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


PHP Members::list_categories_by_title_for_member方法代码示例

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


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

示例1: layout


//.........这里部分代码省略.........
             $suffix .= ' ' . UPDATED_FLAG;
         }
         // add details
         $details = array();
         // the author
         if (isset($context['with_author_information']) && $context['with_author_information'] == 'Y') {
             if ($item['edit_name'] == $item['create_name']) {
                 $details[] = sprintf(i18n::s('by %s'), ucfirst($item['create_name']));
             } else {
                 $details[] = sprintf(i18n::s('by %s, %s'), ucfirst($item['create_name']), ucfirst($item['edit_name']));
             }
         }
         // the publish date
         $details[] = Skin::build_date($item['publish_date']);
         // rating
         $rating_label = '';
         if ($item['rating_count']) {
             $rating_label = Skin::build_rating_img((int) round($item['rating_sum'] / $item['rating_count'])) . ' ' . sprintf(i18n::ns('%d rating', '%d ratings', $item['rating_count']), $item['rating_count']) . ' ';
         }
         // add a link to let surfer rate this item
         if (is_object($anchor) && !$anchor->has_option('without_rating')) {
             if (!$item['rating_count']) {
                 $rating_label .= i18n::s('Rate this page');
             }
             $rating_label = Skin::build_link(Articles::get_url($item['id'], 'like'), $rating_label, 'basic', i18n::s('Rate this page'));
         }
         // display current rating, and allow for rating
         $details[] = $rating_label;
         // details
         if (count($details)) {
             $content .= '<p class="details">' . ucfirst(implode(', ', $details)) . '</p>';
         }
         // the full introductory text
         if ($item['introduction']) {
             $content .= Codes::beautify($item['introduction'], $item['options']);
         } elseif (!is_object($overlay)) {
             include_once $context['path_to_root'] . 'articles/article.php';
             $article = new Article();
             $article->load_by_content($item);
             $content .= $article->get_teaser('teaser');
         }
         // insert overlay data, if any
         if (is_object($overlay)) {
             $content .= $overlay->get_text('list', $item);
         }
         // an array of links
         $menu = array();
         // rate the article
         $menu = array_merge($menu, array(Articles::get_url($item['id'], 'like') => i18n::s('Rate this page')));
         // read the article
         $menu = array_merge($menu, array($url => i18n::s('Read more')));
         // info on related files
         if ($count = Files::count_for_anchor('article:' . $item['id'], TRUE)) {
             $details[] = Skin::build_link($url . '#_attachments', sprintf(i18n::ns('%d file', '%d files', $count), $count), 'basic');
         }
         // info on related comments
         if ($count = Comments::count_for_anchor('article:' . $item['id'], TRUE)) {
             $link = Comments::get_url('article:' . $item['id'], 'list');
             $menu = array_merge($menu, array($link => sprintf(i18n::ns('%d comment', '%d comments', $count), $count)));
         }
         // discuss
         if (Comments::allow_creation($item, $anchor)) {
             $menu = array_merge($menu, array(Comments::get_url('article:' . $item['id'], 'comment') => i18n::s('Discuss')));
         }
         // info on related links
         if ($count = Links::count_for_anchor('article:' . $item['id'], TRUE)) {
             $menu = array_merge($menu, array($url . '#_attachments' => sprintf(i18n::ns('%d link', '%d links', $count), $count)));
         }
         // trackback
         if (Links::allow_trackback()) {
             $menu = array_merge($menu, array('links/trackback.php?anchor=' . urlencode('article:' . $item['id']) => i18n::s('Reference this page')));
         }
         // link to the anchor page
         if (is_object($anchor)) {
             $menu = array_merge($menu, array($anchor->get_url() => $anchor->get_title()));
         }
         // list up to three categories by title, if any
         if ($items = Members::list_categories_by_title_for_member('article:' . $item['id'], 0, 3, 'raw')) {
             foreach ($items as $id => $attributes) {
                 $menu = array_merge($menu, array(Categories::get_permalink($attributes) => $attributes['title']));
             }
         }
         // append a menu
         $content .= Skin::build_list($menu, 'menu_bar');
         // insert a complete box
         $text .= Skin::build_box($icon . $prefix . Codes::beautify_title($item['title']) . $suffix, $content, 'header1', 'article_' . $item['id']);
         // section closing
         if ($item_count == 1) {
             $text .= '</div>' . "\n";
         }
     }
     // end of processing
     SQL::free($result);
     // add links to archives
     $anchor = Categories::get(i18n::c('monthly'));
     if (isset($anchor['id']) && ($items = Categories::list_by_date_for_anchor('category:' . $anchor['id'], 0, COMPACT_LIST_SIZE, 'compact'))) {
         $text .= Skin::build_box(i18n::s('Previous pages'), Skin::build_list($items, 'menu_bar'));
     }
     return $text;
 }
