本文整理汇总了PHP中Skin::build_list方法的典型用法代码示例。如果您正苦于以下问题:PHP Skin::build_list方法的具体用法?PHP Skin::build_list怎么用?PHP Skin::build_list使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Skin
的用法示例。
在下文中一共展示了Skin::build_list方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: layout
/**
* list users
*
* @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 (!($delta = SQL::count($result))) {
return $text;
}
// flag idle users
$idle = gmstrftime('%Y-%m-%d %H:%M:%S', time() - 600);
// process all items in the list
$count = 0;
$items = array();
while ($item = SQL::fetch($result)) {
// url to view the user
$url = Users::get_permalink($item);
// initialize variables
$prefix = $suffix = '';
// signal restricted and private users
if (isset($item['active']) && $item['active'] == 'N') {
$prefix .= PRIVATE_FLAG;
} elseif (isset($item['active']) && $item['active'] == 'R') {
$prefix .= RESTRICTED_FLAG;
}
// signal locked profiles
if (isset($item['capability']) && $item['capability'] == '?') {
$prefix .= EXPIRED_FLAG;
}
// item title
if (isset($item['full_name']) && $item['full_name']) {
$label = ucfirst(Skin::strip($item['full_name'], 10));
$hover = $item['nick_name'];
} else {
$label = ucfirst(Skin::strip($item['nick_name'], 10));
$hover = $item['full_name'];
}
// flag idle users
if (!isset($item['click_date']) || $item['click_date'] < $idle) {
$class = 'idle user';
} else {
$class = 'user';
}
// list all components for this item
$items[$url] = array($prefix, $label, $suffix, $class, NULL, $hover);
// provide only some results
if (++$count >= 5) {
break;
}
}
// end of processing
SQL::free($result);
// turn this to some text
$text = Skin::build_list($items, 'comma');
// some indications on the number of connections
if ($delta -= $count) {
$text .= ', ...';
}
return $text;
}
示例2: layout
/**
* list servers
*
* @param resource the SQL result
* @return string the rendered text
*
* @see layouts/layout.php
**/
function layout($result)
{
global $context;
// empty list
if (!SQL::count($result)) {
$output = array();
return $output;
}
// we return an array of ($url => $attributes)
$items = array();
// process all items in the list
while ($item = SQL::fetch($result)) {
// initialize variables
$prefix = $suffix = $icon = '';
// the url to view this item
$url = Servers::get_url($item['id']);
// use the title as a label
$label = Skin::strip($item['title'], 10);
// flag files uploaded recently
if ($item['edit_date'] >= $context['fresh']) {
$prefix = NEW_FLAG . $prefix;
}
// description
if ($item['description']) {
$suffix .= ' ' . ucfirst(trim($item['description']));
}
// the menu bar for associates and poster
if (Surfer::is_empowered() || Surfer::is($item['edit_id'])) {
$menu = array(Servers::get_url($item['id'], 'edit') => i18n::s('Edit'), Servers::get_url($item['id'], 'delete') => i18n::s('Delete'));
$suffix .= ' ' . Skin::build_list($menu, 'menu');
}
// add a separator
if ($suffix) {
$suffix = ' - ' . $suffix;
}
// append details to the suffix
$suffix .= BR . '<span class="details">';
// details
$details = array();
// item poster
if ($item['edit_name']) {
$details[] = sprintf(i18n::s('edited by %s %s'), Users::get_link($item['edit_name'], $item['edit_address'], $item['edit_id']), Skin::build_date($item['edit_date']));
}
// the edition date
$details[] = Skin::build_date($item['edit_date']);
// all details
if (count($details)) {
$suffix .= ucfirst(implode(', ', $details)) . "\n";
}
// end of details
$suffix .= '</span>';
// list all components for this item
$items[$url] = array($prefix, $label, $suffix, 'server', $icon);
}
// end of processing
SQL::free($result);
return $items;
}
示例3: sprintf
/**
* list participants
*
* @see overlays/overlay.php
*
* @param array the hosting record
* @return some HTML to be inserted into the resulting page
*/
function &get_list_text($host = NULL)
{
global $context;
// we return some text
$text = '';
$to_avoid = NULL;
if ($id = Surfer::get_id()) {
$to_avoid = 'user:' . $id;
}
// page editors, except target surfer
if ($friends =& Members::list_users_by_posts_for_member('article:' . $host['id'], 0, USERS_LIST_SIZE, 'comma', $to_avoid)) {
$text = '<p class="details">' . sprintf(i18n::s('with %s'), Skin::build_list($friends, 'comma')) . '</p>';
}
return $text;
}
示例4: render
public function render($matches)
{
$count = isset($matches[0]) ? $matches[0] : 20;
// sanity check
if (!(int) $count) {
$count = 20;
}
// query the database and layout that stuff
if (!($text = Members::list_categories_by_count_for_anchor(NULL, 0, $count, 'cloud'))) {
$text = '<p>' . i18n::s('No item has been found.') . '</p>';
}
// we have an array to format
if (is_array($text)) {
$text = Skin::build_list($text, '2-columns');
}
// job done
return $text;
}
示例5: layout
/**
* list articles as newspaper do
*
* @param resource the SQL result
* @return string the rendered text
*
* @see layouts/layout.php
**/
function layout($result)
{
global $context;
$text = '';
// empty list
if (!SQL::count($result)) {
return $text;
}
// build a list of articles
$others = array();
$item_count = 0;
include_once $context['path_to_root'] . 'comments/comments.php';
while ($item = SQL::fetch($result)) {
// permalink
$url = Articles::get_permalink($item);
// next item
$item_count += 1;
// section opening
if ($item_count == 1) {
$text .= '<div class="newest">' . "\n";
} elseif ($item_count == 2) {
$text .= '<div class="recent">' . "\n";
}
// layout first article
if ($item_count == 1) {
$text .= $this->layout_first($item);
// layout newest articles
} elseif ($item_count <= 4) {
// the style to apply
switch ($item_count) {
case 2:
$text .= '<div class="west">';
break;
case 3:
$text .= '<div class="center">';
break;
case 4:
$text .= '<div class="east">';
break;
}
$text .= $this->layout_newest($item) . '</div>';
// layout recent articles
} else {
$others[$url] = $this->layout_recent($item);
}
// close newest
if ($item_count == 1) {
$text .= '<br style="clear: left;" /></div>' . "\n";
} elseif ($item_count == 4) {
$text .= '<br style="clear: left;" /></div>' . "\n";
}
}
// not enough items in the database to fill the south; close it here
if ($item_count == 2 || $item_count == 3) {
$text .= '</div>' . "\n";
}
// build the list of other articles
if (count($others)) {
// make box
$text .= Skin::build_box(i18n::s('Previous pages'), Skin::build_list($others, 'decorated'));
}
// end of processing
SQL::free($result);
return $text;
}
示例6: render_voted
/**
* render a compact list of voted pages
*
* @param string the anchor (e.g. 'section:123')
* @param string layout to use
* @return string the rendered text
**/
public static function render_voted($anchor = '', $layout = 'simple')
{
global $context;
// we return some text;
$text = '';
// number of items to display
$count = COMPACT_LIST_SIZE;
if (($position = strpos($anchor, ',')) !== FALSE) {
$count = (int) trim(substr($anchor, $position + 1));
if (!$count) {
$count = COMPACT_LIST_SIZE;
}
$anchor = trim(substr($anchor, 0, $position));
}
// scope is limited to current surfer
if ($anchor == 'self' && Surfer::get_id()) {
$anchor = 'user:' . Surfer::get_id();
// refresh on every page load
Cache::poison();
}
// scope is limited to one section
if (strpos($anchor, 'section:') === 0) {
// look at this branch of the content tree
$anchors = Sections::get_branch_at_anchor($anchor);
// query the database and layout that stuff
$text =& Articles::list_for_anchor_by('rating', $anchors, 0, $count, $layout);
// scope is limited to pages of one surfer
} elseif (strpos($anchor, 'user:') === 0) {
$text =& Articles::list_for_user_by('rating', substr($anchor, 5), 0, $count, $layout);
} else {
$text =& Articles::list_by('rating', 0, $count, $layout);
}
// we have an array to format
if (is_array($text)) {
$text =& Skin::build_list($text, $layout);
}
// job done
return $text;
}
示例7: ucfirst
$context['page_details'] .= '<p class="details">' . ucfirst(implode(', ', $details)) . "</p>\n";
}
// insert anchor prefix
if (is_object($anchor)) {
$text .= $anchor->get_prefix();
}
// main url
if ($item['main_url']) {
$text .= '<p>' . sprintf(i18n::s('Main URL: %s'), Skin::build_link($item['main_url'], NULL, 'external')) . "</p>\n";
}
// a section for remote services
$text .= Skin::build_block(i18n::s('Services accessed remotely'), 'subtitle');
// feed submission
if ($item['submit_feed'] == 'Y') {
$menu = array(Servers::get_url($item['id'], 'test') => i18n::s('Test feed'));
$label = sprintf(i18n::s('News published at this server at %s - %s are fetched periodically'), Skin::build_link($item['feed_url'], NULL, 'external'), Skin::build_list($menu, 'menu'));
if (is_object($anchor)) {
$label .= BR . sprintf(i18n::s('and aggregated locally at %s'), Skin::build_link($anchor->get_url(), $anchor->get_title(), 'section'));
}
} else {
$label = i18n::s('Do not check news from this server.');
}
$text .= '<p>' . $label . "</p>\n";
// ping submission
if ($item['submit_ping'] == 'Y') {
$label = sprintf(i18n::s('This server has to be pinged on updates, by using XML-RPC calls <code>weblogUpdates.ping</code> at %s'), Skin::build_link($item['ping_url']));
} else {
$label = i18n::s('Updates are not transmitted to this server.');
}
$text .= '<p>' . $label . "</p>\n";
// monitoring
示例8: render_embed
//.........这里部分代码省略.........
if (FLV_IMG_HREF) {
$flashvars .= '&top1=' . urlencode(FLV_IMG_HREF . '|10|10');
}
// rely on Flash
if (Surfer::has_flash()) {
// the full object is built in Javascript --see parameters at http://flv-player.net/players/maxi/documentation/
$output = '<div id="flv_' . $item['id'] . '" class="no_print">Flash plugin or Javascript are turned off. Activate both and reload to view the object</div>' . "\n";
Page::insert_script('var flashvars = { flv:"' . $url . '", ' . str_replace(array('&', '='), array('", ', ':"'), $flashvars) . '", autoload:0, margin:1, showiconplay:1, playeralpha:50, iconplaybgalpha:30, showfullscreen:1, showloading:"always", ondoubleclick:"fullscreen" }' . "\n" . 'var params = { allowfullscreen: "true", allowscriptaccess: "always" }' . "\n" . 'var attributes = { id: "file_' . $item['id'] . '", name: "file_' . $item['id'] . '"}' . "\n" . 'swfobject.embedSWF("' . $flvplayer_url . '", "flv_' . $item['id'] . '", "' . $width . '", "' . $height . '", "9", "' . $context['url_to_home'] . $context['url_to_root'] . 'included/browser/expressinstall.swf", flashvars, params);' . "\n");
// native support
} else {
// <video> is HTML5, <object> is legacy
$output = '<video width="' . $width . '" height="' . $height . '" autoplay="" controls="" src="' . $url . '" >' . "\n" . ' <object width="' . $width . '" height="' . $height . '" data="' . $url . '" type="' . Files::get_mime_type($item['file_name']) . '">' . "\n" . ' <param value="' . $url . '" name="movie" />' . "\n" . ' <param value="true" name="allowFullScreen" />' . "\n" . ' <param value="always" name="allowscriptaccess" />' . "\n" . ' <a href="' . $url . '">No video playback capabilities, please download the file</a>' . "\n" . ' </object>' . "\n" . '</video>' . "\n";
}
// job done
return $output;
// a ganttproject timeline
// a ganttproject timeline
case 'gan':
// where the file is
$path = Files::get_path($item['anchor']) . '/' . rawurlencode($item['file_name']);
// we actually use a transformed version of the file
$cache_id = Cache::hash($path) . '.xml';
// apply the transformation
if (!file_exists($context['path_to_root'] . $cache_id) || filemtime($context['path_to_root'] . $cache_id) < filemtime($context['path_to_root'] . $path) || !($text = Safe::file_get_contents($context['path_to_root'] . $cache_id))) {
// transform from GanttProject to SIMILE Timeline
$text = Files::transform_gan_to_simile($path);
// put in cache
Safe::file_put_contents($cache_id, $text);
}
// load the SIMILE Timeline javascript library in shared/global.php
$context['javascript']['timeline'] = TRUE;
// cache would kill the loading of the library
cache::poison();
// 1 week ago
$now = gmdate('M d Y H:i:s', time() - 7 * 24 * 60 * 60);
// load the right file
$output = '<div id="gantt" style="height: ' . $height . '; width: ' . $width . '; border: 1px solid #aaa; font-family: Trebuchet MS, Helvetica, Arial, sans serif; font-size: 8pt"></div>' . "\n";
Page::insert_script('var simile_handle;' . "\n" . 'function onLoad() {' . "\n" . ' var eventSource = new Timeline.DefaultEventSource();' . "\n" . ' var theme = Timeline.ClassicTheme.create();' . "\n" . ' theme.event.bubble.width = 350;' . "\n" . ' theme.event.bubble.height = 300;' . "\n" . ' var bandInfos = [' . "\n" . ' Timeline.createBandInfo({' . "\n" . ' eventSource: eventSource,' . "\n" . ' date: "' . $now . '",' . "\n" . ' width: "80%",' . "\n" . ' intervalUnit: Timeline.DateTime.WEEK,' . "\n" . ' intervalPixels: 200,' . "\n" . ' theme: theme,' . "\n" . ' layout: "original" // original, overview, detailed' . "\n" . ' }),' . "\n" . ' Timeline.createBandInfo({' . "\n" . ' showEventText: false,' . "\n" . ' trackHeight: 0.5,' . "\n" . ' trackGap: 0.2,' . "\n" . ' eventSource: eventSource,' . "\n" . ' date: "' . $now . '",' . "\n" . ' width: "20%",' . "\n" . ' intervalUnit: Timeline.DateTime.MONTH,' . "\n" . ' intervalPixels: 50' . "\n" . ' })' . "\n" . ' ];' . "\n" . ' bandInfos[1].syncWith = 0;' . "\n" . ' bandInfos[1].highlight = true;' . "\n" . ' bandInfos[1].eventPainter.setLayout(bandInfos[0].eventPainter.getLayout());' . "\n" . ' simile_handle = Timeline.create(document.getElementById("gantt"), bandInfos, Timeline.HORIZONTAL);' . "\n" . ' simile_handle.showLoadingMessage();' . "\n" . ' Timeline.loadXML("' . $context['url_to_home'] . $context['url_to_root'] . $cache_id . '", function(xml, url) { eventSource.loadXML(xml, url); });' . "\n" . ' simile_handle.hideLoadingMessage();' . "\n" . '}' . "\n" . "\n" . 'var resizeTimerID = null;' . "\n" . 'function onResize() {' . "\n" . ' if (resizeTimerID == null) {' . "\n" . ' resizeTimerID = window.setTimeout(function() {' . "\n" . ' resizeTimerID = null;' . "\n" . ' simile_handle.layout();' . "\n" . ' }, 500);' . "\n" . ' }' . "\n" . '}' . "\n" . "\n" . '// observe page major events' . "\n" . '$(document).ready( onLoad);' . "\n" . '$(window).resize(onResize);' . "\n");
// job done
return $output;
// a Freemind map
// a Freemind map
case 'mm':
// if we have an external reference, use it
if (isset($item['file_href']) && $item['file_href']) {
$target_href = $item['file_href'];
// else redirect to ourself
} else {
// ensure a valid file name
$file_name = utf8::to_ascii($item['file_name']);
// where the file is
$path = Files::get_path($item['anchor']) . '/' . rawurlencode($item['file_name']);
// map the file on the regular web space
$url_prefix = $context['url_to_home'] . $context['url_to_root'];
// redirect to the actual file
$target_href = $url_prefix . $path;
}
// allow several viewers to co-exist in the same page
static $freemind_viewer_index;
if (!isset($freemind_viewer_index)) {
$freemind_viewer_index = 1;
} else {
$freemind_viewer_index++;
}
// load flash player
$url = $context['url_to_home'] . $context['url_to_root'] . 'included/browser/visorFreemind.swf';
// variables
$flashvars = 'initLoadFile=' . $target_href . '&openUrl=_self';
$output = '<div id="freemind_viewer_' . $freemind_viewer_index . '">Flash plugin or Javascript are turned off. Activate both and reload to view the object</div>' . "\n";
Page::insert_script('var params = {};' . "\n" . 'params.base = "' . dirname($url) . '/";' . "\n" . 'params.quality = "high";' . "\n" . 'params.wmode = "transparent";' . "\n" . 'params.menu = "false";' . "\n" . 'params.flashvars = "' . $flashvars . '";' . "\n" . 'swfobject.embedSWF("' . $url . '", "freemind_viewer_' . $freemind_viewer_index . '", "' . $width . '", "' . $height . '", "6", "' . $context['url_to_home'] . $context['url_to_root'] . 'included/browser/expressinstall.swf", false, params);' . "\n");
// offer to download a copy of the map
$menu = array($target_href => i18n::s('Browse this map with Freemind'));
// display menu commands below the viewer
$output .= Skin::build_list($menu, 'menu_bar');
// job done
return $output;
// native flash
// native flash
case 'swf':
// where to get the file
if (isset($item['file_href']) && $item['file_href']) {
$url = $item['file_href'];
} else {
$url = $context['url_to_home'] . $context['url_to_root'] . 'files/' . str_replace(':', '/', $item['anchor']) . '/' . rawurlencode($item['file_name']);
}
$output = '<div id="swf_' . $item['id'] . '" class="no_print">Flash plugin or Javascript are turned off. Activate both and reload to view the object</div>' . "\n";
Page::insert_script('var params = {};' . "\n" . 'params.base = "' . dirname($url) . '/";' . "\n" . 'params.quality = "high";' . "\n" . 'params.wmode = "transparent";' . "\n" . 'params.allowfullscreen = "true";' . "\n" . 'params.allowscriptaccess = "always";' . "\n" . 'params.flashvars = "' . $flashvars . '";' . "\n" . 'swfobject.embedSWF("' . $url . '", "swf_' . $item['id'] . '", "' . $width . '", "' . $height . '", "6", "' . $context['url_to_home'] . $context['url_to_root'] . 'included/browser/expressinstall.swf", false, params);' . "\n");
return $output;
// link to file page
// link to file page
default:
// link label
$text = Skin::strip($item['title'] ? $item['title'] : str_replace('_', ' ', $item['file_name']));
// make a link to the target page
$url = Files::get_permalink($item);
// return a complete anchor
$output =& Skin::build_link($url, $text);
return $output;
}
}
示例9: array
// see also
$lines = array();
$lines[] = Skin::build_link('categories/', i18n::s('Categories'));
$lines[] = Skin::build_link('search.php', i18n::s('Search'));
$lines[] = Skin::build_link('help/', i18n::s('Help index'));
$lines[] = Skin::build_link('query.php', i18n::s('Contact'));
$text .= Skin::build_box(i18n::s('See also'), Skin::finalize_list($lines, 'compact'), 'boxes');
// list monthly publications in an extra box
$anchor = Categories::get(i18n::c('monthly'));
if (isset($anchor['id']) && ($items = Categories::list_by_date_for_anchor('category:' . $anchor['id'], 0, COMPACT_LIST_SIZE, 'compact'))) {
$text .= Skin::build_box($anchor['title'], Skin::build_list($items, 'compact'), 'boxes') . "\n";
}
// side boxes for related categories, if any
if ($categories = Categories::list_by_date_for_display('section:index', 0, 7, 'raw')) {
foreach ($categories as $id => $attributes) {
// link to the category page from the box title
$label =& Skin::build_box_title(Skin::strip($attributes['title']), Categories::get_permalink($attributes), i18n::s('View the category'));
// box content
if ($items =& Members::list_articles_by_date_for_anchor('category:' . $id, 0, COMPACT_LIST_SIZE, 'compact')) {
$text .= Skin::build_box($label, Skin::build_list($items, 'compact'), 'boxes') . "\n";
}
}
}
// save, whatever change, for 5 minutes
Cache::put($cache_id, $text, 'stable', 300);
}
$context['components']['boxes'] = $text;
// referrals, if any
$context['components']['referrals'] = Skin::build_referrals('sections/index.php');
// render the skin
render_skin();
示例10: layout
/**
* list sections as topics in a forum
*
* @param resource the SQL result
* @return string the rendered text
**/
function layout($result)
{
global $context;
// empty list
if (!SQL::count($result)) {
$output = array();
return $output;
}
// output as a string
$text = '';
// build a list of sections
$family = '';
$first = TRUE;
while ($item = SQL::fetch($result)) {
// change the family
if ($item['family'] != $family) {
$family = $item['family'];
// close last table only if a section has been already listed
if (!$first) {
$text .= Skin::table_suffix();
}
// show the family
$text .= '<h2><span>' . $family . ' </span></h2>' . "\n" . Skin::table_prefix('yabb') . Skin::table_row(array(i18n::s('Board'), 'center=' . i18n::s('Topics'), i18n::s('Last post')), 'header');
} elseif ($first) {
$text .= Skin::table_prefix('yabb');
$text .= Skin::table_row(array(i18n::s('Board'), 'center=' . i18n::s('Topics'), i18n::s('Last post')), 'header');
}
// done with this case
$first = FALSE;
// reset everything
$prefix = $label = $suffix = $icon = '';
// signal restricted and private sections
if ($item['active'] == 'N') {
$prefix .= PRIVATE_FLAG;
} elseif ($item['active'] == 'R') {
$prefix .= RESTRICTED_FLAG;
}
// indicate the id in the hovering popup
$hover = i18n::s('View the section');
if (Surfer::is_member()) {
$hover .= ' [section=' . $item['id'] . ']';
}
// the url to view this item
$url = Sections::get_permalink($item);
// use the title as a link to the page
$title =& Skin::build_link($url, Codes::beautify_title($item['title']), 'basic', $hover);
// also use a clickable thumbnail, if any
if ($item['thumbnail_url']) {
$prefix = Skin::build_link($url, '<img src="' . $item['thumbnail_url'] . '" alt="" title="' . encode_field($hover) . '" class="left_image" />', 'basic', $hover) . $prefix;
}
// flag sections 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 . ' ';
}
// board introduction
if ($item['introduction']) {
$suffix .= '<br style="clear: none;" />' . Codes::beautify_introduction($item['introduction']);
}
// more details
$details = '';
$more = array();
// board moderators
if ($moderators = Sections::list_editors_by_name($item, 0, 7, 'comma5')) {
$more[] = sprintf(i18n::ns('Moderator: %s', 'Moderators: %s', count($moderators)), $moderators);
}
// children boards
if ($children =& Sections::list_by_title_for_anchor('section:' . $item['id'], 0, COMPACT_LIST_SIZE, 'comma')) {
$more[] = sprintf(i18n::ns('Child board: %s', 'Child boards: %s', count($children)), Skin::build_list($children, 'comma'));
}
// as a compact list
if (count($more)) {
$details .= '<ul class="compact">';
foreach ($more as $list_item) {
$details .= '<li>' . $list_item . '</li>' . "\n";
}
$details .= '</ul>' . "\n";
}
// all details
if ($details) {
$details = BR . '<span class="details">' . $details . "</span>\n";
}
// count posts here, and in children sections
$anchors = Sections::get_branch_at_anchor('section:' . $item['id']);
if (!($count = Articles::count_for_anchor($anchors))) {
$count = 0;
}
// get last post
$last_post = '--';
$article =& Articles::get_newest_for_anchor($anchors, TRUE);
if ($article['id']) {
//.........这里部分代码省略.........
示例11:
$context['text'] .= Skin::build_block(i18n::s('Most recent members'), 'title');
if (is_array($rows)) {
$context['text'] .= Skin::build_list($rows, 'decorated');
} else {
$context['text'] .= $rows;
}
}
// oldest posts, but only to associates
if (Surfer::is_associate() && ($rows = Users::list_by_post_date())) {
$context['text'] .= Skin::build_block(i18n::s('Oldest posts'), 'title');
$context['text'] .= '<p>' . i18n::s('Users who have never contributed are not listed at all.') . '</p>' . "\n";
if (is_array($rows)) {
$context['text'] .= Skin::build_list($rows, 'decorated');
} else {
$context['text'] .= $rows;
}
}
// oldest logins, but only to associates
if (Surfer::is_associate() && ($rows = Users::list_by_login_date())) {
$context['text'] .= Skin::build_block(i18n::s('Oldest logins'), 'title');
$context['text'] .= '<p>' . i18n::s('Users who have never been authenticated are not listed at all.') . '</p>' . "\n";
if (is_array($rows)) {
$context['text'] .= Skin::build_list($rows, 'decorated');
} else {
$context['text'] .= $rows;
}
}
// the menu bar for this page
$context['page_tools'][] = Skin::build_link('users/', i18n::s('People'));
// render the skin
render_skin();
示例12: elseif
} 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');
}
}
// display in a separate panel
if (trim($attachments)) {
$label = i18n::s('Attachments');
if ($attachments_count) {
$label .= ' (' . $attachments_count . ')';
}
$panels[] = array('attachments', $label, 'attachments_panel', $attachments);
}
//
示例13: send_body
/**
* dynamically generate the page
*
* @see skins/index.php
*/
function send_body()
{
global $context;
// populate tables for servers
if (is_readable('../servers/populate.php')) {
include_once '../servers/populate.php';
}
// splash
echo '<h3>' . i18n::s('What do you want to do now?') . '</h3>';
// follow-up commands
$menu = array();
$menu = array_merge($menu, array('servers/' => i18n::s('Servers')));
$menu = array_merge($menu, array('help/populate.php' => i18n::s('Launch the Content Assistant again')));
$menu = array_merge($menu, array('control/' => i18n::s('Control Panel')));
echo Skin::build_list($menu, 'menu_bar');
// new content has been created
Logger::remember('help/populate.php: content assistant has created new content');
}
示例14: layout
//.........这里部分代码省略.........
$text .= '<tr class="' . $class_title . '"><th>' . $prefix . $title . $suffix . '</th><th>' . i18n::s('Poster') . '</th><th>' . i18n::s('Messages') . '</th><th>' . i18n::s('Last active') . '</th></tr>' . "\n";
$count = 1;
// get last posts for this board --avoid sticky pages
if (preg_match('/\\barticles_by_([a-z_]+)\\b/i', $item['options'], $matches)) {
$order = $matches[1];
} else {
$order = 'edition';
}
if ($articles =& Articles::list_for_anchor_by($order, 'section:' . $item['id'], 0, 5, 'raw', TRUE)) {
foreach ($articles as $id => $article) {
// get the related overlay, if any
$article_overlay = Overlay::load($article, 'article:' . $id);
// flag articles updated recently
if ($article['expiry_date'] > NULL_DATE && $article['expiry_date'] <= $context['now']) {
$flag = EXPIRED_FLAG . ' ';
} elseif ($article['create_date'] >= $context['fresh']) {
$flag = NEW_FLAG . ' ';
} elseif ($article['edit_date'] >= $context['fresh']) {
$flag = UPDATED_FLAG . ' ';
} else {
$flag = '';
}
// use the title to label the link
if (is_object($article_overlay)) {
$title = Codes::beautify_title($article_overlay->get_text('title', $article));
} else {
$title = Codes::beautify_title($article['title']);
}
// title
$title = Skin::build_link(Articles::get_permalink($article), $title, 'article');
// poster
$poster = Users::get_link($article['create_name'], $article['create_address'], $article['create_id']);
// comments
$comments = Comments::count_for_anchor('article:' . $article['id']);
// last editor
$action = '';
if ($article['edit_date']) {
// label the action
if (isset($article['edit_action'])) {
$action = Anchors::get_action_label($article['edit_action']);
} else {
$action = i18n::s('edited');
}
$action = '<span class="details">' . $action . ' ' . Skin::build_date($article['edit_date']) . '</span>';
}
// this is another row of the output
$text .= '<tr class="' . $class_detail . '"><td>' . $title . $flag . '</td><td>' . $poster . '</td><td style="text-align: center;">' . $comments . '</td><td>' . $action . '</td></tr>' . "\n";
}
}
// more details
$details = array();
// board introduction
if ($item['introduction']) {
$details[] = Codes::beautify_introduction($item['introduction']);
}
// indicate the total number of threads here
if (($count = Articles::count_for_anchor('section:' . $item['id'])) && $count >= 5) {
$details[] = sprintf(i18n::s('%d threads'), $count) . ' »';
}
// link to the section index page
if ($details) {
$details = Skin::build_link(Sections::get_permalink($item), join(' - ', $details), 'basic');
} else {
$details = '';
}
// add a command for new post
$poster = '';
if (Surfer::is_empowered()) {
$poster = Skin::build_link('articles/edit.php?anchor=' . urlencode('section:' . $item['id']), i18n::s('Add a page') . ' »', 'basic');
}
// insert details in a separate row
if ($details || $poster) {
$text .= '<tr class="' . $class_detail . '"><td colspan="3">' . $details . '</td><td>' . $poster . '</td></tr>' . "\n";
}
// more details
$more = array();
// board moderators
if ($moderators = Sections::list_editors_by_name($item, 0, 7, 'comma5')) {
$more[] = sprintf(i18n::ns('Moderator: %s', 'Moderators: %s', count($moderators)), $moderators);
}
// children boards
if ($children =& Sections::list_by_title_for_anchor('section:' . $item['id'], 0, COMPACT_LIST_SIZE, 'compact')) {
$more[] = sprintf(i18n::ns('Child board: %s', 'Child boards: %s', count($children)), Skin::build_list($children, 'comma'));
}
// as a compact list
if (count($more)) {
$content = '<ul class="compact">';
foreach ($more as $list_item) {
$content .= '<li>' . $list_item . '</li>' . "\n";
}
$content .= '</ul>' . "\n";
// insert details in a separate row
$text .= '<tr class="' . $class_detail . '"><td colspan="4">' . $content . '</td></tr>' . "\n";
}
}
// end of processing
SQL::free($result);
$text .= Skin::table_suffix();
return $text;
}
示例15: array
if (!($text = Cache::get($cache_id))) {
// query the database and layout that stuff
if (!($text =& Members::list_categories_by_count_for_anchor(NULL, 0, 200, 'cloud'))) {
$text = '<p>' . i18n::s('No item has been found.') . '</p>';
}
// we have an array to format
if (is_array($text)) {
$text =& Skin::build_list($text, '2-columns');
}
// make a box
if ($text) {
$text =& Skin::build_box('', $text, 'header1', 'categories');
}
// cache this to speed subsequent queries
Cache::put($cache_id, $text, 'categories');
}
$context['text'] .= $text;
// display extra information
$cache_id = 'categories/cloud.php#extra';
if (!($text = Cache::get($cache_id))) {
// add an extra box with helpful links
$links = array('sections/' => i18n::s('Site map'), 'search.php' => i18n::s('Search'), 'help/' => i18n::s('Help index'), 'query.php' => i18n::s('Contact'));
$text .= Skin::build_box(i18n::s('See also'), Skin::build_list($links, 'compact'), 'boxes') . "\n";
// save for later use
Cache::put($cache_id, $text, 'articles');
}
$context['components']['boxes'] = $text;
// referrals, if any
$context['components']['referrals'] =& Skin::build_referrals('categories/cloud.php');
// render the skin
render_skin();