本文整理汇总了PHP中Users::get_link方法的典型用法代码示例。如果您正苦于以下问题:PHP Users::get_link方法的具体用法?PHP Users::get_link怎么用?PHP Users::get_link使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Users
的用法示例。
在下文中一共展示了Users::get_link方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: layout
/**
* list servers
*
* @param resource the SQL result
* @return string the rendered text
*
* @see layouts/layout.php
**/
function layout($result)
{
global $context;
// empty list
if (!SQL::count($result)) {
$output = array();
return $output;
}
// we return an array of ($url => $attributes)
$items = array();
// process all items in the list
while ($item = SQL::fetch($result)) {
// initialize variables
$prefix = $suffix = $icon = '';
// the url to view this item
$url = Servers::get_url($item['id']);
// use the title as a label
$label = Skin::strip($item['title'], 10);
// flag files uploaded recently
if ($item['edit_date'] >= $context['fresh']) {
$prefix = NEW_FLAG . $prefix;
}
// description
if ($item['description']) {
$suffix .= ' ' . ucfirst(trim($item['description']));
}
// the menu bar for associates and poster
if (Surfer::is_empowered() || Surfer::is($item['edit_id'])) {
$menu = array(Servers::get_url($item['id'], 'edit') => i18n::s('Edit'), Servers::get_url($item['id'], 'delete') => i18n::s('Delete'));
$suffix .= ' ' . Skin::build_list($menu, 'menu');
}
// add a separator
if ($suffix) {
$suffix = ' - ' . $suffix;
}
// append details to the suffix
$suffix .= BR . '<span class="details">';
// details
$details = array();
// item poster
if ($item['edit_name']) {
$details[] = sprintf(i18n::s('edited by %s %s'), Users::get_link($item['edit_name'], $item['edit_address'], $item['edit_id']), Skin::build_date($item['edit_date']));
}
// the edition date
$details[] = Skin::build_date($item['edit_date']);
// all details
if (count($details)) {
$suffix .= ucfirst(implode(', ', $details)) . "\n";
}
// end of details
$suffix .= '</span>';
// list all components for this item
$items[$url] = array($prefix, $label, $suffix, 'server', $icon);
}
// end of processing
SQL::free($result);
return $items;
}
示例2: layout
/**
* list comments as successive notes in a thread
*
* @param resource the SQL result
* @return string the rendered text
**/
function layout($result)
{
global $context;
// we return formatted text
$text = '';
// empty list
if (!SQL::count($result)) {
return $text;
}
// build a list of comments
while ($item = SQL::fetch($result)) {
// automatic notification
if ($item['type'] == 'notification') {
$text = '<dd class="thread_other" style="font-style: italic;">' . ucfirst(trim($item['description'])) . '</dd>' . $text;
} else {
// link to user profile -- open links in separate window to enable side browsing of participant profiles
if ($item['create_id']) {
if ($user = Users::get($item['create_id']) && $user['full_name']) {
$hover = $user['full_name'];
} else {
$hover = NULL;
}
$author = Users::get_link($item['create_name'], $item['create_address'], $item['create_id'], TRUE, $hover);
} else {
$author = Users::get_link($item['edit_name'], $item['edit_address'], $item['edit_id'], TRUE);
}
// differentiate my posts from others
if (Surfer::get_id() && $item['create_id'] == Surfer::get_id()) {
$style = ' class="thread_me"';
} else {
$style = ' class="thread_other"';
}
// a clickable label
$stamp = '#';
// flag old items on same day
if (!strncmp($item['edit_date'], gmstrftime('%Y-%m-%d %H:%M:%S', time()), 10)) {
$stamp = Skin::build_time($item['edit_date']);
} else {
$stamp = Skin::build_date($item['edit_date']);
}
// append this at the end of the comment
$stamp = ' <div style="float: right; font-size: x-small">' . Skin::build_link(Comments::get_url($item['id']), $stamp, 'basic', i18n::s('Edit')) . '</div>';
// package everything --change order to get oldest first
$text = '<dt' . $style . '>' . $author . '</dt><dd' . $style . '>' . $stamp . ucfirst(trim($item['description'])) . '</dd>' . $text;
}
}
// end of processing
SQL::free($result);
// finalize the returned definition list
if ($text) {
$text = '<dl>' . $text . '</dl>';
}
// process yacs codes
$text = Codes::beautify($text);
return $text;
}
示例3: layout
/**
* list files
*
* @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
while ($item = SQL::fetch($result)) {
// download the file directly
$url = Files::get_url($item['id'], 'fetch', $item['file_name']);
// file title or file name
$label = Codes::beautify_title($item['title']);
if (!$label) {
$label = ucfirst(str_replace(array('%20', '-', '_'), ' ', $item['file_name']));
}
// initialize variables
$prefix = $suffix = '';
$contributor = Users::get_link($item['create_name'], $item['create_address'], $item['create_id']);
$flag = '';
if ($item['create_date'] >= $context['fresh']) {
$flag = NEW_FLAG;
} elseif ($item['edit_date'] >= $context['fresh']) {
$flag = UPDATED_FLAG;
}
$suffix .= '<span class="details"> - ' . sprintf(i18n::s('By %s'), $contributor) . ' ' . Skin::build_date($item['create_date']) . $flag . '</span>';
// signal restricted and private files
if ($item['active'] == 'N' && defined('PRIVATE_FLAG')) {
$prefix .= PRIVATE_FLAG;
} elseif ($item['active'] == 'R' && defined('RESTRICTED_FLAG')) {
$prefix .= RESTRICTED_FLAG;
}
// list all components for this item
$items[$url] = array($prefix, $label, $suffix, 'file', NULL);
}
// end of processing
SQL::free($result);
return $items;
}
示例4: layout
/**
* list comments
*
* @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;
}
// sanity check
if (!isset($this->layout_variant)) {
$this->layout_variant = 'full';
}
// we return an array of ($url => $attributes)
$items = array();
// process all items in the list
include_once $context['path_to_root'] . 'comments/comments.php';
while ($item = SQL::fetch($result)) {
// get the anchor
$anchor = Anchors::get($item['anchor']);
// initialize variables
$prefix = $suffix = '';
// there is no zoom page for comments
$label = '_';
// the icon is a link to comment permalink
$suffix .= Skin::build_link(Comments::get_url($item['id']), Comments::get_img($item['type']), 'basic', i18n::s('View this comment'));
// a link to the user profile
if ($item['create_name']) {
$suffix .= ' ' . Users::get_link($item['create_name'], $item['create_address'], $item['create_id']);
} else {
$suffix .= ' ' . Users::get_link($item['edit_name'], $item['edit_address'], $item['edit_id']);
}
$menu = array();
// the edition date
if ($item['create_date']) {
$menu[] = Skin::build_date($item['create_date']);
} else {
$menu[] = Skin::build_date($item['edit_date']);
}
// the menu bar for associates, editors and poster
if (Comments::allow_modification($anchor, $item)) {
$menu[] = Skin::build_link(Comments::get_url($item['id'], 'edit'), i18n::s('edit'), 'span');
$menu[] = Skin::build_link(Comments::get_url($item['id'], 'delete'), i18n::s('delete'), 'span');
}
if ($menu) {
$suffix .= ' -' . Skin::finalize_list($menu, 'menu');
}
// new line
$suffix .= BR;
// description
if ($description = ucfirst(trim(Codes::beautify($item['description'] . Users::get_signature($item['create_id']))))) {
$suffix .= ' ' . $description;
}
// url to view the comment
$url = Comments::get_url($item['id']);
// list all components for this item
$items[$url] = array($prefix, $label, $suffix, 'comment', NULL);
}
// end of processing
SQL::free($result);
return $items;
}
示例5: 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']));
//.........这里部分代码省略.........
示例6: layout
/**
* list articles for search requests
*
* @param resource the SQL result
* @return array of resulting items ($score, $summary), or NULL
*
* @see layouts/layout.php
**/
function layout($result)
{
global $context;
// we return an array of array($score, $summary)
$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)) {
// one box at a time
$box = '';
// 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 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;
}
// 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);
}
//.........这里部分代码省略.........
示例7: layout
/**
* list files
*
* Recognize following variants:
* - 'section:123' to list items attached to one particular anchor
* - 'no_author' to list items attached to one user profile
*
* @param resource the SQL result
* @return string HTML text to be displayed, or NULL
*
* @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 = '';
}
// process all items in the list
$items = array();
while ($item = SQL::fetch($result)) {
// one box at a time
$box = '';
// get the main anchor
$anchor = Anchors::get($item['anchor']);
// we feature only the head of the list, if we are at the origin page
if (!count($items) && $anchor && is_string($this->focus) && $this->focus == $anchor->get_reference()) {
$box .= Codes::render_object('file', $item['id']);
// no side icon
$icon = '';
// we are listing various files from various places
} else {
$prefix = $suffix = '';
// stream the file
if (Files::is_stream($item['file_name'])) {
$url = Files::get_url($item['id'], 'stream', $item['file_name']);
} else {
$url = Files::get_url($item['id'], 'fetch', $item['file_name']);
}
// absolute url
$url = $context['url_to_home'] . $context['url_to_root'] . $url;
// signal restricted and private files
if ($item['active'] == 'N') {
$prefix .= PRIVATE_FLAG;
} elseif ($item['active'] == 'R') {
$prefix .= RESTRICTED_FLAG;
}
// file title or file name
$label = Codes::beautify_title($item['title']);
if (!$label) {
$label = ucfirst(str_replace(array('%20', '-', '_'), ' ', $item['file_name']));
}
// show a reference to the file for members
$hover = i18n::s('Get the file');
if (Surfer::is_member()) {
$hover .= ' [file=' . $item['id'] . ']';
}
// flag files uploaded recently
if ($item['create_date'] >= $context['fresh']) {
$suffix .= NEW_FLAG;
} elseif ($item['edit_date'] >= $context['fresh']) {
$suffix .= UPDATED_FLAG;
}
// one line of text
$box .= $prefix . Skin::build_link($url, $label, 'basic', $hover) . $suffix;
// side icon
if ($item['thumbnail_url']) {
$icon = $item['thumbnail_url'];
} else {
$icon = $context['url_to_root'] . Files::get_icon_url($item['file_name']);
}
// build the complete HTML element
$icon = '<img src="' . $icon . '" alt="" title="' . encode_field(strip_tags($label)) . '" />';
// make it a clickable link
$icon = Skin::build_link($url, $icon, 'basic');
}
// first line of details
$details = array();
// file poster and last action
if ($this->layout_variant != 'no_author') {
$details[] = sprintf(i18n::s('shared by %s %s'), Users::get_link($item['edit_name'], $item['edit_address'], $item['edit_id']), Skin::build_date($item['edit_date']));
} else {
$details[] = Skin::build_date($item['edit_date']);
}
// downloads
if ($item['hits'] > 1) {
$details[] = Skin::build_number($item['hits'], i18n::s('downloads'));
}
// file size
if ($item['file_size'] > 1) {
$details[] = Skin::build_number($item['file_size'], i18n::s('bytes'));
}
// anchor link
//.........这里部分代码省略.........
示例8: array
if ($text) {
$panels[] = array('resources', i18n::s('Resources'), 'resources_panel', $text);
}
//
// options tab is visible only to site associates
//
if (Surfer::is_associate()) {
$text = '';
// provide information to section owner
if (isset($item['id'])) {
// owner
$label = i18n::s('Owner');
$input = '';
if (isset($item['owner_id'])) {
if ($owner = Users::get($item['owner_id'])) {
$input = Users::get_link($owner['full_name'], $owner['email'], $owner['id']);
} else {
$input = i18n::s('No owner has been found.');
}
}
// change the owner
if (Articles::is_owned($item, $anchor) || Surfer::is_associate()) {
$input .= ' <span class="details">' . Skin::build_link(Articles::get_url($item['id'], 'own'), i18n::s('Change'), 'button') . '</span>';
}
$fields[] = array($label, $input);
}
// the active flag: Yes/public, Restricted/logged, No/associates --we don't care about inheritance, to enable security changes afterwards
if ($cur_article->is_owned() || Surfer::is_associate()) {
$label = i18n::s('Access');
$input = Skin::build_active_set_input($item);
$hint = Skin::build_active_set_hint($anchor);
示例9: sprintf
$context['page_title'] = sprintf(i18n::s('%s: %s'), i18n::s('Reserve'), $context['page_title']);
// assign the file to this surfer
$user = array('nick_name' => Surfer::get_name(), 'id' => Surfer::get_id(), 'email' => Surfer::get_email_address());
if (Files::assign($item['id'], $user)) {
// inform surfer
$context['text'] .= '<p>' . sprintf(i18n::s('You have reserved this file, and you are encouraged to %s as soon as possible, or to %s.'), Skin::build_link(Files::get_url($item['id'], 'edit'), i18n::s('upload an updated version'), 'basic'), Skin::build_link(Files::get_url($item['id'], 'fetch', 'release'), i18n::s('release reservation'), 'basic')) . '</p>';
// help the surfer
} else {
Logger::error(i18n::s('Operation has failed.'));
}
// follow-up commands
$context['text'] .= Skin::build_block(Skin::build_link($anchor->get_url('files'), i18n::s('Done'), 'button'), 'bottom');
// file has been reserved, and surfer is not owner
} elseif ($action != 'confirm' && isset($item['assign_id']) && $item['assign_id'] && !Surfer::is($item['assign_id'])) {
// inform surfer
$context['text'] .= Skin::build_block(sprintf(i18n::s('This file has been assigned to %s %s, and it is likely that an updated version will be made available soon.'), Users::get_link($item['assign_name'], $item['assign_address'], $item['assign_id']), Skin::build_date($item['assign_date'])), 'caution');
// commands
$menu = array();
$menu[] = Skin::build_submit_button(i18n::s('Download this file'), NULL, NULL, 'confirmed', 'no_spin_on_click');
$menu[] = Skin::build_link($anchor->get_url('files'), i18n::s('Cancel'), 'span');
// to get the actual file
$target_href = $context['url_to_home'] . $context['url_to_root'] . Files::get_url($item['id'], 'fetch', $item['file_name']);
// render commands
$context['text'] .= '<form method="post" action="' . $context['script_url'] . '" id="main_form"><div>' . "\n" . Skin::finalize_list($menu, 'assistant_bar') . '<input type="hidden" name="id" value="' . $item['id'] . '" />' . "\n" . '<input type="hidden" name="action" value="confirm" />' . "\n" . '</div></form>' . "\n";
// set the focus
Page::insert_script('$("#confirmed").focus();');
//actual transfer
} elseif ($item['id'] && $item['anchor']) {
// increment the count of downloads
if (!Surfer::is_crawler()) {
Files::increment_hits($item['id']);
示例10: get_link
/**
* build a pretty link to the profile page of this surfer
*
* This function is a proxy for Users::get_link(), limited to current surfer.
*
* @return string some text describing this surfer, with a link to get more information
*
* @see users/users.php
*/
public static function get_link()
{
global $context;
return Users::get_link(Surfer::get_name(), Surfer::get_email_address(), Surfer::get_id());
}
示例11: sprintf
}
// display the form
if ($with_form) {
// reference the anchor page
if (is_object($anchor) && $anchor->is_viewable()) {
$context['text'] .= '<p>' . sprintf(i18n::s('In: %s'), Skin::build_link($anchor->get_url(), $anchor->get_title())) . "</p>\n";
}
// the form to edit an table
$context['text'] .= '<form method="post" action="' . $context['script_url'] . '" onsubmit="return validateDocumentPost(this)" id="main_form"><div>';
// encode fields
$fields = array();
// display info on current version
if (isset($item['id'])) {
// the last poster
if (isset($item['edit_id'])) {
$text = Users::get_link($item['edit_name'], $item['edit_address'], $item['edit_id']) . ' ' . Skin::build_date($item['edit_date']);
$fields[] = array(i18n::s('Posted by'), $text);
}
}
// the title
$label = i18n::s('Title');
$input = '<textarea name="title" id="title" rows="2" cols="50">' . encode_field(isset($item['title']) ? $item['title'] : '') . '</textarea>';
$hint = i18n::s('Please provide a meaningful title.');
$fields[] = array($label, $input, $hint);
// the query
$label = i18n::s('SQL Query');
$input = '<textarea name="query" rows="15" cols="50">' . encode_field(isset($item['query']) ? $item['query'] : '') . '</textarea>';
$hint = i18n::s('The SELECT command submitted to the database');
$fields[] = array($label, $input, $hint);
// is the first row an url to the zoom page?
$label = i18n::s('First column');
示例12: time
//.........这里部分代码省略.........
if ($this->attributes['status'] == 'open') {
// display the induction message
if (isset($this->attributes['induction_message'])) {
$this->feed_back['message'] .= Codes::render($this->attributes['induction_message']);
}
// possible transition to state 'open'
} else {
$this->transition_to_open();
}
// step 1 - at the very beginning of the workflow
if (!isset($this->attributes['status']) || $this->attributes['status'] == 'created') {
// display the induction message
if (isset($this->attributes['induction_message'])) {
$this->feed_back['message'] .= Codes::render($this->attributes['induction_message']);
}
// possible transition to state 'created'
} else {
$this->transition_to_created();
}
// event details
if ($details = $this->get_event_details_text()) {
$rows[] = array($this->get_event_details_label(), $details);
}
// meeting date
if (isset($this->attributes['date_stamp']) && $this->attributes['date_stamp']) {
// offer to update the calendar
$button = '';
if ($this->attributes['status'] == 'stopped') {
} elseif (enrolments::get_record($this->anchor->get_reference())) {
$button = ' ' . Skin::build_link($this->get_url('fetch_ics'), '<img src="' . $context['url_to_root'] . 'included/jscalendar/img.gif" style="border: none; cursor: pointer;" title="' . i18n::s('Update my calendar') . '" onmouseover="this.style.background=\'red\';" onmouseout="this.style.background=\'\'" alt="' . i18n::s('Update my calendar') . '" />', 'basic');
}
$rows[] = array(i18n::s('Date'), Skin::build_date($this->attributes['date_stamp'], 'full') . $button);
}
// meeting duration
if (isset($this->attributes['duration']) && $this->attributes['duration'] && $this->attributes['duration'] < 1440) {
switch ($this->attributes['duration']) {
case 60:
$duration = i18n::s('one hour');
break;
case 120:
$duration = i18n::s('two hours');
break;
default:
$duration = sprintf(i18n::s('%d minutes'), $this->attributes['duration']);
break;
}
$rows[] = array(i18n::s('Duration'), $duration);
}
// build a link to the owner page, if any
if (isset($this->attributes['chairman']) && $this->attributes['chairman']) {
if ($user = Users::get($this->attributes['chairman'])) {
$label = Users::get_link($user['full_name'], NULL, $user['id']);
} else {
$label = $this->attributes['chairman'];
}
$rows[] = array(i18n::s('Chairman'), $label);
}
// finalize status
if (is_callable(array($this, 'finalize_status'))) {
$this->feed_back['status'] = $this->finalize_status($this->feed_back['status']);
}
// finalize menu
if (is_callable(array($this, 'finalize_menu'))) {
$this->feed_back['menu'] = $this->finalize_menu($this->feed_back['menu']);
}
// we have to refresh the page
if ($this->feed_back['reload_this_page']) {
$reload_through_javascript = '<img alt="*" src="' . $context['url_to_home'] . $context['url_to_root'] . 'skins/_reference/ajax/ajax_spinner.gif" style="vertical-align:-3px" /> ';
Page::insert_script('window.location.reload(true);');
$rows[] = array(i18n::s('Status'), $reload_through_javascript);
// display the status line and/or buttons
} elseif (count($this->feed_back['status']) || count($this->feed_back['menu'])) {
$status = '';
// embed status line
if (count($this->feed_back['status'])) {
$status .= implode(BR, $this->feed_back['status']);
}
// embed menu bar
if (count($this->feed_back['menu'])) {
$status .= Skin::finalize_list($this->feed_back['menu'], 'menu_bar');
}
$rows[] = array(i18n::s('Status'), $status);
}
// display commands to page owner
if (count($this->feed_back['commands'])) {
$rows[] = array('', Skin::finalize_list($this->feed_back['commands'], 'menu_bar'));
}
// format text in a table
$text = Skin::table(NULL, $rows, 'grid');
// finalize feed-back
if ($this->feed_back['message']) {
$text .= Skin::build_box($this->get_message_label(), $this->feed_back['message']);
}
// allow for extensions
if (is_callable(array($this, 'get_view_text_extension'))) {
$text .= $this->get_view_text_extension();
}
// job done
return $text;
}
示例13: finalize_update
/**
* do whatever is necessary when a page has been updated
*
* This function:
* - logs the update
* - sends notification to watchers and to followers
* - "touches" the container of the page,
* - ping referred pages remotely (via the pingback protocol)
* - ping selected servers, if any
* - and triggers the hook 'update'.
*
* The first parameter provides the watching context to consider. If call is related
* to the creation of a published page, the context is the section that hosts the new
* page. If call is related to a draft page that has been published, then the context
* is the page itself.
*
* This function is also able to notify followers of the surfer who has initiated the
* action.
*
* @param object the watching context
* @param array attributes of the published page
* @param object page overlay, if any
* @param boolean TRUE if dates should be left unchanged, FALSE otherwise
* @param boolean TRUE if watchers should be notified, FALSE otherwise
* @param boolean TRUE if followers should be notified, FALSE otherwise
*/
public static function finalize_update($anchor, $item, $overlay = NULL, $silently = FALSE, $with_watchers = TRUE, $with_followers = FALSE)
{
global $context;
// proceed only if the page has been published
if (isset($item['publish_date']) && $item['publish_date'] > NULL_DATE) {
// notification to send by e-mail
$mail = array();
$mail['subject'] = sprintf(i18n::c('%s: %s'), i18n::c('Update'), strip_tags($item['title']));
$mail['notification'] = Articles::build_notification('update', $item);
$mail['headers'] = Mailer::set_thread('article:' . $item['id']);
// allow the overlay to prevent notifications of watcherss
if (is_object($overlay) && !$overlay->should_notify_watchers($mail)) {
$with_watchers = FALSE;
}
// send to watchers of this page, and to watchers upwards
if ($with_watchers && ($handle = new Article())) {
$handle->load_by_content($item, $anchor);
$handle->alert_watchers($mail, 'article:update', $item['active'] == 'N');
}
// never notify followers on private pages
if (isset($item['active']) && $item['active'] == 'N') {
$with_followers = FALSE;
}
// allow the overlay to prevent notifications of followers
if (is_object($overlay) && !$overlay->should_notify_followers()) {
$with_followers = FALSE;
}
// send to followers of this user
if ($with_followers && Surfer::get_id()) {
$mail['message'] = Mailer::build_notification($mail['notification'], 2);
Users::alert_watchers('user:' . Surfer::get_id(), $mail);
}
// update anchors
$anchor->touch('article:update', $item['id'], $silently);
// advertise public pages
if (isset($item['active']) && $item['active'] == 'Y') {
// expose links within the page
$raw = '';
if (isset($item['introduction'])) {
$raw .= $item['introduction'];
}
if (isset($item['source'])) {
$raw .= ' ' . $item['source'];
}
if (isset($item['description'])) {
$raw .= ' ' . $item['description'];
}
// pingback to referred links, if any
include_once $context['path_to_root'] . 'links/links.php';
Links::ping($raw, 'article:' . $item['id']);
// ping servers, if any
Servers::notify($anchor->get_url());
}
}
// 'update' hook
if (is_callable(array('Hooks', 'include_scripts'))) {
Hooks::include_scripts('update', $item['id']);
}
// log page update
$label = sprintf(i18n::c('Update: %s'), strip_tags($item['title']));
$poster = Users::get_link($item['edit_name'], $item['edit_address'], $item['edit_id']);
$description = sprintf(i18n::c('Updated by %s in %s'), $poster, $anchor->get_title());
$description .= "\n\n" . '<a href="' . Articles::get_permalink($item) . '">' . $item['title'] . '</a>';
Logger::notify('articles/articles.php: ' . $label, $description);
}
示例14: array
/**
* display content of 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_view_text($host = NULL)
{
$text = '';
$rows = array();
// this page has an explicit owner
if (isset($host['owner_id']) && ($user = Users::get($host['owner_id']))) {
// allow for click-to-call
$click_to_call = Users::get_click_to_call($user);
// display information on the owner
$rows[] = array(i18n::s('Owner'), Users::get_link($user['full_name'], NULL, $user['id']) . ' ' . $click_to_call);
}
// show progress
$rows[] = array(i18n::s('Progress'), $this->get_progress_value());
// type
$rows[] = array(i18n::s('Workflow'), self::get_type_value());
// the status and history
$history = self::get_history();
$rows[] = array(i18n::s('Status'), self::get_status_label($this->attributes['status']) . $history);
$text = Skin::table(NULL, $rows, 'grid');
return $text;
}
示例15: 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;
}