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


PHP FlexicontentFields::getFields方法代码示例

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


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

示例1: display

 /**
  * Creates the page's display
  *
  * @since 1.0
  */
 function display($tpl = null)
 {
     //initialize variables
     $app = JFactory::getApplication();
     $document = JFactory::getDocument();
     $menus = $app->getMenu();
     $menu = $menus->getActive();
     $uri = JFactory::getURI();
     $view = JRequest::getCmd('view');
     // Get view's Model
     $model = $this->getModel();
     // Get tag and set tag parameters as VIEW's parameters (tag parameters are merged with component/page(=menu item) and optionally with tag cloud parameters)
     $tag = $model->getTag();
     if (empty($tag)) {
         // Raise a 404 error, if tag doesn't exist or access isn't permitted, maybe move this into model ??
         $tid = JRequest::getInt('id', 0);
         $msg = JText::sprintf($tid ? 'Tag id was not set (is 0)' : 'Tag #%d not found', $tid);
         if (FLEXI_J16GE) {
             throw new Exception($msg, 404);
         } else {
             JError::raiseError(404, $msg);
         }
     }
     // Get parameters via model
     $params = $model->getParams();
     // Get various data from the model
     $items = $this->get('Data');
     $total = $this->get('Total');
     // Make sure field values were retrieved e.g. we need 'item->categories' for template classes
     $items = FlexicontentFields::getFields($items, $view, $params);
     // Calculate CSS classes needed to add special styling markups to the items
     flexicontent_html::calculateItemMarkups($items, $params);
     // ********************************
     // Load needed JS libs & CSS styles
     // ********************************
     FLEXI_J30GE ? JHtml::_('behavior.framework', true) : JHTML::_('behavior.mootools');
     flexicontent_html::loadFramework('jQuery');
     flexicontent_html::loadFramework('flexi_tmpl_common');
     //add css file
     if (!$params->get('disablecss', '')) {
         $document->addStyleSheet($this->baseurl . '/components/com_flexicontent/assets/css/flexicontent.css');
         $document->addCustomTag('<!--[if IE]><style type="text/css">.floattext {zoom:1;}</style><![endif]-->');
     }
     //allow css override
     if (file_exists(JPATH_SITE . DS . 'templates' . DS . $app->getTemplate() . DS . 'css' . DS . 'flexicontent.css')) {
         $document->addStyleSheet($this->baseurl . '/templates/' . $app->getTemplate() . '/css/flexicontent.css');
     }
     // **********************************************************
     // Calculate a (browser window) page title and a page heading
     // **********************************************************
     // Verify menu item points to current FLEXIcontent object
     if ($menu) {
         $view_ok = 'tags' == @$menu->query['view'];
         $tid_ok = $tag->id == (int) @$menu->query['id'];
         $menu_matches = $view_ok && $tid_ok;
         //$menu_params = FLEXI_J16GE ? $menu->params : new JParameter($menu->params);  // Get active menu item parameters
     } else {
         $menu_matches = false;
     }
     // MENU ITEM matched, use its page heading (but use menu title if the former is not set)
     if ($menu_matches) {
         $default_heading = FLEXI_J16GE ? $menu->title : $menu->name;
         // Cross set (show_) page_heading / page_title for compatibility of J2.5+ with J1.5 template (and for J1.5 with J2.5 template)
         $params->def('page_heading', $params->get('page_title', $default_heading));
         $params->def('page_title', $params->get('page_heading', $default_heading));
         $params->def('show_page_heading', $params->get('show_page_title', 0));
         $params->def('show_page_title', $params->get('show_page_heading', 0));
     } else {
         // Clear some menu parameters
         //$params->set('pageclass_sfx',	'');  // CSS class SUFFIX is behavior, so do not clear it ?
         // Calculate default page heading (=called page title in J1.5), which in turn will be document title below !! ...
         // meta_params->get('page_title') is meant for <title> but let's use as ... default page heading
         $default_heading = JText::_('FLEXI_ITEMS_WITH_TAG') . ": " . $tag->name;
         // Decide to show page heading (=J1.5 page title), this is always yes
         $show_default_heading = 1;
         // Set both (show_) page_heading / page_title for compatibility of J2.5+ with J1.5 template (and for J1.5 with J2.5 template)
         $params->set('page_title', $default_heading);
         $params->set('page_heading', $default_heading);
         $params->set('show_page_heading', $show_default_heading);
         $params->set('show_page_title', $show_default_heading);
     }
     // Prevent showing the page heading if ... currently no reason
     if (0) {
         $params->set('show_page_heading', 0);
         $params->set('show_page_title', 0);
     }
     // ************************************************************
     // Create the document title, by from page title and other data
     // ************************************************************
     // Use the page heading as document title, (already calculated above via 'appropriate' logic ...)
     $doc_title = $params->get('page_title');
     // Check and prepend or append site name
     if (FLEXI_J16GE) {
         // Not available in J1.5
         // Add Site Name to page title
//.........这里部分代码省略.........
开发者ID:jakesyl,项目名称:flexicontent,代码行数:101,代码来源:view.html.php

示例2: array

 /**
  * Method to render (display method) a field on demand and return the display
  * 
  * @access public
  * @return object
  * @since 1.5.5
  */
 static function &getFieldDisplay(&$item_arr, $fieldname, $single_item_vals = null, $method = 'display', $view = FLEXI_ITEMVIEW)
 {
     // 1. Convert to array of items if not an array already
     if (empty($item_arr)) {
         $err_msg = __FUNCTION__ . "(): empty item data given";
         return $err_msg;
     } else {
         if (!is_array($item_arr)) {
             $items = array(&$item_arr);
         } else {
             $items =& $item_arr;
         }
     }
     // 2. Make sure that fields have been created for all given items
     $_items = array();
     foreach ($items as $i => $item) {
         if (!isset($item->fields)) {
             $_items[] =& $items[$i];
         }
     }
     if (count($_items)) {
         FlexicontentFields::getFields($_items, $view);
     }
     // 3. Check and create HTML display for the given field name
     $_return = array();
     foreach ($items as $item) {
         // Check if we have already created the display and skip current item
         if (isset($item->onDemandFields[$fieldname]->{$method})) {
             continue;
         }
         // Find the field inside item
         foreach ($item->fields as $field) {
             if (!empty($field->name) && $field->name == $fieldname) {
                 break;
             }
         }
         // Check for not found field, and skip it, this is either due to no access or wrong name ...
         $item->onDemandFields[$fieldname] = new stdClass();
         if (empty($field->name) || $field->name != $fieldname) {
             $item->onDemandFields[$fieldname]->label = '';
             $item->onDemandFields[$fieldname]->noaccess = true;
             $item->onDemandFields[$fieldname]->errormsg = 'field not assigned to this type of item or current user has no access';
             $item->onDemandFields[$fieldname]->{$method} = '';
             continue;
         }
         // Get field's values if they were custom values were not given
         if ($single_item_vals !== null && count($items) == 1) {
             // $values is used only if rendering a single item
             $values = $single_item_vals;
         } else {
             $values = isset($item->fieldvalues[$field->id]) ? $item->fieldvalues[$field->id] : array();
         }
         // Set other field data like label and field itself !!!
         $item->onDemandFields[$fieldname]->label = $field->label;
         $item->onDemandFields[$fieldname]->noaccess = false;
         $item->onDemandFields[$fieldname]->field =& $field;
         // Render the (display) method of the field
         if (!isset($field->{$method})) {
             $field = FlexicontentFields::renderField($item, $field, $values, $method, $view);
         }
         if (!isset($field->{$method})) {
             $field->{$method} = '';
         }
         $item->onDemandFields[$fieldname]->{$method} =& $field->{$method};
         $_method_html[$item->id] =& $field->{$method};
     }
     // Return field(s) HTML (in case of multiple items this will be an array indexable by item ids
     if (!is_array($item_arr)) {
         $_method_html = @$_method_html[$item_arr->id];
         // Suppress field name not found ...
     }
     return $_method_html;
 }
开发者ID:jakesyl,项目名称:flexicontent,代码行数:80,代码来源:flexicontent.fields.php

示例3: display

 /**
  * Creates the page's display
  *
  * @since 1.0
  */
 function display($tpl = null)
 {
     // check for form layout
     if ($this->getLayout() == 'form' || in_array(JRequest::getVar('task'), array('add', 'edit'))) {
         // Important set layout to be form since various category view SEF links have this variable set
         $this->setLayout('form');
         $this->_displayForm($tpl);
         return;
     } else {
         $this->setLayout('item');
     }
     // Get Content Types with no category links in item view pathways, and for unroutable (non-linkable) categories
     global $globalnoroute, $globalnopath, $globalcats;
     if (!is_array($globalnopath)) {
         $globalnopath = array();
     }
     if (!is_array($globalnoroute)) {
         $globalnoroute = array();
     }
     //initialize variables
     $dispatcher = JDispatcher::getInstance();
     $app = JFactory::getApplication();
     $session = JFactory::getSession();
     $document = JFactory::getDocument();
     $menus = $app->getMenu();
     $menu = $menus->getActive();
     $uri = JFactory::getURI();
     $user = JFactory::getUser();
     $aid = JAccess::getAuthorisedViewLevels($user->id);
     $db = JFactory::getDBO();
     $nullDate = $db->getNullDate();
     // ******************************************************
     // Get item, model and create form (that loads item data)
     // ******************************************************
     // Get model
     $model = $this->getModel();
     $cid = $model->_cid ? $model->_cid : $model->get('catid');
     // Get current category id
     // Decide version to load
     $version = JRequest::getVar('version', 0, 'request', 'int');
     // Load specific item version (non-zero), 0 version: is unversioned data, -1 version: is latest version (=default for edit form)
     $preview = JRequest::getVar('preview', 0, 'request', 'int');
     // Preview versioned data FLAG ... if previewing and version is not set then ... we load version -1 (=latest version)
     $version = $preview && !$version ? -1 : $version;
     // Allow iLayout from HTTP request, this will be checked during loading item parameters
     $model->setItemLayout('__request__');
     // Try to load existing item, an 404 error will be raised if item is not found. Also value 2 for check_view_access
     // indicates to raise 404 error for ZERO primary key too, instead of creating and returning a new item object
     $start_microtime = microtime(true);
     $item = $model->getItem(null, $check_view_access = 2, $no_cache = $version || $preview, $force_version = $version || $preview ? $version : 0);
     // ZERO means unversioned data
     $_run_time = round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10;
     // Get item parameters as VIEW's parameters (item parameters are merged parameters in order: component/category/layout/type/item/menu/access)
     $params =& $item->parameters;
     // Get item 's layout as this may have been altered
     $ilayout = $params->get('ilayout');
     $print_logging_info = $params->get('print_logging_info');
     if ($print_logging_info) {
         global $fc_run_times;
     }
     if ($print_logging_info) {
         $fc_run_times['get_item_data'] = $_run_time;
     }
     // ********************************
     // Load needed JS libs & CSS styles
     // ********************************
     //add css file
     if (!$params->get('disablecss', '')) {
         $document->addStyleSheet($this->baseurl . '/components/com_flexicontent/assets/css/flexicontent.css');
         $document->addCustomTag('<!--[if IE]><style type="text/css">.floattext {zoom:1;}</style><![endif]-->');
     }
     //allow css override
     if (file_exists(JPATH_SITE . DS . 'templates' . DS . $app->getTemplate() . DS . 'css' . DS . 'flexicontent.css')) {
         $document->addStyleSheet($this->baseurl . '/templates/' . $app->getTemplate() . '/css/flexicontent.css');
     }
     //special to hide the joomfish language selector on item views
     if ($params->get('disable_lang_select', 0)) {
         $css = '#jflanguageselection { visibility:hidden; }';
         $document->addStyleDeclaration($css);
     }
     // *************************************************************
     // Get cached template data, loading any template language files
     // *************************************************************
     $themes = flexicontent_tmpl::getTemplates($lang_files = array($ilayout));
     // *****************
     // Get Item's Fields
     // *****************
     $_items = array(&$item);
     FlexicontentFields::getFields($_items, FLEXI_ITEMVIEW, $params, $aid);
     $fields = $item->fields;
     // ****************************************
     // Get category titles needed by pathway,
     // this will allow Falang to translate them
     // ****************************************
     $catshelper = new flexicontent_cats($cid);
//.........这里部分代码省略.........
开发者ID:benediktharter,项目名称:flexicontent-cck,代码行数:101,代码来源:view.html.php

示例4: renderFields

    function renderFields($context, &$row, &$params, $page = 0)
    {
        JTable::addIncludePath(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_flexicontent' . DS . 'tables');
        require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_flexicontent' . DS . 'defineconstants.php';
        require_once JPATH_SITE . DS . 'components' . DS . 'com_flexicontent' . DS . 'classes' . DS . 'flexicontent.fields.php';
        require_once JPATH_SITE . DS . 'components' . DS . 'com_flexicontent' . DS . 'classes' . DS . 'flexicontent.helper.php';
        require_once JPATH_SITE . DS . 'components' . DS . 'com_flexicontent' . DS . 'helpers' . DS . 'permission.php';
        require_once JPATH_SITE . DS . 'components' . DS . 'com_flexicontent' . DS . 'models' . DS . FLEXI_ITEMVIEW . '.php';
        $app = JFactory::getApplication();
        $user = JFactory::getUser();
        $aid = JAccess::getAuthorisedViewLevels($user->id);
        $itemmodel = new FlexicontentModelItem();
        $item = $itemmodel->getItem($row->id, $check_view_access = false);
        $view = 'com_content.article' ? FLEXI_ITEMVIEW : 'category';
        $items = FlexicontentFields::getFields($item, $view, $_item_params = null, $aid = null, $use_tmpl = false);
        // $_item_params == null means only retrieve fields
        // Only Render custom fields
        $displayed_fields = array();
        foreach ($item->fields as $field) {
            if ($field->iscore) {
                continue;
            }
            $displayed_fields[$field->name] = $field;
            $values = isset($item->fieldvalues[$field->id]) ? $item->fieldvalues[$field->id] : array();
            FlexicontentFields::renderField($item, $field, $values, $method = 'display', $view);
        }
        if (!count($displayed_fields)) {
            return null;
        }
        // Render the list of groups
        $field_html = array();
        foreach ($displayed_fields as $field_name => $field) {
            $_values = null;
            if (!isset($field->display)) {
                continue;
            }
            $field_html[] = '
				<div class="fc-field-box">
					' . ($field->parameters->get('display_label') ? '
					<span class="flexi label">' . $field->label . '</span>' : '') . '
					<div class="flexi value">' . $field->display . '</div>
				</div>
				';
        }
        $_display = '<div class="fc-custom-fields-box">' . implode('', $field_html) . '</div>';
        return $_display;
    }
开发者ID:khetsothea,项目名称:flexicontent-cck,代码行数:47,代码来源:flexisystem.php

示例5: renderItem

 /**
  * Function to render the item view of a given item id
  *
  * @param 	int 		$item_id
  * @return 	string  : the HTML of the item view, also the CSS / JS file would have been loaded
  * @since 1.5
  */
 function renderItem($item_id, $view = FLEXI_ITEMVIEW, $ilayout = '')
 {
     JTable::addIncludePath(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_flexicontent' . DS . 'tables');
     require_once JPATH_SITE . DS . 'components' . DS . 'com_flexicontent' . DS . 'classes' . DS . 'flexicontent.fields.php';
     require_once JPATH_SITE . DS . 'components' . DS . 'com_flexicontent' . DS . 'classes' . DS . 'flexicontent.helper.php';
     require_once JPATH_SITE . DS . 'components' . DS . 'com_flexicontent' . DS . 'helpers' . DS . 'permission.php';
     require_once JPATH_SITE . DS . 'components' . DS . 'com_flexicontent' . DS . 'models' . DS . FLEXI_ITEMVIEW . '.php';
     $app = JFactory::getApplication();
     $user = JFactory::getUser();
     $itemmodel = new FlexicontentModelItem();
     $item = $itemmodel->getItem($item_id, $check_view_access = false);
     $aid = JAccess::getAuthorisedViewLevels($user->id);
     list($item) = FlexicontentFields::getFields($item, $view, $item->parameters, $aid);
     // Get Item's specific ilayout
     if ($ilayout == '') {
         $ilayout = $item->parameters->get('ilayout', '');
     }
     // Get type's ilayout
     if ($ilayout == '') {
         $type = JTable::getInstance('flexicontent_types', '');
         $type->id = $item->type_id;
         $type->load();
         $type->params = new JRegistry($type->attribs);
         $ilayout = $type->params->get('ilayout', 'default');
     }
     $this->item =& $item;
     $this->params_saved = @$this->params;
     $this->params =& $item->parameters;
     $this->tmpl = '.item.' . $ilayout;
     $this->print_link = JRoute::_('index.php?view=' . FLEXI_ITEMVIEW . '&id=' . $item->slug . '&pop=1&tmpl=component');
     $this->pageclass_sfx = '';
     if (!isset($this->item->event)) {
         $this->item->event = new stdClass();
     }
     $this->item->event->beforeDisplayContent = '';
     $this->item->event->afterDisplayTitle = '';
     $this->item->event->afterDisplayContent = '';
     $this->fields =& $this->item->fields;
     // start capturing output into a buffer
     ob_start();
     // Include the requested template filename in the local scope (this will execute the view logic).
     if (file_exists(JPATH_SITE . DS . 'templates' . DS . $app->getTemplate() . DS . 'html' . DS . 'com_flexicontent' . DS . 'templates' . DS . $ilayout)) {
         include JPATH_SITE . DS . 'templates' . DS . $app->getTemplate() . DS . 'html' . DS . 'com_flexicontent' . DS . 'templates' . DS . $ilayout . DS . 'item.php';
     } else {
         if (file_exists(JPATH_COMPONENT . DS . 'templates' . DS . $ilayout)) {
             include JPATH_SITE . DS . 'components' . DS . 'com_flexicontent' . DS . 'templates' . DS . $ilayout . DS . 'item.php';
         } else {
             include JPATH_SITE . DS . 'components' . DS . 'com_flexicontent' . DS . 'templates' . DS . 'default' . DS . 'item.php';
         }
     }
     // done with the requested template; get the buffer and clear it.
     $item_html = ob_get_contents();
     ob_end_clean();
     $this->params = $this->params_saved;
     return $item_html;
 }
开发者ID:nettdotkomm,项目名称:flexicontent-cck,代码行数:63,代码来源:flexicontent.helper.php

示例6: display

 /**
  * Creates the page's display
  *
  * @since 1.0
  */
 function display($tpl = null)
 {
     //initialize variables
     $app = JFactory::getApplication();
     $document = JFactory::getDocument();
     $menus = $app->getMenu();
     $menu = $menus->getActive();
     $uri = JFactory::getURI();
     $view = JRequest::getCmd('view');
     // Get view's Model
     $model = $this->getModel();
     // Get parameters via model
     $params = $model->getParams();
     // Get various data from the model
     $items = $this->get('Data');
     $total = $this->get('Total');
     // Make sure field values were retrieved e.g. we need 'item->categories' for template classes
     $items = FlexicontentFields::getFields($items, $view, $params);
     // Calculate CSS classes needed to add special styling markups to the items
     flexicontent_html::calculateItemMarkups($items, $params);
     // ********************************
     // Load needed JS libs & CSS styles
     // ********************************
     FLEXI_J30GE ? JHtml::_('behavior.framework', true) : JHTML::_('behavior.mootools');
     flexicontent_html::loadFramework('jQuery');
     flexicontent_html::loadFramework('flexi_tmpl_common');
     // Add css files to the document <head> section (also load CSS joomla template override)
     if (!$params->get('disablecss', '')) {
         $document->addStyleSheetVersion($this->baseurl . '/components/com_flexicontent/assets/css/flexicontent.css', FLEXI_VHASH);
         //$document->addCustomTag('<!--[if IE]><style type="text/css">.floattext {zoom:1;}</style><![endif]-->');
     }
     if (file_exists(JPATH_SITE . DS . 'templates' . DS . $app->getTemplate() . DS . 'css' . DS . 'flexicontent.css')) {
         $document->addStyleSheetVersion($this->baseurl . '/templates/' . $app->getTemplate() . '/css/flexicontent.css', FLEXI_VHASH);
     }
     // **********************************************************
     // Calculate a (browser window) page title and a page heading
     // **********************************************************
     // Verify menu item points to current FLEXIcontent object
     if ($menu) {
         $view_ok = 'favourites' == @$menu->query['view'];
         $menu_matches = $view_ok;
         //$menu_params = FLEXI_J16GE ? $menu->params : new JParameter($menu->params);  // Get active menu item parameters
     } else {
         $menu_matches = false;
     }
     // MENU ITEM matched, use its page heading (but use menu title if the former is not set)
     if ($menu_matches) {
         $default_heading = FLEXI_J16GE ? $menu->title : $menu->name;
         // Cross set (show_) page_heading / page_title for compatibility of J2.5+ with J1.5 template (and for J1.5 with J2.5 template)
         $params->def('page_heading', $params->get('page_title', $default_heading));
         $params->def('page_title', $params->get('page_heading', $default_heading));
         $params->def('show_page_heading', $params->get('show_page_title', 0));
         $params->def('show_page_title', $params->get('show_page_heading', 0));
     } else {
         // Clear some menu parameters
         //$params->set('pageclass_sfx',	'');  // CSS class SUFFIX is behavior, so do not clear it ?
         // Calculate default page heading (=called page title in J1.5), which in turn will be document title below !! ...
         // meta_params->get('page_title') is meant for <title> but let's use as ... default page heading
         $default_heading = JText::_('FLEXI_YOUR_FAVOURED_ITEMS');
         // Decide to show page heading (=J1.5 page title), this is always yes
         $show_default_heading = 1;
         // Set both (show_) page_heading / page_title for compatibility of J2.5+ with J1.5 template (and for J1.5 with J2.5 template)
         $params->set('page_title', $default_heading);
         $params->set('page_heading', $default_heading);
         $params->set('show_page_heading', $show_default_heading);
         $params->set('show_page_title', $show_default_heading);
     }
     // Prevent showing the page heading if ... currently no reason
     if (0) {
         $params->set('show_page_heading', 0);
         $params->set('show_page_title', 0);
     }
     // ************************************************************
     // Create the document title, by from page title and other data
     // ************************************************************
     // Use the page heading as document title, (already calculated above via 'appropriate' logic ...)
     $doc_title = $params->get('page_title');
     // Check and prepend or append site name to page title
     if ($doc_title != $app->getCfg('sitename')) {
         if ($app->getCfg('sitename_pagetitles', 0) == 1) {
             $doc_title = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $doc_title);
         } elseif ($app->getCfg('sitename_pagetitles', 0) == 2) {
             $doc_title = JText::sprintf('JPAGETITLE', $doc_title, $app->getCfg('sitename'));
         }
     }
     // Finally, set document title
     $document->setTitle($doc_title);
     // ************************
     // Set document's META tags
     // ************************
     // Workaround for Joomla not setting the default value for 'robots', so component must do it
     $app_params = $app->getParams();
     if ($_mp = $app_params->get('robots')) {
         $document->setMetadata('robots', $_mp);
     }
//.........这里部分代码省略.........
开发者ID:khetsothea,项目名称:flexicontent-cck,代码行数:101,代码来源:view.html.php

示例7: getList


//.........这里部分代码省略.........
     foreach ($ordering as $ord) {
         $items_arr = modFlexicontentHelper::getItems($params, $ord);
         if (empty($items_arr)) {
             continue;
         }
         foreach ($items_arr as $catid => $items) {
             if (!isset($cat_items_arr[$catid])) {
                 $cat_items_arr[$catid] = array();
             }
             for ($i = 0; $i < count($items); $i++) {
                 $items[$i]->featured = $i < $featured ? 1 : 0;
                 $items[$i]->fetching = $ord;
                 $cat_items_arr[$catid][] = $items[$i];
             }
         }
     }
     //$mod_fc_run_times['query_items'] = $modfc_jprof->getmicrotime() - $mod_fc_run_times['query_items'];
     // Impementation of Empty Field Filter.
     // The cost of the following code is minimal.
     // The big time cost goes into rendering the fields ...
     // We need to create the display of the fields before examining if they are empty.
     // The hardcoded limit of max items skipped is 100.
     if ($skip_items && count($skiponempty_fields)) {
         $mod_fc_run_times['empty_fields_filter'] = $modfc_jprof->getmicrotime();
         // 0. Add ONLY skipfields to the list of fields to be rendered
         $fields_list = implode(',', $skiponempty_fields);
         //$skip_params = new JRegistry();
         //$skip_params->set('fields',$fields_list);
         foreach ($cat_items_arr as $catid => $cat_items) {
             // 1. The filtered rows
             $filtered_rows = array();
             $order_count = array();
             // 2. Get field values (we pass null parameters to only retrieve field values and not render (YET) the 'skip-onempty' fields
             FlexicontentFields::getFields($cat_items, 'module', $skip_params = null);
             // 3. Skip Items with empty fields (if this filter is enabled)
             foreach ($cat_items as $i => $item) {
                 //echo "$i . {$item->title}<br/>";
                 // Check to initialize counter for this ordering
                 if (!isset($order_count[$item->fetching])) {
                     $order_count[$item->fetching] = 0;
                 }
                 // Check if enough encountered for this ordering
                 if ($order_count[$item->fetching] >= $count) {
                     continue;
                 }
                 // Initialize skip property ZERO for 'any' and ONE for 'all'
                 $skip_curritem = $onempty_fields_combination == 'any' ? 0 : 1;
                 // Now check for empty field display or empty field values, if so item must be skipped
                 foreach ($skiponempty_fields as $skipfield_name) {
                     if ($skip_items == 2) {
                         // We will check field's display
                         FlexicontentFields::getFieldDisplay($item, $skipfield_name, null, 'display', 'module');
                         $skipfield_data = @$item->fields[$skipfield_name]->display;
                     } else {
                         // We will check field's value
                         $skipfield_iscore = $item->fields[$skipfield_name]->iscore;
                         $skipfield_id = $item->fields[$skipfield_name]->id;
                         $skipfield_data = $skipfield_iscore ? $item->{$skipfield_name} : @$item->fieldvalues[$skipfield_id];
                     }
                     // Strip HTML Tags
                     if ($striptags_onempty_fields) {
                         $skipfield_data = strip_tags($skipfield_data);
                     }
                     // Decide if field is empty
                     $skipfield_isempty = is_array($skipfield_data) ? !count($skipfield_data) : !strlen(trim($skipfield_data));
                     if ($skipfield_isempty) {
开发者ID:khetsothea,项目名称:flexicontent-cck,代码行数:67,代码来源:helper.php

示例8: getData

 function getData($number)
 {
     nextendimport('nextend.database.database');
     $db = NextendDatabase::getInstance();
     $data = array();
     $query = 'SELECT ';
     $query .= 'con.id ';
     $query .= 'FROM #__content AS con ';
     $query .= 'LEFT JOIN #__flexicontent_cats_item_relations AS fcat ON fcat.itemid = con.id ';
     $query .= 'LEFT JOIN #__categories AS cat ON fcat.catid = cat.id ';
     $where = array();
     $category = array_map('intval', explode('||', $this->_data->get('sourcecategory', '')));
     if (!in_array('0', $category) && !in_array('1', $category)) {
         $where[] = 'fcat.catid IN (' . implode(',', $category) . ') ';
     }
     if ($this->_data->get('sourcepublished', 1)) {
         $where[] = 'con.state = 1 ';
     }
     if ($this->_data->get('sourcefeatured', 0)) {
         $where[] = 'con.featured = 1 ';
     }
     $language = $this->_data->get('sourcelanguage', '*');
     if ($language) {
         $where[] = 'con.language = ' . $db->quote($language) . ' ';
     }
     if (count($where)) {
         $query .= ' WHERE ' . implode(' AND ', $where);
     }
     $query .= 'GROUP BY con.id ';
     $order = NextendParse::parse($this->_data->get('order1', 'con.title|*|asc'));
     if ($order[0]) {
         $query .= 'ORDER BY ' . $order[0] . ' ' . $order[1] . ' ';
         $order = NextendParse::parse($this->_data->get('order2', 'con.title|*|asc'));
         if ($order[0]) {
             $query .= ', ' . $order[0] . ' ' . $order[1] . ' ';
         }
     }
     $query .= 'LIMIT 0, ' . $number . ' ';
     $db->setQuery($query);
     $result = $db->loadAssocList();
     $lng = JFactory::getLanguage();
     $adminapp = JFactory::$application;
     $siteapp = JApplicationCms::getInstance('site');
     $siteapp->loadLanguage($lng);
     require_once JPATH_ADMINISTRATOR . DS . 'components/com_flexicontent/defineconstants.php';
     JTable::addIncludePath(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_flexicontent' . DS . 'tables');
     require_once JPATH_SITE . DS . 'components' . DS . 'com_flexicontent' . DS . 'helpers' . DS . 'permission.php';
     require_once JPATH_SITE . DS . "components/com_flexicontent/classes/flexicontent.fields.php";
     require_once JPATH_SITE . DS . "components/com_flexicontent/classes/flexicontent.helper.php";
     require_once JPATH_SITE . '/components/com_flexicontent/models/item.php';
     $app = JFactory::getApplication();
     $user = JFactory::getUser();
     $aid = FLEXI_J16GE ? $user->getAuthorisedViewLevels() : (int) $user->get('aid');
     $itemmodel = FLEXI_J16GE ? new FlexicontentModelItem() : new FlexicontentModelItems();
     for ($i = 0; $i < count($result); $i++) {
         $data[$i] = array();
         JFactory::$application = $siteapp;
         $item = $itemmodel->getItem($result[$i]['id'], $check_view_access = false);
         list($item) = FlexicontentFields::getFields($item, '', $item->parameters, $aid);
         JFactory::$application = $adminapp;
         $data[$i]['link'] = FlexicontentHelperRoute::getItemRoute($item->id, $item->catid);
         foreach ($item->fields as $k => $field) {
             $data[$i][$k] = FlexicontentFields::getFieldDisplay($item, $k, $values = null, $method = 'display');
         }
     }
     JFactory::$application = $adminapp;
     return $data;
 }
开发者ID:pguilford,项目名称:vcomcc,代码行数:68,代码来源:generator.php


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