當前位置: 首頁>>代碼示例>>PHP>>正文


PHP JAccess::getAuthorisedViewLevels方法代碼示例

本文整理匯總了PHP中JAccess::getAuthorisedViewLevels方法的典型用法代碼示例。如果您正苦於以下問題:PHP JAccess::getAuthorisedViewLevels方法的具體用法?PHP JAccess::getAuthorisedViewLevels怎麽用?PHP JAccess::getAuthorisedViewLevels使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在JAccess的用法示例。


在下文中一共展示了JAccess::getAuthorisedViewLevels方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testGetAuthorisedViewLevels

 /**
  * Tests the JAccess::getAuthorisedViewLevels method.
  *
  * @return  void
  *
  * @since   11.1
  * @covers  JAccess::getAuthorisedViewLevels
  */
 public function testGetAuthorisedViewLevels()
 {
     usleep(100);
     $access = new JAccess();
     $array1 = array(0 => 1, 1 => 3);
     $this->assertThat($access->getAuthorisedViewLevels(42), $this->equalTo($array1), 'Line:' . __LINE__ . ' Super user gets Public, Special (levels 1,3)');
     $array2 = array(0 => 1);
     $this->assertThat($access->getAuthorisedViewLevels(50), $this->equalTo($array2), 'Line:' . __LINE__ . ' User 50 gets Public (level 1)');
     $array3 = array(0 => 1, 1 => 4);
     $this->assertThat($access->getAuthorisedViewLevels(99), $this->equalTo($array3), 'Line:' . __LINE__ . ' User 99 gets Level 4');
 }
開發者ID:ZerGabriel,項目名稱:joomla-platform,代碼行數:19,代碼來源:JAccessTest.php

示例2: testGetAuthorisedViewLevels

 /**
  * Tests the JAccess::getAuthorisedViewLevels method.
  *
  * @return  void
  *
  * @since   11.1
  */
 public function testGetAuthorisedViewLevels()
 {
     if (defined('DB_NOT_AVAILABLE')) {
         $this->markTestSkipped('The database is not available');
     }
     $access = new JAccess();
     $array1 = array(0 => 1, 1 => 3);
     $this->assertThat($access->getAuthorisedViewLevels(42), $this->equalTo($array1), 'Line:' . __LINE__ . ' Super user gets Public, Special (levels 1,3)');
     $array2 = array(0 => 1);
     $this->assertThat($access->getAuthorisedViewLevels(50), $this->equalTo($array2), 'Line:' . __LINE__ . ' User 50 gets Public (level 1)');
     $array3 = array(0 => 1, 1 => 4);
     $this->assertThat($access->getAuthorisedViewLevels(99), $this->equalTo($array3), 'Line:' . __LINE__ . ' User 99 gets Level 4');
 }
開發者ID:GMaup,項目名稱:joomla-platform,代碼行數:20,代碼來源:JAccessTest.php

示例3: testGetAuthorisedViewLevels

 /**
  * Tests the JAccess::getAuthorisedViewLevels method.
  *
  * @return  void
  *
  * @since   11.1
  */
 public function testGetAuthorisedViewLevels()
 {
     // Run the parent::setUp() method here to save time (since we only need to run it once)
     parent::setUp();
     if (defined('DB_NOT_AVAILABLE')) {
         $this->markTestSkipped('The database is not available');
     }
     $access = new JAccess();
     $array1 = array(0 => 1, 1 => 3);
     $this->assertThat($access->getAuthorisedViewLevels(42), $this->equalTo($array1), 'Line:' . __LINE__ . ' Super user gets Public, Special (levels 1,3)');
     $array2 = array(0 => 1);
     $this->assertThat($access->getAuthorisedViewLevels(50), $this->equalTo($array2), 'Line:' . __LINE__ . ' User 50 gets Public (level 1)');
     $array3 = array(0 => 1, 1 => 4);
     $this->assertThat($access->getAuthorisedViewLevels(99), $this->equalTo($array3), 'Line:' . __LINE__ . ' User 99 gets Level 4');
 }
