本文整理汇总了PHP中Overlay类的典型用法代码示例。如果您正苦于以下问题:PHP Overlay类的具体用法?PHP Overlay怎么用?PHP Overlay使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Overlay类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: __toString
public function __toString()
{
$parent_string = parent::__toString();
$output = array();
$output[] = sprintf("<PhotoOverlay%s>", isset($this->id) ? sprintf(" id=\"%s\"", $this->id) : "");
$output[] = $parent_string;
$output[] = "</PhotoOverlay>";
return implode("\n", $output);
}
示例3: __toString
public function __toString()
{
$parent_string = parent::__toString();
$output = array();
$output[] = sprintf("<GroundOverlay%s>", isset($this->id) ? sprintf(" id=\"%s\"", $this->id) : "");
$output[] = $parent_string;
if (isset($this->altitude)) {
$output[] = sprintf("\t<altitude>%f</altitude>", $this->altitude);
}
if (isset($this->altitudeMode)) {
$output[] = $this->altitudeMode->__toString();
}
if (isset($this->latLonBox)) {
$output[] = $this->latLonBox->__toString();
}
$output[] = "</GroundOverlay>";
return implode("\n", $output);
}
示例4: layout
/**
* list sections
*
* @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;
}
// process all items in the list
while ($item = SQL::fetch($result)) {
// get the related overlay
$overlay = Overlay::load($item, 'section:' . $item['id']);
// more text
$text .= Sections::to_xml($item, $overlay);
}
// end of processing
SQL::free($result);
return $text;
}
示例5: Overlay_home_response_content
function Overlay_home_response_content($params)
{
$countries = array();
$files = glob(APP_WEB_DIR . DS . 'img' . DS . 'squareflags' . DS . '*');
foreach ($files as $file) {
$basename = basename($file);
$src = Q_Request::baseUrl() . "/img/squareflags/{$basename}";
$src = str_replace(' ', '%20', $src);
if (empty($firstCountrySrc)) {
$firstCountrySrc = $src;
}
$parts = explode('.', $basename);
$parts2 = explode('_', $parts[0]);
foreach ($parts2 as &$v) {
$v = strtoupper($v[0]) . substr($v, 1);
}
$countries[$src] = implode(' ', $parts2);
}
$counter = Overlay::counter();
$proxyHost = 'http://' . $_SERVER['HTTP_HOST'] . ':' . Q_Config::get('Q', 'node', 'port', '80');
Q_Response::setScriptData('Overlay.proxyHost', $proxyHost);
return Q::view('Overlay/content/home.php', compact('countries', 'firstCountrySrc', 'counter'));
}
示例6: __toString
public function __toString()
{
$parent_string = parent::__toString();
$output = array();
$output[] = sprintf("<ScreenOverlay%s>", isset($this->id) ? sprintf(" id=\"%s\"", $this->id) : "");
$output[] = $parent_string;
if (isset($this->rotation)) {
$output[] = sprintf("\t<rotation>%s</rotation>", $this->rotation);
}
if (isset($this->overlayXY)) {
$output[] = sprintf("\t<overlayXY %s />", (string) $this->overlayXY);
}
if (isset($this->screenXY)) {
$output[] = sprintf("\t<screenXY %s />", (string) $this->screenXY);
}
if (isset($this->rotationXY)) {
$output[] = sprintf("\t<rotationXY %s />", (string) $this->rotationXY);
}
if (isset($this->size)) {
$output[] = sprintf("\t<size %s />", (string) $this->size);
}
$output[] = "</ScreenOverlay>";
return implode("\n", $output);
}
示例7: layout
/**
* list articles
*
* @param resource the SQL result
* @return array
*
* @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
while ($item = SQL::fetch($result)) {
// get the related overlay, if any
$overlay = Overlay::load($item, 'category:' . $item['id']);
// get the anchor
$anchor = Anchors::get($item['anchor']);
// provide an absolute link
$url = Categories::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']);
}
// time of last update
$time = SQL::strtotime($item['edit_date']);
// the section
$root = '';
if ($item['anchor'] && ($anchor = Anchors::get($item['anchor']))) {
$root = ucfirst(trim(strip_tags(Codes::beautify_title($anchor->get_title()))));
}
// the icon to use
$icon = '';
if ($item['thumbnail_url']) {
$icon = $item['thumbnail_url'];
} elseif ($item['anchor'] && ($anchor = Anchors::get($item['anchor'])) && is_callable($anchor, 'get_bullet_url')) {
$icon = $anchor->get_bullet_url();
}
if ($icon) {
$icon = $context['url_to_home'] . $context['url_to_root'] . $icon;
}
// the author(s) is an e-mail address, according to rss 2.0 spec
$author = '';
if (isset($item['create_address'])) {
$author .= $item['create_address'];
}
if (isset($item['create_name']) && trim($item['create_name'])) {
$author .= ' (' . $item['create_name'] . ')';
}
if (isset($item['edit_address']) && trim($item['edit_address']) && $item['create_address'] != $item['edit_address']) {
if ($author) {
$author .= ', ';
}
$author .= $item['edit_address'];
if (isset($item['edit_name']) && trim($item['edit_name'])) {
$author .= ' (' . $item['edit_name'] . ')';
}
}
// list all components for this item
$items[$url] = array($time, $title, $author, $root, $icon, '', '', '');
}
// end of processing
SQL::free($result);
return $items;
}
示例8: 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;
}
// the script used to check all pages at once
Page::insert_script('function cascade_selection_to_all_article_rows(handle) {' . "\n" . ' $("div#articles_panel input[type=\'checkbox\'].row_selector").each(' . "\n" . ' function() { $(this).attr("checked", $(handle).is(":checked"));}' . "\n" . ' );' . "\n" . '}' . "\n");
// table prefix
$text .= Skin::table_prefix('yc-grid');
// table headers
$main = '<input type="checkbox" class="row_selector" onclick="cascade_selection_to_all_article_rows(this);" />';
$cells = array($main, i18n::s('Page'), i18n::s('Rank'));
$text .= Skin::table_row($cells, 'header');
// process all items in the list
include_once $context['path_to_root'] . 'comments/comments.php';
include_once $context['path_to_root'] . 'links/links.php';
$count = 0;
while ($item = SQL::fetch($result)) {
$cells = array();
// 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);
// column to select the row
$cells[] = '<input type="checkbox" name="selected_articles[]" id="article_selector_' . $count . '" class="row_selector" value="' . $item['id'] . '" />';
// 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 locked articles
if (isset($item['locked']) && $item['locked'] == 'Y') {
$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;
}
// 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;
}
// 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']);
//.........这里部分代码省略.........
示例9: elseif
} elseif (isset($context['arguments'][0])) {
$id = $context['arguments'][0];
}
$id = strip_tags($id);
// get the item from the database
$item = Articles::get($id);
// get the related anchor, if any
$anchor = NULL;
if (isset($item['anchor']) && $item['anchor']) {
$anchor = Anchors::get($item['anchor']);
}
// get poll data
include_once '../overlay.php';
$overlay = NULL;
if (isset($item['overlay'])) {
$overlay = Overlay::load($item, 'article:' . $item['id']);
}
// look for the vote
$vote = '';
if (isset($_REQUEST['vote'])) {
$vote = $_REQUEST['vote'];
}
if (isset($context['arguments'][1])) {
$vote = $context['arguments'][1];
}
$vote = strip_tags($vote);
// next url
$next = '';
if (isset($_REQUEST['next'])) {
$next = $_REQUEST['next'];
}
示例10: layout
/**
* list articles
*
* @param resource the SQL result
* @return string
*
* @see layouts/layout.php
**/
function layout($result)
{
global $context;
// we return some text
$text = '';
// empty list
if (!SQL::count($result)) {
return $text;
}
// sanity check
if (!isset($this->focus)) {
$this->focus = NULL;
}
// process all items in the list
include_once $context['path_to_root'] . 'comments/comments.php';
include_once $context['path_to_root'] . 'links/links.php';
$odd = TRUE;
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']);
}
// initialize variables
$prefix = $suffix = $icon = '';
// 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;
}
// 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;
}
// some details
$details = array();
// info on related files --optional
if ($count = Files::count_for_anchor('article:' . $item['id'], TRUE)) {
$details[] = sprintf(i18n::ns('%d file', '%d files', $count), $count);
}
// info on related comments --mandatory
if ($count = Comments::count_for_anchor('article:' . $item['id'], FALSE)) {
$details[] = sprintf(i18n::ns('%d comment', '%d comments', $count), $count);
}
// info on related links --optional
if ($count = Links::count_for_anchor('article:' . $item['id'], TRUE)) {
$details[] = sprintf(i18n::ns('%d link', '%d links', $count), $count);
}
// details
if (count($details)) {
$suffix .= ' <span class="details">(' . ucfirst(implode(', ', $details)) . ')</span>';
}
// flag popular pages
if ($item['hits'] > 300) {
$suffix .= POPULAR_FLAG;
}
// last contribution
if ($item['edit_action']) {
$action = Anchors::get_action_label($item['edit_action']) . ' ';
} else {
$action = i18n::s('edited');
}
if ($item['edit_name']) {
$suffix .= '<br /><span class="details">' . sprintf(i18n::s('%s by %s %s'), $action, Users::get_link($item['edit_name'], $item['edit_address'], $item['edit_id']), Skin::build_date($item['edit_date'])) . '</span>';
} else {
$suffix .= '<br /><span class="details">' . $action . ' ' . Skin::build_date($item['edit_date']) . '</span>';
}
// flag articles updated recently
if ($item['create_date'] >= $context['fresh']) {
$suffix .= NEW_FLAG;
} elseif ($item['edit_date'] >= $context['fresh']) {
$suffix .= UPDATED_FLAG;
}
// insert overlay data, if any
if (is_object($overlay)) {
$suffix .= $overlay->get_text('list', $item, $this->focus);
}
// the hovering title
if ($item['introduction'] && $context['skins_with_details'] == 'Y') {
$hover = strip_tags(Codes::beautify_introduction($item['introduction']));
//.........这里部分代码省略.........
示例11: 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;
}
// layout in a table
$text = Skin::table_prefix('wide');
// 'even' is used for title rows, 'odd' for detail rows
$class_title = 'odd';
$class_detail = 'even';
// build a list of sections
$family = '';
include_once $context['path_to_root'] . 'comments/comments.php';
include_once $context['path_to_root'] . 'links/links.php';
while ($item = SQL::fetch($result)) {
// change the family
if ($item['family'] != $family) {
$family = $item['family'];
// show the family
$text .= Skin::table_suffix() . '<h2><span>' . $family . ' </span></h2>' . "\n" . Skin::table_prefix('wide');
}
// get the related overlay, if any
$overlay = Overlay::load($item, 'section:' . $item['id']);
// get the main anchor
$anchor = Anchors::get($item['anchor']);
// 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 to label the link
if (is_object($overlay)) {
$title = Codes::beautify_title($overlay->get_text('title', $item));
} else {
$title = Codes::beautify_title($item['title']);
}
// use the title as a link to the page
$title =& Skin::build_link($url, $title, 'basic', $hover);
// 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 . ' ';
}
// this is another row of the output
$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']);
//.........这里部分代码省略.........
示例12: layout
/**
* list sections
*
* @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, 'section:' . $item['id']);
// get the main anchor
$anchor = Anchors::get($item['anchor']);
// the url to view this item
$url = Sections::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 restricted and private sections
if ($item['active'] == 'N') {
$prefix .= PRIVATE_FLAG;
} elseif ($item['active'] == 'R') {
$prefix .= RESTRICTED_FLAG;
}
// flag sections 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;
}
// info on related comments
if ($count = Comments::count_for_anchor('section:' . $item['id'], TRUE)) {
$suffix .= ' (' . $count . ')';
}
// details
$details = array();
// info on related sections
if ($count = Sections::count_for_anchor('section:' . $item['id'])) {
$details[] = sprintf(i18n::ns('%d section', '%d sections', $count), $count);
}
// info on related articles
if ($count = Articles::count_for_anchor('section:' . $item['id'])) {
$details[] = sprintf(i18n::ns('%d page', '%d pages', $count), $count);
}
// info on related files
if ($count = Files::count_for_anchor('section:' . $item['id'], TRUE)) {
$details[] = sprintf(i18n::ns('%d file', '%d files', $count), $count);
}
// info on related links
if ($count = Links::count_for_anchor('section:' . $item['id'], TRUE)) {
$details[] = sprintf(i18n::ns('%d link', '%d links', $count), $count);
}
// 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, 'section', $icon);
}
// end of processing
SQL::free($result);
return $items;
}
示例13: 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
//.........这里部分代码省略.........
示例14: 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
$title = $abstract = $author = '';
// 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')) {
$title .= DRAFT_FLAG;
}
// signal restricted and private articles
if ($item['active'] == 'N') {
$title .= PRIVATE_FLAG;
} elseif ($item['active'] == 'R') {
$title .= 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
$title .= Skin::build_link($url, $label, 'basic', $hover);
// signal locked articles
if (isset($item['locked']) && $item['locked'] == 'Y' && Articles::is_owned($item, $anchor)) {
$title .= ' ' . LOCKED_FLAG;
}
// 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)) {
//.........这里部分代码省略.........
示例15: elseif
$id = $_REQUEST['id'];
} elseif (isset($context['arguments'][0])) {
$id = $context['arguments'][0];
}
$id = strip_tags($id);
// get the item from the database
$item = Categories::get($id);
// get the related anchor, if any
$anchor = NULL;
if (isset($item['anchor']) && $item['anchor']) {
$anchor = Anchors::get($item['anchor']);
}
// get the related overlay, if any
$overlay = NULL;
if (isset($item['overlay'])) {
$overlay = Overlay::load($item, 'category:' . $item['id']);
}
// associates and authenticated editors can do what they want
if (Surfer::is_associate() || Surfer::is_member() && is_object($anchor) && $anchor->is_assigned()) {
$permitted = TRUE;
} else {
$permitted = FALSE;
}
// load the skin
load_skin('categories');
// the path to this page
if (is_object($anchor) && $anchor->is_viewable()) {
$context['path_bar'] = $anchor->get_path_bar();
} else {
$context['path_bar'] = array('categories/' => i18n::s('Categories'));
}