开发者ID:rair,项目名称:yacs,代码行数:101,代码来源:layout_home_articles_as_digg.php

示例2: urlencode

        Safe::redirect($context['url_to_home'] . $context['url_to_root'] . 'users/login.php?url=' . urlencode(Categories::get_url($member, 'select')));
    }
    // permission denied to authenticated user
    Safe::header('Status: 401 Unauthorized', TRUE, 401);
    Logger::error(i18n::s('You are not allowed to perform this operation.'));
    // build a form to associates some categories to this item
} else {
    // actual update
    if (isset($_REQUEST['anchor']) && isset($_REQUEST['member'])) {
        // on error display the form again
        if ($error = Members::toggle($_REQUEST['anchor'], $_REQUEST['member'], isset($_REQUEST['father']) ? $_REQUEST['father'] : '')) {
            Logger::error($error);
        }
    }
    // the current list of linked categories
    $categories =& Members::list_categories_by_title_for_member($member, 0, CATEGORIES_LIST_SIZE, 'raw');
    // the form to link additional categories
    if (!is_array($categories) || count($categories) < CATEGORIES_LIST_SIZE) {
        $context['text'] .= '<form method="post" action="' . $context['script_url'] . '"><div style="margin-bottom: 2em;">' . i18n::s('Select a category') . ' <select name="anchor">' . Categories::get_options($categories) . '</select>' . ' ' . Skin::build_submit_button(i18n::s('Categorize')) . '<input type="hidden" name="member" value="' . encode_field($member) . '">' . '</div></form>' . "\n";
    }
    // the current list of linked categories
    if (count($categories)) {
        // display attached categories with unlink buttons
        $context['text'] .= '<p>' . i18n::s('All categories that have been associated to this page:') . '</p>';
        // browse the list
        foreach ($categories as $category_id => $attributes) {
            // make an url
            $url = Categories::get_permalink($attributes);
            // gather information on this category
            $prefix = $suffix = $type = $icon = '';
            $label = Skin::strip($attributes['title']);
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:select.php

示例3: 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;
 }
开发者ID:rair,项目名称:yacs,代码行数:101,代码来源:layout_articles_as_table.php

示例4: layout


//.........这里部分代码省略.........
         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']);
         // the number of hits
         if (Surfer::is_logged() && $item['hits'] > 1) {
             $details[] = Skin::build_number($item['hits'], i18n::s('hits'));
         }
         // info on related files
         $stats = Files::stat_for_anchor('article:' . $item['id']);
         if ($stats['count']) {
             $details[] = sprintf(i18n::ns('%d file', '%d files', $stats['count']), $stats['count']);
         }
         // info on related links
         $stats = Links::stat_for_anchor('article:' . $item['id']);
         if ($stats['count']) {
             $details[] = sprintf(i18n::ns('%d link', '%d links', $stats['count']), $stats['count']);
         }
         // info on related comments
         $stats = Comments::stat_for_anchor('article:' . $item['id']);
         if ($stats['count']) {
             $details[] = sprintf(i18n::ns('%d comment', '%d comments', $stats['count']), $stats['count']);
         }
         // 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');
         }
         // combine in-line details
         if (count($details)) {
             $suffix .= ucfirst(trim(implode(', ', $details)));
         }
         // list up to three categories by title, if any
         $anchors = array();
         if ($members =& Members::list_categories_by_title_for_member('article:' . $item['id'], 0, 7, 'raw')) {
             foreach ($members as $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)) {
             $suffix .= BR . sprintf(i18n::s('In %s'), implode(' / ', $anchors));
         }
         // end of details
         $suffix .= '</span>';
         // strip empty details
         $suffix = str_replace(BR . '<span class="details"></span>', '', $suffix);
         $suffix = str_replace('<span class="details"></span>', '', $suffix);
         // the icon to put in the left column
         if ($item['thumbnail_url']) {
             $icon = $item['thumbnail_url'];
         }
         // commands
         $commands = array(Skin::build_link(Articles::get_url($item['id'], 'edit'), i18n::s('edit'), 'basic'), Skin::build_link(Articles::get_url($item['id'], 'delete'), i18n::s('delete'), 'basic'));
         // link to this page
         $cells[] = $prefix . Skin::build_link($url, $title, 'article') . ' - ' . Skin::finalize_list($commands, 'menu') . $suffix;
         // ranking
         $cells[] = '<input type="text" size="5" name="article_rank_' . $item['id'] . '" value="' . $item['rank'] . '" onfocus="$(\'#article_selector_' . $count . '\').attr(\'checked\', \'checked\');" onchange="$(\'#act_on_articles\').prop(\'selectedIndex\', 9);" />';
         // append the row
         $text .= Skin::table_row($cells, $count++);
     }
     // select all rows
     $cells = array('<input type="checkbox" class="row_selector" onclick="cascade_selection_to_all_article_rows(this);" />', i18n::s('Select all/none'), '');
     $text .= Skin::table_row($cells, $count++);
     // table suffix
     $text .= Skin::table_suffix();
     // end of processing
     SQL::free($result);
     return $text;
 }