開發者ID:nibra,項目名稱:joomla-platform,代碼行數:22,代碼來源:JAccessTest.php

示例4: getList

 public static function getList(&$params)
 {
     // Get the dbo
     $db = JFactory::getDbo();
     // Get an instance of the generic articles model
     $model = JModelLegacy::getInstance('Articles', 'ContentModel', array('ignore_request' => true));
     // Set application parameters in model
     $app = JFactory::getApplication();
     $appParams = $app->getParams();
     $model->setState('params', $appParams);
     // Set the filters based on the module params
     $model->setState('list.start', 0);
     $model->setState('list.limit', (int) $params->get('count', 10));
     $model->setState('filter.published', 1);
     // Access filter
     $access = !JComponentHelper::getParams('com_content')->get('show_noauth');
     $authorised = JAccess::getAuthorisedViewLevels(JFactory::getUser()->get('id'));
     $model->setState('filter.access', $access);
     // Category filter
     $model->setState('filter.category_id', $params->get('catid', array(), 'title'));
     // Ordering
     $model->setState('list.ordering', $params->get('article_ordering', 'a.ordering'));
     $model->setState('list.direction', $params->get('article_ordering_direction', 'ASC'));
     $items = $model->getItems();
     return $items;
 }
開發者ID:renekreijveld,項目名稱:ModBootstrapCarousel,代碼行數:26,代碼來源:helper.php

示例5: display

 /**
  * Creates the page's display
  *
  * @since 1.0
  */
 function display($tpl = null)
 {
     $user = JFactory::getUser();
     $aid = JAccess::getAuthorisedViewLevels($user->id);
     // Get model
     $model = $this->getModel();
     // Get category and set category parameters as VIEW's parameters (category parameters are merged with component/page/author parameters already)
     $category = $this->get('Category');
     $params = $category->parameters;
     // Get various data from the model
     $items = $this->get('Data');
     // Get field values
     $_vars = null;
     FlexicontentFields::getItemFields($items, $_vars, $_view = 'category', $aid);
     // Zero unneeded search index text
     foreach ($items as $item) {
         $item->search_index = '';
     }
     // Use &test=1 to test / preview item data of first item
     if (JRequest::getCmd('test', 0)) {
         $item = reset($items);
         echo "<pre>";
         print_r($item);
         exit;
     }
     // Output items in JSON FORMAT
     echo @json_encode($items);
 }
開發者ID:khetsothea,項目名稱:flexicontent-cck,代碼行數:33,代碼來源:view.json.php

