public function addColumn($column) { if (preg_match("/\\{i18n\\:.*\\}/i", $column['headerText'])) { $code = preg_replace("/\\{i18n\\:(.*)\\}/i", "\$1", $column['headerText']); $column['headerText'] = org_glizy_locale_Locale::getPlain($code); } $this->columns[] = $column; }
function render() { $content = $this->getContent(); $outputTitle = ''; $outputImage = ''; $outputProperty = ''; $outputDescription = ''; foreach ($this->items as $i) { $value = $content[$i['field']]; if (glz_empty($value)) { continue; } if (is_array($value) && $value['__html__']) { $value = $value['__html__']; } $renderCell = $i['renderCell']; if (!empty($renderCell)) { if (!is_object($renderCell)) { $renderCell =& org_glizy_ObjectFactory::createObject($renderCell); $i['renderCell'] = $renderCell; } if (is_object($renderCell)) { $value = $renderCell->renderCell($value); } } $label = $i['label']; if (preg_match("/\\{i18n\\:.*\\}/i", $label)) { $code = preg_replace("/\\{i18n\\:(.*)\\}/i", "\$1", $label); $label = org_glizy_locale_Locale::getPlain($code); } if ($i['type'] == 'title') { $outputTitle .= '<h2>' . $value . '</h2>'; } else { if ($i['type'] == 'property') { $outputProperty .= '<li><span>' . $label . ':</span> ' . $value . '</li>'; } else { if ($i['type'] == 'description') { $outputDescription .= '<h3>' . $label . '</h3> ' . $value; } else { if ($i['type'] == 'image') { $outputImage .= $value; } } } } } $cssClass = $this->getAttribute('cssClass'); if ($outputProperty != '') { $outputProperty = '<ul>' . $outputProperty . '</ul>'; } if ($outputImage != '') { $outputImage = '<dic class="row"><div class="three columns images">' . $outputImage . '</div>'; $outputProperty = '<div class="eight columns">' . $outputProperty . '</div></div>'; } $output = '<div id="' . $this->getOriginalId() . '"' . ($cssClass != "" ? ' class="' . $cssClass . '"' : '') . '>'; $output .= $outputTitle . $outputImage . $outputProperty . $outputDescription; $output .= '</div>'; $this->addOutputCode($output); }
public function addCriteria($id, $label, $type, $values, $dataProvider) { if (preg_match("/\\{i18n\\:.*\\}/i", $label)) { $code = preg_replace("/\\{i18n\\:(.*)\\}/i", "\$1", $label); $label = org_glizy_locale_Locale::getPlain($code); } $temp = new StdClass(); $temp->id = $id; $temp->label = $label; $temp->type = $type; $temp->values = $values; $temp->dataProvider = $dataProvider; $this->criteria[$temp->label] = $temp; }
/** * @param $name * * @return mixed|org_glizy_components_Component|string * @throws Exception */ function &getAttribute($name) { $value = isset($this->_attributes[$name]) ? $this->_attributes[$name] : null; if (is_string($value)) { if (@$this->_attributesDefinition[$name]['type'] == COMPONENT_TYPE_OBJECT || preg_match("/^\\{[^\\:]*\\}\$/i", $value)) { $value = str_replace('{', '', $value); $value = str_replace('}', '', $value); if (strpos($value, '.') === false) { $value =& $this->getComponentById($value); } else { // controlla se c'è da chiamare un metodo $phpArray = explode('.', $value); if (count($phpArray)) { $phpcode = '$A = &$this->getComponentById(\'' . $phpArray[0] . '\');'; for ($i = 1; $i < count($phpArray); $i++) { $phpcode .= '$' . chr(65 + $i) . '=$' . chr(64 + $i) . '->' . $phpArray[$i] . ';'; } $phpcode = $phpcode . '; return $' . chr(64 + $i) . ';'; $value = eval($phpcode); } } } else { if (preg_match("/\\{php\\:.*\\}/i", $value)) { // Codice php per ottenere il valore dell'attributo $phpcode = org_glizy_helpers_PhpScript::parse($value); $value = eval($phpcode); //return $value; } else { if (preg_match("/\\{i18n\\:.*\\}/i", $value)) { $code = preg_replace("/\\{i18n\\:(.*)\\}/i", "\$1", $value); $value = org_glizy_locale_Locale::getPlain($code); } else { if (preg_match("/\\{config\\:.*\\}/i", $value)) { $code = preg_replace("/\\{config\\:(.*)\\}/i", "\$1", $value); $value = __Config::get($code); } } } } } if ($value && !is_object($value) && !is_array($value)) { $value = $this->_validateAttributeValue($name, $value); } return $value; }
function _searchNodeDetails(&$myNode, &$title, $language) { if ($myNode->hasAttribute('value')) { $title = $myNode->getAttribute('value'); if (preg_match("/\\{i18n\\:.*\\}/i", $title)) { $code = preg_replace("/\\{i18n\\:(.*)\\}/i", "\$1", $title); $title = org_glizy_locale_Locale::getPlain($code); } return $title; } foreach ($myNode->childNodes as $currNode) { if (($currNode->nodeName == 'Title' || $currNode->nodeName == 'glz:Title') && $currNode->getAttribute('lang') == $language) { $title = $currNode->hasAttribute('value') ? trim($currNode->getAttribute('value')) : trim($currNode->getText()); break; } } }