コード例 #1
0
ファイル: pages.php プロジェクト: nathanieltite/elefant
<?php

$this->require_admin();
$page->layout = 'admin';
$page->title = i18n_get('All Pages');
$limit = 20;
$_GET['offset'] = isset($_GET['offset']) ? $_GET['offset'] : 0;
$lock = new Lock();
$pages = Webpage::query('id, title, access')->order('title asc')->fetch_orig($limit, $_GET['offset']);
$count = Webpage::query()->count();
foreach ($pages as $k => $p) {
    $pages[$k]->locked = $lock->exists('Webpage', $p->id);
}
echo $tpl->render('admin/pages', array('pages' => $pages, 'count' => $count, 'offset' => $_GET['offset'], 'more' => $count > $_GET['offset'] + $limit ? true : false, 'prev' => $_GET['offset'] - $limit, 'next' => $_GET['offset'] + $limit));
コード例 #2
0
ファイル: links.php プロジェクト: Selwyn-b/elefant
<?php

/**
 * Returns a list of internal page links to the WYSIWYG editor's
 * link dialog.
 *
 * Note: Only includes public pages.
 */
function admin_links_sort($a, $b)
{
    if ($a['title'] == $b['title']) {
        return 0;
    }
    return $a['title'] < $b['title'] ? -1 : 1;
}
$page->layout = false;
$menu = Webpage::query('id, title, menu_title')->where('access', 'public')->fetch_orig();
$out = array();
foreach ($menu as $pg) {
    $mt = !empty($pg->menu_title) ? $pg->menu_title : $pg->title;
    $out[] = array('url' => Link::href($pg->id), 'title' => $mt);
}
usort($out, 'admin_links_sort');
echo json_encode($out);
コード例 #3
0
ファイル: pages.php プロジェクト: Selwyn-b/elefant
<?php

/**
 * Show a list of all pages for admins.
 */
$this->require_acl('admin', 'admin/pages');
$page->layout = 'admin';
$page->title = __('Web Pages');
$limit = 20;
$num = isset($_GET['offset']) ? $_GET['offset'] : 1;
$offset = ($num - 1) * $limit;
$q = isset($_GET['q']) ? $_GET['q'] : '';
// search query
$q_fields = array('id', 'title', 'menu_title', 'window_title', 'access', 'keywords', 'description', 'body');
$q_exact = array('id', 'title', 'access');
$url = !empty($q) ? '/admin/pages?q=' . urlencode($q) . '&offset=%d' : '/admin/pages?offset=%d';
$lock = new Lock();
$pages = Webpage::query('id, title, access')->where_search($q, $q_fields, $q_exact)->order('title asc')->fetch_orig($limit, $offset);
$count = Webpage::query()->where_search($q, $q_fields, $q_exact)->count();
foreach ($pages as $k => $p) {
    $pages[$k]->locked = $lock->exists('Webpage', $p->id);
}
echo $tpl->render('admin/pages', array('limit' => $limit, 'total' => $count, 'pages' => $pages, 'count' => count($pages), 'url' => $url, 'q' => $q));