/** * Constructor * @param string $name Name * @param string $caption Caption * @param string $value Initial content */ function SpawEditorPage($name, $caption, $value = '', $direction = 'ltr') { // workaround for names with [ and ] $_page_count = SpawConfig::getStaticConfigItem('_page_count'); if ($_page_count != null) { SpawConfig::setStaticConfigItem('_page_count', $_page_count->value + 1); } else { SpawConfig::setStaticConfigItem('_page_count', 1); } $_pn = SpawConfig::getStaticConfigValue('_page_count'); $ctrl_id = str_replace(']', '_', str_replace('[', '_', $name)); if ($ctrl_id != $name) { $ctrl_id = $ctrl_id . '_' . $_pn; } $this->name = $ctrl_id; $this->inputName = $name; $this->caption = $caption; $this->value = $value; $this->direction = $direction; }
/** * Gets global value for the element of config item provided item's value is an array * @param string $name Config item name * @param mixed $index Array index * @returns mixed Element value */ function getStaticConfigValueElement($name, $index) { $cfg_item = SpawConfig::getStaticConfigItem($name); if ($cfg_item && is_array($cfg_item->value) && !empty($cfg_item->value[$index])) { return $cfg_item->value[$index]; } else { return NULL; } }