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


PHP Members::list_sections_by_title_for_anchor方法代码示例

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


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

示例1: get_childs

 /**
  * list childs of this anchor, with or without type filters
  * 
  * @param string set of desired childs (articles, sections...) separted by comma, or "all" keyword
  * @param int offset to start listing
  * @param int the maximum of items returned per type
  * @param mixed string or object the layout to use
  * @return an array of array with raw items sorted by type
  */
 function get_childs($filter = 'all', $offset = 0, $max = 50, $layout = 'raw')
 {
     // we return a array
     $childs = array();
     // sub-categories
     if ($filter == 'all' || preg_match('/\\bcategor(y|ies)\\b/i', $filter)) {
         $childs['category'] = Categories::list_by_title_for_anchor($this, $offset, $max, $layout);
     }
     // related articles
     if ($filter == 'all' || preg_match('/\\barticles?\\b/i', $filter)) {
         $childs['article'] = Members::list_articles_by_title_for_anchor($this->get_reference(), $offset, $max, $layout);
     }
     // related sections
     if ($filter == 'all' || preg_match('/\\bsections?\\b/i', $filter)) {
         $childs['section'] = Members::list_sections_by_title_for_anchor($this->get_reference(), $offset, $max, $layout);
     }
     // related users
     if ($filter == 'all' || preg_match('/\\busers?\\b/i', $filter)) {
         $childs['user'] = Members::list_users_by_name_for_anchor($this->get_reference(), $offset, $max, $layout);
     }
     // files
     if ($filter == 'all' || preg_match('/\\bfiles?\\b/i', $filter)) {
         $childs['file'] = Files::list_by_title_for_anchor($this->get_reference(), $offset, $max, $layout);
     }
     return $childs;
 }
开发者ID:rair,项目名称:yacs,代码行数:35,代码来源:category.php

