本文整理汇总了PHP中Skin::navigate方法的典型用法代码示例。如果您正苦于以下问题:PHP Skin::navigate方法的具体用法?PHP Skin::navigate怎么用?PHP Skin::navigate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Skin
的用法示例。
在下文中一共展示了Skin::navigate方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
// we have an array to format
if (is_array($text)) {
$text =& Skin::build_list($text, '2-columns');
}
// navigation commands for categories, if necessary
if ($stats['count'] > CATEGORIES_PER_PAGE) {
$menu = array('_count' => Skin::build_number($stats['count'], i18n::s('categories')));
$home = 'categories/';
if ($context['with_friendly_urls'] == 'Y') {
$prefix = $home . 'index.php/';
} elseif ($context['with_friendly_urls'] == 'R') {
$prefix = $home;
} else {
$prefix = $home . '?page=';
}
$menu = array_merge($menu, Skin::navigate($home, $prefix, $stats['count'], CATEGORIES_PER_PAGE, $page));
// add a menu at the bottom
$text .= Skin::build_list($menu, 'menu_bar');
}
// make a box
if ($text) {
$text =& Skin::build_box('', $text, 'header1', 'categories');
}
// associates may list specific categories as well
if ($page == 1 && Surfer::is_associate()) {
// query the database and layout that stuff
if ($items = Categories::list_inactive_by_title(0, 25)) {
// we have an array to format
if (is_array($items)) {
$items = Skin::build_list($items, '2-columns');
}
示例2: array
if (is_object($layout)) {
$items_per_page = $layout->items_per_page();
} else {
$items_per_page = FILES_PER_PAGE;
}
// the first file to list
$offset = ($page - 1) * $items_per_page;
if (is_object($layout) && method_exists($layout, 'set_offset')) {
$layout->set_offset($offset);
}
// a navigation bar for these files
if ($count = Files::count_for_anchor($anchor->get_reference())) {
$context['page_menu'] += array('_count' => sprintf(i18n::ns('%d file', '%d files', $count), $count));
// navigation commands for files
$prefix = Files::get_url($anchor->get_reference(), 'navigate');
$context['page_menu'] += Skin::navigate($anchor->get_url('files'), $prefix, $count, $items_per_page, $page, FALSE);
// list files by date or by title
if ($anchor->has_option('files_by') == 'title') {
$items = Files::list_by_title_for_anchor($anchor->get_reference(), $offset, $items_per_page, $anchor->get_reference());
} else {
$items = Files::list_by_date_for_anchor($anchor->get_reference(), $offset, $items_per_page, $anchor->get_reference());
}
// actually render the html
if (is_array($items)) {
$context['text'] .= Skin::build_list($items, 'decorated');
} elseif (is_string($items)) {
$context['text'] .= $items;
}
}
// insert anchor suffix
if (is_object($anchor)) {
示例3: elseif
$offset = ($zoom_index - 1) * LINKS_PER_PAGE;
if (Articles::has_option('links_by_title', $anchor, $item)) {
$items = Links::list_by_title_for_anchor('article:' . $item['id'], $offset, LINKS_PER_PAGE);
} else {
$items = Links::list_by_date_for_anchor('article:' . $item['id'], $offset, LINKS_PER_PAGE);
}
// actually render the html
if (is_array($items)) {
$box['text'] .= Skin::build_list($items, 'decorated');
} elseif (is_string($items)) {
$box['text'] .= $items;
}
// navigation commands for links
$home = Articles::get_permalink($item);
$prefix = Articles::get_url($item['id'], 'navigate', 'links');
$box['bar'] += Skin::navigate($home, $prefix, $count, LINKS_PER_PAGE, $zoom_index);
// new links are allowed
if ($cur_article->allows('creation', 'link')) {
Skin::define_img('LINKS_ADD_IMG', 'links/add.gif');
$box['bar'] += array('links/edit.php?anchor=' . urlencode('article:' . $item['id']) => LINKS_ADD_IMG . i18n::s('Add a link'));
}
}
// there is some box content
if ($box['text']) {
$canvas['links'] = Skin::build_content('links', i18n::s('Links'), $box['text'], $box['bar']);
}
$canvas['links_count'] = $count;
}
//
// trailer information
//
示例4: elseif
$offset = ($zoom_index - 1) * LINKS_PER_PAGE;
if (preg_match('/\\blinks_by_title\\b/i', $item['options'])) {
$items = Links::list_by_title_for_anchor('section:' . $item['id'], $offset, LINKS_PER_PAGE, 'no_anchor');
} else {
$items = Links::list_by_date_for_anchor('section:' . $item['id'], $offset, LINKS_PER_PAGE, 'no_anchor');
}
// actually render the html
if (is_array($items)) {
$box['text'] .= Skin::build_list($items, 'rows');
} elseif (is_string($items)) {
$box['text'] .= $items;
}
// navigation commands for links
$home = Sections::get_permalink($item);
$prefix = Sections::get_url($item['id'], 'navigate', 'links');
$box['bar'] = array_merge($box['bar'], Skin::navigate($home, $prefix, $count, LINKS_PER_PAGE, $zoom_index));
}
// new links are allowed -- check option 'with_links'
if (Links::allow_creation($item, $anchor, 'section')) {
Skin::define_img('LINKS_ADD_IMG', 'links/add.gif');
$box['bar'] += array('links/edit.php?anchor=' . urlencode('section:' . $item['id']) => LINKS_ADD_IMG . i18n::s('Add a link'));
}
// integrate commands
if (count($box['bar'])) {
$box['text'] = Skin::build_list($box['bar'], 'menu_bar') . $box['text'];
}
// there is some box content
if (trim($box['text'])) {
$attachments .= Skin::build_box(i18n::s('Links'), $box['text'], 'header1', 'links');
}
}
示例5: layout_newest
//.........这里部分代码省略.........
$text .= $overlay->get_text('view', $item);
}
// the beautified description, which is the actual page body
if ($item['description']) {
// use adequate label
if (is_object($overlay) && ($label = $overlay->get_label('description'))) {
$text .= Skin::build_block($label, 'title');
}
$text .= Skin::build_block($item['description'], 'description', '', $item['options']);
}
//
// list related files
//
// if this surfer is an editor of this article, show hidden files as well
if (Articles::is_assigned($item['id']) || is_object($anchor) && $anchor->is_assigned()) {
Surfer::empower();
}
// build a complete box
$box['bar'] = array();
$box['text'] = '';
// count the number of files in this article
if ($count = Files::count_for_anchor('article:' . $item['id'])) {
if ($count > 20) {
$box['bar'] += array('_count' => sprintf(i18n::ns('%d file', '%d files', $count), $count));
}
// list files by date (default) or by title (option files_by_title)
if (Articles::has_option('files_by', $anchor, $item) == 'title') {
$items = Files::list_by_title_for_anchor('article:' . $item['id'], 0, FILES_PER_PAGE, 'article:' . $item['id']);
} else {
$items = Files::list_by_date_for_anchor('article:' . $item['id'], 0, FILES_PER_PAGE, 'article:' . $item['id']);
}
if (is_array($items)) {
$box['text'] .= Skin::build_list($items, 'decorated');
}
// navigation commands for files
$prefix = Articles::get_url($item['id'], 'navigate', 'files');
$box['bar'] += Skin::navigate($url, $prefix, $count, FILES_PER_PAGE, 0);
// the command to post a new file, if allowed
if (Files::allow_creation($item, $anchor, 'article')) {
$link = 'files/edit.php?anchor=' . urlencode('article:' . $item['id']);
$box['bar'] += array($link => i18n::s('Add a file'));
}
if (is_array($box['bar'])) {
$box['text'] .= Skin::build_list($box['bar'], 'menu_bar');
}
}
// actually render the html for this box
if ($box['text']) {
$text .= Skin::build_box(i18n::s('Files'), $box['text'], 'header1', 'files');
}
//
// bottom page menu
//
// discuss this page, if the index page can be commented, and comments are accepted at the article level
if (Comments::allow_creation($item, $anchor)) {
$this->menu[] = Skin::build_link(Comments::get_url('article:' . $item['id'], 'comment'), i18n::s('Post a comment'), 'span');
}
// info on related comments
if ($count = Comments::count_for_anchor('article:' . $item['id'])) {
$this->menu[] = Skin::build_link(Comments::get_url('article:' . $item['id'], 'list'), sprintf(i18n::ns('%d comment', '%d comments', $count), $count), 'span');
}
// new links are accepted at the index page and at the article level
if (Links::allow_trackback()) {
$this->menu[] = Skin::build_link('links/trackback.php?anchor=' . urlencode('article:' . $item['id']), i18n::s('Reference this page'), 'span');
}
// info on related links
if ($count = Links::count_for_anchor('article:' . $item['id'])) {
$this->menu[] = Skin::build_link($url . '#_attachments', sprintf(i18n::ns('%d link', '%d links', $count), $count), 'span');
}
// new files are accepted at the index page and at the article level
if (is_object($anchor) && $anchor->has_option('with_files') && !($anchor->has_option('no_files') || preg_match('/\\bno_files\\b/i', $item['options']))) {
// add a file
if (Files::allow_creation($item, $anchor, 'article')) {
if ($context['with_friendly_urls'] == 'Y') {
$link = 'files/edit.php/article/' . $item['id'];
} else {
$link = 'files/edit.php?anchor=' . urlencode('article:' . $item['id']);
}
$this->menu[] = Skin::build_link($link, i18n::s('Add a file'), 'span');
}
}
// modify this page
if (Surfer::is_empowered()) {
$this->menu[] = Skin::build_link(Articles::get_url($item['id'], 'edit'), i18n::s('Edit'), 'span');
}
// view permalink
if (Surfer::is_empowered()) {
$this->menu[] = Skin::build_link($url, i18n::s('Permalink'), 'span');
}
// insert overlay data, if any
if (is_object($overlay)) {
$text .= $overlay->get_text('trailer', $item);
}
// add trailer information from this item, if any
if (isset($item['trailer']) && trim($item['trailer'])) {
$text .= Codes::beautify($item['trailer']);
}
// returned the formatted content
return $text;
}
示例6: elseif
// stop hackers
if ($page > 1 && ($page - 1) * $items_per_page > $stats['count']) {
Safe::header('Status: 401 Unauthorized', TRUE, 401);
Logger::error(i18n::s('You are not allowed to perform this operation.'));
} else {
// navigation commands for articles, if necessary
if ($stats['count'] > $items_per_page) {
$home = 'articles/';
if ($context['with_friendly_urls'] == 'Y') {
$prefix = $home . 'index.php/';
} elseif ($context['with_friendly_urls'] == 'R') {
$prefix = $home;
} else {
$prefix = $home . '?page=';
}
$context['page_menu'] += Skin::navigate($home, $prefix, $stats['count'], $items_per_page, $page);
}
// page main content
$cache_id = 'articles/index.php#text#' . $page;
if (!($text = Cache::get($cache_id))) {
// query the database and layout that stuff
$offset = ($page - 1) * $items_per_page;
if ($text =& Articles::list_by('publication', $offset, $items_per_page)) {
// we have an array to format
if (is_array($text)) {
$text =& Skin::build_list($text, 'decorated');
}
}
// cache this to speed subsequent queries
Cache::put($cache_id, $text, 'articles');
}
示例7: render
/**
* list dates at some anchor
*
* @param string type of replaced items (e.g., 'articles')
* @param string the anchor to consider (e.g., 'section:123')
* @param int page index
* @return string to be inserted in resulting web page, or NULL
*/
function render($type, $anchor, $page = 1)
{
global $context;
// instead of articles
if ($type != 'articles') {
return NULL;
}
// get the containing page
$container = Anchors::get($anchor);
// handle dates
include_once $context['path_to_root'] . 'dates/dates.php';
// the maximum number of articles per page
if (!defined('DATES_PER_PAGE')) {
define('DATES_PER_PAGE', 50);
}
// where we are
$offset = ($page - 1) * DATES_PER_PAGE;
// should we display all dates, or not?
$with_past_dates = FALSE;
if (preg_match('/\\bwith_past_dates\\b/i', $this->attributes['overlay_parameters'])) {
$with_past_dates = TRUE;
}
// menu to be displayed at the top
$menu = array();
// empowered users can contribute
if (Articles::allow_creation(NULL, $container)) {
Skin::define_img('ARTICLES_ADD_IMG', 'articles/add.gif');
$menu[] = '<div style="display: inline">' . Skin::build_link('articles/edit.php?anchor=' . urlencode($anchor), ARTICLES_ADD_IMG . i18n::s('Add an event'), 'span') . '</div>';
}
// ensure access to past dates
if (!$with_past_dates && ($items = Dates::list_past_for_anchor($anchor, $offset, DATES_PER_PAGE, 'compact'))) {
// turn an array to a string
if (is_array($items)) {
$items =& Skin::build_list($items, 'compact');
}
// navigation bar
$bar = array();
// count the number of dates in this section
$stats = Dates::stat_past_for_anchor($anchor);
if ($stats['count'] > DATES_PER_PAGE) {
$bar = array_merge($bar, array('_count' => sprintf(i18n::ns('%d date', '%d dates', $stats['count']), $stats['count'])));
}
// navigation commands for dates
if ($section = Sections::get(str_replace('section:', '', $anchor))) {
$home = Sections::get_permalink($section);
$prefix = Sections::get_url($section['id'], 'navigate', 'articles');
$bar = array_merge($bar, Skin::navigate($home, $prefix, $stats['count'], DATES_PER_PAGE, $page));
}
// display the bar
if (is_array($bar)) {
$items = Skin::build_list($bar, 'menu_bar') . $items;
}
// in a separate box
$menu[] = Skin::build_sliding_box(i18n::s('Past dates'), $items, 'past_dates', TRUE);
}
// menu displayed towards the top of the page
$text = Skin::finalize_list($menu, 'menu_bar');
// build a list of events
if (preg_match('/\\blayout_as_list\\b/i', $this->attributes['overlay_parameters'])) {
// list all dates
if ($with_past_dates) {
// navigation bar
$bar = array();
// count the number of dates in this section
$stats = Dates::stat_for_anchor($anchor);
if ($stats['count'] > DATES_PER_PAGE) {
$bar = array_merge($bar, array('_count' => sprintf(i18n::ns('%d date', '%d dates', $stats['count']), $stats['count'])));
}
// navigation commands for dates
$section = Sections::get($anchor);
$home = Sections::get_permalink($section);
$prefix = Sections::get_url($section['id'], 'navigate', 'articles');
$bar = array_merge($bar, Skin::navigate($home, $prefix, $stats['count'], DATES_PER_PAGE, $page));
// display the bar
if (count($bar)) {
$text .= Skin::build_list($bar, 'menu_bar');
}
// list one page of dates
if ($items = Dates::list_for_anchor($anchor, $offset, DATES_PER_PAGE, 'family')) {
$text .= $items;
}
// display only future dates to regular surfers
} else {
// show future dates on first page
if ($page == 1 && ($items = Dates::list_future_for_anchor($anchor, 0, 500, 'family', TRUE))) {
$text .= $items;
}
}
// deliver a calendar view for current month, plus months around
} else {
// show past dates as well
if ($with_past_dates) {
//.........这里部分代码省略.........
示例8: array
}
// a navigation bar for these comments
if ($count = Comments::count_for_anchor('article:' . $item['id'])) {
$discussion_count = $count;
$box['bottom'] += array('_count' => sprintf(i18n::ns('%d comment', '%d comments', $count), $count));
// list comments by date
$items = Comments::list_by_date_for_anchor('article:' . $item['id'], $offset, $items_per_page, $layout, TRUE);
// actually render the html
if (is_array($items)) {
$box['text'] .= Skin::build_list($items, 'rows');
} elseif (is_string($items)) {
$box['text'] .= $items;
}
// navigation commands for comments
$prefix = Comments::get_url('article:' . $item['id'], 'navigate');
$box['bottom'] += Skin::navigate(NULL, $prefix, $count, $items_per_page, $zoom_index, FALSE, TRUE);
}
// build a box
if ($box['text']) {
$discussion .= Skin::build_content('comments', '', $box['text'], $box['top'], $box['bottom']);
}
}
// display in a separate panel
if ($discussion) {
$label = i18n::s('Discussion');
if ($discussion_count) {
$label .= ' (' . $discussion_count . ')';
}
$panels[] = array('discussion', $label, 'discussion_panel', $discussion);
}
//
示例9: layout
//.........这里部分代码省略.........
$text .= Skin::build_content('files', i18n::s('Files'), $box['text'], $box['bar']);
}
// list of comments
$title_label = '';
if (is_object($anchor)) {
$title_label = ucfirst($overlay->get_label('list_title', 'comments'));
}
if (!$title_label) {
$title_label = i18n::s('Comments');
}
// no layout yet
$layout = NULL;
// label to create a comment
$add_label = '';
if (is_object($overlay)) {
$add_label = $overlay->get_label('new_command', 'comments');
}
if (!$add_label) {
$add_label = i18n::s('Post a comment');
}
// get a layout from anchor
$layout =& Comments::get_layout($anchor, $item);
// provide author information to layout
if (is_object($layout) && isset($item['create_id']) && $item['create_id']) {
$layout->set_focus('user:' . $item['create_id']);
}
// the maximum number of comments per page
if (is_object($layout)) {
$items_per_page = $layout->items_per_page();
} else {
$items_per_page = COMMENTS_PER_PAGE;
}
// the first comment to list
$offset = 0;
if (is_object($layout) && method_exists($layout, 'set_offset')) {
$layout->set_offset($offset);
}
// build a complete box
$box = array('bar' => array(), 'prefix_bar' => array(), 'text' => '');
// feed the wall
if (Comments::allow_creation($item, $anchor)) {
$box['text'] .= Comments::get_form('article:' . $item['id']);
}
// a navigation bar for these comments
if ($count = Comments::count_for_anchor('article:' . $item['id'])) {
if ($count > 20) {
$box['bar'] += array('_count' => sprintf(i18n::ns('%d comment', '%d comments', $count), $count));
}
// list comments by date
$items = Comments::list_by_date_for_anchor('article:' . $item['id'], $offset, $items_per_page, $layout, TRUE);
// actually render the html
if (is_array($items)) {
$box['text'] .= Skin::build_list($items, 'rows');
} elseif (is_string($items)) {
$box['text'] .= $items;
}
// navigation commands for comments
$prefix = Comments::get_url('article:' . $item['id'], 'navigate');
$box['bar'] = array_merge($box['bar'], Skin::navigate(NULL, $prefix, $count, $items_per_page, $zoom_index));
}
// ensure that the surfer can change content
if (Articles::allow_modification($item, $anchor)) {
// view or modify this section
$menu = array();
$box['bar'] += array(Articles::get_permalink($item) => i18n::s('View the page'));
if (!is_object($overlay) || !($label = $overlay->get_label('edit_command', 'articles'))) {
$label = i18n::s('Edit this page');
}
$box['bar'] += array(Articles::get_url($item['id'], 'edit') => $label);
}
// show commands
if (count($box['bar'])) {
// commands before the box
$box['text'] = Skin::build_list($box['prefix_bar'], 'menu_bar') . $box['text'];
// append the menu bar at the end
$box['text'] .= Skin::build_list($box['bar'], 'menu_bar');
}
// build a box
if ($box['text']) {
// put a title if there are other titles or if more than 2048 chars
$title = '';
if (preg_match('/(<h1|<h2|<h3|<table|\\[title|\\[subtitle)/i', $context['text'] . $text) || strlen($context['text'] . $text) > 2048) {
$title = $title_label;
}
// insert a full box
$text .= Skin::build_box($title, $box['text'], 'header1', 'comments');
}
// assemble the full panel
$panels[] = array('att' . $item['id'], ucfirst(Skin::strip($item['title'], 30)), 'atc' . $item['id'], $text);
}
// there is some box content
if (trim($box['text'])) {
$text .= $box['text'];
}
// format tabs
$text = Skin::build_tabs($panels);
// end of processing
SQL::free($result);
return $text;
}
示例10: array
$box['top'] += array('sections/new.php' => SECTIONS_ADD_IMG . i18n::s('Create a new web space'));
}
// associates can assign editors and readers
if (Surfer::is_associate()) {
Skin::define_img('SECTIONS_SELECT_IMG', 'sections/select.gif');
$box['top'] += array('sections/select.php?anchor=user:' . $item['id'] => SECTIONS_SELECT_IMG . i18n::s('Assign sections'));
}
// count the number of articles for this user
$count = Sections::count_for_user($item['id']);
if ($count) {
$box['bottom'] += array('_count' => sprintf(i18n::ns('%d section', '%d sections', $count), $count));
}
// navigation commands for articles
$home = Users::get_permalink($item);
$prefix = Users::get_url($item['id'], 'navigate', 'sections');
$box['bottom'] = array_merge($box['bottom'], Skin::navigate($home, $prefix, $count, SECTIONS_PER_PAGE, $zoom_index));
// append a menu bar before the list
$box['top'] = array_merge($box['top'], $box['bottom']);
if (count($box['top'])) {
$box['text'] .= Skin::build_list($box['top'], 'menu_bar');
}
// compute offset from list beginning
$offset = ($zoom_index - 1) * SECTIONS_PER_PAGE;
// list assigned by title
$layout = Layouts::new_('rights', 'section');
$layout->set_focus($item['id']);
$items =& Sections::list_by_date_for_user($item['id'], $offset, SECTIONS_PER_PAGE, $layout);
if (is_array($items)) {
$box['text'] .= Skin::build_list($items, 'compact');
} elseif ($items) {
$box['text'] .= $items;
示例11: layout
//.........这里部分代码省略.........
$this_section = new section();
$this_section->load_by_content($item, $anchor);
if ($this_section->is_assigned()) {
if ($order == 'publication' && ($items =& Articles::list_for_anchor_by('draft', 'section:' . $item['id'], 0, 20, 'compact'))) {
if (is_array($items)) {
$items = Skin::build_list($items, 'compact');
}
$box['top_bar'] += array('_draft' => Skin::build_sliding_box(i18n::s('Draft pages'), $items));
}
}
// top menu
if ($box['top_bar']) {
$box['text'] .= Skin::build_list($box['top_bar'], 'menu_bar');
}
// get pages
$items =& Articles::list_for_anchor_by($order, 'section:' . $item['id'], $offset, $items_per_page, $layout);
// items in the middle
if (is_array($items) && isset($item['articles_layout']) && $item['articles_layout'] == 'compact') {
$box['text'] .= Skin::build_list($items, 'compact');
} elseif (is_array($items)) {
$box['text'] .= Skin::build_list($items, 'decorated');
} elseif (is_string($items)) {
$box['text'] .= $items;
}
// no navigation bar with alistapart
if (!isset($item['articles_layout']) || $item['articles_layout'] != 'alistapart') {
// count the number of articles in this section
if ($count = Articles::count_for_anchor('section:' . $item['id'])) {
if ($count > 20) {
$box['bottom_bar'] += array('_count' => sprintf(i18n::ns('%d page', '%d pages', $count), $count));
}
// navigation commands for articles
$home = Sections::get_permalink($item);
$prefix = Sections::get_url($item['id'], 'navigate', 'articles');
$box['bottom_bar'] += Skin::navigate($home, $prefix, $count, $items_per_page, 1);
}
}
// bottom menu
if ($box['bottom_bar']) {
$box['text'] .= Skin::build_list($box['bottom_bar'], 'menu_bar');
}
// there is some box content
if ($box['text']) {
$text .= $box['text'];
}
}
// layout sub-sections
if (!isset($item['sections_layout']) || $item['sections_layout'] != 'none') {
// select a layout
if (!isset($item['sections_layout']) || !$item['sections_layout']) {
include_once 'layout_sections.php';
$layout = new Layout_sections();
} else {
$layout = Layouts::new_($item['sections_layout'], 'section');
}
// the maximum number of sections per page
if (is_object($layout)) {
$items_per_page = $layout->items_per_page();
} else {
$items_per_page = SECTIONS_PER_PAGE;
}
// build a complete box
$box = array('top_bar' => array(), 'text' => '', 'bottom_bar' => array());
// the command to add a new section
//if(Sections::allow_creation($item, $anchor)) {
if ($anchor->allows('creation', 'section')) {