public static function GetCategoryUri($categoryid) { static $categories = null; if (is_null($categories)) { // Get all URIs and associated categories $categories = array(); $pages = new Model_Page(); $pages->where('application = ?', 'News'); foreach ($pages->getAll() as $page) { $settings = $page->get('settings'); $uri = $page->get('uri'); // This news page only includes certain categories if (isset($settings['categoryid']) && !in_array(0, $settings['categoryid'])) { foreach ($settings['categoryid'] as $cid) { $categories[$cid] = $uri; } } else { $categories[0] = $uri; } } } // There is a page that explicitly includes this category if (isset($categories[$categoryid])) { return $categories[$categoryid]; } // There is a page that includes all categories if (isset($categories[0])) { return $categories[0]; } // There is no page for this category return null; }
public function testContentPageAdmin() { $this->logIn(); $this->get(TYPEF_WEB_DIR . '/admin/content'); $this->getAssets(); $pages = new Model_Page(); $pages->where('application = ?', 'Content'); foreach ($pages->getAll() as $page) { $this->get(TYPEF_WEB_DIR . '/admin/content/page?pageid=' . $page['pageid']); $this->getAssets(); } }
public function pageAction() { $this->view->menu_page = 'selected'; $this->view->item = $this->_getParam('item', 'new'); $this->view->lang = $this->_getParam('lang', 'ua'); $this->view->pages = Model_Page::getAll(); $this->view->galleries = Model_Gallery::getAll('image'); $this->view->videos = Model_Gallery::getAll('video'); $this->view->audios = Model_Gallery::getAll('audio'); $this->view->actionname = '/admin/savepage'; $this->view->idname = 'idpage'; //перевіряємо на видалення $delete = $this->_getParam('delete', false); if ($delete && Zend_Validate::is($this->view->item, 'Digits')) { Model_Page::deletepage($this->view->item); $this->_redirect('/admin/page'); } // якщо треба отримати дані за id сторінки if (Zend_Validate::is($this->view->item, 'Digits')) { $this->view->data = Model_Page::getById($this->view->item, $this->view->lang); } else { $this->view->data = Model_Page::getById(NULL); } }
*/ // save typing below $typef_app_dir = TYPEF_WEB_DIR . '/admin/pages'; // validate the incoming page id (for pagination) $page = @$_REQUEST['page']; if (!$page || $page < 1) { $page = 1; } $pm->setVariable('page', $page); // get all pages; sort by nickname and uri; paginate $pages = new Model_Page(); $pages->where('siteid = ?', Typeframe::CurrentPage()->siteid()); $pages->order('nickname, uri'); $pages->setPagination($page, 300); // add pages to template; set up pagination foreach ($pages->getAll() as $page) { if (Typeframe::Registry()->application($page['application'])) { //$page['admin'] = Typeframe::Registry()->application($page['application'])->admin(); } else { trigger_error("Application '{$page['application']}' is not registered"); } $pm->addLoop('pages', $page); } //$pm->setVariable('totalpages', $pages->getTotalPages()); //$pm->setVariable('pagedurl', $typef_app_dir); $pm->setVariableArray(Pagination::Calculate($pages->count(), 100, $pm->getVariable('page'), $typef_app_dir)); // add applications to template $applications = array(); foreach (Typeframe::Registry()->applications() as $app) { if (!preg_match('/ Admin$/', $app->name())) { continue;