本文整理汇总了PHP中Skin::build_sliding_box方法的典型用法代码示例。如果您正苦于以下问题:PHP Skin::build_sliding_box方法的具体用法?PHP Skin::build_sliding_box怎么用?PHP Skin::build_sliding_box使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Skin
的用法示例。
在下文中一共展示了Skin::build_sliding_box方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
if ($box['text']) {
$text .= $box['text'];
}
}
}
// associates may list special sections as well
if (!$zoom_type && Surfer::is_empowered()) {
// inactive sections, if any
$items = Sections::list_inactive_by_title_for_anchor('section:' . $item['id'], 0, 50, 'compact');
// we have an array to format
if (count($items)) {
$items =& Skin::build_list($items, 'compact');
}
// displayed as another box
if ($items) {
$context['page_menu'] += array('_other_sections' => Skin::build_sliding_box(i18n::s('Other sections'), $items, NULL, TRUE, TRUE));
}
}
// trailer information
//
// add trailer information from the overlay, 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']);
}
// insert anchor suffix
if (is_object($anchor)) {
$text .= $anchor->get_suffix();
示例2: layout
/**
* list articles as alistapart did
*
* @param resource the SQL result
* @return string the rendered text
*
* @see layouts/layout.php
**/
function layout($result)
{
global $context;
// we return some text
$text = '';
// empty list
if (!SQL::count($result)) {
$output = '<p>' . i18n::s('No page to display.');
if (Surfer::is_associate()) {
$output .= ' ' . sprintf(i18n::s('Use the %s to populate this server.'), Skin::build_link('help/populate.php', i18n::s('Content Assistant'), 'shortcut'));
}
$output .= '</p>';
return $output;
}
// menu at page bottom
$this->menu = array();
// build a list of articles
$item_count = 0;
$future = array();
$others = array();
include_once $context['path_to_root'] . 'comments/comments.php';
include_once $context['path_to_root'] . 'links/links.php';
while ($item = SQL::fetch($result)) {
// get the related overlay
$overlay = Overlay::load($item, 'article:' . $item['id']);
// get the main anchor
$anchor = Anchors::get($item['anchor']);
// the url to view this item
$url = Articles::get_permalink($item);
// build a title
if (is_object($overlay)) {
$title = Codes::beautify_title($overlay->get_text('title', $item));
} else {
$title = Codes::beautify_title($item['title']);
}
// initialize variables
$prefix = $suffix = '';
// signal restricted and private articles
if ($item['active'] == 'N') {
$prefix .= PRIVATE_FLAG;
} elseif ($item['active'] == 'R') {
$prefix .= RESTRICTED_FLAG;
}
// signal locked articles
if (isset($item['locked']) && $item['locked'] == 'Y' && Articles::is_owned($item, $anchor)) {
$suffix .= LOCKED_FLAG;
}
// flag expired articles, and articles updated recently
if ($item['expiry_date'] > NULL_DATE && $item['expiry_date'] <= $context['now']) {
$suffix = EXPIRED_FLAG . ' ';
} elseif ($item['create_date'] >= $context['fresh']) {
$suffix = NEW_FLAG . ' ';
} elseif ($item['edit_date'] >= $context['fresh']) {
$suffix = UPDATED_FLAG . ' ';
}
// list separately articles to be published
if ($item['publish_date'] <= NULL_DATE) {
$prefix = DRAFT_FLAG . $prefix;
$future[$url] = array($prefix, $title, $suffix);
} elseif ($item['publish_date'] > $context['now']) {
$future[$url] = array($prefix, $title, $suffix);
} else {
$item_count += 1;
// layout the newest article
if ($item_count == 1) {
$text .= $this->layout_newest($item);
// display all tags
if ($item['tags']) {
$context['page_tags'] = Skin::build_tags($item['tags']);
}
// layout recent articles
} else {
$others[$url] = array($prefix, $title, $suffix);
}
}
}
// build the list of future articles
if (@count($future)) {
$this->menu[] = Skin::build_sliding_box(i18n::s('Pages under preparation'), Skin::build_list($future, 'compact'), NULL, TRUE);
}
// build the list of other articles
if (@count($others)) {
$this->menu[] = Skin::build_sliding_box(i18n::s('Previous pages'), Skin::build_list($others, 'compact'), NULL, TRUE);
}
// talk about it
if (@count($this->menu)) {
$text .= Skin::build_box(strlen($text) > 1024 ? i18n::s('Follow-up') : '', Skin::finalize_list($this->menu, 'menu_bar'));
}
// end of processing
SQL::free($result);
return $text;
}
示例3: str_replace
/**
* build a box
*
* Accept following variants:
* - 'extra' for a flashy box on page side
* - 'floating' for a box floated to the left
* - 'folded' for a folded box with content
* - 'gadget' for additional content in the main part of the page
* - 'header1' with a level 1 title
* - 'header1 even'
* - 'header1 odd'
* - 'header2' with a level 2 title
* - 'header3' with a level 3 title
* - 'navigation' for additional navigational information on page side
* - 'sidebar' for some extra information in the main part of the page
* - 'sidecolumn' for some extra information in the main part of the page
* - 'sliding' for sliding content
* - 'toc' for a table of content
* - 'toq' for a table of questions
* - 'unfolded' for a folded box with content
*
* @param string the box title, if any
* @param string the box content
* @param string the box variant, if any
* @param string a unique object id, if any
* @param string a link to add to the title, if any
* @param string the popup to display while hovering the link, if any
* @return the HTML to display
*
*/
public static function &build_box($title, $content, $variant = 'header1', $id = '', $url = '', $popup = '')
{
global $context;
$content = Codes::fix_tags($content);
// accept line breaks in box titles
$title = str_replace("\n", BR, $title);
// append a link to the title, if any
if ($url) {
$title =& Skin::build_box_title($title, $url, $popup);
}
// depending on variant
switch ($variant) {
case 'extra':
$output =& Skin::build_extra_box($title, $content, $id);
break;
case 'floating':
$output =& Skin::build_floating_box($title, $content, $id);
break;
case 'folded':
case 'folder':
// obsoleted
$output =& Skin::build_folded_box($title, $content, $id);
break;
case 'gadget':
$output =& Skin::build_gadget_box($title, $content, $id);
break;
case 'header1':
case 'header1 even':
case 'header1 odd':
case 'header2':
case 'header3':
$output =& Skin::build_header_box($title, $content, $id, $variant);
break;
case 'navigation':
$output =& Skin::build_navigation_box($title, $content, $id);
break;
case 'section':
// legacy
$output =& Skin::build_header_box($title, $content, $id);
break;
case 'sidebar':
$output =& Skin::build_sidebar_box($title, $content, $id);
break;
case 'sidecolumn':
$output =& Skin::build_sidecolumn_box($title, $content, $id);
break;
case 'sliding':
$output =& Skin::build_sliding_box($title, $content, $id);
break;
case 'toc':
$output =& Skin::build_toc_box($title, $content, $id);
break;
case 'toq':
$output =& Skin::build_toq_box($title, $content, $id);
break;
case 'unfolded':
$output =& Skin::build_unfolded_box($title, $content, $id);
break;
default:
// displayed in the navigation panel
if (isset($context['skins_navigation_components']) && strpos($context['skins_navigation_components'], $variant) !== FALSE) {
$output =& Skin::build_navigation_box($title, $content, $id);
} elseif (isset($context['skins_extra_components']) && strpos($context['skins_extra_components'], $variant) !== FALSE) {
$output =& Skin::build_extra_box($title, $content, $id);
} else {
$output =& Skin::build_header_box($title, $content, $id, $variant);
}
break;
}
// job done
//.........这里部分代码省略.........
示例4: 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) {
//.........这里部分代码省略.........
示例5: layout
//.........这里部分代码省略.........
} else {
$items_per_page = ARTICLES_PER_PAGE;
}
// sort and list articles
$offset = 0;
if (preg_match('/\\barticles_by_([a-z_]+)\\b/i', $item['options'], $matches)) {
$order = $matches[1];
} elseif (is_callable(array($layout, 'items_order'))) {
$order = $layout->items_order();
} else {
$order = 'edition';
}
// create a box
$box = array('top_bar' => array(), 'text' => '', 'bottom_bar' => array());
// the command to post a new page
//if(Articles::allow_creation($item, $anchor)) {
if ($anchor->allows('creation', 'article')) {
Skin::define_img('ARTICLES_ADD_IMG', 'articles/add.gif');
$url = 'articles/edit.php?anchor=' . urlencode('section:' . $item['id']);
if (is_object($content_overlay) && ($label = $content_overlay->get_label('new_command', 'articles'))) {
} else {
$label = ARTICLES_ADD_IMG . i18n::s('Add a page');
}
$box['top_bar'] += array($url => $label);
}
// list pages under preparation
$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');