示例2: elseif

     if (preg_match('/^user:/', $_REQUEST['anchor'])) {
         Members::assign($_REQUEST['member'], $_REQUEST['anchor']);
     }
     // break an assignment, and also purge the watch list
 } elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == 'reset' && isset($_REQUEST['member'])) {
     Members::free($_REQUEST['anchor'], $_REQUEST['member']);
     if (preg_match('/^user:/', $_REQUEST['anchor'])) {
         Members::free($_REQUEST['member'], $_REQUEST['anchor']);
     }
 }
 // insert anchor prefix
 if (is_object($anchor)) {
     $context['text'] .= $anchor->get_prefix();
 }
 // the current list of linked sections
 $sections =& Members::list_sections_by_title_for_anchor($anchor->get_reference(), 0, SECTIONS_LIST_SIZE, 'raw');
 // the form to link additional sections
 if (!is_array($sections) || count($sections) < SECTIONS_LIST_SIZE) {
     $context['text'] .= '<form method="post" action="' . $context['script_url'] . '"><p>' . i18n::s('To assign a section, look in the content tree below and assign one section at a time') . BR . '<select name="member">' . Sections::get_options(NULL, $sections) . '</select>' . ' ' . Skin::build_submit_button(' >> ') . '<input type="hidden" name="anchor" value="' . encode_field($anchor->get_reference()) . '">' . '<input type="hidden" name="action" value="set">' . '</p></form>' . "\n";
 }
 // splash
 $context['text'] .= '<p style="margin-top: 2em;">' . sprintf(i18n::s('This is the list of sections assigned to %s'), $anchor->get_title()) . '</p>';
 // layout assigned sections
 if ($sections) {
     // browse the list
     foreach ($sections as $id => $section) {
         // get the related overlay, if any
         $overlay = Overlay::load($section, 'section:' . $id);
         // get parent anchor
         $parent = Anchors::get($section['anchor']);
         // the url to view this item
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:select.php

示例3: layout


//.........这里部分代码省略.........
         }
         // info on related articles
         if ($count = Members::count_articles_for_anchor('category:' . $item['id'])) {
             $details[] = sprintf(i18n::ns('%d page', '%d pages', $count), $count);
             $related_count += $count;
         }
         // info on related files
         if ($count = Files::count_for_anchor('category:' . $item['id'], TRUE)) {
             $details[] = sprintf(i18n::ns('%d file', '%d files', $count), $count);
             $related_count += $count;
         }
         // info on related links
         if ($count = Links::count_for_anchor('category:' . $item['id'], TRUE)) {
             $details[] = sprintf(i18n::ns('%d link', '%d links', $count), $count);
             $related_count += $count;
         }
         // info on related comments
         if ($count = Comments::count_for_anchor('category:' . $item['id'], TRUE)) {
             $details[] = sprintf(i18n::ns('%d comment', '%d comments', $count), $count);
             $related_count += $stats['count'];
         }
         // info on related users
         if ($count = Members::count_users_for_anchor('category:' . $item['id'])) {
             $details[] = sprintf(i18n::ns('%d user', '%d users', $count), $count);
         }
         // append details to the suffix
         if (count($details)) {
             $suffix .= "\n" . '<span class="details">(' . implode(', ', $details) . ')</span>';
         }
         // add a head list of related links
         $details = array();
         // add sub-categories on index pages
         if ($related = Categories::list_by_date_for_anchor('category:' . $item['id'], 0, YAHOO_LIST_SIZE, 'compact')) {
             foreach ($related as $sub_url => $label) {
                 $sub_prefix = $sub_suffix = $sub_hover = '';
                 if (is_array($label)) {
                     $sub_prefix = $label[0];
                     $sub_suffix = $label[2];
                     if (@$label[5]) {
                         $sub_hover = $label[5];
                     }
                     $label = $label[1];
                 }
                 $details[] = $sub_prefix . Skin::build_link($sub_url, $label, 'basic', $sub_hover) . $sub_suffix;
             }
         }
         // add related sections if necessary
         if (count($details) < YAHOO_LIST_SIZE && ($related =& Members::list_sections_by_title_for_anchor('category:' . $item['id'], 0, YAHOO_LIST_SIZE - count($details), 'compact'))) {
             foreach ($related as $sub_url => $label) {
                 $sub_prefix = $sub_suffix = $sub_hover = '';
                 if (is_array($label)) {
                     $sub_prefix = $label[0];
                     $sub_suffix = $label[2];
                     if (@$label[5]) {
                         $sub_hover = $label[5];
                     }
                     $label = $label[1];
                 }
                 $details[] = $sub_prefix . Skin::build_link($sub_url, $label, 'basic', $sub_hover) . $sub_suffix;
             }
         }
         // add related articles if necessary
         if (count($details) < YAHOO_LIST_SIZE && ($related =& Members::list_articles_by_date_for_anchor('category:' . $item['id'], 0, YAHOO_LIST_SIZE - count($details), 'compact'))) {
             foreach ($related as $sub_url => $label) {
                 $sub_prefix = $sub_suffix = $sub_hover = '';
                 if (is_array($label)) {
                     $sub_prefix = $label[0];
                     $sub_suffix = $label[2];
                     if (@$label[5]) {
                         $sub_hover = $label[5];
                     }
                     $label = $label[1];
                 }
                 $details[] = $sub_prefix . Skin::build_link($sub_url, $label, 'basic', $sub_hover) . $sub_suffix;
             }
         }
         // give me more
         if (count($details) && $related_count > YAHOO_LIST_SIZE) {
             $details[] = Skin::build_link(Categories::get_permalink($item), i18n::s('More') . MORE_IMG, 'more', i18n::s('View the category'));
         }
         // layout details
         if (count($details)) {
             $suffix .= BR . "\n&raquo;&nbsp;" . '<span class="details">' . implode(', ', $details) . "</span>\n";
         }
         // put the actual icon in the left column
         if (isset($item['thumbnail_url'])) {
             $icon = $item['thumbnail_url'];
         }
         // use the title to label the link
         $label = Skin::strip($item['title'], 50);
         // some hovering title for this category
         $hover = i18n::s('View the category');
         // list all components for this item
         $items[$url] = array($prefix, $label, $suffix, 'category', $icon, $hover);
     }
     // end of processing
     SQL::free($result);
     $output = Skin::build_list($items, '2-columns');
     return $output;
 }
开发者ID:rair,项目名称:yacs,代码行数:101,代码来源:layout_categories_as_yahoo.php

