本文整理汇总了PHP中FlexicontentFields类的典型用法代码示例。如果您正苦于以下问题:PHP FlexicontentFields类的具体用法?PHP FlexicontentFields怎么用?PHP FlexicontentFields使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FlexicontentFields类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
/**
* Creates the page's display
*
* @since 1.0
*/
function display($tpl = null)
{
$user = JFactory::getUser();
$aid = JAccess::getAuthorisedViewLevels($user->id);
// Get model
$model = $this->getModel();
// Get category and set category parameters as VIEW's parameters (category parameters are merged with component/page/author parameters already)
$category = $this->get('Category');
$params = $category->parameters;
// Get various data from the model
$items = $this->get('Data');
// Get field values
$_vars = null;
FlexicontentFields::getItemFields($items, $_vars, $_view = 'category', $aid);
// Zero unneeded search index text
foreach ($items as $item) {
$item->search_index = '';
}
// Use &test=1 to test / preview item data of first item
if (JRequest::getCmd('test', 0)) {
$item = reset($items);
echo "<pre>";
print_r($item);
exit;
}
// Output items in JSON FORMAT
echo @json_encode($items);
}
示例2: onDisplayFieldValue
function onDisplayFieldValue(&$field, $item, $values = null, $prop = 'display')
{
if (!in_array($field->field_type, self::$field_types)) {
return;
}
$field->label = JText::_($field->label);
$field->{$prop} = '';
$values = $values ? $values : $field->value;
if ($field->field_type == 'relation_reverse') {
$reverse_field = $field->parameters->get('reverse_field', 0);
if (!$reverse_field) {
$field->{$prop} = 'Field [id:' . $field->id . '] : ' . JText::_('FLEXI_FIELD_NO_FIELD_SELECTED');
return;
}
$_itemids_catids = null;
// Always ignore passed items, the DB query will determine the items
} else {
// Compatibility with old values, we no longer serialize all values to one, this way the field can be reversed !!!
$values = ($field_data = @unserialize($values)) ? $field_data : $field->value;
// No related items, just return empty display
if (!$values || !count($values)) {
return;
}
$_itemids_catids = array();
foreach ($values as $i => $val) {
list($itemid, $catid) = explode(":", $val);
$_itemids_catids[$itemid] = new stdClass();
$_itemids_catids[$itemid]->itemid = $itemid;
$_itemids_catids[$itemid]->catid = $catid;
$_itemids_catids[$itemid]->value = $val;
}
}
$field->{$prop} = FlexicontentFields::getItemsList($field->parameters, $_itemids_catids, $isform = 0, @$reverse_field, $field, $item);
}
示例3: display
function display($tpl = null)
{
$user = JFactory::getUser();
$dispatcher = JDispatcher::getInstance();
// Initialize some variables
$item =& $this->get('Item');
$params =& $item->parameters;
$fields =& $this->get('Extrafields');
$tags =& $item->tags;
$categories =& $item->categories;
$favourites = $item->favourites;
$favoured = $item->favoured;
// process the new plugins
JPluginHelper::importPlugin('content', 'image');
if (!FLEXI_J16GE) {
$dispatcher->trigger('onPrepareContent', array(&$item, &$params, 0));
} else {
$dispatcher->trigger('onContentPrepare', array('com_content.article', &$item, &$params, 0));
}
$document = JFactory::getDocument();
// set document information
$document->setTitle($item->title);
$document->setName($item->alias);
$document->setDescription($item->metadesc);
$document->setMetaData('keywords', $item->metakey);
// prepare header lines
$document->setHeader($this->_getHeaderText($item, $params));
$pdf_format_fields = trim($params->get("pdf_format_fields"));
$pdf_format_fields = !$pdf_format_fields ? array() : preg_split("/[\\s]*,[\\s]*/", $pdf_format_fields);
$methodnames = array();
foreach ($pdf_format_fields as $pdf_format_field) {
@(list($fieldname, $methodname) = preg_split("/[\\s]*:[\\s]*/", $pdf_format_field));
$methodnames[$fieldname] = empty($methodname) ? 'display' : $methodname;
}
// IF no fields set then just print the item's description text
if (!count($pdf_format_fields)) {
echo $item->text;
return;
}
foreach ($fields as $field) {
if (!isset($methodnames[$field->name])) {
continue;
}
if ($field->iscore) {
FlexicontentFields::loadFieldConfig($field, $item);
//$results = $dispatcher->trigger('onDisplayCoreFieldValue', array( &$field, $item, &$params, $tags, $categories, $favourites, $favoured ));
FLEXIUtilities::call_FC_Field_Func('core', 'onDisplayCoreFieldValue', array(&$field, $item, &$params, $tags, $categories, $favourites, $favoured));
} else {
//$results = $dispatcher->trigger('onDisplayFieldValue', array( &$field, $item ));
FLEXIUtilities::call_FC_Field_Func($field->field_type, 'onDisplayFieldValue', array(&$field, $item));
}
if (@$field->display) {
echo '<b>' . $field->label . '</b>: ';
echo $field->display . '<br /><br />';
}
}
}
示例4: countrows
/**
* count the rows
*
* @access public
* @return void
* @since 1.0
*/
function countrows()
{
$start_microtime = microtime(true);
// Check for request forgeries
//JRequest::checkToken() or jexit( 'Invalid Token' );
//$params = JComponentHelper::getParams( 'com_flexicontent' );
@ob_end_clean();
$indexer = JRequest::getVar('indexer', 'advanced');
$rebuildmode = JRequest::getVar('rebuildmode', '');
$session = JFactory::getSession();
// Retrieve fields, that are assigned as (advanced/basic) searchable/filterable
if ($rebuildmode == 'quick' && $indexer == 'advanced') {
$nse_fields = FlexicontentFields::getSearchFields('id', $indexer, null, null, $_load_params = false, 0, $search_type = 'non-search');
$nsp_fields = FlexicontentFields::getSearchFields('id', $indexer, null, null, $_load_params = false, 0, $search_type = 'dirty-nosupport');
$session->set($indexer . '_nse_fields', $nse_fields, 'flexicontent');
$session->set($indexer . '_nsp_fields', $nsp_fields, 'flexicontent');
$fields = FlexicontentFields::getSearchFields('id', $indexer, null, null, $_load_params = true, 0, $search_type = 'dirty-search');
} else {
$fields = FlexicontentFields::getSearchFields('id', $indexer, null, null, $_load_params = true, 0, $search_type = 'all-search');
}
// Get the field ids of the searchable fields
$fieldids = array_keys($fields);
// Get ids of searchable and ids of item having values for these fields
$itemsmodel = $this->getModel('items');
// Get items model to call needed methods
$itemids = $itemsmodel->getFieldsItems($fieldids);
// Get the items ids that have value for any of the searchable fields
// Set item ids into session to avoid recalculation ...
$session->set($indexer . '_items_to_index', $itemids, 'flexicontent');
// Set field information into session to avoid recalculation ...
$session->set($indexer . '_fields', $fields, 'flexicontent');
echo 'success';
//echo count($fieldids)*count($itemids).'|';
// WARNING: json_encode will output object if given an array with gaps in the indexing
//echo '|'.json_encode($itemids);
//echo '|'.json_encode($fieldids);
echo '|' . count($itemids);
echo '|' . count($fieldids);
$elapsed_microseconds = round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10;
$session->set($indexer . '_total_runtime', $elapsed_microseconds, 'flexicontent');
exit;
}
示例5:
$published = JHTML::image('administrator/components/com_flexicontent/assets/images/tick_f2.png', JText::_('FLEXI_NOT_AVAILABLE'), ' class="fc-man-icon-s" ');
} else {
if (!$canPublish && $row->published) {
// No privilige published
$published = JHTML::image('administrator/components/com_flexicontent/assets/images/tick_f2.png', JText::_('FLEXI_NOT_AVAILABLE'), ' class="fc-man-icon-s" ');
} else {
if (!$canPublish && !$row->published) {
// No privilige unpublished
$published = JHTML::image('administrator/components/com_flexicontent/assets/images/publish_x_f2.png', JText::_('FLEXI_NOT_AVAILABLE'), ' class="fc-man-icon-s" ');
} else {
$published = JHTML::_('jgrid.published', $row->published, $i, $ctrl);
}
}
}
//check which properties are supported by current field
$ft_support = FlexicontentFields::getPropertySupport($row->field_type, $row->iscore);
$supportsearch = $ft_support->supportsearch;
$supportfilter = $ft_support->supportfilter;
$supportadvsearch = $ft_support->supportadvsearch;
$supportadvfilter = $ft_support->supportadvfilter;
if ($row->issearch == 0 || $row->issearch == 1 || !$supportsearch) {
$search_dirty = 0;
$issearch = $row->issearch && $supportsearch ? "search.png" : "publish_x" . (!$supportsearch ? '_f2' : '') . ".png";
$issearch_tip = $row->issearch && $supportsearch ? $flexi_yes . ", " . $flexi_toggle : ($supportsearch ? $flexi_no . ", " . $flexi_toggle : $flexi_nosupport);
} else {
$search_dirty = 1;
$issearch = $row->issearch == -1 ? "disconnect.png" : "connect.png";
$issearch_tip = ($row->issearch == 2 ? $flexi_yes : $flexi_no) . ", " . $flexi_toggle . ", " . $flexi_rebuild;
}
$isfilter = $row->isfilter && $supportfilter ? "filter.png" : "publish_x" . (!$supportfilter ? '_f2' : '') . ".png";
$isfilter_tip = $row->isfilter && $supportfilter ? $flexi_yes . ", " . $flexi_toggle : ($supportsearch ? $flexi_no . ", " . $flexi_toggle : $flexi_nosupport);
示例6: onIndexSearch
function onIndexSearch(&$field, &$post, &$item)
{
if (!in_array($field->field_type, self::$field_types)) {
return;
}
if (!$field->issearch) {
return;
}
// a. Each of the values of $values array will be added to the basic search index (one record per item)
// b. If $values is null then the column value from table 'flexicontent_fields_item_relations' for current field / item pair will be used
// 'required_properties' is meant for multi-property fields, do not add to search index if any of these is empty
// 'search_properties' contains property fields that should be added as text
// 'properties_spacer' is the spacer for the 'search_properties' text
// 'filter_func' is the filtering function to apply to the final text
FlexicontentFields::onIndexSearch($field, $post, $item, $required_properties = array('title'), $search_properties = array('title', 'text'), $properties_spacer = ' ', $filter_func = 'strip_tags');
return true;
}
示例7: if
<div class="lineinfo image_descr">
<?php if ($this->params->get('intro_use_image', 1) && $src) : ?>
<figure class="image<?php echo $this->params->get('intro_position') ? ' right' : ' left'; ?>">
<?php if ($this->params->get('intro_link_image', 1)) : ?>
<a href="<?php echo JRoute::_(FlexicontentHelperRoute::getItemRoute($item->slug, $item->categoryslug, 0, $item)); ?>" class="hasTip" title="<?php echo JText::_( 'FLEXI_READ_MORE_ABOUT' ) . '::' . htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8'); ?>">
<img src="<?php echo $thumb; ?>" alt="<?php echo htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8'); ?>" />
</a>
<?php else : ?>
<img src="<?php echo $thumb; ?>" alt="<?php echo htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8'); ?>" />
<?php endif; ?>
</figure>
<?php endif; ?>
<p>
<?php
FlexicontentFields::getFieldDisplay($item, 'text', $values=null, $method='display');
if ($this->params->get('intro_strip_html', 1)) :
echo flexicontent_html::striptagsandcut( $item->fields['text']->display, $this->params->get('intro_cut_text', 200) );
else :
echo $item->fields['text']->display;
endif;
?>
</p>
</div>
<!-- BOF under-description-line1 block -->
<?php if (isset($item->positions['under-description-line1'])) : ?>
<div class="lineinfo line3">
<?php foreach ($item->positions['under-description-line1'] as $field) : ?>
<span class="element">
<?php if ($field->label) : ?>
示例8: 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');
flexicontent_html::loadFramework('jQuery');
flexicontent_html::loadFramework('flexi_tmpl_common');
// Add tooltips
示例9: _createDisplayHTML
private function _createDisplayHTML(&$field, &$item, &$grouped_fields, $custom_html, $max_count, $pretext, $posttext)
{
// ********************************
// Parse and identify custom fields
// ********************************
//return array('"<b>Custom HTML</b>" display for fieldgroup field, is not implemented yet, please use default HTML');
if (!$custom_html) {
return "Empty custom HTML variable for group field: " . $field->label;
}
$result = preg_match_all("/\\{\\{([a-zA-Z_0-9]+)(##)?([a-zA-Z_0-9]+)?\\}\\}/", $custom_html, $field_matches);
$gf_reps = $result ? $field_matches[0] : array();
$gf_names = $result ? $field_matches[1] : array();
$gf_methods = $result ? $field_matches[3] : array();
//foreach ($gf_names as $i => $gf_name)
// $parsed_fields[] = $gf_names[$i] . ($gf_methods[$i] ? "->". $gf_methods[$i] : "");
//echo "$custom_html :: Fields for Related Items List: ". implode(", ", $parsed_fields ? $parsed_fields : array() ) ."<br/>\n";
// ***********************************************************************
// Parse and identify language strings and then make language replacements
// ***********************************************************************
$result = preg_match_all("/\\%\\%([^%]+)\\%\\%/", $custom_html, $translate_matches);
$translate_strings = $result ? $translate_matches[1] : array('FLEXI_READ_MORE_ABOUT');
foreach ($translate_strings as $translate_string) {
$custom_html = str_replace('%%' . $translate_string . '%%', JText::_($translate_string), $custom_html);
}
// **************************************************************
// Render HTML of grouped fields mentioned inside the custom HTML
// **************************************************************
$_rendered_fields = array();
$found_names = array_flip($gf_names);
//print_r($gf_names);
if (count($gf_names)) {
$view = JRequest::getVar('flexi_callview', JRequest::getVar('view', FLEXI_ITEMVIEW));
$gf_props = array();
foreach ($grouped_fields as $grouped_field) {
if (!isset($found_names[$grouped_field->name])) {
continue;
}
$pos = $found_names[$grouped_field->name];
$_rendered_fields[$pos] = $grouped_field;
// Check if display method is 'label' aka nothing to render
if ($gf_methods[$pos] == 'label') {
continue;
}
// Check if display method of the field has been created already
$method = $gf_methods[$pos] ? $gf_methods[$pos] : 'display';
if (isset($grouped_field->{$method}) && is_array($grouped_field->{$method})) {
continue;
}
// Render the display method for the given field
$_values = $grouped_field->value;
$grouped_field->ingroup = 1;
// render as array
//echo 'Rendering: '. $grouped_field->name . ', method: ' . $method . '<br/>';
//FLEXIUtilities::call_FC_Field_Func($grouped_field->field_type, 'onDisplayFieldValue', array(&$grouped_field, $item, $_values, $method));
unset($grouped_field->{$method});
// Unset display variable to make sure display HTML it is created, because we reuse the field
FlexicontentFields::renderField($item, $grouped_field, $_values, $method, $view);
// Includes content plugins triggering
unset($grouped_field->ingroup);
}
}
// *******************************************************************
// Render the value list of the fieldgroup, using custom HTML for each
// value-set of the fieldgroup, and performing the field replacements
// *******************************************************************
$custom_display = array();
for ($n = 0; $n < $max_count; $n++) {
$rendered_html = $custom_html;
foreach ($_rendered_fields as $pos => $_rendered_field) {
$pos = $found_names[$_rendered_field->name];
$method = $gf_methods[$pos] ? $gf_methods[$pos] : 'display';
//echo 'Replacing: '. $_rendered_field->name . ', method: ' . $method . ', index: ' .$n. '<br/>';
$rendered_html = str_replace($gf_reps[$pos], @$_rendered_field->{$method}[$n], $rendered_html);
//unset($_rendered_field->{$method}); // Unset display of fields in case they need to be rendered again
}
$custom_display[$n] = $pretext . $rendered_html . $posttext;
}
return $custom_display;
}
示例10: display
function display($tpl = null)
{
//initialise variables
$app = JFactory::getApplication();
$document = JFactory::getDocument();
$cparams = JComponentHelper::getParams('com_flexicontent');
$user = JFactory::getUser();
//add css to document
$document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/flexicontentbackend.css');
if (FLEXI_J30GE) {
$document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j3x.css');
} else {
if (FLEXI_J16GE) {
$document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j25.css');
} else {
$document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j15.css');
}
}
//add js function to overload the joomla submitform
FLEXI_J30GE ? JHtml::_('behavior.framework', true) : JHTML::_('behavior.mootools');
JHTML::_('behavior.tooltip');
flexicontent_html::loadFramework('jQuery');
flexicontent_html::loadFramework('select2');
$document->addScript(JURI::root() . 'components/com_flexicontent/assets/js/admin.js');
$document->addScript(JURI::root() . 'components/com_flexicontent/assets/js/validate.js');
//Load pane behavior
jimport('joomla.html.pane');
//Import File system
jimport('joomla.filesystem.file');
//Get data from the model
$model = $this->getModel();
$row = $this->get('Field');
if (FLEXI_J16GE) {
$form = $this->get('Form');
}
$types = $this->get('Typeslist');
$typesselected = $this->get('Typesselected');
//create the toolbar
if ($row->id) {
JToolBarHelper::title(JText::_('FLEXI_EDIT_FIELD'), 'fieldedit');
} else {
JToolBarHelper::title(JText::_('FLEXI_ADD_FIELD'), 'fieldadd');
}
$ctrl = FLEXI_J16GE ? 'fields.' : '';
JToolBarHelper::apply($ctrl . 'apply');
JToolBarHelper::save($ctrl . 'save');
JToolBarHelper::custom($ctrl . 'saveandnew', 'savenew.png', 'savenew.png', 'FLEXI_SAVE_AND_NEW', false);
JToolBarHelper::cancel($ctrl . 'cancel');
// Import Joomla plugin that implements the type of current flexi field
JPluginHelper::importPlugin('flexicontent_fields', $row->iscore ? 'core' : $row->field_type);
// load plugin's english language file then override with current language file
$extension_name = 'plg_flexicontent_fields_' . ($row->iscore ? 'core' : $row->field_type);
JFactory::getLanguage()->load($extension_name, JPATH_ADMINISTRATOR, 'en-GB', true);
JFactory::getLanguage()->load($extension_name, JPATH_ADMINISTRATOR, null, true);
//check which properties are supported by current field
$ft_support = FlexicontentFields::getPropertySupport($row->field_type, $row->iscore);
$supportsearch = $ft_support->supportsearch;
$supportadvsearch = $ft_support->supportadvsearch;
$supportfilter = $ft_support->supportfilter;
$supportadvfilter = $ft_support->supportadvfilter;
$supportuntranslatable = $ft_support->supportuntranslatable;
$supportvalueseditable = $ft_support->supportvalueseditable;
$supportformhidden = $ft_support->supportformhidden;
$supportedithelp = $ft_support->supportedithelp;
//build selectlists, (for J1.6+ most of these are defined via XML file and custom form field classes)
$lists = array();
//build field_type list
if (!$row->field_type) {
$row->field_type = 'text';
}
if ($row->iscore == 1) {
$class = 'disabled="disabled"';
} else {
$class = '';
$_field_id = '#' . (FLEXI_J16GE ? 'jform_' : '') . 'field_type';
$_row_id = FLEXI_J16GE ? $form->getValue("id") : $row->id;
$_ctrl_task = FLEXI_J16GE ? 'task=fields.getfieldspecificproperties' : 'controller=fields&task=getfieldspecificproperties';
$document->addScriptDeclaration("\n\t\t\t\tjQuery(document).ready(function() {\n\t\t\t\t\tjQuery('" . $_field_id . "').on('change', function() {\n\t\t\t\t\t\tjQuery('#fieldspecificproperties').html('<p class=\"centerimg\"><img src=\"components/com_flexicontent/assets/images/ajax-loader.gif\" align=\"center\"></p>');\n\t\t\t\t\t\tjQuery.ajax({\n\t\t\t\t\t\t\ttype: \"GET\",\n\t\t\t\t\t\t\turl: 'index.php?option=com_flexicontent&" . $_ctrl_task . "&cid=" . $_row_id . "&field_type='+this.value+'&format=raw',\n\t\t\t\t\t\t\tsuccess: function(str) {\n\t\t\t\t\t\t\t\tjQuery('#fieldspecificproperties').html(str);\n\t\t\t\t\t\t\t\tvar JTooltips = new Tips(jQuery('#fieldspecificproperties .hasTip'), { maxTitleChars: 50, fixed: false});\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tjQuery('#field_typename').html(jQuery('" . $_field_id . "').val());\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t");
}
//build field select list
$lists['field_type'] = flexicontent_html::buildfieldtypeslist('field_type', $class, $row->field_type, $group = true);
//build type select list
$attribs = 'class="use_select2_lib" multiple="multiple" size="6"';
$attribs .= $row->iscore ? ' disabled="disabled"' : '';
$types_fieldname = FLEXI_J16GE ? 'jform[tid][]' : 'tid[]';
$lists['tid'] = flexicontent_html::buildtypesselect($types, $types_fieldname, $typesselected, false, $attribs);
// **************************************************************************
// Create fields for J1.5 (J2.5+ uses JForm XML file for most of form fields)
// **************************************************************************
if (!FLEXI_J16GE) {
//build formhidden selector
$formhidden[] = JHTML::_('select.option', 0, JText::_('FLEXI_NO'));
$formhidden[] = JHTML::_('select.option', 1, JText::_('FLEXI_FRONTEND'));
$formhidden[] = JHTML::_('select.option', 2, JText::_('FLEXI_BACKEND'));
$formhidden[] = JHTML::_('select.option', 3, JText::_('FLEXI_BOTH'));
$formhidden_fieldname = FLEXI_J16GE ? 'jform[formhidden]' : 'formhidden';
$lists['formhidden'] = JHTML::_('select.radiolist', $formhidden, $formhidden_fieldname, '', 'value', 'text', $row->formhidden);
if (FLEXI_ACCESS) {
$valueseditable[] = JHTML::_('select.option', 0, JText::_('FLEXI_ANY_EDITOR'));
$valueseditable[] = JHTML::_('select.option', 1, JText::_('FLEXI_USE_ACL_PERMISSION'));
//.........这里部分代码省略.........
示例11: onIndexSearch
function onIndexSearch(&$field, &$post, &$item)
{
if (!$field->iscore) {
return;
}
if (!$field->issearch) {
return;
}
$values = $this->_prepareForSearchIndexing($field, $post, $for_advsearch = 0);
// if post is null, indexer is running
$filter_func = $field->field_type == 'maintext' ? 'strip_tags' : null;
// 'isindexed' is not applicable for basic index and CORE fields
$field->isindexed = 0;
//in_array($field->field_type, array('type','state','tags','categories','created','createdby','modified','modifiedby'));
// if values is null means retrieve data from the DB
FlexicontentFields::onIndexSearch($field, $values, $item, $required_properties = array(), $search_properties = array(), $properties_spacer = ' ', $filter_func);
return true;
}
示例12: onIndexSearch
function onIndexSearch(&$field, &$post, &$item)
{
if (!$field->iscore) {
return;
}
if (!$field->issearch) {
return;
}
$values = $this->_prepareForSearchIndexing($field, $post, $for_advsearch = 0);
$filter_func = $field->field_type == 'maintext' ? 'strip_tags' : null;
FlexicontentFields::onIndexSearch($field, $values, $item, $required_properties = array(), $search_properties = array(), $properties_spacer = ' ', $filter_func);
return true;
}
示例13: _displayForm
//.........这里部分代码省略.........
} else {
JError::raiseError(403, $msg);
}
}
}
}
}
// *****************************************************************************
// Get (CORE & CUSTOM) fields and their VERSIONED values and then
// (a) Apply Content Type Customization to CORE fields (label, description, etc)
// (b) Create the edit html of the CUSTOM fields by triggering 'onDisplayField'
// *****************************************************************************
// Check if saving an item that translates an original content in site's default language
$site_default = substr(flexicontent_html::getSiteDefaultLang(), 0, 2);
$is_content_default_lang = $site_default == substr($item->language, 0, 2);
//$modify_untraslatable_values = $enable_translation_groups && !$is_content_default_lang; // && $item->lang_parent_id && $item->lang_parent_id!=$item->id;
if ($print_logging_info) {
$start_microtime = microtime(true);
}
$fields = $this->get('Extrafields');
$item->fields =& $fields;
if ($print_logging_info) {
$fc_run_times['get_field_vals'] = round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10;
}
if ($print_logging_info) {
$start_microtime = microtime(true);
}
$jcustom = $app->getUserState('com_flexicontent.edit.item.custom');
//print_r($jcustom);
foreach ($fields as $field) {
// a. Apply CONTENT TYPE customizations to CORE FIELDS, e.g a type specific label & description
// NOTE: the field parameters are already created so there is not need to call this for CUSTOM fields, which do not have CONTENT TYPE customizations
if ($field->iscore) {
FlexicontentFields::loadFieldConfig($field, $item);
}
// b. Create field 's editing HTML (the form field)
// NOTE: this is DONE only for CUSTOM fields, since form field html is created by the form for all CORE fields, EXCEPTION is the 'text' field (see bellow)
if (!$field->iscore) {
if (isset($jcustom[$field->name])) {
$field->value = array();
foreach ($jcustom[$field->name] as $i => $_val) {
$field->value[$i] = $_val;
}
}
$is_editable = !$field->valueseditable || $user->authorise('flexicontent.editfieldvalues', 'com_flexicontent.field.' . $field->id);
if ($is_editable) {
FLEXIUtilities::call_FC_Field_Func($field->field_type, 'onDisplayField', array(&$field, &$item));
if ($field->untranslatable) {
$field->html = '<div class="alert alert-info fc-small fc-iblock">' . JText::_('FLEXI_FIELD_VALUE_IS_NON_TRANSLATABLE') . '</div>' . "\n" . $field->html;
}
} else {
if ($field->valueseditable == 1) {
$field->html = '<div class="fc-mssg fc-note">' . JText::_($field->parameters->get('no_acc_msg_form') ? $field->parameters->get('no_acc_msg_form') : 'FLEXI_NO_ACCESS_LEVEL_TO_EDIT_FIELD') . '</div>';
} else {
if ($field->valueseditable == 2) {
FLEXIUtilities::call_FC_Field_Func($field->field_type, 'onDisplayFieldValue', array(&$field, $item));
$field->html = '<div class="fc-mssg fc-note">' . JText::_($field->parameters->get('no_acc_msg_form') ? $field->parameters->get('no_acc_msg_form') : 'FLEXI_NO_ACCESS_LEVEL_TO_EDIT_FIELD') . '</div>' . "\n" . $field->display;
} else {
if ($field->valueseditable == 3) {
FLEXIUtilities::call_FC_Field_Func($field->field_type, 'onDisplayFieldValue', array(&$field, $item));
$field->html = $field->display;
} else {
if ($field->valueseditable == 4) {
$field->html = '';
$field->formhidden = 4;
}
示例14: getItemThumbs
function getItemThumbs(&$params, &$items, $uprefix = 'item', $rprefix = 'nav')
{
if (!$params->get($uprefix . '_use_image', 1)) {
return array();
}
if (empty($items)) {
return array();
}
if ($params->get($uprefix . '_image')) {
$img_size_map = array('l' => 'large', 'm' => 'medium', 's' => 'small', 'o' => 'original');
$img_field_size = $img_size_map[$params->get($uprefix . '_image_size', 'l')];
$img_field_name = $params->get($uprefix . '_image');
}
if (!empty($img_field_name)) {
//$_return = FlexicontentFields::renderFields( false, array_keys($items), array($img_field_name), FLEXI_ITEMVIEW, array('display_'.$img_field_size.'_src'));
FlexicontentFields::getFieldDisplay($items, $img_field_name, $values = null, 'display_' . $img_field_size . '_src', FLEXI_ITEMVIEW);
}
$thumbs = array();
foreach ($items as $item_id => $item) {
if (!empty($img_field_name)) {
//$src = str_replace(JURI::root(), '', @ $_return[$item_id][$img_field_name] );
$img_field =& $item->fields[$img_field_name];
$src = str_replace(JURI::root(), '', @$img_field->{'display_' . $img_field_size . '_src'});
} else {
$src = flexicontent_html::extractimagesrc($item);
}
$RESIZE_FLAG = !$params->get($uprefix . '_image') || !$params->get($uprefix . '_image_size');
if ($src && $RESIZE_FLAG) {
// Resize image when src path is set and RESIZE_FLAG: (a) using image extracted from item main text OR (b) not using image field's already created thumbnails
$w = '&w=' . $params->get($rprefix . '_width', 200);
$h = '&h=' . $params->get($rprefix . '_height', 200);
$aoe = '&aoe=1';
$q = '&q=95';
$zc = $params->get($rprefix . '_method') ? '&zc=' . $params->get($rprefix . '_method') : '';
$ext = strtolower(pathinfo($src, PATHINFO_EXTENSION));
$f = in_array($ext, array('png', 'ico', 'gif')) ? '&f=' . $ext : '';
$conf = $w . $h . $aoe . $q . $zc . $f;
$base_url = !preg_match("#^http|^https|^ftp|^/#i", $src) ? JURI::base(true) . '/' : '';
$thumb = JURI::base(true) . '/components/com_flexicontent/librairies/phpthumb/phpThumb.php?src=' . $base_url . $src . $conf;
} else {
// Do not resize image when (a) image src path not set or (b) using image field's already created thumbnails
$thumb = $src;
}
if ($thumb) {
$thumbs[$item_id] = $thumb;
}
}
return $thumbs;
}
示例15: display
function display($tpl = null)
{
//initialise variables
$app = JFactory::getApplication();
$option = JRequest::getVar('option');
$document = JFactory::getDocument();
$cparams = JComponentHelper::getParams('com_flexicontent');
$user = JFactory::getUser();
//add css to document
$document->addStyleSheetVersion(JURI::base(true) . '/components/com_flexicontent/assets/css/flexicontentbackend.css', FLEXI_VHASH);
$document->addStyleSheetVersion(JURI::base(true) . '/components/com_flexicontent/assets/css/j3x.css', FLEXI_VHASH);
// Add JS frameworks
flexicontent_html::loadFramework('select2');
// Add js function to overload the joomla submitform validation
JHTML::_('behavior.formvalidation');
// load default validation JS to make sure it is overriden
$document->addScriptVersion(JURI::root(true) . '/components/com_flexicontent/assets/js/admin.js', FLEXI_VHASH);
$document->addScriptVersion(JURI::root(true) . '/components/com_flexicontent/assets/js/validate.js', FLEXI_VHASH);
//Load pane behavior
jimport('joomla.html.pane');
//Import File system
jimport('joomla.filesystem.file');
//Get data from the model
$model = $this->getModel();
$row = $this->get('Field');
$form = $this->get('Form');
$types = $this->get('Typeslist');
$typesselected = $this->get('Typesselected');
//create the toolbar
if ($row->id) {
JToolBarHelper::title(JText::_('FLEXI_EDIT_FIELD'), 'fieldedit');
} else {
JToolBarHelper::title(JText::_('FLEXI_ADD_FIELD'), 'fieldadd');
}
$ctrl = FLEXI_J16GE ? 'fields.' : '';
JToolBarHelper::apply($ctrl . 'apply');
JToolBarHelper::save($ctrl . 'save');
JToolBarHelper::custom($ctrl . 'saveandnew', 'savenew.png', 'savenew.png', 'FLEXI_SAVE_AND_NEW', false);
JToolBarHelper::cancel($ctrl . 'cancel');
// Import Joomla plugin that implements the type of current flexi field
$extfolder = 'flexicontent_fields';
$extname = $row->iscore ? 'core' : $row->field_type;
JPluginHelper::importPlugin('flexicontent_fields', $row->iscore ? 'core' : $row->field_type);
// Create class name of the plugin and then create a plugin instance
$classname = 'plg' . ucfirst($extfolder) . $extname;
// Check max allowed version
if (property_exists($classname, 'prior_to_version')) {
// Set a system message with warning of failed PHP limits
$prior_to_version = $app->getUserStateFromRequest($option . '.flexicontent.prior_to_version_' . $row->field_type, 'prior_to_version_' . $row->field_type, 0, 'int');
$app->setUserState($option . '.flexicontent.prior_to_version_' . $row->field_type, $prior_to_version + 1);
if ($prior_to_version < 2) {
$close_btn = FLEXI_J30GE ? '<a class="close" data-dismiss="alert">×</a>' : '<a class="fc-close" onclick="this.parentNode.parentNode.removeChild(this.parentNode);">×</a>';
$manifest_path = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_flexicontent' . DS . 'manifest.xml';
$com_xml = JApplicationHelper::parseXMLInstallFile($manifest_path);
$ver_exceeded = version_compare(str_replace(' ', '.', $com_xml['version']), str_replace(' ', '.', $classname::$prior_to_version), '>=');
if ($ver_exceeded) {
echo '
<span class="fc-note fc-mssg-inline">
' . $close_btn . '
Warning: installed version of Field: \'<b>' . $extname . '</b>\' was given to be free for FLEXIcontent versions prior to: v' . $classname::$prior_to_version . ' <br/> It may or may not work properly in later versions
</span>';
} else {
echo '
<span class="fc-info fc-mssg-inline">
' . $close_btn . '
Note: installed version of Field: \'<b>' . $extname . '</b>\' is given free for FLEXIcontent versions prior to: v' . $classname::$prior_to_version . ', nevertheless it will continue to function after FLEXIcontent is upgraded.
</span>';
}
}
}
// load plugin's english language file then override with current language file
$extension_name = 'plg_flexicontent_fields_' . ($row->iscore ? 'core' : $row->field_type);
JFactory::getLanguage()->load($extension_name, JPATH_ADMINISTRATOR, 'en-GB', true);
JFactory::getLanguage()->load($extension_name, JPATH_ADMINISTRATOR, null, true);
//check which properties are supported by current field
$ft_support = FlexicontentFields::getPropertySupport($row->field_type, $row->iscore);
$supportsearch = $ft_support->supportsearch;
$supportadvsearch = $ft_support->supportadvsearch;
$supportfilter = $ft_support->supportfilter;
$supportadvfilter = $ft_support->supportadvfilter;
$supportuntranslatable = $ft_support->supportuntranslatable;
$supportvalueseditable = $ft_support->supportvalueseditable;
$supportformhidden = $ft_support->supportformhidden;
$supportedithelp = $ft_support->supportedithelp;
//build selectlists, (for J1.6+ most of these are defined via XML file and custom form field classes)
$lists = array();
//build field_type list
if (!$row->field_type) {
$row->field_type = 'text';
}
$_attribs = ' class="use_select2_lib fc_skip_highlight" ';
if ($row->iscore == 1) {
$_attribs .= ' disabled="disabled" ';
} else {
$_field_id = 'jform_field_type';
$_row_id = $form->getValue("id");
$_ctrl_task = 'task=fields.getfieldspecificproperties';
$document->addScriptDeclaration("\n\t\t\t\tjQuery(document).ready(function() {\n\t\t\t\t\tjQuery('#" . $_field_id . "').on('change', function() {\n\t\t\t\t\t\tjQuery('#fieldspecificproperties').html('<p class=\"centerimg\"><img src=\"components/com_flexicontent/assets/images/ajax-loader.gif\" align=\"center\"></p>');\n\t\t\t\t\t\tjQuery.ajax({\n\t\t\t\t\t\t\ttype: \"GET\",\n\t\t\t\t\t\t\turl: 'index.php?option=com_flexicontent&" . $_ctrl_task . "&cid=" . $_row_id . "&field_type='+this.value+'&format=raw',\n\t\t\t\t\t\t\tsuccess: function(str) {\n\t\t\t\t\t\t\t\tjQuery('#fieldspecificproperties').html(str);\n\t\t\t\t\t\t\t\t" . (FLEXI_J30GE ? "\n\t\t\t\t\t\t\t\t\tjQuery('.hasTooltip').tooltip({'html': true,'container': jQuery('#fieldspecificproperties')});\n\t\t\t\t\t\t\t\t" : "\n\t\t\t\t\t\t\t\tvar tipped_elements = jQuery('#fieldspecificproperties .hasTip');\n\t\t\t\t\t\t\t\ttipped_elements.each(function() {\n\t\t\t\t\t\t\t\t\tvar title = this.get('title');\n\t\t\t\t\t\t\t\t\tif (title) {\n\t\t\t\t\t\t\t\t\t\tvar parts = title.split('::', 2);\n\t\t\t\t\t\t\t\t\t\tthis.store('tip:title', parts[0]);\n\t\t\t\t\t\t\t\t\t\tthis.store('tip:text', parts[1]);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\tvar ajax_JTooltips = new Tips(\$('fieldspecificproperties').getElements('.hasTip'), { maxTitleChars: 50, fixed: false});\n\t\t\t\t\t\t\t\t") . "\n\t\t\t\t\t\t\t\ttabberAutomatic(tabberOptions, 'fieldspecificproperties');\n\t\t\t\t\t\t\t\tfc_bindFormDependencies('#fieldspecificproperties', 0, '');\n\t\t\t\t\t\t\t\tjQuery('#field_typename').html(jQuery('#" . $_field_id . "').val());\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t");
}
//build field select list
//.........这里部分代码省略.........