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


PHP FlexicontentFields::setFilterValues方法代码示例

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


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

示例1: foreach

             }
         }
     }
 }
 // Remove categories filter
 if ($display_cat_list || $catid) {
     foreach ($filters as $i => $filter) {
         if ($filter->field_type == 'categories') {
             unset($filters[$i]);
             break;
         }
     }
 }
 // Set filter values (initial or locked) via configuration parameters
 FlexicontentFields::setFilterValues($params, 'persistent_filters', $is_persistent = 1);
 FlexicontentFields::setFilterValues($params, 'initial_filters', $is_persistent = 0);
 // 4. Add html to filter objects
 if (!empty($filters)) {
     FlexicontentFields::renderFilters($params, $filters, $form_name);
 }
 // Restore variables
 JRequest::setVar('cid', $saved_cid);
 // restore cid
 JRequest::setVar('layout', $saved_layout);
 // restore layout
 JRequest::setVar('option', $saved_option);
 // restore option
 JRequest::setVar('view', $saved_view);
 // restore view
 // Load needed JS libs & CSS styles
 FLEXI_J30GE ? JHtml::_('behavior.framework', true) : JHTML::_('behavior.mootools');
开发者ID:noxidsoft,项目名称:flexicontent-cck,代码行数:31,代码来源:mod_flexifilter.php

示例2: _loadCategoryParams


