本文整理汇总了PHP中Skin::build_box方法的典型用法代码示例。如果您正苦于以下问题:PHP Skin::build_box方法的具体用法?PHP Skin::build_box怎么用?PHP Skin::build_box使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Skin
的用法示例。
在下文中一共展示了Skin::build_box方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: elseif
/**
* display content below main panel
*
* Everything is in a separate panel
*
* @param array the hosting record, if any
* @return some HTML to be inserted into the resulting page
*/
function &get_trailer_text($host = NULL)
{
$text = '';
// display the following only if at least one comment has been attached to this page
if (is_object($this->anchor) && !Comments::count_for_anchor($this->anchor->get_reference())) {
return $text;
}
// ask the surfer if he has not answered yet, and if the page has not been locked
$ask = TRUE;
if (isset($_COOKIE['rating_' . $host['id']])) {
$ask = FALSE;
} elseif (isset($host['locked']) && $host['locked'] == 'Y') {
$ask = FALSE;
}
// ask the surfer
if ($ask) {
$text = '<p style="line-height: 2.5em;">' . i18n::s('Has this page been useful to you?') . ' ' . Skin::build_link(Articles::get_url($host['id'], 'like'), i18n::s('Yes'), 'button') . ' ' . Skin::build_link(Articles::get_url($host['id'], 'dislike'), i18n::s('No'), 'button') . '</p>';
// or report on results
} elseif ($host['rating_count']) {
$text = '<p>' . Skin::build_rating_img((int) round($host['rating_sum'] / $host['rating_count'])) . ' ' . sprintf(i18n::ns('%d rating', '%d ratings', $host['rating_count']), $host['rating_count']) . '</p>';
}
// add a title
if ($text) {
$text = Skin::build_box(i18n::s('Feed-back'), $text);
}
// done
return $text;
}
示例2: layout
/**
* list articles
*
* @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)) {
return $text;
}
// clear flows
$text .= '<br style="clear: left" />';
// process all items in the list
while ($item = SQL::fetch($result)) {
// get the related overlay
$overlay = Overlay::load($item, 'article:' . $item['id']);
// the url to view this item
$url = Articles::get_permalink($item);
// use the title to label the link
if (is_object($overlay)) {
$title = Codes::beautify_title($overlay->get_text('title', $item));
} else {
$title = Codes::beautify_title($item['title']);
}
// the hovering title
if ($item['introduction'] && $context['skins_with_details'] == 'Y') {
$hover = strip_tags(Codes::beautify_introduction($item['introduction']));
} else {
$hover = i18n::s('View the page');
}
// title is a link to the target article
$title =& Skin::build_link($url, $title, 'basic', $hover);
// use the thumbnail for this article
if ($icon = trim($item['thumbnail_url'])) {
// fix relative path
if (!preg_match('/^(\\/|http:|https:|ftp:)/', $icon)) {
$icon = $context['url_to_root'] . $icon;
}
// use parameter of the control panel for this one
$options = '';
if (isset($context['classes_for_thumbnail_images'])) {
$options = 'class="' . $context['classes_for_thumbnail_images'] . '" ';
}
// build the complete HTML element
$icon = '<img src="' . $icon . '" alt="" title="' . encode_field($hover) . '" ' . $options . ' />';
// use default icon if nothing to display
} else {
$icon = MAP_IMG;
}
// use the image as a link to the target page
$icon =& Skin::build_link($url, $icon, 'basic', $hover);
// add a floating box
$text .= Skin::build_box($title, $icon, 'floating');
}
// clear flows
$text .= '<br style="clear: left" />';
// end of processing
SQL::free($result);
return $text;
}
示例3: build_endpoints
/**
* retrieve endpoints of last calls
*
* This is useful to list all servers notified after a publication.
*
* @param string title of the folded box generated
* @return mixed text to be integrated into the page, or array with one item per recipient, or ''
*/
public static function build_endpoints($title = NULL)
{
global $context;
// nothing to show
if (!Surfer::get_id() || !isset($context['servers_endpoints']) || !$context['servers_endpoints']) {
return '';
}
// return the bare list
if (!$title) {
return $context['servers_endpoints'];
}
// build a nice list
$list = array();
foreach ($context['servers_endpoints'] as $recipient) {
$list[] = htmlspecialchars($recipient);
}
return Skin::build_box($title, Skin::finalize_list($list, 'compact'), 'folded');
}
示例4: array_merge
$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);
}
//
// users
//
$users = '';
$users_count = 0;
示例5:
}
// list future articles
if (Surfer::is_associate() && ($rows =& Articles::list_by('future', 0, 5))) {
if (is_array($rows)) {
$rows = Skin::build_list($rows, 'decorated');
}
$context['text'] .= Skin::build_box(i18n::s('Future articles'), $rows, 'header1', 'future');
}
// list dead articles
if (Surfer::is_associate() && ($rows =& Articles::list_by('expiry', 0, 10, 'hits'))) {
if (is_array($rows)) {
$rows = Skin::build_list($rows, 'decorated');
}
$context['text'] .= Skin::build_box(i18n::s('Dead articles'), $rows, 'header1', 'expired');
}
// list the oldest published articles, that have to be validated again
if (Surfer::is_associate() && ($rows =& Articles::list_by('review', 0, 10, 'review'))) {
if (is_array($rows)) {
$rows = Skin::build_list($rows, 'decorated');
}
$context['text'] .= Skin::build_box(i18n::s('Oldest articles'), $rows, 'header1', 'oldest');
}
// list articles with very few hits
if (Surfer::is_associate() && ($rows =& Articles::list_by('unread', 0, 10, 'hits'))) {
if (is_array($rows)) {
$rows = Skin::build_list($rows, 'decorated');
}
$context['text'] .= Skin::build_box(i18n::s('Less read articles'), $rows, 'header1', 'unread');
}
// render the skin
render_skin();
示例6: elseif
$context['text'] .= Skin::build_block('<form method="post" action="setup.php"><p class="assistant_bar">' . "\n" . Skin::build_submit_button(i18n::s('Database maintenance')) . "\n" . '<input type="hidden" name="action" value="build" />' . "\n" . '</p></form>', 'bottom');
// this may take several minutes
$context['text'] .= '<p>' . i18n::s('When you will click on the button the server will be immediately requested to proceed. However, because of the so many things to do on the back-end, you may have to wait for minutes before getting a response displayed. Thank you for your patience.') . '</p>';
// create the database on first installation
} elseif (!file_exists('../parameters/switch.on')) {
$context['text'] .= Skin::build_block('<form method="post" action="setup.php"><p class="assistant_bar">' . "\n" . Skin::build_submit_button(i18n::s('Create tables in the database')) . "\n" . '<input type="hidden" name="action" value="build" />' . "\n" . '</p></form>', 'bottom');
// this may take several minutes
$context['text'] .= '<p>' . i18n::s('When you will click on the button the server will be immediately requested to proceed. However, because of the so many things to do on the back-end, you may have to wait for minutes before getting a response displayed. Thank you for your patience.') . '</p>';
// or back to the control panel
} else {
$menu = array('control/' => i18n::s('Control Panel'), 'control/setup.php' => i18n::s('Database maintenance'));
$context['text'] .= Skin::build_list($menu, 'menu_bar');
}
// display current hooks
} else {
// the splash message
$context['text'] .= i18n::s('This script will scan your php scripts to install software hooks.');
// the submit button
$context['text'] .= '<form method="post" action="' . $context['script_url'] . '" id="main_form"><p>' . Skin::build_submit_button(i18n::s('Scan scripts for software extensions'), NULL, NULL, 'confirmed') . '<input type="hidden" name="action" value="check" />' . '</p></form>';
// the script used for form handling at the browser
Page::insert_script('$("#confirmed").focus();');
// this may take several minutes
$context['text'] .= '<p>' . i18n::s('When you will click on the button the server will be immediately requested to proceed. However, because of the so many things to do on the back-end, you may have to wait for minutes before getting a response displayed. Thank you for your patience.') . '</p>';
// display the existing hooks configuration file, if any
$content = Safe::file_get_contents('../parameters/hooks.include.php');
if (strlen($content)) {
$context['text'] .= Skin::build_box(sprintf(i18n::s('Current content of %s'), 'parameters/hooks.include.php'), Safe::highlight_string($content), 'folded');
}
}
// render the skin
render_skin();
示例7: array
if ($items) {
$context['text'] .= Skin::build_box(i18n::s('Comments'), utf8::to_unicode($items));
}
//
// related links
//
// list links by date (default) or by title (option :links_by_title:)
$items = array();
if (Articles::has_option('links_by_title', $anchor, $item)) {
$items = Links::list_by_title_for_anchor('article:' . $item['id'], 0, 50, 'compact');
} else {
$items = Links::list_by_date_for_anchor('article:' . $item['id'], 0, 50, 'compact');
}
// actually list items
if (count($items)) {
$context['text'] .= Skin::build_box(i18n::s('See also'), utf8::to_unicode(Skin::build_list($items, 'compact')));
}
//
// page suffix
//
// link to the original page
$context['text'] .= '<p>' . sprintf(i18n::s('The original page is located at %s'), Skin::build_link(Articles::get_permalink($item), Articles::get_permalink($item))) . "</p>\n";
// insert anchor suffix
if (is_object($anchor)) {
$context['text'] .= $anchor->get_suffix();
}
//
// special rendering if everything is ok
//
$text = '<html><body>' . "\n";
// display the title
示例8: layout
//.........这里部分代码省略.........
$suffix .= ' ' . UPDATED_FLAG;
}
// add details
$details = array();
// the author
if (isset($context['with_author_information']) && $context['with_author_information'] == 'Y') {
if ($item['edit_name'] == $item['create_name']) {
$details[] = sprintf(i18n::s('by %s'), ucfirst($item['create_name']));
} else {
$details[] = sprintf(i18n::s('by %s, %s'), ucfirst($item['create_name']), ucfirst($item['edit_name']));
}
}
// the publish date
$details[] = Skin::build_date($item['publish_date']);
// rating
$rating_label = '';
if ($item['rating_count']) {
$rating_label = Skin::build_rating_img((int) round($item['rating_sum'] / $item['rating_count'])) . ' ' . sprintf(i18n::ns('%d rating', '%d ratings', $item['rating_count']), $item['rating_count']) . ' ';
}
// add a link to let surfer rate this item
if (is_object($anchor) && !$anchor->has_option('without_rating')) {
if (!$item['rating_count']) {
$rating_label .= i18n::s('Rate this page');
}
$rating_label = Skin::build_link(Articles::get_url($item['id'], 'like'), $rating_label, 'basic', i18n::s('Rate this page'));
}
// display current rating, and allow for rating
$details[] = $rating_label;
// details
if (count($details)) {
$content .= '<p class="details">' . ucfirst(implode(', ', $details)) . '</p>';
}
// the full introductory text
if ($item['introduction']) {
$content .= Codes::beautify($item['introduction'], $item['options']);
} elseif (!is_object($overlay)) {
include_once $context['path_to_root'] . 'articles/article.php';
$article = new Article();
$article->load_by_content($item);
$content .= $article->get_teaser('teaser');
}
// insert overlay data, if any
if (is_object($overlay)) {
$content .= $overlay->get_text('list', $item);
}
// an array of links
$menu = array();
// rate the article
$menu = array_merge($menu, array(Articles::get_url($item['id'], 'like') => i18n::s('Rate this page')));
// read the article
$menu = array_merge($menu, array($url => i18n::s('Read more')));
// info on related files
if ($count = Files::count_for_anchor('article:' . $item['id'], TRUE)) {
$details[] = Skin::build_link($url . '#_attachments', sprintf(i18n::ns('%d file', '%d files', $count), $count), 'basic');
}
// info on related comments
if ($count = Comments::count_for_anchor('article:' . $item['id'], TRUE)) {
$link = Comments::get_url('article:' . $item['id'], 'list');
$menu = array_merge($menu, array($link => sprintf(i18n::ns('%d comment', '%d comments', $count), $count)));
}
// discuss
if (Comments::allow_creation($item, $anchor)) {
$menu = array_merge($menu, array(Comments::get_url('article:' . $item['id'], 'comment') => i18n::s('Discuss')));
}
// info on related links
if ($count = Links::count_for_anchor('article:' . $item['id'], TRUE)) {
$menu = array_merge($menu, array($url . '#_attachments' => sprintf(i18n::ns('%d link', '%d links', $count), $count)));
}
// trackback
if (Links::allow_trackback()) {
$menu = array_merge($menu, array('links/trackback.php?anchor=' . urlencode('article:' . $item['id']) => i18n::s('Reference this page')));
}
// link to the anchor page
if (is_object($anchor)) {
$menu = array_merge($menu, array($anchor->get_url() => $anchor->get_title()));
}
// list up to three categories by title, if any
if ($items = Members::list_categories_by_title_for_member('article:' . $item['id'], 0, 3, 'raw')) {
foreach ($items as $id => $attributes) {
$menu = array_merge($menu, array(Categories::get_permalink($attributes) => $attributes['title']));
}
}
// append a menu
$content .= Skin::build_list($menu, 'menu_bar');
// insert a complete box
$text .= Skin::build_box($icon . $prefix . Codes::beautify_title($item['title']) . $suffix, $content, 'header1', 'article_' . $item['id']);
// section closing
if ($item_count == 1) {
$text .= '</div>' . "\n";
}
}
// end of processing
SQL::free($result);
// add links to archives
$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(i18n::s('Previous pages'), Skin::build_list($items, 'menu_bar'));
}
return $text;
}
示例9: 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();
示例10: array_merge
// list categories by title
$offset = ($zoom_index - 1) * CATEGORIES_PER_PAGE;
$items =& Members::list_categories_by_title_for_member('article:' . $item['id'], $offset, CATEGORIES_PER_PAGE, 'sidebar');
// the command to change categories assignments
if (Categories::allow_assign($item, $anchor)) {
$items = array_merge($items, array(Categories::get_url('article:' . $item['id'], 'select') => i18n::s('Assign categories')));
}
// actually render the html for the section
if (is_array($box['bar'])) {
$box['text'] .= Skin::build_list($box['bar'], 'menu_bar');
}
if (is_array($items)) {
$box['text'] .= Skin::build_list($items, 'compact');
}
if ($box['text']) {
$context['components']['categories'] = Skin::build_box(i18n::s('See also'), $box['text'], 'categories', 'categories');
}
}
// referrals, if any
$context['components']['referrals'] =& Skin::build_referrals(Articles::get_permalink($item));
}
//
// the main part of the page
//
$context['page_description'] = '';
// filter description, if necessary
if (is_object($overlay)) {
$description = $overlay->get_text('description', $item);
} else {
$description = $item['description'];
}
示例11: array
$selected = '';
if ($overlay_name == $overlay_type) {
$selected = ' selected="selected"';
}
$input .= '<option value="' . $overlay_name . '"' . $selected . '>' . $overlay_name . "</option>\n";
}
}
}
$input .= '</select>';
$fields[] = array($label, $input, $hint);
// remember overlay type
} elseif (is_object($overlay)) {
$text .= '<input type="hidden" name="overlay_type" value="' . encode_field($overlay->get_type()) . '" />';
}
// add a folded box
$text .= Skin::build_box(i18n::s('More options'), Skin::build_form($fields), 'folded');
$fields = array();
// display in a separate panel
if ($text) {
$panels[] = array('options', i18n::s('Options'), 'options_panel', $text);
}
// preserve attributes coming from template duplication
if (!isset($item['id'])) {
$hidden = array('behaviors', 'extra', 'icon_url', 'index_map', 'prefix', 'suffix', 'trailer');
foreach ($hidden as $name) {
if (isset($item[$name])) {
$context['text'] .= '<input type="hidden" name="' . $name . '" value="' . $item[$name] . '" />';
}
}
}
// or preserve attributes not managed interactively
示例12: array
// build the form
$text .= Skin::build_form($fields);
$fields = array();
// display in a separate panel
if ($text) {
$panels[] = array('information', i18n::s('Information'), 'information_panel', $text);
}
//
// resources tab
//
$text = '';
// splash message for new items
if (!isset($item['id'])) {
$text .= '<p>' . i18n::s('Submit the new item, and you will be able to add resources afterwards.') . '</p>';
} elseif ($items = Images::list_by_date_for_anchor('file:' . $item['id'])) {
$text .= Skin::build_box(i18n::s('Images'), Skin::build_list($items, 'decorated'), 'unfolded', 'edit_images');
}
// display in a separate panel
if ($text) {
$panels[] = array('resources', i18n::s('Resources'), 'resources_panel', $text);
}
//
// options tab
//
$text = '';
// associates may change the active flag: Yes/public, Restricted/logged, No/associates
if (Surfer::is_member()) {
$label = i18n::s('Access');
$input = Skin::build_active_set_input($item);
$hint = Skin::build_active_set_hint($anchor);
$fields[] = array($label, $input, $hint);
示例13: sprintf
}
$context['text'] .= Skin::finalize_list($links, 'assistant_bar');
// page help
$help = '';
// information to members
if (Surfer::is_member()) {
$help .= '<p>' . sprintf(i18n::s('This has been posted by %s %s.'), Users::get_link($item['edit_name'], $item['edit_address'], $item['edit_id']), Skin::build_date($item['edit_date'])) . "</p>\n";
}
$help .= '<p><ins>' . i18n::s('Text inserted since that version.') . '</ins></p>' . '<p><del>' . i18n::s('Text suppressed from this version.') . '</del></p>' . '<p>' . i18n::s('Caution: restoration can not be reversed!') . '</p>';
$context['components']['boxes'] = Skin::build_box(i18n::s('Help'), $help, 'boxes', 'help');
//
// the navigation sidebar
//
$text = '';
// buttons to display previous and next pages, if any
if (is_object($anchor)) {
$neighbours = $anchor->get_neighbours('version', $item);
$text .= Skin::neighbours($neighbours, 'sidebar');
}
// build a nice sidebar box
if ($text) {
$text =& Skin::build_box(i18n::s('Navigation'), $text, 'neighbours', 'neighbours');
}
$context['components']['neighbours'] = $text;
//
// referrals, if any, in a sidebar
//
$context['components']['referrals'] =& Skin::build_referrals(Versions::get_url($item['id']));
}
// render the skin
render_skin();
示例14: script
$context['page_tools'][] = Skin::build_link(Scripts::get_url('licenses'), i18n::s('Licenses'), 'basic');
// splash message
$text = '<p>' . i18n::s('Click on any link below to access the documentation extracted from each script (phpDoc).') . "</p>\n";
// tree of links to documentation pages
$text .= Codes::beautify($item['content']);
// link to some other server
} else {
$text = '<p>' . i18n::s('The complete documentation is available at the following server:') . '</p>';
// link to the existing reference server, or to the original server
if (!isset($context['reference_server']) || !$context['reference_server']) {
$context['reference_server'] = i18n::s('www.yacs.fr');
}
$text .= '<p>' . Skin::build_link('http://' . $context['reference_server'] . '/', $context['reference_server'], 'external') . "</p>\n";
}
// documentation box
$context['text'] .= Skin::build_box(i18n::s('On-line Documentation'), $text);
// page tools
if (Surfer::is_associate()) {
// patch the server
$context['page_tools'][] = Skin::build_link('scripts/upload.php', i18n::s('Apply a patch'), 'basic');
// signal scripts to run once, if any
if (Safe::glob($context['path_to_root'] . 'scripts/run_once/*.php') !== FALSE) {
$context['page_tools'][] = Skin::build_link('scripts/run_once.php', i18n::s('Run once'), 'basic');
}
// stage from reference server
$context['page_tools'][] = Skin::build_link('scripts/stage.php', i18n::s('Update the software'), 'basic');
// set the reference server
$context['page_tools'][] = Skin::build_link('scripts/configure.php', i18n::s('Configure'), 'basic');
// check script signatures
$context['page_tools'][] = Skin::build_link('scripts/check.php', i18n::s('Check software integrity'), 'basic');
// validate scripts
示例15: array
// back to the category page
$menu = array();
$menu[] = Skin::build_link(Categories::get_permalink($item), i18n::s('Done'), 'button');
$context['text'] .= Skin::finalize_list($menu, 'assistant_bar');
}
Mailer::close();
// no recipient has been found
} elseif (!($recipients =& Members::list_users_by_posts_for_anchor('category:' . $item['id'], 0, 200, 'mail')) || !count($recipients)) {
Logger::error(i18n::s('No recipient has been found.'));
// display the form
} else {
// the form to send a message
$context['text'] .= '<form method="post" action="' . $context['script_url'] . '" onsubmit="return validateDocumentPost(this)" id="main_form"><div>';
// build a nice list of recipients
$label = i18n::s('Message recipients');
$input = Skin::build_box(i18n::s('Select recipients'), $recipients, 'folded');
$fields[] = array($label, $input);
// the subject
$label = i18n::s('Message title');
$input = '<input type="text" name="subject" id="subject" size="70" value="' . encode_field($item['title']) . '" />';
$fields[] = array($label, $input);
// the message
$label = i18n::s('Message content');
$input = Surfer::get_editor('message', '<p>' . $item['title'] . BR . Categories::get_permalink($item) . '</p>');
$fields[] = array($label, $input);
// build the form
$context['text'] .= Skin::build_form($fields);
//
// bottom commands
//
$menu = array();