private function Update()
 {
     $Update = new AppYoutube();
     $this->Data['youtube_id'] = $this->Tube;
     $this->Data['youtube_date'] = date('Y-m-d H:i:s');
     $Update->setThis((object) $this->Data);
     if ($Update->Execute()->update(null, 'youtube_id')) {
         $this->Error = ["O video <b>{$this->Data['youtube_title']}</b> foi atualizado com sucesso no sistema!", WS_ACCEPT];
         $this->Result = $Update->Execute()->MaxFild("youtube_id");
     }
 }
    </div>
    <!-- cartilhas -->

    <!-- Canal Youtube -->
    <div class="col-md-12">

        <section class="nomargin section">
            
            <h1 class="nomargin"><a href="https://www.youtube.com/channel/<?php 
echo CANAL;
?>
" target="_blank" class="btn btn-site">Canal do Youtube</a></h1>
            
            <?php 
$AppYou = new AppYoutube();
$AppYou->Execute()->Query("youtube_status = 1 ORDER BY youtube_date DESC LIMIT :limit OFFSET :offset", "limit=2&offset=0", true);
if (!$AppYou->Execute()->getResult()) {
    echo "<div style='display: block;margin-top:40px;'>\n";
    WSErro("Desculpe, não temos videos no momento, favor volte mais tarde!", WS_INFOR);
    echo "</div>\n";
} else {
    foreach ($AppYou->Execute()->getResult() as $row) {
        $row->datetime = date('Y-m-d', strtotime($row->youtube_date));
        $row->pubdate = date("d/m/Y H:i", strtotime($row->youtube_date));
        $View->Show((array) $row, $youtube);
    }
}
?>
        </section>
    </div>
Example #3
0
        <header>
            <h1>Atualizar Post:</h1>
        </header>

        <?php 
$tube = filter_input_array(INPUT_POST, FILTER_DEFAULT);
$tubeId = filter_input(INPUT_GET, 'tubeId', FILTER_VALIDATE_INT);
if (isset($tube) && $tube['SendPostForm']) {
    $tube['youtube_status'] = $tube['SendPostForm'] == 'Atualizar' ? '0' : '1';
    unset($tube['SendPostForm']);
    require_once '_models/AdminYoutube.class.php';
    $cadastra = new AdminYoutube();
    $cadastra->ExeUpdate($tubeId, $tube);
    WSErro($cadastra->getError()[0], $cadastra->getError()[1]);
} else {
    $Read = new AppYoutube();
    $Read->setYoutube_id($tubeId);
    $Read->Execute()->find();
    if (!$Read->Execute()->getResult()) {
        header('Location: painel.php?exe=youtube/index&empty=true');
    } else {
        $tube = (array) $Read->Execute()->getResult();
        $tube['youtube_date'] = date('d/m/Y H:i:s', strtotime($tube['youtube_date']));
    }
}
$checkCreate = filter_input(INPUT_GET, 'create', FILTER_VALIDATE_BOOLEAN);
if ($checkCreate && empty($cadastra)) {
    WSErro("O video <b>{$tube['youtube_title']}</b> foi cadastrado com sucesso no sistema, continue alterando o mesmo!", WS_ACCEPT);
}
?>