开发者ID:rair,项目名称:yacs,代码行数:101,代码来源:layout_articles_as_manage.php

示例5: layout


//.........这里部分代码省略.........
         // 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']);
         }
         // signal restricted and private sections
         if ($item['active'] == 'N') {
             $prefix .= PRIVATE_FLAG;
         } elseif ($item['active'] == 'R') {
             $prefix .= RESTRICTED_FLAG;
         }
         // this is another row of the output
         $text .= '<tr class="' . $class_title . '"><th>' . $prefix . Skin::build_link($url, $title, 'basic', i18n::s('View the section')) . $suffix . '</th></tr>' . "\n";
         // document most recent page here
         $content = $prefix = $title = $suffix = $icon = '';
         $menu = array();
         // branches of this tree
         $anchors = Sections::get_branch_at_anchor('section:' . $item['id']);
         // get last post
         $article =& Articles::get_newest_for_anchor($anchors, TRUE);
         if ($article['id']) {
             // permalink
             $url = Articles::get_permalink($article);
             // get the anchor
             $anchor = Anchors::get($article['anchor']);
             // get the related overlay, if any
             $overlay = Overlay::load($item, 'section:' . $item['id']);
             // use the title to label the link
             if (is_object($overlay)) {
                 $title = Codes::beautify_title($overlay->get_text('title', $article));
             } else {
                 $title = Codes::beautify_title($article['title']);
             }
             // signal restricted and private articles
             if ($article['active'] == 'N') {
                 $prefix .= PRIVATE_FLAG;
             } elseif ($article['active'] == 'R') {
                 $prefix .= RESTRICTED_FLAG;
             }
             // the icon to put aside
             if ($article['thumbnail_url']) {
                 $icon = $article['thumbnail_url'];
             }
             // the icon to put aside
             if (!$icon && is_callable(array($anchor, 'get_bullet_url'))) {
                 $icon = $anchor->get_bullet_url();
             }
             if ($icon) {
                 $icon = '<a href="' . $context['url_to_root'] . $url . '"><img src="' . $icon . '" class="right_image" alt="" title="' . encode_field(i18n::s('View the page')) . '" /></a>';
             }
             // the introductory text
             if ($article['introduction']) {
                 $content .= Codes::beautify_introduction($article['introduction']);
             } elseif (!is_object($overlay)) {
                 $handle = new Article();
                 $handle->load_by_content($article);
                 $content .= $handle->get_teaser('teaser');
             }
             // insert overlay data, if any
             if (is_object($overlay)) {
                 $content .= $overlay->get_text('list', $article);
             }
             // link to description, if any
             if (trim($article['description'])) {
                 $menu[] = Skin::build_link($url, i18n::s('Read more') . MORE_IMG, 'span', i18n::s('View the page'));
             }
             // info on related files
             if ($count = Files::count_for_anchor('article:' . $article['id'])) {
                 $menu[] = sprintf(i18n::ns('%d file', '%d files', $count), $count);
             }
             // info on related comments
             if ($count = Comments::count_for_anchor('article:' . $article['id'])) {
                 $menu[] = sprintf(i18n::ns('%d comment', '%d comments', $count), $count);
             }
             // discuss
             if (Comments::allow_creation($article, $anchor)) {
                 $menu[] = Skin::build_link(Comments::get_url('article:' . $article['id'], 'comment'), i18n::s('Discuss'), 'span');
             }
             // the main anchor link
             if (is_object($anchor) && (!isset($this->focus) || $article['anchor'] != $this->focus)) {
                 $menu[] = Skin::build_link($anchor->get_url(), ucfirst($anchor->get_title()), 'span', i18n::s('View the section'));
             }
             // list up to three categories by title, if any
             if ($items =& Members::list_categories_by_title_for_member('article:' . $article['id'], 0, 3, 'raw')) {
                 foreach ($items as $id => $attributes) {
                     $menu[] = Skin::build_link(Categories::get_permalink($attributes), $attributes['title'], 'span');
                 }
             }
             // append a menu
             $content .= '<p>' . Skin::finalize_list($menu, 'menu') . '</p>';
             // this is another row of the output
             $text .= '<tr class="' . $class_detail . '"><td>' . '<h3 class="top"><span>' . Skin::build_link($url, $prefix . $title . $suffix, 'basic', i18n::s('View the page')) . '</span></h3>' . '<div class="content">' . $icon . $content . '</div>' . '</td></tr>' . "\n";
         }
     }
     // end of processing
     SQL::free($result);
     $text .= Skin::table_suffix();
     return $text;
 }
