当前位置: 首页>>代码示例>>PHP>>正文


PHP Users::get_permalink方法代码示例

本文整理汇总了PHP中Users::get_permalink方法的典型用法代码示例。如果您正苦于以下问题:PHP Users::get_permalink方法的具体用法?PHP Users::get_permalink怎么用?PHP Users::get_permalink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Users的用法示例。


在下文中一共展示了Users::get_permalink方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: layout

 /**
  * list users
  *
  * @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 (!($delta = SQL::count($result))) {
         return $text;
     }
     // flag idle users
     $idle = gmstrftime('%Y-%m-%d %H:%M:%S', time() - 600);
     // process all items in the list
     $count = 0;
     $items = array();
     while ($item = SQL::fetch($result)) {
         // url to view the user
         $url = Users::get_permalink($item);
         // initialize variables
         $prefix = $suffix = '';
         // signal restricted and private users
         if (isset($item['active']) && $item['active'] == 'N') {
             $prefix .= PRIVATE_FLAG;
         } elseif (isset($item['active']) && $item['active'] == 'R') {
             $prefix .= RESTRICTED_FLAG;
         }
         // signal locked profiles
         if (isset($item['capability']) && $item['capability'] == '?') {
             $prefix .= EXPIRED_FLAG;
         }
         // item title
         if (isset($item['full_name']) && $item['full_name']) {
             $label = ucfirst(Skin::strip($item['full_name'], 10));
             $hover = $item['nick_name'];
         } else {
             $label = ucfirst(Skin::strip($item['nick_name'], 10));
             $hover = $item['full_name'];
         }
         // flag idle users
         if (!isset($item['click_date']) || $item['click_date'] < $idle) {
             $class = 'idle user';
         } else {
             $class = 'user';
         }
         // list all components for this item
         $items[$url] = array($prefix, $label, $suffix, $class, NULL, $hover);
         // provide only some results
         if (++$count >= 5) {
             break;
         }
     }
     // end of processing
     SQL::free($result);
     // turn this to some text
     $text = Skin::build_list($items, 'comma');
     // some indications on the number of connections
     if ($delta -= $count) {
         $text .= ', ...';
     }
     return $text;
 }
开发者ID:rair,项目名称:yacs,代码行数:68,代码来源:layout_users_as_comma5.php

示例2: layout

 /**
  * list users
  *
  * @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)) {
         // url to view the user profile
         $url = Users::get_permalink($item);
         // time of last update
         $time = SQL::strtotime($item['edit_date']);
         // item title
         if ($item['full_name']) {
             $label = ucfirst(Skin::strip($item['full_name'], 10));
         } else {
             $label = ucfirst(Skin::strip($item['nick_name'], 10));
         }
         // the section
         $section = '';
         // the author(s) is an e-mail address, according to rss 2.0 spec
         $author .= $item['edit_address'] . ' (' . $item['edit_name'] . ')';
         // introduction
         $introduction = Codes::beautify($item['introduction']);
         // the description
         $description = Codes::beautify($item['description']);
         // cap the number of words
         $description = Skin::cap($description, 300);
         // fix image references
         $description = preg_replace('#"/([^">]+?)"#', '"' . $context['url_to_home'] . '/$1"', $description);
         // other rss fields
         $extensions = array();
         // list all components for this item
         $items[$url] = array($time, $label, $author, $section, $icon, $introduction, $description, $extensions);
     }
     // end of processing
     SQL::free($result);
     return $items;
 }
开发者ID:rair,项目名称:yacs,代码行数:51,代码来源:layout_users_as_feed.php

示例3: array

         $new_users[$url] = array($prefix, $label, $suffix, $type, $icon);
     }
     // display attached users with unlink buttons
     $context['text'] .= Skin::build_list($new_users, 'compact') . '</div>';
 }
 // list also editors of parent containers
 $inherited = '';
 $handle = $anchor->get_parent();
 while ($handle && ($parent = Anchors::get($handle))) {
     $handle = $parent->get_parent();
     if (($users =& Members::list_users_by_posts_for_member($parent->get_reference(), 0, 50 * USERS_LIST_SIZE, 'raw')) && count($users)) {
         // browse the list
         $items = array();
         foreach ($users as $id => $user) {
             // make an url
             $url = Users::get_permalink($user);
             // gather information on this user
             $prefix = $suffix = $type = $icon = '';
             if (isset($user['full_name']) && $user['full_name']) {
                 $label = $user['full_name'] . ' (' . $user['nick_name'] . ')';
             } else {
                 $label = $user['nick_name'];
             }
             // surfer cannot be deselected
             if ($parent->is_owned($id, FALSE)) {
                 $suffix .= ' - <span class="details">' . i18n::s('owner') . '</span>';
             }
             // format the item
             $items[$url] = array($prefix, $label, $suffix, $type, $icon);
         }
         // display attached users with unlink buttons
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:select.php

示例4: elseif

     Safe::header('Status: 401 Unauthorized', TRUE, 401);
 } elseif (!Surfer::is_logged()) {
     Safe::redirect($context['url_to_home'] . $context['url_to_root'] . 'users/login.php?url=' . urlencode(Articles::get_permalink($item)));
 } elseif (isset($_REQUEST['requested']) && ($requested = Users::get($_REQUEST['requested'])) && $requested['email']) {
     // prepare the mail message
     $to = Mailer::encode_recipient($requested['email'], $requested['full_name']);
     $subject = sprintf(i18n::c('%s: %s'), i18n::c('Request'), strip_tags($item['title']));
     $message = Articles::build_notification('apply', $item, $overlay);
     $headers = Mailer::set_thread('article:' . $item['id']);
     // allow for skinnable template
     $message = Skin::build_mail_message($message);
     // build multiple parts, for HTML rendering
     $message = Mailer::build_multipart($message);
     // send the message to requested user
     if (Mailer::post(Surfer::from(), $to, $subject, $message, NULL, $headers)) {
         $text = sprintf(i18n::s('Your request has been transmitted to %s. Check your mailbox for feed-back.'), Skin::build_link(Users::get_permalink($requested), Codes::beautify_title($requested['full_name']), 'user'));
         $context['text'] .= Skin::build_block($text, 'note');
     }
     // follow-up navigation
     $context['text'] .= '<div>' . i18n::s('Where do you want to go now?') . '</div>';
     $menu = array();
     $menu[] = Skin::build_link($context['url_to_root'], i18n::s('Front page'), 'button');
     $menu[] = Skin::build_link(Surfer::get_permalink(), i18n::s('My profile'), 'span');
     $context['text'] .= Skin::finalize_list($menu, 'menu_bar');
     // offer to request some owner
 } else {
     // provide feed-back to surfer
     $context['text'] .= Skin::build_block(i18n::s('You are not allowed to access this page.'), 'caution');
     // list owners
     $owners = array();
     // owner of this section
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:view.php

示例5: array

        $fields[] = array($label, $input);
        // the password has to be repeated for confirmation
        $label = i18n::s('Password confirmation');
        $input = '<input type="password" name="confirm" size="20" value="' . encode_field(isset($_REQUEST['confirm']) ? $_REQUEST['confirm'] : '') . '" />';
        $fields[] = array($label, $input);
        // append the script used for data checking on the browser
        Page::insert_script('$("#password").focus();');
    }
    // stop replay attacks and robots
    if ($field = Surfer::get_robot_stopper()) {
        $fields[] = $field;
    }
    // build the form
    $context['text'] .= Skin::build_form($fields);
    // cancel link
    if (!isset($item['id'])) {
        $cancel_url = $context['url_to_home'] . $context['url_to_root'];
    } else {
        $cancel_url = Users::get_permalink($item);
    }
    // bottom commands
    $context['text'] .= Skin::finalize_list(array(Skin::build_submit_button(i18n::s('Submit'), i18n::s('Press [s] to submit data'), 's'), Skin::build_link($cancel_url, i18n::s('Cancel'), 'span')), 'assistant_bar');
    // hidden field that have to be saved as well
    if (isset($item['id']) && $item['id']) {
        $context['text'] .= '<input type="hidden" name="id" value="' . $item['id'] . '" />';
    }
    // end of the form
    $context['text'] .= '</div></form>';
}
// render the skin
render_skin();
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:password.php

示例6: elseif

} elseif (($item = Categories::get($id)) || ($item =& Categories::get_by_keyword($id))) {
    Safe::redirect(Categories::get_permalink($item));
    // look in articles
} elseif ($items =& Articles::list_for_name($id, NULL, 'full')) {
    // only one page has this name
    if (count($items) == 1) {
        list($url, $attributes) = each($items);
        Safe::redirect($url);
    }
    // splash
    $context['text'] .= '<p>' . i18n::s('Select below among available pages.') . '</p>';
    // several pages
    $context['text'] .= Skin::build_list($items, 'decorated');
    // look in user profiles
} elseif ($item = Users::get($id)) {
    Safe::redirect(Users::get_permalink($item));
    // not found
} else {
    $context['text'] .= '<p>' . sprintf(i18n::s('Sorry, no page has the provided name: %s'), $id) . '</p>' . "\n";
    // offer to create a new page
    $context['text'] .= '<p>' . Skin::build_link('articles/edit.php?name=' . urlencode($id), i18n::s('Add a page with this name'), 'shortcut') . '</p>' . "\n";
}
// the form to submit a new search
if ($id) {
    $label = i18n::s('Look for');
} else {
    $label = i18n::s('Nick name');
}
$input = '<input type="text" name="id" id="id" size="25" value="' . encode_field($id) . '" maxlength="64" />' . ' ' . Skin::build_submit_button(i18n::s('Search'));
$context['text'] .= '<form method="get" action="' . $context['script_url'] . '" onsubmit="return validateDocumentPost(this)" id="main_form"><p>' . $label . ' ' . $input . '</p></form>';
// the script used for form handling at the browser
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:go.php

示例7: elseif

    Logger::error(i18n::s('You are not allowed to perform this operation.'));
    // no deletion in demo mode
} elseif (isset($_REQUEST['confirm']) && $_REQUEST['confirm'] == 'yes' && file_exists($context['path_to_root'] . 'parameters/demo.flag')) {
    Safe::header('Status: 401 Unauthorized', TRUE, 401);
    Logger::error(i18n::s('You are not allowed to perform this operation in demonstration mode.'));
    // deletion is confirmed
} elseif (isset($_REQUEST['confirm']) && $_REQUEST['confirm'] == 'yes') {
    // close the session on self-deletion
    if (Surfer::get_id() == $item['id']) {
        Surfer::reset();
    }
    // attempt to delete
    if (Users::delete($item['id'])) {
        // log item deletion
        $label = sprintf(i18n::c('Deletion: %s'), strip_tags($item['nick_name']));
        $description = Users::get_permalink($item);
        Logger::remember('users/delete.php: ' . $label, $description);
        // this can appear anywhere
        Cache::clear();
        // back to the index page
        Safe::redirect($context['url_to_home'] . $context['url_to_root'] . 'users/');
    }
    // deletion has to be confirmed
} elseif (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'POST') {
    Logger::error(i18n::s('The action has not been confirmed.'));
} else {
    // the submit button
    if (Surfer::is($item['id'])) {
        $label = i18n::s('Yes, I want to suppress my own profile from this server and log out.');
    } else {
        $label = i18n::s('Yes, I want to suppress this user');
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:delete.php

示例8: elseif

} elseif (!$permitted) {
    Safe::header('Status: 401 Unauthorized', TRUE, 401);
    Logger::error(i18n::s('You are not allowed to perform this operation.'));
    // send the list of recent contributions by this user
} else {
    // get the list from the cache, if possible
    $cache_id = 'users/feed.php?id=' . $item['id'] . '#channel';
    if (!($text = Cache::get($cache_id))) {
        // loads feeding parameters
        Safe::load('parameters/feeds.include.php');
        // structured data
        $values = array();
        $values['channel'] = array();
        // set channel information
        $values['channel']['title'] = $item['full_name'] ? $item['full_name'] : $item['nick_name'];
        $values['channel']['link'] = Users::get_permalink($item);
        $values['channel']['description'] = $item['introduction'];
        // the image for this channel
        if (isset($context['powered_by_image']) && $context['powered_by_image']) {
            $values['channel']['image'] = $context['url_to_home'] . $context['url_to_root'] . $context['powered_by_image'];
        }
        // the list of newest pages
        $values['items'] = (array) Articles::list_for_author_by('publication', $item['id'], 0, 50, 'feed');
        // make a text
        include_once '../services/codec.php';
        include_once '../services/rss_codec.php';
        $result = rss_Codec::encode($values);
        $status = @$result[0];
        $text = @$result[1];
        // save in cache for the next request
        Cache::put($cache_id, $text, 'articles');
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:feed.php

示例9: elseif

                    }
                    // we only have a recipient address
                } elseif ($item['email'] && !Mailer::notify(Surfer::from(), $item['email'], $mail['subject'], $mail['message'], $mail['headers'])) {
                    Logger::error(sprintf(i18n::s('Impossible to send a message to %s.'), $item['email']));
                }
            }
        }
    }
    // follow-up commands
    if (!$render_overlaid) {
        $menu = array();
        if (isset($article['id'])) {
            $menu = array(Articles::get_permalink($article) => i18n::s('View the new thread'));
        }
        if (count($items) == 1 && ($item = $items[0]) && isset($item['id'])) {
            $menu = array_merge($menu, array(Users::get_permalink($item) => sprintf(i18n::s('Back to %s'), $item['nick_name'])));
        } elseif (Surfer::get_id()) {
            $menu = array_merge($menu, array(Surfer::get_permalink() => i18n::s('Back to my profile')));
        }
        if (count($menu)) {
            $context['text'] .= Skin::build_block(i18n::s('Where do you want to go now?') . Skin::build_list($menu, 'menu_bar'), 'bottom');
        }
    }
} elseif ($with_form) {
    // target user statut doen't allow MP, except from associates
    if (!Surfer::is_associate() && ($overlay->attributes['user_status'] == 'donotdisturb' || $overlay->attributes['user_status'] == 'anonymous' || $item['without_alerts'] == 'Y')) {
        $context['text'] .= '<p>' . sprintf(i18n::s('Sorry, "%s" wish not to receive private message'), $item['nick_name']) . '</p>' . "\n";
        render_skin();
        finalize_page(TRUE);
    }
    $context['text'] .= Users::get_thread_creation_form($item['id']);
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:contact.php

示例10: encode_field

 if ($item['full_name']) {
     $text .= '		<foaf:name>' . encode_field($item['full_name']) . '</foaf:name>' . "\n";
 }
 // nick name
 if ($item['nick_name']) {
     $text .= '		<foaf:nick>' . encode_field($item['nick_name']) . '</foaf:nick>' . "\n";
 }
 // a representation of the mailto: URI -- protect privacy
 if ($item['email'] && is_callable('sha1')) {
     $text .= '		<foaf:mbox_sha1sum>' . sha1(encode_field('mailto:' . $item['email'])) . '</foaf:mbox_sha1sum>' . "\n";
 }
 // the web address
 if ($item['web_address']) {
     $text .= '		<foaf:homepage rdf:resource="' . encode_field($item['web_address']) . '" />' . "\n";
 } else {
     $text .= '		<foaf:homepage rdf:resource="' . encode_field(Users::get_permalink($item)) . '" />' . "\n";
 }
 // the user avatar
 if ($item['avatar_url']) {
     if ($item['avatar_url'][0] == '/') {
         $item['avatar_url'] = str_replace('//', '/', $context['url_to_home'] . $context['url_to_root'] . $item['avatar_url']);
     }
     $text .= '		<foaf:img rdf:resource="' . encode_field($item['avatar_url']) . '" />' . "\n";
 }
 // list watched users by posts
 if ($items =& Members::list_users_by_posts_for_member('user:' . $item['id'], 0, USERS_PER_PAGE, 'raw')) {
     foreach ($items as $id => $attributes) {
         $text .= '	<foaf:knows>' . "\n" . '		<foaf:Person>' . "\n" . '			<foaf:name>' . encode_field($attributes['full_name']) . '</foaf:name>' . "\n" . '			<rdfs:seeAlso rdf:resource="' . encode_field($context['url_to_home'] . $context['url_to_root'] . Users::get_url($id, 'describe')) . '" />' . "\n" . '		</foaf:Person>' . "\n" . '	</foaf:knows>' . "\n";
     }
 }
 $text .= '	</foaf:Person>' . "\n" . '</rdf:RDF>';
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:describe.php

示例11: layout

 /**
  * list users
  *
  * @param resource the SQL result
  * @return string the rendered text
  *
  * @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;
     }
     // flag idle users
     $idle = gmstrftime('%Y-%m-%d %H:%M:%S', time() - 600);
     // default variant
     if (!isset($this->layout_variant)) {
         $this->layout_variant == 'full';
     }
     // process all items in the list
     while ($item = SQL::fetch($result)) {
         // initialize variables
         $prefix = $suffix = $icon = '';
         // the url to view this item
         $url = Users::get_permalink($item);
         // flag profiles updated recently
         if ($item['create_date'] >= $context['fresh']) {
             $suffix .= NEW_FLAG;
         } elseif ($item['edit_date'] >= $context['fresh']) {
             $suffix .= UPDATED_FLAG;
         }
         // signal restricted and private articles
         if ($item['active'] == 'N') {
             $prefix .= PRIVATE_FLAG;
         } elseif ($item['active'] == 'R') {
             $prefix .= RESTRICTED_FLAG;
         }
         // signal locked profiles
         if ($item['capability'] == '?') {
             $prefix .= EXPIRED_FLAG;
         }
         // item title
         if ($item['full_name']) {
             $label = ucfirst(Skin::strip($item['full_name'], 10));
             $hover = $item['nick_name'];
         } else {
             $label = ucfirst(Skin::strip($item['nick_name'], 10));
             $hover = $item['full_name'];
         }
         // show contact information
         if (Surfer::may_contact()) {
             $suffix .= Users::build_presence($item);
         }
         // the introduction
         if ($item['introduction']) {
             if (is_callable(array('codes', 'beautify'))) {
                 $suffix .= ' -&nbsp;' . Codes::beautify($item['introduction']);
             } else {
                 $suffix .= ' -&nbsp;' . $item['introduction'];
             }
         }
         // display all tags
         if ($item['tags']) {
             $suffix .= ' <span class="tags">' . Skin::build_tags($item['tags'], 'user:' . $item['id']) . '</span>';
         }
         // details
         $details = array();
         // capability
         if ($item['capability'] == 'A') {
             $details[] = i18n::s('Associate');
         } elseif ($item['capability'] == 'S') {
             $details[] = i18n::s('Subscriber');
         } else {
             $details[] = i18n::s('Member');
         }
         // creation date
         if ($item['create_date']) {
             $details[] = sprintf(i18n::s('registered %s'), Skin::build_date($item['create_date']));
         }
         // last login
         if ($this->layout_variant == 'dates') {
             if (isset($item['login_date']) && $item['login_date'] > NULL_DATE) {
                 $address = '';
                 if ($item['login_address']) {
                     $address = ' (' . $item['login_address'] . ')';
                 }
                 $details[] = sprintf(i18n::s('last login %s'), Skin::build_date($item['login_date']) . $address);
             } else {
                 $details[] = i18n::s('no login');
             }
         }
         // last post
         if ($this->layout_variant == 'dates') {
             if (isset($item['post_date']) && $item['post_date'] > NULL_DATE) {
                 $details[] = sprintf(i18n::s('last post %s'), Skin::build_date($item['post_date']));
             }
//.........这里部分代码省略.........
开发者ID:rair,项目名称:yacs,代码行数:101,代码来源:layout_users.php

示例12: elseif

$context['page_title'] = i18n::s('Validate your e-mail address');
// stop crawlers
if (Surfer::is_crawler()) {
    Safe::header('Status: 401 Unauthorized', TRUE, 401);
    Logger::error(i18n::s('You are not allowed to perform this operation.'));
    // not found
} elseif (!isset($item['id'])) {
    include '../error.php';
    // bad handle
} elseif ($id != $item['handle']) {
    include '../error.php';
} elseif (Users::validate($item['id'])) {
    // congratulations
    $context['text'] .= sprintf(i18n::s('<p>%s,</p><p>Your e-mail address has been validated, and you are now an active member of this community.</p>'), ucfirst($item['nick_name']));
    // set permanent name shown from top level
    Safe::setcookie('surfer_name', $item['nick_name'], time() + 60 * 60 * 24 * 500, '/');
    // save surfer profile in session context
    Surfer::set($item);
    // follow-up commands
    $follow_up = i18n::s('Where do you want to go now?');
    $menu = array();
    $menu = array_merge($menu, array(Users::get_permalink($item) => i18n::s('My profile')));
    $menu = array_merge($menu, array($context['url_to_root'] => i18n::s('Front page')));
    $follow_up .= Skin::build_list($menu, 'menu_bar');
    $context['text'] .= Skin::build_block($follow_up, 'bottom');
    // failed operation
} else {
    $context['text'] .= '<p>' . i18n::s('Your e-mail address has not been validated.') . "</p>\n";
}
// render the skin
render_skin();
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:validate.php

示例13: layout

 /**
  * list users
  *
  * @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 (!($count = SQL::count($result))) {
         return $text;
     }
     $text = '<div>';
     // process all items in the list
     $count = 0;
     $checked = ' checked="checked"';
     while ($item = SQL::fetch($result)) {
         // we need some address
         if (!$item['email']) {
             continue;
         }
         // do not write to myself
         if ($item['id'] == Surfer::get_id()) {
             continue;
         }
         // get the related overlay, if any
         $overlay = Overlay::load($item, 'user:' . $item['id']);
         // one radio button per person
         $text .= '<input type="radio" name="requested" value="' . encode_field($item['id']) . '"' . $checked . ' />';
         // signal restricted and private users
         if ($item['active'] == 'N') {
             $text .= PRIVATE_FLAG;
         } elseif ($item['active'] == 'R') {
             $text .= RESTRICTED_FLAG;
         }
         // the url to view this item
         $url = Users::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['full_name']);
         }
         // sanity check
         if (!$title) {
             $title = $item['nick_name'];
         }
         // link to this page
         $text .= Skin::build_link($url, $title, 'user');
         // the introductory text
         if ($item['introduction']) {
             $text .= '<span class="tiny"> - ' . Codes::beautify_introduction($item['introduction']) . '</span>';
         }
         // insert overlay data, if any
         if (is_object($overlay)) {
             $text .= $overlay->get_text('list', $item);
         }
         // append the row
         $text .= BR;
         $count++;
         $checked = '';
     }
     // div suffix
     $text .= '</div>';
     // no valid account has been found
     if (!$count) {
         $text = '';
     }
     // end of processing
     SQL::free($result);
     return $text;
 }
开发者ID:rair,项目名称:yacs,代码行数:77,代码来源:layout_users_as_request.php

示例14: get_url

 /**
  * get the url to display the main page for this anchor
  *
  * @param string the targeted action ('view', 'print', 'edit', 'delete', ...)
  * @return an anchor to the viewing script, or NULL
  *
  * @see shared/anchor.php
  */
 function get_url($action = 'view')
 {
     // sanity check
     if (!isset($this->item['id'])) {
         return NULL;
     }
     switch ($action) {
         // list of files
         case 'files':
             return Users::get_permalink($this->item) . '#_information';
             // the permalink page
         // the permalink page
         case 'view':
             return Users::get_permalink($this->item);
             // another action
         // another action
         default:
             return Users::get_url($this->item['id'], $action, $this->item['nick_name']);
     }
 }
