?> </td> <td style="text-align:right; width:24px;"> <?php echo @$row->category ? isset($row->category->positions) ? '<a href="' . $catlink . '">' . $editMultiple . '</a>' : $noeditlayout : ''; ?> </td> <td style="text-align: left"> <?php if ($defaulttitle_cat) { ?> <span data-placement="top" class="<?php echo $tip_class; ?> " title="<?php echo flexicontent_html::getToolTip('', $description_cat, 1, 1); ?> " > <?php echo JText::_($defaulttitle_cat); ?> </span> <?php } ?> </td> </tr> <?php $k = 1 - $k; $i++; }
echo $item->is_active_item ? 'fcitem_active' : ''; ?> " > <?php if ($add_tooltips) { ?> <a href="<?php echo $item->link; ?> " class="fcitem_link <?php echo $tooltip_class; ?> " title="<?php echo flexicontent_html::getToolTip($item->fulltitle, $item->text, 0, 1); ?> "> <?php echo $item->title; ?> </a> <?php } else { ?> <a href="<?php echo $item->link; ?> "><?php echo $item->title; ?>
<div class="nowrap_box inlinefile-lang-box"> <label class="label inlinefile-lang-lbl ' . $tip_class . '" title="' . flexicontent_html::getToolTip('FLEXI_LANGUAGE', 'FLEXI_FILE_LANGUAGE_DESC', 1, 1) . '" id="' . $elementid_n . '_file-lang-lbl" for="' . $elementid_n . '_file-lang"> ' . JText::_('FLEXI_LANGUAGE') . ' </label> <span class="inlinefile-lang-data"> ' . flexicontent_html::buildlanguageslist($fieldname_n . '[file-lang]', 'class="fc_filelang use_select2_lib"', !isset($form_data[$file_id]) ? $file_data->language : $form_data[$file_id]['file-lang'], 1) . ' </span> </div>' : '') . ($iform_desc ? ' <div class="nowrap_box inlinefile-desc-box"> <label class="label inlinefile-desc-lbl ' . $tip_class . '" title="' . flexicontent_html::getToolTip('FLEXI_DESCRIPTION', 'FLEXI_FILE_DESCRIPTION_DESC', 1, 1) . '" id="' . $elementid_n . '_file-desc-lbl" for="' . $elementid_n . '_file-desc"> ' . JText::_('FLEXI_DESCRIPTION') . ' </label> <span class="inlinefile-desc-data"> <textarea id="' . $elementid_n . '_file-desc" cols="24" rows="3" name="' . $fieldname_n . '[file-desc]" class="fc_filedesc">' . (!isset($form_data[$file_id]) ? $file_data->description : $form_data[$file_id]['file-desc']) . '</textarea> </span> </div>' : '') . ($iform_dir ? ' <div class="nowrap_box inlinefile-secure-box"> <label class="label inlinefile-secure-lbl ' . $tip_class . '" data-placement="top" title="' . flexicontent_html::getToolTip('FLEXI_URL_SECURE', 'FLEXI_URL_SECURE_DESC', 1, 1) . '" id="' . $elementid_n . '_secure-lbl"> ' . JText::_('FLEXI_URL_SECURE') . ' </label> ' . ($has_values ? ' <span class="inlinefile-secure-info" style="' . (!$has_values ? 'display:none;' : '') . '"> <span class="badge badge-info">' . JText::_($file_data->secure ? 'FLEXI_YES' : 'FLEXI_NO') . '</span> </span>' : '') . ' <span class="inlinefile-secure-data" style="' . ($has_values ? 'display:none;' : '') . '"> ' . flexicontent_html::buildradiochecklist(array(1 => JText::_('FLEXI_YES'), 0 => JText::_('FLEXI_NO')), $fieldname_n . '[secure]', !isset($form_data[$file_id]) ? 1 : (int) $form_data[$file_id]['secure'], 0, ' class="fc_filedir" ', $elementid_n . '_secure') . ' </span> </div>' : '') . ' <div class="fcclear"></div>'; $n++; }
<img src="' . $field->prevThumb . '" alt="Previous"/> ' : '') . ' </a> </span>'; } else { $html .= ' <span class="fc-pagenav-prev"> <span class="btn disabled"> <i class="icon-previous"></i> ' . htmlspecialchars($prev_label, ENT_NOQUOTES, 'UTF-8') . ' </span> </span>'; } // Previous item linking if ($field->next) { $tooltip = $use_tooltip ? ' title="' . flexicontent_html::getToolTip($tooltip_title_next, $field->nexttitle, 0) . '"' : ''; $html .= ' <span class="fc-pagenav-next' . ($use_tooltip ? $tooltip_class : '') . '" ' . ($use_tooltip ? $tooltip : '') . '> <a class="btn" href="' . $field->nexturl . '"> <i class="icon-next"></i> ' . ($use_title ? $field->nexttitle : htmlspecialchars($next_label, ENT_NOQUOTES, 'UTF-8')) . ' ' . ($field->nextThumb ? ' <br/> <img src="' . $field->nextThumb . '" alt="Next"/> ' : '') . ' </a> </span>'; } else { $html .= ' <span class="fc-pagenav-next"> <span class="btn disabled">
function getUploadLimitsTxt(&$field) { $tip_class = FLEXI_J30GE ? ' hasTooltip' : ' hasTip'; $hint_image = JHTML::image('components/com_flexicontent/assets/images/comment.png', JText::_('FLEXI_NOTES'), ''); $upload_maxsize = $field->parameters->get('upload_maxsize'); $phpUploadLimit = flexicontent_upload::getPHPuploadLimit(); $server_limit_exceeded = $phpUploadLimit['value'] < $upload_maxsize; if ($server_limit_exceeded) { $warn_image = JHTML::image('components/com_flexicontent/assets/images/warning.png', JText::_('FLEXI_NOTES'), ''); } $conf_limit_class = $server_limit_exceeded ? '' : 'badge-success'; $conf_limit_style = $server_limit_exceeded ? 'text-decoration: line-through;' : ''; $conf_lim_image = $server_limit_exceeded ? $warn_image . $hint_image : $hint_image; $sys_limit_class = $server_limit_exceeded ? 'badge-important' : ''; return ' <span class="fc-img-field-upload-limits-box"> <span class="label label-info fc-upload-box-lbl">' . JText::_($server_limit_exceeded ? 'FLEXI_UPLOAD_LIMITS' : 'FLEXI_UPLOAD_LIMIT') . '</span> <span class="fc-php-upload-limit-box"> <span class="' . $tip_class . '" style="margin-left:24px;" title="' . flexicontent_html::getToolTip('FLEXI_FIELD_CONF_UPLOAD_MAX_LIMIT', 'FLEXI_FIELD_CONF_UPLOAD_MAX_LIMIT_DESC', 1, 1) . '">' . $conf_lim_image . '</span> <span class="badge ' . $conf_limit_class . '" style="' . $conf_limit_style . '">' . round($upload_maxsize / (1024 * 1024), 2) . ' M </span> </span> ' . ($server_limit_exceeded ? ' <span class="fc-sys-upload-limit-box"> <span class="' . $tip_class . '" style="margin-left:24px;" title="' . flexicontent_html::getToolTip(JText::_('FLEXI_SERVER_UPLOAD_MAX_LIMIT'), JText::sprintf('FLEXI_SERVER_UPLOAD_MAX_LIMIT_DESC', $phpUploadLimit['name']), 0, 1) . '">' . $hint_image . '</span> <span class="badge ' . $sys_limit_class . '">' . round($phpUploadLimit['value'] / (1024 * 1024), 2) . ' M </span> </span>' : '') . ' </span> '; }
continue; } } // Check if 'Description' field will NOT be placed via fields manager placement/ordering, // but instead it will be inside a custom TAB or inside the 'Description' TAB (default) if ($field->field_type == 'maintext' && isset($all_tab_fields['text'])) { ob_start(); } // Decide label classes, tooltip, etc $lbl_class = 'label'; $lbl_title = ''; // field has tooltip $edithelp = $field->edithelp ? $field->edithelp : 1; if ($field->description && ($edithelp == 1 || $edithelp == 2)) { $lbl_class .= ($edithelp == 2 ? ' fc_tooltip_icon ' : ' ') . $tip_class; $lbl_title = flexicontent_html::getToolTip(trim($field->label, ':'), $field->description, 0, 1); } // field is required $required = $field->parameters->get('required', 0); if ($required) { $lbl_class .= ' required'; } // Some fields may force a container width ? $display_label_form = $field->parameters->get('display_label_form', 1); $row_k = 1 - $row_k; $full_width = $display_label_form == 0 || $display_label_form == 2 || $display_label_form == -1; $width = $field->parameters->get('container_width', $full_width ? '100%!important;' : false); $container_width = empty($width) ? '' : 'width:' . $width . ($width != (int) $width ? 'px!important;' : ''); $container_class = "fcfield_row" . $row_k . " container_fcfield container_fcfield_id_" . $field->id . " container_fcfield_name_" . $field->name; ?>
function onDisplayField(&$field, &$item) { if (!in_array($field->field_type, self::$field_types)) { return; } // Check max allowed version $manifest_path = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_flexicontent' . DS . 'manifest.xml'; $com_xml = JApplicationHelper::parseXMLInstallFile($manifest_path); if (version_compare(str_replace(' ', '.', $com_xml['version']), str_replace(' ', '.', self::$prior_to_version), '>=')) { echo ' <span class="fc-note fc-nobgimage fc-mssg"> Warning: installed version of Field: \'<b>' . $field->field_type . '</b>\' was meant for FLEXIcontent versions prior to: v' . self::$prior_to_version . ' <br/> It may or may not work properly in later versions<br/> </span>'; } $field->label = JText::_($field->label); $use_ingroup = 0; // Field grouped should not be recursively grouped if ($use_ingroup) { $field->formhidden = 3; } if ($use_ingroup && empty($field->ingroup)) { return; } $compact_edit = $field->parameters->get('compact_edit', 0); // initialize framework objects and other variables $document = JFactory::getDocument(); $db = JFactory::getDBO(); $tooltip_class = FLEXI_J30GE ? 'hasTooltip' : 'hasTip'; // **************** // Number of values // **************** $multiple = $use_ingroup || (int) $field->parameters->get('allow_multiple', 0); $max_values = $use_ingroup ? 0 : (int) $field->parameters->get('max_values', 0); $required = $field->parameters->get('required', 0); $required = $required ? ' required' : ''; $add_position = (int) $field->parameters->get('add_position', 3); // ************** // Value handling // ************** // Get fields belonging to this field group $grouped_fields = $this->getGroupFields($field); // Get values of fields making sure that also empty values are created too $max_count = 1; $this->getGroupFieldsValues($grouped_fields, $item, $max_count); // Render Form HTML of the field foreach ($grouped_fields as $field_id => $grouped_field) { for ($n = count($grouped_field->value); $n < $max_count; $n++) { $grouped_field->value[$n] = null; } $grouped_field->ingroup = 1; $grouped_field->item_id = $item->id; FLEXIUtilities::call_FC_Field_Func($grouped_field->field_type, 'onDisplayField', array(&$grouped_field, &$item)); unset($grouped_field->ingroup); } $js = ""; $css = ""; if ($multiple) { // Add the drag and drop sorting feature if (!$use_ingroup) { $js .= "\n\t\t\tjQuery(document).ready(function(){\n\t\t\t\tjQuery('#sortables_" . $field->id . "').sortable({\n\t\t\t\t\thandle: '.fcfield-drag-handle',\n\t\t\t\t\tcontainment: 'parent',\n\t\t\t\t\ttolerance: 'pointer'\n\t\t\t\t});\n\t\t\t});\n\t\t\t"; } $js .= "\n\t\t\tjQuery(document).ready(function(){" . ($compact_edit == 2 ? "jQuery('#sortables_" . $field->id . "').find('.toggle_group_down').trigger('click');" : "") . ($compact_edit == 1 ? "jQuery('#sortables_" . $field->id . "').find('.toggle_group_up').trigger('click');" : "") . "});\n\t\t\t"; if ($max_values) { FLEXI_J16GE ? JText::script("FLEXI_FIELD_MAX_ALLOWED_VALUES_REACHED", true) : fcjsJText::script("FLEXI_FIELD_MAX_ALLOWED_VALUES_REACHED", true); } $js .= "\n\t\t\tvar uniqueRowNum" . $field->id . "\t= " . $max_count . "; // Unique row number incremented only\n\t\t\tvar rowCount" . $field->id . "\t= " . $max_count . "; // Counts existing rows to be able to limit a max number of values\n\t\t\tvar maxValues" . $field->id . " = " . $max_values . ";\n\t\t\t"; // Create function call for add/deleting Field values $addField_pattern = "\n\t\t\t\tvar fieldval_box = groupval_box.find('.fcfieldval_container__GRP_FID_');\n\t\t\t\tfieldval_box.find('.invalid').removeClass('invalid').attr('aria-invalid', 'false');\n\t\t\t\tvar newSubLabel = fieldval_box.prev('label.sub_label');\n\t\t\t\tvar newLabelFor = 'custom_%s_'+uniqueRowNum" . $field->id . ";\n\t\t\t\tnewSubLabel.attr('for', newLabelFor);\n\t\t\t\tnewSubLabel.attr('for_bck', newLabelFor);\n\t\t\t\tfcflabels[ newLabelFor ] = newSubLabel;\n\t\t\t\taddField_GRP_FID_(null, groupval_box, groupval_box.find('.fcfieldval_container__GRP_FID_'), add_params);"; $delField_pattern = "\n\t\t\t\tif(rowCount" . $field->id . " == 1)\n\t\t\t\t{\n\t\t\t\t\t// We need to update the current grouped label of the field if this was the last element being re-added\n\t\t\t\t\tvar fieldval_box = groupval_box.find('.fcfieldval_container__GRP_FID_');\n\t\t\t\t\tfieldval_box.find('.invalid').removeClass('invalid').attr('aria-invalid', 'false');\n\t\t\t\t\tvar newSubLabel = fieldval_box.prev('label.sub_label');\n\t\t\t\t\tvar newLabelFor = 'custom_%s_'+uniqueRowNum" . $field->id . ";\n\t\t\t\t\tnewSubLabel.attr('for', newLabelFor);\n\t\t\t\t\tnewSubLabel.attr('for_bck', newLabelFor);\n\t\t\t\t\tfcflabels[ newLabelFor ] = newSubLabel;\n\t\t\t\t}\n\t\t\t\tdeleteField_GRP_FID_(null, groupval_box, groupval_box.find('.fcfieldval_container__GRP_FID_'));\n\t\t\t\t"; $addField_funcs = $delField_funcs = ''; foreach ($grouped_fields as $field_id => $grouped_field) { $addField_funcs .= str_replace("_GRP_FID_", $grouped_field->id, sprintf($addField_pattern, $grouped_field->name)); $delField_funcs .= str_replace("_GRP_FID_", $grouped_field->id, sprintf($delField_pattern, $grouped_field->name)); } $js .= "\n\t\t\tfunction addField" . $field->id . "(el, groupval_box, fieldval_box, params)\n\t\t\t{\n\t\t\t\tvar insert_before = (typeof params!== 'undefined' && typeof params.insert_before !== 'undefined') ? params.insert_before : 0;\n\t\t\t\tvar remove_previous = (typeof params!== 'undefined' && typeof params.remove_previous !== 'undefined') ? params.remove_previous : 0;\n\t\t\t\tvar scroll_visible = (typeof params!== 'undefined' && typeof params.scroll_visible !== 'undefined') ? params.scroll_visible : 1;\n\t\t\t\tvar animate_visible = (typeof params!== 'undefined' && typeof params.animate_visible !== 'undefined') ? params.animate_visible : 1;\n\t\t\t\t\n\t\t\t\tif((rowCount" . $field->id . " >= maxValues" . $field->id . ") && (maxValues" . $field->id . " != 0)) {\n\t\t\t\t\talert(Joomla.JText._('FLEXI_FIELD_MAX_ALLOWED_VALUES_REACHED') + maxValues" . $field->id . ");\n\t\t\t\t\treturn 'cancel';\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// Find last container of fields and clone it to create a new container of fields\n\t\t\t\tvar lastField = fieldval_box ? fieldval_box : jQuery(el).prev().children().last();\n\t\t\t\tvar newField = lastField.clone();\n\t\t\t\t\n\t\t\t\t// Need to at least change FORM field names and HTML tag IDs before adding the container to the DOM\n\t\t\t\tvar theSet = newField.find('input, select');\n\t\t\t\tvar nr = 0;\n\t\t\t\ttheSet.each(function() {\n\t\t\t\t\tvar elem = jQuery(this);\n\t\t\t\t\telem.attr('name', '_duplicated_" . $field->id . "_'+uniqueRowNum" . $field->id . "+'_'+nr);\n\t\t\t\t\telem.attr('id', '_duplicated_" . $field->id . "_'+uniqueRowNum" . $field->id . "+'_'+nr);\n\t\t\t\t\tnr++;\n\t\t\t\t});\n\t\t\t\t"; // Add new field to DOM $js .= "\n\t\t\t\tlastField ?\n\t\t\t\t\t(insert_before ? newField.insertBefore( lastField ) : newField.insertAfter( lastField ) ) :\n\t\t\t\t\tnewField.appendTo( jQuery('#sortables_" . $field->id . "') ) ;\n\t\t\t\t"; // Add new element to sortable objects (if field not in group) if (!$use_ingroup) { $js .= "\n\t\t\t\tjQuery('#sortables_" . $field->id . "').sortable({\n\t\t\t\t\thandle: '.fcfield-drag-handle',\n\t\t\t\t\tcontainment: 'parent',\n\t\t\t\t\ttolerance: 'pointer'\n\t\t\t\t});\n\t\t\t\t\n\t\t\t\t// Add new values for each field\n\t\t\t\tvar groupval_box = newField;\n\t\t\t\tvar add_params = {remove_previous: 1, scroll_visible: 0, animate_visible: 0};\n\t\t\t\t" . $addField_funcs . "\n\t\t\t\t"; } // Readd prettyCheckable and remove previous if so requested $js .= "\n\t\t\t\tif (remove_previous) lastField.remove();\n\t\t\t\t"; // Show new field, increment counters $js .= "\n\t\t\t\t//newField.fadeOut({ duration: 400, easing: 'swing' }).fadeIn({ duration: 200, easing: 'swing' });\n\t\t\t\tif (scroll_visible) fc_scrollIntoView(newField, 1);\n\t\t\t\tif (animate_visible) newField.css({opacity: 0.1}).animate({ opacity: 1 }, 800);\n\t\t\t\t\n\t\t\t\t// Enable tooltips on new element\n\t\t\t\tnewField.find('.hasTooltip').tooltip({'html': true,'container': newField});\n\t\t\t\t\n\t\t\t\trowCount" . $field->id . "++; // incremented / decremented\n\t\t\t\tuniqueRowNum" . $field->id . "++; // incremented only\n\t\t\t}\n\n\t\t\tfunction deleteField" . $field->id . "(el)\n\t\t\t{\n\t\t\t\tvar row = jQuery(el).closest('li');\n\t\t\t\t\n\t\t\t\t// Do cleanup by calling the deleteField of each individual field, these functions will re-add last element as empty if needed\n\t\t\t\tvar groupval_box = jQuery(el).closest('li');\n\t\t\t\t" . $delField_funcs . "\n\t\t\t\tif(rowCount" . $field->id . " == 1)\n\t\t\t\t{\n\t\t\t\t\tuniqueRowNum" . $field->id . "++; // increment unique row id, since last group was re-added\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// Also remove the group field values container if not last one\n\t\t\t\tif(rowCount" . $field->id . " > 1) {\n\t\t\t\t\t// Destroy the remove/add/etc buttons, so that they are not reclicked, while we do the hide effect (before DOM removal of field value)\n\t\t\t\t\trow.find('.fcfield-delvalue').remove();\n\t\t\t\t\trow.find('.fcfield-insertvalue').remove();\n\t\t\t\t\trow.find('.fcfield-drag-handle').remove();\n\t\t\t\t\t// Do hide effect then remove from DOM\n\t\t\t\t\trow.fadeOut(420, function(){ this.remove(); });\n\t\t\t\t\trowCount" . $field->id . "--;\n\t\t\t\t}\n\t\t\t}\n\t\t\t"; $css .= ''; $remove_button = '<span class="fcfield-delvalue" title="' . JText::_('FLEXI_REMOVE_VALUE') . '" onclick="deleteField' . $field->id . '(this);"></span>'; $move2 = '<span class="fcfield-drag-handle" title="' . JText::_('FLEXI_CLICK_TO_DRAG') . '"></span>'; $add_here = ''; $add_here .= $add_position == 2 || $add_position == 3 ? '<span class="fcfield-insertvalue fc_before" onclick="addField' . $field->id . '(null, jQuery(this).closest(\'ul\'), jQuery(this).closest(\'li\'), {insert_before: 1});" title="' . JText::_('FLEXI_ADD_BEFORE') . '"></span> ' : ''; $add_here .= $add_position == 1 || $add_position == 3 ? '<span class="fcfield-insertvalue fc_after" onclick="addField' . $field->id . '(null, jQuery(this).closest(\'ul\'), jQuery(this).closest(\'li\'), {insert_before: 0});" title="' . JText::_('FLEXI_ADD_AFTER') . '"></span> ' : ''; if ($compact_edit) { $add_here .= ' <button class="toggle_group_down btn btn-small btn-success" style="' . ($compact_edit == 2 ? 'display:none;' : '') . ' min-width: 120px;" onclick="fc_toggle_box_via_btn(jQuery(this).closest(\'li\').find(\'.fcfieldval_container_outer:not(.fcAlwaysVisibleField)\'), this, \'\', jQuery(this).next(), 1); return false;"> <i class="icon-downarrow"></i>' . JText::_('FLEXI_FIELD_GROUP_EDIT_DETAILS') . ' </button> <button class="toggle_group_up btn btn-small" style="' . ($compact_edit == 1 ? 'display:none;' : '') . ' min-width: 120px;" onclick="fc_toggle_box_via_btn(jQuery(this).closest(\'li\').find(\'.fcfieldval_container_outer:not(.fcAlwaysVisibleField)\'), this, \'\', jQuery(this).prev(), 0); return false;"> <i class="icon-uparrow"></i>' . JText::_('FLEXI_FIELD_GROUP_HIDE_DETAILS') . ' </button> '; } } else { $remove_button = ''; $move2 = ''; $add_here = ''; $js .= ''; $css .= ''; } if ($js) { $document->addScriptDeclaration($js); } if ($css) { $document->addStyleDeclaration($css); } $close_btn = FLEXI_J30GE ? '<a class="close" data-dismiss="alert">×</a>' : '<a class="fc-close" onclick="this.parentNode.parentNode.removeChild(this.parentNode);">×</a>'; $alert_box = FLEXI_J30GE ? '<div %s class="alert alert-%s %s">' . $close_btn . '%s</div>' : '<div %s class="fc-mssg fc-%s %s">' . $close_btn . '%s</div>'; if ($compact_edit) { $compact_edit_excluded = $field->parameters->get('compact_edit_excluded', array()); if (empty($compact_edit_excluded)) { $compact_edit_excluded = array(); } if (!is_array($compact_edit_excluded)) { $compact_edit_excluded = preg_split("/[\\|,]/", $compact_edit_excluded); } $compact_edit_excluded = array_flip($compact_edit_excluded); } $field->html = array(); for ($n = 0; $n < $max_count; $n++) { $field->html[$n] = ' ' . ($use_ingroup ? '' : $move2) . ' ' . ($use_ingroup ? '' : $remove_button) . ' ' . ($use_ingroup || !$add_position ? '' : $add_here) . ' '; // Append item-form display HTML of the every field in the group $i = 0; foreach ($grouped_fields as $field_id => $grouped_field) { $lbl_class = 'flexi label sub_label'; $lbl_title = ''; // field has tooltip $edithelp = $grouped_field->edithelp ? $grouped_field->edithelp : 1; if ($grouped_field->description && ($edithelp == 1 || $edithelp == 2)) { $lbl_class .= ($edithelp == 2 ? ' fc_tooltip_icon ' : ' ') . $tooltip_class; $lbl_title = flexicontent_html::getToolTip(trim($field->label, ':'), $grouped_field->description, 0, 1); } $field->html[$n] .= '<div class="fcclear"></div> <div class="fcfieldval_container_outer' . ($compact_edit && isset($compact_edit_excluded[$field_id]) ? ' fcAlwaysVisibleField' : '') . '"> <label class="' . $lbl_class . '" title="' . $lbl_title . '" for="custom_' . $grouped_field->name . '_' . $n . '" for_bck="custom_' . $grouped_field->name . '_' . $n . '">' . $grouped_field->label . '</label> <div class="fcfieldval_container valuebox fcfieldval_container_' . $grouped_field->id . ' container_fcfield_name_' . $grouped_field->name . '" > ' . ($grouped_field->description && $edithelp == 3 ? sprintf($alert_box, '', 'info', 'fc-nobgimage', $grouped_field->description) : '') . ' ' . @$grouped_field->html[$n] . ' </div> </div> '; $i++; } if (!$multiple) { break; } // multiple values disabled, break out of the loop, not adding further values even if the exist } // Non value HTML $non_value_html = ''; foreach ($grouped_fields as $field_id => $grouped_field) { $non_value_html .= @$grouped_field->html[-1]; } // Implode form HTML as a list $list_classes = "fcfield-sortables"; $list_classes .= " fcfield-group"; if (count($field->html)) { $field->html = '<li class="fcfieldval_container valuebox fcfieldval_container_' . $field->id . ' container_fcfield_name_' . $field->name . '">' . implode('</li><li class="fcfieldval_container valuebox fcfieldval_container_' . $field->id . ' container_fcfield_name_' . $field->name . '">', $field->html) . '</li>'; $field->html = '<div id="sortables_outer_' . $field->id . '"><ul class="' . $list_classes . '" id="sortables_' . $field->id . '">' . $field->html . '</ul></div>'; } else { $field->html = ''; } if (!$add_position) { $field->html .= '<span class="fcfield-addvalue fccleared" onclick="addField' . $field->id . '(this);" title="' . JText::_('FLEXI_ADD_TO_BOTTOM') . '"></span>'; } // Append non value html of fields $field->html = ($field->parameters->get('compact_edit_global', 0) ? ' <div class="toggle_all_values_buttons_box"> <span id="sortables_' . $field->id . '_btn" class="btn" onclick="fc_toggle_box_via_btn(jQuery(\'#sortables_outer_' . $field->id . '\'), this, \'\', jQuery(this).next(), 0); return false;"> <i class="icon-uparrow"></i>' . JText::_('FLEXI_FIELD_GROUP_HIDE_VALUES') . ' </span> <span id="sortables_' . $field->id . '_btn" class="btn btn-success" onclick="fc_toggle_box_via_btn(jQuery(\'#sortables_outer_' . $field->id . '\'), this, \'\', jQuery(this).prev(), 1); return false;" style="display:none;"> <i class="icon-downarrow"></i>' . JText::_('FLEXI_FIELD_GROUP_SHOW_VALUES') . ' </span> </div> ' : '') . ' ' . $field->html . ($non_value_html ? ' <div class="fcclear"></div>' . $non_value_html : ''); }
function getInput() { $node =& $this->element; $attributes = get_object_vars($node->attributes()); $attributes = $attributes['@attributes']; $values = $this->value; if (!is_array($values)) { $values = explode("|", $values); } $fieldname = $this->name; $element_id = $this->id; $name = $attributes['name']; $control_name = str_replace($name, '', $element_id); //$attribs = ' style="float:left;" '; $attribs = array('id' => $element_id, 'list.attr' => array(), 'list.translate' => false, 'option.key' => 'value', 'option.text' => 'text', 'option.attr' => 'attr', 'list.select' => $values); if (@$attributes['multiple'] == 'multiple' || @$attributes['multiple'] == 'true') { $attribs['list.attr']['multiple'] = 'multiple'; $attribs['list.attr']['size'] = @$attributes['size'] ? $attributes['size'] : "6"; } // HTML Tag parameters if ($onchange = @$attributes['onchange']) { $onchange = str_replace('{control_name}', $control_name, $onchange); $attribs['list.attr']['onchange'] = $onchange; } $subtype = @$attributes['subtype']; $attribs['list.attr']['class'] = array(); if ($subtype == 'radio') { $attribs['list.attr']['class'][] = 'radio'; } if ($class = @$attributes['class']) { $attribs['list.attr']['class'][] = $class; } if (@$attributes['fccustom_revert']) { $attribs['list.attr']['class'][] = 'fccustom_revert'; } if (@$attributes['toggle_related']) { $attribs['list.attr']['class'][] = 'fcform_toggler_element'; } $attribs['list.attr']['class'] = implode($attribs['list.attr']['class'], ' '); // Construct an array of the HTML OPTION statements. $options = array(); foreach ($node->children() as $option) { $name = FLEXI_J30GE ? $option->getName() : $option->name(); //echo "<pre>"; print_r($option); echo "</pre>"; exit; // Check for current option is a GROUP and add its START if ($name == "group") { $options[] = JHTML::_('select.optgroup', JText::_($option->attributes()->label)); } // If current option is group then iterrate through its children, otherwise create single value array $children = $name == "group" ? $option->children() : array(&$option); foreach ($children as $sub_option) { $attr_arr = array(); if (isset($sub_option->attributes()->seton_list)) { $attr_arr['seton_list'] = $sub_option->attributes()->seton_list; } if (isset($sub_option->attributes()->setoff_list)) { $attr_arr['setoff_list'] = $sub_option->attributes()->setoff_list; } if (isset($sub_option->attributes()->refsh_list)) { $attr_arr['refsh_list'] = $sub_option->attributes()->refsh_list; } if (isset($sub_option->attributes()->force_list)) { $attr_arr['force_list'] = $sub_option->attributes()->force_list; } if (isset($sub_option->attributes()->show_list)) { $attr_arr['show_list'] = $sub_option->attributes()->show_list; } if (isset($sub_option->attributes()->hide_list)) { $attr_arr['hide_list'] = $sub_option->attributes()->hide_list; } if (isset($sub_option->attributes()->fcconfigs)) { $attr_arr['fcconfigs'] = $sub_option->attributes()->fcconfigs; } if (isset($sub_option->attributes()->fcreadonly)) { $attr_arr['fcreadonly'] = $sub_option->attributes()->fcreadonly; } if (isset($sub_option->attributes()->class)) { $attr_arr['class'] = $sub_option->attributes()->class; } $val = $sub_option->attributes()->value; $text = FLEXI_J30GE ? $sub_option->__toString() : $sub_option->data(); //$options[] = JHTML::_('select.option', $val, JText::_($text)); $options[] = array('value' => $val, 'text' => JText::_($text), 'attr' => $attr_arr); } // Check for current option is a GROUP and add its END if ($name == "group") { $options[] = JHTML::_('select.optgroup', ''); } } /* support for parameter multi-value, multi-parameter dependencies in non-FLEXIcontent views */ static $js_added = false; if (!$js_added) { $js_added = true; $doc = JFactory::getDocument(); $doc->addScript(JURI::root(true) . '/components/com_flexicontent/assets/js/flexi-lib.js'); if (JRequest::getCmd('option') != 'com_flexicontent') { $js = "\n\t\t\t\tjQuery(document).ready(function(){\n\t\t\t\t\t" . (FLEXI_J30GE ? "fc_bindFormDependencies('body', 2, '.control-group');" : "fc_bindFormDependencies('body', 1, 'li');") . "\n\t\t\t\t});\n\t\t\t\t"; $doc->addScriptDeclaration($js); } } if ($subtype == 'radio') { $_class = ' class ="' . $attribs['list.attr']['class'] . '"'; $_id = ' id="' . $element_id . '"'; $html = ''; foreach ($options as $i => $option) { $selected = count($values) && $values[0] == $option['value'] ? ' checked="checked"' : ''; $input_attribs = ''; $label_class = ''; foreach ($option['attr'] as $k => $v) { if ($k == 'class') { $label_class = $v; continue; } $input_attribs .= ' ' . $k . '="' . $v . '"'; } $html .= ' <input id="' . $element_id . $i . '" type="radio" value="' . $option['value'] . '" name="' . $fieldname . '" ' . $input_attribs . $selected . '/> <label class="' . $label_class . '" for="' . $element_id . $i . '" value="' . $option['text'] . '"> ' . $option['text'] . ' </label>'; } $html = ' <fieldset ' . $_class . $_id . '> ' . $html . ' </fieldset> '; } else { $html = JHTML::_('select.genericlist', $options, $fieldname, $attribs); } if ($inline_tip = @$attributes['inline_tip']) { $tip_img = @$attributes['tip_img']; $tip_img = $tip_img ? $tip_img : 'comment.png'; $preview_img = @$attributes['preview_img']; $preview_img = $preview_img ? $preview_img : ''; $tip_class = @$attributes['tip_class']; $tip_class .= FLEXI_J30GE ? ' hasTooltip' : ' hasTip'; $hintmage = JHTML::image('administrator/components/com_flexicontent/assets/images/' . $tip_img, JText::_('FLEXI_NOTES'), ' align="left" style="max-height:24px; padding:0px; margin-left:12px; margin-right:0px;" '); $previewimage = $preview_img ? JHTML::image('administrator/components/com_flexicontent/assets/images/' . $preview_img, JText::_('FLEXI_NOTES'), ' align="left" style="max-height:24px; padding:0px; margin:0px;" ') : ''; $tip_text = '<span class="' . $tip_class . '" style="float:left;" title="' . flexicontent_html::getToolTip(null, $inline_tip, 1, 1) . '">' . $hintmage . $previewimage . '</span>'; } if ($inline_tip = @$attributes['inline_tip2']) { $tip_img = @$attributes['tip_img2']; $tip_img = $tip_img ? $tip_img : 'comment.png'; $preview_img = @$attributes['preview_img2']; $preview_img = $preview_img ? $preview_img : ''; $tip_class = @$attributes['tip_class2']; $tip_class .= FLEXI_J30GE ? ' hasTooltip' : ' hasTip'; $hintmage = JHTML::image('administrator/components/com_flexicontent/assets/images/' . $tip_img, JText::_('FLEXI_NOTES'), ' align="left" style="max-height:24px; padding:0px; margin-left:12px; margin-right:0px;" '); $previewimage = $preview_img ? JHTML::image('administrator/components/com_flexicontent/assets/images/' . $preview_img, JText::_('FLEXI_NOTES'), ' align="left" style="max-height:24px; padding:0px; margin:0px;" ') : ''; $tip_text2 = '<span class="' . $tip_class . '" style="float:left;" title="' . flexicontent_html::getToolTip(null, $inline_tip, 1, 1) . '">' . $hintmage . $previewimage . '</span>'; } return $html . @$tip_text . @$tip_text2; }
/** * Method to build the Joomfish languages list * * @return object * @since 1.5 */ static function buildstateslist($name, $attribs, $selected, $displaytype = 1, $tagid = null) { static $state_names = null; static $state_descrs = null; static $state_imgs = null; if (!$state_names) { $state_names = array(1 => JText::_('FLEXI_PUBLISHED'), -5 => JText::_('FLEXI_IN_PROGRESS'), 0 => JText::_('FLEXI_UNPUBLISHED'), -3 => JText::_('FLEXI_PENDING'), -4 => JText::_('FLEXI_TO_WRITE'), 2 => JText::_('FLEXI_ARCHIVED'), -2 => JText::_('FLEXI_TRASHED'), '' => JText::_('FLEXI_UNKNOWN')); $state_descrs = array(1 => JText::_('FLEXI_PUBLISH_THIS_ITEM'), -5 => JText::_('FLEXI_SET_STATE_AS_IN_PROGRESS'), 0 => JText::_('FLEXI_UNPUBLISH_THIS_ITEM'), -3 => JText::_('FLEXI_SET_STATE_AS_PENDING'), -4 => JText::_('FLEXI_SET_STATE_AS_TO_WRITE'), 2 => JText::_('FLEXI_ARCHIVE_THIS_ITEM'), -2 => JText::_('FLEXI_TRASH_THIS_ITEM'), '' => 'FLEXI_UNKNOWN'); $state_imgs = array(1 => 'tick.png', -5 => 'publish_g.png', 0 => 'publish_x.png', -3 => 'publish_r.png', -4 => 'publish_y.png', 2 => 'archive.png', -2 => 'trash.png', '' => 'unknown.png'); } $state[] = JHTML::_('select.option', '', JText::_(!is_numeric($displaytype) && is_string($displaytype) ? $displaytype : 'FLEXI_DO_NOT_CHANGE')); $state[] = JHTML::_('select.option', -4, $state_names[-4]); $state[] = JHTML::_('select.option', -3, $state_names[-3]); $state[] = JHTML::_('select.option', -5, $state_names[-5]); $state[] = JHTML::_('select.option', 1, $state_names[1]); $state[] = JHTML::_('select.option', 0, $state_names[0]); $state[] = JHTML::_('select.option', 2, $state_names[2]); $state[] = JHTML::_('select.option', -2, $state_names[-2]); $tagid = $tagid ? $tagid : str_replace('[', '_', preg_replace('#\\]|\\[\\]#', '', $name)); if ($displaytype == 1 || !is_numeric($displaytype) && is_string($displaytype)) { $list = JHTML::_('select.genericlist', $state, $name, $attribs, 'value', 'text', $selected, $tagid); } else { if ($displaytype == 2) { $state_ids = array(1, -5, 0, -3, -4); // published: 1, -5 unpublished: 0, -3, -4 $state_ids[] = 2; // archived $state_ids[] = -2; // trashed $state_colors = array(1 => 'darkgreen', -5 => 'darkgreen', 0 => 'darkred', -3 => 'darkred', -4 => 'darkred', 2 => 'darkblue', -2 => 'gray'); $img_path = JURI::root(true) . "/components/com_flexicontent/assets/images/"; $list = ''; $checked = $selected === '' ? ' checked="checked"' : ''; $list .= '<input id="state9999" type="radio" name="state" class="state" value="" ' . $checked . '/>'; $tooltip_class = FLEXI_J30GE ? ' hasTooltip' : ' hasTip'; $tooltip_title = flexicontent_html::getToolTip('FLEXI_USE_STATE_COLUMN', 'FLEXI_USE_STATE_COLUMN_TIP', 1, 1); $list .= '<label class="state_box' . $tooltip_class . '" for="state9999" title="' . $tooltip_title . '">'; $list .= JText::_('FLEXI_USE_STATE_COLUMN'); $list .= '</label>'; foreach ($state_ids as $i => $state_id) { //if ($state_id==0 || $state_id==2) $list .= "<br/>"; $checked = $state_id == $selected ? ' checked="checked"' : ''; $list .= '<input id="state' . $state_id . '" type="radio" name="state" class="state" value="' . $state_id . '" ' . $checked . '/>'; $list .= '<label class="state_box" for="state' . $state_id . '" title="' . $state_names[$state_id] . '" style="color:' . $state_colors[$state_id] . ';">'; $list .= $state_names[$state_id]; //$list .= '<img src="'.$img_path.$state_imgs[$state_id].'" width="16" height="16" style="border-width:0;" alt="'.$state_names[$state_id].'" />'; $list .= '</label>'; } } else { $list = 'Bad type in buildstateslist()'; } } return $list; }
?> </th> <th class="left"> <?php echo JHtml::_('grid.sort', 'COM_USERS_HEADING_ASSET_NAME', 'a.name', $listDirn, $listOrder); ?> </th> <?php foreach ($this->actions as $key => $action) { ?> <th width="5%"> <span class="<?php echo $tip_class; ?> " title="<?php echo flexicontent_html::getToolTip(JText::_($key), JText::_($action[1]), 0, 1); ?> "> <?php echo JText::_($key); ?> </span> </th> <?php } ?> <th class="nowrap" width="5%"> <?php echo JHtml::_('grid.sort', 'COM_USERS_HEADING_LFT', 'a.lft', $listDirn, $listOrder); ?> </th>
<td align="center"><?php echo $row->access_level; ?> </td> <td align="center" class="col_lang"> <?php if (0 && !empty($row->lang) && !empty($this->langs->{$row->lang}->imgsrc)) { ?> <img class="<?php echo $tip_class; ?> " title="<?php echo flexicontent_html::getToolTip(JText::_('FLEXI_LANGUAGE'), $row->lang == '*' ? JText::_("All") : (!empty($row->lang) ? $this->langs->{$row->lang}->name : ''), 0, 1); ?> " src="<?php echo $this->langs->{$row->lang}->imgsrc; ?> " alt="<?php echo $row->lang; ?> " /> <?php } elseif (!empty($row->lang)) { ?> <?php echo $row->lang == '*' ? JText::_("All") : (!empty($row->lang) ? $this->langs->{$row->lang}->name : ''); ?>
</span> <div class="fcclear"></div> <?php foreach ($code_btn_lbls as $_posname => $btn_lbl) { ?> <span class="code_box <?php echo $_posname; ?> nowrap_box" style="display:none;" > <span class="btn <?php echo $tip_class; ?> " title="<?php echo flexicontent_html::getToolTip('Insert code', $code_btn_tips[$_posname], 0, 1); ?> " onclick="toggle_code_inputbox(this);"><span class="icon-eye"></span><?php echo JText::_($code_btn_lbls[$_posname]); ?> </span> <span class="nowrap_box" style="display:none; float:left; clear:both; margin:2px 0px 0px 0px;"> <div class="alert alert-warning" style="clear:both; margin:2px 0px 2px 0px;"><?php echo JText::_('FLEXI_COPY_CODE'); ?> </div> <div class="alert alert-info" style="clear:both; margin:2px 0px 2px 0px;"> <?php echo $code_btn_tips[$_posname]; ?>
$search_autocomplete = $params->get('search_autocomplete', 1); // Filters configuration $use_filters = $params->get('use_filters', 0) && $filters; $show_filter_labels = $params->get('show_filter_labels', 1); // a ZERO initial value of show_search_go ... is AUTO $show_search_go = $show_search_go || !$filter_autosubmit; // || $use_search; // Calculate needed flags $filter_instructions = $use_search || $use_filters ? $filter_instructions : 0; // Create instructions (tooltip or inline message) $legend_class = 'fc_legend_text'; $legend_tip = ''; if ($filter_instructions == 1) { $legend_class .= FLEXI_J30GE ? ' hasTooltip' : ' hasTip'; $legend_tip = ($use_search ? '<b>' . JText::_('FLEXI_TEXT_SEARCH') . '</b><br/>' . JText::_('FLEXI_TEXT_SEARCH_INFO') : '') . ($use_search || $use_filters ? '<br/><br/>' : '') . ($use_filters ? '<b>' . JText::_('FLEXI_FIELD_FILTERS') . '</b><br/>' . JText::_('FLEXI_FIELD_FILTERS_INFO') : ''); $legend_tip = flexicontent_html::getToolTip(null, $legend_tip, 0, 1); } else { if ($filter_instructions == 2) { $legend_inline = ($use_search ? '<strong>' . JText::_('FLEXI_TEXT_SEARCH') . '</strong><br/>' . JText::_('FLEXI_TEXT_SEARCH_INFO') : '') . ($use_search || $use_filters ? '<br/><br/>' : '') . ($use_filters ? '<strong>' . JText::_('FLEXI_FIELD_FILTERS') . '</strong><br/>' . JText::_('FLEXI_FIELD_FILTERS_INFO') : ''); } } if ($use_search || $use_filters) { /* BOF search and filters block */ if (!$params->get('disablecss', '')) { JFactory::getDocument()->addStyleSheet(JURI::root(true) . '/components/com_flexicontent/assets/css/flexi_filters.css'); } $searchphrase_selector = flexicontent_html::searchphrase_selector($params, $form_name); ?> <div id="<?php echo $form_id;
,'previous',true);" > <?php $img_path = JURI::base(true) . '/'; ?> <?php $handle_classes = 'mod_fc_item_handle' . ($item_handles_dir == 'horizontal' ? ' fc_scrollitem_h' : ' fc_scrollitem_v'); ?> <?php foreach ($list[$ord]['standard'] as $item) { ?> <?php $tip_html = ''; if ($item_handle_title == 1 || $item_handle_text == 1) { $tip_html = flexicontent_html::getToolTip($item_handle_title == 1 ? $item->title : null, $item_handle_text == 1 ? $item->text : null, 0, 1); } $classes = $handle_classes . ($tip_html ? $tooltip_class : ''); ?> <span class="<?php echo $classes; ?> " title="<?php echo $tip_html; ?> " > <img alt="" src="<?php echo @$item->image ? $item->image : $img_path . $mod_default_img_path; ?> " style="<?php echo 'width:' . $item_handle_width . 'px; height:' . $item_handle_height . 'px';
?> <a href="<?php echo $item_link; ?> " > <img src="<?php echo $thumb; ?> " alt="<?php echo $title_encoded; ?> " class="<?php echo $tooltip_class; ?> " title="<?php echo flexicontent_html::getToolTip($_read_more_about, $title_encoded, 0, 0); ?> "/> </a> <?php } else { ?> <img src="<?php echo $thumb; ?> " alt="<?php echo $title_encoded; ?> " title="<?php echo $title_encoded; ?>
* but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ defined('_JEXEC') or die('Restricted access'); $tip_class = FLEXI_J30GE ? ' hasTooltip' : ' hasTip'; $btn_class = FLEXI_J30GE ? 'btn' : 'fc_button fcsimple'; $start_text = '<span class="label">' . JText::_('FLEXI_COLUMNS', true) . '</span>'; $end_text = '<div class="icon-arrow-up-2" title="' . JText::_('FLEXI_HIDE') . '" style="cursor: pointer;" onclick="fc_toggle_box_via_btn(\\\'mainChooseColBox\\\', document.getElementById(\\\'fc_mainChooseColBox_btn\\\'), \\\'btn-primary\\\');"></div>'; flexicontent_html::jscode_to_showhide_table('mainChooseColBox', 'adminListTableFCtags', $start_text, $end_text); $edit_entry = JText::_('FLEXI_EDIT_TAG', true); $user = JFactory::getUser(); $cparams = JComponentHelper::getParams('com_flexicontent'); $autologin = ''; //$cparams->get('autoflogin', 1) ? '&fcu='.$user->username . '&fcp='.$user->password : ''; $attribs_preview = ' class="fc-man-icon-s ' . $tip_class . '" title="' . flexicontent_html::getToolTip('FLEXI_PREVIEW', 'FLEXI_DISPLAY_ENTRY_IN_FRONTEND_DESC', 1, 1) . '" '; $image_preview = JHTML::image('components/com_flexicontent/assets/images/' . 'monitor_go.png', JText::_('FLEXI_PREVIEW'), $attribs_preview); $list_total_cols = 8; ?> <script type="text/javascript"> // delete active filter function delFilter(name) { //if(window.console) window.console.log('Clearing filter:'+name); var myForm = jQuery('#adminForm'); var filter = jQuery('#'+name); if (filter.attr('type')=='checkbox') filter.checked = ''; else filter.val('');
function &getLimitedProps(&$field, &$item, $cascade_prompt = 'Please select above', $ajax = false, $i = 0) { // some parameter shortcuts $sql_mode = $field->parameters->get('sql_mode', 0); $field_elements = $field->parameters->get('field_elements'); $cascade_after = (int) $field->parameters->get('cascade_after', 0); if ($cascade_after) { $_valgrps = $ajax ? $field->valgrps : (isset($field->valgrps[$i]) ? $field->valgrps[$i] : null); if (empty($_valgrps)) { $elements = array(); if (!$ajax) { //$prompt = JHTML::_('select.option', (self::$valueIsArr ? '_field_selection_prompt_' : ''), $cascade_prompt, 'value', 'text', (self::$valueIsArr ? 'disabled' : null)); $prompt = (object) array('value' => self::$valueIsArr ? '_field_selection_prompt_' : '', 'text' => $cascade_prompt, 'disable' => self::$valueIsArr ? true : null, 'isprompt' => 'badge badge-info'); $elements = array($prompt); } return $elements; } } if ($sql_mode) { $and_clause = ''; if ($cascade_after) { // Filter out values not in the the value group, this is done by modifying the SQL query $db = JFactory::getDBO(); $_elements = array(); foreach ($_valgrps as &$vg) { $vg = $db->Quote($vg); } unset($vg); $and_clause = ' AND valgroup IN (' . implode(',', $_valgrps) . ')'; } $item_pros = true; $elements = FlexicontentFields::indexedField_getElements($field, $item, self::$extra_props, $item_pros, false, $and_clause); if (!is_array($elements)) { //$prompt = JHTML::_('select.option', (self::$valueIsArr ? '_field_selection_prompt_' : ''), JText::_('FLEXI_FIELD_INVALID_QUERY'), 'value', 'text', (self::$valueIsArr ? 'disabled' : null)); $prompt = (object) array('value' => self::$valueIsArr ? '_field_selection_prompt_' : '', 'text' => JText::_('FLEXI_FIELD_INVALID_QUERY'), 'disable' => self::$valueIsArr ? true : null, 'isprompt' => 'badge badge-important'); $elements = array($prompt); return $elements; } } else { $elements = FlexicontentFields::indexedField_getElements($field, $item, self::$extra_props); if (!is_array($elements)) { //$prompt = JHTML::_('select.option', (self::$valueIsArr ? '_field_selection_prompt_' : ''), JText::_('FLEXI_FIELD_INVALID_ELEMENTS'), 'value', 'text', (self::$valueIsArr ? 'disabled' : null)); $prompt = (object) array('value' => self::$valueIsArr ? '_field_selection_prompt_' : '', 'text' => JText::_('FLEXI_FIELD_INVALID_ELEMENTS'), 'disable' => self::$valueIsArr ? true : null, 'isprompt' => 'badge badge-important'); $elements = array($prompt); return $elements; } if ($cascade_after) { // Filter out values not in the the value group, this is done after the elements text is parsed $_elements = array(); $_valgrps = array_flip($_valgrps); foreach ($elements as $element) { if (isset($_valgrps[$element->valgroup])) { $_elements[$element->value] = $element; } } $elements = $_elements; } } if (empty($elements)) { //$prompt = JHTML::_('select.option', (self::$valueIsArr ? '_field_selection_prompt_' : ''), 'No data found', 'value', 'text', (self::$valueIsArr ? 'disabled' : null)); $prompt = (object) array('value' => self::$valueIsArr ? '_field_selection_prompt_' : '', 'text' => JText::_('FLEXI_FIELD_NO_DATA_FOUND'), 'disable' => self::$valueIsArr ? true : null, 'isprompt' => 'badge badge-warning'); $elements = array(0 => $prompt); return $elements; } else { $display_label_form = (int) $field->parameters->get('display_label_form', 1); $firstoptiontext = $display_label_form == -1 ? $field->label : JText::_($field->parameters->get('firstoptiontext', 'FLEXI_SELECT')); $usefirstoption = $display_label_form == -1 ? 1 : $field->parameters->get('usefirstoption', self::$isDropDown ? 1 : 0); if ($usefirstoption) { // Add selection prompt //prompt = JHTML::_('select.option', (self::$valueIsArr ? '_field_selection_prompt_' : ''), $firstoptiontext, 'value', 'text', (self::$valueIsArr ? 'disabled' : null)); $prompt = (object) array('value' => self::$valueIsArr ? '_field_selection_prompt_' : '', 'text' => $firstoptiontext, 'disable' => self::$valueIsArr ? true : null, 'isprompt' => 'badge badge-info'); array_unshift($elements, $prompt); } } if ($field->field_type == 'radioimage' || $field->field_type == 'checkboximage') { // image specific variables $form_vals_display = $field->parameters->get('form_vals_display', 1); // this field includes image but it can be more convenient/compact not to be display image in item form $imagedir = preg_replace('#^(/)*#', '', $field->parameters->get('imagedir')); $imgpath = JURI::root(true) . '/' . $imagedir; $imgfolder = JPATH_SITE . DS . $imagedir; foreach ($elements as $element) { if ($form_vals_display > 0 && !isset($element->image_html) && empty($element->isprompt)) { $element->image_html = file_exists($imgfolder . $element->image) ? '<img style="vertical-align:unset!important;" src="' . $imgpath . $element->image . '" alt="' . $element->text . '" />' : '[NOT found]: ' . $imgpath . $element->image; } if (!isset($element->label_tip)) { $element->label_tip = flexicontent_html::getToolTip(null, $element->text, 0, 1); } } } return $elements; }
function getInput() { $doc = JFactory::getDocument(); $db = JFactory::getDBO(); $cparams = JComponentHelper::getParams('com_flexicontent'); $node =& $this->element; $attributes = get_object_vars($node->attributes()); $attributes = $attributes['@attributes']; // ******************************************************************* // Option labels and option values (for the created SELECT form field) // ******************************************************************* $otext = (bool) @$attributes['fieldnameastext'] ? "CONCAT(label, ' [', `name`, ']')" : 'label'; $ovalue = (bool) @$attributes['fieldnameasvalue'] ? '`name`' : 'id'; // for old FC versions compatibility, second option must be like id // ********************************* // IS advanced filter / search FLAGs // ********************************* $and = ''; $isnotcore = (bool) @$attributes['isnotcore']; if ($isnotcore) { $and .= ' AND iscore = 0'; } $isadvsearch = (int) @$attributes['isadvsearch']; if ($isadvsearch) { $and .= ' AND isadvsearch=' . $isadvsearch; } $isadvfilter = (int) @$attributes['isadvfilter']; if ($isadvfilter) { $and .= ' AND isadvfilter=' . $isadvfilter; } // ******************************** // INCLUDE/EXCLUDE some field types // ******************************** $field_type = (string) @$attributes['field_type']; if ($field_type) { $field_type = explode(",", $field_type); foreach ($field_type as $i => $ft) { $field_type_quoted[$i] = $db->Quote($ft); } $and .= " AND field_type IN (" . implode(",", $field_type_quoted) . ")"; } $exclude_field_type = (string) @$attributes['exclude_field_type']; if ($exclude_field_type) { $exclude_field_type = explode(",", $exclude_field_type); foreach ($exclude_field_type as $i => $ft) { $exclude_field_type_quoted[$i] = $db->Quote($ft); } $and .= " AND field_type NOT IN (" . implode(",", $exclude_field_type_quoted) . ")"; } $orderable = (int) @$attributes['orderable']; if ($orderable) { $non_orderable1 = 'account_via_submit,authoritems,toolbar,file,image,groupmarker,fcpagenav,minigallery,weblink,extendedweblink,email,fcloadmodule'; $non_orderable2 = trim($cparams->get('non_orderable_types', '')); $non_orderable = $non_orderable1 . ($non_orderable2 ? ',' . $non_orderable2 : ''); $non_orderable = array_unique(explode(",", $non_orderable)); foreach ($non_orderable as $i => $ft) { $non_orderable_quoted[$i] = $db->Quote($ft); } $and .= " AND field_type NOT IN (" . implode(",", $non_orderable_quoted) . ")"; } // ************************** // Retrieve field data for DB // ************************** $query = 'SELECT ' . $ovalue . ' AS value, ' . $otext . ' AS text' . ' FROM #__flexicontent_fields' . ' WHERE published = 1' . $and . ' ORDER BY label ASC, id ASC'; $db->setQuery($query); $fields = $db->loadObjectList(); // *********************************** // Values, form field name and id, etc // *********************************** $values = $this->value; if (empty($values)) { $values = array(); } if (!is_array($values)) { $values = preg_split("/[\\|,]/", $values); } $fieldname = FLEXI_J16GE ? $this->name : $control_name . '[' . $name . ']'; $element_id = FLEXI_J16GE ? $this->id : $control_name . $name; $name = FLEXI_J16GE ? $attributes['name'] : $name; $control_name = FLEXI_J16GE ? str_replace($name, '', $element_id) : $control_name; // ******************************************* // HTML Tag parameters parameters, and styling // ******************************************* $attribs = ' style="float:left;" '; if (@$attributes['multiple'] == 'multiple' || @$attributes['multiple'] == 'true') { $attribs .= ' multiple="multiple" '; $attribs .= @$attributes['size'] ? ' size="' . $attributes['size'] . '" ' : ' size="6" '; $fieldname .= !FLEXI_J16GE ? "[]" : ""; // NOTE: this added automatically in J2.5 } else { if ((bool) @$attributes['display_useglobal']) { array_unshift($fields, JHTML::_('select.option', '', '- ' . JText::_('FLEXI_USE_GLOBAL') . ' -')); array_unshift($fields, JHTML::_('select.option', '0', '- ' . JText::_('FLEXI_NOT_SET') . ' -')); // Compatibility with older FC versions } else { $custom_prompt = @$attributes['custom_prompt']; $custom_prompt = $custom_prompt ? $custom_prompt : 'FLEXI_PLEASE_SELECT'; array_unshift($fields, JHTML::_('select.option', '0', '- ' . JText::_($custom_prompt) . ' -')); } } if ($class = @$attributes['class']) { $attribs .= 'class="' . $class . '"'; } if ($onchange = @$attributes['onchange']) { $onchange = str_replace('{control_name}', $control_name, $onchange); $attribs .= ' onchange="' . $onchange . '"'; } if ($inline_tip = @$attributes['inline_tip']) { $tip_img = @$attributes['tip_img']; $tip_img = $tip_img ? $tip_img : 'comment.png'; $preview_img = @$attributes['preview_img']; $preview_img = $preview_img ? $preview_img : ''; $tip_class = @$attributes['tip_class']; $tip_class .= FLEXI_J30GE ? ' hasTooltip' : ' hasTip'; $hintmage = JHTML::image('administrator/components/com_flexicontent/assets/images/' . $tip_img, JText::_('FLEXI_NOTES'), ' align="left" style="max-height:24px; padding:0px; margin-left:12px; margin-right:0px;" '); $previewimage = $preview_img ? JHTML::image('administrator/components/com_flexicontent/assets/images/' . $preview_img, JText::_('FLEXI_NOTES'), ' align="left" style="max-height:24px; padding:0px; margin:0px;" ') : ''; $tip_text = '<span class="' . $tip_class . '" style="float:left;" title="' . flexicontent_html::getToolTip(null, $inline_tip, 1, 1) . '">' . $hintmage . $previewimage . '</span>'; } // *********************** // Create the field's HTML // *********************** return JHTML::_('select.genericlist', $fields, $fieldname, $attribs, 'value', 'text', $values, $element_id) . @$tip_text; }
function onDisplayFieldValue(&$field, $item, $values = null, $prop = 'display') { if (!in_array($field->field_type, self::$field_types)) { return; } $field->label = JText::_($field->label); // Some variables $is_ingroup = !empty($field->ingroup); $use_ingroup = $field->parameters->get('use_ingroup', 0); $multiple = $use_ingroup || (int) $field->parameters->get('allow_multiple', 0); // Get field values $values = $values ? $values : $field->value; // Check for no values and not displaying ALL elements $display_all = $field->parameters->get('display_all', 0) && !$is_ingroup; // NOT supported inside fielgroup yet if (empty($values) && !$display_all) { if (!$is_ingroup) { $field->{$prop} = ''; $field->display_index = ''; } else { $field->{$prop} = array(); $field->display_index = array(); } return; } // Prefix - Suffix - Separator parameters, replacing other field values if found $remove_space = $field->parameters->get('remove_space', 0); $pretext = FlexicontentFields::replaceFieldValue($field, $item, $field->parameters->get('pretext', ''), 'pretext'); $posttext = FlexicontentFields::replaceFieldValue($field, $item, $field->parameters->get('posttext', ''), 'posttext'); $separatorf = $field->parameters->get('separatorf', 1); $opentag = FlexicontentFields::replaceFieldValue($field, $item, $field->parameters->get('opentag', ''), 'opentag'); $closetag = FlexicontentFields::replaceFieldValue($field, $item, $field->parameters->get('closetag', ''), 'closetag'); // Microdata (classify the field values for search engines) $itemprop = $field->parameters->get('microdata_itemprop'); if ($pretext) { $pretext = $remove_space ? $pretext : $pretext . ' '; } if ($posttext) { $posttext = $remove_space ? $posttext : ' ' . $posttext; } // Value creation $sql_mode = $field->parameters->get('sql_mode', 0); $field_elements = $field->parameters->get('field_elements', ''); $text_or_value = $field->parameters->get('text_or_value', 2); // image specific or image related variables $imagedir = preg_replace('#^(/)*#', '', $field->parameters->get('imagedir')); $imgpath = JURI::root(true) . '/' . $imagedir; $tooltip_class = FLEXI_J30GE ? 'hasTooltip' : 'hasTip'; switch ($separatorf) { case 0: $separatorf = ' '; break; case 1: $separatorf = '<br />'; break; case 2: $separatorf = ' | '; break; case 3: $separatorf = ', '; break; case 4: $separatorf = $closetag . $opentag; break; case 5: $separatorf = ''; break; default: $separatorf = ' '; break; } // Get indexed element values $elements = FlexicontentFields::indexedField_getElements($field, $item, self::$extra_props); if (!$elements) { if ($sql_mode) { $field->{$prop} = JText::_('FLEXI_FIELD_INVALID_QUERY'); } else { $field->{$prop} = JText::_('FLEXI_FIELD_INVALID_ELEMENTS'); } return; } // Check for no elements found if (empty($elements)) { $field->{$prop} = ''; $field->display_index = ''; return; } // Handle case of FORM fields that each value is an array of values // (e.g. selectmultiple, checkbox), and that multi-value input is also enabled // we make sure that values should be an array of arrays $values = $multiple && self::$valueIsArr ? $values : array($values); // Create display of field $field->{$prop} = array(); $display_index = array(); // Prepare for looping if (!$values) { $values = array(); } if ($display_all) { // non-selected value shortcuts $ns_pretext = FlexicontentFields::replaceFieldValue($field, $item, $field->parameters->get('ns_pretext', ''), 'ns_pretext'); $ns_posttext = FlexicontentFields::replaceFieldValue($field, $item, $field->parameters->get('ns_posttext', ''), 'ns_posttext'); $ns_pretext = $ns_pretext . '<span class="fc_field_unsused_val">'; $ns_posttext = '</span>' . $ns_posttext; $ns_pretext = $remove_space ? $ns_pretext : $ns_pretext . ' '; $ns_posttext = $remove_space ? $ns_posttext : ' ' . $ns_posttext; } foreach ($values as $value) { // Compatibility for serialized values if ($multiple && self::$valueIsArr) { if (is_array($value)) { } else { if (@unserialize($value) !== false || $value === 'b:0;') { $value = unserialize($value); } } } // Make sure value is an array if (!is_array($value)) { $value = strlen($value) ? array($value) : array(); } // Skip empty if not in field group if (!count($value) && !$is_ingroup) { continue; } $html = array(); $index = array(); // CASE a. Display ALL elements (selected and NON-selected) *** NOT supported inside fieldgroup YET if ($display_all) { // *** value is always an array we made sure above $indexes = array_flip($value); foreach ($elements as $val => $element) { if ($text_or_value == 0) { $disp = $element->value; } else { if ($text_or_value == 1) { $disp = $element->text; } else { $disp = '<img src="' . $imgpath . $element->image . '" class="' . $tooltip_class . '" title="' . flexicontent_html::getToolTip(null, $element->text, 0) . '" alt="' . $element->text . '" />'; } } if (isset($indexes[$val])) { $html[] = $pretext . $disp . $posttext; $index[] = $element->value; } else { $html[] = $ns_pretext . $disp . $ns_posttext; } } } else { foreach ($value as $v) { // Skip empty/invalid values but add empty display, if in field group $element = !strlen($v) ? false : @$elements[$v]; if (!$element) { if ($use_ingroup) { $html[] = ''; } continue; } if ($text_or_value == 0) { $disp = $element->value; } else { if ($text_or_value == 1) { $disp = $element->text; } else { $disp = '<img src="' . $imgpath . $element->image . '" class="' . $tooltip_class . '" title="' . flexicontent_html::getToolTip(null, $element->text, 0) . '" alt="' . $element->text . '" />'; } } $html[] = $pretext . $disp . $posttext; $index[] = $pretext . $element->value . $posttext; } } if ($multiple && self::$valueIsArr) { // For current array of values, apply values separator, and field 's opening / closing texts $field->{$prop}[] = !count($html) ? '' : $opentag . implode($separatorf, $html) . $closetag; $display_index[] = !count($html) ? '' : $opentag . implode($separatorf, $index) . $closetag; } else { // Done, there should not be more !!, since we handled an array of singular values $field->{$prop} = $html; $display_index = $index; break; } } // Add microdata to every group of values if field -- is -- in a field group if ($is_ingroup && $itemprop) { foreach ($field->{$prop} as $n => $disp_html) { $field->{$prop}[$n] = '<div style="display:inline" itemprop="' . $itemprop . '" >' . $field->{$prop}[$n] . '</div>'; } } // Do not convert the array to string if field is in a group, and do not add: FIELD's opetag, closetag, value separator if (!$is_ingroup) { if ($multiple && self::$valueIsArr) { // Values separator, field 's opening / closing texts, were already applied for every array of values $field->{$prop} = implode("", $field->{$prop}); $field->display_index = implode("", $display_index); } else { // Apply values separator, and field 's opening / closing texts $field->{$prop} = !count($field->{$prop}) ? '' : $opentag . implode($separatorf, $field->{$prop}) . $closetag; $field->display_index = !count($field->{$prop}) ? '' : $opentag . implode($separatorf, $display_index) . $closetag; } // Add microdata once for all values, if field -- is NOT -- in a field group if ($field->{$prop} !== '' && $itemprop) { $field->{$prop} = '<div style="display:inline" itemprop="' . $itemprop . '" >' . $field->{$prop} . '</div>'; } } }
$row_modified = strtotime($assoc_item->modified); if (!$row_modified) { $row_modified = strtotime($assoc_item->created); } } foreach ($this->lang_assocs[$row->lang_parent_id] as $assoc_item) { if ($assoc_item->id == $row->id) { continue; } $assoc_modified = strtotime($assoc_item->modified); if (!$assoc_modified) { $assoc_modified = strtotime($assoc_item->created); } $_class = $assoc_modified < $row_modified ? ' fc_assoc_outdated' : ''; $_link = 'index.php?option=com_flexicontent&' . $items_task . 'edit&cid=' . $assoc_item->id; $_title = flexicontent_html::getToolTip(JText::_($assoc_modified < $row_modified ? 'FLEXI_OUTDATED' : 'FLEXI_UPTODATE'), ($assoc_item->lang == '*' ? JText::_("All") : $this->langs->{$assoc_item->lang}->name) . ' <br/><br/> ' . $assoc_item->title, 0, 1); echo '<a class="fc_assoc_translation ' . $tip_class . $_class . '" target="_blank" href="' . $_link . '" title="' . $_title . '" >'; //echo $assoc_item->id; if (!empty($assoc_item->lang) && !empty($this->langs->{$assoc_item->lang}->imgsrc)) { echo ' <img src="' . $this->langs->{$assoc_item->lang}->imgsrc . '" alt="' . $assoc_item->lang . '" />'; } else { if (!empty($assoc_item->lang)) { echo $assoc_item->lang == '*' ? JText::_("FLEXI_ALL") : $assoc_item->lang; } } echo "</a>"; } } ?> </td> <?php
echo $orderby_selector; ?> </span> </span> <?php } ?> <?php if ($orderby_selector_2nd) { ?> <span class="fc_orderby_box <?php echo $tooltip_class; ?> " title="<?php echo flexicontent_html::getToolTip('FLEXI_ORDERBY', 'FLEXI_ORDERBY_INFO', 1, 1); ?> "> <span class="fc_orderby_selector"><?php echo $orderby_selector_2nd; ?> </span> </span> <?php } ?> <span class="fc_pages_counter"> <span class="label"><?php echo $this->pageNav->getPagesCounter(); ?>
?> <div class="fcclear"></div> <?php if (!$this->items) { // No items exist if ($this->getModel()->getState('limit')) { // Not creating a category view without items echo '<div class="noitems group">' . JText::_('FLEXI_NO_ITEMS_FOUND') . '</div>'; } return; } $items =& $this->items; $tooltip_class = FLEXI_J30GE ? 'hasTooltip' : 'hasTip'; $_comments_container_params = 'class="fc_comments_count ' . $tooltip_class . '" title="' . flexicontent_html::getToolTip('FLEXI_NUM_OF_COMMENTS', 'FLEXI_NUM_OF_COMMENTS_TIP', 1, 1) . '"'; // *********** // DECIDE TAGS // *********** // Main container $mainAreaTag = 'div'; // SEO, header level of title tag $itemTitleHeaderLevel = '2'; // SEO, header level of tab title tag $tabsHeaderLevel = $itemTitleHeaderLevel == '2' ? '3' : '2'; ?> <!-- tabber start --> <div class="fctabber group"> <?php foreach ($items as $i => $item) {
function getLabel() { $node =& $this->element; $attributes = get_object_vars($node->attributes()); $attributes = $attributes['@attributes']; if (@$attributes['enableparam']) { $cparams = JComponentHelper::getParams('com_flexicontent'); if (!$cparams->get($attributes['enableparam'])) { return ''; } } $label = $this->element['label']; $class = FLEXI_J30GE ? ' hasTooltip' : ' hasTip'; if (@$attributes['labelclass']) { $class .= ' ' . $attributes['labelclass']; } $title = "..."; if ($this->element['description']) { $title = flexicontent_html::getToolTip($label, $this->element['description'], 1, 1); } return '<label style="" class="' . $class . '" title="' . $title . '" >' . JText::_($label) . '</label>'; }
function onDisplayFieldValue(&$field, $item, $values = null, $prop = 'display') { if (!in_array($field->field_type, self::$field_types)) { return; } $field->{$prop} = ''; $option = JRequest::getCmd('option'); $view = JRequest::getString('view', FLEXI_ITEMVIEW); $print = JRequest::getCMD('print'); // No output if it is not FLEXIcontent item view or view is "print" if ($view != FLEXI_ITEMVIEW || $option != 'com_flexicontent' || $print) { return; } // parameters shortcuts $load_css = $field->parameters->get('load_css', 1); $use_tooltip = $field->parameters->get('use_tooltip', 1); $use_title = $field->parameters->get('use_title', 0); $use_category_link = $field->parameters->get('use_category_link', 0); $show_prevnext_count = $field->parameters->get('show_prevnext_count', 1); $tooltip_title_next = JText::_($field->parameters->get('tooltip_title_next', 'FLEXI_FIELDS_PAGENAV_GOTONEXT')); $tooltip_title_prev = JText::_($field->parameters->get('tooltip_title_prev', 'FLEXI_FIELDS_PAGENAV_GOTOPREV')); $prev_label = JText::_($field->parameters->get('prev_label', 'FLEXI_FIELDS_PAGENAV_GOTOPREV')); $next_label = JText::_($field->parameters->get('next_label', 'FLEXI_FIELDS_PAGENAV_GOTONEXT')); $category_label = JText::_($field->parameters->get('category_label', 'FLEXI_FIELDS_PAGENAV_CATEGORY')); $cid = JRequest::getInt('cid'); $cid = $cid ? $cid : (int) $item->catid; // Get active category parameters $db = JFactory::getDBO(); $query = 'SELECT * FROM #__categories WHERE id = ' . $cid; $db->setQuery($query); $catdata = $db->loadObject(); $catdata->parameters = FLEXI_J16GE ? new JRegistry($catdata->params) : new JParameter($catdata->params); // Get list of ids of selected, TODO retrieve item ids from view: // --> this will allow special navigating layouts "mcats,author,myitems,tags,favs" and also utilize current filtering $ids = null; $list = $this->getItemList($field, $item, $ids, $cid, $catdata->parameters); // Location of current content item in array list $loc_to_ids = array_keys($list); $ids_to_loc = array_flip($loc_to_ids); $location = isset($ids_to_loc[$item->id]) ? $ids_to_loc[$item->id] : false; // Get previous and next item data $field->prev = null; $field->prevtitle = null; $field->prevurl = null; $field->next = null; $field->nexttitle = null; $field->nexturl = null; $field->category = null; $field->categorytitle = null; $field->categoryurl = null; // Get item data $rows = false; $prev_id = null; $next_id = null; if ($location !== false) { $prev_id = $location - 1 >= 0 ? $loc_to_ids[$location - 1] : null; $next_id = $location + 1 < count($list) ? $loc_to_ids[$location + 1] : null; $ids = array(); // Previous item if it exists if ($prev_id) { $ids[] = $prev_id; } // Current item may belong may not be list in main category so retrieve it to get a proper categoryslug $ids[] = $item->id; // Next item if it exists if ($next_id) { $ids[] = $next_id; } // Query specific ids $rows = $this->getItemList($field, $item, $ids, $cid, $catdata->parameters); // previous content item if ($prev_id) { $field->prev = $rows[$prev_id]; $field->prevtitle = $field->prev->title; $field->prevurl = JRoute::_(FlexicontentHelperRoute::getItemRoute($field->prev->slug, $field->prev->categoryslug, 0, $field->prev)); } // next content item if ($next_id) { $field->next = $rows[$next_id]; $field->nexttitle = $field->next->title; $field->nexturl = JRoute::_(FlexicontentHelperRoute::getItemRoute($field->next->slug, $field->next->categoryslug, 0, $field->next)); } } // Check if displaying nothing and stop if (!$field->prev && !$field->next && !$use_category_link) { return; } $html = '<span class="flexi fc-pagenav">'; $tooltip_class = FLEXI_J30GE ? ' hasTooltip' : ' hasTip'; // CATEGORY back link if ($use_category_link) { $cat_image = $this->getCatThumb($catdata, $field->parameters); $limit = count($list); $limit = $limit ? $limit : 10; $start = floor($location / $limit) * $limit; if (!empty($rows[$item->id]->categoryslug)) { $html .= ' <span class="fc-pagenav-return"> <a class="btn btn-info" href="' . JRoute::_(FlexicontentHelperRoute::getCategoryRoute($rows[$item->id]->categoryslug)) . '?start=' . $start . '">' . htmlspecialchars($category_label, ENT_NOQUOTES, 'UTF-8') . ($cat_image ? ' <br/> <img src="' . $cat_image . '" alt="Return"/>' : '') . ' </a> </span>'; } } // Item location and total count $html .= $show_prevnext_count ? '<span class="fc-pagenav-items-cnt badge badge-info">' . ($location + 1) . '/' . count($list) . '</span>' : ''; // Get images $items_arr = array(); if ($field->prev) { $items_arr[$field->prev->id] = $field->prev; } if ($field->next) { $items_arr[$field->next->id] = $field->next; } $thumbs = $this->getItemThumbs($field->parameters, $items_arr); // Next item linking if ($field->prev) { $tooltip = $use_tooltip ? ' title="' . flexicontent_html::getToolTip($tooltip_title_prev, $field->prevtitle, 0) . '"' : ''; $html .= ' <span class="fc-pagenav-prev' . ($use_tooltip ? $tooltip_class : '') . '" ' . ($use_tooltip ? $tooltip : '') . '> <a class="btn" href="' . $field->prevurl . '"> <i class="icon-previous"></i> ' . ($use_title ? $field->prevtitle : htmlspecialchars($prev_label, ENT_NOQUOTES, 'UTF-8')) . ' ' . (isset($thumbs[$field->prev->id]) ? ' <br/> <img src="' . $thumbs[$field->prev->id] . '" alt="Previous"/> ' : '') . ' </a> </span>'; } else { $html .= ' <span class="fc-pagenav-prev"> <span class="btn disabled"> <i class="icon-previous"></i> ' . htmlspecialchars($prev_label, ENT_NOQUOTES, 'UTF-8') . ' </span> </span>'; } // Previous item linking if ($field->next) { $tooltip = $use_tooltip ? ' title="' . flexicontent_html::getToolTip($tooltip_title_next, $field->nexttitle, 0) . '"' : ''; $html .= ' <span class="fc-pagenav-next' . ($use_tooltip ? $tooltip_class : '') . '" ' . ($use_tooltip ? $tooltip : '') . '> <a class="btn" href="' . $field->nexturl . '"> <i class="icon-next"></i> ' . ($use_title ? $field->nexttitle : htmlspecialchars($next_label, ENT_NOQUOTES, 'UTF-8')) . ' ' . (isset($thumbs[$field->next->id]) ? ' <br/> <img src="' . $thumbs[$field->next->id] . '" alt="Next"/> ' : '') . ' </a> </span>'; } else { $html .= ' <span class="fc-pagenav-next"> <span class="btn disabled"> <i class="icon-next"></i> ' . htmlspecialchars($next_label, ENT_NOQUOTES, 'UTF-8') . ' </span> </span>'; } $html .= '</span>'; // Load needed JS/CSS if ($use_tooltip) { FLEXI_J30GE ? JHtml::_('bootstrap.tooltip') : JHTML::_('behavior.tooltip'); } if ($load_css) { JFactory::getDocument()->addStyleSheet(JURI::root(true) . '/plugins/flexicontent_fields/fcpagenav/' . (FLEXI_J16GE ? 'fcpagenav/' : '') . 'fcpagenav.css'); } $field->{$prop} = $html; }
// Dates displayed in the item form, are in user timezone for J2.5, and in site's default timezone for J1.5 $site_zone = JFactory::getApplication()->getCfg('offset'); $user_zone = JFactory::getUser()->getParam('timezone', $site_zone); $tz = new DateTimeZone($user_zone); $tz_offset = $tz->getOffset(new JDate()) / 3600; $tz_info = $tz_offset > 0 ? ' UTC +' . $tz_offset : ' UTC ' . $tz_offset; $tz_info .= ' (' . $user_zone . ')'; $date_note_msg = JText::sprintf(FLEXI_J16GE ? 'FLEXI_DATES_IN_USER_TIMEZONE_NOTE' : 'FLEXI_DATES_IN_SITE_TIMEZONE_NOTE', ' ', $tz_info); $date_note_attrs = ' class="fc-man-icon-s ' . $tip_class . '" title="' . flexicontent_html::getToolTip(null, $date_note_msg, 0, 1) . '" '; $date_zone_tip = JHTML::image('administrator/components/com_flexicontent/assets/images/comment.png', JText::_('FLEXI_NOTES'), $date_note_attrs); $list_total_cols = 13; // COMMON repeated texts $edit_entry = JText::_('FLEXI_EDIT_TAG', true); $view_entry = JText::_('FLEXI_VIEW', true); $rem_filt_txt = JText::_('FLEXI_REMOVE_FILTER'); $rem_filt_tip = ' class="' . $tip_class . ' filterdel" title="' . flexicontent_html::getToolTip('FLEXI_ACTIVE_FILTER', 'FLEXI_CLICK_TO_REMOVE_THIS_FILTER', 1, 1) . '" '; ?> <script type="text/javascript"> // the function overloads joomla standard event function submitform(pressbutton) { form = document.adminForm; // If formvalidator activated if( pressbutton == 'remove' ) { var answer = confirm('<?php echo JText::_('FLEXI_ITEMS_DELETE_CONFIRM', true); ?> ') if (!answer){ new Event(e).stop();
/** * Creates the item submit form * * @since 1.0 */ function _displayForm($tpl) { jimport('joomla.html.parameter'); // ... we use some strings from administrator part // load english language file for 'com_content' component then override with current language file JFactory::getLanguage()->load('com_content', JPATH_ADMINISTRATOR, 'en-GB', true); JFactory::getLanguage()->load('com_content', JPATH_ADMINISTRATOR, null, true); // load english language file for 'com_flexicontent' component then override with current language file JFactory::getLanguage()->load('com_flexicontent', JPATH_ADMINISTRATOR, 'en-GB', true); JFactory::getLanguage()->load('com_flexicontent', JPATH_ADMINISTRATOR, null, true); // ******************************** // Initialize variables, flags, etc // ******************************** $app = JFactory::getApplication(); $dispatcher = JDispatcher::getInstance(); $document = JFactory::getDocument(); $session = JFactory::getSession(); $user = JFactory::getUser(); $db = JFactory::getDBO(); $uri = JFactory::getURI(); $nullDate = $db->getNullDate(); $menu = $app->getMenu()->getActive(); // We do not have item parameters yet, but we need to do some work before creating the item // Get the COMPONENT only parameter $params = new JRegistry(); $cparams = JComponentHelper::getParams('com_flexicontent'); $params->merge($cparams); // Merge the active menu parameters if ($menu) { $params->merge($menu->params); } // Some flags $enable_translation_groups = flexicontent_db::useAssociations(); //$params->get("enable_translation_groups"); $print_logging_info = $params->get('print_logging_info'); if ($print_logging_info) { global $fc_run_times; } // ***************** // Load JS/CSS files // ***************** FLEXI_J30GE ? JHtml::_('behavior.framework', true) : JHTML::_('behavior.mootools'); flexicontent_html::loadFramework('jQuery'); flexicontent_html::loadFramework('select2'); flexicontent_html::loadFramework('flexi-lib'); // Load custom behaviours: form validation, popup tooltips JHTML::_('behavior.formvalidation'); // load default validation JS to make sure it is overriden JHTML::_('behavior.tooltip'); if (FLEXI_J30GE) { JHtml::_('bootstrap.tooltip'); } //JHTML::_('script', 'joomla.javascript.js', 'includes/js/'); // Add css files to the document <head> section (also load CSS joomla template override) $document->addStyleSheet(JURI::base(true) . '/components/com_flexicontent/assets/css/flexicontent.css'); 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'); } // Fields common CSS $document->addStyleSheet($this->baseurl . '/components/com_flexicontent/assets/css/flexi_form_fields.css'); // Load backend / frontend shared and Joomla version specific CSS (different for frontend / backend) FLEXI_J30GE ? $document->addStyleSheet(JURI::base(true) . '/components/com_flexicontent/assets/css/j3x.css') : $document->addStyleSheet(JURI::base(true) . '/components/com_flexicontent/assets/css/j25.css'); // Add js function to overload the joomla submitform $document->addScript(JURI::base(true) . '/components/com_flexicontent/assets/js/admin.js'); $document->addScript(JURI::base(true) . '/components/com_flexicontent/assets/js/validate.js'); // Add js function for custom code used by FLEXIcontent item form $document->addScript(JURI::base(true) . '/components/com_flexicontent/assets/js/itemscreen.js'); // ********************************************************* // Get item data and create item form (that loads item data) // ********************************************************* if ($print_logging_info) { $start_microtime = microtime(true); } $model = $this->getModel(); // ** WE NEED TO get OR decide the Content Type, before we call the getItem // ** We rely on typeid Request variable to decide type for new items so make sure this is set, // ZERO means allow user to select type, but if user is only allowed a single type, then autoselect it! // Try type from session $jdata = $app->getUserState('com_flexicontent.edit.item.data'); //print_r($jdata); if (!empty($jdata['type_id'])) { JRequest::setVar('typeid', (int) $jdata['type_id']); // This also forces zero if value not set } else { if ($menu && isset($menu->query['typeid'])) { JRequest::setVar('typeid', (int) $menu->query['typeid']); // This also forces zero if value not set } } $new_typeid = JRequest::getVar('typeid', 0, '', 'int'); // Verify type is allowed to the user if (!$new_typeid) { $types = $model->getTypeslist($type_ids_arr = false, $check_perms = true, $_published = true); if ($types && count($types) == 1) { $new_typeid = $types[0]->id; } JRequest::setVar('typeid', $new_typeid); $canCreateType = true; } // FORCE model to load versioned data (URL specified version or latest version (last saved)) $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) $item = $model->getItem(null, $check_view_access = false, $no_cache = true, $force_version = $version != 0 ? $version : -1); // -1 version means latest // Replace component/menu 'params' with thee merged component/category/type/item/menu ETC ... parameters $params =& $item->parameters; if ($print_logging_info) { $fc_run_times['get_item_data'] = round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10; } // Load permissions (used by form template) $perms = $this->_getItemPerms($item); // Create submit configuration (for new items) into the session, this is needed before creating the item form $submitConf = $this->_createSubmitConf($item, $perms); // Most core field are created via calling methods of the form (J2.5) $form = $this->get('Form'); // is new item and ownership Flags $isnew = !$item->id; $isOwner = $item->created_by == $user->get('id'); // Get available types and the currently selected/requested type $types = $model->getTypeslist(); $typesselected = $model->getTypesselected(); // Get type parameters, these are needed besides the 'merged' item parameters, e.g. to get Type's default layout $tparams = $this->get('Typeparams'); $tparams = new JRegistry($tparams); // ********************************************************************************************************* // Get language stuff, and also load Template-Specific language file to override or add new language strings // ********************************************************************************************************* if ($enable_translation_groups) { $langAssocs = $params->get('uselang_fe') == 1 ? $this->get('LangAssocs') : false; } $langs = FLEXIUtilities::getLanguages('code'); FLEXIUtilities::loadTemplateLanguageFile($params->get('ilayout', 'default')); // ************************************* // Create captcha field via custom logic // ************************************* // create and set (into HTTP request) a unique item id for plugins that needed it if ($item->id) { $unique_tmp_itemid = $item->id; } else { $unique_tmp_itemid = $app->getUserState('com_flexicontent.edit.item.unique_tmp_itemid'); $unique_tmp_itemid = $unique_tmp_itemid ? $unique_tmp_itemid : date('_Y_m_d_h_i_s_', time()) . uniqid(true); } //print_r($unique_tmp_itemid); JRequest::setVar('unique_tmp_itemid', $unique_tmp_itemid); // Component / Menu Item parameters $allowunauthorize = $params->get('allowunauthorize', 0); // allow unauthorised user to submit new content $unauthorized_page = $params->get('unauthorized_page', ''); // page URL for unauthorized users (via global configuration) $notauth_itemid = $params->get('notauthurl', ''); // menu itemid (to redirect) when user is not authorized to create content // Create captcha field or messages // Maybe some code can be removed by using Joomla's built-in form element (in XML file), instead of calling the captcha plugin ourselves $use_captcha = $params->get('use_captcha', 1); // 1 for guests, 2 for any user $captcha_formop = $params->get('captcha_formop', 0); // 0 for submit, 1 for submit/edit (aka always) $display_captcha = $use_captcha >= 2 || $use_captcha == 1 && $user->guest; $display_captcha = $display_captcha && ($isnew || $captcha_formop); // Trigger the configured captcha plugin if ($display_captcha) { // Get configured captcha plugin $c_plugin = $params->get('captcha', $app->getCfg('captcha')); // TODO add param to override default if ($c_plugin) { $c_name = 'captcha_response_field'; $c_id = $c_plugin == 'recaptcha' ? 'dynamic_recaptcha_1' : 'fc_dynamic_captcha'; $c_class = ' required'; $c_namespace = 'fc_item_form'; // Try to load the configured captcha plugin, (check if disabled or uninstalled), Joomla will enqueue an error message if needed $captcha_obj = JCaptcha::getInstance($c_plugin, array('namespace' => $c_namespace)); if ($captcha_obj) { $captcha_field = $captcha_obj->display($c_name, $c_id, $c_class); $label_class = 'flexi_label'; $label_class .= FLEXI_J30GE ? ' hasTooltip' : ' hasTip'; $label_tooltip = flexicontent_html::getToolTip(null, 'FLEXI_CAPTCHA_ENTER_CODE_DESC', 1, 1); $captcha_field = ' <label id="' . $c_name . '-lbl" for="' . $c_name . '" class="' . $label_class . '" title="' . $label_tooltip . '" > ' . JText::_('FLEXI_CAPTCHA_ENTER_CODE') . ' </label> <div id="container_fcfield_' . $c_plugin . '" class="container_fcfield container_fcfield_name_' . $c_plugin . '"> <div class="fcfieldval_container valuebox fcfieldval_container_' . $c_plugin . '"> ' . $captcha_field . ' </div> </div>'; } } } // ******************************* // CHECK EDIT / CREATE PERMISSIONS // ******************************* // User Group / Author parameters $authorparams = flexicontent_db::getUserConfig($user->id); $max_auth_limit = intval($authorparams->get('max_auth_limit', 0)); // maximum number of content items the user can create $hasTmpEdit = false; $hasCoupon = false; // Check session if ($session->has('rendered_uneditable', 'flexicontent')) { $rendered_uneditable = $session->get('rendered_uneditable', array(), 'flexicontent'); $hasTmpEdit = !empty($rendered_uneditable[$model->get('id')]); $hasCoupon = !empty($rendered_uneditable[$model->get('id')]) && $rendered_uneditable[$model->get('id')] == 2; // editable via coupon } if (!$isnew) { // EDIT action // Finally check if item is currently being checked-out (currently being edited) if ($model->isCheckedOut($user->get('id'))) { $msg = JText::sprintf('FLEXI_DESCBEINGEDITTED', $model->get('title')); $app->redirect(JRoute::_('index.php?view=' . FLEXI_ITEMVIEW . '&cid=' . $model->get('catid') . '&id=' . $model->get('id'), false), $msg); } //Checkout the item $model->checkout(); // Get edit access, this includes privileges edit and edit-own and the temporary EDIT flag ('rendered_uneditable') $canEdit = $model->getItemAccess()->get('access-edit'); // If no edit privilege, check if edit COUPON was provided if (!$canEdit) { $edittok = JRequest::getCmd('edittok', false); if ($edittok) { $query = 'SHOW TABLES LIKE "' . $app->getCfg('dbprefix') . 'flexicontent_edit_coupons"'; $db->setQuery($query); $tbl_exists = (bool) count($db->loadObjectList()); if ($tbl_exists) { $query = 'SELECT * FROM #__flexicontent_edit_coupons ' . ' WHERE token = ' . $db->Quote($edittok) . ' AND id = ' . $model->get('id'); $db->setQuery($query); $tokdata = $db->loadObject(); if ($tokdata) { $hasCoupon = true; $rendered_uneditable = $session->get('rendered_uneditable', array(), 'flexicontent'); $rendered_uneditable[$model->get('id')] = 2; // 2: indicates, that has edit via EDIT Coupon $session->set('rendered_uneditable', $rendered_uneditable, 'flexicontent'); $canEdit = 1; } else { JError::raiseNotice(403, JText::_('EDIT_TOKEN_IS_INVALID') . ' : ' . $edittok); } } } } // Edit check finished, throw error if needed if (!$canEdit) { if ($user->guest) { $uri = JFactory::getURI(); $return = $uri->toString(); $fcreturn = serialize(array('id' => @$this->_item->id, 'cid' => $cid)); // a special url parameter, used by some SEF code $com_users = FLEXI_J16GE ? 'com_users' : 'com_user'; $url = $params->get('login_page', 'index.php?option=' . $com_users . '&view=login'); $return = strtr(base64_encode($return), '+/=', '-_,'); $url .= '&return=' . $return; //$url .= '&return='.urlencode(base64_encode($return)); $url .= '&fcreturn=' . base64_encode($fcreturn); JError::raiseWarning(403, JText::sprintf("FLEXI_LOGIN_TO_ACCESS", $url)); $app->redirect($url); } else { if ($unauthorized_page) { // unauthorized page via global configuration JError::raiseNotice(403, JText::_('FLEXI_ALERTNOTAUTH_TASK')); $app->redirect($unauthorized_page); } else { // user isn't authorize to edit this content $msg = JText::_('FLEXI_ALERTNOTAUTH_TASK'); if (FLEXI_J16GE) { throw new Exception($msg, 403); } else { JError::raiseError(403, $msg); } } } } } else { // CREATE action // Get create access, this includes check of creating in at least one category, and type's "create items" $canAdd = $model->getItemAccess()->get('access-create'); $not_authorised = !$canAdd; // Check if Content Type can be created by current user if (empty($canCreateType)) { if ($new_typeid) { // not needed, already done be model when type_id is set, check and remove $canCreateType = $model->canCreateType(array($new_typeid)); // Can create given Content Type } else { // needed not done be model yet $canCreateType = $model->canCreateType(); // Can create at least one Content Type } } $not_authorised = $not_authorised || !$canCreateType; // Allow item submission by unauthorized users, ... even guests ... if ($allowunauthorize == 2) { $allowunauthorize = !$user->guest; } if ($not_authorised && !$allowunauthorize) { if (!$canCreateType) { $type_name = isset($types[$new_typeid]) ? '"' . JText::_($types[$new_typeid]->name) . '"' : JText::_('FLEXI_ANY'); $msg = JText::sprintf('FLEXI_NO_ACCESS_CREATE_CONTENT_OF_TYPE', $type_name); } else { $msg = JText::_('FLEXI_ALERTNOTAUTH_CREATE'); } } else { if ($max_auth_limit) { $db->setQuery('SELECT COUNT(id) FROM #__content WHERE created_by = ' . $user->id); $authored_count = $db->loadResult(); $content_is_limited = $authored_count >= $max_auth_limit; $msg = $content_is_limited ? JText::sprintf('FLEXI_ALERTNOTAUTH_CREATE_MORE', $max_auth_limit) : ''; } } if ($not_authorised && !$allowunauthorize || @$content_is_limited) { // User isn't authorize to add ANY content if ($notauth_menu = $app->getMenu()->getItem($notauth_itemid)) { // a. custom unauthorized submission page via menu item $internal_link_vars = @$notauth_menu->component ? '&Itemid=' . $notauth_itemid . '&option=' . $notauth_menu->component : ''; $notauthurl = JRoute::_($notauth_menu->link . $internal_link_vars, false); JError::raiseNotice(403, $msg); $app->redirect($notauthurl); } else { if ($unauthorized_page) { // b. General unauthorized page via global configuration JError::raiseNotice(403, $msg); $app->redirect($unauthorized_page); } else { // c. Finally fallback to raising a 403 Exception/Error that will redirect to site's default 403 unauthorized page if (FLEXI_J16GE) { throw new Exception($msg, 403); } 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; } } } } } } // c. Create main text field, via calling the display function of the textarea field (will also check for tabs) if ($field->field_type == 'maintext') { if (isset($item->item_translations)) { $shortcode = substr($item->language, 0, 2); foreach ($item->item_translations as $lang_id => $t) { if ($shortcode == $t->shortcode) { continue; } $field->name = array('jfdata', $t->shortcode, 'text'); $field->value[0] = html_entity_decode($t->fields->text->value, ENT_QUOTES, 'UTF-8'); FLEXIUtilities::call_FC_Field_Func('textarea', 'onDisplayField', array(&$field, &$item)); $t->fields->text->tab_labels = $field->tab_labels; $t->fields->text->html = $field->html; unset($field->tab_labels); unset($field->html); } } $field->name = 'text'; // NOTE: We use the text created by the model and not the text retrieved by the CORE plugin code, which maybe overwritten with JoomFish/Falang data $field->value[0] = $item->text; // do not decode special characters this was handled during saving ! // Render the field's (form) HTML FLEXIUtilities::call_FC_Field_Func('textarea', 'onDisplayField', array(&$field, &$item)); } } if ($print_logging_info) { $fc_run_times['render_field_html'] = round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10; } // Tags used by the item $usedtagsids = $this->get('UsedtagsIds'); // NOTE: This will normally return the already set versioned value of tags ($item->tags) $usedtagsdata = $model->getUsedtagsData($usedtagsids); // Get the edit lists $lists = $this->_buildEditLists($perms, $params, $authorparams); // Get number of subscribers $subscribers = $this->get('SubscribersCount'); // Get menu overridden categories/main category fields $menuCats = $this->_getMenuCats($item, $perms); // Create placement configuration for CORE properties $placementConf = $this->_createPlacementConf($item, $fields); // Item language related vars $languages = FLEXIUtilities::getLanguages(); $itemlang = new stdClass(); $itemlang->shortcode = substr($item->language, 0, 2); $itemlang->name = $languages->{$item->language}->name; $itemlang->image = '<img src="' . @$languages->{$item->language}->imgsrc . '" alt="' . $languages->{$item->language}->name . '" />'; //Load the JEditor object $editor = JFactory::getEditor(); // ********************************************************** // Calculate a (browser window) page title and a page heading // ********************************************************** // Verify menu item points to current FLEXIcontent object if ($menu) { $menu_matches = false; $view_ok = FLEXI_ITEMVIEW == @$menu->query['view'] || 'article' == @$menu->query['view']; $menu_matches = $view_ok; //$menu_params = $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 { // Calculate default page heading (=called page title in J1.5), which in turn will be document title below !! ... $default_heading = !$isnew ? JText::_('FLEXI_EDIT') : JText::_('FLEXI_NEW'); // Decide to show page heading (=J1.5 page title), there is no need for this in item view $show_default_heading = 0; // 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); } // ************************************************************ // 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 // Add Site Name to page title if ($app->getCfg('sitename_pagetitles', 0) == 1) { $doc_title = $app->getCfg('sitename') . " - " . $doc_title; } elseif ($app->getCfg('sitename_pagetitles', 0) == 2) { $doc_title = $doc_title . " - " . $app->getCfg('sitename'); } // Finally, set document title $document->setTitle($doc_title); // Add title to pathway $pathway = $app->getPathWay(); $pathway->addItem($doc_title, ''); // Get pageclass suffix $pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx')); // Ensure the row data is safe html // @TODO: check if this is really required as it conflicts with the escape function in the tmpl //JFilterOutput::objectHTMLSafe( $item ); $this->assign('action', $uri->toString()); $this->assignRef('item', $item); $this->assignRef('form', $form); // most core field are created via calling methods of the form (J2.5) if ($enable_translation_groups) { $this->assignRef('lang_assocs', $langAssocs); } $this->assignRef('langs', $langs); $this->assignRef('params', $params); $this->assignRef('lists', $lists); $this->assignRef('subscribers', $subscribers); $this->assignRef('editor', $editor); $this->assignRef('user', $user); $this->assignRef('usedtagsdata', $usedtagsdata); $this->assignRef('fields', $fields); $this->assignRef('tparams', $tparams); $this->assignRef('perms', $perms); $this->assignRef('document', $document); $this->assignRef('nullDate', $nullDate); $this->assignRef('menuCats', $menuCats); $this->assignRef('submitConf', $submitConf); $this->assignRef('placementConf', $placementConf); $this->assignRef('itemlang', $itemlang); $this->assignRef('pageclass_sfx', $pageclass_sfx); $this->assign('captcha_errmsg', @$captcha_errmsg); $this->assign('captcha_field', @$captcha_field); // **************************************************************** // SET INTO THE FORM, parameter values for various parameter groups // **************************************************************** if (JHTML::_('date', $item->publish_down, 'Y') <= 1969 || $item->publish_down == $nullDate) { $item->publish_down = JText::_('FLEXI_NEVER'); } // **************************** // Handle Template related work // **************************** // (a) Get the templates structures used to create form fields for template parameters $themes = flexicontent_tmpl::getTemplates(); $tmpls_all = $themes->items; // (b) Get Content Type allowed templates $allowed_tmpls = $tparams->get('allowed_ilayouts'); $type_default_layout = $tparams->get('ilayout', 'default'); if (empty($allowed_tmpls)) { $allowed_tmpls = array(); } if (!is_array($allowed_tmpls)) { $allowed_tmpls = explode("|", $allowed_tmpls); } // (c) Add default layout, unless all templates allowed (=array is empty) if (count($allowed_tmpls) && !in_array($type_default_layout, $allowed_tmpls)) { $allowed_tmpls[] = $type_default_layout; } // (d) Create array of template data according to the allowed templates for current content type if (count($allowed_tmpls)) { foreach ($tmpls_all as $tmpl) { if (in_array($tmpl->name, $allowed_tmpls)) { $tmpls[] = $tmpl; } } } else { $tmpls = $tmpls_all; } // (e) Apply Template Parameters values into the form fields structures foreach ($tmpls as $tmpl) { if (FLEXI_J16GE) { $jform = new JForm('com_flexicontent.template.item', array('control' => 'jform', 'load_data' => true)); $jform->load($tmpl->params); $tmpl->params = $jform; foreach ($tmpl->params->getGroup('attribs') as $field) { $fieldname = $field->__get('fieldname'); $value = $item->itemparams->get($fieldname); if (strlen($value)) { $tmpl->params->setValue($fieldname, 'attribs', $value); } } } else { $tmpl->params->loadINI($item->attribs); } } $this->assignRef('tmpls', $tmpls); // Clear custom form data from session $app->setUserState($form->option . '.edit.' . $form->context . '.custom', false); $app->setUserState($form->option . '.edit.' . $form->context . '.jfdata', false); $app->setUserState($form->option . '.edit.' . $form->context . '.unique_tmp_itemid', false); if ($print_logging_info) { $start_microtime = microtime(true); } parent::display($tpl); if ($print_logging_info) { $fc_run_times['form_rendering'] = round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10; } }
<td align="left" style="padding:0px;"> <?php $translated_label = JText::_($row->label); $original_label_text = $translated_label != $row->label ? '<br/><small>' . $row->label . '</small>' : ''; $escaped_label = htmlspecialchars(JText::_($row->label), ENT_QUOTES, 'UTF-8'); $field_desc = ''; $field_desc_len = JString::strlen($row->description); if ($field_desc_len > 50) { $field_desc = JString::substr(htmlspecialchars($row->description, ENT_QUOTES, 'UTF-8'), 0, 50) . '...'; } else { if ($field_desc_len) { $field_desc = htmlspecialchars($row->description, ENT_QUOTES, 'UTF-8'); } } if ($field_desc) { echo ' <img src="components/com_flexicontent/assets/images/comment.png" class="fc-man-icon-s ' . $tip_class . '" title="' . flexicontent_html::getToolTip($_desc_label, $field_desc, 0, 0) . '" />'; } ?> </td> <td align="left"> <?php if (isset($row->grouping_field)) { $_r = $row->grouping_field; $_link = 'index.php?option=com_flexicontent&' . $fields_task . 'edit&cid[]=' . $_r->id; echo ' <a style="padding:2px;" href="' . $_link . '" title="' . $edit_entry . '"> <img align="left" style="max-height:24px; padding:0px; margin:0px;" alt="Note" src="components/com_flexicontent/assets/images/insert_merge_field.png" title="Grouped inside: ' . htmlspecialchars($_r->label, ENT_QUOTES, 'UTF-8') . '" class="fc-man-icon-s ' . $tip_class . '" /> </a>'; } echo $padspacer;
<td> <?php if ($this->row->created == $this->nullDate) { echo JText::_('FLEXI_NEW_ITEM'); } else { echo JHTML::_('date', $this->row->created, JText::_('DATE_FORMAT_LC2')); } ?> </td> </tr> <tr> <td> <?php $field = isset($this->fields['modified']) ? $this->fields['modified'] : false; if ($field) { $label_tooltip = 'class="' . $tip_class . ' label" title="' . flexicontent_html::getToolTip(null, $field->description, 0, 1) . '"'; } else { $label_tooltip = 'class="label"'; } ?> <span <?php echo $label_tooltip; ?> ><?php echo $field ? $field->label : JText::_('FLEXI_MODIFIED'); ?> </span> </td> <td> <?php if ($this->row->modified == $this->nullDate) {
static function createItemsListHTML(&$params, &$item_list, $isform = 0, &$parentfield, &$parentitem, &$_item_data = null) { $db = JFactory::getDBO(); global $globalcats, $globalnoroute, $fc_run_times; if (!is_array($globalnoroute)) { $globalnoroute = array(); } // Get fields of type relation static $disallowed_fieldnames = null; $disallowed_fields = array('relation', 'relation_reverse'); if ($disallowed_fieldnames === null) { $query = "SELECT name FROM #__flexicontent_fields WHERE field_type IN ('" . implode("','", $disallowed_fields) . "')"; $db->setQuery($query); $field_name_col = FLEXI_J16GE ? $db->loadColumn() : $db->loadResultArray(); $disallowed_fieldnames = !$field_name_col ? array() : array_flip($field_name_col); } // Prefix - Suffix - Separator parameters, replacing other field values if found $remove_space = $params->get('remove_space', 0); $pretext = $params->get($isform ? 'pretext_form' : 'pretext', ''); $posttext = $params->get($isform ? 'posttext_form' : 'posttext', ''); $separatorf = $params->get($isform ? 'separator' : 'separatorf'); $opentag = $params->get($isform ? 'opentag_form' : 'opentag', ''); $closetag = $params->get($isform ? 'closetag_form' : 'closetag', ''); if ($pretext) { $pretext = $remove_space ? $pretext : $pretext . ' '; } if ($posttext) { $posttext = $remove_space ? $posttext : ' ' . $posttext; } switch ($separatorf) { case 0: $separatorf = ' '; break; case 1: $separatorf = '<br />'; break; case 2: $separatorf = ' | '; break; case 3: $separatorf = ', '; break; case 4: $separatorf = $closetag . $opentag; break; case 5: $separatorf = ''; break; default: $separatorf = ' '; break; } // some parameter shortcuts $relitem_html = $params->get($isform ? 'relitem_html_form' : 'relitem_html', '__display_text__'); $displayway = $params->get($isform ? 'displayway_form' : 'displayway', 1); $addlink = $params->get($isform ? 'addlink_form' : 'addlink', 1); $addtooltip = $params->get($isform ? 'addtooltip_form' : 'addtooltip', 1); // Parse and identify custom fields $result = preg_match_all("/\\{\\{([a-zA-Z_0-9]+)(##)?([a-zA-Z_0-9]+)?\\}\\}/", $relitem_html, $field_matches); $custom_field_reps = $result ? $field_matches[0] : array(); $custom_field_names = $result ? $field_matches[1] : array(); $custom_field_methods = $result ? $field_matches[3] : array(); /*foreach ($custom_field_names as $i => $custom_field_name) $parsed_fields[] = $custom_field_names[$i] . ($custom_field_methods[$i] ? "->". $custom_field_methods[$i] : ""); echo "$relitem_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("/\\%\\%([^%]+)\\%\\%/", $relitem_html, $translate_matches); $translate_strings = $result ? $translate_matches[1] : array('FLEXI_READ_MORE_ABOUT'); foreach ($translate_strings as $translate_string) { $relitem_html = str_replace('%%' . $translate_string . '%%', JText::_($translate_string), $relitem_html); } foreach ($item_list as $result) { // Check if related item is published and skip if not published if ($result->state != 1 && $result->state != -5) { continue; } $itemslug = $result->id . ":" . $result->alias; $catslug = ""; // Check if removed from category or inside a noRoute category or inside a non-published category // and use main category slug or other routable & published category slug $catid_arr = explode(",", $result->catidlist); $catalias_arr = explode(",", $result->cataliaslist); for ($i = 0; $i < count($catid_arr); $i++) { $itemcataliases[$catid_arr[$i]] = $catalias_arr[$i]; } $rel_itemid = $result->id; $rel_catid = !empty($result->rel_catid) ? $result->rel_catid : $result->catid; if (isset($itemcataliases[$rel_catid]) && !in_array($rel_catid, $globalnoroute) && $globalcats[$rel_catid]->published) { $catslug = $rel_catid . ":" . $itemcataliases[$rel_catid]; } else { if (!in_array($result->catid, $globalnoroute) && $globalcats[$result->catid]->published) { $catslug = $globalcats[$result->catid]->slug; } else { foreach ($catid_arr as $catid) { if (!in_array($catid, $globalnoroute) && $globalcats[$catid]->published) { $catslug = $globalcats[$catid]->slug; break; } } } } $result->slug = $itemslug; $result->categoryslug = $catslug; } // Perform field's display replacements if ($i_slave = $parentfield ? $parentitem->id . "_" . $parentfield->id : '') { $fc_run_times['render_subfields'][$i_slave] = 0; } foreach ($custom_field_names as $i => $custom_field_name) { if (isset($disallowed_fieldnames[$custom_field_name])) { continue; } if ($custom_field_methods[$i] == 'label') { continue; } if ($i_slave) { $start_microtime = microtime(true); } $display_var = $custom_field_methods[$i] ? $custom_field_methods[$i] : 'display'; FlexicontentFields::getFieldDisplay($item_list, $custom_field_name, $custom_field_values = null, $display_var); if ($i_slave) { $fc_run_times['render_subfields'][$i_slave] += round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10; } } $tooltip_class = FLEXI_J30GE ? 'hasTooltip' : 'hasTip'; $display = array(); foreach ($item_list as $result) { $url_read_more = JText::_(isset($_item_data->url_read_more) ? $_item_data->url_read_more : 'FLEXI_READ_MORE_ABOUT', 1); $url_class = isset($_item_data->url_class) ? $_item_data->url_class : 'relateditem'; // Check if related item is published and skip if not published if ($result->state != 1 && $result->state != -5) { continue; } // a. Replace some custom made strings $item_url = JRoute::_(FlexicontentHelperRoute::getItemRoute($result->slug, $result->categoryslug, 0, $result)); $item_title_escaped = htmlspecialchars($result->title, ENT_COMPAT, 'UTF-8'); $tooltip_title = flexicontent_html::getToolTip($url_read_more, $item_title_escaped, $translate = 0, $escape = 0); $item_tooltip = ' class="' . $tooltip_class . ' ' . $url_class . '" title="' . $tooltip_title . '" '; $display_text = $displayway ? $result->title : $result->id; $display_text = !$addlink ? $display_text : '<a href="' . $item_url . '"' . ($addtooltip ? $item_tooltip : '') . ' >' . $display_text . '</a>'; $curr_relitem_html = $relitem_html; $curr_relitem_html = str_replace('__item_url__', $item_url, $curr_relitem_html); $curr_relitem_html = str_replace('__item_title_escaped__', $item_title_escaped, $curr_relitem_html); $curr_relitem_html = str_replace('__item_tooltip__', $item_tooltip, $curr_relitem_html); $curr_relitem_html = str_replace('__display_text__', $display_text, $curr_relitem_html); // b. Replace item properties, e.g. {item->id}, (item->title}, etc $null_field = null; FlexicontentFields::doQueryReplacements($curr_relitem_html, $null_field, $result); // c. Replace HTML display of various item fields $err_mssg = 'Cannot replace field: "%s" because it is of not allowed field type: "%s", which can cause loop or other problem'; foreach ($custom_field_names as $i => $custom_field_name) { $_field = @$result->fields[$custom_field_name]; $custom_field_display = ''; if ($is_disallowed_field = isset($disallowed_fieldnames[$custom_field_name])) { $custom_field_display .= sprintf($err_mssg, $custom_field_name, @$_field->field_type); } else { $display_var = $custom_field_methods[$i] ? $custom_field_methods[$i] : 'display'; $custom_field_display .= @$_field->{$display_var}; } $curr_relitem_html = str_replace($custom_field_reps[$i], $custom_field_display, $curr_relitem_html); } $display[] = trim($pretext . $curr_relitem_html . $posttext); } $display = $opentag . implode($separatorf, $display) . $closetag; return $display; }
echo htmlspecialchars($row->title, ENT_QUOTES, 'UTF-8'); ?> </a> <?php } ?> <?php if (!empty($row->note)) { /* Display J1.6+ category note in a tooltip */ ?> <span class="<?php echo $tip_class; ?> " title="<?php echo flexicontent_html::getToolTip(JText::_('FLEXI_NOTES'), $row->note, 0, 1); ?> "> <?php echo $infoimage; ?> </span> <?php } ?> </td> <td> <?php if (JString::strlen($row->alias) > 25) {