本文整理汇总了PHP中Skin::build_rating_img方法的典型用法代码示例。如果您正苦于以下问题:PHP Skin::build_rating_img方法的具体用法?PHP Skin::build_rating_img怎么用?PHP Skin::build_rating_img使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Skin
的用法示例。
在下文中一共展示了Skin::build_rating_img方法的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 as topics in a forum
*
* @param resource the SQL result
* @return string the rendered text
**/
function layout($result)
{
global $context;
// we return some text
$text = '';
// empty list
if (!SQL::count($result)) {
return $text;
}
// start a table
$text .= Skin::table_prefix('jive');
// headers
$text .= Skin::table_row(array(i18n::s('Topic'), i18n::s('Content')), 'header');
// build a list of articles
$odd = FALSE;
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, if any
$overlay = Overlay::load($item, 'article:' . $item['id']);
// get the anchor
$anchor = Anchors::get($item['anchor']);
// 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']);
}
// one row per article
$text .= '<tr class="' . ($odd ? 'odd' : 'even') . '"><td>';
$odd = !$odd;
// signal articles to be published
if (!isset($item['publish_date']) || $item['publish_date'] <= NULL_DATE || $item['publish_date'] > gmstrftime('%Y-%m-%d %H:%M:%S')) {
$text .= DRAFT_FLAG;
}
// signal restricted and private articles
if ($item['active'] == 'N') {
$text .= PRIVATE_FLAG;
} elseif ($item['active'] == 'R') {
$text .= RESTRICTED_FLAG;
}
// use the title as a link to the page
$text .= Skin::build_link($url, '<strong>' . $title . '</strong>', 'basic');
// signal locked articles
if (isset($item['locked']) && $item['locked'] == 'Y' && Articles::is_owned($item, $anchor)) {
$text .= ' ' . LOCKED_FLAG;
}
// flag articles updated recently
if ($item['expiry_date'] > NULL_DATE && $item['expiry_date'] <= $context['now']) {
$text .= ' ' . EXPIRED_FLAG;
} elseif ($item['create_date'] >= $context['fresh']) {
$text .= ' ' . NEW_FLAG;
} elseif ($item['edit_date'] >= $context['fresh']) {
$text .= ' ' . UPDATED_FLAG;
}
// add details, if any
$details = array();
// poster name
if (isset($context['with_author_information']) && $context['with_author_information'] == 'Y') {
if ($item['create_name']) {
$details[] = sprintf(i18n::s('posted by %s %s'), Users::get_link($item['create_name'], $item['create_address'], $item['create_id']), Skin::build_date($item['create_date']));
}
}
// last update
$details[] = sprintf(i18n::s('Updated %s'), Skin::build_date($item['edit_date']));
// add details to the title
if (count($details)) {
$text .= '<p class="details" style="margin: 3px 0">' . join(', ', $details) . '</p>';
}
// display all tags
if ($item['tags']) {
$text .= '<p class="tags">' . Skin::build_tags($item['tags'], 'article:' . $item['id']) . '</p>';
}
// next cell for the content
$text .= '</td><td width="70%">';
// the content to be displayed
$content = '';
// rating
if ($item['rating_count'] && !(is_object($anchor) && $anchor->has_option('without_rating'))) {
$content .= Skin::build_link(Articles::get_url($item['id'], 'like'), Skin::build_rating_img((int) round($item['rating_sum'] / $item['rating_count'])), 'basic');
}
// the introductory text
if (is_object($overlay)) {
$content .= Codes::beautify_introduction($overlay->get_text('introduction', $item));
} else {
$content .= Codes::beautify_introduction($item['introduction']);
}
// insert overlay data, if any
if (is_object($overlay)) {
$content .= $overlay->get_text('list', $item);
}
// the description
//.........这里部分代码省略.........
示例3: layout
//.........这里部分代码省略.........
// flag articles updated recently
if ($item['expiry_date'] > NULL_DATE && $item['expiry_date'] <= $context['now']) {
$title .= ' ' . EXPIRED_FLAG;
} elseif ($item['create_date'] >= $context['fresh']) {
$title .= ' ' . NEW_FLAG;
} elseif ($item['edit_date'] >= $context['fresh']) {
$title .= ' ' . UPDATED_FLAG;
}
// the icon
if ($item['thumbnail_url']) {
$abstract .= '<a href="' . $context['url_to_root'] . $url . '"><img src="' . $item['thumbnail_url'] . '" class="right_image" alt="" /></a>';
}
// the introductory text
if (is_object($overlay)) {
$abstract .= Codes::beautify_introduction($overlay->get_text('introduction', $item));
} elseif ($item['introduction']) {
$abstract .= Codes::beautify_introduction($item['introduction']);
}
// insert overlay data, if any
if (is_object($overlay)) {
$abstract .= $overlay->get_text('list', $item);
}
// make some abstract out of main text
if (!$item['introduction'] && $context['skins_with_details'] == 'Y') {
$abstract .= Skin::cap(Codes::beautify($item['description'], $item['options']), 50);
}
// attachment details
$details = array();
// info on related files
if ($count = Files::count_for_anchor('article:' . $item['id'], TRUE)) {
Skin::define_img('FILES_LIST_IMG', 'files/list.gif');
$details[] = FILES_LIST_IMG . sprintf(i18n::ns('%d file', '%d files', $count), $count);
}
// info on related links
if ($count = Links::count_for_anchor('article:' . $item['id'], TRUE)) {
Skin::define_img('LINKS_LIST_IMG', 'links/list.gif');
$details[] = LINKS_LIST_IMG . sprintf(i18n::ns('%d link', '%d links', $count), $count);
}
// comments
if ($count = Comments::count_for_anchor('article:' . $item['id'], TRUE)) {
Skin::define_img('COMMENTS_LIST_IMG', 'comments/list.gif');
$details[] = Skin::build_link(Comments::get_url('article:' . $item['id'], 'list'), COMMENTS_LIST_IMG . sprintf(i18n::ns('%d comment', '%d comments', $count), $count));
}
// describe attachments
if (count($details)) {
$abstract .= '<p style="margin: 3px 0;">' . join(', ', $details) . '</p>';
}
// anchors
$anchors = array();
if ($members =& Members::list_categories_by_title_for_member('article:' . $item['id'], 0, 7, 'raw')) {
foreach ($members as $category_id => $attributes) {
// add background color to distinguish this category against others
if (isset($attributes['background_color']) && $attributes['background_color']) {
$attributes['title'] = '<span style="background-color: ' . $attributes['background_color'] . '; padding: 0 3px 0 3px;">' . $attributes['title'] . '</span>';
}
$anchors[] = Skin::build_link(Categories::get_permalink($attributes), $attributes['title'], 'basic');
}
}
if (@count($anchors)) {
$abstract .= '<p class="tags" style="margin: 3px 0">' . implode(' ', $anchors) . '</p>';
}
// poster name
if (isset($context['with_author_information']) && $context['with_author_information'] == 'Y') {
if ($item['create_name']) {
$author = Users::get_link($item['create_name'], $item['create_address'], $item['create_id']);
} else {
$author = Users::get_link($item['edit_name'], $item['edit_address'], $item['edit_id']);
}
}
// more details
$details =& Articles::build_dates($anchor, $item);
// rating
if ($item['rating_count'] && !(is_object($anchor) && $anchor->has_option('without_rating'))) {
$details[] = Skin::build_link(Articles::get_url($item['id'], 'like'), Skin::build_rating_img((int) round($item['rating_sum'] / $item['rating_count'])), 'basic');
}
// page details
if (count($details)) {
$details = '<p class="details">' . join(', ', $details) . '</p>';
}
// this is another row of the output -- title, abstract, (author,) details
if (isset($context['with_author_information']) && $context['with_author_information'] == 'Y') {
$cells = array($title, $abstract, $author, $details);
} else {
$cells = array($title, $abstract, $details);
}
// append this row
$rows[] = $cells;
}
// end of processing
SQL::free($result);
// headers
if (isset($context['with_author_information']) && $context['with_author_information'] == 'Y') {
$headers = array(i18n::s('Topic'), i18n::s('Abstract'), i18n::s('Poster'), i18n::s('Details'));
} else {
$headers = array(i18n::s('Topic'), i18n::s('Abstract'), i18n::s('Details'));
}
// return a sortable table
$text .= Skin::table($headers, $rows, 'grid');
return $text;
}
示例4: layout
/**
* list articles as topics in a forum
*
* @param resource the SQL result
* @return string the rendered text
**/
function layout($result)
{
global $context;
// we return some text
$text = '';
// empty list
if (!SQL::count($result)) {
return $text;
}
// allow for complete styling
$text = '<div class="last_articles">';
// build a list of articles
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 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']);
}
// reset everything
$prefix = $label = $suffix = $icon = '';
// signal articles to be published
if (!isset($item['publish_date']) || $item['publish_date'] <= NULL_DATE || $item['publish_date'] > gmstrftime('%Y-%m-%d %H:%M:%S')) {
$prefix .= DRAFT_FLAG;
}
// signal restricted and private articles
if ($item['active'] == 'N') {
$prefix .= PRIVATE_FLAG;
} elseif ($item['active'] == 'R') {
$prefix .= RESTRICTED_FLAG;
}
// flag expired articles
if ($item['expiry_date'] > NULL_DATE && $item['expiry_date'] <= $context['now']) {
$prefix .= EXPIRED_FLAG . ' ';
} elseif ($item['create_date'] >= $context['fresh']) {
$suffix .= NEW_FLAG;
} elseif ($item['edit_date'] >= $context['fresh']) {
$suffix .= UPDATED_FLAG;
}
// signal locked articles
if (isset($item['locked']) && $item['locked'] == 'Y' && Articles::is_owned($item, $anchor)) {
$suffix .= ' ' . LOCKED_FLAG;
}
// rating
if ($item['rating_count'] && !(is_object($anchor) && $anchor->has_option('without_rating'))) {
$suffix .= ' ' . Skin::build_link(Articles::get_url($item['id'], 'like'), Skin::build_rating_img((int) round($item['rating_sum'] / $item['rating_count'])), 'basic');
}
// indicate the id in the hovering popup
$hover = i18n::s('View the page');
if (Surfer::is_member()) {
$hover .= ' [article=' . $item['id'] . ']';
}
// one box per update
$text .= '<div class="last_article" >';
// use the title as a link to the page
$text .= Skin::build_block($prefix . ucfirst($title) . $suffix, 'header1');
// some details about this page
$details = array();
// page starter and date
if ($item['create_name']) {
$details[] = sprintf(i18n::s('Started by %s'), Users::get_link($item['create_name'], $item['create_address'], $item['create_id'])) . ' ' . Skin::build_date($item['create_date']);
}
// page last modification
if ($item['edit_date'] && $item['edit_action'] == 'article:update' && $item['edit_name']) {
$details[] = Anchors::get_action_label($item['edit_action']) . ' ' . sprintf(i18n::s('by %s'), Users::get_link($item['edit_name'], $item['edit_address'], $item['edit_id'])) . ' ' . Skin::build_date($item['edit_date']);
}
// friends
if ($friends =& Members::list_users_by_posts_for_anchor('article:' . $item['id'], 0, USERS_LIST_SIZE, 'comma5', $item['create_id'])) {
$details[] = sprintf(i18n::s('with %s'), $friends);
}
// people details
if ($details) {
$text .= '<p class="details">' . join(', ', $details) . "</p>\n";
}
// the introductory text
$introduction = '';
if (is_object($overlay)) {
$introduction = $overlay->get_text('introduction', $item);
} elseif ($item['introduction']) {
$introduction = $item['introduction'];
}
if ($introduction) {
$text .= '<div style="margin: 1em 0;">' . Codes::beautify_introduction($introduction) . '</div>';
}
// insert overlay data, if any
if (is_object($overlay)) {
//.........这里部分代码省略.........
示例5: layout
//.........这里部分代码省略.........
if ($introduction) {
$suffix .= ' - ' . Codes::beautify_introduction($introduction);
// link to description, if any
if ($item['description']) {
$suffix .= ' ' . Skin::build_link($url, MORE_IMG, 'more', i18n::s('View the page')) . ' ';
}
}
// insert overlay data, if any
if (is_object($overlay)) {
$suffix .= $overlay->get_text('list', $item);
}
// next line, except if we already are at the beginning of a line
if ($suffix && !preg_match('/<br\\s*\\/>$/', rtrim($suffix))) {
$suffix .= BR;
}
// append details to the suffix
$suffix .= '<span class="details">';
// details
$details = array();
// display details only at the main index page, and also at anchor pages
if (isset($this->focus) && $item['anchor'] != $this->focus) {
// the author
if (isset($context['with_author_information']) && $context['with_author_information'] == 'Y') {
if ($item['create_name'] != $item['edit_name']) {
$details[] = sprintf(i18n::s('by %s, %s'), $item['create_name'], $item['edit_name']);
} else {
$details[] = sprintf(i18n::s('by %s'), $item['create_name']);
}
}
// the last action
$details[] = Anchors::get_action_label($item['edit_action']) . ' ' . Skin::build_date($item['edit_date']);
// the number of hits
if (Surfer::is_logged() && $item['hits'] > 1) {
$details[] = Skin::build_number($item['hits'], i18n::s('hits'));
}
// info on related files
if ($count = Files::count_for_anchor('article:' . $item['id'], TRUE)) {
$details[] = sprintf(i18n::ns('%d file', '%d files', $count), $count);
}
// info on related links
if ($count = Links::count_for_anchor('article:' . $item['id'], TRUE)) {
$details[] = sprintf(i18n::ns('%d link', '%d links', $count), $count);
}
// info on related comments
if ($count = Comments::count_for_anchor('article:' . $item['id'], TRUE)) {
$details[] = sprintf(i18n::ns('%d comment', '%d comments', $count), $count);
}
// rating
if ($item['rating_count'] && !(is_object($anchor) && $anchor->has_option('without_rating'))) {
$details[] = Skin::build_link(Articles::get_url($item['id'], 'like'), Skin::build_rating_img((int) round($item['rating_sum'] / $item['rating_count'])), 'basic');
}
// unusual ranks are signaled to associates and owners
if ($item['rank'] != 10000 && Articles::is_owned($item, $anchor)) {
$details[] = '{' . $item['rank'] . '}';
}
}
// at the user page
if ($this->layout_variant == 'no_author' && Surfer::get_id()) {
if (Members::check('article:' . $item['id'], 'user:' . Surfer::get_id())) {
$label = i18n::s('Stop notifications');
} else {
$label = i18n::s('Watch this page');
}
$menu = array('users/track.php?anchor=' . urlencode('article:' . $item['id']) => $label);
$details[] = Skin::build_list($menu, 'menu');
}
// the main anchor link
if (is_object($anchor) && (!isset($this->focus) || $item['anchor'] != $this->focus)) {
$details[] = sprintf(i18n::s('in %s'), Skin::build_link($anchor->get_url(), ucfirst($anchor->get_title()), 'section'));
}
// combine in-line details
if (count($details)) {
$suffix .= ucfirst(trim(implode(', ', $details)));
}
// end of details
$suffix .= '</span>';
// display all tags
if ($item['tags']) {
$suffix .= ' <span class="tags">' . Skin::build_tags($item['tags'], 'article:' . $item['id']) . '</span>';
}
// strip empty details
$suffix = str_replace(BR . '<span class="details"></span>', '', $suffix);
$suffix = str_replace('<span class="details"></span>', '', $suffix);
// insert a suffix separator
if (trim($suffix)) {
$suffix = ' ' . $suffix;
}
// the icon to put in the left column
if ($item['thumbnail_url']) {
$icon = $item['thumbnail_url'];
} elseif (is_callable(array($anchor, 'get_bullet_url'))) {
$icon = $anchor->get_bullet_url();
}
// list all components for this item
$items[$url] = array($prefix, $title, $suffix, 'article', $icon);
}
// end of processing
SQL::free($result);
return $items;
}
示例6: layout_newest
/**
* layout the newest articles
*
* caution: this function also updates page title directly, and this makes its call non-cacheable
*
* @param array the article
* @return string the rendered text
**/
function layout_newest($item)
{
global $context;
// get the related overlay, if any
$overlay = Overlay::load($item, 'article:' . $item['id']);
// get the anchor
$anchor = Anchors::get($item['anchor']);
// the url to view this item
$url = Articles::get_permalink($item);
// reset the rendering engine between items
Codes::initialize($url);
// build a title
if (is_object($overlay)) {
$title = Codes::beautify_title($overlay->get_text('title', $item));
} else {
$title = Codes::beautify_title($item['title']);
}
// title prefix & suffix
$text = $prefix = $suffix = '';
// flag articles updated recently
if ($context['site_revisit_after'] < 1) {
$context['site_revisit_after'] = 2;
}
$context['fresh'] = gmstrftime('%Y-%m-%d %H:%M:%S', mktime(0, 0, 0, date("m"), date("d") - $context['site_revisit_after'], date("Y")));
// link to permalink
if (Surfer::is_empowered()) {
$title = Skin::build_box_title($title, $url, i18n::s('Permalink'));
}
// signal articles to be published
if ($item['publish_date'] <= NULL_DATE) {
$prefix .= DRAFT_FLAG;
} else {
if ($item['publish_date'] > NULL_DATE && $item['publish_date'] > $context['now']) {
$prefix .= DRAFT_FLAG;
}
}
// 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 article
if ($item['expiry_date'] > NULL_DATE && $item['expiry_date'] <= $context['now']) {
$suffix .= EXPIRED_FLAG;
}
// update page title directly
$text .= Skin::build_block($prefix . $title . $suffix, 'title');
// if this article has a specific icon, use it
if ($item['icon_url']) {
$icon = $item['icon_url'];
} elseif ($item['anchor'] && ($anchor = Anchors::get($item['anchor']))) {
$icon = $anchor->get_icon_url();
}
// if we have a valid image
if (preg_match('/(.gif|.jpg|.jpeg|.png)$/i', $icon)) {
// fix relative path
if (!preg_match('/^(\\/|http:|https:|ftp:)/', $icon)) {
$icon = $context['url_to_root'] . $icon;
}
// flush the image on the right
$text .= '<img src="' . $icon . '" class="right_image" alt="" />';
}
// article rating, if the anchor allows for it
if (!is_object($anchor) || !$anchor->has_option('without_rating')) {
// report on current rating
$label = '';
if ($item['rating_count']) {
$label = Skin::build_rating_img((int) round($item['rating_sum'] / $item['rating_count'])) . ' ';
}
$label .= i18n::s('Rate this page');
// allow for rating
$text .= Skin::build_link(Articles::get_url($item['id'], 'like'), $label, 'basic');
}
// the introduction text, if any
if (is_object($overlay)) {
$text .= Skin::build_block($overlay->get_text('introduction', $item), 'introduction');
} else {
$text .= Skin::build_block($item['introduction'], 'introduction');
}
// insert overlay data, if any
if (is_object($overlay)) {
$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'))) {
//.........这里部分代码省略.........
示例7: array
if (isset($item['tags'])) {
$context['page_tags'] =& Skin::build_tags($item['tags']);
}
// one detail per line
$text .= '<p class="details">';
$details = array();
// add details from the overlay, if any
if (is_object($overlay) && ($more = $overlay->get_text('details', $item))) {
$details[] = $more;
}
// article rating, if the anchor allows for it, and if no rating has already been registered
if (!Articles::has_option('without_rating', $anchor, $item) && !Articles::has_option('rate_as_digg', $anchor, $item)) {
// report on current rating
$label = '';
if ($item['rating_count']) {
$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']) . ' ';
}
if (!$label) {
$label .= i18n::s('Rate this page');
}
// link to the rating page
$label = Skin::build_link(Articles::get_url($item['id'], 'like'), $label, 'span', i18n::s('Rate this page'));
// feature page rating
$details[] = $label;
}
// the source, if any
if ($item['source']) {
if (preg_match('/(http|https|ftp):\\/\\/([^\\s]+)/', $item['source'], $matches)) {
$item['source'] = Skin::build_link($matches[0], $matches[0], 'external');
} elseif (strpos($item['source'], '[') === 0) {
if ($attributes = Links::transform_reference($item['source'])) {
示例8: layout
//.........这里部分代码省略.........
// signal articles to be published
if ($item['publish_date'] <= NULL_DATE || $item['publish_date'] > gmstrftime('%Y-%m-%d %H:%M:%S')) {
$prefix .= DRAFT_FLAG;
}
// signal restricted and private articles
if ($item['active'] == 'N') {
$prefix .= PRIVATE_FLAG;
} elseif ($item['active'] == 'R') {
$prefix .= RESTRICTED_FLAG;
}
// introduction
$introduction = '';
if (is_object($overlay)) {
$introduction = $overlay->get_text('introduction', $item);
} else {
$introduction = $item['introduction'];
}
// the introductory text
if ($introduction) {
$suffix .= ' - ' . Codes::beautify_introduction($introduction);
// link to description, if any
if ($item['description']) {
$suffix .= ' ' . Skin::build_link($url, MORE_IMG, 'more', i18n::s('View the page')) . ' ';
}
}
// insert overlay data, if any
if (is_object($overlay)) {
$suffix .= $overlay->get_text('list', $item);
}
// details
$details = array();
// the author
if ($item['create_name'] != $item['edit_name']) {
$details[] = sprintf(i18n::s('by %s, %s'), Users::get_link($item['create_name'], $item['create_address'], $item['create_id']), Users::get_link($item['edit_name'], $item['edit_address'], $item['edit_id']));
} else {
$details[] = sprintf(i18n::s('by %s'), Users::get_link($item['create_name'], $item['create_address'], $item['create_id']));
}
// the last action
$details[] = Anchors::get_action_label($item['edit_action']) . ' ' . Skin::build_date($item['edit_date']);
// the number of hits
if (Surfer::is_logged() && $item['hits'] > 1) {
$details[] = Skin::build_number($item['hits'], i18n::s('hits'));
}
// info on related files
if ($count = Files::count_for_anchor('article:' . $item['id'])) {
$details[] = sprintf(i18n::ns('%d file', '%d files', $count), $count);
}
// info on related links
if ($count = Links::count_for_anchor('article:' . $item['id'], TRUE)) {
$details[] = sprintf(i18n::ns('%d link', '%d links', $count), $count);
}
// info on related comments
if ($count = Comments::count_for_anchor('article:' . $item['id'])) {
$details[] = sprintf(i18n::ns('%d comment', '%d comments', $count), $count);
}
// rating
if ($item['rating_count'] && !(is_object($anchor) && $anchor->has_option('without_rating'))) {
$details[] = Skin::build_link(Articles::get_url($item['id'], 'like'), Skin::build_rating_img((int) round($item['rating_sum'] / $item['rating_count'])), 'basic');
}
// the main anchor link
if (is_object($anchor)) {
$details[] = sprintf(i18n::s('in %s'), Skin::build_link($anchor->get_url(), ucfirst($anchor->get_title()), 'section'));
}
// display all tags
if ($item['tags']) {
$details[] = '<span class="tags">' . Skin::build_tags($item['tags'], 'article:' . $item['id']) . '</span>';
}
// combine in-line details
if (count($details)) {
$suffix .= '<p class="details">' . Skin::finalize_list($details, 'menu') . '</p>';
}
// insert a suffix separator
if (trim($suffix)) {
$suffix = ' ' . $suffix;
}
// item summary
$box .= $prefix . Skin::build_link($url, $title, 'article') . $suffix;
// the icon to put in the left column
if ($item['thumbnail_url']) {
$icon = $item['thumbnail_url'];
} elseif (is_callable(array($anchor, 'get_bullet_url'))) {
$icon = $anchor->get_bullet_url();
}
// build the complete HTML element
if ($icon) {
$icon = '<img src="' . $icon . '" alt="" title="' . encode_field(strip_tags($title)) . '" />';
// make it a clickable link
$icon = Skin::build_link($url, $icon, 'basic');
// default icon
} else {
$icon = DECORATED_IMG;
}
// layout this item
$list = array(array($box, $icon));
$items[] = array($item['score'], Skin::finalize_list($list, 'decorated'));
}
// end of processing
SQL::free($result);
return $items;
}
示例9: layout
/**
* list articles as a table of content of a manual
*
* @param resource the SQL result
* @return string the rendered text
**/
function layout($result)
{
global $context;
// we return some text
$text = '';
// empty list
if (!SQL::count($result)) {
return $text;
}
// build a list of articles
include_once $context['path_to_root'] . 'links/links.php';
$text .= '<ul class="manual">';
while ($item = SQL::fetch($result)) {
// get the related overlay, if any
$overlay = Overlay::load($item, 'article:' . $item['id']);
// get the anchor
$anchor = Anchors::get($item['anchor']);
// 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']);
}
// reset everything
$prefix = $label = $suffix = $icon = $details = '';
// signal articles to be published
if (!isset($item['publish_date']) || $item['publish_date'] <= NULL_DATE || $item['publish_date'] > gmstrftime('%Y-%m-%d %H:%M:%S')) {
$prefix .= DRAFT_FLAG;
}
// signal restricted and private articles
if (isset($item['active']) && $item['active'] == 'N') {
$prefix .= PRIVATE_FLAG;
} elseif (isset($item['active']) && $item['active'] == 'R') {
$prefix .= RESTRICTED_FLAG;
}
// flag 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;
}
// attachment details
$details = array();
// info on related files
if ($count = Files::count_for_anchor('article:' . $item['id'], TRUE)) {
Skin::define_img('FILES_LIST_IMG', 'files/list.gif');
$details[] = FILES_LIST_IMG . sprintf(i18n::ns('%d file', '%d files', $count), $count);
}
// info on related links
if ($count = Links::count_for_anchor('article:' . $item['id'], TRUE)) {
Skin::define_img('LINKS_LIST_IMG', 'links/list.gif');
$details[] = LINKS_LIST_IMG . sprintf(i18n::ns('%d link', '%d links', $count), $count);
}
// rating
if ($item['rating_count']) {
$details[] = Skin::build_link(Articles::get_url($item['id'], 'like'), Skin::build_rating_img((int) round($item['rating_sum'] / $item['rating_count'])), 'basic');
}
// describe attachments
if (count($details)) {
$suffix .= ' <span class="details">' . join(', ', $details) . '</span>';
}
// display all tags
if ($item['tags']) {
$suffix .= ' <span class="details">- ' . Skin::build_tags($item['tags'], 'article:' . $item['id']) . '</span>';
}
// make a link
$label = $prefix . Skin::build_link($url, $title, 'basic') . $suffix;
// use the title as a link to the page
$text .= '<li>' . $label . "</li>\n";
}
$text .= '</ul>' . "\n";
// end of processing
SQL::free($result);
return $text;
}
示例10: layout
/**
* list articles as topics in a forum
*
* @param resource the SQL result
* @return string the rendered text
**/
function layout($result)
{
global $context;
// we return some text
$text = '';
// empty list
if (!SQL::count($result)) {
return $text;
}
// page size for comments
include_once $context['path_to_root'] . 'comments/layout_comments_as_updates.php';
$layout = new Layout_comments_as_updates();
// build a list of articles
$rows = array();
include_once $context['path_to_root'] . 'comments/comments.php';
while ($item = SQL::fetch($result)) {
// get the related overlay
$overlay = Overlay::load($item, 'article:' . $item['id']);
// get the 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']);
}
// reset everything
$text = $prefix = $label = $suffix = $icon = '';
// signal articles to be published
if (!isset($item['publish_date']) || $item['publish_date'] <= NULL_DATE || $item['publish_date'] > gmstrftime('%Y-%m-%d %H:%M:%S')) {
$prefix .= DRAFT_FLAG;
}
// signal restricted and private articles
if ($item['active'] == 'N') {
$prefix .= PRIVATE_FLAG;
} elseif ($item['active'] == 'R') {
$prefix .= RESTRICTED_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 . ' ';
}
// rating
if ($item['rating_count'] && !(is_object($anchor) && $anchor->has_option('without_rating'))) {
$suffix .= ' ' . Skin::build_link(Articles::get_url($item['id'], 'like'), Skin::build_rating_img((int) round($item['rating_sum'] / $item['rating_count'])), 'basic');
}
// select an icon for this thread
$item['comments_count'] = Comments::count_for_anchor('article:' . $item['id']);
if (is_object($overlay) && $overlay->attributes['overlay_type'] == 'poll') {
Skin::define_img('POLL_IMG', 'articles/poll.gif');
$icon = POLL_IMG;
} elseif ($item['rank'] < 10000) {
Skin::define_img('STICKY_THREAD_IMG', 'articles/sticky_thread.gif');
$icon = STICKY_THREAD_IMG;
} elseif (isset($item['comments_count']) && $item['comments_count'] >= 20) {
Skin::define_img('VERY_HOT_THREAD_IMG', 'articles/very_hot_thread.gif');
$icon = VERY_HOT_THREAD_IMG;
} elseif (isset($item['comments_count']) && $item['comments_count'] >= 10) {
$icon = HOT_THREAD_IMG;
} else {
$icon = THREAD_IMG;
}
// indicate the id in the hovering popup
$hover = i18n::s('View the page');
if (Surfer::is_member()) {
$hover .= ' [article=' . $item['id'] . ']';
}
// use the title as a link to the page
$title = $prefix . Skin::build_link($url, ucfirst($title), 'basic', $hover) . $suffix;
$suffix = '';
// the introductory text
$introduction = '';
if (is_object($overlay)) {
$introduction = $overlay->get_text('introduction', $item);
} elseif ($item['introduction']) {
$introduction = $item['introduction'];
}
if ($introduction) {
$suffix .= BR . Codes::beautify_introduction($introduction);
}
// insert overlay data, if any
if (is_object($overlay)) {
$suffix .= $overlay->get_text('list', $item);
}
// shortcuts to comments pages
if (isset($item['comments_count']) && ($pages = (int) ceil($item['comments_count'] / $layout->items_per_page())) && $pages > 1) {
$suffix .= '<p class="details">Pages ';
for ($index = 1; $index <= $pages; $index++) {
//.........这里部分代码省略.........
示例11: layout
/**
* list articles as slashdot do
*
* @param resource the SQL result
* @return string the rendered text
**/
function layout($result)
{
global $context;
// we return some text
$text = '';
// empty list
if (!SQL::count($result)) {
return $text;
}
// build a list of articles
include_once $context['path_to_root'] . 'articles/article.php';
include_once $context['path_to_root'] . 'comments/comments.php';
include_once $context['path_to_root'] . 'links/links.php';
$class = 'even';
while ($item = SQL::fetch($result)) {
// get the related overlay
$overlay = Overlay::load($item, 'article:' . $item['id']);
// get the anchor
$anchor = Anchors::get($item['anchor']);
// 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']);
}
// reset everything
$content = $prefix = $label = $suffix = $icon = '';
// the icon to put aside
if ($item['thumbnail_url']) {
$icon = $item['thumbnail_url'];
}
if ($icon) {
$icon = '<a href="' . $context['url_to_root'] . $url . '"><img src="' . $icon . '" class="right_image" alt="" title="' . encode_field(i18n::s('More')) . '" /></a>';
}
// flag sticky pages
if ($item['rank'] < 10000) {
$prefix .= STICKY_FLAG;
}
// signal articles to be published
if ($item['publish_date'] <= NULL_DATE || $item['publish_date'] > $context['now']) {
$prefix .= DRAFT_FLAG;
}
// 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 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;
}
// rating
if ($item['rating_count'] && !(is_object($anchor) && $anchor->has_option('without_rating'))) {
$suffix .= Skin::build_link(Articles::get_url($item['id'], 'like'), Skin::build_rating_img((int) round($item['rating_sum'] / $item['rating_count'])), 'basic');
}
// the full introductory text
if ($item['introduction']) {
$content .= Codes::beautify_introduction($item['introduction']);
} elseif (!is_object($overlay)) {
$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);
}
// 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 modification date
if ($item['edit_date'] > NULL_DATE) {
$details[] = Skin::build_date($item['edit_date']);
}
// read the article
$details[] = Skin::build_link($url, i18n::s('More'), 'basic');
//.........这里部分代码省略.........
示例12: layout
/**
* list articles
*
* @param resource the SQL result
* @return array of resulting items, or NULL
*
* @see layouts/layout.php
**/
function layout($result)
{
global $context;
// we return an array of ($url => $attributes)
$items = array();
// empty list
if (!SQL::count($result)) {
return $items;
}
// process all items in the list
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, if any
$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);
// 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']);
}
// initialize variables
$prefix = $suffix = $icon = '';
// flag sticky pages
if ($item['rank'] < 10000) {
$prefix .= STICKY_FLAG;
}
// signal articles to be published
if ($item['publish_date'] <= NULL_DATE || $item['publish_date'] > gmstrftime('%Y-%m-%d %H:%M:%S')) {
$prefix .= DRAFT_FLAG;
}
// 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 articles that are dead, or created or updated very recently
if ($item['expiry_date'] > NULL_DATE && $item['expiry_date'] <= $context['now']) {
$prefix .= EXPIRED_FLAG;
} elseif ($item['create_date'] >= $context['fresh']) {
$suffix .= ' ' . NEW_FLAG;
} elseif ($item['edit_date'] >= $context['fresh']) {
$suffix .= ' ' . UPDATED_FLAG;
}
// rating
if ($item['rating_count'] && !(is_object($anchor) && $anchor->has_option('without_rating'))) {
$suffix .= Skin::build_rating_img((int) round($item['rating_sum'] / $item['rating_count']));
}
// info on related comments
if ($count = Comments::count_for_anchor('article:' . $item['id'], TRUE)) {
$suffix .= ' (' . $count . ')';
}
// details
$details = array();
// info on related files
if ($count = Files::count_for_anchor('article:' . $item['id'], TRUE)) {
$details[] = sprintf(i18n::ns('%d file', '%d files', $count), $count);
}
// info on related links
if ($count = Links::count_for_anchor('article:' . $item['id'], TRUE)) {
$details[] = sprintf(i18n::ns('%d link', '%d links', $count), $count);
}
// flag popular pages
if ($item['hits'] > 300) {
$details[] = POPULAR_FLAG;
}
// the main anchor link
if (is_object($anchor) && (!isset($this->focus) || $item['anchor'] != $this->focus)) {
$details[] = sprintf(i18n::s('in %s'), Skin::build_link($anchor->get_url(), ucfirst($anchor->get_title()), 'section'));
}
// combine in-line details
if (count($details)) {
$suffix .= ' - <span class="details">' . trim(implode(', ', $details)) . '</span>';
}
// list all components for this item
$items[$url] = array($prefix, $title, $suffix, 'article', $icon);
}
// end of processing
SQL::free($result);
return $items;
}
示例13: layout
/**
* list dates
*
* Recognize following variants:
* - 'no_anchor' to list items attached to one particular anchor
* - 'no_author' to list items attached to one user prodate
*
* @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
include_once $context['path_to_root'] . 'comments/comments.php';
include_once $context['path_to_root'] . 'links/links.php';
while ($item = SQL::fetch($result)) {
// initialize variables
$prefix = $suffix = $icon = '';
// the url to view this item
$url = Articles::get_permalink($item);
// build a valid label
$label = Codes::beautify_title($item['title']);
// the introductory text
if ($item['introduction']) {
$suffix .= ' - ' . Codes::strip($item['introduction']);
// link to description, if any
if ($item['description']) {
$suffix .= ' ' . Skin::build_link($url, MORE_IMG, 'more', i18n::s('View the page')) . ' ';
}
}
// 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']));
}
// info on related files
if ($count = Files::count_for_anchor('article:' . $item['id'], TRUE)) {
$details[] = sprintf(i18n::ns('%d file', '%d files', $count), $count);
}
// info on related links
if ($count = Links::count_for_anchor('article:' . $item['id'], TRUE)) {
$details[] = sprintf(i18n::ns('%d link', '%d links', $count), $count);
}
// info on related comments
if ($count = Comments::count_for_anchor('article:' . $item['id'], TRUE)) {
$details[] = sprintf(i18n::ns('%d comment', '%d comments', $count), $count);
}
// rating
if ($item['rating_count']) {
$details[] = Skin::build_link(Articles::get_url($item['id'], 'like'), Skin::build_rating_img((int) round($item['rating_sum'] / $item['rating_count'])), 'basic');
}
// all details
if (count($details)) {
$suffix .= BR . '<span class="details">' . ucfirst(implode(', ', $details)) . '</span>';
}
// the icon to put in the left column
if ($item['thumbnail_url']) {
$icon = $item['thumbnail_url'];
}
// list all components for this item
$items[$url] = array($prefix, $label, $suffix, 'date', $icon, $item['date_stamp']);
}
// end of processing
SQL::free($result);
return $items;
}
示例14: layout
//.........这里部分代码省略.........
if ($item['active'] == 'N') {
$prefix .= PRIVATE_FLAG;
} elseif ($item['active'] == 'R') {
$prefix .= RESTRICTED_FLAG;
}
// the introductory text
if (is_object($overlay)) {
$introduction = $overlay->get_text('introduction', $item);
} else {
$introduction = $item['introduction'];
}
if ($introduction) {
$suffix .= BR . Codes::beautify_introduction($introduction);
}
// insert overlay data, if any
if (is_object($overlay)) {
$suffix .= $overlay->get_text('list', $item);
}
// append details to the suffix
$suffix .= BR . '<span class="details">';
// details
$details = array();
// the author
if (isset($context['with_author_information']) && $context['with_author_information'] == 'Y') {
if ($item['create_name'] != $item['edit_name']) {
$details[] = sprintf(i18n::s('by %s, %s'), $item['create_name'], $item['edit_name']);
} else {
$details[] = sprintf(i18n::s('by %s'), $item['create_name']);
}
}
// the last action
$details[] = Anchors::get_action_label($item['edit_action']) . ' ' . Skin::build_date($item['edit_date']);
// the number of hits
if (Surfer::is_logged() && $item['hits'] > 1) {
$details[] = Skin::build_number($item['hits'], i18n::s('hits'));
}
// info on related files
$stats = Files::stat_for_anchor('article:' . $item['id']);
if ($stats['count']) {
$details[] = sprintf(i18n::ns('%d file', '%d files', $stats['count']), $stats['count']);
}
// info on related links
$stats = Links::stat_for_anchor('article:' . $item['id']);
if ($stats['count']) {
$details[] = sprintf(i18n::ns('%d link', '%d links', $stats['count']), $stats['count']);
}
// info on related comments
$stats = Comments::stat_for_anchor('article:' . $item['id']);
if ($stats['count']) {
$details[] = sprintf(i18n::ns('%d comment', '%d comments', $stats['count']), $stats['count']);
}
// rating
if ($item['rating_count'] && !(is_object($anchor) && $anchor->has_option('without_rating'))) {
$details[] = Skin::build_link(Articles::get_url($item['id'], 'like'), Skin::build_rating_img((int) round($item['rating_sum'] / $item['rating_count'])), 'basic');
}
// combine in-line details
if (count($details)) {
$suffix .= ucfirst(trim(implode(', ', $details)));
}
// list up to three categories by title, if any
$anchors = array();
if ($members =& Members::list_categories_by_title_for_member('article:' . $item['id'], 0, 7, 'raw')) {
foreach ($members as $id => $attributes) {
// add background color to distinguish this category against others
if (isset($attributes['background_color']) && $attributes['background_color']) {
$attributes['title'] = '<span style="background-color: ' . $attributes['background_color'] . '; padding: 0 3px 0 3px;">' . $attributes['title'] . '</span>';
}
$anchors[] = Skin::build_link(Categories::get_permalink($attributes), $attributes['title'], 'basic');
}
}
if (count($anchors)) {
$suffix .= BR . sprintf(i18n::s('In %s'), implode(' / ', $anchors));
}
// end of details
$suffix .= '</span>';
// strip empty details
$suffix = str_replace(BR . '<span class="details"></span>', '', $suffix);
$suffix = str_replace('<span class="details"></span>', '', $suffix);
// the icon to put in the left column
if ($item['thumbnail_url']) {
$icon = $item['thumbnail_url'];
}
// commands
$commands = array(Skin::build_link(Articles::get_url($item['id'], 'edit'), i18n::s('edit'), 'basic'), Skin::build_link(Articles::get_url($item['id'], 'delete'), i18n::s('delete'), 'basic'));
// link to this page
$cells[] = $prefix . Skin::build_link($url, $title, 'article') . ' - ' . Skin::finalize_list($commands, 'menu') . $suffix;
// ranking
$cells[] = '<input type="text" size="5" name="article_rank_' . $item['id'] . '" value="' . $item['rank'] . '" onfocus="$(\'#article_selector_' . $count . '\').attr(\'checked\', \'checked\');" onchange="$(\'#act_on_articles\').prop(\'selectedIndex\', 9);" />';
// append the row
$text .= Skin::table_row($cells, $count++);
}
// select all rows
$cells = array('<input type="checkbox" class="row_selector" onclick="cascade_selection_to_all_article_rows(this);" />', i18n::s('Select all/none'), '');
$text .= Skin::table_row($cells, $count++);
// table suffix
$text .= Skin::table_suffix();
// end of processing
SQL::free($result);
return $text;
}
示例15: layout
/**
* list articles as a daily weblog do
*
* @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)) {
if (Surfer::is_associate()) {
$text .= '<p>' . sprintf(i18n::s('Use the %s to populate this server.'), Skin::build_link('help/populate.php', i18n::s('Content Assistant'), 'shortcut')) . '</p>';
}
return $text;
}
// build a list of articles
include_once $context['path_to_root'] . 'comments/comments.php';
include_once $context['path_to_root'] . 'links/links.php';
while ($item = SQL::fetch($result)) {
// three components per box
$box = array();
$box['date'] = '';
$box['title'] = '';
$box['content'] = '';
// get the related overlay, if any
$overlay = Overlay::load($item, 'article:' . $item['id']);
// get the anchor
$anchor = Anchors::get($item['anchor']);
// permalink
$url = Articles::get_permalink($item);
// make a live title
if (is_object($overlay)) {
$box['title'] .= Codes::beautify_title($overlay->get_text('title', $item));
} else {
$box['title'] .= Codes::beautify_title($item['title']);
}
// make a clickable title
$box['title'] = Skin::build_link($url, $box['title'], 'basic');
// signal restricted and private articles
if ($item['active'] == 'N') {
$box['title'] = PRIVATE_FLAG . $box['title'];
} elseif ($item['active'] == 'R') {
$box['title'] = RESTRICTED_FLAG . $box['title'];
}
// flag articles updated recently
if ($item['expiry_date'] > NULL_DATE && $item['expiry_date'] <= $context['now']) {
$box['title'] .= EXPIRED_FLAG;
} elseif ($item['create_date'] >= $context['fresh']) {
$box['title'] .= NEW_FLAG;
} elseif ($item['edit_date'] >= $context['fresh']) {
$box['title'] .= UPDATED_FLAG;
}
// what's the date of publication?
if (isset($item['publish_date']) && $item['publish_date'] > NULL_DATE) {
$box['date'] .= Skin::build_date($item['publish_date'], 'publishing');
}
// the icon to put aside - never use anchor images
if ($item['icon_url']) {
$box['content'] .= '<a href="' . $context['url_to_root'] . $url . '"><img src="' . $item['icon_url'] . '" class="left_image" alt="" /></a>';
}
// details
$details = array();
// rating
if ($item['rating_count'] && !(is_object($anchor) && $anchor->has_option('without_rating'))) {
$details[] = Skin::build_link(Articles::get_url($item['id'], 'like'), Skin::build_rating_img((int) round($item['rating_sum'] / $item['rating_count'])), 'basic');
}
// show details
if (count($details)) {
$box['content'] .= '<p class="details">' . implode(' ~ ', $details) . '</p>' . "\n";
}
// list categories by title, if any
if ($items = Members::list_categories_by_title_for_member('article:' . $item['id'], 0, 7, 'raw')) {
$tags = array();
foreach ($items as $id => $attributes) {
// add background color to distinguish this category against others
if (isset($attributes['background_color']) && $attributes['background_color']) {
$attributes['title'] = '<span style="background-color: ' . $attributes['background_color'] . '; padding: 0 3px 0 3px;">' . $attributes['title'] . '</span>';
}
$tags[] = Skin::build_link(Categories::get_permalink($attributes), $attributes['title'], 'basic');
}
$box['content'] .= '<p class="tags">' . implode(' ', $tags) . '</p>';
}
// the introduction text, if any
if (is_object($overlay)) {
$box['content'] .= Skin::build_block($overlay->get_text('introduction', $item), 'introduction');
} else {
$box['content'] .= Skin::build_block($item['introduction'], 'introduction');
}
// insert overlay data, if any
if (is_object($overlay)) {
$box['content'] .= $overlay->get_text('list', $item);
}
// the description
$box['content'] .= Skin::build_block($item['description'], 'description', '', $item['options']);
// a compact list of attached files
//.........这里部分代码省略.........