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


PHP Articles::list_for_user_by方法代码示例

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


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

示例1: render_voted

 /**
  * render a compact list of voted pages
  *
  * @param string the anchor (e.g. 'section:123')
  * @param string layout to use
  * @return string the rendered text
  **/
 public static function render_voted($anchor = '', $layout = 'simple')
 {
     global $context;
     // we return some text;
     $text = '';
     // number of items to display
     $count = COMPACT_LIST_SIZE;
     if (($position = strpos($anchor, ',')) !== FALSE) {
         $count = (int) trim(substr($anchor, $position + 1));
         if (!$count) {
             $count = COMPACT_LIST_SIZE;
         }
         $anchor = trim(substr($anchor, 0, $position));
     }
     // scope is limited to current surfer
     if ($anchor == 'self' && Surfer::get_id()) {
         $anchor = 'user:' . Surfer::get_id();
         // refresh on every page load
         Cache::poison();
     }
     // scope is limited to one section
     if (strpos($anchor, 'section:') === 0) {
         // look at this branch of the content tree
         $anchors = Sections::get_branch_at_anchor($anchor);
         // query the database and layout that stuff
         $text =& Articles::list_for_anchor_by('rating', $anchors, 0, $count, $layout);
         // scope is limited to pages of one surfer
     } elseif (strpos($anchor, 'user:') === 0) {
         $text =& Articles::list_for_user_by('rating', substr($anchor, 5), 0, $count, $layout);
     } else {
         $text =& Articles::list_by('rating', 0, $count, $layout);
     }
     // we have an array to format
     if (is_array($text)) {
         $text =& Skin::build_list($text, $layout);
     }
     // job done
     return $text;
 }
开发者ID:rair,项目名称:yacs,代码行数:46,代码来源:code_read_vote.php

示例2: array_merge

     // load the choosen layout
     $layout = Layouts::new_('last', 'article');
     $layout->set_focus($item['id']);
     // navigation commands for articles
     $home = Users::get_permalink($item);
     $prefix = Users::get_url($item['id'], 'navigate', 'articles');
     $box['bottom'] = array_merge($box['bottom'], Skin::navigate($home, $prefix, $count, $layout->items_per_page(), $zoom_index));
     // append a menu bar before the list
     $box['top'] = array_merge($box['top'], $box['bottom']);
     if (count($box['top'])) {
         $box['text'] .= Skin::build_list($box['top'], 'menu_bar');
     }
     // compute offset from list beginning
     $offset = ($zoom_index - 1) * ARTICLES_PER_PAGE;
     // list watched pages by date, not only pages posted by this user
     $items =& Articles::list_for_user_by('edition', $item['id'], $offset, $layout->items_per_page(), 'last');
     if (is_array($items)) {
         $box['text'] .= Skin::build_list($items, 'compact');
     } elseif ($items) {
         $box['text'] .= $items;
     }
     // append a menu bar below the list
     if (count($box['bottom']) > 1) {
         $box['text'] .= Skin::build_list($box['bottom'], 'menu_bar');
     }
     // a complete box
     if ($box['text']) {
         $stream .= $box['text'];
     }
 }
 // in a separate panel
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:view.php

示例3:

    //
    // title
    $section = Skin::build_block(i18n::s('Files'), 'title');
    // list files by date
    $items = Files::list_by_date_for_anchor('user:' . $item['id'], 0, 50, 'compact');
    // actually render the html for the section
    if ($items) {
        $context['text'] .= $section . Skin::build_list($items, 'compact');
    }
    //
    // the links section
    //
    // title
    $section = Skin::build_block(i18n::s('See also'), 'title');
    // list links by date
    if (preg_match('/\\blinks_by_title\\b/i', $item['options'])) {
        $items = Links::list_by_title_for_anchor('user:' . $item['id'], 0, 20, 'no_author');
    } else {
        $items = Links::list_by_date_for_anchor('user:' . $item['id'], 0, 20, 'no_author');
    }
    // actually render the html
    if ($items) {
        $context['text'] .= $section . Skin::build_list($items, 'compact');
    }
    // list pages attached to this user
    if ($items =& Articles::list_for_user_by('edition', $item['id'], 0, 50, 'compact')) {
        $context['text'] .= Skin::build_box(i18n::s('Pages'), Skin::build_list($items, 'compact'));
    }
}
// render the skin
render_skin();
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:print.php

示例4: render_updated

 /**
  * render a compact list of recent modifications
  *
  * The provided anchor can reference:
  * - a section 'section:123'
  * - a category 'category:456'
  * - a user 'user:789'
  * - 'self'
  * - nothing
  *
  * @param string the anchor (e.g. 'section:123')
  * @param string layout to use
  * @return string the rendered text
  **/
 public static function render_updated($layout = 'simple', $anchor = '')
 {
     global $context;
     // we return some text;
     $text = '';
     // number of items to display
     $count = COMPACT_LIST_SIZE;
     if (($position = strpos($anchor, ',')) !== FALSE) {
         $count = (int) trim(substr($anchor, $position + 1));
         if (!$count) {
             $count = COMPACT_LIST_SIZE;
         }
         $anchor = trim(substr($anchor, 0, $position));
     }
     // scope is limited to current surfer
     if ($anchor == 'self' && Surfer::get_id()) {
         $anchor = 'user:' . Surfer::get_id();
         // refresh on every page load
         Cache::poison();
     }
     // scope is limited to one section
     if (strpos($anchor, 'section:') === 0) {
         // look at this branch of the content tree
         $anchors = Sections::get_branch_at_anchor($anchor);
         // query the database and layout that stuff
         $text = Articles::list_for_anchor_by('edition', $anchors, 0, $count, $layout);
         // scope is limited to one category
     } elseif (strpos($anchor, 'category:') === 0) {
         // first level of depth
         $anchors = array();
         // get sections linked to this category
         if ($topics = Members::list_sections_by_title_for_anchor($anchor, 0, 50, 'raw')) {
             foreach ($topics as $id => $not_used) {
                 $anchors = array_merge($anchors, array('section:' . $id));
             }
         }
         // second level of depth
         if (count($topics) && count($anchors) < 2000) {
             $topics = Sections::get_children_of_anchor($anchors);
             $anchors = array_merge($anchors, $topics);
         }
         // third level of depth
         if (count($topics) && count($anchors) < 2000) {
             $topics = Sections::get_children_of_anchor($anchors);
             $anchors = array_merge($anchors, $topics);
         }
         // fourth level of depth
         if (count($topics) && count($anchors) < 2000) {
             $topics = Sections::get_children_of_anchor($anchors);
             $anchors = array_merge($anchors, $topics);
         }
         // fifth level of depth
         if (count($topics) && count($anchors) < 2000) {
             $topics = Sections::get_children_of_anchor($anchors);
             $anchors = array_merge($anchors, $topics);
         }
         // the category itself is an anchor
         $anchors[] = $anchor;
         // ensure anchors are referenced only once
         $anchors = array_unique($anchors);
         // query the database and layout that stuff
         $text = Members::list_articles_by_date_for_anchor($anchors, 0, $count, $layout);
         // scope is limited to pages of one surfer
     } elseif (strpos($anchor, 'user:') === 0) {
         $text = Articles::list_for_user_by('edition', substr($anchor, 5), 0, $count, $layout);
     } else {
         $text = Articles::list_by('edition', 0, $count, $layout);
     }
     // we have an array to format
     if (is_array($text)) {
         $text = Skin::build_list($text, $layout);
     }
     // job done
     return $text;
 }
开发者ID:rair,项目名称:yacs,代码行数:89,代码来源:codes.php


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