protected function getInput() { JPluginHelper::importPlugin('cck_field'); require_once JPATH_PLUGINS . '/cck_field_validation/required/required.php'; $name = 'core_options'; $override = array('rows' => 1); $storage = (string) $this->element['cck_storage_field_prefix']; $and = $storage != '' ? ' AND a.storage_field LIKE "' . $storage . '%"' : ''; $fields = JCckDatabase::loadObjectList('SELECT a.title as text, a.name as value FROM #__cck_core_fields AS a' . ' WHERE a.storage = "dev" AND a.id > 500' . $and . ' ORDER BY text'); $fields = is_array($fields) ? array_merge(array(JHtml::_('select.option', '', '- ' . JText::_('COM_CCK_ADD_A_FIELD') . ' -')), $fields) : array(); $html = JHtml::_('select.genericlist', $fields, 'fields_list', 'size="1" class="inputbox select" style="max-width:175px;"', 'value', 'text', '', 'fields_list'); $format = (string) $this->element['js_format']; $lang = JFactory::getLanguage(); $lang->load('com_cck'); $lang->load('com_cck_default', JPATH_SITE); if ($format != 'raw') { JCck::loadjQuery(true, true, true); } $force_id = (string) $this->element['id']; $config = array('asset' => '', 'asset_id' => 0, 'client' => '', 'doTranslation' => 1, 'doValidation' => 2, 'pk' => ''); if ($format == 'raw') { $config['tmpl'] = 'ajax'; } $inherit = $force_id != '' ? array('id' => (string) $this->element['id']) : array(); $field = JCckDevField::getObject($name); if (!$field) { return; } $storage_field = $field->storage_field; $field->storage_field = $this->name; $field = JCckDevField::get($field, $this->value, $config, $inherit, $override); $script = $this->_addScripts((string) $this->element['name'], array('value' => $this->value), $format); return $field->form . $html . $script; }
protected function getInput() { JPluginHelper::importPlugin('cck_field'); require_once JPATH_PLUGINS . '/cck_field_validation/required/required.php'; $attributes = isset($this->element['cck_attributes']) ? (string) $this->element['cck_attributes'] : ''; $name = (string) $this->element['construction']; $name2 = (string) $this->element['construction2']; $options = isset($this->element['cck_options']) ? (string) $this->element['cck_options'] : ''; $suffix = (string) $this->element['more'] ? '<span class="variation_value">' . (string) $this->element['more'] . '</span>' : ''; $suffix2 = (string) $this->element['more2'] ? '<span class="variation_value">' . (string) $this->element['more2'] . '</span>' : ''; $selectlabel = isset($this->element['cck_selectlabel']) ? (string) $this->element['cck_selectlabel'] : 'undefined'; if (!$name) { return; } $format = (string) $this->element['js_format']; $lang = JFactory::getLanguage(); $lang->load('com_cck'); $lang->load('com_cck_default', JPATH_SITE); if ($format != 'raw') { JCck::loadjQuery(true, true, array('cck.dev-3.3.0.min.js', 'jquery.json.min.js', 'jquery.ui.effects.min.js')); } $force_id = (string) $this->element['id']; $config = array('asset' => '', 'asset_id' => 0, 'client' => '', 'doTranslation' => 1, 'doValidation' => 2, 'pk' => ''); if ($format == 'raw') { $config['tmpl'] = 'ajax'; } $inherit = $force_id != '' ? array('id' => (string) $this->element['id']) : array(); $field = JCckDevField::getObject($name); if (!$field) { return; } $storage_field = $field->storage_field; $field->storage_field = $this->name; if ($attributes != '') { if ($field->attributes) { $field->attributes .= ' ' . htmlspecialchars(str_replace("'", '"', $attributes)); } else { $field->attributes = htmlspecialchars(str_replace("'", '"', $attributes)); } } if ($options != '') { $field->options = $options; } if ($selectlabel != 'undefined') { $field->selectlabel = $selectlabel; } $field = JCckDevField::get($field, $this->value, $config, $inherit); $more = ''; if ($name2) { $field2 = JCckDevField::getObject($name2); $storage_field2 = $field2->storage_field; $field2->storage_field = str_replace($storage_field, $storage_field2, $this->name); $field2 = JCckDevField::get($field2, (string) $this->element['value2'], $config, $inherit); $more = $field2->form; } $script = $this->_addScripts($this->id, array('appendTo' => (string) $this->element['js_appendto'], 'isVisibleWhen' => (string) $this->element['js_isvisiblewhen'], 'isDisabledWhen' => (string) $this->element['js_isdisabledwhen']), $format); return $field->form . $suffix . $more . $suffix2 . $script; }
$field->variation = ''; $field->variation_override = ''; $field->restriction = ''; if ($field->type == 'checkbox' || $field->type == 'radio') { $field->bool = 1; } // Set $doc = JFactory::getDocument(); $doc->addStyleSheet(JURI::root(true) . '/media/cck/css/cck.admin.css'); $doc->addStyleDeclaration('div.cck_forms.cck_admin div.cck_form {float:none;}'); $doc->addScriptDeclaration('jQuery(document).ready(function($){ $("#titlebox").html("' . JText::_('COM_CCK_PREVIEW') . '"); $("#submitBox,#resetBox").hide(); });'); Helper_Include::addDependencies('box', 'edit'); ?> <div class="seblod preview"> <div align="center" style="text-align:center;"> <div class="cck_forms cck_admin cck_<?php echo $field->type; ?> "> <div class="cck_form cck_form_<?php echo $field->type; ?> "> <?php echo JCckDevField::getForm($field, '', $config); ?> </div> </div> </div> </div>
public function onCCK_FieldPrepareSearch(&$field, $value = '', &$config = array(), $inherit = array(), $return = false) { if (self::$type != $field->type) { return; } parent::g_onCCK_FieldPrepareSearch($field, $config); // Init $divider = $field->match_value ? $field->match_value : ' '; if (is_array($value)) { $value = implode($divider, $value); } // Prepare $form = JCckDevField::getForm('core_not_empty_image', $value, $config, array('id' => $field->id, 'name' => $field->name, 'variation' => $field->variation)); // Set $field->form = $form; $field->match_mode = 'not_empty'; $field->type = 'checkbox'; $field->value = $value; // Return if ($return === true) { return $field; } }
public static function renderForm($field, $value, &$config = array('doValidation' => 2), $override = array(), $inherit = array(), $class = '') { $field = JCckDevField::get($field, $value, $config, $inherit, $override); if (!$field) { return ''; } $config['fields'][] = $field->storage_field; $tag = $field->required ? '<span class="star"> *</span>' : ''; $class = $class ? ' class="' . $class . '"' : ''; $html = isset($field->form) ? $field->form : ''; if (isset($inherit['after'])) { $html .= $inherit['after']; } $label = ''; if ($field->label) { $label = '<label>' . $field->label . $tag . '</label>'; } $html = '<li' . $class . '>' . $label . $html . '</li>'; return $html; }