本文整理汇总了PHP中Articles::build_dates方法的典型用法代码示例。如果您正苦于以下问题:PHP Articles::build_dates方法的具体用法?PHP Articles::build_dates怎么用?PHP Articles::build_dates使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Articles
的用法示例。
在下文中一共展示了Articles::build_dates方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sprintf
}
// page editors
if ($items = Articles::list_editors_by_name($item, 0, 7, 'comma5')) {
$details[] = sprintf(i18n::s('%s: %s'), Skin::build_link(Users::get_url('article:' . $item['id'], 'select'), i18n::s('Editors')), $items);
}
// page watchers
if ($items = Articles::list_watchers_by_posts($item, 0, 7, 'comma5')) {
$details[] = sprintf(i18n::s('%s: %s'), Skin::build_link(Users::get_url('article:' . $item['id'], 'watch'), i18n::s('Watchers')), $items);
}
}
// display details, if any
if (count($details)) {
$text .= ucfirst(implode(BR . "\n", $details)) . BR . "\n";
}
// other details
$details =& Articles::build_dates($anchor, $item);
// signal articles to be published
if ($item['publish_date'] <= NULL_DATE) {
if ($cur_article->allows('publication')) {
$label = Skin::build_link(Articles::get_url($item['id'], 'publish'), i18n::s('not published'));
} else {
$label = i18n::s('not published');
}
$details[] = DRAFT_FLAG . ' ' . $label;
}
// the number of hits
if ($item['hits'] > 1 && ($cur_article->is_owned() || (!isset($context['content_without_details']) || $context['content_without_details'] != 'Y' || $cur_article->has_option('with_details')))) {
// flag popular pages
$popular = '';
if ($item['hits'] > 100) {
$popular = POPULAR_FLAG;
示例2: 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;
}
示例3: layout
/**
* list articles as rows in a table
*
* @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
$rows = array();
include_once $context['path_to_root'] . 'comments/comments.php';
include_once $context['path_to_root'] . 'links/links.php';
while ($item = SQL::fetch($result)) {
// get the related overlay
$overlay = Overlay::load($item, 'article:' . $item['id']);
// get the anchor
$anchor = Anchors::get($item['anchor']);
// the url to view this item
$url = Articles::get_permalink($item);
// reset everything
$id = $summary = $owner = $type = $status = $update = $progress = '';
// link to the page
$id = Skin::build_link($url, $item['id'], 'basic');
// 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')) {
$summary .= DRAFT_FLAG;
}
// signal restricted and private articles
if ($item['active'] == 'N') {
$summary .= PRIVATE_FLAG;
} elseif ($item['active'] == 'R') {
$summary .= RESTRICTED_FLAG;
}
// indicate the id in the hovering popup
$hover = i18n::s('View the page');
if (Surfer::is_member()) {
$hover .= ' [article=' . $item['id'] . ']';
}
// use the title to label the link
if (is_object($overlay)) {
$label = Codes::beautify_title($overlay->get_text('title', $item));
} else {
$label = Codes::beautify_title($item['title']);
}
// use the title as a link to the page
$summary .= Skin::build_link($url, $label, 'basic', $hover);
// signal locked articles
if (isset($item['locked']) && $item['locked'] == 'Y' && Articles::is_owned($item, $anchor)) {
$summary .= ' ' . LOCKED_FLAG;
}
// flag articles updated recently
if ($item['expiry_date'] > NULL_DATE && $item['expiry_date'] <= $context['now']) {
$summary .= ' ' . EXPIRED_FLAG;
} elseif ($item['create_date'] >= $context['fresh']) {
$summary .= ' ' . NEW_FLAG;
} elseif ($item['edit_date'] >= $context['fresh']) {
$summary .= ' ' . UPDATED_FLAG;
}
// attachment details
$details = array();
// info on related files
if ($count = Files::count_for_anchor('article:' . $item['id'])) {
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));
}
// combine in-line details
if (count($details)) {
$summary .= ' <span class="details">' . trim(implode(' ', $details)) . '</span>';
}
// dates
$summary .= BR . '<span class="details">' . join(BR, Articles::build_dates($anchor, $item)) . '</span>';
// display all tags
if ($item['tags']) {
$summary .= BR . '<span class="tags">' . Skin::build_tags($item['tags'], 'article:' . $item['id']) . '</span>';
}
// page owner
if (isset($item['owner_id']) && ($owner = Users::get($item['owner_id']))) {
$owner = Users::get_link($owner['full_name'], $owner['email'], $owner['id']);
}
// type is provided by the overlay
if (is_object($overlay)) {
$type = $overlay->get_value('type', '');
}
//.........这里部分代码省略.........