示例6: prepareData

 /**
  * Prepare data hook.
  *
  * @return  void
  */
 protected function prepareData()
 {
     require_once JPATH_SITE . '/components/com_content/helpers/route.php';
     $app = JFactory::getApplication();
     $data = $this->getData();
     $data->params = JComponentHelper::getParams('com_content');
     $data->user = $user = JUser::getInstance($app->input->getUsername('username'));
     JModelLegacy::addIncludePath(\Windwalker\Helper\PathHelper::getSite('com_content') . '/models');
     $model = JModelLegacy::getInstance('Articles', 'ContentModel', array('ignore_request' => true));
     $model->setState('params', $data->params);
     $access = !JComponentHelper::getParams('com_content')->get('show_noauth');
     $authorised = JAccess::getAuthorisedViewLevels(JFactory::getUser()->get('id'));
     $model->setState('filter.published', 1);
     $model->setState('filter.access', $access);
     $model->setState('filter.author_id', (int) $user->id);
     $model->setState('list.ordering', 'a.created');
     $model->setState('list.direction', 'DESC');
     $model->setState('list.limit', 10);
     $data->items = $model->getItems();
     $data->pagination = $model->getPagination();
     foreach ($data->items as &$item) {
         $item->slug = $item->id . ':' . $item->alias;
         $item->catslug = $item->catid . ':' . $item->category_alias;
         $item->params = $data->params;
         if ($access || in_array($item->access, $authorised)) {
             // We know that user has the privilege to view the article
             $item->link = JRoute::_(ContentHelperRoute::getArticleRoute($item->slug, $item->catid, $item->language));
         } else {
             $item->link = JRoute::_('index.php?option=com_users&view=login');
         }
         $item->parent_slug = $item->parent_alias ? $item->parent_id . ':' . $item->parent_alias : $item->parent_id;
         // No link for ROOT category
         if ($item->parent_alias == 'root') {
             $item->parent_slug = null;
         }
         $item->event = new stdClass();
         $dispatcher = JEventDispatcher::getInstance();
         // Old plugins: Ensure that text property is available
         if (!isset($item->text)) {
             $item->text = $item->introtext;
         }
         $app->input->set('option', 'com_content');
         $app->input->set('view', 'category');
         $app->input->set('layout', 'blog');
         JPluginHelper::importPlugin('content');
         $dispatcher->trigger('onContentPrepare', array('com_content.category', &$item, &$item->params, 0));
         // Old plugins: Use processed text as introtext
         $item->introtext = $item->text;
         $results = $dispatcher->trigger('onContentAfterTitle', array('com_content.category', &$item, &$item->params, 0));
         $item->event->afterDisplayTitle = trim(implode("\n", $results));
         $results = $dispatcher->trigger('onContentBeforeDisplay', array('com_content.category', &$item, &$item->params, 0));
         $item->event->beforeDisplayContent = trim(implode("\n", $results));
         $results = $dispatcher->trigger('onContentAfterDisplay', array('com_content.category', &$item, &$item->params, 0));
         $item->event->afterDisplayContent = trim(implode("\n", $results));
         $app->input->set('option', 'com_userxtd');
         $app->input->set('view', 'content');
         $app->input->set('layout', 'default');
     }
     $this->setTitle();
 }
開發者ID:ForAEdesWeb,項目名稱:AEW27,代碼行數:65,代碼來源:html.php

示例7: testGetAuthorisedViewLevels

 /**
  * Tests the JAccess::getAuthorisedViewLevels method.
  *
  * @return  void
  *
  * @since   11.1
  */
 public function testGetAuthorisedViewLevels()
 {
     usleep(100);
     $access = new JAccess();
     $array1 = array(0 => 1, 1 => 1, 2 => 2, 3 => 3);
     $this->assertThat($access->getAuthorisedViewLevels(42), $this->equalTo($array1), 'Line:' . __LINE__ . ' Super user gets Public (levels 1)');
 }
開發者ID:joomla-projects,項目名稱:media-manager-improvement,代碼行數:14,代碼來源:JAccessTest.php

示例8: getList

 public static function getList(&$params)
 {
     // Get the dbo
     $db = JFactory::getDbo();
     // Get an instance of the generic tracks model
     $model = JModelLegacy::getInstance('Sections', 'PlayjoomModel', array('ignore_request' => true));
     // Set application parameters in model
     $app = JFactory::getApplication();
     $appParams = $app->getParams();
     $model->setState('params', $appParams);
     // Set the filters based on the module params
     $model->setState('list.start', 0);
     $model->setState('list.limit', (int) $params->get('count', 5));
     // Access filter
     $access = !JComponentHelper::getParams('com_playjoom')->get('show_noauth', 1);
     $authorised = JAccess::getAuthorisedViewLevels(JFactory::getUser()->get('id'));
     $ordering = 'a.access_datetime';
     $dir = 'DESC';
     $model->setState('list.ordering', $ordering);
     $model->setState('list.direction', $dir);
     $items = $model->getItems();
     //create item link
     foreach ($items as &$item) {
         //Check for Trackcontrol
         if (JPluginHelper::isEnabled('playjoom', 'trackcontrol') == false) {
             $item->link = null;
         } else {
             $item->link = JRoute::_('index.php?option=com_playjoom&view=broadcast&id=' . $item->id);
         }
         $item->accessinfo = modLastPlayedHelper::GetTimeInfoList($item->access_datetime, $params, 'access');
     }
     return $items;
 }
開發者ID:TFToto,項目名稱:playjoom-builds,代碼行數:33,代碼來源:helper.php

