static function simple($firstPage, $currentPage, $lastPage) { // setup registry $reg = new registry(); $reg['first'] = $firstPage; $reg['previous'] = $currentPage <= $firstPage ? $firstPage : $currentPage - 1; $reg['next'] = $currentPage >= $lastPage ? $lastPage : $currentPage + 1; $reg['last'] = $lastPage; // look for project view file $srcView = sprintf('%s/pagerSimple.phtml', VIEW); // if fail, fallback to mwa version if (!file_exists($srcView)) { $srcView = sprintf('%s/view/pagerSimple.phtml', LIBRARY); } // if fallback not found, throw error. if (!file_exists($srcView)) { throw new Exception('the given file ' . $srcView . ' was not found.'); } // init and exec view $view = new view($srcView); return $view->compile($reg); }
<?php /** * fotoalbum.php * * photoalbum admin page * @author Anders Ytterström <*****@*****.**> * @since 2007-12-29 */ require '../../../init.php'; if (!isset($_POST['delete'])) { http_response::redir('/admin/fotoalbum'); } $registry =& registry::getInstance(); $user =& user::getInstance(); $view = new view(ROOT . '/view/admin/photos/delete.phtml'); $model = new model_photos(); if (!$user->isOnline()) { http_response::redir('/login.php'); } $registry['sidebar'] = false; $registry['delete'] = $_POST['delete']; echo $view->compile();
<?php $user = user::getInstance(); $registry = registry::getInstance(); // validate model and construct if correct. $registry['modelLabel'] = http_request::getString('model'); if ($registry['modelLabel'] == false || !file_exists(ROOT . '/model/' . $registry['modelLabel'] . ".php")) { throw new Exception("the model <b>" . $registry['modelLabel'] . "</b> does not exist in this application. It could have been removed, or has ever existed. Check the spelling and try again."); } $qryModel = "model_" . $registry['modelLabel']; $model = new $qryModel(); // needed for the page header. admin::getModels(); $registry['controls'] = $model->getEntityProperties(); // setup page $registry['entities'] = $model->getSummary(); $registry['title'] = $registry['modelLabel']; $registry['bclass'] = $registry['modelLabel'] . " list model"; //see if there is any custom template. Else,fall back on default. $ct = sprintf("%s/view/cms/list/%s.phtml", ROOT, $registry['modelLabel']); if (!file_exists($ct)) { $ct = sprintf("%s/list/%s.phtml", VIEW, $registry['modelLabel']); } if (file_exists($ct)) { $view = new view($ct); $view->isFragment(); $registry['customList'] = $view->compile(); }
static function generate() { $form = new view(SITE . '/view/form/normal.phtml'); $form->isFragment = true; return $form->compile(); }