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


PHP flexicontent_html::getUserCurrentLang方法代码示例

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


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

示例1: _getassigned

 /**
  * Method to get the assigned items for a category
  *
  * @access private
  * @return int
  */
 function _getassigned($id)
 {
     global $globalcats;
     $user = JFactory::getUser();
     $db = JFactory::getDBO();
     // Get the view's parameters
     $params = $this->_params;
     $use_tmp = true;
     // Date-Times are stored as UTC, we should use current UTC time to compare and not user time (requestTime),
     //  thus the items are published globally at the time the author specified in his/her local clock
     //$app  = JFactory::getApplication();
     //$now  = FLEXI_J16GE ? $app->requestTime : $app->get('requestTime');   // NOT correct behavior it should be UTC (below)
     //$date = JFactory::getDate();
     //$now  = FLEXI_J16GE ? $date->toSql() : $date->toMySQL();              // NOT good if string passed to function that will be cached, because string continuesly different
     $_nowDate = 'UTC_TIMESTAMP()';
     //$db->Quote($now);
     $nullDate = $db->getNullDate();
     // Get some parameters and other info
     $catlang = $params->get('language', '');
     // Category language (currently UNUSED)
     $lang = flexicontent_html::getUserCurrentLang();
     // Get user current language
     $filtercat = $params->get('filtercat', 0);
     // Filter items using currently selected language
     $show_noauth = $params->get('show_noauth', 0);
     // Show unauthorized items
     // First thing we need to do is to select only the requested items
     $where = ' WHERE 1 ';
     if ($this->_authorid) {
         $where .= ' AND i.created_by = ' . $db->Quote($this->_authorid);
     }
     // Filter the category view with the current user language
     if ($filtercat) {
         $lta = $use_tmp ? 'i' : 'ie';
         $where .= ' AND ( ' . $lta . '.language LIKE ' . $db->Quote($lang . '%') . ' OR ' . $lta . '.language="*" ) ';
     }
     // Get privilege to view non viewable items (upublished, archived, trashed, expired, scheduled).
     // NOTE:  ACL view level is checked at a different place
     $ignoreState = $user->authorise('flexicontent.ignoreviewstate', 'com_flexicontent');
     if (!$ignoreState) {
         // Limit by publication state. Exception: when displaying personal user items or items modified by the user
         $where .= ' AND ( i.state IN (1, -5) OR ( i.created_by = ' . $user->id . ' AND i.created_by != 0 ) )';
         //.' OR ( i.modified_by = '.$user->id.' AND i.modified_by != 0 ) )';
         // Limit by publish up/down dates. Exception: when displaying personal user items or items modified by the user
         $where .= ' AND ( ( i.publish_up = ' . $db->Quote($nullDate) . ' OR i.publish_up <= ' . $_nowDate . ' ) OR ( i.created_by = ' . $user->id . ' AND i.created_by != 0 ) )';
         //.' OR ( i.modified_by = '.$user->id.' AND i.modified_by != 0 ) )';
         $where .= ' AND ( ( i.publish_down = ' . $db->Quote($nullDate) . ' OR i.publish_down >= ' . $_nowDate . ' ) OR ( i.created_by = ' . $user->id . ' AND i.created_by != 0 ) )';
         //.' OR ( i.modified_by = '.$user->id.' AND i.modified_by != 0 ) )';
     }
     // Count items according to full depth level !!!
     $catlist = !empty($globalcats[$id]->descendants) ? $globalcats[$id]->descendants : $id;
     $where .= ' AND rel.catid IN (' . $catlist . ')';
     // Select only items that user has view access, if listing of unauthorized content is not enabled
     // Checking item, category, content type access level
     if (!$show_noauth) {
         $aid_arr = JAccess::getAuthorisedViewLevels($user->id);
         $aid_list = implode(",", $aid_arr);
         $where .= ' AND ty.access IN (0,' . $aid_list . ')';
         $where .= ' AND mc.access IN (0,' . $aid_list . ')';
         $where .= ' AND  i.access IN (0,' . $aid_list . ')';
     }
     $query = 'SELECT COUNT(DISTINCT rel.itemid)' . ' FROM #__flexicontent_cats_item_relations AS rel' . (!$use_tmp ? ' JOIN #__content AS i ON rel.itemid = i.id' : ' JOIN #__flexicontent_items_tmp AS i ON rel.itemid = i.id') . (!$use_tmp ? ' JOIN #__flexicontent_items_ext AS ie ON rel.itemid = ie.item_id' : '') . ' JOIN #__flexicontent_types AS ty ON ' . (!$use_tmp ? 'ie' : 'i') . '.type_id = ty.id' . ' JOIN #__categories AS mc ON mc.id =   i.catid AND mc.published = 1' . $where;
     $db->setQuery($query);
     $assigneditems = $db->loadResult();
     if ($db->getErrorNum()) {
         JFactory::getApplication()->enqueueMessage(__FUNCTION__ . '(): SQL QUERY ERROR:<br/>' . nl2br($db->getErrorMsg()), 'error');
     }
     return $assigneditems;
 }
开发者ID:noxidsoft,项目名称:flexicontent-cck,代码行数:75,代码来源:category.php

示例2: doQueryReplacements

 static function doQueryReplacements(&$query, &$field, &$item, &$item_pros = true, $canCache = null)
 {
     // replace item properties
     preg_match_all("/{item->[^}]+}/", $query, $matches);
     $canCache = count($matches[0]) == 0;
     if (!$item_pros && count($matches[0])) {
         $item_pros = count($matches[0]);
         return '';
     }
     // If needed replace item properties, loading the item if not already loaded
     if (count($matches[0]) && !$item) {
         if (!@$field->item_id) {
             echo __FUNCTION__ . "(): field->item_id is not set";
             return;
         }
         $item = JTable::getInstance($type = 'flexicontent_items', $prefix = '', $config = array());
         $item->load($field->item_id);
     }
     foreach ($matches[0] as $replacement_tag) {
         $replacement_value = '$' . substr($replacement_tag, 1, -1);
         eval("\$replacement_value = \"{$replacement_value}\";");
         $query = str_replace($replacement_tag, $replacement_value, $query);
     }
     // replace field properties
     if ($field) {
         preg_match_all("/{field->[^}]+}/", $query, $matches);
         foreach ($matches[0] as $replacement_tag) {
             $replacement_value = '$' . substr($replacement_tag, 1, -1);
             eval("\$replacement_value = \" {$replacement_value}\";");
             $query = str_replace($replacement_tag, $replacement_value, $query);
         }
     }
     // replace current user language
     $query = str_replace("{curr_userlang_shorttag}", flexicontent_html::getUserCurrentLang(), $query);
     $query = str_replace("{curr_userlang_fulltag}", flexicontent_html::getUserCurrentLang(), $query);
     return $query;
 }
