/** * Read current configuration from disk * * @access public * @param string name of the configuration file * @return bool true on success */ function fromXML($fileName) { if (!file_exists($fileName)) { Amber::showError('Error', 'Config file not found: ' . htmlspecialchars($fileName)); return false; } $loader = new XMLLoader(false); $res = $loader->getArray($fileName); if (is_array($res) && is_array($res['config'])) { foreach ($res['config'] as $key => $value) { $this->{$key} = $value; } } return true; }
/** * @access private * @param string name of the report * @return Report */ function &loadReport($name) { $repPath = $this->_basePath . '/reports/'; $xmlLoader = new XMLLoader(); $res =& $xmlLoader->getArray($repPath . '/' . $name . '.xml'); $param = $res['report']; $obj = new AmberObjectRaw(); $obj->type = $this->objectTypes['report']; if (isset($param['Name'])) { $obj->name = $param['Name']; } $obj->design = file_get_contents($repPath . '/' . $param['FileNameDesign']); if (isset($param['FileNameCode']) && isset($param['ClassName'])) { $obj->class = $param['ClassName']; $obj->code = trim(file_get_contents($repPath . '/' . $param['FileNameCode'])); } return $obj; }