} $item = new stdClass(); $item->client = $elem == 'type' ? 'site' : 'search'; $item->id = JCckDatabase::loadResult('SELECT id FROM #__cck_core_' . $elem . 's WHERE name = "' . (string) $name . '"'); if (!$item->id) { return; } $live = $app->input->getString('live', ''); $variat = $app->input->getString('variat', ''); $values = getOptions($live); $variations = getOptions($variat); // Variations $opts = array(JHtml::_('select.option', '', '- ' . JText::_('COM_CCK_INHERITED') . ' -'), JHtml::_('select.option', 'clear', JText::_('COM_CCK_CLEAR')), JHtml::_('select.option', 'hidden', JText::_('COM_CCK_HIDDEN')), JHtml::_('select.option', 'value', JText::_('COM_CCK_VALUE')), JHtml::_('select.option', '<OPTGROUP>', JText::_('COM_CCK_FORM')), JHtml::_('select.option', 'form', JText::_('COM_CCK_DEFAULT')), JHtml::_('select.option', 'form_filter', JText::_('COM_CCK_FORM_FILTER')), JHtml::_('select.option', 'disabled', JText::_('COM_CCK_FORM_DISABLED')), JHtml::_('select.option', '</OPTGROUP>', '')); // Process require_once JPATH_ADMINISTRATOR . '/components/' . CCK_COM . '/helpers/helper_workshop.php'; $fields = Helper_Workshop::getFields($elem, $item, 'AND (( c.live = "" AND c.live_value = "" ) OR ( c.live = "" AND c.live_value != "" AND c.variation != "hidden" ) OR ( c.live != "" AND c.live != "stage" ))', false, true); if (count($fields)) { foreach ($fields as $pos) { foreach ($pos as $field) { $value = isset($values[$field->name]) ? htmlspecialchars($values[$field->name]) : ''; $variat = isset($variations[$field->name]) ? $variations[$field->name] : ''; $variat = $variat == 'none' ? $variat = 'hidden' : $variat; // TODO: FIX TO REMOVE AFTER GA $variation = Jhtml::_('select.genericlist', $opts, 'variation_' . $field->name, 'size="1" class="inputbox variation_values" onchange="CCK_setOptions(\'variation\');"', 'value', 'text', $variat); $html .= '<label style="padding-left: 10px;">' . $field->title . '</label>' . '<input class="live_values inputbox" type="text" id="live_' . $field->name . '" name="live_' . $field->name . '" value="' . $value . '" onchange="CCK_setOptions(\'live\');" />' . $variation . '<div class="clear"></div>'; } } } echo $html; ?>
function prepareDisplay_Ajax() { $featured = $this->state->get('skeleton_id', 0); // Fields $objects = ''; $pos = isset($this->style->positions[0]->value) ? $this->style->positions[0]->value : 'mainbody'; $this->fields = Helper_Workshop::getFields('type', $this->item, 'a.folder = ' . (int) $featured, false, false, $pos); $this->fieldsAv = Helper_Workshop::getFieldsAv('type', $this->item, $objects, 'a.folder != ' . (int) $featured); $this->type_fields = JCckDatabase::loadObjectList('SELECT fieldid, GROUP_CONCAT(DISTINCT typeid separator " c-") AS cc FROM #__cck_core_type_field group by fieldid', 'fieldid'); // Positions $positions = Helper_Workshop::getPositions('type', $this->item); if (count($this->style->positions)) { $this->positions = array(); foreach ($this->style->positions as $p) { if ($p->value) { $this->positions[$p->value] = new stdClass(); $this->positions[$p->value]->title = $p->text; $this->positions[$p->value]->name = $p->value; $this->positions[$p->value]->disable = false; $this->positions[$p->value]->legend = @$positions[$p->value]->legend; $this->positions[$p->value]->variation = @$positions[$p->value]->variation; $this->positions[$p->value]->variation_options = @$positions[$p->value]->variation_options; $this->positions[$p->value]->width = @$positions[$p->value]->width; $this->positions[$p->value]->height = @$positions[$p->value]->height; } } } $this->positions_nb = count($this->positions); $this->variations = Helper_Workshop::getPositionVariations($this->style->template); // Filters $max_width = JCck::on() ? '' : ' style="max-width:180px;"'; $default_f = $this->item->id > 0 ? $this->item->folder : ''; $options = Helper_Admin::getPluginOptions('field', 'cck_', true, false, true); $this->lists['af_t'] = JHtml::_('select.genericlist', $options, 'filter_type', 'class="inputbox filter input-medium" prefix="t-"' . $max_width, 'value', 'text', '', 'filter1'); $options = Helper_Admin::getAlphaOptions(true); $this->lists['af_a'] = JHtml::_('select.genericlist', $options, 'filter_alpha', 'class="inputbox filter input-medium" prefix="a-"', 'value', 'text', '', 'filter3'); $options = Helper_Admin::getTypeOptions(true, false); $this->lists['af_c'] = JHtml::_('select.genericlist', $options, 'filter_type', 'class="inputbox filter input-medium" prefix="c-"' . $max_width, 'value', 'text', '', 'filter4'); $options = Helper_Admin::getFolderOptions(true, true, false, true, 'field'); $this->lists['af_f'] = JHtml::_('select.genericlist', $options, 'filter_folder', 'class="inputbox filter input-medium" prefix="f-"' . $max_width, 'value', 'text', $default_f, 'filter2'); }
function prepareDisplay_Ajax() { // Fields if ($this->item->cck_type != '' && !$this->item->skip) { $pos = isset($this->style->positions[0]->value) ? $this->style->positions[0]->value : 'mainbody'; $this->fields = Helper_Workshop::getFields('search', $this->item, 'a.name = "cck"', false, false, $pos); $this->fields[$pos][0]->variation = 'hidden'; $this->fields[$pos][0]->match_mode = 'exact'; $this->fields[$pos][0]->live_value = $this->item->cck_type; $this->fieldsAv = Helper_Workshop::getFieldsAv('search', $this->item, '', 'a.name != "cck"'); } else { $this->fields = Helper_Workshop::getFields('search', $this->item); $this->fieldsAv = Helper_Workshop::getFieldsAv('search', $this->item, ''); } $this->type_fields = JCckDatabase::loadObjectList('SELECT fieldid, GROUP_CONCAT(DISTINCT typeid separator " c-") AS cc FROM #__cck_core_type_field group by fieldid', 'fieldid'); // Positions $positions = Helper_Workshop::getPositions('search', $this->item); if (is_object($this->style) && count($this->style->positions)) { $this->positions = array(); foreach ($this->style->positions as $p) { if ($p->value) { $this->positions[$p->value] = new stdClass(); $this->positions[$p->value]->title = $p->text; $this->positions[$p->value]->name = $p->value; $this->positions[$p->value]->disable = false; $this->positions[$p->value]->legend = @$positions[$p->value]->legend; $this->positions[$p->value]->variation = @$positions[$p->value]->variation; $this->positions[$p->value]->variation_options = @$positions[$p->value]->variation_options; $this->positions[$p->value]->width = @$positions[$p->value]->width; $this->positions[$p->value]->height = @$positions[$p->value]->height; $this->positions[$p->value]->css = @$positions[$p->value]->css; } } } else { $this->positions = array('mainbody' => (object) array('title' => '(mainbody)', 'name' => 'mainbody', 'disable' => false, 'legend' => '', 'variation' => '', 'variation_options' => '', 'width' => '', 'height' => '')); } $this->positions_nb = count($this->positions); $this->variations = Helper_Workshop::getPositionVariations($this->item->template); // Filters $max_width = JCck::on() ? '' : ' style="max-width:180px;"'; $default_f = $this->item->id > 0 ? $this->item->folder : ''; $options = Helper_Admin::getPluginOptions('field', 'cck_', true, false, true); $this->lists['af_t'] = JHtml::_('select.genericlist', $options, 'filter_type', 'class="inputbox filter" size="1" prefix="t-"' . $max_width, 'value', 'text', '', 'filter1'); $options = Helper_Admin::getAlphaOptions(true); $this->lists['af_a'] = JHtml::_('select.genericlist', $options, 'filter_alpha', 'class="inputbox filter" size="1" prefix="a-"', 'value', 'text', '', 'filter3'); $options = Helper_Admin::getTypeOptions(true, false); $this->lists['af_c'] = JHtml::_('select.genericlist', $options, 'filter_type', 'class="inputbox filter" size="1" prefix="c-"' . $max_width, 'value', 'text', '', 'filter4'); $options = Helper_Admin::getFolderOptions(true, true, false, true, 'field'); $this->lists['af_f'] = JHtml::_('select.genericlist', $options, 'filter_folder', 'class="inputbox filter" size="1" prefix="f-"' . $max_width, 'value', 'text', $default_f, 'filter2'); }