开发者ID:rair,项目名称:yacs,代码行数:101,代码来源:layout_sections_as_slashdot.php

示例6: array

     } else {
         $box_title = i18n::s('Navigation');
         $box_url = '';
     }
     // in a navigation box
     $box_popup = '';
     $context['components']['contextual'] = Skin::build_box($box_title, $menu, 'contextual', 'contextual_menu', $box_url, $box_popup);
 }
 // categories attached to this article, if not at another follow-up page
 if (!$zoom_type || $zoom_type == 'categories') {
     // build a complete box
     $box['bar'] = array();
     $box['text'] = '';
     // list categories by title
     $offset = ($zoom_index - 1) * CATEGORIES_PER_PAGE;
     $items =& Members::list_categories_by_title_for_member('article:' . $item['id'], $offset, CATEGORIES_PER_PAGE, 'sidebar');
     // the command to change categories assignments
     if (Categories::allow_assign($item, $anchor)) {
         $items = array_merge($items, array(Categories::get_url('article:' . $item['id'], 'select') => i18n::s('Assign categories')));
     }
     // actually render the html for the section
     if (is_array($box['bar'])) {
         $box['text'] .= Skin::build_list($box['bar'], 'menu_bar');
     }
     if (is_array($items)) {
         $box['text'] .= Skin::build_list($items, 'compact');
     }
     if ($box['text']) {
         $context['components']['categories'] = Skin::build_box(i18n::s('See also'), $box['text'], 'categories', 'categories');
     }
 }
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:view.php

示例7: layout


//.........这里部分代码省略.........
         $hover = i18n::s('View the page');
         if (Surfer::is_member()) {
             $hover .= ' [article=' . $item['id'] . ']';
         }
         // use the title as a link to the page
         $title = $prefix . Skin::build_link($url, ucfirst($title), 'basic', $hover) . $suffix;
         $suffix = '';
         // the introductory text
         $introduction = '';
         if (is_object($overlay)) {
             $introduction = $overlay->get_text('introduction', $item);
         } elseif ($item['introduction']) {
             $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);
         }
         // shortcuts to comments pages
         if (isset($item['comments_count']) && ($pages = (int) ceil($item['comments_count'] / $layout->items_per_page())) && $pages > 1) {
             $suffix .= '<p class="details">Pages ';
             for ($index = 1; $index <= $pages; $index++) {
                 $suffix .= Skin::build_link('comments/list.php?id=article:' . $item['id'] . '&amp;page=' . $index, $index, 'basic', i18n::s('One page of comments')) . ' ';
             }
             $suffix .= Skin::build_link('comments/list.php?id=article:' . $item['id'] . '&amp;page=' . $pages, MORE_IMG, 'basic', i18n::s('Most recent comments')) . '</p>';
         }
         // links to sections and categories
         $anchors = array();
         // the main anchor link
         if (is_object($anchor) && (!isset($this->focus) || $item['anchor'] != $this->focus)) {
             $anchors[] = Skin::build_link($anchor->get_url(), ucfirst($anchor->get_title()), 'basic', i18n::s('In this section'));
         }
         // list categories by title, if any
         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>';
                 }
                 if (!isset($this->focus) || $this->focus != 'category:' . $category_id) {
                     $anchors[] = Skin::build_link(Categories::get_permalink($attributes), $attributes['title'], 'basic', i18n::s('Related topics'));
                 }
             }
         }
         // list section and categories in the suffix
         if (@count($anchors)) {
             $suffix .= '<p class="tags">' . implode(' ', $anchors) . '</p>';
         }
         // the creator of this article
         $starter = '';
         if ($item['create_name']) {
             $starter = '<span class="details">' . Users::get_link($item['create_name'], $item['create_address'], $item['create_id']) . '</span>';
         }
         // the last editor
         $details = '';
         if ($item['edit_date']) {
             // find a name, if any
             $user = '';
             if ($item['edit_name']) {
                 // label the action
                 if (isset($item['edit_action'])) {
                     $user .= Anchors::get_action_label($item['edit_action']) . ' ';
                 }
                 // name of last editor
                 $user .= sprintf(i18n::s('by %s'), Users::get_link($item['edit_name'], $item['edit_address'], $item['edit_id']));
             }
             $details .= $user . ' ' . Skin::build_date($item['edit_date']);
         }
         // signal locked articles
         if (isset($item['locked']) && $item['locked'] == 'Y' && Articles::is_owned($item, $anchor)) {
             $details .= ', ' . LOCKED_FLAG;
         }
         // poster details
         if ($details) {
             $details = '<p class="details">' . $details . "</p>\n";
         }
         if (!isset($item['comments_count'])) {
             $item['comments_count'] = 0;
         }
         // this is another row of the output
         $cells = array($title . $suffix, 'center=' . $starter, 'center=' . $item['comments_count'], 'center=' . Skin::build_number($item['hits']), $details);
         if (THREAD_IMG) {
             $cells = array_merge(array($icon), $cells);
         }
         $rows[] = $cells;
     }
     // end of processing
     SQL::free($result);
     // headers
     $headers = array(i18n::s('Topic'), 'center=' . i18n::s('Poster'), 'center=' . i18n::s('Replies'), 'center=' . i18n::s('Views'), i18n::s('Last post'));
     if (THREAD_IMG) {
         $headers = array_merge(array(''), $headers);
     }
     // make a sortable table
     $output = Skin::table($headers, $rows, 'yabb');
     return $output;
 }