开发者ID:jakesyl,项目名称:flexicontent,代码行数:37,代码来源:flexicontent.fields.php

示例3: _buildItemWhere

 /**
  * Method to build the WHERE clause
  *
  * @access private
  * @return string
  */
 function _buildItemWhere()
 {
     $user = JFactory::getUser();
     $db = JFactory::getDBO();
     // Get the view's parameters
     $cparams = $this->_params;
     // Date-Times are stored as UTC, we should use current UTC time to compare and not user time (requestTime),
     //  thus the items are published globally at the time the author specified in his/her local clock
     //$app  = JFactory::getApplication();
     //$now  = FLEXI_J16GE ? $app->requestTime : $app->get('requestTime');   // NOT correct behavior it should be UTC (below)
     //$date = JFactory::getDate();
     //$now  = FLEXI_J16GE ? $date->toSql() : $date->toMySQL();              // NOT good if string passed to function that will be cached, because string continuesly different
     $_nowDate = 'UTC_TIMESTAMP()';
     //$db->Quote($now);
     $nullDate = $db->getNullDate();
     // First thing we need to do is to select only the requested TAGGED items
     $where = ' WHERE tag.tid = ' . $this->_id;
     // User current language
     $lang = flexicontent_html::getUserCurrentLang();
     $filtertag = $cparams->get('filtertag', 0);
     // Filter the tag view with the active language
     if ((FLEXI_FISH || FLEXI_J16GE) && $filtertag) {
         $lta = FLEXI_J16GE ? 'i' : 'ie';
         $where .= ' AND ( ' . $lta . '.language LIKE ' . $db->Quote($lang . '%') . (FLEXI_J16GE ? ' OR ' . $lta . '.language="*" ' : '') . ' ) ';
     }
     // Get privilege to view non viewable items (upublished, archived, trashed, expired, scheduled).
     // NOTE:  ACL view level is checked at a different place
     $ignoreState = $user->authorise('flexicontent.ignoreviewstate', 'com_flexicontent');
     if (!$ignoreState) {
         // Limit by publication state. Exception: when displaying personal user items or items modified by the user
         $where .= ' AND ( i.state IN (1, -5) OR ( i.created_by = ' . $user->id . ' AND i.created_by != 0 ) )';
         //.' OR ( i.modified_by = '.$user->id.' AND i.modified_by != 0 ) )';
         // Limit by publish up/down dates. Exception: when displaying personal user items or items modified by the user
         $where .= ' AND ( ( i.publish_up = ' . $this->_db->Quote($nullDate) . ' OR i.publish_up <= ' . $_nowDate . ' ) OR ( i.created_by = ' . $user->id . ' AND i.created_by != 0 ) )';
         //.' OR ( i.modified_by = '.$user->id.' AND i.modified_by != 0 ) )';
         $where .= ' AND ( ( i.publish_down = ' . $this->_db->Quote($nullDate) . ' OR i.publish_down >= ' . $_nowDate . ' ) OR ( i.created_by = ' . $user->id . ' AND i.created_by != 0 ) )';
         //.' OR ( i.modified_by = '.$user->id.' AND i.modified_by != 0 ) )';
     }
     $where .= !FLEXI_J16GE ? ' AND i.sectionid = ' . FLEXI_SECTION : '';
     /*
      * If we have a filter, and this is enabled... lets tack the AND clause
      * for the filter onto the WHERE clause of the item query.
      */
     // ****************************************
     // Create WHERE clause part for Text Search
     // ****************************************
     $text = JRequest::getString('filter', JRequest::getString('q', ''), 'default');
     // Check for LIKE %word% search, for languages without spaces
     $filter_word_like_any = $cparams->get('filter_word_like_any', 0);
     $phrase = $filter_word_like_any ? JRequest::getWord('searchphrase', JRequest::getWord('p', 'any'), 'default') : JRequest::getWord('searchphrase', JRequest::getWord('p', 'exact'), 'default');
     $si_tbl = 'flexicontent_items_ext';
     $search_prefix = $cparams->get('add_search_prefix') ? 'vvv' : '';
     // SEARCH WORD Prefix
     $text = !$search_prefix ? trim($text) : preg_replace('/(\\b[^\\s,\\.]+\\b)/u', $search_prefix . '$0', trim($text));
     $words = preg_split('/\\s\\s*/u', $text);
     if (strlen($text)) {
         $ts = 'ie';
         $escaped_text = $db->escape($text, true);
         $quoted_text = $db->Quote($escaped_text, false);
         switch ($phrase) {
             case 'natural':
                 $_text_match = ' MATCH (' . $ts . '.search_index) AGAINST (' . $quoted_text . ') ';
                 break;
             case 'natural_expanded':
                 $_text_match = ' MATCH (' . $ts . '.search_index) AGAINST (' . $quoted_text . ' WITH QUERY EXPANSION) ';
                 break;
             case 'exact':
                 $stopwords = array();
                 $shortwords = array();
                 if (!$search_prefix) {
                     $words = flexicontent_db::removeInvalidWords($words, $stopwords, $shortwords, $si_tbl, 'search_index', $isprefix = 0);
                 }
                 if (empty($words)) {
                     // All words are stop-words or too short, we could try to execute a query that only contains a LIKE %...% , but it would be too slow
                     JRequest::setVar('ignoredwords', implode(' ', $stopwords));
                     JRequest::setVar('shortwords', implode(' ', $shortwords));
                     $_text_match = ' 0=1 ';
                 } else {
                     // speed optimization ... 2-level searching: first require ALL words, then require exact text
                     $newtext = '+' . implode(' +', $words);
                     $quoted_text = $db->escape($newtext, true);
                     $quoted_text = $db->Quote($quoted_text, false);
                     $exact_text = $db->Quote('%' . $escaped_text . '%', false);
                     $_text_match = ' MATCH (' . $ts . '.search_index) AGAINST (' . $quoted_text . ' IN BOOLEAN MODE) AND ' . $ts . '.search_index LIKE ' . $exact_text;
                 }
                 break;
             case 'all':
                 $stopwords = array();
                 $shortwords = array();
                 if (!$search_prefix) {
                     $words = flexicontent_db::removeInvalidWords($words, $stopwords, $shortwords, $si_tbl, 'search_index', $isprefix = 1);
                 }
                 JRequest::setVar('ignoredwords', implode(' ', $stopwords));
                 JRequest::setVar('shortwords', implode(' ', $shortwords));
//.........这里部分代码省略.........
开发者ID:nettdotkomm,项目名称:flexicontent-cck,代码行数:101,代码来源:tags.php

示例4: onContentSearch


//.........这里部分代码省略.........
                 $filters[$filter->id] = $filter;
                 // index by filter_id in this case too (for consistency, although we do not use the array index ?)
             }
         }
         unset($filters_tmp);
     }
     // If configured filters were not found/invalid for the current content type(s)
     // then retrieve all fields marked as filterable for the give content type(s) this is useful to list per content type filters automatically, even when not set or misconfigured
     if (empty($filters)) {
         if (!empty($contenttypes)) {
             $filters = FlexicontentFields::getSearchFields($key = 'id', $indexer = 'advanced', null, $contenttypes, $load_params = true, 0, 'filter');
         } else {
             $filters = array();
         }
     }
     // **********************
     // Load Plugin parameters
     // **********************
     $plugin = JPluginHelper::getPlugin('search', 'flexiadvsearch');
     $pluginParams = new JRegistry($plugin->params);
     // Shortcuts for plugin parameters
     $search_limit = $params->get('search_limit', $pluginParams->get('search_limit', 20));
     // Limits the returned results of this seach plugin
     $filter_lang = $params->get('filter_lang', $pluginParams->get('filter_lang', 1));
     // Language filtering enabled
     $search_archived = $params->get('search_archived', $pluginParams->get('search_archived', 1));
     // Include archive items into the search
     $browsernav = $params->get('browsernav', $pluginParams->get('browsernav', 2));
     // Open search in window (for value 1)
     // ***************************************************************************************************************
     // Varous other variable USED in the SQL query like (a) current frontend language and (b) -this- plugin specific ordering, (c) null / now dates, (d) etc
     // ***************************************************************************************************************
     // Get current frontend language (fronted user selected)
     $lang = flexicontent_html::getUserCurrentLang();
     // NULL and CURRENT dates,
     // NOTE: the current date needs to use built-in MYSQL function, otherwise filter caching can not work because the CURRENT DATETIME is continuously different !!!
     //$now = JFactory::getDate()->toSql();
     $_nowDate = 'UTC_TIMESTAMP()';
     //$db->Quote($now);
     $nullDate = $db->getNullDate();
     // Section name
     $searchFlexicontent = JText::_('FLEXICONTENT');
     // REMOVED / COMMENTED OUT this feature:
     // Require any OR all Filters ... this can be user selectable
     //$show_filtersop = $params->get('show_filtersop', 1);
     //$default_filtersop = $params->get('default_filtersop', 'all');
     //$FILTERSOP = !$show_filtersop ? $default_filtersop : JRequest::getVar('filtersop', $default_filtersop);
     // ****************************************
     // Create WHERE clause part for Text Search
     // ****************************************
     $si_tbl = !$txtmode ? 'flexicontent_items_ext' : 'flexicontent_advsearch_index';
     $search_prefix = JComponentHelper::getParams('com_flexicontent')->get('add_search_prefix') ? 'vvv' : '';
     // SEARCH WORD Prefix
     $text = preg_replace('/(\\b[^\\s,\\.]+\\b)/u', $search_prefix . '$0', trim($text));
     if (strlen($text)) {
         $ts = !$txtmode ? 'ie' : 'ts';
         $escaped_text = $db->escape($text, true);
         $quoted_text = $db->Quote($escaped_text, false);
         switch ($phrase) {
             case 'natural':
                 if ($filter_word_like_any) {
                     $_text_match = ' LOWER (' . $ts . '.search_index) LIKE ' . $db->Quote('%' . $escaped_text . '%', false);
                 } else {
                     $_text_match = ' MATCH (' . $ts . '.search_index) AGAINST (' . $quoted_text . ') ';
                 }
                 break;
开发者ID:nettdotkomm,项目名称:flexicontent-cck,代码行数:67,代码来源:flexiadvsearch.php

示例5: getItems


//.........这里部分代码省略.........
                     } else {
                         if (isset($curitem->custom_date)) {
                             // $date_type == 3
                             $idate = $curitem->custom_date;
                         }
                     }
                 }
             }
             if ($idate) {
                 $idate = explode(' ', $idate);
                 $cdate = $idate[0] . ' 00:00:00';
             }
             $curritemcats = explode(',', $curitem->itemcats);
         }
     }
     // ******************
     // current item scope
     // ******************
     $currid = JRequest::getInt('id');
     if ($method_curitem == 1) {
         // exclude method  ---  exclude current item
         $where .= ' AND i.id <> ' . $currid;
     } else {
         if ($method_curitem == 2) {
             // include method  ---  include current item ONLY
             $where .= ' AND i.id = ' . $currid;
         } else {
             // All Items including current
         }
     }
     // **********************
     // current language scope
     // **********************
     $lang = flexicontent_html::getUserCurrentLang();
     if ($method_curlang == 1) {
         // exclude method  ---  exclude items of current language
         $where .= ' AND ie.language NOT LIKE ' . $db->Quote($lang . '%');
     } else {
         if ($method_curlang == 2) {
             // include method  ---  include items of current language ONLY
             $where .= ' AND ( ie.language LIKE ' . $db->Quote($lang . '%') . (FLEXI_J16GE ? ' OR ie.language="*" ' : '') . ' ) ';
         } else {
             // Items of any language
         }
     }
     // *****************************
     // current user favourites scope
     // *****************************
     $curruserid = (int) $user->get('id');
     if ($method_curuserfavs == 1) {
         // exclude method  ---  exclude currently logged user favourites
         $join_favs = ' LEFT OUTER JOIN #__flexicontent_favourites AS fav ON fav.itemid = i.id AND fav.userid = ' . $curruserid;
         $where .= ' AND fav.itemid IS NULL';
     } else {
         if ($method_curuserfavs == 2) {
             // include method  ---  include currently logged user favourites
             $join_favs = ' LEFT JOIN #__flexicontent_favourites AS fav ON fav.itemid = i.id';
             $where .= ' AND fav.userid = ' . $curruserid;
         } else {
             // All Items regardless of being favoured by current user
             $join_favs = '';
         }
     }
     // ******************************
     // joomla featured property scope
     // ******************************
