コード例 #1
0
ファイル: helper.php プロジェクト: GitIPFire/Homeworks
    public static function getCategoriesPerLanguage($config = array('filter.published' => array(0, 1), 'filter.languages' => array()), $index = null)
    {

        $hash = md5(serialize($config));

        if (!isset(self::$_categoriesDataPerLanguage[$hash]))
        {
            $config = (array)$config;
            $db = JFactory::getDbo();

            $query = "SELECT c.*, g.title AS groupname, exfg.name as extra_fields_group FROM #__k2_categories as c LEFT JOIN #__viewlevels AS g ON g.id = c.access"." LEFT JOIN #__k2_extra_fields_groups AS exfg ON exfg.id = c.extraFieldsGroup WHERE c.id>0";

            if (!empty($config['filter.published']))
            {
                $query .= ' and c.published in ('.ShlDbHelper::arrayToIntvalList($config['filter.published']).')';
            }
            if (!empty($config['filter.languages']))
            {
                $query .= ' and c.language in ('.ShlDbHelper::arrayToQuotedList($config['filter.languages']).')';
            }

            $db->setQuery($query);
            $items = $db->loadObjectList($index);

            foreach ($items as &$item)
            {
                $item->title = $item->name;
                $item->parent_id = $item->parent;
            }

            self::$_categoriesDataPerLanguage[$hash] = $items;
        }

        return self::$_categoriesDataPerLanguage[$hash];
    }
コード例 #2
0
ファイル: editalias.php プロジェクト: alesconti/FF_2015
 /**
  * Get a list of aliases from their ids,
  * passed as params
  *
  * @param array of integer $ids the list of aliases id to fetch
  * @return array of objects as read from db
  */
 public function getByIds($ids = array())
 {
     $aliases = array();
     if (empty($ids)) {
         return $aliases;
     }
     // select element where id is in list supplied
     try {
         $aliases = ShlDbHelper::selectObjectList($this->_getTableName(), array('*'), $this->_db->quoteName('id') . ' in (?)', ShlDbHelper::arrayToQuotedList($ids));
     } catch (Exception $e) {
     }
     // return result
     return $aliases;
 }
コード例 #3
0
ファイル: general.php プロジェクト: alesconti/FF_2015
 /**
  * Load components
  *
  * @access  public
  * @param array exclude an array of component to exclude from result
  * @return  array
  */
 public static function getComponentsList($exclude = array())
 {
     static $components = null;
     if (is_null($components)) {
         $db = ShlDbHelper::getDb();
         // exclude some and ourselves
         $exclude = array_merge(array('com_sh404sef', 'com_joomfish', 'com_falang', 'com_joomsef', 'com_acesef', 'com_admin', 'com_cache', 'com_categories', 'com_checkin', 'com_cpanel', 'com_installer', 'com_languages', 'com_media', 'com_menus', 'com_messages', 'com_modules', 'com_plugins', 'com_templates', 'com_config', 'com_redirect'), $exclude);
         $where = $db->quoteName('type') . ' = ? and ' . $db->quoteName('enabled') . ' = ? and ' . $db->quoteName('element') . ' <> ? ' . ' and ' . $db->quoteName('element') . ' not in (' . ShlDbHelper::arrayToQuotedList($exclude) . ')';
         $whereData = array('component', 1, '');
         try {
             $components = ShlDbHelper::selectObjectList('#__extensions', array('*'), $where, $whereData, $orderBy = array('name'), $offset = 0, $lines = 0, $key = 'element');
         } catch (Exception $e) {
             JError::raiseWarning('SOME_ERROR_CODE', "Error loading Components: " . $e->getMessage());
             return false;
         }
     }
     return $components;
 }