_groupTitle = (string)$groupTitle;
return $this;
}
public function getGroupTitle()
{
return $this->_groupTitle;
}
public function getData()
{
/** @var $itemObj Qs_Db_Obj */
$itemObj = App_Cms_Obj::getInstance()->getItemObject($this->getOption('type'));
$itemObj->setLanguage(Qs_Constant::get('CURRENT_LANGUAGE'))
->setPrimaryKey($this->getOption('number'))
->initData();
$data = $itemObj->getData();
if (!isset($data['content'])) {
$itemObj->setLanguage(Qs_Constant::get('DEFAULT_LANGUAGE'))
->setPrimaryKey($this->getOption('number'))
->clearData()
->initData();
$data = $itemObj->getData();
}
return $data;
}
public function exec()
{
$data = $this->getData();
if (!isset($data['content'])) {
return false;
}
if (null !== ($placeholdersSource = $this->getConfig('placeholders'))) {
$separator = (false !== strpos($placeholdersSource, '\\')) ? '\\' : '_';
$placeholderSourceObj = 'App' . $separator . $placeholdersSource . 'Obj';
if (class_exists($placeholderSourceObj)) {
/** @var Qs_Db_Obj $placeholderObj */
$placeholderObj = new $placeholderSourceObj();
$placeholdersData = $placeholderObj->getPlaceholdersData();
foreach ($placeholdersData as $idx => $text) {
if (is_object($text)) {
$placeholdersData[$idx] = (string) $text;
} else {
$placeholdersData[$idx] = htmlspecialchars($text);
}
}
$data['content'] = str_replace(
array_keys($placeholdersData),
array_values($placeholdersData),
$data['content']
);
}
}
$data['tpl'] = $this->getTemplate('view.tpl');
$this->_addItem($data);
return $this;
}
}