//.........这里部分代码省略.........
     // Start merging of parameters
     // ***************************
     // 0. Start from component parameters
     $params = new JRegistry();
     $params->merge($compParams);
     // 1. Merge category's inherited parameters (e.g. ancestor categories or specific category)
     while (!empty($heritage_stack)) {
         $catdata = array_pop($heritage_stack);
         if ($catdata->params->get('orderbycustomfieldid') === "0") {
             $catdata->params->set('orderbycustomfieldid', '');
         }
         $params->merge($catdata->params);
         if ($debug_inheritcid) {
             array_push($merge_stack, "MERGED CATEGORY PARAMETERS of (inherit-from) category: " . $catdata->title);
         }
     }
     // 2. Merge category parameters (potentially overriden via  author's category parameters)
     if ($catParams->get('orderbycustomfieldid') === "0") {
         $catParams->set('orderbycustomfieldid', '');
     }
     $params->merge($catParams);
     if ($debug_inheritcid && $id) {
         array_push($merge_stack, "MERGED CATEGORY PARAMETERS of current category");
     }
     if ($debug_inheritcid && $this->_authorid && !empty($_author_catreg) && $_author_catreg->get('override_currcat_config', 0)) {
         array_push($merge_stack, "MERGED CATEGORY PARAMETERS of (current) author: {$this->_authorid}");
     }
     // g. Verify menu item points to current FLEXIcontent object, and then merge menu item parameters
     if (!empty($menu)) {
         $this->_menu_itemid = $menu->id;
         $view_ok = @$menu->query['view'] == 'category';
         $cid_ok = @$menu->query['cid'] == $this->_id;
         $layout_ok = @$menu->query['layout'] == $this->_layout;
         // Examine author only for author layout, !! thus ignoring empty author_id when layout is 'myitems' or 'favs', for them this is set explicitely (* see populateCategoryState() function)
         $authorid_ok = $this->_layout != 'author' || @$menu->query['authorid'] == $this->_authorid;
         // Examine tagid only for tags layout
         $tagid_ok = $this->_layout != 'tags' || @$menu->query['tagid'] == $this->_tagid;
         // We will merge menu parameters last, thus overriding the default categories parameters if either
         // (a) override is enabled in the menu or (b) category Layout is 'myitems' or 'favs' or 'tags' or 'mcats' which has no default parameters
         $overrideconf = $menu_params->get('override_defaultconf', 0) || $this->_layout == 'myitems' || $this->_layout == 'favs' || $this->_layout == 'mcats' || $this->_layout == 'tags';
         $menu_matches = $view_ok && $cid_ok & $layout_ok && $authorid_ok;
         if ($menu_matches && $overrideconf) {
             // Add - all - menu parameters related or not related to category parameters override
             if ($menu_params->get('orderbycustomfieldid') === "0") {
                 $menu_params->set('orderbycustomfieldid', '');
             }
             $params->merge($menu_params);
             if ($debug_inheritcid) {
                 array_push($merge_stack, "MERGED CATEGORY PARAMETERS of (current) menu item: " . $menu->id);
             }
         } else {
             if ($menu_matches) {
                 // Add menu parameters - not - related to category parameters override
                 $params->set('item_depth', $menu_params->get('item_depth'));
                 $params->set('page_title', $menu_params->get('page_title'));
                 $params->set('show_page_heading', $menu_params->get('show_page_heading'));
                 $params->set('page_heading', $menu_params->get('page_heading'));
                 $params->set('pageclass_sfx', $menu_params->get('pageclass_sfx'));
             }
         }
     }
     // Parameters meant for lists
     $params->set('show_editbutton', $params->get('show_editbutton_lists', 1));
     // Parameter meant for lists
     $params->set('show_title', $params->get('show_title_lists', 1));
     // Parameter meant for lists
     $params->set('link_titles', $params->get('link_titles_lists', 1));
     // Parameter meant for lists
     // Set filter values (initial or locked) via configuration parameters
     if ($params->get('use_persistent_filters')) {
         FlexicontentFields::setFilterValues($params, 'persistent_filters', $is_persistent = 1);
     }
     FlexicontentFields::setFilterValues($params, 'initial_filters', $is_persistent = 0);
     // Bugs of v2.0 RC2
     if (FLEXI_J16GE) {
         if (is_array($orderbycustomfieldid = $params->get('orderbycustomfieldid', 0))) {
             JError::raiseNotice(0, "FLEXIcontent versions up to to v2.0 RC2a, had a bug, please open category and resave it, you can use 'copy parameters' to quickly update many categories");
             $params->set('orderbycustomfieldid', $orderbycustomfieldid[0]);
         }
         if (preg_match("/option=com_user&/", $params->get('login_page', ''))) {
             JError::raiseNotice(0, "The login url seems to be wrongly set in the FLEXIcontent component configuration.<br /> Please replace: <u>option=com_user</u> with <u>option=com_users</u>");
             $params->set('login_page', str_replace("com_user&", "com_users&", $params->get('login_page', '')));
         }
     }
     // Retrieve Layout's parameters, also deciding the layout
     $this->decideLayout($params);
     $layoutParams = $this->getLayoutparams();
     $layoutParams = new JRegistry($layoutParams);
     //print_r($layoutParams);
     // Allow global layout parameters to be inherited properly
     $this->_params = clone $layoutParams;
     $this->_params->merge($params);
     $merge_stack[1] = "MERGED LAYOUT PARAMETERS of '" . $this->_clayout . "'";
     if ($debug_inheritcid) {
         $app->enqueueMessage(implode("<br/>\n", $merge_stack));
     }
     // Also set into a global variable
     global $fc_catview;
     $fc_catview['params'] = $this->_params;
 }
开发者ID:noxidsoft,项目名称:flexicontent-cck,代码行数:101,代码来源:category.php

示例3: getItems