示例9: getList

 /**
  * Get a list of the latest articles from the article model
  *
  * @param   \Joomla\Registry\Registry  &$params  object holding the models parameters
  *
  * @return  mixed
  *
  * @since 1.6
  */
 public static function getList(&$params)
 {
     // Get an instance of the generic articles model
     $model = JModelLegacy::getInstance('Articles', 'ContentModel', array('ignore_request' => true));
     // Set application parameters in model
     $app = JFactory::getApplication();
     $appParams = $app->getParams();
     $model->setState('params', $appParams);
     // Set the filters based on the module params
     $model->setState('list.start', 0);
     $model->setState('list.limit', (int) $params->get('count', 5));
     $model->setState('filter.published', 1);
     // Access filter
     $access = !JComponentHelper::getParams('com_content')->get('show_noauth');
     $authorised = JAccess::getAuthorisedViewLevels(JFactory::getUser()->get('id'));
     $model->setState('filter.access', $access);
     // Category filter
     $model->setState('filter.category_id', $params->get('catid', array()));
     // Filter by language
     $model->setState('filter.language', $app->getLanguageFilter());
     // Set ordering
     $ordering = $params->get('ordering', 'a.publish_up');
     $model->setState('list.ordering', $ordering);
     if (trim($ordering) == 'rand()') {
         $model->setState('list.ordering', JFactory::getDbo()->getQuery(true)->Rand());
     } else {
         $direction = $params->get('direction', 1) ? 'DESC' : 'ASC';
         $model->setState('list.direction', $direction);
         $model->setState('list.ordering', $ordering);
     }
     // Retrieve Content
     $items = $model->getItems();
     foreach ($items as &$item) {
         $item->readmore = strlen(trim($item->fulltext));
         $item->slug = $item->id . ':' . $item->alias;
         $item->catslug = $item->catid . ':' . $item->category_alias;
         if ($access || in_array($item->access, $authorised)) {
             // We know that user has the privilege to view the article
             $item->link = JRoute::_(ContentHelperRoute::getArticleRoute($item->slug, $item->catid, $item->language));
             $item->linkText = JText::_('MOD_ARTICLES_NEWS_READMORE');
         } else {
             $item->link = new JUri(JRoute::_('index.php?option=com_users&view=login', false));
             $item->link->setVar('return', base64_encode(ContentHelperRoute::getArticleRoute($item->slug, $item->catid, $item->language)));
             $item->linkText = JText::_('MOD_ARTICLES_NEWS_READMORE_REGISTER');
         }
         $item->introtext = JHtml::_('content.prepare', $item->introtext, '', 'mod_articles_news.content');
         if (!$params->get('image')) {
             $item->introtext = preg_replace('/<img[^>]*>/', '', $item->introtext);
         }
         $results = $app->triggerEvent('onContentAfterTitle', array('com_content.article', &$item, &$params, 1));
         $item->afterDisplayTitle = trim(implode("\n", $results));
         $results = $app->triggerEvent('onContentBeforeDisplay', array('com_content.article', &$item, &$params, 1));
         $item->beforeDisplayContent = trim(implode("\n", $results));
         $results = $app->triggerEvent('onContentAfterDisplay', array('com_content.article', &$item, &$params, 1));
         $item->afterDisplayContent = trim(implode("\n", $results));
     }
     return $items;
 }
開發者ID:joomla-projects,項目名稱:media-manager-improvement,代碼行數:67,代碼來源:helper.php

示例10: getRoles

 /**
  * Returns the roles of the user
  *
  * @return int The role id
  */
 public function getRoles()
 {
     $data = $this->getData();
     $roles = KObjectConfig::unbox($data->roles);
     if (empty($roles)) {
         $this->getSession()->set('user.roles', JAccess::getAuthorisedViewLevels($this->getId()));
     }
     return parent::getRoles();
 }
開發者ID:daodaoliang,項目名稱:nooku-framework,代碼行數:14,代碼來源:user.php

