예제 #1
0
파일: select.php 프로젝트: rair/yacs
     if (Surfer::is(intval(substr($anchor->get_reference(), 5)))) {
         $title = i18n::s('Who do you want to follow?');
     } else {
         $title = sprintf(i18n::s('Persons followed by %s'), $anchor->get_title());
     }
 } elseif (!strncmp($anchor->get_reference(), 'category:', 9)) {
     $title = sprintf(i18n::s('Add a member to %s'), $anchor->get_title());
 } else {
     $title = i18n::s('Add a participant');
 }
 // finalize the box
 $context['text'] .= Skin::build_box($title, $form, 'header1');
 // looking at category members
 if (!strncmp($anchor->get_reference(), 'category:', 9)) {
     // current list of category members
     if ($users =& Members::list_users_by_name_for_anchor($anchor->get_reference(), 0, 5 * USERS_LIST_SIZE, 'raw')) {
         // browse the list
         $new_users = 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 ($anchor->is_owned($id, FALSE)) {
                 $suffix .= ' - <span class="details">' . i18n::s('owner') . '</span>';
예제 #2
0
파일: category.php 프로젝트: rair/yacs
 /**
  * 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;
 }
예제 #3
0
파일: view.php 프로젝트: rair/yacs
 // notify members
 if ($count > 1 && Surfer::is_associate()) {
     Skin::define_img('CATEGORIES_EMAIL_IMG', 'categories/email.gif');
     $box['bar'] += array(Categories::get_url($item['id'], 'mail') => CATEGORIES_EMAIL_IMG . i18n::s('Notify members'));
 }
 // spread the list over several pages
 if ($count > USERS_LIST_SIZE) {
     $box['bar'] += array('_count' => sprintf(i18n::ns('%d user', '%d users', $count), $count));
 }
 // navigation commands for users
 $home = Categories::get_permalink($item);
 $prefix = Categories::get_url($item['id'], 'navigate', 'users');
 $box['bar'] = array_merge($box['bar'], Skin::navigate($home, $prefix, $count, USERS_LIST_SIZE, $zoom_index));
 // list items by date (default) or by title (option 'users_by_title')
 $offset = ($zoom_index - 1) * USERS_LIST_SIZE;
 $items =& Members::list_users_by_name_for_anchor('category:' . $item['id'], $offset, USERS_LIST_SIZE, $layout);
 // actually render the html
 if ($box['bar']) {
     $box['text'] .= Skin::build_list($box['bar'], 'menu_bar');
 }
 if (is_array($items)) {
     $box['text'] .= Skin::build_list($items, 'decorated');
 } elseif (is_string($items)) {
     $box['text'] .= $items;
 }
 if ($box['bar'] && $stats['count'] - $offset > 5) {
     $box['text'] .= Skin::build_list($box['bar'], 'menu_bar');
 }
 // in a separate panel
 if ($box['text']) {
     $panels[] = array('users', i18n::s('Persons'), 'users_panel', $box['text']);