*/ // get sorting options list($sort_options, $sort, $order) = News::GetAdminSortingOptions(); // set sorting in template $pm->setVariable('sort_options', $sort_options); $pm->setVariable('sort', $sort); if (!empty($_REQUEST['pageid'])) { $page = Model_Page::Get($_REQUEST['pageid']); if (!$page->exists() || $page['application'] != 'News' && $page['application'] != 'News RSS') { Typeframe::Redirect('Invalid page specified.', Typeframe::CurrentPage()->applicationUri(), 1); return; } $pm->setVariable('currentpage', $page); } $newspages = new Model_Page(); $newspages->where('application = ?', 'News'); $pm->setVariable('newspages', $newspages); $articles = new Model_News_Article(); $total = $articles->count(); if (!empty($_REQUEST['status'])) { $articles->where('status = ?', $_REQUEST['status']); } $articles->order($order); // set up pagination $page = @$_REQUEST['page'] && ctype_digit($_REQUEST['page']) ? intval($_REQUEST['page']) : 1; $perpage = isset($settings['perpage']) ? $settings['perpage'] : 10; //$articles->setPagination($page, $perpage); $articles->paginate($page, $perpage); // add pagination, articles to template $pm->setVariable('pagination', Pagination::Calculate($total, $perpage, $page)); $pm->setVariable('news', $articles);