/** * * @access public * @param string report's design as XML * */ function initialize_report($strXML) { // // Common initialization // $res =& XMLLoader::_makeXMLTree($strXML); if (count($res) == 0) { Amber::showError('Parse error', XMLLoader::getParseError()); die; } $xml = $res['report']; $this->Width = $xml['Width']; if (!$this->Name) { $this->Name = $xml['Name']; } if (isset($xml['Printer'])) { $prt =& $xml['Printer']; $this->LeftMargin = empty($prt['LeftMargin']) ? 720 : $prt['LeftMargin']; $this->RightMargin = empty($prt['RightMargin']) ? 720 : $prt['RightMargin']; $this->TopMargin = empty($prt['TopMargin']) ? 720 : $prt['TopMargin']; $this->BottomMargin = empty($prt['BottomMargin']) ? 720 : $prt['BottomMargin']; $this->Orientation = MSPageOrientation($prt['Orientation']); MSPageSize($prt['PaperSize'], $this->PaperSize, $this->PaperWidth, $this->PaperHeight); } if ($xml['RecordSource']) { $this->RecordSource = $xml['RecordSource']; } $this->hReport = objectHandler::getHandle($this); /* * Sections */ $sections = array('ReportHeader', 'PageHeader', 'Detail', 'ReportFooter', 'PageFooter'); foreach ($sections as $secName) { if (isset($xml[$secName])) { $this->{$secName} =& new Section($secName); $this->Sections[$secName] =& $this->{$secName}; $this->{$secName}->load($this, $xml[$secName]); } else { $this->{$secName} =& new SectionNull($secName); $this->Sections[$secName] =& $this->{$secName}; $this->{$secName}->load($this, array()); } } /* * Group Sections */ $groupSections = array('GroupHeaders', 'GroupFooters'); foreach ($groupSections as $groupSecName) { if (is_array($xml[$groupSecName])) { foreach ($xml[$groupSecName] as $i => $sectionXML) { $t =& $this->{$groupSecName}; // reference to array $t[$i] =& new GroupSection($groupSecName); $t[$i]->load($this, $sectionXML); $this->Sections[$t[$i]->Name] =& $t[$i]; } } } /* * in labels: change property Parent from name (string) to reference (&obj) */ //FIXME: this should be moved to Control-Class (with a few parameter-changes.....) if (is_array($this->Controls)) { foreach ($this->Controls as $i => $ctrl) { if (isset($ctrl->Parent)) { if (!isset($this->Controls[$ctrl->Parent])) { Amber::showError('Internal Error', 'Referenced parent control with name="' . $ctrl->Parent . '" does not exist.'); die; } $this->Controls[$i]->Parent =& $this->Controls[$ctrl->Parent]; $this->Controls[$i]->Properties['Parent'] =& $this->Controls[$ctrl->Parent]; } } } /* * Group Levels */ if (is_array($xml['GroupLevels'])) { foreach ($xml['GroupLevels'] as $i => $levelXML) { $this->GroupLevels[$i] =& new GroupLevel(); $this->GroupLevels[$i]->load($levelXML); } } // mirror controls and sections into user space $this->_Code->initialize($this); }