本文整理汇总了PHP中FlexicontentFields::getItemsList方法的典型用法代码示例。如果您正苦于以下问题:PHP FlexicontentFields::getItemsList方法的具体用法?PHP FlexicontentFields::getItemsList怎么用?PHP FlexicontentFields::getItemsList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FlexicontentFields
的用法示例。
在下文中一共展示了FlexicontentFields::getItemsList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例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;
$show_total_only = $field->parameters->get('show_total_only', 0);
$total_show_auto_btn = $field->parameters->get('total_show_auto_btn', 0);
$total_show_list = $field->parameters->get('total_show_list', 0);
// *******************************************
// Check for special display : total info only
// *******************************************
if ($prop == 'display_total') {
$display_total = true;
} else {
if ($show_total_only == 1 || $show_total_only == 2 && count($values)) {
$app = JFactory::getApplication();
$view = JRequest::getVar('view');
$option = JRequest::getVar('option');
$isItemsManager = $app->isAdmin() && $view == 'items' && $option == 'com_flexicontent';
$total_in_view = $field->parameters->get('total_in_view', array('backend'));
$total_in_view = FLEXIUtilities::paramToArray($total_in_view);
$display_total = $isItemsManager && in_array('backend', $total_in_view) || in_array($view, $total_in_view);
} else {
$display_total = false;
}
}
// ***********************************************************
// Create total info and terminate if not adding the item list
// ***********************************************************
if ($display_total) {
$total_append_text = $field->parameters->get('total_append_text', '');
$field->{$prop} .= '<span class="fcrelation_field_total">' . count($values) . ' ' . $total_append_text . '</span>';
// Terminate if not adding any extra information
if (!$total_show_list && !$total_show_auto_btn) {
return;
}
// Override the item list HTML parameter ...
$total_relitem_html = $field->parameters->get('total_relitem_html', '');
if ($total_relitem_html) {
$field->parameters->set('relitem_html', $total_relitem_html);
}
}
// ***********************************************************
// Prepare item list data for rendering the related items list
// ***********************************************************
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;
}
}
// **********************************************
// Create the submit button for auto related item
// **********************************************
$auto_relate_curritem = $field->parameters->get('auto_relate_curritem', 0);
$auto_relate_menu_itemid = $field->parameters->get('auto_relate_menu_itemid', 0);
$auto_relate_position = $field->parameters->get('auto_relate_position', 0);
$auto_rel_btn = '';
if ($auto_relate_curritem && $auto_relate_menu_itemid && (!$display_total || $total_show_auto_btn)) {
$_submit_text = $field->parameters->get('auto_relate_submit_text', 'FLEXI_ADD_RELATED');
$_show_to_unauth = $field->parameters->get('auto_relate_show_to_unauth', 0);
$auto_relations[0] = new stdClass();
$auto_relations[0]->itemid = $item->id;
$auto_relations[0]->fieldid = $field->id;
$category = null;
$auto_rel_btn = flexicontent_html::addbutton($field->parameters, $category, $auto_relate_menu_itemid, $_submit_text, $auto_relations, $_show_to_unauth);
}
// *****************************
// Finally, create the item list
// *****************************
if (!$display_total || $total_show_list) {
$add_before = $auto_rel_btn && ($auto_relate_position == 0 || $auto_relate_position == 2);
$add_after = $auto_rel_btn && ($auto_relate_position == 1 || $auto_relate_position == 2);
$field->{$prop} .= '' . ($add_before ? $auto_rel_btn : '') . FlexicontentFields::getItemsList($field->parameters, $_itemids_catids, $isform = 0, @$reverse_field, $field, $item) . ($add_after ? $auto_rel_btn : '');
} else {
if ($auto_rel_btn) {
$field->{$prop} .= $auto_rel_btn;
}
}
//.........这里部分代码省略.........