//.........这里部分代码省略.........
     $add_comments = ($display_comments_feat || $display_comments || in_array('commented', $ordering)) && $jcomments_exist;
     // Additional select and joins for comments
     $select_comments = $add_comments ? ', COUNT(DISTINCT com.id) AS comments_total' : '';
     $join_comments_type = $ordering[1] == 'commented' ? ' INNER JOIN' : ' LEFT JOIN';
     // Do not require most commented for 2nd level ordering
     $join_comments = $add_comments ? $join_comments_type . ' #__jcomments AS com ON com.object_id = i.id AND com.object_group="com_flexicontent" AND com.published="1"' : '';
     // **********************************************************
     // Decide Select Sub-Clause and Join-Clause for voting/rating
     // **********************************************************
     $display_voting = $params->get('display_voting');
     $display_voting_feat = $params->get('display_voting_feat');
     // Decide to JOIN (or not) with rating TABLE, needed when displaying ratings and/or when ordering by ratings
     $add_rated = $display_voting_feat || $display_voting || in_array('rated', $ordering);
     // Additional select and joins for ratings
     $select_rated = in_array('rated', $ordering) ? ', (cr.rating_sum / cr.rating_count) * 20 AS votes' : '';
     $select_rated .= $add_rated ? ', cr.rating_sum as rating_sum, cr.rating_count as rating_count' : '';
     $join_rated_type = in_array('rated', $ordering) ? ' INNER JOIN' : ' LEFT JOIN';
     $join_rated = $add_rated ? $join_rated_type . ' #__content_rating AS cr ON cr.content_id = i.id' : '';
     // ***********************************************************
     // Finally put together the query to retrieve the listed items
     // ***********************************************************
     // ******************
     // Custom FIELD scope
     // ******************
     $where_field_filters = '';
     $join_field_filters = '';
     // ZERO 'behaviour' means statically selected records, but METHOD 1 is ALL records ... so NOTHING to do
     if (!$behaviour_filt && $method_filt == 1) {
     } else {
         if ($behaviour_filt == 0 || $behaviour_filt == 2) {
             $negate_op = $method_filt == 2 ? 'NOT' : '';
             // These field filters apply a STATIC filtering, regardless of current item being displayed.
             // Static Field Filters (These are a string that MAPs filter ID TO filter VALUES)
             $static_filters_data = FlexicontentFields::setFilterValues($params, 'static_filters', $is_persistent = 1, $set_method = "array");
             // Dynamic Field Filters (THIS is filter IDs list)
             // These field filters apply a DYNAMIC filtering, that depend on current item being displayed. The items that have same value as currently displayed item will be included in the list.
             //$dynamic_filters = FlexicontentFields::setFilterValues( $params, 'dynamic_filters', $is_persistent=0);
             foreach ($static_filters_data as $filter_id => $filter_values) {
                 // Handle single-valued filter as multi-valued
                 if (!is_array($filter_values)) {
                     $filter_values = array(0 => $filter_values);
                 }
                 // Single or Multi valued filter
                 if (isset($filter_values[0])) {
                     $in_values = array();
                     foreach ($filter_values as $val) {
                         $in_values[] = $db->Quote($val);
                     }
                     // Quote in case they are strings !!
                     $where_field_filters .= ' AND ' . $negate_op . ' (rel' . $filter_id . '.value IN (' . implode(',', $in_values) . ') ) ';
                 } else {
                     // Special case only one part of range provided ... must MATCH/INCLUDE empty values or NULL values ...
                     $value_empty = !strlen(@$filter_values[1]) && strlen(@$filter_values[2]) ? ' OR rel' . $filter_id . '.value="" OR rel' . $filter_id . '.value IS NULL ' : '';
                     if (strlen(@$filter_values[1]) || strlen(@$filter_values[2])) {
                         $where_field_filters .= ' AND ' . $negate_op . ' ( 1 ';
                         if (strlen(@$filter_values[1])) {
                             $where_field_filters .= ' AND (rel' . $filter_id . '.value >=' . $filter_values[1] . ') ';
                         }
                         if (strlen(@$filter_values[2])) {
                             $where_field_filters .= ' AND (rel' . $filter_id . '.value <=' . $filter_values[2] . $value_empty . ') ';
                         }
                         $where_field_filters .= ' )';
                     }
                 }
                 $join_field_filters .= ' JOIN #__flexicontent_fields_item_relations AS rel' . $filter_id . ' ON rel' . $filter_id . '.item_id=i.id AND rel' . $filter_id . '.field_id = ' . $filter_id;
             }
开发者ID:khetsothea,项目名称:flexicontent-cck,代码行数:67,代码来源:helper.php


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