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


PHP KunenaForumCategoryHelper::getChildren方法代码示例

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


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

示例1: getCategories

	/**
	 * @return array
	 */
	public function getCategories()
	{
		$rows			=	\KunenaForumCategoryHelper::getChildren( 0, 10, array( 'action' => 'admin', 'unpublished' => true ) );
		$options		=	array();

		foreach ( $rows as $row ) {
			$options[]	=	\moscomprofilerHTML::makeOption( (string) $row->id, str_repeat( '- ', $row->level + 1  ) . ' ' . $row->name );
		}

		return $options;
	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:14,代码来源:Model.php

示例2: getCategoryTree

 /**
  * @param XmapDisplayerInterface $xmap
  * @param stdClass $parent
  * @param array $params
  * @param int $catid
  */
 private static function getCategoryTree($xmap, stdClass $parent, array &$params, $catid)
 {
     /** @var KunenaForumCategory[] $categories */
     $categories = KunenaForumCategoryHelper::getChildren($catid);
     $xmap->changeLevel(1);
     foreach ($categories as $cat) {
         $node = new stdClass();
         $node->id = $parent->id;
         $node->browserNav = $parent->browserNav;
         $node->uid = $parent->uid . '_c_' . $cat->id;
         $node->name = $cat->name;
         $node->priority = $params['cat_priority'];
         $node->changefreq = $params['cat_changefreq'];
         $node->link = 'index.php?option=com_kunena&view=category&catid=' . $cat->id . '&Itemid=' . $parent->id;
         $node->secure = $parent->secure;
         if ($xmap->printNode($node)) {
             self::getTopics($xmap, $parent, $params, $cat->id);
         }
     }
     $xmap->changeLevel(-1);
 }
开发者ID:b2un0,项目名称:joomla-plugin-xmap-kunena,代码行数:27,代码来源:com_kunena.php

示例3: getLatestMessages

 /**
  * @param bool|array|int  $categories
  * @param int   $limitstart
  * @param int   $limit
  * @param array $params
  *
  * @return array
  */
 public static function getLatestMessages($categories = false, $limitstart = 0, $limit = 0, $params = array())
 {
     $reverse = isset($params['reverse']) ? (int) $params['reverse'] : 0;
     $orderby = isset($params['orderby']) ? (string) $params['orderby'] : 'm.time DESC';
     $starttime = isset($params['starttime']) ? (int) $params['starttime'] : 0;
     $mode = isset($params['mode']) ? $params['mode'] : 'recent';
     $user = isset($params['user']) ? $params['user'] : false;
     $where = isset($params['where']) ? (string) $params['where'] : '';
     $childforums = isset($params['childforums']) ? (bool) $params['childforums'] : false;
     $db = JFactory::getDBO();
     // FIXME: use right config setting
     if ($limit < 1 && empty($params['nolimit'])) {
         $limit = KunenaFactory::getConfig()->threads_per_page;
     }
     $query = $db->getQuery(true);
     $query->select('m.*, t.message')->from('#__kunena_messages AS m')->innerJoin('#__kunena_messages_text AS t ON m.id = t.mesid')->where('m.moved=0')->order($orderby);
     $authorise = 'read';
     $hold = 'm.hold=0';
     $userfield = 'm.userid';
     switch ($mode) {
         case 'unapproved':
             $authorise = 'approve';
             $hold = "m.hold=1";
             break;
         case 'deleted':
             $authorise = 'undelete';
             $hold = "m.hold>=2";
             break;
         case 'mythanks':
             $userfield = 'th.userid';
             $query->innerJoin('#__kunena_thankyou AS th ON m.id = th.postid');
             break;
         case 'thankyou':
             $userfield = 'th.targetuserid';
             $query->innerJoin('#__kunena_thankyou AS th ON m.id = th.postid');
             break;
         case 'recent':
         default:
     }
     if (is_array($categories) && in_array(0, $categories)) {
         $categories = false;
     }
     $categories = KunenaForumCategoryHelper::getCategories($categories, $reverse, 'topic.' . $authorise);
     if ($childforums) {
         $categories += KunenaForumCategoryHelper::getChildren($categories, -1, array('action' => 'topic.' . $authorise));
     }
     $catlist = array();
     foreach ($categories as $category) {
         $catlist += $category->getChannels();
     }
     if (empty($catlist)) {
         return array(0, array());
     }
     $allowed = implode(',', array_keys($catlist));
     $query->where("m.catid IN ({$allowed})");
     $query->where($hold);
     if ($user) {
         $query->where("{$userfield}={$db->Quote($user)}");
     }
     // Negative time means no time
     if ($starttime == 0) {
         $starttime = KunenaFactory::getSession()->lasttime;
     } elseif ($starttime > 0) {
         $starttime = JFactory::getDate()->toUnix() - $starttime * 3600;
     }
     if ($starttime > 0) {
         $query->where("m.time>{$db->Quote($starttime)}");
     }
     if ($where) {
         $query->where($where);
     }
     $cquery = clone $query;
     $cquery->clear('select')->clear('order')->select('COUNT(*)');
     $db->setQuery($cquery);
     $total = (int) $db->loadResult();
     if (KunenaError::checkDatabaseError() || !$total) {
         return array(0, array());
     }
     // If out of range, use last page
     if ($limit && $total < $limitstart) {
         $limitstart = intval($total / $limit) * $limit;
     }
     $db->setQuery($query, $limitstart, $limit);
     $results = $db->loadAssocList();
     if (KunenaError::checkDatabaseError()) {
         return array(0, array());
     }
     $messages = array();
     foreach ($results as $result) {
         $instance = new KunenaForumMessage($result);
         $instance->exists(true);
         self::$_instances[$instance->id] = $instance;
//.........这里部分代码省略.........
开发者ID:proyectoseb,项目名称:University,代码行数:101,代码来源:helper.php

示例4: isCategoryConflict

	function isCategoryConflict($menuitem, $catid, $catname) {
		KUNENA_PROFILER ? KunenaProfiler::instance()->start('function '.__CLASS__.'::'.__FUNCTION__.'()') : null;
		if (isset ( self::$views[$catname] ) || isset ( self::$layouts[$catname] ) || isset ( self::$functions[$catname] ) ) {
			KUNENA_PROFILER ? KunenaProfiler::instance()->stop('function '.__CLASS__.'::'.__FUNCTION__.'()') : null;
			return true;
		}
		if (self::$catidcache === null) {
			self::loadCategories ();
		}
		$keys = array_keys(self::$catidcache, $catname);
		if (count($keys) == 1) return false;
		if (!empty($menuitem->query['catid'])) {
			$keys = array_flip($keys);
			unset($keys[$catid]);
			$categories = array_intersect_key($keys, KunenaForumCategoryHelper::getChildren($menuitem->query['catid']));
			KUNENA_PROFILER ? KunenaProfiler::instance()->stop('function '.__CLASS__.'::'.__FUNCTION__.'()') : null;
			return !empty($categories);
		}
		KUNENA_PROFILER ? KunenaProfiler::instance()->stop('function '.__CLASS__.'::'.__FUNCTION__.'()') : null;
		return true;
	}
开发者ID:rich20,项目名称:Kunena,代码行数:21,代码来源:router.php

示例5: checkCategory

	protected static function checkCategory($item, JUri $uri)
	{
		static $cache = array();
		$catid = (int) $uri->getVar('catid');
		$check = self::check($item, $uri);

		if (!$check || !$catid)
		{
			return $check;
		}

		if (!isset($cache[$item->id]))
		{
			$cache[$item->id] = array();

			if (!empty($item->query['catid']))
			{
				$cache[$item->id] = KunenaForumCategoryHelper::getChildren($item->query['catid']);
				$cache[$item->id][$item->query['catid']] = KunenaForumCategoryHelper::get($item->query['catid']);
			}
		}

		return intval(isset($cache[$item->id][$catid])) * 8;
	}
开发者ID:BillVGN,项目名称:PortalPRP,代码行数:24,代码来源:route.php

示例6: getCategoryTree

 static function getCategoryTree($xmap, $parent, &$params, $parentCat)
 {
     $db = JFactory::getDBO();
     // Load categories
     if (self::getKunenaMajorVersion() >= '2.0') {
         // Kunena 2.0+
         $catlink = 'index.php?option=com_kunena&view=category&catid=%s&Itemid=' . $parent->id;
         $toplink = 'index.php?option=com_kunena&view=topic&catid=%s&id=%s&Itemid=' . $parent->id;
         // kimport('kunena.forum.category.helper');
         $categories = KunenaForumCategoryHelper::getChildren($parentCat);
     } else {
         $catlink = 'index.php?option=com_kunena&func=showcat&catid=%s&Itemid=' . $parent->id;
         $toplink = 'index.php?option=com_kunena&func=view&catid=%s&id=%s&Itemid=' . $parent->id;
         if (self::getKunenaMajorVersion() >= '1.6') {
             // Kunena 1.6+
             kimport('session');
             $session = KunenaFactory::getSession();
             $session->updateAllowedForums();
             $allowed = $session->allowed;
             $query = "SELECT id, name FROM `#__kunena_categories` WHERE parent={$parentCat} AND id IN ({$allowed}) ORDER BY ordering";
         } else {
             // Kunena 1.0+
             $query = "SELECT id, name FROM `{$params['table_prefix']}_categories` WHERE parent={$parentCat} AND published=1 AND pub_access=0 ORDER BY ordering";
         }
         $db->setQuery($query);
         $categories = $db->loadObjectList();
     }
     /* get list of categories */
     $xmap->changeLevel(1);
     foreach ($categories as $cat) {
         $node = new stdclass();
         $node->id = $parent->id;
         $node->browserNav = $parent->browserNav;
         $node->uid = 'com_kunenac' . $cat->id;
         $node->name = $cat->name;
         $node->priority = $params['cat_priority'];
         $node->changefreq = $params['cat_changefreq'];
         $node->link = sprintf($catlink, $cat->id);
         $node->expandible = true;
         $node->secure = $parent->secure;
         if ($xmap->printNode($node) !== FALSE) {
             xmap_com_kunena::getCategoryTree($xmap, $parent, $params, $cat->id);
         }
     }
     if ($params['include_topics']) {
         if (self::getKunenaMajorVersion() >= '2.0') {
             // Kunena 2.0+
             // kimport('kunena.forum.topic.helper');
             // TODO: orderby parameter is missing:
             $topics = KunenaForumTopicHelper::getLatestTopics($parentCat, 0, $params['limit'], array('starttime', $params['days']));
             if (count($topics) == 2 && is_numeric($topics[0])) {
                 $topics = $topics[1];
             }
         } else {
             $access = KunenaFactory::getAccessControl();
             $hold = $access->getAllowedHold(self::$profile, $parentCat);
             // Kunena 1.0+
             $query = "SELECT t.id, t.catid, t.subject, max(m.time) as time, count(m.id) as msgcount\n                    FROM {$params['table_prefix']}_messages t\n                    INNER JOIN {$params['table_prefix']}_messages AS m ON t.id = m.thread\n                    WHERE t.catid={$parentCat} AND t.parent=0\n                    AND t.hold in ({$hold})\n                    GROUP BY m.`thread`\n                    ORDER BY {$params['topics_order']} DESC";
             if ($params['days']) {
                 $query = "SELECT * FROM ({$query}) as topics WHERE time >= {$params['days']}";
             }
             #echo str_replace('#__','mgbj2_',$query);
             $db->setQuery($query, 0, $params['limit']);
             $topics = $db->loadObjectList();
         }
         //get list of topics
         foreach ($topics as $topic) {
             $node = new stdclass();
             $node->id = $parent->id;
             $node->browserNav = $parent->browserNav;
             $node->uid = 'com_kunenat' . $topic->id;
             $node->name = $topic->subject;
             $node->priority = $params['topic_priority'];
             $node->changefreq = $params['topic_changefreq'];
             $node->modified = intval(@$topic->last_post_time ? $topic->last_post_time : $topic->time);
             $node->link = sprintf($toplink, @$topic->category_id ? $topic->category_id : $topic->catid, $topic->id);
             $node->expandible = false;
             $node->secure = $parent->secure;
             if ($xmap->printNode($node) !== FALSE) {
                 // Pagination will not work with K2.0, revisit this when that version is out and stable
                 if ($params['include_pagination'] && isset($topic->msgcount) && $topic->msgcount > self::$config->messages_per_page) {
                     $msgPerPage = self::$config->messages_per_page;
                     $threadPages = ceil($topic->msgcount / $msgPerPage);
                     for ($i = 2; $i <= $threadPages; $i++) {
                         $subnode = new stdclass();
                         $subnode->id = $node->id;
                         $subnode->uid = $node->uid . 'p' . $i;
                         $subnode->name = "[{$i}]";
                         $subnode->seq = $i;
                         $subnode->link = $node->link . '&limit=' . $msgPerPage . '&limitstart=' . ($i - 1) * $msgPerPage;
                         $subnode->browserNav = $node->browserNav;
                         $subnode->priority = $node->priority;
                         $subnode->changefreq = $node->changefreq;
                         $subnode->modified = $node->modified;
                         $subnode->secure = $node->secure;
                         $xmap->printNode($subnode);
                     }
                 }
             }
         }
//.........这里部分代码省略.........
开发者ID:jooservices,项目名称:Crexmap,代码行数:101,代码来源:com_kunena.php

示例7: buildInfo

 protected function buildInfo()
 {
     if ($this->_topics !== false) {
         return;
     }
     $this->_topics = 0;
     $this->_posts = 0;
     $this->_lastcat = $this;
     /** @var array|KunenaForumCategory[] $categories */
     $categories[$this->id] = $this;
     // TODO: support channels
     //$categories += $this->getChannels();
     $categories += KunenaForumCategoryHelper::getChildren($this->id);
     foreach ($categories as $category) {
         $category->buildInfo();
         $lastCategory = $category->getLastCategory();
         $this->_topics += $category->_topics ? $category->_topics : max($category->numTopics, 0);
         $this->_posts += $category->_posts ? $category->_posts : max($category->numPosts, 0);
         if ($lastCategory->last_post_time && $this->_lastcat->last_post_time < $lastCategory->last_post_time) {
             $this->_lastcat = $lastCategory;
         }
     }
 }
开发者ID:densem-2013,项目名称:exikom,代码行数:23,代码来源:category.php

示例8: getBoards

 /**
  * @return array
  */
 public static function getBoards()
 {
     if (!class_exists('KunenaForumCategoryHelper')) {
         return array();
     }
     $rows = KunenaForumCategoryHelper::getChildren(0, 10);
     $categories = array();
     if ($rows) {
         foreach ($rows as $row) {
             $categories[] = moscomprofilerHTML::makeOption($row->id, str_repeat('- ', $row->level + 1) . ' ' . $row->name);
         }
     }
     return $categories;
 }
开发者ID:bobozhangshao,项目名称:HeartCare,代码行数:17,代码来源:kunena20.php

示例9: getTopics

 public function getTopics()
 {
     if ($this->topics === false) {
         $catid = $this->getState('item.id');
         $limitstart = $this->getState('list.start');
         $limit = $this->getState('list.limit');
         $format = $this->getState('format');
         $topic_ordering = $this->getCategory()->topic_ordering;
         $access = KunenaAccess::getInstance();
         $hold = $format == 'feed' ? 0 : $access->getAllowedHold($this->me, $catid);
         $moved = $format == 'feed' ? 0 : 1;
         $params = array('hold' => $hold, 'moved' => $moved);
         switch ($topic_ordering) {
             case 'alpha':
                 $params['orderby'] = 'tt.ordering DESC, tt.subject ASC ';
                 break;
             case 'creation':
                 $params['orderby'] = 'tt.ordering DESC, tt.first_post_time ' . strtoupper($this->getState('list.direction'));
                 break;
             case 'lastpost':
             default:
                 $params['orderby'] = 'tt.ordering DESC, tt.last_post_time ' . strtoupper($this->getState('list.direction'));
         }
         if ($format == 'feed') {
             $catid = array_keys(KunenaForumCategoryHelper::getChildren($catid, 100) + array($catid => 1));
         }
         list($this->total, $this->topics) = KunenaForumTopicHelper::getLatestTopics($catid, $limitstart, $limit, $params);
         if ($this->total > 0) {
             // collect user ids for avatar prefetch when integrated
             $userlist = array();
             $lastpostlist = array();
             foreach ($this->topics as $topic) {
                 $userlist[intval($topic->first_post_userid)] = intval($topic->first_post_userid);
                 $userlist[intval($topic->last_post_userid)] = intval($topic->last_post_userid);
                 $lastpostlist[intval($topic->last_post_id)] = intval($topic->last_post_id);
             }
             // Prefetch all users/avatars to avoid user by user queries during template iterations
             if (!empty($userlist)) {
                 KunenaUserHelper::loadUsers($userlist);
             }
             KunenaForumTopicHelper::getUserTopics(array_keys($this->topics));
             KunenaForumTopicHelper::getKeywords(array_keys($this->topics));
             $lastreadlist = KunenaForumTopicHelper::fetchNewStatus($this->topics);
             // Fetch last / new post positions when user can see unapproved or deleted posts
             if (($lastpostlist || $lastreadlist) && ($this->me->isAdmin() || KunenaAccess::getInstance()->getModeratorStatus())) {
                 KunenaForumMessageHelper::loadLocation($lastpostlist + $lastreadlist);
             }
         }
     }
     return $this->topics;
 }
开发者ID:madcsaba,项目名称:li-de,代码行数:51,代码来源:category.php

示例10: before

 /**
  * Prepare category index display.
  *
  * @return void
  */
 protected function before()
 {
     parent::before();
     $this->me = KunenaUserHelper::getMyself();
     // Get sections to display.
     $catid = $this->input->getInt('catid', 0);
     if ($catid) {
         $sections = KunenaForumCategoryHelper::getCategories($catid);
     } else {
         $sections = KunenaForumCategoryHelper::getChildren();
     }
     $sectionIds = array();
     $this->more[$catid] = 0;
     foreach ($sections as $key => $category) {
         $this->categories[$category->id] = array();
         $this->more[$category->id] = 0;
         // Display only categories which are supposed to show up.
         if ($catid || $category->params->get('display.index.parent', 3) > 0) {
             if ($catid || $category->params->get('display.index.children', 3) > 1) {
                 $sectionIds[] = $category->id;
             } else {
                 $this->more[$category->id]++;
             }
         } else {
             $this->more[$category->parent_id]++;
             unset($sections[$key]);
             continue;
         }
     }
     // Get categories and subcategories.
     if (empty($sections)) {
         return;
     }
     $this->sections = $sections;
     $categories = KunenaForumCategoryHelper::getChildren($sectionIds);
     if (empty($categories)) {
         return;
     }
     $categoryIds = array();
     $topicIds = array();
     $userIds = array();
     $postIds = array();
     foreach ($categories as $key => $category) {
         $this->more[$category->id] = 0;
         // Display only categories which are supposed to show up.
         if ($catid || $category->params->get('display.index.parent', 3) > 1) {
             if ($catid || $category->getParent()->params->get('display.index.children', 3) > 2 && $category->params->get('display.index.children', 3) > 2) {
                 $categoryIds[] = $category->id;
             } else {
                 $this->more[$category->id]++;
             }
         } else {
             $this->more[$category->parent_id]++;
             unset($categories[$key]);
             continue;
         }
         // Get list of topics.
         $last = $category->getLastCategory();
         if ($last->last_topic_id) {
             $topicIds[$last->last_topic_id] = $last->last_topic_id;
         }
         $this->categories[$category->parent_id][] = $category;
         $rssURL = $category->getRSSUrl();
         if (!empty($rssURL)) {
             $category->rssURL = $category->getRSSUrl();
         }
     }
     $subcategories = KunenaForumCategoryHelper::getChildren($categoryIds);
     foreach ($subcategories as $category) {
         // Display only categories which are supposed to show up.
         if ($catid || $category->params->get('display.index.parent', 3) > 2) {
             $this->categories[$category->parent_id][] = $category;
         } else {
             $this->more[$category->parent_id]++;
         }
     }
     // Pre-fetch topics (also display unauthorized topics as they are in allowed categories).
     $topics = KunenaForumTopicHelper::getTopics($topicIds, 'none');
     // Pre-fetch users (and get last post ids for moderators).
     foreach ($topics as $topic) {
         $userIds[$topic->last_post_userid] = $topic->last_post_userid;
         $postIds[$topic->id] = $topic->last_post_id;
     }
     KunenaUserHelper::loadUsers($userIds);
     KunenaForumMessageHelper::getMessages($postIds);
     // Pre-fetch user related stuff.
     $this->pending = array();
     if ($this->me->exists() && !$this->me->isBanned()) {
         // Load new topic counts.
         KunenaForumCategoryHelper::getNewTopics(array_keys($categories + $subcategories));
         // Get categories which are moderated by current user.
         $access = KunenaAccess::getInstance();
         $moderate = $access->getAdminStatus($this->me) + $access->getModeratorStatus($this->me);
         if (!empty($moderate[0])) {
             // Global moderators.
//.........这里部分代码省略.........
开发者ID:giabmf11,项目名称:Kunena-Forum,代码行数:101,代码来源:display.php

示例11: getAdminCategories

	public function getAdminCategories() {
		if ( $this->_admincategories === false ) {
			$me = KunenaUserHelper::getMyself();
			$params = array (
				'ordering'=>$this->getState ( 'list.ordering' ),
				'direction'=>$this->getState ( 'list.direction' ) == 'asc' ? 1 : -1,
				'search'=>$this->getState ( 'list.search' ),
				'unpublished'=>1,
				'action'=>'admin');
			$catid = $this->getState ( 'item.id', 0 );
			$categories = array();
			if ($catid) {
				$categories = KunenaForumCategoryHelper::getParents($catid, $this->getState ( 'list.levels' ), array('unpublished'=>1, 'action'=>'none'));
				$categories[] = KunenaForumCategoryHelper::get($catid);
			}
			$categories = array_merge($categories, KunenaForumCategoryHelper::getChildren($catid, $this->getState ( 'list.levels' ), $params));
			$categories = KunenaForumCategoryHelper::getIndentation($categories);
			$this->setState ( 'list.total', count($categories) );
			$this->_admincategories = array_slice ( $categories, $this->getState ( 'list.start' ), $this->getState ( 'list.limit' ) );
			$admin = 0;
			$acl = KunenaFactory::getAccessControl();
			foreach ($this->_admincategories as $category) {
				$siblings = array_keys(KunenaForumCategoryHelper::getCategoryTree($category->parent_id));
				if (empty($siblings)) {
					// FIXME: deal with orphaned categories
					$orphans = true;
					$category->parent_id = 0;
					$category->name = JText::_ ( 'COM_KUNENA_CATEGORY_ORPHAN' ) . ' : ' . $category->name;
				}
				$category->up = $me->isAdmin($category->parent_id) && reset($siblings) != $category->id;
				$category->down = $me->isAdmin($category->parent_id) && end($siblings) != $category->id;
				$category->reorder = $me->isAdmin($category->parent_id);
				if ($category->accesstype == 'joomla.level') {
					$groupname = $acl->getGroupName($category->accesstype, $category->access);
					if (version_compare(JVERSION, '1.6','>')) {
						// Joomla 1.6+
						$category->accessname = JText::_('COM_KUNENA_INTEGRATION_JOOMLA_LEVEL').': '.($groupname ? $groupname : JText::_('COM_KUNENA_NOBODY'));
					} else {
						// Joomla 1.5
						$category->accessname = JText::_('COM_KUNENA_INTEGRATION_JOOMLA_LEVEL').': '.($groupname ? JText::_($groupname) : JText::_('COM_KUNENA_NOBODY'));
					}
				} elseif ($category->accesstype != 'none') {
					$category->accessname = JText::_('COM_KUNENA_INTEGRATION_'.strtoupper(preg_replace('/[^\w\d]+/', '_', $category->accesstype))).': '.$category->access;
				} elseif (version_compare(JVERSION, '1.6','>')) {
					// Joomla 1.6+
					$groupname = $acl->getGroupName($category->accesstype, $category->pub_access);
					$category->accessname = JText::sprintf( $category->pub_recurse ? 'COM_KUNENA_A_GROUP_X_PLUS' : 'COM_KUNENA_A_GROUP_X_ONLY', $groupname ? JText::_( $groupname ) : JText::_('COM_KUNENA_NOBODY') );
					$groupname = $acl->getGroupName($category->accesstype, $category->admin_access);
					if ($groupname && $category->pub_access != $category->admin_access) {
						$category->accessname .= ' / '.JText::sprintf( $category->admin_recurse ? 'COM_KUNENA_A_GROUP_X_PLUS' : 'COM_KUNENA_A_GROUP_X_ONLY', JText::_( $groupname ));
					}
				} else {
					// Joomla 1.5
					$groupname = $acl->getGroupName($category->accesstype, $category->pub_access);
					if ($category->pub_access == 0) {
						$category->accessname = JText::_('COM_KUNENA_PUBLIC');
					} else if ($category->pub_access == - 1) {
						$category->accessname = JText::_('COM_KUNENA_ALLREGISTERED');
					} else if ($category->pub_access == 1 || !$groupname) {
						$category->accessname = JText::_('COM_KUNENA_NOBODY');
					} else {
						$category->accessname = JText::sprintf( $category->pub_recurse ? 'COM_KUNENA_A_GROUP_X_PLUS' : 'COM_KUNENA_A_GROUP_X_ONLY', JText::_( $groupname ));
					}
					$groupname = $acl->getGroupName($category->accesstype, $category->admin_access);
					if ($category->pub_access > 0 && $groupname && $category->pub_access != $category->admin_access) {
						$category->accessname .= ' / '.JText::sprintf( $category->admin_recurse ? 'COM_KUNENA_A_GROUP_X_PLUS' : 'COM_KUNENA_A_GROUP_X_ONLY', JText::_( $groupname ));
					}
				}
				if ($category->accesstype != 'none') {
					$category->admin_group = '';
				} else {
					$category->admin_group = JText::_ ( $acl->getGroupName($category->accesstype, $category->admin_access ));
				}
				if ($me->isAdmin($category->id) && $category->isCheckedOut(0)) {
					$category->editor = KunenaFactory::getUser($category->checked_out)->getName();
				} else {
					$category->checked_out = 0;
					$category->editor = '';
				}
				$admin += $me->isAdmin($category->id);
			}
			$this->setState ( 'list.count.admin', $admin );
		}
		if (isset($orphans)) {
			$app = JFactory::getApplication ();
			$app->enqueueMessage ( JText::_ ( 'COM_KUNENA_CATEGORY_ORPHAN_DESC' ), 'notice' );
		}
		return $this->_admincategories;
	}
开发者ID:GoremanX,项目名称:Kunena-2.0,代码行数:89,代码来源:categories.php

示例12: getAdminCategories

	public function getAdminCategories() {
		if ( $this->_admincategories === false ) {
			$me = KunenaFactory::getUser();
			$jversion = new JVersion ();
			$params = array (
				'ordering'=>$this->getState ( 'list.ordering' ),
				'direction'=>$this->getState ( 'list.direction' ) == 'asc' ? 1 : -1,
				'search'=>$this->getState ( 'list.search' ),
				'unpublished'=>1,
				'action'=>'admin');
			$catid = $this->getState ( 'item.id', 0 );
			$categories = array();
			if ($catid) {
				$categories = KunenaForumCategoryHelper::getParents($catid, $this->getState ( 'list.levels' ), array('unpublished'=>1, 'action'=>'none'));
				$categories[] = KunenaForumCategoryHelper::get($catid);
			}
			$categories = array_merge($categories, KunenaForumCategoryHelper::getChildren($catid, $this->getState ( 'list.levels' ), $params));
			$categories = KunenaForumCategoryHelper::getIndentation($categories);
			$this->setState ( 'list.total', count($categories) );
			$this->_admincategories = array_slice ( $categories, $this->getState ( 'list.start' ), $this->getState ( 'list.limit' ) );
			$admin = 0;
			$acl = KunenaFactory::getAccessControl();
			foreach ($this->_admincategories as $category) {
				$siblings = array_keys(KunenaForumCategoryHelper::getCategoryTree($category->parent_id));
				if (empty($siblings)) {
					// FIXME: deal with orphaned categories
					$orphans = true;
					$category->parent_id = 0;
					$category->name = JText::_ ( 'COM_KUNENA_CATEGORY_ORPHAN' ) . ' : ' . $category->name;
				}
				$category->up = $me->isAdmin($category->parent_id) && reset($siblings) != $category->id;
				$category->down = $me->isAdmin($category->parent_id) && end($siblings) != $category->id;
				$category->reorder = $me->isAdmin($category->parent_id);
				if ($category->accesstype != 'none') {
					$category->pub_group = JText::_('COM_KUNENA_INTEGRATION_'.strtoupper($category->accesstype));
				} elseif ($jversion->RELEASE == '1.5') {
					if ($category->pub_access == 0) {
						$category->pub_group = JText::_('COM_KUNENA_EVERYBODY');
					} else if ($category->pub_access == - 1) {
						$category->pub_group = JText::_('COM_KUNENA_ALLREGISTERED');
					} else if ($category->pub_access == 1) {
						$category->pub_group = JText::_('COM_KUNENA_NOBODY');
					} else {
						$category->pub_group = JText::_( $acl->getGroupName($category->pub_access) );
					}
				} else {
					$category->pub_group = $category->pub_access ? JText::_( $acl->getGroupName($category->pub_access) ) : JText::_('COM_KUNENA_NOBODY');
				}
				if ($category->accesstype != 'none') {
					$category->admin_group = '';
				} else {
					$category->admin_group = JText::_ ( $acl->getGroupName($category->admin_access ));
				}
				if ($me->isAdmin($category->id) && $category->isCheckedOut(0)) {
					$category->editor = KunenaFactory::getUser($category->checked_out)->getName();
				} else {
					$category->checked_out = 0;
					$category->editor = '';
				}
				$admin += $me->isAdmin($category->id);
			}
			$this->setState ( 'list.count.admin', $admin );
		}
		if (isset($orphans)) {
			$app = JFactory::getApplication ();
			$app->enqueueMessage ( JText::_ ( 'COM_KUNENA_CATEGORY_ORPHAN_DESC' ), 'notice' );
		}
		return $this->_admincategories;
	}
开发者ID:rich20,项目名称:Kunena,代码行数:69,代码来源:categories.php

示例13: categories

	/**
	 * @return array
	 */
	public function categories()
	{
		$options			=	array();

		if ( $this->installed() ) {
			$rows			=	KunenaForumCategoryHelper::getChildren( 0, 10 );

			if ( $rows ) foreach ( $rows as $row ) {
				$options[]	=	moscomprofilerHTML::makeOption( (string) $row->id, str_repeat( '- ', $row->level + 1  ) . ' ' . $row->name );
			}
		}

		return $options;
	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:17,代码来源:kunena.php

示例14: getCategories

	public function getCategories() {
		if ( $this->items === false ) {
			$this->items = array();
			$catid = $this->getState ( 'item.id' );
			$layout = $this->getState ( 'layout' );
			$flat = false;

			if ($layout == 'user') {
				$categories[0] = KunenaForumCategoryHelper::getSubscriptions();
				$flat = true;
			} elseif ($catid) {
				$categories[0] = KunenaForumCategoryHelper::getCategories($catid);
				if (empty($categories[0]))
					return array();
			} else {
				$categories[0] = KunenaForumCategoryHelper::getChildren();
			}

		if ($flat) {
			$allsubcats = $categories[0];
		} else {
			$allsubcats = KunenaForumCategoryHelper::getChildren(array_keys($categories [0]), 1);
		}
		if (empty ( $allsubcats ))
			return array();

		KunenaForumCategoryHelper::getNewTopics(array_keys($allsubcats));

		$modcats = array ();
		$lastpostlist = array ();
		$userlist = array();
		$topiclist = array();

		foreach ( $allsubcats as $subcat ) {
			if ($flat || isset ( $categories [0] [$subcat->parent_id] )) {

				$last = $subcat->getLastPosted ();
				if ($last->last_topic_id) {
					$topiclist[$last->last_topic_id] = $last->last_topic_id;
					// collect user ids for avatar prefetch when integrated
					$userlist [(int)$last->last_post_userid] = (int)$last->last_post_userid;
					$lastpostlist [(int)$subcat->id] = (int)$last->last_post_id;
					$last->_last_post_location = $last->last_topic_posts;
				}

				if ($this->config->listcat_show_moderators) {
					$subcat->moderators = $subcat->getModerators ( false, false );
					$userlist += $subcat->moderators;
				}

				if ($this->me->isModerator ( $subcat->id ))
					$modcats [] = $subcat->id;
			}
			$categories [$subcat->parent_id] [] = $subcat;
		}
		KunenaForumTopicHelper::getTopics($topiclist);

		if ($this->me->ordering != 0) {
			$topic_ordering = $this->me->ordering == 1 ? true : false;
		} else {
			$topic_ordering = $this->config->default_sort == 'asc' ? false : true;
		}

		$this->pending = array ();
		if ($this->me->userid && count ( $modcats )) {
			$catlist = implode ( ',', $modcats );
			$db = JFactory::getDBO ();
			$db->setQuery ( "SELECT catid, COUNT(*) AS count
				FROM #__kunena_messages
				WHERE catid IN ({$catlist}) AND hold=1
				GROUP BY catid" );
			$pending = $db->loadAssocList ();
			KunenaError::checkDatabaseError();
			foreach ( $pending as $item ) {
				if ($item ['count'])
					$this->pending [$item ['catid']] = $item ['count'];
			}
		}
		// Fix last post position when user can see unapproved or deleted posts
		if ($lastpostlist && !$topic_ordering && $this->me->userid && $this->me->isModerator()) {
			KunenaForumMessageHelper::loadLocation($lastpostlist);
		}

		// Prefetch all users/avatars to avoid user by user queries during template iterations
		KunenaUserHelper::loadUsers($userlist);

		if ($flat) {
			$this->items = $allsubcats;
		} else {
			$this->items = $categories;
		}
		}

		return $this->items;
	}
开发者ID:rich20,项目名称:Kunena,代码行数:95,代码来源:category.php

示例15: categorylist

 public static function categorylist($name, $parent, $options = array(), $params = array(), $attribs = null, $key = 'value', $text = 'text', $selected = array(), $idtag = false, $translate = false)
 {
     $unpublished = isset($params['unpublished']) ? (bool) $params['unpublished'] : 0;
     $sections = isset($params['sections']) ? (bool) $params['sections'] : 0;
     $ordering = isset($params['ordering']) ? (string) $params['ordering'] : 'ordering';
     $direction = isset($params['direction']) && $params['direction'] == 'desc' ? -1 : 1;
     $action = isset($params['action']) ? (string) $params['action'] : 'read';
     $levels = isset($params['levels']) ? (int) $params['levels'] : 10;
     $topleveltxt = isset($params['toplevel']) ? $params['toplevel'] : false;
     $catid = isset($params['catid']) ? (int) $params['catid'] : 0;
     $hide_lonely = isset($params['hide_lonely']) ? (bool) $params['hide_lonely'] : 0;
     $params = array();
     $params['ordering'] = $ordering;
     $params['direction'] = $direction;
     $params['unpublished'] = $unpublished;
     $params['action'] = $action;
     $params['selected'] = $catid;
     if ($catid) {
         $category = KunenaForumCategoryHelper::get($catid);
         if (!$category->getParent()->authorise($action) && !KunenaUserHelper::getMyself()->isAdmin()) {
             $categories = KunenaForumCategoryHelper::getParents($catid, $levels, $params);
         }
     }
     $channels = array();
     if (!isset($categories)) {
         $category = KunenaForumCategoryHelper::get($parent);
         $children = KunenaForumCategoryHelper::getChildren($parent, $levels, $params);
         if ($params['action'] == 'topic.create') {
             $channels = $category->getChannels();
             if (empty($children) && !isset($channels[$category->id])) {
                 $category = KunenaForumCategoryHelper::get();
             }
             foreach ($channels as $id => $channel) {
                 if (!$id || $category->id == $id || isset($children[$id]) || !$channel->authorise($action)) {
                     unset($channels[$id]);
                 }
             }
         }
         $categories = $category->id > 0 ? array($category->id => $category) + $children : $children;
         if ($hide_lonely && count($categories) + count($channels) <= 1) {
             return;
         }
     }
     if (!is_array($options)) {
         $options = array();
     }
     if ($selected === false || $selected === null) {
         $selected = array();
     } elseif (!is_array($selected)) {
         $selected = array((string) $selected);
     }
     if ($topleveltxt) {
         $me = KunenaUserHelper::getMyself();
         $disabled = $action == 'admin' && !$me->isAdmin();
         $options[] = JHtml::_('select.option', '0', JText::_($topleveltxt), 'value', 'text', $disabled);
         if (empty($selected) && !$disabled) {
             $selected[] = 0;
         }
         $toplevel = 1;
     } else {
         $toplevel = -KunenaForumCategoryHelper::get($parent)->level;
     }
     foreach ($categories as $category) {
         $disabled = !$category->authorise($action) || !$sections && $category->isSection();
         if (empty($selected) && !$disabled) {
             $selected[] = $category->id;
         }
         $options[] = JHtml::_('select.option', $category->id, str_repeat('- ', $category->level + $toplevel) . ' ' . $category->name, 'value', 'text', $disabled);
     }
     $disabled = false;
     foreach ($channels as $category) {
         if (empty($selected)) {
             $selected[] = $category->id;
         }
         $options[] = JHtml::_('select.option', $category->id, '+ ' . $category->getParent()->name . ' / ' . $category->name, 'value', 'text', $disabled);
     }
     reset($options);
     if (is_array($attribs)) {
         $attribs = JArrayHelper::toString($attribs);
     }
     $id = $name;
     if ($idtag) {
         $id = $idtag;
     }
     $id = str_replace('[', '', $id);
     $id = str_replace(']', '', $id);
     $html = '';
     if (!empty($options)) {
         $html .= '<select name="' . $name . '" id="' . $id . '" ' . $attribs . '>';
         $html .= JHtml::_('select.options', $options, $key, $text, $selected, $translate);
         $html .= '</select>';
     }
     return $html;
 }
开发者ID:madcsaba,项目名称:li-de,代码行数:94,代码来源:kunenaforum.php


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