开发者ID:rair,项目名称:yacs,代码行数:101,代码来源:layout_articles_as_yabb.php

示例8: layout

 /**
  * list articles as a daily weblog do
  *
  * @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)) {
         if (Surfer::is_associate()) {
             $text .= '<p>' . sprintf(i18n::s('Use the %s to populate this server.'), Skin::build_link('help/populate.php', i18n::s('Content Assistant'), 'shortcut')) . '</p>';
         }
         return $text;
     }
     // build a list of articles
     include_once $context['path_to_root'] . 'comments/comments.php';
     include_once $context['path_to_root'] . 'links/links.php';
     while ($item = SQL::fetch($result)) {
         // three components per box
         $box = array();
         $box['date'] = '';
         $box['title'] = '';
         $box['content'] = '';
         // get the related overlay, if any
         $overlay = Overlay::load($item, 'article:' . $item['id']);
         // get the anchor
         $anchor = Anchors::get($item['anchor']);
         // permalink
         $url = Articles::get_permalink($item);
         // make a live title
         if (is_object($overlay)) {
             $box['title'] .= Codes::beautify_title($overlay->get_text('title', $item));
         } else {
             $box['title'] .= Codes::beautify_title($item['title']);
         }
         // make a clickable title
         $box['title'] = Skin::build_link($url, $box['title'], 'basic');
         // signal restricted and private articles
         if ($item['active'] == 'N') {
             $box['title'] = PRIVATE_FLAG . $box['title'];
         } elseif ($item['active'] == 'R') {
             $box['title'] = RESTRICTED_FLAG . $box['title'];
         }
         // flag articles updated recently
         if ($item['expiry_date'] > NULL_DATE && $item['expiry_date'] <= $context['now']) {
             $box['title'] .= EXPIRED_FLAG;
         } elseif ($item['create_date'] >= $context['fresh']) {
             $box['title'] .= NEW_FLAG;
         } elseif ($item['edit_date'] >= $context['fresh']) {
             $box['title'] .= UPDATED_FLAG;
         }
         // what's the date of publication?
         if (isset($item['publish_date']) && $item['publish_date'] > NULL_DATE) {
             $box['date'] .= Skin::build_date($item['publish_date'], 'publishing');
         }
         // the icon to put aside - never use anchor images
         if ($item['icon_url']) {
             $box['content'] .= '<a href="' . $context['url_to_root'] . $url . '"><img src="' . $item['icon_url'] . '" class="left_image" alt="" /></a>';
         }
         // details
         $details = array();
         // 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');
         }
         // show details
         if (count($details)) {
             $box['content'] .= '<p class="details">' . implode(' ~ ', $details) . '</p>' . "\n";
         }
         // list categories by title, if any
         if ($items = Members::list_categories_by_title_for_member('article:' . $item['id'], 0, 7, 'raw')) {
             $tags = array();
             foreach ($items as $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>';
                 }
                 $tags[] = Skin::build_link(Categories::get_permalink($attributes), $attributes['title'], 'basic');
             }
             $box['content'] .= '<p class="tags">' . implode(' ', $tags) . '</p>';
         }
         // the introduction text, if any
         if (is_object($overlay)) {
             $box['content'] .= Skin::build_block($overlay->get_text('introduction', $item), 'introduction');
         } else {
             $box['content'] .= Skin::build_block($item['introduction'], 'introduction');
         }
         // insert overlay data, if any
         if (is_object($overlay)) {
             $box['content'] .= $overlay->get_text('list', $item);
         }
         // the description
         $box['content'] .= Skin::build_block($item['description'], 'description', '', $item['options']);
         // a compact list of attached files
//.........这里部分代码省略.........
开发者ID:rair,项目名称:yacs,代码行数:101,代码来源:layout_home_articles_as_daily.php

示例9: layout


//.........这里部分代码省略.........
             $prefix .= STICKY_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;
         }
         // signal locked articles
         if (isset($item['locked']) && $item['locked'] == 'Y' && Articles::is_owned($item, $anchor)) {
             $suffix .= ' ' . LOCKED_FLAG;
         }
         // flag articles 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;
         }
         // rating
         if ($item['rating_count'] && !(is_object($anchor) && $anchor->has_option('without_rating'))) {
             $suffix .= Skin::build_link(Articles::get_url($item['id'], 'like'), Skin::build_rating_img((int) round($item['rating_sum'] / $item['rating_count'])), 'basic');
         }
         // the full introductory text
         if ($item['introduction']) {
             $content .= Codes::beautify_introduction($item['introduction']);
         } elseif (!is_object($overlay)) {
             $article = new Article();
             $article->load_by_content($item);
             $content .= $article->get_teaser('teaser');
         }
         // insert overlay data, if any
         if (is_object($overlay)) {
             $content .= $overlay->get_text('list', $item);
         }
         // add details
         $details = array();
         // the author
         if (isset($context['with_author_information']) && $context['with_author_information'] == 'Y') {
             if ($item['edit_name'] == $item['create_name']) {
                 $details[] = sprintf(i18n::s('by %s'), ucfirst($item['create_name']));
             } else {
                 $details[] = sprintf(i18n::s('by %s, %s'), ucfirst($item['create_name']), ucfirst($item['edit_name']));
             }
         }
         // the modification date
         if ($item['edit_date'] > NULL_DATE) {
             $details[] = Skin::build_date($item['edit_date']);
         }
         // read the article
         $details[] = Skin::build_link($url, i18n::s('More'), 'basic');
         // info on related files
         if ($count = Files::count_for_anchor('article:' . $item['id'], TRUE)) {
             $details[] = Skin::build_link($url . '#_attachments', sprintf(i18n::ns('%d file', '%d files', $count), $count), 'basic');
         }
         // info on related comments
         if ($count = Comments::count_for_anchor('article:' . $item['id'], TRUE)) {
             $link = Comments::get_url('article:' . $item['id'], 'list');
             $details[] = Skin::build_link($link, sprintf(i18n::ns('%d comment', '%d comments', $count), $count), 'basic');
         }
         // discuss
         if (Comments::allow_creation($item, $anchor)) {
             $details[] = Skin::build_link(Comments::get_url('article:' . $item['id'], 'comment'), i18n::s('Discuss'), 'basic');
         }
         // info on related links
         if ($count = Links::count_for_anchor('article:' . $item['id'], TRUE)) {
             $details[] = Skin::build_link($url . '#_attachments', sprintf(i18n::ns('%d link', '%d links', $count), $count), 'basic');
         }
         // list categories by title, if any
         if ($items =& Members::list_categories_by_title_for_member('article:' . $item['id'], 0, 7, 'raw')) {
             foreach ($items as $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>';
                 }
                 $details[] = Skin::build_link(Categories::get_permalink($attributes), $attributes['title'], 'basic');
             }
         }
         // details
         if (count($details)) {
             $content .= '<div><span class="details">' . ucfirst(implode(' - ', $details)) . '</span></div>';
         }
         // insert a complete box
         $text .= Skin::build_box(Skin::build_link($url, $prefix . $title . $suffix, 'basic', i18n::s('View the page')), $icon . $content, 'header1 ' . $class, 'article_' . $item['id']);
         // stack boxes
         if ($class == 'even') {
             $class = 'odd';
         } else {
             $class = 'even';
         }
     }
     // end of processing
     SQL::free($result);
     return $text;
 }
开发者ID:rair,项目名称:yacs,代码行数:101,代码来源:layout_articles_as_slashdot.php

示例10: join

     // public aggregators
     // 		if(!isset($context['without_internet_visibility']) || ($context['without_internet_visibility'] != 'Y'))
     // 			$lines[] = join(BR, Skin::build_subscribers($context['url_to_home'].$context['url_to_root'].Users::get_url($item['id'], 'feed'), $item['nick_name']));
 }
 // in a side box
 if (count($lines)) {
     $context['components']['channels'] = Skin::build_box(i18n::s('Monitor'), join(BR, $lines), 'channels', 'feed');
 }
 // categories attached to this item, if not at another follow-up page
 if (!$zoom_type || $zoom_type == 'categories') {
     // build a complete box
     $box = array();
     $box['bar'] = array();
     $box['text'] = '';
     // list categories by title
     $items =& Members::list_categories_by_title_for_member('user:' . $item['id'], 0, COMPACT_LIST_SIZE, 'sidebar');
     // the command to change categories assignments
     if (Categories::allow_assign($item)) {
         $items = array_merge($items, array(Categories::get_url('user:' . $item['id'], 'select') => i18n::s('Assign categories')));
     }
     // actually render the html for the section
     if (is_array($box['bar'])) {
         $box['text'] .= Skin::build_list($box['bar'], 'menu_bar');
     }
     if (is_array($items)) {
         $box['text'] .= Skin::build_list($items, 'compact');
     }
     if ($box['text']) {
         $context['components']['categories'] = Skin::build_box(i18n::s('See also'), $box['text'], 'categories', 'categories');
     }
 }
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:view.php

示例11: layout_newest

 /**
  * layout one of the newest articles
  *
  * @param array the article
  * @param object the anchor of this article, if any
  * @return string the rendered text
  **/
 function layout_newest($item, $anchor)
 {
     global $context;
     // get the related overlay, if any
     $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']);
     }
     // initialize variables
     $prefix = $suffix = $text = '';
     // help to jump here
     $prefix .= '<a id="article_' . $item['id'] . '"></a>';
     // signal restricted and private articles
     if ($item['active'] == 'N') {
         $prefix .= PRIVATE_FLAG;
     } elseif ($item['active'] == 'R') {
         $prefix .= RESTRICTED_FLAG;
     }
     // rating
     if ($item['rating_count']) {
         $suffix .= Skin::build_link(Articles::get_url($item['id'], 'like'), Skin::build_rating_img((int) round($item['rating_sum'] / $item['rating_count'])), 'basic', i18n::s('Rate this page'));
     }
     // use the title as a link to the page
     $text .= '<h3><span>' . $prefix . Skin::build_link($url, $title, 'basic', i18n::s('View the page')) . $suffix . '</span></h3>';
     // details
     $details = array();
     // the creator and editor of this article
     if (isset($context['with_author_information']) && $context['with_author_information'] == 'Y') {
         if ($item['edit_name'] != $item['create_name']) {
             $label = sprintf(i18n::s('by %s, %s'), ucfirst($item['create_name']), ucfirst($item['edit_name']));
         } else {
             $label = sprintf(i18n::s('by %s'), ucfirst($item['create_name']));
         }
         $details[] = $label;
     }
     // poster details
     if (count($details)) {
         $text .= BR . '<span class="details">' . ucfirst(implode(', ', $details)) . "</span>\n";
     }
     // the introductory text
     $introduction = '';
     if (is_object($overlay)) {
         $introduction .= Codes::beautify_introduction($overlay->get_text('introduction', $item));
     } elseif ($item['introduction']) {
         $introduction .= Codes::beautify_introduction($item['introduction']);
     } else {
         $introduction .= Skin::cap(Codes::beautify($item['description'], $item['options']), 70);
     }
     if ($introduction) {
         $text .= '<p>' . $introduction . '</p>' . "\n";
     }
     // insert overlay data, if any
     if (is_object($overlay)) {
         $text .= $overlay->get_text('list', $item);
     }
     // read this article
     $text .= '<p class="details">' . Skin::build_link($url, i18n::s('View the page'), 'basic');
     // info on related files
     if ($count = Files::count_for_anchor('article:' . $item['id'], TRUE)) {
         $text .= ' (' . Skin::build_link($url . '#_attachments', sprintf(i18n::ns('%d file', '%d files', $count), $count), 'basic') . ')';
     }
     // list up to three categories by title, if any
     if ($items =& Members::list_categories_by_title_for_member('article:' . $item['id'], 0, 5, 'raw')) {
         $text .= BR;
         $first_category = TRUE;
         foreach ($items as $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>';
             }
             if (!$first_category) {
                 $text .= ',';
             }
             $text .= ' ' . Skin::build_link(Categories::get_permalink($attributes), $attributes['title'], 'basic', i18n::s('More pages'));
             $first_category = FALSE;
         }
     }
     $text .= '</p>';
     return $text;
 }