示例4: layout

 /**
  * list categories
  *
  * @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 plain text
     $text = '';
     // process all items in the list
     while ($item = SQL::fetch($result)) {
         // one box per category
         $box['title'] = '';
         $box['text'] = '';
         // use the title to label the link
         $box['title'] = Skin::strip($item['title'], 50);
         // list related categories, if any
         if ($items = Categories::list_by_date_for_anchor('category:' . $item['id'], 0, COMPACT_LIST_SIZE, 'compact')) {
             foreach ($items as $url => $label) {
                 if (is_array($label)) {
                     $label = $label[1];
                 }
                 $box['text'] .= '<li>' . Skin::build_link($url, $label, 'category') . '</li>' . "\n";
             }
         }
         // info on related sections
         $items =& Members::list_sections_by_title_for_anchor('category:' . $item['id'], 0, COMPACT_LIST_SIZE);
         if ($items) {
             foreach ($items as $url => $label) {
                 if (is_array($label)) {
                     $label = $label[1];
                 }
                 $box['text'] .= '<li>' . Skin::build_link($url, $label, 'section') . '</li>' . "\n";
             }
         }
         // info on related articles
         if (isset($item['options']) && preg_match('/\\barticles_by_title\\b/i', $item['options'])) {
             $items =& Members::list_articles_by_title_for_anchor('category:' . $item['id'], 0, COMPACT_LIST_SIZE);
         } else {
             $items =& Members::list_articles_by_date_for_anchor('category:' . $item['id'], 0, COMPACT_LIST_SIZE);
         }
         if ($items) {
             foreach ($items as $url => $label) {
                 if (is_array($label)) {
                     $label = $label[1];
                 }
                 $box['text'] .= '<li>' . Skin::build_link($url, $label, 'article') . '</li>' . "\n";
             }
         }
         // info on related files
         if (isset($item['options']) && preg_match('/\\bfiles_by_title\\b/i', $item['options'])) {
             $items = Files::list_by_title_for_anchor('category:' . $item['id'], 0, COMPACT_LIST_SIZE, 'category:' . $item['id']);
         } else {
             $items = Files::list_by_date_for_anchor('category:' . $item['id'], 0, COMPACT_LIST_SIZE, 'category:' . $item['id']);
         }
         if ($items) {
             foreach ($items as $url => $label) {
                 if (is_array($label)) {
                     $label = $label[1];
                 }
                 $box['text'] .= '<li>' . Skin::build_link($url, $label, 'file') . '</li>' . "\n";
             }
         }
         // info on related comments
         include_once $context['path_to_root'] . 'comments/comments.php';
         if ($items = Comments::list_by_date_for_anchor('category:' . $item['id'], 0, COMPACT_LIST_SIZE, 'compact')) {
             foreach ($items as $url => $label) {
                 if (is_array($label)) {
                     $label = $label[1];
                 }
                 $box['text'] .= '<li>' . Skin::build_link($url, $label, 'comment') . '</li>' . "\n";
             }
         }
         // info on related links
         include_once $context['path_to_root'] . 'links/links.php';
         if (isset($item['options']) && preg_match('/\\blinks_by_title\\b/i', $item['options'])) {
             $items = Links::list_by_title_for_anchor('category:' . $item['id'], 0, COMPACT_LIST_SIZE);
         } else {
             $items = Links::list_by_date_for_anchor('category:' . $item['id'], 0, COMPACT_LIST_SIZE);
         }
         if ($items) {
             foreach ($items as $url => $label) {
                 if (is_array($label)) {
                     $label = $label[1];
                 }
                 $box['text'] .= '<li>' . Skin::build_link($url, $label) . '</li>' . "\n";
             }
         }
         // add a direct link to the category
         if (Surfer::is_associate()) {
             $box['title'] .= '&nbsp;' . Skin::build_link(Categories::get_permalink($item), MORE_IMG, 'basic');
//.........这里部分代码省略.........
开发者ID:rair,项目名称:yacs,代码行数:101,代码来源:layout_categories_as_inline.php

示例5: 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

示例6: array

         $items_per_page = $layout_sections->items_per_page();
     } else {
         $items_per_page = SECTIONS_PER_PAGE;
     }
     // count the number of sections in this category
     $count = Members::count_sections_for_anchor('category:' . $item['id']);
     if ($count > $items_per_page) {
         $box['bar'] = array('_count' => sprintf(i18n::ns('%d section', '%d sections', $count), $count));
     }
     // navigation commands for sections
     $home = Categories::get_permalink($item);
     $prefix = Categories::get_url($item['id'], 'navigate', 'sections');
     $box['bar'] = array_merge($box['bar'], Skin::navigate($home, $prefix, $count, $items_per_page, $zoom_index));
     // list items by date (default) or by title (option 'sections_by_title')
     $offset = ($zoom_index - 1) * $items_per_page;
     $items =& Members::list_sections_by_title_for_anchor('category:' . $item['id'], $offset, $items_per_page, $layout_sections);
     // actually render the html for the section
     if (is_array($items)) {
         $box['text'] .= Skin::build_list($items, 'decorated');
     } elseif (is_string($items)) {
         $box['text'] .= $items;
     }
     if ($box['bar']) {
         $box['text'] .= Skin::build_list($box['bar'], 'menu_bar');
     }
     // in a separate panel
     if ($box['text']) {
         $panels[] = array('sections', i18n::s('Sections'), 'sections_panel', $box['text']);
     }
 }
 //
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:view.php


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