/** * {@inheritdoc} * * @SuppressWarnings(PHPMD.Superglobals) * @SuppressWarnings(PHPMD.CamelCaseVariableName) */ public function getFieldDefinition($arrOverrides = array()) { // Load the language files. \Controller::loadLanguageFile('tl_metamodel_attribute'); \Controller::loadLanguageFile('default'); $arrFieldDef = parent::getFieldDefinition($arrOverrides); $arrFieldDef['inputType'] = 'multiColumnWizard'; $arrFieldDef['eval'] = array('columnFields' => array('gp_mode' => array('inputType' => 'select', 'eval' => array('style' => 'width:180px', 'includeBlankOption' => true, 'columnPos' => 'first'), 'options' => array('gp_show' => $GLOBALS['TL_LANG']['tl_metamodel_attribute']['gp_show'], 'gp_hide' => $GLOBALS['TL_LANG']['tl_metamodel_attribute']['gp_hide'])), 'gp_countries' => array('inputType' => 'checkbox', 'options' => $this->getSelectedCountries(), 'eval' => array('multiple' => true, 'columnPos' => 'first'))), 'buttons' => array('copy' => false, 'delete' => false, 'up' => false, 'down' => false)); return $arrFieldDef; }
/** * {@inheritdoc} */ public function getFieldDefinition($arrOverrides = array()) { $arrColLabels = deserialize($this->get('tabletext_cols'), true); $arrFieldDef = parent::getFieldDefinition($arrOverrides); $arrFieldDef['inputType'] = 'multiColumnWizard'; $arrFieldDef['eval']['columnFields'] = array(); $count = count($arrColLabels); for ($i = 0; $i < $count; $i++) { $arrFieldDef['eval']['columnFields']['col_' . $i] = array('label' => $arrColLabels[$i]['rowLabel'], 'inputType' => 'text', 'eval' => array()); if ($arrColLabels[$i]['rowStyle']) { $arrFieldDef['eval']['columnFields']['col_' . $i]['eval']['style'] = 'width:' . $arrColLabels[$i]['rowStyle']; } } return $arrFieldDef; }
/** * {@inheritdoc} */ public function getFieldDefinition($arrOverrides = array()) { $arrFieldDef = parent::getFieldDefinition($arrOverrides); $this->widgetMode = $arrOverrides['tag_as_wizard']; if ($this->isTreePicker()) { $arrFieldDef['inputType'] = 'DcGeneralTreePicker'; $arrFieldDef['eval']['sourceName'] = $this->getTagSource(); $arrFieldDef['eval']['fieldType'] = 'checkbox'; $arrFieldDef['eval']['idProperty'] = $this->getAliasColumn(); $arrFieldDef['eval']['orderField'] = $this->getSortingColumn(); $arrFieldDef['eval']['minLevel'] = $arrOverrides['tag_minLevel']; $arrFieldDef['eval']['maxLevel'] = $arrOverrides['tag_maxLevel']; } elseif ($this->widgetMode == 1) { // If tag as wizard is true, change the input type. $arrFieldDef['inputType'] = 'checkboxWizard'; } elseif ($this->widgetMode == 3) { $arrFieldDef['inputType'] = 'select'; $arrFieldDef['eval']['chosen'] = true; } else { $arrFieldDef['inputType'] = 'checkbox'; } $arrFieldDef['eval']['includeBlankOption'] = true; $arrFieldDef['eval']['multiple'] = true; return $arrFieldDef; }
/** * {@inheritdoc} */ public function getAttributeSettingNames() { return array_merge(parent::getAttributeSettingNames(), array('mandatory', 'filterable', 'searchable', 'get_geo', 'get_land', 'lookupservice', 'datamode', 'single_attr_id', 'first_attr_id', 'second_attr_id')); }
/** * Initialize the template with values. * * @param Template $objTemplate The Template instance to populate. * @param array $arrRowData The row data for the current item. * @param ISimple $objSettings The render settings to use for this attribute. * * @return void */ public function prepareTemplate(Template $objTemplate, $arrRowData, $objSettings) { parent::prepareTemplate($objTemplate, $arrRowData, $objSettings); $base = \Environment::get('base'); $lang = $this->getActiveLanguageArray(); $strEmpty = $this->ensureImage($this->get('rating_emtpy'), 'system/modules/metamodelsattribute_rating/html/star-empty.png'); $strFull = $this->ensureImage($this->get('rating_full'), 'system/modules/metamodelsattribute_rating/html/star-full.png'); $strHover = $this->ensureImage($this->get('rating_hover'), 'system/modules/metamodelsattribute_rating/html/star-hover.png'); $size = getimagesize(TL_ROOT . '/' . $strEmpty); $objTemplate->imageWidth = $size[0]; $objTemplate->rateHalf = $this->get('rating_half') ? 'true' : 'false'; $objTemplate->name = 'rating_attribute_' . $this->get('id') . '_' . $arrRowData['id']; $objTemplate->ratingDisabled = TL_MODE == 'BE' || $objSettings->get('rating_disabled') || \Session::getInstance()->get($this->getLockId($arrRowData['id'])); $value = $this->get('rating_max') * floatval($arrRowData[$this->getColName()]['meanvalue']); $objTemplate->currentValue = round($value / 0.5, 0) * 0.5; $objTemplate->tipText = sprintf($lang['metamodel_rating_label'], '[VALUE]', $this->get('rating_max')); $objTemplate->ajaxUrl = sprintf('SimpleAjax.php?metamodelsattribute_rating=%s', $this->get('id')); $objTemplate->ajaxData = json_encode(array('id' => $this->get('id'), 'pid' => $this->get('pid'), 'item' => $arrRowData['id'])); $arrOptions = array(); $intInc = strlen($this->get('rating_half')) ? 0.5 : 1; $intValue = $intInc; while ($intValue <= $this->get('rating_max')) { $arrOptions[] = $intValue; $intValue += $intInc; } $objTemplate->options = $arrOptions; $objTemplate->imageEmpty = $base . $strEmpty; $objTemplate->imageFull = $base . $strFull; $objTemplate->imageHover = $base . $strHover; }