<?php use App\CoreUtils; use App\Episodes; use App\Pagination; use App\Permission; /** @var $do string */ $Pagination = new Pagination('episodes', 10, $Database->where('season != 0')->count('episodes')); CoreUtils::fixPath("/episodes/{$Pagination->page}"); $heading = "Episodes"; $title = "Page {$Pagination->page} - {$heading}"; $Episodes = Episodes::get($Pagination->getLimit()); if (isset($_GET['js'])) { $Pagination->respond(Episodes::getTableTbody($Episodes), '#episodes tbody'); } $settings = array('title' => $title, 'do-css', 'js' => array('paginate', $do)); if (Permission::sufficient('staff')) { $settings['js'] = array_merge($settings['js'], array('moment-timezone', "{$do}-manage")); } CoreUtils::loadPage($settings);
?> </tbody> </table> <? } echo $Pagination; $Movies = $Database->where('season', 0)->orderBy('episode','DESC')->get('episodes'); ?> <h1>Movies</h1> <? if (empty($Episodes)){ ?> <p>There are no movies stored in the database</p> <? } if (Permission::sufficient('staff')) { ?> <div class="actions"> <button id="add-movie" class="green typcn typcn-plus">Add Movie</button> </div> <? } if (!empty($Episodes) || (empty($Episodes) && Permission::sufficient('staff'))){ ?> <table id="movies"> <thead> <tr> <th><span class="mobile-hide">Overall </span>#</th> <th>Title & Air Date</th> </tr> </thead> <tbody><?php echo Episodes::getTableTbody($Movies, true); ?> </tbody> </table> <? } ?> </div>