示例11: getList

 public static function getList(&$params)
 {
     $app = JFactory::getApplication();
     $db = JFactory::getDbo();
     // Get an instance of the generic articles model
     $model = JModel::getInstance('Articles', 'ContentModel', array('ignore_request' => true));
     // Set application parameters in model
     $appParams = JFactory::getApplication()->getParams();
     $model->setState('params', $appParams);
     // Set the filters based on the module params
     $model->setState('list.start', 0);
     $model->setState('list.limit', (int) $params->get('count', 5));
     $model->setState('filter.published', 1);
     $model->setState('list.select', 'a.fulltext, a.id, a.title, a.alias, a.title_alias, a.introtext, a.state, a.catid, a.created, a.created_by, a.created_by_alias,' . ' a.modified, a.modified_by,a.publish_up, a.publish_down, a.attribs, a.metadata, a.metakey, a.metadesc, a.access,' . ' a.hits, a.featured,' . ' LENGTH(a.fulltext) AS readmore');
     // Access filter
     $access = !JComponentHelper::getParams('com_content')->get('show_noauth');
     $authorised = JAccess::getAuthorisedViewLevels(JFactory::getUser()->get('id'));
     $model->setState('filter.access', $access);
     // Category filter
     $model->setState('filter.category_id', $params->get('catid', array()));
     // Filter by language
     $model->setState('filter.language', $app->getLanguageFilter());
     // Set ordering
     $ordering = $params->get('ordering', 'a.publish_up');
     $model->setState('list.ordering', $ordering);
     if (trim($ordering) == 'rand()') {
         $model->setState('list.direction', '');
     } else {
         $model->setState('list.direction', 'DESC');
     }
     //	Retrieve Content
     $items = $model->getItems();
     foreach ($items as &$item) {
         $item->readmore = trim($item->fulltext) != '';
         $item->slug = $item->id . ':' . $item->alias;
         $item->catslug = $item->catid . ':' . $item->category_alias;
         if ($access || in_array($item->access, $authorised)) {
             // We know that user has the privilege to view the article
             $item->link = JRoute::_(ContentHelperRoute::getArticleRoute($item->slug, $item->catid));
             $item->linkText = JText::_('MOD_ARTICLES_NEWS_READMORE');
         } else {
             $item->link = JRoute::_('index.php?option=com_user&view=login');
             $item->linkText = JText::_('MOD_ARTICLES_NEWS_READMORE_REGISTER');
         }
         $item->introtext = JHtml::_('content.prepare', $item->introtext);
         //new
         if (!$params->get('image')) {
             $item->introtext = preg_replace('/<img[^>]*>/', '', $item->introtext);
         }
         $results = $app->triggerEvent('onContentAfterDisplay', array('com_content.article', &$item, &$params, 1));
         $item->afterDisplayTitle = trim(implode("\n", $results));
         $results = $app->triggerEvent('onContentBeforeDisplay', array('com_content.article', &$item, &$params, 1));
         $item->beforeDisplayContent = trim(implode("\n", $results));
     }
     return $items;
 }
開發者ID:reechalee,項目名稱:joomla1.6,代碼行數:56,代碼來源:helper.php