开发者ID:rair,项目名称:yacs,代码行数:28,代码来源:user.php

示例15: layout

 /**
  * list users
  *
  * @param resource the SQL result
  * @return string the rendered text
  *
  * @see layouts/layout.php
  **/
 function layout($result)
 {
     global $context;
     // we return an array of ($url => $attributes)
     $items = array();
     // empty list
     if (!($delta = SQL::count($result))) {
         return $items;
     }
     // flag idle users
     $idle = gmstrftime('%Y-%m-%d %H:%M:%S', time() - 600);
     // process all items in the list
     $count = 0;
     while ($item = SQL::fetch($result)) {
         // url to view the user
         $url = Users::get_permalink($item);
         // initialize variables
         $prefix = $suffix = '';
         // signal restricted and private users
         if (isset($item['active']) && $item['active'] == 'N') {
             $prefix .= PRIVATE_FLAG;
         } elseif (isset($item['active']) && $item['active'] == 'R') {
             $prefix .= RESTRICTED_FLAG;
         }
         // signal locked profiles
         if (isset($item['active']) && $item['capability'] == '?') {
             $prefix .= EXPIRED_FLAG;
         }
         // item title
         if (isset($item['full_name']) && $item['full_name']) {
             $label = ucfirst(Skin::strip($item['full_name'], 10));
             $hover = $item['nick_name'];
         } else {
             $label = ucfirst(Skin::strip($item['nick_name'], 10));
             $hover = $item['full_name'];
         }
         // flag idle users
         if (!isset($item['click_date']) || $item['click_date'] < $idle) {
             $class = 'idle user';
         } else {
             $class = 'user';
         }
         // list all components for this item
         $items[$url] = array($prefix, $label, $suffix, $class, NULL, $hover);
         // limit to one page of results
         if (++$count >= USERS_PER_PAGE) {
             break;
         }
     }
     // end of processing
     SQL::free($result);
     // turn this to some text
     $items = Skin::build_list($items, 'compact');
     // some indications on the number of connections
     if ($delta -= $count) {
         if ($delta < 100) {
             $label = sprintf(i18n::ns('and %d other person', 'and %d other persons', $delta), $delta);
         } else {
             $label = i18n::s('and many more persons');
         }
         $items .= '<p>' . $label . '</p>';
     }
     return $items;
 }
开发者ID:rair,项目名称:yacs,代码行数:72,代码来源:layout_users_as_compact.php


注:本文中的Users::get_permalink方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。