开发者ID:khetsothea,项目名称:flexicontent-cck,代码行数:67,代码来源:helper.php

示例6: loadFramework

 /**
  * Utility function to load each JS Frameworks once
  *
  * @param 	string 		$text
  * @param 	int 		$nb
  * @return 	string
  * @since 1.5
  */
 static function loadFramework($framework, $mode = '')
 {
     // Detect already loaded framework
     static $_loaded = array();
     if (isset($_loaded[$framework])) {
         return $_loaded[$framework];
     }
     $_loaded[$framework] = false;
     // Get frameworks that are configured to be loaded manually in frontend (e.g. via the Joomla template)
     $app = JFactory::getApplication();
     static $load_frameworks = null;
     static $load_jquery = null;
     if (!isset($load_frameworks[$framework])) {
         $flexiparams = JComponentHelper::getParams('com_flexicontent');
         //$load_frameworks = $flexiparams->get('load_frameworks', array('jQuery','image-picker','masonry','select2','inputmask','prettyCheckable','fancybox'));
         //$load_frameworks = FLEXIUtilities::paramToArray($load_frameworks);
         //$load_frameworks = array_flip($load_frameworks);
         //$load_jquery = isset($load_frameworks['jQuery']) || !$app->isSite();
         if ($load_jquery === null) {
             $load_jquery = $flexiparams->get('loadfw_jquery', 1) == 1 || !$app->isSite();
         }
         $load_framework = $flexiparams->get('loadfw_' . strtolower(str_replace('-', '_', $framework)), 1);
         $load_frameworks[$framework] = $load_framework == 1 || $load_framework == 2 && !$app->isSite();
     }
     // Set loaded flag
     $_loaded[$framework] = $load_frameworks[$framework];
     // Do not progress further if it is disabled
     if (!$load_frameworks[$framework]) {
         return false;
     }
     // Load Framework
     $document = JFactory::getDocument();
     $lib_path = '/components/com_flexicontent/librairies';
     $js = "";
     $css = "";
     switch ($framework) {
         case 'jQuery':
             if ($load_jquery) {
                 flexicontent_html::loadJQuery();
             }
             break;
         case 'mCSB':
             if ($load_jquery) {
                 flexicontent_html::loadJQuery();
             }
             $framework_path = JURI::root(true) . $lib_path . '/mCSB';
             $document->addScript($framework_path . '/jquery.mCustomScrollbar.min.js');
             $document->addStyleSheet($framework_path . '/jquery.mCustomScrollbar.css');
             $js .= "\n\t\t\t\t\tjQuery(document).ready(function(){\n\t\t\t\t\t\tjQuery('.fc_add_scroller').mCustomScrollbar({\n\t\t\t\t\t\t\ttheme:'dark-thick',\n\t\t\t\t\t\t\tadvanced:{updateOnContentResize: true}\n\t\t\t\t\t\t});\n\t\t\t\t\t\tjQuery('.fc_add_scroller_horizontal').mCustomScrollbar({\n\t\t\t\t\t\t\ttheme:'dark-thick',\n\t\t\t\t\t\t\thorizontalScroll:true,\n\t\t\t\t\t\t\tadvanced:{updateOnContentResize: true}\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t";
             break;
         case 'image-picker':
             if ($load_jquery) {
                 flexicontent_html::loadJQuery();
             }
             $framework_path = JURI::root(true) . $lib_path . '/image-picker';
             $document->addScript($framework_path . '/image-picker.min.js');
             $document->addStyleSheet($framework_path . '/image-picker.css');
             break;
         case 'masonry':
             $framework_path = JURI::root(true) . $lib_path . '/masonry';
             $document->addScript($framework_path . '/masonry.pkgd.min.js');
             break;
         case 'select2':
             if ($load_jquery) {
                 flexicontent_html::loadJQuery();
             }
             // Replace chosen function (if loaded)
             //JHtml::_('formbehavior.chosen', '#_some_iiidddd_');
             $js .= "\n\t\t\t\tif (typeof jQuery.fn.chosen == 'function') { \n\t\t\t\t\tjQuery.fn.chosen_fc = jQuery.fn.chosen;\n\t\t\t\t\tjQuery.fn.chosen = function(){\n\t\t\t\t\t\tvar args = arguments;\n\t\t\t\t\t\tjQuery(this).each(function() {\n\t\t\t\t\t\t\tif (jQuery(this).hasClass('use_select2_lib')) return;\n\t\t\t\t\t\t\tjQuery(this).chosen_fc(args);\n\t\t\t\t\t\t});\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\t";
             $ver = '3.5.4';
             $framework_path = JURI::root(true) . $lib_path . '/select2';
             $framework_folder = JPATH_SITE . DS . 'components' . DS . 'com_flexicontent' . DS . 'librairies' . DS . 'select2';
             $document->addScriptVersion($framework_path . '/select2.min.js', $ver);
             $document->addStyleSheetVersion($framework_path . '/select2.css', $ver);
             $lang_code = flexicontent_html::getUserCurrentLang();
             if ($lang_code && $lang_code != 'en') {
                 // Try language shortcode
                 if (file_exists($framework_folder . DS . 'select2_locale_' . $lang_code . '.js')) {
                     $document->addScriptVersion($framework_path . '/select2_locale_' . $lang_code . '.js', $ver);
                 } else {
                     $country_code = flexicontent_html::getUserCurrentLang($short_tag = false);
                     if ($country_code && file_exists($framework_folder . DS . 'select2_locale_' . $country_code . '.js')) {
                         $document->addScriptVersion($framework_path . '/select2_locale_' . $country_code . '.js', $ver);
                     }
                 }
             }
             $js .= "\n\t\t\t\t\tjQuery(document).ready(function() {\n\t\t\t\t\t\t\n\t\t\t\t\t\t" . "\n\t\t\t\t\t\tjQuery('select.use_select2_lib').select2({\n\t\t\t\t\t\t\t/*hideSelectionFromResult: function(selectedObject) { selectedObject.removeClass('select2-result-selectable').addClass('select2-result-unselectable').addClass('select2-disabled'); return false; },*/\n\t\t\t\t\t\t\tminimumResultsForSearch: 10\n\t\t\t\t\t\t});\n\t\t\t\t\t\t\n\t\t\t\t\t\tjQuery('div.use_select2_lib').each(function() {\n\t\t\t\t\t\t\tvar el_container = jQuery(this);\n\t\t\t\t\t\t\tvar el_select = el_container.next('select');\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t" . "\n\t\t\t\t\t\t\tvar fc_label_text = el_select.attr('data-fc_label_text');\n\t\t\t\t\t\t\tif (!fc_label_text) fc_label_text = el_select.attr('fc_label_text');\n\t\t\t\t\t\t\tif (fc_label_text) {\n\t\t\t\t\t\t\t\tvar _label = (fc_label_text.length >= 30) ? fc_label_text.substring(0, 28) + '...' : fc_label_text;\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tjQuery('<span/>', {\n\t\t\t\t\t\t\t\t\t'class': 'fc_has_inner_label fc_has_inner_label_select2',\n\t\t\t\t\t\t\t\t\t'text': _label\n\t\t\t\t\t\t\t\t}).prependTo(el_container.find('.select2-search-field'));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t" . "\n\t\t\t\t\t\t\tvar fc_prompt_text = el_select.attr('data-fc_prompt_text');\n\t\t\t\t\t\t\tif (!fc_prompt_text) fc_prompt_text = el_select.attr('fc_prompt_text');\n\t\t\t\t\t\t\tif (fc_prompt_text) {\n\t\t\t\t\t\t\t\tvar _prompt = (fc_prompt_text.length >= 30) ? fc_prompt_text.substring(0, 28) + '...' : fc_prompt_text;\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tjQuery('<span/>', {\n\t\t\t\t\t\t\t\t\t'class': 'fc_has_inner_prompt fc_has_inner_prompt_select2',\n\t\t\t\t\t\t\t\t\t'text': _prompt\n\t\t\t\t\t\t\t\t}).prependTo(el_container.find('.select2-search-field')).hide();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t" . "\n\t\t\t\t\t\t\tif ( ! el_select.attr('multiple') && !el_select.hasClass('fc_skip_highlight') ) {\n\t\t\t\t\t\t\t\tvar el = el_container.find('.select2-choice');\n\t\t\t\t\t\t\t\tvar val = el_select.val();\n\t\t\t\t\t\t\t\tif (val === null) {\n\t\t\t\t\t\t\t\t\t//el.addClass('fc_highlight_disabled');\n\t\t\t\t\t\t\t\t} else if (!!val && val.length) {\n\t\t\t\t\t\t\t\t\tel.addClass('fc_highlight');\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tel.removeClass('fc_highlight');\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t\t\n\t\t\t\t\t\t" . "\n\t\t\t\t\t\tjQuery('select.use_select2_lib').on('select2-open', function() {\n\t\t\t\t\t\t\t" . "\n\t\t\t\t\t\t\tvar el_container = jQuery(this).parent();\n\t\t\t\t\t\t\tvar el = jQuery(this).parent().find('.select2-input');\n\t\t\t\t\t\t\tvar el_label = el.prevAll('.fc_has_inner_label');\n\t\t\t\t\t\t\tif (el_label) el_label.hide();\n\t\t\t\t\t\t\tvar el_prompt = el.prevAll('.fc_has_inner_prompt');\n\t\t\t\t\t\t\tif (el_prompt) el_prompt.show();\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t" . "\n\t\t\t\t\t\t\tif (jQuery(this).hasClass('select2_list_selected')) {\n\t\t\t\t\t\t\t\tvar els = jQuery('#select2-drop').find('.select2-selected');\n\t\t\t\t\t\t\t\tels.addClass('select2-selected-highlight').addClass('select2-disabled').removeClass('select2-selected').removeClass('select2-result-selectable');\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}).on('select2-close', function() {\n\t\t\t\t\t\t\t" . "\n\t\t\t\t\t\t\tvar el_container = jQuery(this).parent();\n\t\t\t\t\t\t\tvar el = jQuery(this).parent().find('.select2-input');\n\t\t\t\t\t\t\tvar el_label = el.prevAll('.fc_has_inner_label');\n\t\t\t\t\t\t\tif (el_label) el_label.show();\n\t\t\t\t\t\t\tvar el_prompt = el.prevAll('.fc_has_inner_prompt');\n\t\t\t\t\t\t\tif (el_prompt) el_prompt.hide();\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t" . "\n\t\t\t\t\t\t\tif (jQuery(this).hasClass('select2_list_selected')) {\n\t\t\t\t\t\t\t\tvar els = jQuery('#select2-drop').find('.select2-selected-highlight');\n\t\t\t\t\t\t\t\tels.removeClass('select2-selected-highlight').removeClass('select2-disabled').addClass('select2-result-selectable');\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}).on\n\t\t\t\t\t\t\n\t\t\t\t\t\t" . "\n\t\t\t\t\t\t('change', function() {\n\t\t\t\t\t\t\tvar el_select = jQuery(this);\n\t\t\t\t\t\t\tif ( ! el_select.attr('multiple') && !el_select.hasClass('fc_skip_highlight') ) {\n\t\t\t\t\t\t\t\tvar el = jQuery(this).prev('div').find('.select2-choice');\n\t\t\t\t\t\t\t\tvar val = el_select.val();\n\t\t\t\t\t\t\t\tif (!!val && val.length) {\n\t\t\t\t\t\t\t\t\tel.addClass('fc_highlight');\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tel.removeClass('fc_highlight');\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t\t\n\t\t\t\t\t\t" . "\n\t\t\t\t\t\tjQuery('div.use_select2_lib.select2-container-multi input').on('keydown', function() {\n\t\t\t\t\t\t\tvar el = jQuery(this);\n\t\t\t\t\t\t\tsetTimeout(function() {\n\t\t\t\t\t\t\t\tvar val = el.val();\n\t\t\t\t\t\t\t\tif (!!val && val.length) {\n\t\t\t\t\t\t\t\t\tvar el_prompt = el.prevAll('.fc_has_inner_prompt');\n\t\t\t\t\t\t\t\t\tif (el_prompt) el_prompt.hide();\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tvar el_prompt = el.prevAll('.fc_has_inner_prompt');\n\t\t\t\t\t\t\t\t\tif (el_prompt) el_prompt.show();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}, 0);\n\t\t\t\t\t\t});\n\t\t\t\t\t\t\n\t\t\t\t\t\t" . "\n\t\t\t\t\t\tjQuery('select.use_select2_lib').on('loaded open', function() {\n\t\t\t\t\t\t\tvar ul = jQuery('#select2-drop ul.select2-results');\n\t\t\t\t\t\t\tvar needsScroll= ul.prop('scrollHeight') > ul.prop('clientHeight');\n\t\t\t\t\t\t\tif (needsScroll) ul.css('overflow-y', 'scroll');\n\t\t\t\t\t\t\telse  ul.css('overflow-y', 'auto');\n\t\t\t\t\t\t});\n\t\t\t\t\t\t\n\t\t\t\t\t});\n\t\t\t\t";
             break;
         case 'inputmask':
             if ($load_jquery) {
                 flexicontent_html::loadJQuery();
             }
//.........这里部分代码省略.........
开发者ID:nettdotkomm,项目名称:flexicontent-cck,代码行数:101,代码来源:flexicontent.helper.php

示例7: loadTemplateLanguageFile

 /**
  * Load Template-Specific language file to override or add new language strings
  *
  * @return object
  * @since 1.5
  */
 static function loadTemplateLanguageFile($tmplname = 'default', $view = '')
 {
     // Check that template name was given
     $tmplname = empty($tmplname) ? 'default' : $tmplname;
     // This is normally component/module/plugin name, we could use 'category', 'items', etc to have a view specific language file
     // e.g. en/en.category.ini, but this is an overkill and make result into duplication of strings ... better all in one file
     $extension = '';
     // JRequest::get('view');
     // Current language, we decided to use LL-CC (language-country) format mapping SEF shortcode, e.g. 'en' to 'en-GB'
     $user_lang = flexicontent_html::getUserCurrentLang();
     $languages = FLEXIUtilities::getLanguages($hash = 'shortcode');
     if (!$user_lang || !isset($languages->{$user_lang}->code)) {
         return;
     }
     // Language has been disabled
     $language_tag = $languages->{$user_lang}->code;
     // We will use template folder as BASE of language files instead of joomla's language folder
     // Since FLEXIcontent templates are meant to be user-editable it makes sense to place language files inside them
     $base_dir = JPATH_SITE . DS . 'components' . DS . 'com_flexicontent' . DS . 'templates' . DS . $tmplname;
     // Final use joomla's API to load our template's language files -- (load english template language file then override with current language file)
     JFactory::getLanguage()->load($extension, $base_dir, 'en-GB', $reload = true);
     // Fallback to english language template file
     JFactory::getLanguage()->load($extension, $base_dir, $language_tag, $reload = true);
     // User's current language template file
 }
开发者ID:benediktharter,项目名称:flexicontent-cck,代码行数:31,代码来源:flexicontent.helper.php

示例8: txtautocomplete

 /**
  * Logic to get text search autocomplete strings
  *
  * @access public
  * @return void
  * @since 1.0
  */
 function txtautocomplete()
 {
     $app = JFactory::getApplication();
     $cparams = JComponentHelper::getParams('com_flexicontent');
     $option = JRequest::getVar('option');
     $use_tmp = true;
     $min_word_len = $app->getUserState($option . '.min_word_len', 0);
     $filtercat = $cparams->get('filtercat', 0);
     // Filter items using currently selected language
     $show_noauth = $cparams->get('show_noauth', 0);
     // Show unauthorized items
     // Get request variables
     $type = JRequest::getVar('type');
     $text = JRequest::getVar('text');
     $pageSize = JRequest::getInt('pageSize', 20);
     $pageNum = JRequest::getInt('pageNum', 1);
     $cid = JRequest::getInt('cid', 0);
     $cids = array();
     $_cids = JRequest::getVar('cids', '');
     if ($cid) {
         // single category view
         global $globalcats;
         $_cids = $globalcats[$cid]->descendantsarray;
     } else {
         if (empty($_cids)) {
             // try to get category ids from the categories filter
             $_cids = JRequest::getVar('filter_13', '');
             $_cids = empty($_cids) ? array() : $_cids;
             $_cids = !is_array($_cids) ? json_decode($_cids) : $_cids;
         } else {
             if (!is_array($_cids)) {
                 // multi category view
                 $_cids = preg_replace('/[^0-9,]/i', '', (string) $_cids);
                 $_cids = explode(',', $_cids);
             }
         }
     }
     // make sure given data are integers ... !!
     foreach ($_cids as $i => $_id) {
         if ((int) $_id) {
             $cids[] = (int) $_id;
         }
     }
     $cid_list = implode(',', $cids);
     $lang = flexicontent_html::getUserCurrentLang();
     // Nothing to do
     if ($type != 'basic_index' && $type != 'adv_index') {
         jexit();
     }
     if (!strlen($text)) {
         jexit();
     }
     // All starting words are exact words but last word is a ... word prefix
     $search_prefix = JComponentHelper::getParams('com_flexicontent')->get('add_search_prefix') ? 'vvv' : '';
     // SEARCH WORD Prefix
     $words = preg_split('/\\s\\s*/u', $text);
     $_words = array();
     foreach ($words as &$_w) {
         $_words[] = !$search_prefix ? trim($_w) : preg_replace('/(\\b[^\\s,\\.]+\\b)/u', $search_prefix . '$0', trim($_w));
     }
     $newtext = '+' . implode(' +', $_words) . '*';
     //print_r($_words); exit;
     // Query CLAUSE for match the given text
     $db = JFactory::getDBO();
     $quoted_text = $db->escape($newtext, true);
     $quoted_text = $db->Quote($quoted_text, false);
     $_text_match = ' MATCH (si.search_index) AGAINST (' . $quoted_text . ' IN BOOLEAN MODE) ';
     // Query retieval limits
     $limitstart = $pageSize * ($pageNum - 1);
     $limit = $pageSize;
     $lang_where = '';
     if ($filtercat) {
         $lang_where .= '   AND ( i.language LIKE ' . $db->Quote($lang . '%') . (FLEXI_J16GE ? ' OR i.language="*" ' : '') . ' ) ';
     }
     $access_where = '';
     $joinaccess = '';
     /*if (!$show_noauth) {
     			$user = JFactory::getUser();
     			$aid_arr = JAccess::getAuthorisedViewLevels($user->id);
     			$aid_list = implode(",", $aid_arr);
     			$access_where .= ' AND ty.access IN (0,'.$aid_list.')';
     			$access_where .= ' AND mc.access IN (0,'.$aid_list.')';
     			$access_where .= ' AND  i.access IN (0,'.$aid_list.')';
     		}*/
     // Do query ...
     $tbl = $type == 'basic_index' ? 'flexicontent_items_ext' : 'flexicontent_advsearch_index';
     $query = 'SELECT si.item_id, si.search_index' . ' FROM #__' . $tbl . ' AS si' . ' JOIN ' . ($use_tmp ? '#__flexicontent_items_tmp' : '#__content') . ' AS i ON i.id = si.item_id' . ($access_where && !$use_tmp || $lang_where && !FLEXI_J16GE && !$use_tmp || $type != 'basic_index' ? ' JOIN #__flexicontent_items_ext AS ie ON i.id = ie.item_id ' : '') . ($access_where ? ' JOIN #__flexicontent_types AS ty ON ie.type_id = ty.id' : '') . ($access_where ? ' JOIN #__categories AS mc ON mc.id = i.catid' : '') . ($cid_list ? ' JOIN #__flexicontent_cats_item_relations AS rel ON i.id = rel.itemid AND rel.catid IN (' . $cid_list . ')' : '') . $joinaccess . ' WHERE ' . $_text_match . '   AND i.state IN (1,-5) ' . $lang_where . $access_where . ' LIMIT ' . $limitstart . ', ' . $limit;
     $db->setQuery($query);
     $data = $db->loadAssocList();
     //print_r($data); exit;
     //if ($db->getErrorNum())  echo __FUNCTION__.'(): SQL QUERY ERROR:<br/>'.nl2br($db->getErrorMsg());
     // Get last word (this is a word prefix) and remove it from words array
     $word_prefix = array_pop($words);
//.........这里部分代码省略.........
开发者ID:khetsothea,项目名称:flexicontent-cck,代码行数:101,代码来源:controller.php

示例9: _getsubs

 /**
  * Method to fetch the subcategories
  *
  * @access private
  * @return object
  */
 function _getsubs($id)
 {
     $params = $this->_params;
     $use_tmp = true;
     $user = JFactory::getUser();
     $db = JFactory::getDBO();
     $cat_orderby = $this->_buildCatOrderBy('subcat_');
     // Date-Times are stored as UTC, we should use current UTC time to compare and not user time (requestTime),
     // thus the items are published globally at the time the author specified in his/her local clock
     //$now  = JFactory::getApplication()->requestTime;   // NOT correct behavior it should be UTC (below)
     //$now  = JFactory::getDate()->toSql();              // NOT good if string passed to function that will be cached, because string continuesly different
     $_nowDate = 'UTC_TIMESTAMP()';
     //$db->Quote($now);
     $nullDate = $db->getNullDate();
     // Get some parameters and other info
     $catlang = $params->get('language', '');
     // Category language (currently UNUSED)
     $lang = flexicontent_html::getUserCurrentLang();
     // Get user current language
     $filtercat = $params->get('filtercat', 0);
     // Filter items using currently selected language
     $show_noauth = $params->get('show_noauth', 0);
     // Show unauthorized items
     // Build where clause
     $sub_where = ' WHERE cc.published = 1';
     $sub_where .= ' AND c.id = cc.id';
     // Filter the category view with the current user language
     if ($filtercat) {
         $lta = $use_tmp ? 'i' : 'ie';
         $sub_where .= ' AND ( ' . $lta . '.language LIKE ' . $db->Quote($lang . '%') . ' OR ' . $lta . '.language="*" ) ';
     }
     // Get privilege to view non viewable items (upublished, archived, trashed, expired, scheduled).
     // NOTE:  ACL view level is checked at a different place
     $ignoreState = $user->authorise('flexicontent.ignoreviewstate', 'com_flexicontent');
     if (!$ignoreState) {
         // Limit by publication state. Exception: when displaying personal user items or items modified by the user
         $sub_where .= ' AND ( i.state IN (1, -5) OR ( i.created_by = ' . $user->id . ' AND i.created_by != 0 ) )';
         //.' OR ( i.modified_by = '.$user->id.' AND i.modified_by != 0 ) )';
         // Limit by publish up/down dates. Exception: when displaying personal user items or items modified by the user
         $sub_where .= ' AND ( ( i.publish_up = ' . $db->Quote($nullDate) . ' OR i.publish_up <= ' . $_nowDate . ' ) OR ( i.created_by = ' . $user->id . ' AND i.created_by != 0 ) )';
         //.' OR ( i.modified_by = '.$user->id.' AND i.modified_by != 0 ) )';
         $sub_where .= ' AND ( ( i.publish_down = ' . $db->Quote($nullDate) . ' OR i.publish_down >= ' . $_nowDate . ' ) OR ( i.created_by = ' . $user->id . ' AND i.created_by != 0 ) )';
         //.' OR ( i.modified_by = '.$user->id.' AND i.modified_by != 0 ) )';
     }
     // Select only items that user has view access, checking item, category, content type access level
     $and = $asscat_and = '';
     if (!$show_noauth) {
         $aid_arr = JAccess::getAuthorisedViewLevels($user->id);
         $aid_list = implode(",", $aid_arr);
         $sub_where .= ' AND ty.access IN (0,' . $aid_list . ')';
         $sub_where .= ' AND cc.access IN (0,' . $aid_list . ')';
         $sub_where .= ' AND  i.access IN (0,' . $aid_list . ')';
         $and .= ' AND  c.access IN (0,' . $aid_list . ')';
         $asscat_and .= ' AND sc.access IN (0,' . $aid_list . ')';
     }
     $query = 'SELECT c.*,' . ' CASE WHEN CHAR_LENGTH( c.alias ) THEN CONCAT_WS( \':\', c.id, c.alias ) ELSE c.id END AS slug,' . ' (' . ' SELECT COUNT( DISTINCT rel.itemid )' . ' FROM #__flexicontent_cats_item_relations AS rel' . (!$use_tmp ? ' JOIN #__content AS i ON rel.itemid = i.id' : ' JOIN #__flexicontent_items_tmp AS i ON rel.itemid = i.id') . (!$use_tmp ? ' JOIN #__flexicontent_items_ext AS ie ON rel.itemid = ie.item_id' : '') . ' JOIN #__flexicontent_types AS ty ON ' . (!$use_tmp ? 'ie' : 'i') . '.type_id = ty.id' . ' JOIN #__categories AS cc ON cc.id = rel.catid' . $sub_where . ' ) AS assignedsubitems,' . ' (' . ' SELECT COUNT( sc.id )' . ' FROM #__categories AS sc' . ' WHERE c.id = sc.parent_id' . ' AND sc.published = 1' . $asscat_and . ' ) AS assignedcats' . ' FROM #__categories AS c' . ' WHERE c.published = 1' . (!FLEXI_J16GE ? ' AND c.section = ' . FLEXI_SECTION : ' AND c.extension="' . FLEXI_CAT_EXTENSION . '" ') . ' AND c.parent_id = ' . (int) $id . $and . $cat_orderby;
     $this->_db->setQuery($query);
     $this->_subs = $this->_db->loadObjectList();
     return $this->_subs;
 }
开发者ID:khetsothea,项目名称:flexicontent-cck,代码行数:66,代码来源:flexicontent.php

示例10: explode

}
$app = JFactory::getApplication();
$caching = $app->getCfg('caching');
$show_alpha = $this->params->get('show_alpha', 1);
if ($show_alpha == 1) {
    // Language Default
    $alphacharacters = JTEXT::_("FLEXI_ALPHA_INDEX_CHARACTERS");
    $groups = explode("!!", $alphacharacters);
    $groupcssclasses = explode("!!", JTEXT::_("FLEXI_ALPHA_INDEX_CSSCLASSES"));
    $alphaaliases = explode("!!", JTEXT::_("FLEXI_ALPHA_INDEX_ALIASES"));
} else {
    // $show_alpha == 2
    // Custom setting
    $alphacharacters = $this->params->get('alphacharacters', "[default]=a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,y,z!!0,1,2,3,4,5,6,7,8,9");
    // Get a 2 character language tag
    $lang = flexicontent_html::getUserCurrentLang();
    // a. Try to get for current language
    $result = preg_match("/(\\[{$lang}\\])=([^[]+)/i", $alphacharacters, $matches);
    if ($result) {
        $custom_lang_alpha_index = $matches[2];
    } else {
        // b. Try to get default for all languages
        $result = preg_match("/(\\[default\\])=([^[]+)/i", $alphacharacters, $matches);
        if ($result) {
            $custom_lang_alpha_index = $matches[2];
        } else {
            // c. Use default language string from language file
            $custom_lang_alpha_index = JTEXT::_("FLEXI_ALPHA_INDEX_CHARACTERS");
        }
    }
    $groups = explode("!!", $custom_lang_alpha_index);
开发者ID:khetsothea,项目名称:flexicontent-cck,代码行数:31,代码来源:category_alpha_html5.php

示例11: _getsubs

 /**
  * Method to fetch the subcategories
  *
  * @access private
  * @return object
  */
 function _getsubs($id)
 {
     $params = $this->_params;
     $user = JFactory::getUser();
     $db = JFactory::getDBO();
     $orderby = $this->_buildCatOrderBy('subcat_');
     // Get a 2 character language tag
     $lang = flexicontent_html::getUserCurrentLang();
     // Do we filter the categories
     $filtercat = $params->get('filtercat', 0);
     // show unauthorized items
     $show_noauth = $params->get('show_noauth', 0);
     // Build where clause
     $where = ' WHERE cc.published = 1';
     $where .= ' AND c.id = cc.id';
     // Filter the category view with the active active language
     if ((FLEXI_FISH || FLEXI_J16GE) && $filtercat) {
         $lta = FLEXI_J16GE ? 'i' : 'ie';
         $where .= ' AND ( ' . $lta . '.language LIKE ' . $db->Quote($lang . '%') . (FLEXI_J16GE ? ' OR ' . $lta . '.language="*" ' : '') . ' ) ';
     }
     $states = (int) $user->get('gid') > 19 ? '1, -5, 0, -3, -4' : '1, -5';
     $where .= ' AND i.state IN (' . $states . ')';
     // Select only items that user has view access, if listing of unauthorized content is not enabled
     $subjoin = $suband = $join = $and = '';
     if (!$show_noauth) {
         if (FLEXI_J16GE) {
             $aid_arr = JAccess::getAuthorisedViewLevels($user->id);
             $aid_list = implode(",", $aid_arr);
             $suband .= ' AND ty.access IN (0,' . $aid_list . ')';
             $suband .= ' AND cc.access IN (0,' . $aid_list . ')';
             $suband .= ' AND i.access IN (0,' . $aid_list . ')';
             $and .= ' AND c.access IN (0,' . $aid_list . ')';
         } else {
             $aid = (int) $user->get('aid');
             if (FLEXI_ACCESS) {
                 $subjoin .= ' LEFT JOIN #__flexiaccess_acl AS sgt ON ty.id = sgt.axo AND sgt.aco = "read" AND sgt.axosection = "type"';
                 $subjoin .= ' LEFT JOIN #__flexiaccess_acl AS sgc ON cc.id = sgc.axo AND sgc.aco = "read" AND sgc.axosection = "category"';
                 $subjoin .= ' LEFT JOIN #__flexiaccess_acl AS sgi ON i.id = sgi.axo AND sgi.aco = "read" AND sgi.axosection = "item"';
                 $suband .= ' AND (sgt.aro IN ( ' . $user->gmid . ' ) OR ty.access <= ' . $aid . ')';
                 $suband .= ' AND (sgc.aro IN ( ' . $user->gmid . ' ) OR cc.access <= ' . $aid . ')';
                 $suband .= ' AND (sgi.aro IN ( ' . $user->gmid . ' ) OR i.access <= ' . $aid . ')';
                 $join .= ' LEFT JOIN #__flexiaccess_acl AS gc ON c.id = gc.axo AND gc.aco = "read" AND gc.axosection = "category"';
                 $and .= ' AND (gc.aro IN ( ' . $user->gmid . ' ) OR c.access <= ' . $aid . ')';
             } else {
                 $suband .= ' AND ty.access <= ' . $aid;
                 $suband .= ' AND cc.access <= ' . $aid;
                 $suband .= ' AND i.access <= ' . $aid;
                 $and .= ' AND c.access <= ' . $aid;
             }
         }
     }
     $query = 'SELECT c.*,' . ' CASE WHEN CHAR_LENGTH( c.alias ) THEN CONCAT_WS( \':\', c.id, c.alias ) ELSE c.id END AS slug,' . ' (' . ' SELECT COUNT( DISTINCT i.id )' . ' FROM #__content AS i' . ' JOIN #__flexicontent_cats_item_relations AS rel ON rel.itemid = i.id' . ' JOIN #__flexicontent_items_ext AS ie ON ie.item_id = i.id' . ' JOIN #__flexicontent_types AS ty ON ie.type_id = ty.id' . ' JOIN #__categories AS cc ON cc.id = rel.catid' . $subjoin . $where . $suband . ' ) AS assignedsubitems,' . ' (' . ' SELECT COUNT( sc.id )' . ' FROM #__categories AS sc' . ' WHERE c.id = sc.parent_id' . ' AND sc.published = 1' . ' ) AS assignedcats' . ' FROM #__categories AS c' . $join . ' WHERE c.published = 1' . (!FLEXI_J16GE ? ' AND c.section = ' . FLEXI_SECTION : ' AND c.extension="' . FLEXI_CAT_EXTENSION . '" ') . ' AND c.parent_id = ' . (int) $id . $and . $orderby;
     $this->_db->setQuery($query);
     $this->_subs = $this->_db->loadObjectList();
     return $this->_subs;
 }
开发者ID:jakesyl,项目名称:flexicontent,代码行数:62,代码来源:flexicontent.php


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