本文整理汇总了PHP中flexicontent_html::loadFramework方法的典型用法代码示例。如果您正苦于以下问题:PHP flexicontent_html::loadFramework方法的具体用法?PHP flexicontent_html::loadFramework怎么用?PHP flexicontent_html::loadFramework使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类flexicontent_html
的用法示例。
在下文中一共展示了flexicontent_html::loadFramework方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onDisplayField
function onDisplayField(&$field, &$item)
{
// execute the code only if the field type match the plugin type
if ( !in_array($field->field_type, self::$field_types) ) return;
$field->label = JText::_($field->label);
// some parameter shortcuts
$sql_mode = $field->parameters->get( 'sql_mode', 0 ) ;
$field_elements = $field->parameters->get( 'field_elements' ) ;
$default_value = $field->parameters->get( 'default_value', '' ) ;
$firstoptiontext = $field->parameters->get( 'firstoptiontext', 'FLEXI_SELECT' ) ;
$usefirstoption = $field->parameters->get( 'usefirstoption', 1 ) ;
$required = $field->parameters->get( 'required', 0 ) ;
$required = $required ? ' required' : '';
// initialise property
if (!$field->value && $default_value!=='') {
$field->value = array();
$field->value[0] = $default_value;
} else if (!$field->value) {
$field->value = array();
$field->value[0] = '';
}
$fieldname = FLEXI_J16GE ? 'custom['.$field->name.']' : $field->name;
$elementid = FLEXI_J16GE ? 'custom_'.$field->name : $field->name;
// Get indexed element values
$elements = FlexicontentFields::indexedField_getElements($field, $item, self::$extra_props);
if ( !$elements ) {
if ($sql_mode)
$field->html = JText::_('FLEXI_FIELD_INVALID_QUERY');
else
$field->html = JText::_('FLEXI_FIELD_INVALID_ELEMENTS');
return;
}
static $select2_added = false;
if ( !$select2_added )
{
$select2_added = true;
flexicontent_html::loadFramework('select2');
}
$classes = ' use_select2_lib ';
$classes .= $required;
$attribs = ' class="'.$classes.'"';
// Create field's HTML display for item form
// Display as drop-down select
$options = array();
if ($usefirstoption) $options[] = JHTML::_('select.option', '', JText::_($firstoptiontext));
foreach ($elements as $element) {
$options[] = JHTML::_('select.option', $element->value, JText::_($element->text));
}
$field->html = JHTML::_('select.genericlist', $options, $fieldname, $attribs, 'value', 'text', $field->value, $elementid);
}
示例2: display
function display($tpl = null)
{
$mainframe = JFactory::getApplication();
$option = JRequest::getVar('option');
//initialise variables
$db = JFactory::getDBO();
$document = JFactory::getDocument();
$template = $mainframe->getTemplate();
$dispatcher = JDispatcher::getInstance();
$rev = JRequest::getInt('version', '', 'request');
$codemode = JRequest::getInt('codemode', 0);
$cparams = JComponentHelper::getParams('com_flexicontent');
FLEXI_J30GE ? JHtml::_('behavior.framework', true) : JHTML::_('behavior.mootools');
flexicontent_html::loadFramework('jQuery');
JHTML::_('behavior.tooltip');
JHTML::_('behavior.modal');
//a trick to avoid loosing general style in modal window
$css = 'body, td, th { font-size: 11px; } .novalue { color: gray; font-style: italic; }';
$document->addStyleDeclaration($css);
//Get data from the model
$model = $this->getModel();
$row = $this->get('Item');
$fields = $this->get('Extrafields');
$versions = $this->get('VersionList');
$tparams = $this->get('Typeparams');
// Create the type parameters
$tparams = FLEXI_J16GE ? new JRegistry($tparams) : new JParameter($tparams);
// Add html to field object trought plugins
foreach ($fields as $field) {
if ($field->value) {
//$results = $dispatcher->trigger('onDisplayFieldValue', array( &$field, $row ));
$fieldname = $field->iscore ? 'core' : $field->field_type;
FLEXIUtilities::call_FC_Field_Func($fieldname, 'onDisplayFieldValue', array(&$field, $row));
} else {
$field->display = '<span class="novalue">' . JText::_('FLEXI_NO_VALUE') . '</span>';
}
if ($field->version) {
//$results = $dispatcher->trigger('onDisplayFieldValue', array( &$field, $row, $field->version, 'displayversion' ));
$fieldname = $field->iscore ? 'core' : $field->field_type;
FLEXIUtilities::call_FC_Field_Func($fieldname, 'onDisplayFieldValue', array(&$field, $row, $field->version, 'displayversion'));
} else {
$field->displayversion = '<span class="novalue">' . JText::_('FLEXI_NO_VALUE') . '</span>';
}
}
//assign data to template
$this->assignRef('document', $document);
$this->assignRef('row', $row);
$this->assignRef('fields', $fields);
$this->assignRef('versions', $versions);
$this->assignRef('rev', $rev);
$this->assignRef('tparams', $tparams);
$this->assignRef('cparams', $cparams);
$this->assignRef('codemode', $codemode);
parent::display($tpl);
}
示例3: display
function display($tpl = null)
{
//initialise variables
$app = JFactory::getApplication();
$document = JFactory::getDocument();
$user = JFactory::getUser();
//$authorparams = flexicontent_db::getUserConfig($user->id);
//add css/js to document
flexicontent_html::loadFramework('select2');
$document->addStyleSheet(JURI::base(true) . '/components/com_flexicontent/assets/css/flexicontentbackend.css');
if (FLEXI_J30GE) {
$document->addStyleSheet(JURI::base(true) . '/components/com_flexicontent/assets/css/j3x.css');
} else {
if (FLEXI_J16GE) {
$document->addStyleSheet(JURI::base(true) . '/components/com_flexicontent/assets/css/j25.css');
}
}
//create the toolbar
JToolBarHelper::title(JText::_('FLEXI_EDIT_FILE'), 'fileedit');
JToolBarHelper::apply('filemanager.apply');
JToolBarHelper::save('filemanager.save');
JToolBarHelper::cancel('filemanager.cancel');
//Get data from the model
$model = $this->getModel();
$form = $this->get('Form');
$row = $this->get('File');
// fail if checked out not by 'me'
if ($row->id) {
if ($model->isCheckedOut($user->get('id'))) {
JError::raiseWarning('SOME_ERROR_CODE', $row->name . ' ' . JText::_('FLEXI_EDITED_BY_ANOTHER_ADMIN'));
$app->redirect('index.php?option=com_flexicontent&view=filemanager');
}
}
//build access level list
$lists['access'] = JHTML::_('access.assetgrouplist', 'access', $row->access, $config = array('class' => 'use_select2_lib'));
// Build languages list
//$allowed_langs = !$authorparams ? null : $authorparams->get('langs_allowed',null);
//$allowed_langs = !$allowed_langs ? null : FLEXIUtilities::paramToArray($allowed_langs);
$allowed_langs = null;
$lists['language'] = flexicontent_html::buildlanguageslist('language', ' class="use_select2_lib" ', $row->language, 2, $allowed_langs, $published_only = false);
//clean data
JFilterOutput::objectHTMLSafe($row, ENT_QUOTES);
//assign data to template
$this->assignRef('form', $form);
$this->assignRef('row', $row);
$this->assignRef('lists', $lists);
$this->assignRef('document', $document);
parent::display($tpl);
}
示例4: array
$custom4 = $params->get('custom4');
$custom5 = $params->get('custom5');
// Create Item List Data
$list_arr = modFlexicontentHelper::getList($params);
// Get comments for the items (if enabled), NOTE !! TODO: modify templates and XML file so that this used
$comments_arr = modFlexicontentHelper::getComments($params, $list_arr);
$mod_fc_run_times['category_data_retrieval'] = $modfc_jprof->getmicrotime();
// Get Category List Data
$catdata_arr = modFlexicontentHelper::getCategoryData($params);
$catdata_arr = $catdata_arr ? $catdata_arr : array(false);
$mod_fc_run_times['category_data_retrieval'] = $modfc_jprof->getmicrotime() - $mod_fc_run_times['category_data_retrieval'];
$mod_fc_run_times['rendering_template'] = $modfc_jprof->getmicrotime();
// Load needed JS libs & CSS styles
FLEXI_J30GE ? JHtml::_('behavior.framework', true) : JHTML::_('behavior.mootools');
flexicontent_html::loadFramework('jQuery');
flexicontent_html::loadFramework('flexi_tmpl_common');
// Add tooltips
if ($add_tooltips) {
JHTML::_('behavior.tooltip');
}
// Add css
if ($add_ccs && $layout) {
if ($caching && !FLEXI_J16GE) {
// Work around for caching bug in J1.5
if (file_exists(dirname(__FILE__) . DS . 'tmpl' . DS . $layout . DS . $layout . '.css')) {
// active layout css
echo '<link rel="stylesheet" href="' . JURI::base(true) . '/modules/mod_flexicontent/tmpl/' . $layout . '/' . $layout . '.css">';
}
echo '<link rel="stylesheet" href="' . JURI::base(true) . '/modules/mod_flexicontent/tmpl_common/module.css">';
echo '<link rel="stylesheet" href="' . JURI::base(true) . '/components/com_flexicontent/assets/css/flexicontent.css">';
//allow css override
示例5: buildSelectList
function buildSelectList($field)
{
$db = JFactory::getDBO();
$app = JFactory::getApplication();
$user = JFactory::getUser();
$document = JFactory::getDocument();
// Get configuration parameters
$required = $field->parameters->get('required', 0);
$required = $required ? ' required' : '';
$autoupload = $field->parameters->get('autoupload', 1);
$existing_imgs = $field->parameters->get('existing_imgs', 1);
$imagepickerlimit = $field->parameters->get('imagepickerlimit', 200);
$all_media = $field->parameters->get('list_all_media_files', 0);
$unique_thumb_method = $field->parameters->get('unique_thumb_method', 0);
$limit_by_uploader = $field->parameters->get('limit_by_uploader', 0);
// USED ONLY WHEN all_media is ENABLED
$dir = $field->parameters->get('dir');
$dir_url = str_replace('\\', '/', $dir);
$image_folder = JURI::root(true) . '/' . $dir_url;
// Retrieve available (and appropriate) images from the DB
if ($all_media) {
$query = 'SELECT filename' . ' FROM #__flexicontent_files' . ' WHERE secure=1 AND ext IN ("jpg","gif","png","jpeg") ' . ($limit_by_uploader ? " AND uploaded_by = " . $user->id : "");
} else {
$query = 'SELECT value' . ' FROM #__flexicontent_fields_item_relations' . ' WHERE field_id = ' . (int) $field->id;
}
$db->setQuery($query);
$values = FLEXI_J16GE ? $db->loadColumn() : $db->loadResultArray();
// Create original filenames array skipping any empty records,
// NOTE: if all_media is ON the we already retrieved filenames above
if ($all_media) {
$filenames =& $values;
} else {
$filenames = array();
foreach ($values as $value) {
if (empty($value)) {
continue;
}
$value = @unserialize($value);
if (!isset($value['originalname'])) {
continue;
}
$filenames[] = $value['originalname'];
}
}
// Eliminate duplicate records in the array
sort($filenames);
$filenames = array_unique($filenames);
// Eliminate records that have no original files
$securepath = JPath::clean(COM_FLEXICONTENT_FILEPATH . DS);
$existing_files = array();
foreach ($filenames as $filename) {
$filepath = $securepath . $filename;
if (file_exists($filepath)) {
$existing_files[] = $filename;
}
}
$filenames = $existing_files;
$images_count = count($filenames);
// Create attributes of the drop down field for selecting existing images
$onchange = ' onchange="';
$onchange .= " qmAssignFile" . $field->id . "(this.id, '', fc_db_img_path+'/s_'+this.value);";
$onchange .= ' "';
$classes = ' existingname no_value_selected ';
$js = "";
// Add Image Picker script on the document.ready event
static $imagepicker_added = false;
$use_imgpicker = $existing_imgs == 1 && $images_count <= $imagepickerlimit;
if ($use_imgpicker) {
$classes .= ' image-picker masonry show-labels show-html ';
if (!$imagepicker_added) {
$imagepicker_added = true;
flexicontent_html::loadFramework('image-picker');
$js .= "\n\t\t\t\t\tfunction fcimgfld_toggle_image_picker(obj) {\n\t\t\t\t\t\tvar has_imagepicker = jQuery(obj).parent().find('ul.image_picker_selector').length != 0;\n\t\t\t\t\t\tif (has_imagepicker) jQuery(obj).parent().find('ul.image_picker_selector').remove();\n\t\t\t\t\t\telse jQuery(obj).parent().find('select.image-picker').imagepicker({ hide_select:false, show_label:true })\n\t\t\t\t\t}\n\t\t\t\t\t";
}
}
// Add Select2 script on the document.ready event
static $select2_added = false;
$classes .= ' use_select2_lib ';
if (!$select2_added) {
$select2_added = true;
flexicontent_html::loadFramework('select2');
}
// Add custom Javascript Code
if ($js) {
$document->addScriptDeclaration($js);
}
$attribs = $onchange . " " . ' class="' . $classes . '"';
// Populate the select field options
$options = array();
$options[] = $use_imgpicker ? '<option value="">' . JText::_('FLEXI_FIELD_PLEASE_SELECT') . '</option>' : JHTML::_('select.option', '', JText::_('FLEXI_FIELD_PLEASE_SELECT'));
foreach ($filenames as $filename) {
$options[] = $use_imgpicker ? '<option data-img-src="' . $image_folder . '/s_' . $filename . '" value="' . $filename . '">' . $filename . '</option>' : JHTML::_('select.option', $filename, $filename);
}
// Finally create the select field and return it
$formfldname = '__FORMFLDNAME__';
$formfldid = '__FORMFLDID__';
$list = $use_imgpicker ? '<select ' . $attribs . ' name="' . $formfldname . '" id="' . $formfldid . '">' . implode("\n", $options) . '</select>' : JHTML::_('select.genericlist', $options, $formfldname, $attribs, 'value', 'text', '', $formfldid);
if ($use_imgpicker) {
$btn_name = JText::_('FLEXI_TOGGLE_ALL_THUMBS') . " (" . $images_count . ")";
$list = '<input class="fcfield-button" type="button" value="' . $btn_name . '" onclick="fcimgfld_toggle_image_picker(this);" /> ' . $list;
//.........这里部分代码省略.........
示例6: onDisplayFieldValue
//.........这里部分代码省略.........
case 2:
// left
// left
case 4:
// right
$cols = ceil(count($values) * ($h_s + 8) / $h_l);
// thumbnail columns
$series = $scroll_thumbnails ? 1 : $cols;
$series_size = ($w_s + 8) * $series;
break;
}
static $item_field_arr = null;
static $js_and_css_added = false;
$slideshowtype = $field->parameters->get('slideshowtype', 'Flash');
// default is normal slideshow
$slideshowClass = 'Slideshow';
if (empty($values)) {
return;
}
if (!$js_and_css_added) {
$document->addStyleSheet(JURI::root(true) . '/plugins/flexicontent_fields/minigallery/css/minigallery.css');
FLEXI_J16GE ? JHtml::_('behavior.framework', true) : JHTML::_('behavior.mootools');
$document->addScript(JURI::root(true) . '/plugins/flexicontent_fields/minigallery/js/slideshow.js');
if ($slideshowtype != 'slideshow') {
$document->addScript(JURI::root(true) . '/plugins/flexicontent_fields/minigallery/js/slideshow.' . strtolower($slideshowtype) . '.js');
$slideshowClass .= '.' . $slideshowtype;
}
// this allows you to override the default css files
$csspath = JPATH_ROOT . '/templates/' . $app->getTemplate() . '/css/minigallery.css';
if (file_exists($csspath)) {
$document->addStyleSheet(JURI::root(true) . '/templates/' . $app->getTemplate() . '/css/minigallery.css');
}
if ($usepopup && $popuptype == 4) {
flexicontent_html::loadFramework('fancybox');
}
}
$js_and_css_added = true;
$htmltag_id = "slideshowContainer_" . $field->name . "_" . $item->id;
$slidethumb = "slideshowThumbnail_" . $field->name . "_" . $item->id;
$transition = $field->parameters->get('transition', 'back');
$t_dir = $field->parameters->get('t_dir', 'in');
$thumbnails = $field->parameters->get('thumbnails', '1');
$thumbnails = $thumbnails ? 'true' : 'false';
$controller = $field->parameters->get('controller', '1');
$controller = $controller ? 'true' : 'false';
$otheroptions = $field->parameters->get('otheroptions', '');
if (!isset($item_field_arr[$item->id][$field->id])) {
$item_field_arr[$item->id][$field->id] = 1;
$css = "\n\t\t\t#{$htmltag_id} {\n\t\t\t\twidth: " . $w_l . "px;\n\t\t\t\theight: " . $h_l . "px;\n\t\t\t\tmargin-" . $marginpos . ": " . ($marginval + 8) * $series . "px;\n\t\t\t}\n\t\t\t\t";
if ($thumbposition == 2 || $thumbposition == 4) {
$css .= "div .slideshow-thumbnails { " . $marginpos . ": -" . ($series_size + 4) . "px; height: 100%; width: " . ($series_size + 4) . "px; top:0px; }";
$css .= "div .slideshow-thumbnails ul { width: " . $series_size . "px; }";
$css .= "div .slideshow-thumbnails ul li { }";
} else {
if ($thumbposition == 1 || $thumbposition == 3) {
$css .= "div .slideshow-thumbnails { " . $marginpos . ": -" . ($series_size + 4) . "px; height: " . $series_size . "px; }";
if ($series > 1) {
$css .= "div .slideshow-thumbnails ul { width:100%!important; }";
}
$css .= "div .slideshow-thumbnails ul li { float: left!important;}";
} else {
// inside TODO
$css .= "div .slideshow-thumbnails { " . $marginpos . ": -" . ($marginval + 8) . "px; height: " . ($h_s + 8) . "px; top:0px; z-index:100; }";
$css .= "div .slideshow-thumbnails ul { width: 100%!important;}";
$css .= "div .slideshow-thumbnails ul li { float: left!important;}";
}
示例7: onDisplayField
function onDisplayField(&$field, &$item)
{
if (!in_array($field->field_type, self::$field_types)) {
return;
}
$field->label = JText::_($field->label);
$use_ingroup = $field->parameters->get('use_ingroup', 0);
$ajax = !empty($field->isAjax);
if ($use_ingroup) {
$field->formhidden = 3;
}
if ($use_ingroup && empty($field->ingroup) && !$ajax) {
return;
}
// initialize framework objects and other variables
$document = JFactory::getDocument();
// 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);
// ****************
// 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
// **************
// Default value
$value_usage = $field->parameters->get('default_value_use', 0);
$default_value = $item->version == 0 || $value_usage > 0 ? trim($field->parameters->get('default_value', '')) : '';
// *************************
// Input field configuration
// *************************
// DISPLAY using prettyCheckable JS
$use_jslib = $field->parameters->get('use_jslib', 2);
$use_prettycheckable = $use_jslib == 2;
static $prettycheckable_added = null;
if ($use_prettycheckable && $prettycheckable_added === null) {
$prettycheckable_added = flexicontent_html::loadFramework('prettyCheckable');
}
// Display text label, use checkbox/radio image field for more
$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
// when field is displayed as drop-down select (item edit form only)
$firstoptiontext = $field->parameters->get('firstoptiontext', 'FLEXI_SELECT');
$usefirstoption = $field->parameters->get('usefirstoption', 1);
// Prefix - Suffix - Separator (item FORM) parameters, for the checkbox/radio elements
$pretext = $field->parameters->get('pretext_form', '');
$posttext = $field->parameters->get('posttext_form', '');
$separator = $field->parameters->get('separator', 0);
$opentag = $field->parameters->get('opentag_form', '');
$closetag = $field->parameters->get('closetag_form', '');
switch ($separator) {
case 0:
$separator = ' ';
break;
case 1:
$separator = '<br />';
break;
case 2:
$separator = ' | ';
break;
case 3:
$separator = ', ';
break;
case 4:
$separator = $closetag . $opentag;
break;
default:
$separator = ' ';
break;
}
// Initialise property with default value
if (!$field->value) {
$field->value = array($default_value);
}
// CSS classes of value container
$value_classes = 'fcfieldval_container valuebox fcfieldval_container_' . $field->id;
// Field name and HTML TAG id
$valueholder_nm = 'custom[_fcfield_valueholder_][' . $field->name . ']';
$valueholder_id = 'custom__fcfield_valueholder__' . $field->name;
$fieldname = 'custom[' . $field->name . ']';
$elementid = 'custom_' . $field->name;
$js = "";
$css = "";
// *********************************************************************************************
// Handle adding the needed JS code to CASCADE (listen to) changes of the dependent master field
// *********************************************************************************************
if ($cascade_after && !$ajax) {
$byIds = FlexicontentFields::indexFieldsByIds($item->fields);
if (isset($byIds[$cascade_after])) {
$cascade_prompt = $field->parameters->get('cascade_prompt', '');
$cascade_prompt = $cascade_prompt ? JText::_($cascade_prompt) : JText::_('FLEXI_PLEASE_SELECT') . ': ' . $byIds[$cascade_after]->label;
$srcELid = 'custom_' . $byIds[$cascade_after]->name;
$trgELid = $elementid;
// Get values of cascade (on) source field
//.........这里部分代码省略.........
示例8: display
function display($tpl = null)
{
//initialise variables
$app = JFactory::getApplication();
$option = JRequest::getVar('option');
$document = JFactory::getDocument();
$cparams = JComponentHelper::getParams('com_flexicontent');
$user = JFactory::getUser();
//add css to document
$document->addStyleSheetVersion(JURI::base(true) . '/components/com_flexicontent/assets/css/flexicontentbackend.css', FLEXI_VHASH);
$document->addStyleSheetVersion(JURI::base(true) . '/components/com_flexicontent/assets/css/j3x.css', FLEXI_VHASH);
// Add JS frameworks
flexicontent_html::loadFramework('select2');
// Add js function to overload the joomla submitform validation
JHTML::_('behavior.formvalidation');
// load default validation JS to make sure it is overriden
$document->addScriptVersion(JURI::root(true) . '/components/com_flexicontent/assets/js/admin.js', FLEXI_VHASH);
$document->addScriptVersion(JURI::root(true) . '/components/com_flexicontent/assets/js/validate.js', FLEXI_VHASH);
//Load pane behavior
jimport('joomla.html.pane');
//Import File system
jimport('joomla.filesystem.file');
//Get data from the model
$model = $this->getModel();
$row = $this->get('Field');
$form = $this->get('Form');
$types = $this->get('Typeslist');
$typesselected = $this->get('Typesselected');
//create the toolbar
if ($row->id) {
JToolBarHelper::title(JText::_('FLEXI_EDIT_FIELD'), 'fieldedit');
} else {
JToolBarHelper::title(JText::_('FLEXI_ADD_FIELD'), 'fieldadd');
}
$ctrl = FLEXI_J16GE ? 'fields.' : '';
JToolBarHelper::apply($ctrl . 'apply');
JToolBarHelper::save($ctrl . 'save');
JToolBarHelper::custom($ctrl . 'saveandnew', 'savenew.png', 'savenew.png', 'FLEXI_SAVE_AND_NEW', false);
JToolBarHelper::cancel($ctrl . 'cancel');
// Import Joomla plugin that implements the type of current flexi field
$extfolder = 'flexicontent_fields';
$extname = $row->iscore ? 'core' : $row->field_type;
JPluginHelper::importPlugin('flexicontent_fields', $row->iscore ? 'core' : $row->field_type);
// Create class name of the plugin and then create a plugin instance
$classname = 'plg' . ucfirst($extfolder) . $extname;
// Check max allowed version
if (property_exists($classname, 'prior_to_version')) {
// Set a system message with warning of failed PHP limits
$prior_to_version = $app->getUserStateFromRequest($option . '.flexicontent.prior_to_version_' . $row->field_type, 'prior_to_version_' . $row->field_type, 0, 'int');
$app->setUserState($option . '.flexicontent.prior_to_version_' . $row->field_type, $prior_to_version + 1);
if ($prior_to_version < 2) {
$close_btn = FLEXI_J30GE ? '<a class="close" data-dismiss="alert">×</a>' : '<a class="fc-close" onclick="this.parentNode.parentNode.removeChild(this.parentNode);">×</a>';
$manifest_path = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_flexicontent' . DS . 'manifest.xml';
$com_xml = JApplicationHelper::parseXMLInstallFile($manifest_path);
$ver_exceeded = version_compare(str_replace(' ', '.', $com_xml['version']), str_replace(' ', '.', $classname::$prior_to_version), '>=');
if ($ver_exceeded) {
echo '
<span class="fc-note fc-mssg-inline">
' . $close_btn . '
Warning: installed version of Field: \'<b>' . $extname . '</b>\' was given to be free for FLEXIcontent versions prior to: v' . $classname::$prior_to_version . ' <br/> It may or may not work properly in later versions
</span>';
} else {
echo '
<span class="fc-info fc-mssg-inline">
' . $close_btn . '
Note: installed version of Field: \'<b>' . $extname . '</b>\' is given free for FLEXIcontent versions prior to: v' . $classname::$prior_to_version . ', nevertheless it will continue to function after FLEXIcontent is upgraded.
</span>';
}
}
}
// load plugin's english language file then override with current language file
$extension_name = 'plg_flexicontent_fields_' . ($row->iscore ? 'core' : $row->field_type);
JFactory::getLanguage()->load($extension_name, JPATH_ADMINISTRATOR, 'en-GB', true);
JFactory::getLanguage()->load($extension_name, JPATH_ADMINISTRATOR, null, true);
//check which properties are supported by current field
$ft_support = FlexicontentFields::getPropertySupport($row->field_type, $row->iscore);
$supportsearch = $ft_support->supportsearch;
$supportadvsearch = $ft_support->supportadvsearch;
$supportfilter = $ft_support->supportfilter;
$supportadvfilter = $ft_support->supportadvfilter;
$supportuntranslatable = $ft_support->supportuntranslatable;
$supportvalueseditable = $ft_support->supportvalueseditable;
$supportformhidden = $ft_support->supportformhidden;
$supportedithelp = $ft_support->supportedithelp;
//build selectlists, (for J1.6+ most of these are defined via XML file and custom form field classes)
$lists = array();
//build field_type list
if (!$row->field_type) {
$row->field_type = 'text';
}
$_attribs = ' class="use_select2_lib fc_skip_highlight" ';
if ($row->iscore == 1) {
$_attribs .= ' disabled="disabled" ';
} else {
$_field_id = 'jform_field_type';
$_row_id = $form->getValue("id");
$_ctrl_task = 'task=fields.getfieldspecificproperties';
$document->addScriptDeclaration("\n\t\t\t\tjQuery(document).ready(function() {\n\t\t\t\t\tjQuery('#" . $_field_id . "').on('change', function() {\n\t\t\t\t\t\tjQuery('#fieldspecificproperties').html('<p class=\"centerimg\"><img src=\"components/com_flexicontent/assets/images/ajax-loader.gif\" align=\"center\"></p>');\n\t\t\t\t\t\tjQuery.ajax({\n\t\t\t\t\t\t\ttype: \"GET\",\n\t\t\t\t\t\t\turl: 'index.php?option=com_flexicontent&" . $_ctrl_task . "&cid=" . $_row_id . "&field_type='+this.value+'&format=raw',\n\t\t\t\t\t\t\tsuccess: function(str) {\n\t\t\t\t\t\t\t\tjQuery('#fieldspecificproperties').html(str);\n\t\t\t\t\t\t\t\t" . (FLEXI_J30GE ? "\n\t\t\t\t\t\t\t\t\tjQuery('.hasTooltip').tooltip({'html': true,'container': jQuery('#fieldspecificproperties')});\n\t\t\t\t\t\t\t\t" : "\n\t\t\t\t\t\t\t\tvar tipped_elements = jQuery('#fieldspecificproperties .hasTip');\n\t\t\t\t\t\t\t\ttipped_elements.each(function() {\n\t\t\t\t\t\t\t\t\tvar title = this.get('title');\n\t\t\t\t\t\t\t\t\tif (title) {\n\t\t\t\t\t\t\t\t\t\tvar parts = title.split('::', 2);\n\t\t\t\t\t\t\t\t\t\tthis.store('tip:title', parts[0]);\n\t\t\t\t\t\t\t\t\t\tthis.store('tip:text', parts[1]);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\tvar ajax_JTooltips = new Tips(\$('fieldspecificproperties').getElements('.hasTip'), { maxTitleChars: 50, fixed: false});\n\t\t\t\t\t\t\t\t") . "\n\t\t\t\t\t\t\t\ttabberAutomatic(tabberOptions, 'fieldspecificproperties');\n\t\t\t\t\t\t\t\tfc_bindFormDependencies('#fieldspecificproperties', 0, '');\n\t\t\t\t\t\t\t\tjQuery('#field_typename').html(jQuery('#" . $_field_id . "').val());\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t");
}
//build field select list
//.........这里部分代码省略.........
示例9: display
/**
* Creates the page's display
*
* @since 1.0
*/
function display($tpl = null)
{
//initialize variables
$app = JFactory::getApplication();
$document = JFactory::getDocument();
$menus = $app->getMenu();
$menu = $menus->getActive();
$uri = JFactory::getURI();
$view = JRequest::getCmd('view');
// Get view's Model
$model = $this->getModel();
// Get parameters via model
$params = $model->getParams();
// Get various data from the model
$items = $this->get('Data');
$total = $this->get('Total');
// Make sure field values were retrieved e.g. we need 'item->categories' for template classes
$items = FlexicontentFields::getFields($items, $view, $params);
// Calculate CSS classes needed to add special styling markups to the items
flexicontent_html::calculateItemMarkups($items, $params);
// ********************************
// Load needed JS libs & CSS styles
// ********************************
FLEXI_J30GE ? JHtml::_('behavior.framework', true) : JHTML::_('behavior.mootools');
flexicontent_html::loadFramework('jQuery');
flexicontent_html::loadFramework('flexi_tmpl_common');
// Add css files to the document <head> section (also load CSS joomla template override)
if (!$params->get('disablecss', '')) {
$document->addStyleSheetVersion($this->baseurl . '/components/com_flexicontent/assets/css/flexicontent.css', FLEXI_VHASH);
//$document->addCustomTag('<!--[if IE]><style type="text/css">.floattext {zoom:1;}</style><![endif]-->');
}
if (file_exists(JPATH_SITE . DS . 'templates' . DS . $app->getTemplate() . DS . 'css' . DS . 'flexicontent.css')) {
$document->addStyleSheetVersion($this->baseurl . '/templates/' . $app->getTemplate() . '/css/flexicontent.css', FLEXI_VHASH);
}
// **********************************************************
// Calculate a (browser window) page title and a page heading
// **********************************************************
// Verify menu item points to current FLEXIcontent object
if ($menu) {
$view_ok = 'favourites' == @$menu->query['view'];
$menu_matches = $view_ok;
//$menu_params = FLEXI_J16GE ? $menu->params : new JParameter($menu->params); // Get active menu item parameters
} else {
$menu_matches = false;
}
// MENU ITEM matched, use its page heading (but use menu title if the former is not set)
if ($menu_matches) {
$default_heading = FLEXI_J16GE ? $menu->title : $menu->name;
// Cross set (show_) page_heading / page_title for compatibility of J2.5+ with J1.5 template (and for J1.5 with J2.5 template)
$params->def('page_heading', $params->get('page_title', $default_heading));
$params->def('page_title', $params->get('page_heading', $default_heading));
$params->def('show_page_heading', $params->get('show_page_title', 0));
$params->def('show_page_title', $params->get('show_page_heading', 0));
} else {
// Clear some menu parameters
//$params->set('pageclass_sfx', ''); // CSS class SUFFIX is behavior, so do not clear it ?
// Calculate default page heading (=called page title in J1.5), which in turn will be document title below !! ...
// meta_params->get('page_title') is meant for <title> but let's use as ... default page heading
$default_heading = JText::_('FLEXI_YOUR_FAVOURED_ITEMS');
// Decide to show page heading (=J1.5 page title), this is always yes
$show_default_heading = 1;
// Set both (show_) page_heading / page_title for compatibility of J2.5+ with J1.5 template (and for J1.5 with J2.5 template)
$params->set('page_title', $default_heading);
$params->set('page_heading', $default_heading);
$params->set('show_page_heading', $show_default_heading);
$params->set('show_page_title', $show_default_heading);
}
// Prevent showing the page heading if ... currently no reason
if (0) {
$params->set('show_page_heading', 0);
$params->set('show_page_title', 0);
}
// ************************************************************
// Create the document title, by from page title and other data
// ************************************************************
// Use the page heading as document title, (already calculated above via 'appropriate' logic ...)
$doc_title = $params->get('page_title');
// Check and prepend or append site name to page title
if ($doc_title != $app->getCfg('sitename')) {
if ($app->getCfg('sitename_pagetitles', 0) == 1) {
$doc_title = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $doc_title);
} elseif ($app->getCfg('sitename_pagetitles', 0) == 2) {
$doc_title = JText::sprintf('JPAGETITLE', $doc_title, $app->getCfg('sitename'));
}
}
// Finally, set document title
$document->setTitle($doc_title);
// ************************
// Set document's META tags
// ************************
// Workaround for Joomla not setting the default value for 'robots', so component must do it
$app_params = $app->getParams();
if ($_mp = $app_params->get('robots')) {
$document->setMetadata('robots', $_mp);
}
//.........这里部分代码省略.........
示例10: onDisplayField
function onDisplayField(&$field, &$item)
{
// execute the code only if the field type match the plugin type
if ( !in_array($field->field_type, self::$field_types) ) return;
$field->label = JText::_($field->label);
// some parameter shortcuts
$sql_mode = $field->parameters->get( 'sql_mode', 0 ) ;
$field_elements = $field->parameters->get( 'field_elements' ) ;
$default_values = $field->parameters->get( 'default_values', '' ) ;
// Prefix - Suffix - Separator parameters, replacing other field values if found
$pretext = $field->parameters->get( 'pretext_form', '' ) ;
$posttext = $field->parameters->get( 'posttext_form', '' ) ;
$separator = $field->parameters->get( 'separator', 0 ) ;
$opentag = $field->parameters->get( 'opentag_form', '' ) ;
$closetag = $field->parameters->get( 'closetag_form', '' ) ;
$required = $field->parameters->get( 'required', 0 ) ;
//$required = $required ? ' required validate-checkbox' : '';
$max_values = $field->parameters->get( 'max_values', 0 ) ;
$min_values = $field->parameters->get( 'min_values', 0 ) ;
$exact_values = $field->parameters->get( 'exact_values', 0 ) ;
if ($required && !$min_values) $min_values = 1;
if ($exact_values) $max_values = $min_values = $exact_values;
$js_popup_err = $field->parameters->get( 'js_popup_err', 0 ) ;
switch($separator)
{
case 0:
$separator = ' ';
break;
case 1:
$separator = '<br />';
break;
case 2:
$separator = ' | ';
break;
case 3:
$separator = ', ';
break;
case 4:
$separator = $closetag . $opentag;
break;
default:
$separator = ' ';
break;
}
// initialise property
if (!$field->value && $default_values!=='') {
$field->value = explode(",", $default_values);
} else if (!$field->value) {
$field->value = array();
$field->value[0] = '';
}
$fieldname = FLEXI_J16GE ? 'custom['.$field->name.'][]' : $field->name.'[]';
$elementid = FLEXI_J16GE ? 'custom_'.$field->name : $field->name;
// Get indexed element values
$elements = FlexicontentFields::indexedField_getElements($field, $item, self::$extra_props);
if ( !$elements ) {
if ($sql_mode)
$field->html = JText::_('FLEXI_FIELD_INVALID_QUERY');
else
$field->html = JText::_('FLEXI_FIELD_INVALID_ELEMENTS');
return;
}
static $prettycheckable_added = null;
if ( $prettycheckable_added === null )
{
$prettycheckable_added = flexicontent_html::loadFramework('prettyCheckable');
}
$attribs = '';
$classes = ($prettycheckable_added ? ' use_prettycheckable ' : '');
//$classes .= $required;
if ($exact_values) {
$attribs .= ' exact_values="'.$exact_values.'" ';
} else {
if ($max_values) $attribs .= ' max_values="'.$max_values.'" ';
if ($min_values) $attribs .= ' min_values="'.$min_values.'" ';
}
if ($js_popup_err) $attribs .= ' js_popup_err="'.$js_popup_err.'" ';
if ($max_values || $min_values || $exact_values) $classes .= ' validate-cboxlimitations ';
if ($classes) $attribs .= ' class="'.$classes.'" ';
// Create field's HTML display for item form
// Display as checkboxes
$i = 0;
$options = array();
foreach ($elements as $element) {
//.........这里部分代码省略.........
示例11: display
/**
* Creates the page's display
*
* @since 1.0
*/
function display($tpl = null)
{
//initialize variables
$option = JRequest::getVar('option');
$app = JFactory::getApplication();
$document = JFactory::getDocument();
$db = JFactory::getDBO();
$menus = $app->getMenu();
$menu = $menus->getActive();
$uri = JFactory::getURI();
$pathway = $app->getPathway();
// Get view's Model
$model = $this->getModel();
$error = '';
$rows = null;
$total = 0;
$form_id = $form_name = "searchForm";
// Get parameters via model
$params = $model->getParams();
// Get various data from the model
$areas = $this->get('areas');
$state = $this->get('state');
$searchword = $state->get('keyword');
$searchphrase = $state->get('match');
$searchordering = $state->get('ordering');
// ***********************************************************
// some parameter shortcuts common with advanced search plugin
// ***********************************************************
$canseltypes = $params->get('canseltypes', 1);
$txtmode = $params->get('txtmode', 0);
// 0: BASIC Index, 1: ADVANCED Index without search fields user selection, 2: ADVANCED Index with search fields user selection
// Get if text searching according to specific (single) content type
$show_txtfields = $params->get('show_txtfields', 1);
//0:hide, 1:according to content, 2:use custom configuration
$show_txtfields = $txtmode ? 0 : $show_txtfields;
// disable this flag if using BASIC index for text search
// Get if filtering according to specific (single) content type
$show_filters = $params->get('show_filters', 1);
//0:hide, 1:according to content, 2:use custom configuration
// Force single type selection and showing the content type selector
$type_based_search = $show_filters == 1 || $show_txtfields == 1;
$canseltypes = $type_based_search ? 1 : $canseltypes;
// ********************************
// Load needed JS libs & CSS styles
// ********************************
FLEXI_J30GE ? JHtml::_('behavior.framework', true) : JHTML::_('behavior.mootools');
flexicontent_html::loadFramework('jQuery');
flexicontent_html::loadFramework('flexi_tmpl_common');
// Add css files to the document <head> section (also load CSS joomla template override)
if (!$params->get('disablecss', '')) {
$document->addStyleSheetVersion($this->baseurl . '/components/com_flexicontent/assets/css/flexicontent.css', FLEXI_VERSION);
$document->addStyleSheetVersion($this->baseurl . '/components/com_flexicontent/assets/css/flexi_filters.css', FLEXI_VERSION);
//$document->addCustomTag('<!--[if IE]><style type="text/css">.floattext {zoom:1;}</style><![endif]-->');
}
if (file_exists(JPATH_SITE . DS . 'templates' . DS . $app->getTemplate() . DS . 'css' . DS . 'flexicontent.css')) {
$document->addStyleSheetVersion($this->baseurl . '/templates/' . $app->getTemplate() . '/css/flexicontent.css', FLEXI_VERSION);
}
// **********************************************************
// Calculate a (browser window) page title and a page heading
// **********************************************************
// Verify menu item points to current FLEXIcontent object
if ($menu) {
$view_ok = 'search' == @$menu->query['view'];
$menu_matches = $view_ok;
//$menu_params = FLEXI_J16GE ? $menu->params : new JParameter($menu->params); // Get active menu item parameters
} else {
$menu_matches = false;
}
// MENU ITEM matched, use its page heading (but use menu title if the former is not set)
if ($menu_matches) {
$default_heading = FLEXI_J16GE ? $menu->title : $menu->name;
// Cross set (show_) page_heading / page_title for compatibility of J2.5+ with J1.5 template (and for J1.5 with J2.5 template)
$params->def('page_heading', $params->get('page_title', $default_heading));
$params->def('page_title', $params->get('page_heading', $default_heading));
$params->def('show_page_heading', $params->get('show_page_title', 0));
$params->def('show_page_title', $params->get('show_page_heading', 0));
} else {
// Clear some menu parameters
//$params->set('pageclass_sfx', ''); // CSS class SUFFIX is behavior, so do not clear it ?
// Calculate default page heading (=called page title in J1.5), which in turn will be document title below !! ...
// meta_params->get('page_title') is meant for <title> but let's use as ... default page heading
$default_heading = JText::_('FLEXI_SEARCH');
// Decide to show page heading (=J1.5 page title), this default to no
$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);
}
// Prevent showing the page heading if ... currently no reason
if (0) {
$params->set('show_page_heading', 0);
$params->set('show_page_title', 0);
}
//.........这里部分代码省略.........
示例12: display
/**
* Creates the item page
*
* @since 1.0
*/
function display($tpl = null)
{
// ********************************
// Initialize variables, flags, etc
// ********************************
global $globalcats;
$categories = $globalcats;
$app = JFactory::getApplication();
$dispatcher = JDispatcher::getInstance();
$document = JFactory::getDocument();
$config = JFactory::getConfig();
$session = JFactory::getSession();
$user = JFactory::getUser();
$db = JFactory::getDBO();
$option = JRequest::getVar('option');
$nullDate = $db->getNullDate();
// Get the COMPONENT only parameters
// Get component parameters
$params = new JRegistry();
$cparams = JComponentHelper::getParams('com_flexicontent');
$params->merge($cparams);
$params = clone JComponentHelper::getParams('com_flexicontent');
// 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
// *****************
// Add css to document
$document->addStyleSheetVersion(JURI::base(true) . '/components/com_flexicontent/assets/css/flexicontentbackend.css', FLEXI_VERSION);
$document->addStyleSheetVersion(JURI::base(true) . '/components/com_flexicontent/assets/css/j3x.css', FLEXI_VERSION);
// Fields common CSS
$document->addStyleSheetVersion(JURI::root(true) . '/components/com_flexicontent/assets/css/flexi_form_fields.css', FLEXI_VERSION);
// Add JS frameworks
flexicontent_html::loadFramework('select2');
$prettycheckable_added = flexicontent_html::loadFramework('prettyCheckable');
flexicontent_html::loadFramework('flexi-lib');
// Add js function to overload the joomla submitform validation
JHTML::_('behavior.formvalidation');
// load default validation JS to make sure it is overriden
$document->addScriptVersion(JURI::root(true) . '/components/com_flexicontent/assets/js/admin.js', FLEXI_VERSION);
$document->addScriptVersion(JURI::root(true) . '/components/com_flexicontent/assets/js/validate.js', FLEXI_VERSION);
// Add js function for custom code used by FLEXIcontent item form
$document->addScriptVersion(JURI::root(true) . '/components/com_flexicontent/assets/js/itemscreen.js', FLEXI_VERSION);
// ***********************
// Get data from the model
// ***********************
if ($print_logging_info) {
$start_microtime = microtime(true);
}
$model = $this->getModel();
$item = $model->getItem();
$form = $this->get('Form');
if ($print_logging_info) {
$fc_run_times['get_item_data'] = round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10;
}
// ***************************
// Get Associated Translations
// ***************************
if ($enable_translation_groups) {
$langAssocs = $this->get('LangAssocs');
}
$langs = FLEXIUtilities::getLanguages('code');
// Get item id and new flag
$cid = $model->getId();
$isnew = !$cid;
// Create and set a unique item id for plugins that needed it
if ($cid) {
$unique_tmp_itemid = $cid;
} 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);
// Get number of subscribers
$subscribers = $model->getSubscribersCount();
// ******************
// Version Panel data
// ******************
// Get / calculate some version related variables
$versioncount = $model->getVersionCount();
$versionsperpage = $params->get('versionsperpage', 10);
$pagecount = (int) ceil($versioncount / $versionsperpage);
// Data need by version panel: (a) current version page, (b) currently active version
$current_page = 1;
$k = 1;
$allversions = $model->getVersionList();
foreach ($allversions as $v) {
if ($k > 1 && ($k - 1) % $versionsperpage == 0) {
$current_page++;
//.........这里部分代码省略.........
示例13: favicon
/**
* Creates the favourite icons
*
* @param array $params
* @since 1.0
*/
static function favicon($field, $favoured, $item, $type = 'item')
{
$user = JFactory::getUser();
$item_id = $item->id;
// avoid using $field, we also support favoured categories
$item_title = $item->title;
static $js_and_css_added = false;
static $tooltip_class, $addremove_tip, $img_fav_add, $img_fav_delete;
if (!$js_and_css_added) {
$document = JFactory::getDocument();
$cparams = JComponentHelper::getParams('com_flexicontent');
$tooltip_class = FLEXI_J30GE ? ' hasTooltip' : ' hasTip';
$text = $user->id ? 'FLEXI_ADDREMOVE_FAVOURITE' : 'FLEXI_FAVOURE';
$overlib = $user->id ? 'FLEXI_ADDREMOVE_FAVOURITE_TIP' : 'FLEXI_FAVOURE_LOGIN_TIP';
$addremove_tip = flexicontent_html::getToolTip($text, $overlib, 1, 1);
// Make sure mootools are loaded before our js
//FLEXI_J30GE ? JHtml::_('behavior.framework', true) : JHTML::_('behavior.mootools');
// Load tooltips JS
if ($cparams->get('add_tooltips', 1)) {
FLEXI_J30GE ? JHtml::_('bootstrap.tooltip') : JHTML::_('behavior.tooltip');
}
flexicontent_html::loadFramework('jQuery');
flexicontent_html::loadFramework('flexi_tmpl_common');
$document->addScriptVersion(JURI::root(true) . '/components/com_flexicontent/assets/js/fcfav.js', FLEXI_VERSION);
JText::script('FLEXI_YOUR_BROWSER_DOES_NOT_SUPPORT_AJAX', true);
JText::script('FLEXI_LOADING', true);
JText::script('FLEXI_ADDED_TO_YOUR_FAVOURITES', true);
JText::script('FLEXI_YOU_NEED_TO_LOGIN', true);
JText::script('FLEXI_REMOVED_FROM_YOUR_FAVOURITES', true);
JText::script('FLEXI_USERS', true);
//5
JText::script('FLEXI_FAVOURE', true);
JText::script('FLEXI_REMOVE_FAVOURITE', true);
//7
JText::script('FLEXI_FAVS_YOU_HAVE_SUBSCRIBED', true);
JText::script('FLEXI_FAVS_CLICK_TO_SUBSCRIBE', true);
JText::script('FLEXI_TOTAL', true);
$js = "\n\t\t\t\tvar fcfav_rfolder = '" . JURI::root(true) . "';\n\t\t\t";
$document->addScriptDeclaration($js);
$js_and_css_added = true;
}
$output = "";
if ($user->id && $favoured) {
$alt_text = JText::_('FLEXI_REMOVE_FAVOURITE');
if (!$img_fav_delete) {
$img_fav_delete = JHTML::image('components/com_flexicontent/assets/images/' . 'heart_delete.png', $alt_text, NULL);
}
$onclick = "javascript:FCFav(" . $item_id . ", '" . $type . "')";
$link = "javascript:void(null)";
$output .= '<span class="fcfav_delete">' . ' <a id="favlink_' . $type . '_' . $item_id . '" href="' . $link . '" onclick="' . $onclick . '" class="btn fcfav-reponse' . $tooltip_class . '" title="' . $addremove_tip . '">' . $img_fav_delete . '</a>' . ' <span class="fav_item_id" style="display:none;">' . $item_id . '</span>' . ' <span class="fav_item_title" style="display:none;">' . $item_title . '</span>' . '</span>';
} elseif ($user->id) {
$alt_text = JText::_('FLEXI_FAVOURE');
if (!$img_fav_add) {
$img_fav_add = JHTML::image('components/com_flexicontent/assets/images/' . 'heart_add.png', $alt_text, NULL);
}
$onclick = "javascript:FCFav(" . $item_id . ", '" . $type . "')";
$link = "javascript:void(null)";
$output .= '<span class="fcfav_add">' . ' <a id="favlink_' . $type . '_' . $item_id . '" href="' . $link . '" onclick="' . $onclick . '" class="btn fcfav-reponse' . $tooltip_class . '" title="' . $addremove_tip . '">' . $img_fav_add . '</a>' . ' <span class="fav_item_id" style="display:none;">' . $item_id . '</span>' . ' <span class="fav_item_title" style="display:none;">' . $item_title . '</span>' . '</span>';
} else {
$attribs = 'class="btn ' . $tooltip_class . '" title="' . $addremove_tip . '" onclick="alert(\'' . JText::_('FLEXI_FAVOURE_LOGIN_TIP') . '\')"';
$image = JHTML::image('components/com_flexicontent/assets/images/' . 'heart_login.png', JText::_('FLEXI_FAVOURE'), $attribs);
$output = $image;
}
return $output;
}
示例14: onDisplayField
function onDisplayField(&$field, &$item)
{
if (!in_array($field->field_type, self::$field_types)) {
return;
}
$field->label = JText::_($field->label);
$use_ingroup = $field->parameters->get('use_ingroup', 0);
$ajax = !empty($field->isAjax);
if ($use_ingroup) {
$field->formhidden = 3;
}
if ($use_ingroup && empty($field->ingroup) && !$ajax) {
return;
}
// initialize framework objects and other variables
$document = JFactory::getDocument();
// 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);
// ****************
// 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
// **************
// Default value
$value_usage = $field->parameters->get('default_value_use', 0);
$default_value = $item->version == 0 || $value_usage > 0 ? trim($field->parameters->get('default_value', '')) : '';
// *************************
// Input field configuration
// *************************
// DISPLAY using select2 JS
$use_jslib = $field->parameters->get('use_jslib', 1);
$use_select2 = $use_jslib == 1;
static $select2_added = null;
if ($use_select2 && $select2_added === null) {
$select2_added = flexicontent_html::loadFramework('select2');
}
// Parameters for DISPLAY with / without using select2 JS
// ... none such parameters
// Custom HTML placed before / after form field
$opentag = $field->parameters->get('opentag_form', '');
$closetag = $field->parameters->get('closetag_form', '');
// Initialise property with default value
if (!$field->value) {
$field->value = array($default_value);
}
// CSS classes of value container
$value_classes = 'fcfieldval_container valuebox fcfieldval_container_' . $field->id;
// Field name and HTML TAG id
$valueholder_nm = 'custom[_fcfield_valueholder_][' . $field->name . ']';
$valueholder_id = 'custom__fcfield_valueholder__' . $field->name;
$fieldname = 'custom[' . $field->name . ']';
$elementid = 'custom_' . $field->name;
$js = "";
$css = "";
// *********************************************************************************************
// Handle adding the needed JS code to CASCADE (listen to) changes of the dependent master field
// *********************************************************************************************
if ($cascade_after && !$ajax) {
$byIds = FlexicontentFields::indexFieldsByIds($item->fields);
if (isset($byIds[$cascade_after])) {
$cascade_prompt = $field->parameters->get('cascade_prompt', '');
$cascade_prompt = $cascade_prompt ? JText::_($cascade_prompt) : JText::_('FLEXI_PLEASE_SELECT') . ': ' . $byIds[$cascade_after]->label;
$srcELid = 'custom_' . $byIds[$cascade_after]->name;
$trgELid = $elementid;
// Get values of cascade (on) source field
$field->valgrps = $byIds[$cascade_after]->value ? $byIds[$cascade_after]->value : array();
foreach ($field->valgrps as &$vg) {
if (is_array($vg)) {
} else {
if (@unserialize($vg) !== false || $vg === 'b:0;') {
$vg = unserialize($vg);
} else {
$vg = array($vg);
}
}
}
unset($vg);
} else {
$cascade_after = 0;
echo 'Error in field ' . $field->label . ' [' . $field->id . ']' . ' cannot cascaded after field no: ' . $cascade_after . ', field was not found <br/>';
}
} else {
if ($cascade_after && $ajax) {
$field->valgrps = isset($field->valgrps) ? $field->valgrps : array();
$field->valgrps = is_array($field->valgrps) ? $field->valgrps : preg_split("/\\s*,\\s*/u", trim($field->valgrps));
}
}
// ***********************
// Handle multiple records
// ***********************
if ($multiple && !$ajax) {
// Add the drag and drop sorting feature
//.........这里部分代码省略.........
示例15: _buildEditLists
/**
* Creates the HTML of various form fields used in the item edit form
*
* @since 1.0
*/
function _buildEditLists(&$perms, &$params, &$authorparams)
{
$db = JFactory::getDBO();
$user = JFactory::getUser();
// get current user
$item = $this->get('Item');
// get the item from the model
$document = JFactory::getDocument();
$session = JFactory::getSession();
global $globalcats;
$categories = $globalcats;
// get the categories tree
$types = $this->get('Typeslist');
$typesselected = $this->get('Typesselected');
$subscribers = $this->get('SubscribersCount');
$isnew = !$item->id;
// *******************************
// Get categories used by the item
// *******************************
if ($isnew) {
// Case for preselected main category for new items
$maincat = $item->catid ? $item->catid : JRequest::getInt('maincat', 0);
if ($maincat) {
$selectedcats = array($maincat);
$item->catid = $maincat;
} else {
$selectedcats = array();
}
if ($params->get('cid_default')) {
$selectedcats = $params->get('cid_default');
}
if ($params->get('catid_default')) {
$item->catid = $params->get('catid_default');
}
} else {
// NOTE: This will normally return the already set versioned value of categories ($item->categories)
$selectedcats = $this->get('Catsselected');
}
// *********************************************************************************************
// Build select lists for the form field. Only few of them are used in J1.6+, since we will use:
// (a) form XML file to declare them and then (b) getInput() method form field to create them
// *********************************************************************************************
// First clean form data, we do this after creating the description field which may contain HTML
JFilterOutput::objectHTMLSafe($item, ENT_QUOTES);
flexicontent_html::loadFramework('select2');
$prettycheckable_added = flexicontent_html::loadFramework('prettyCheckable');
$lists = array();
// build state list
$non_publishers_stategrp = $perms['isSuperAdmin'] || $item->state == -3 || $item->state == -4;
$special_privelege_stategrp = $item->state == 2 || $perms['canarchive'] || ($item->state == -2 || $perms['candelete']);
$state = array();
// Using <select> groups
if ($non_publishers_stategrp || $special_privelege_stategrp) {
$state[] = JHTML::_('select.optgroup', JText::_('FLEXI_PUBLISHERS_WORKFLOW_STATES'));
}
$state[] = JHTML::_('select.option', 1, JText::_('FLEXI_PUBLISHED'));
$state[] = JHTML::_('select.option', 0, JText::_('FLEXI_UNPUBLISHED'));
$state[] = JHTML::_('select.option', -5, JText::_('FLEXI_IN_PROGRESS'));
// States reserved for workflow
if ($non_publishers_stategrp) {
$state[] = JHTML::_('select.optgroup', '');
$state[] = JHTML::_('select.optgroup', JText::_('FLEXI_NON_PUBLISHERS_WORKFLOW_STATES'));
}
if ($item->state == -3 || $perms['isSuperAdmin']) {
$state[] = JHTML::_('select.option', -3, JText::_('FLEXI_PENDING'));
}
if ($item->state == -4 || $perms['isSuperAdmin']) {
$state[] = JHTML::_('select.option', -4, JText::_('FLEXI_TO_WRITE'));
}
// Special access states
if ($special_privelege_stategrp) {
$state[] = JHTML::_('select.optgroup', '');
$state[] = JHTML::_('select.optgroup', JText::_('FLEXI_SPECIAL_ACTION_STATES'));
}
if ($item->state == 2 || $perms['canarchive']) {
$state[] = JHTML::_('select.option', 2, JText::_('FLEXI_ARCHIVED'));
}
if ($item->state == -2 || $perms['candelete']) {
$state[] = JHTML::_('select.option', -2, JText::_('FLEXI_TRASHED'));
}
// Close last <select> group
if ($non_publishers_stategrp || $special_privelege_stategrp) {
$state[] = JHTML::_('select.optgroup', '');
}
$class = 'use_select2_lib';
$attribs = 'class="' . $class . '"';
$lists['state'] = JHTML::_('select.genericlist', $state, 'jform[state]', $attribs, 'value', 'text', $item->state, 'jform_state');
if (!FLEXI_J16GE) {
$lists['state'] = str_replace('<optgroup label="">', '</optgroup>', $lists['state']);
}
// *** BOF: J2.5 SPECIFIC SELECT LISTS
if (FLEXI_J16GE) {
}
// *** EOF: J1.5 SPECIFIC SELECT LISTS
// build version approval list
//.........这里部分代码省略.........