示例12: getData

 static function getData($params)
 {
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $result = array();
     $use_all_items = $params->get('use_all_items', 0);
     $app = JFactory::getApplication();
     $language = $app->getLanguageFilter();
     // Access
     $access = !JComponentHelper::getParams('com_jdownloads')->get('show_noauth');
     $authorised = JAccess::getAuthorisedViewLevels(JFactory::getUser()->get('id'));
     $groups = implode(',', $authorised);
     // get at first the categories
     $query->select('id')->from('#__jdownloads_categories');
     $query->where('published = 1');
     if (!$use_all_items) {
         $query->where('access IN (' . $groups . ')');
     }
     $query->where("id > '1'");
     // remove 'root' cat
     $db->setQuery($query);
     $cats = $db->loadColumn();
     $result['cats'] = (int) count($cats);
     $cats_id_list = implode(',', $cats);
     // get the Downloads
     $query->clear();
     $query->select('COUNT(file_id)')->from('#__jdownloads_files');
     $query->where('published = 1');
     if (!$use_all_items) {
         $query->where('access IN (' . $groups . ')');
     }
     $query->where('cat_id = 1 OR cat_id IN (' . $cats_id_list . ')');
     $db->setQuery($query);
     $result['files'] = (int) $db->loadResult();
     // get the Downloads
     $query->clear();
     $query->select('SUM(downloads)')->from('#__jdownloads_files');
     $query->where('published = 1');
     if (!$use_all_items) {
         $query->where('access IN (' . $groups . ')');
     }
     $query->where('cat_id = 1 OR cat_id IN (' . $cats_id_list . ')');
     $db->setQuery($query);
     $result['hits'] = (int) $db->loadResult();
     $query->clear();
     $query->select('SUM(views)')->from('#__jdownloads_files');
     $query->where('published = 1');
     if (!$use_all_items) {
         $query->where('access IN (' . $groups . ')');
     }
     $query->where('cat_id = 1 OR cat_id IN (' . $cats_id_list . ')');
     $db->setQuery($query);
     $result['views'] = (int) $db->loadResult();
     return $result;
 }
開發者ID:madcsaba,項目名稱:li-de,代碼行數:55,代碼來源:helper.php

示例13: getList

 static function getList($params)
 {
     $db = JFactory::getDbo();
     // Get an instance of the generic downloads model
     $model = JModelLegacy::getInstance('categories', 'jdownloadsModel', array('ignore_request' => true));
     // Set application parameters in model
     $app = JFactory::getApplication();
     $appParams = $app->getParams('com_jdownloads');
     $model->setState('params', $appParams);
     // Set the filters based on the module params
     $model->setState('list.start', 0);
     //$model->setState('list.limit', (int) $params->get('sum_view', 5));
     $model->setState('filter.published', 1);
     // Access filter
     $access = !JComponentHelper::getParams('com_jdownloads')->get('show_noauth');
     $authorised = JAccess::getAuthorisedViewLevels(JFactory::getUser()->get('id'));
     $model->setState('filter.access', $access);
     // Category filter
     // Category display decisions
     $catid = $params->get('catid');
     $catoption = intval($params->get('catoption', 1));
     if ($catid) {
         $catid = implode(',', $catid);
         if ($catoption == 1) {
             $catid = '1,' . $catid;
         }
         $cat_condition = 'c.id ' . ($catoption ? ' IN ' : ' NOT IN ') . '(' . $catid . ') ';
         $model->setState('filter.category_id', $cat_condition);
     } else {
         $model->setState('filter.category_id', '');
     }
     $level = intval($params->get('maxlevel', 0));
     $model->setState('filter.level', $level);
     // Filter by language
     $model->setState('filter.language', $app->getLanguageFilter());
     // Set sort ordering
     $ordering = 'c.lft';
     $dir = 'ASC';
     $model->setState('list.ordering', $ordering);
     $model->setState('list.direction', $dir);
     $items = $model->getItems(true);
     // with childrens
     foreach ($items as &$item) {
         $item->catslug = $item->id . ':' . $item->alias;
         if ($access || in_array($item->access, $authorised)) {
             // We know that user has the privilege to view the download
             $item->link = '-';
         } else {
             $item->link = JRoute::_('index.php?option=com_users&view=login');
         }
     }
     return $items;
 }
開發者ID:madcsaba,項目名稱:li-de,代碼行數:53,代碼來源:helper.php