开发者ID:rair,项目名称:yacs,代码行数:92,代码来源:layout_articles_as_hardboiled.php

示例12: render_categories

 /**
  * render a list of categories
  *
  * The provided anchor can reference:
  * - a section 'category:123'
  * - 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_categories($layout = 'compact', $anchor = '')
 {
     global $context;
     // we return some text;
     $text = '';
     // number of items to display
     $count = YAHOO_LIST_SIZE;
     if (($position = strpos($anchor, ',')) !== FALSE) {
         $count = (int) trim(substr($anchor, $position + 1));
         if (!$count) {
             $count = YAHOO_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 category
     if (strpos($anchor, 'category:') === 0) {
         $text = Categories::list_by_title_for_anchor($anchor, 0, $count, $layout);
     } elseif (strpos($anchor, 'user:') === 0) {
         $text = Members::list_categories_by_title_for_member($anchor, 0, $count, $layout);
     }
     // consider all pages
     if (!$text) {
         $text = Categories::list_by_title_for_anchor(NULL, 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,代码行数:50,代码来源:codes.php

示例13: layout


//.........这里部分代码省略.........
         }
         // close digg-like area
         $digg .= '</div>';
         // 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;
         }
         // signal locked articles
         if (isset($item['locked']) && $item['locked'] == 'Y' && Articles::is_owned($item, $anchor)) {
             $suffix .= ' ' . LOCKED_FLAG;
         }
         // flag articles 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;
         }
         // the full introductory text
         if (is_object($overlay)) {
             $content .= Codes::beautify_introduction($overlay->get_text('introduction', $item));
         }
         if ($item['introduction']) {
             $content .= Codes::beautify_introduction($item['introduction']);
         } else {
             $article = new Article();
             $article->load_by_content($item);
             $content .= $article->get_teaser('teaser');
         }
         // add details
         $details = array();
         // the author
         if (isset($context['with_author_information']) && $context['with_author_information'] == 'Y') {
             if ($item['edit_name'] == $item['create_name']) {
                 $details[] = sprintf(i18n::s('by %s'), ucfirst($item['create_name']));
             } else {
                 $details[] = sprintf(i18n::s('by %s, %s'), ucfirst($item['create_name']), ucfirst($item['edit_name']));
             }
         }
         // the publish date
         if (isset($item['publish_date']) && $item['publish_date'] > NULL_DATE) {
             $details[] = Skin::build_date($item['publish_date']);
         }
         // read the article
         $details[] = Skin::build_link($url, i18n::s('View the page'), 'basic');
         // info on related files
         if ($count = Files::count_for_anchor('article:' . $item['id'], TRUE)) {
             $details[] = Skin::build_link($url . '#_attachments', sprintf(i18n::ns('%d file', '%d files', $count), $count), 'basic');
         }
         // info on related comments
         if ($count = Comments::count_for_anchor('article:' . $item['id'], TRUE)) {
             $link = Comments::get_url('article:' . $item['id'], 'list');
             $details[] = Skin::build_link($link, sprintf(i18n::ns('%d comment', '%d comments', $count), $count), 'basic');
         }
         // discuss
         if (Comments::allow_creation($item, $anchor)) {
             $details[] = Skin::build_link(Comments::get_url('article:' . $item['id'], 'comment'), i18n::s('Discuss'), 'basic');
         }
         // info on related links
         if ($count = Links::count_for_anchor('article:' . $item['id'], TRUE)) {
             $details[] = Skin::build_link($url . '#_attachments', sprintf(i18n::ns('%d link', '%d links', $count), $count), 'basic');
         }
         // link to the anchor page
         if (is_object($anchor) && (!isset($this->focus) || $item['anchor'] != $this->focus)) {
             $details[] = Skin::build_link($anchor->get_url(), $anchor->get_title(), 'basic');
         }
         // list categories by title, if any
         if ($items =& Members::list_categories_by_title_for_member('article:' . $item['id'], 0, 7, 'raw')) {
             foreach ($items as $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>';
                 }
                 $details[] = Skin::build_link(Categories::get_permalink($attributes), $attributes['title'], 'basic');
             }
         }
         // details
         if (count($details)) {
             $content .= '<p class="details">' . ucfirst(implode(' - ', $details)) . '</p>';
         }
         // manage layout
         $content = '<div class="digg_content">' . $digg . $content . '</div>';
         // insert a complete box
         $text .= Skin::build_box($prefix . $title . $suffix, $icon . $content, 'header1', 'article_' . $item['id']);
         // section closing
         if ($item_count == 1) {
             $text .= '</div>' . "\n";
         }
     }
     // end of processing
     SQL::free($result);
     return $text;
 }
开发者ID:rair,项目名称:yacs,代码行数:101,代码来源:layout_articles_as_digg.php


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