Пример #1
0
<?php

$logs = new Model_Mailform_Log();
$logs->order('`read`, datesubmitted DESC');
$logs->where('hidden = ?', 0);
// filter by the given id
if (!empty($_REQUEST['mailformid'])) {
    $logs->where('mailformid = ?', $_REQUEST['mailformid']);
}
$pagination = Pagination::Calculate(count($logs));
$logs->paginate($pagination['page'], $pagination['perpage']);
foreach ($logs->select() as $log) {
    $log['read'] = 1;
    $log->save();
}
$pm->setVariable('log', $logs);
$pm->setVariable('pagination', $pagination);
Пример #2
0
	24 march 2011: cleaned up
	25 march 2011: rewrote to use DAO
	29 march 2011: now using getTotal
*/
// TODO: Consider making a separate admin page for comment sections (i.e., each URL that has a comment plugin)
// TODO: Do it by adding filters at the top
//$comments = Comment::DAOFactory();
$comments = new Model_Comment();
if (defined('COMMENTS_REQUIRE_APPROVAL')) {
    $pm->setVariable('comments_require_approval', COMMENTS_REQUIRE_APPROVAL);
    if (COMMENTS_REQUIRE_APPROVAL) {
        $comments->where('approved = 0');
        $pm->setVariable('totalpending', $comments->getTotal());
        //$comments->resetSelect();
        $comments = new Model_Comment();
    }
}
if (isset($_REQUEST['show']) && 'unapproved' == $_REQUEST['show']) {
    $comments->where('approved = 0');
}
if (isset($_REQUEST['application'])) {
    $comments->select()->where('#__page.application = ?', $_REQUEST['application']);
}
$total = $comments->getTotal();
$comments->order('datecreated DESC');
$comments->setPagination(isset($_REQUEST['page']) ? $_REQUEST['page'] : 1);
$pm->setVariable('comments', $comments);
$page = !empty($_REQUEST['page']) ? $_REQUEST['page'] : 1;
Pagination::Calculate($total, 20, $page);
Пример #3
0
// set category id in template
//$pm->setVariable('categoryid', $settings['categoryid']);
// get articles; limit to this category and valid publication date
$articles = new Model_News_Article();
$categories = new Model_News_Category();
if (isset($settings['categoryid']) && is_array($settings['categoryid']) && count($settings['categoryid']) && !in_array(0, $settings['categoryid'])) {
    $articles->where('news.categoryid IN ?', $settings['categoryid']);
    $categories->where('categoryid IN ?', $settings['categoryid']);
}
$articles->where('pubdate <= ?', Typeframe::Now());
$articles->where('expdate > ? OR expdate = ? OR expdate IS NULL', Typeframe::Now(), '0000-00-00 00:00:00');
$articles->where('status = ?', 'published');
$total = $articles->count();
// set up pagination
$perpage = !empty($settings['perpage']) ? $settings['perpage'] : 20;
$pag = Pagination::Calculate($total, $perpage);
$articles->paginate($pag['page'], $pag['perpage']);
$pm->setVariable('pagination', $pag);
$settings = Typeframe::CurrentPage()->settings();
// add articles, pagination to template
$pm->setVariable('news', $articles);
//$pm->setVariableArray(Pagination::Calculate($articles->getTotal(),
//						$perpage, $articles->getCurrentPage()));
// get categories; limit to the given parent category
//$categories = new News_Category_Factory();
$categories = new Model_News_Category();
//if ($categoryid) $categories->where('parentid IN ?', $categoryid);
//$categories->setParentId($categoryid);
// add parent category to template
/*if ($category)
{
Пример #4
0
 */
// 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);
Пример #5
0
<?php

$entries = new BaseModel_Log();
$entries->order('logid DESC');
$pagination = Pagination::Calculate($entries->getTotal(), 20);
$pm->setVariable('pagination', $pagination);
$entries->paginate($pagination['page'], 20);
$pm->setVariable('entries', $entries);
Пример #6
0
$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;
    }
    $applications[$app->title()] = array('name' => $app->name(), 'base' => $app->base());
}
$pm->setVariable('applications', $applications);