示例14: getList

 public static function getList(&$params)
 {
     // Get an instance of the generic articles model
     $model = JModel::getInstance('Articles', 'ContentModel', array('ignore_request' => true));
     // Set application parameters in model
     $appParams = JFactory::getApplication()->getParams();
     $model->setState('params', $appParams);
     // Set the filters based on the module params
     $model->setState('list.start', 0);
     $model->setState('list.limit', (int) $params->get('count', 5));
     $model->setState('filter.published', 1);
     // Access filter
     $access = !JComponentHelper::getParams('com_content')->get('show_noauth');
     $authorised = JAccess::getAuthorisedViewLevels(JFactory::getUser()->get('id'));
     $model->setState('filter.access', $access);
     // Category filter
     if ($catid = $params->get('catid')) {
         $model->setState('filter.category_id', $catid);
     }
     // User filter
     $userId = JFactory::getUser()->get('id');
     switch ($params->get('user_id')) {
         case 'by_me':
             $model->setState('filter.author_id', $userId);
             break;
         case 'not_me':
             $model->setState('filter.author_id', $userId);
             $model->setState('filter.author_id.include', false);
             break;
     }
     // Set ordering
     $order_map = array('m_dsc' => 'a.modified DESC, a.created', 'c_dsc' => 'a.created');
     $ordering = JArrayHelper::getValue($order_map, $params->get('ordering'), 'a.created');
     $dir = 'DESC';
     $model->setState('list.ordering', $ordering);
     $model->setState('list.direction', $dir);
     $items = $model->getItems();
     foreach ($items as &$item) {
         $item->slug = $item->id . ':' . $item->alias;
         $item->catslug = $item->catid . ':' . $item->category_alias;
         if ($access || in_array($item->access, $authorised)) {
             // We know that user has the privilege to view the article
             $item->link = JRoute::_(ContentHelperRoute::getArticleRoute($item->slug, $item->catslug));
         } else {
             $item->link = JRoute::_('index.php?option=com_user&view=login');
         }
         $item->introtext = JHtml::_('content.prepare', $item->introtext);
     }
     return $items;
 }
開發者ID:joebushi,項目名稱:joomla,代碼行數:50,代碼來源:helper.php

示例15: getList

    static function getList($params)
    {
        // Get an instance of the generic articles model
        $model = JModel::getInstance('Category', 'WeblinksModel', array('ignore_request' => true));
        // Set application parameters in model
        $app = JFactory::getApplication();
        $appParams = $app->getParams();
        $model->setState('params', $appParams);
        // Set the filters based on the module params
        $model->setState('list.start', 0);
        $model->setState('list.limit', (int) $params->get('count', 5));
        $model->setState('filter.state', 1);
        $model->setState('filter.archived', 0);
        $model->setState('filter.approved', 1);
        // Access filter
        $access = !JComponentHelper::getParams('com_weblinks')->get('show_noauth');
        $authorised = JAccess::getAuthorisedViewLevels(JFactory::getUser()->get('id'));
        $model->setState('filter.access', $access);
        $ordering = $params->get('ordering', 'ordering');
        $model->setState('list.ordering', $ordering == 'order' ? 'ordering' : $ordering);
        $model->setState('list.direction', $params->get('direction', 'asc'));
        $catid = (int) $params->get('catid', 0);
        $model->setState('category.id', $catid);
        $model->setState('list.select', 'a.*, c.published AS c_published,
		CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(":", a.id, a.alias) ELSE a.id END as slug,
		CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(":", c.id, c.alias) ELSE c.id END as catslug,
		DATE_FORMAT(a.date, "%Y-%m-%d") AS created');
        $model->setState('filter.c.published', 1);
        // Filter by language
        $model->setState('filter.language', $app->getLanguageFilter());
        $items = $model->getItems();
        /*
         * This was in the previous code before we changed over to using the
         * weblinkscategory model but I don't see any models using checked_out filters
         * in their getListQuery() methods so I believe we should not be adding this now
         */
        /*
        $query->where('(a.checked_out = 0 OR a.checked_out = '.$user->id.')');
        */
        for ($i = 0, $count = count($items); $i < $count; $i++) {
            $item =& $items[$i];
            if ($item->params->get('count_clicks', $params->get('count_clicks')) == 1) {
                $item->link = JRoute::_('index.php?option=com_weblinks&task=weblink.go&catid=' . $item->catslug . '&id=' . $item->slug);
            } else {
                $item->link = $item->url;
            }
        }
        return $items;
    }
開發者ID:Simarpreet05,項目名稱:joomla,代碼行數:49,代碼來源:helper.php


注:本文中的JAccess::getAuthorisedViewLevels方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。