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


PHP ModulesHelper::getPositionsByTemplate方法代码示例

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


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

示例1: getListQuery

 /**
  * Build an SQL query to load the list data.
  *
  * @return	JDatabaseQuery
  */
 protected function getListQuery()
 {
     // Create a new query object.
     $db = $this->getDbo();
     $query = $db->getQuery(true);
     // Select the required fields from the table.
     $query->select($this->getState('list.select', 'a.id, a.title, a.note, a.position, a.module, a.language,' . 'a.checked_out, a.checked_out_time, a.published+2*(e.enabled-1) as published, a.access, a.ordering, a.publish_up, a.publish_down'));
     $query->from($db->quoteName('#__modules') . ' AS a');
     // Join over the language
     $query->select('l.title AS language_title');
     $query->join('LEFT', $db->quoteName('#__languages') . ' AS l ON l.lang_code = a.language');
     // Join over the users for the checked out user.
     $query->select('uc.name AS editor');
     $query->join('LEFT', '#__users AS uc ON uc.id=a.checked_out');
     // Join over the asset groups.
     $query->select('ag.title AS access_level');
     $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
     // Join over the module menus
     $query->select('MIN(mm.menuid) AS pages');
     $query->join('LEFT', '#__modules_menu AS mm ON mm.moduleid = a.id');
     // Join over the extensions
     $query->select('e.name AS name');
     $query->join('LEFT', '#__extensions AS e ON e.element = a.module');
     $query->group('a.id, a.title, a.note, a.position, a.module, a.language,a.checked_out,' . 'a.checked_out_time, a.published, a.access, a.ordering,l.title, uc.name, ag.title, e.name,' . 'l.lang_code, uc.id, ag.id, mm.moduleid, e.element, a.publish_up, a.publish_down,e.enabled');
     // Filter by access level.
     if ($access = $this->getState('filter.access')) {
         $query->where('a.access = ' . (int) $access);
     }
     // Filter by client.
     $clientId = $this->getState('filter.client_id');
     if (is_numeric($clientId)) {
         $query->where('a.client_id = ' . (int) $clientId . ' AND e.client_id =' . (int) $clientId);
     }
     // Filter by template
     $template = $this->getState('filter.template');
     if ($template) {
         $listPosition = ModulesHelper::getPositionsByTemplate();
         if (!empty($listPosition)) {
             $query->where('a.position in (' . $listPosition . ')');
         }
     }
     // Filter by published state
     $state = $this->getState('filter.state');
     if (is_numeric($state)) {
         $query->where('a.published = ' . (int) $state);
     } elseif ($state === '') {
         $query->where('(a.published IN (0, 1))');
     }
     // Filter by position
     $position = $this->getState('filter.position');
     if ($position && $position != 'none') {
         $query->where('a.position = ' . $db->Quote($position));
     } elseif ($position == 'none') {
         $query->where('a.position = ' . $db->Quote(''));
     }
     // Filter by module
     $module = $this->getState('filter.module');
     if ($module) {
         $query->where('a.module = ' . $db->Quote($module));
     }
     // Filter by search in title
     $search = $this->getState('filter.search');
     if (!empty($search)) {
         if (stripos($search, 'id:') === 0) {
             $query->where('a.id = ' . (int) substr($search, 3));
         } else {
             $search = $db->Quote('%' . $db->escape($search, true) . '%');
             $query->where('(' . 'a.title LIKE ' . $search . ' OR a.note LIKE ' . $search . ')');
         }
     }
     // Filter on the language.
     if ($language = $this->getState('filter.language')) {
         $query->where('a.language = ' . $db->quote($language));
     }
     //echo nl2br(str_replace('#__','jos_',$query));
     return $query;
 }
开发者ID:jdrzaic,项目名称:joomla-dummy,代码行数:82,代码来源:modules.php

示例2: getPositions

 /**
  * Get list of module position.
  *
  * @param   integer  $clientId  Client ID.
  *
  * @return  array
  */
 static function getPositions($clientId)
 {
     jimport('joomla.filesystem.folder');
     try {
         $app = JFactory::getApplication('administrator');
         $db = JFactory::getDbo();
         $query = $db->getQuery(true);
         $query->select('DISTINCT(position)');
         $query->from('#__modules');
         $query->where($db->quoteName('client_id') . ' = ' . (int) $clientId);
         $template = $app->getUserState('com_modules.modules.filter.template', null);
         if ($template) {
             $listPosition = ModulesHelper::getPositionsByTemplate();
             if (!empty($listPosition)) {
                 $query->where('position in (' . $listPosition . ')');
             }
         }
         $query->order('position');
         $db->setQuery($query);
         $positions = $db->loadColumn();
         $positions = is_array($positions) ? $positions : array();
     } catch (Exception $e) {
         throw $e;
     }
     // Build the list
     $options = array();
     foreach ($positions as $position) {
         if (!$position) {
             $options[] = JHtml::_('select.option', 'none', ':: ' . JText::_('JNONE') . ' ::');
         } else {
             $options[] = JHtml::_('select.option', $position, $position);
         }
     }
     return $options;
 }
开发者ID:jdrzaic,项目名称:joomla-dummy,代码行数:42,代码来源:modules.php


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