예제 #1
0
 /**
  * Loads an XML file and set's up the class to generate reports based on
  * the description of the class.
  * @param string $report A path to the xml file which contains the
  *                       description of this report
  */
 public function __construct($report, $redirected = false)
 {
     parent::__construct();
     $this->xml = simplexml_load_file(($redirected ? "" : "app/modules") . $report);
     $path = $this->xml["name"] . "/generate/pdf";
     $this->name = (string) $this->xml["name"];
     $this->label = $this->xml["label"];
     Application::setTitle($this->label);
     $baseModel = $this->xml["baseModel"];
     $this->basePackage = isset($this->xml["basePackage"]) ? (string) $this->xml["basePackage"] : reset(explode(".", (string) $this->xml["baseModel"]));
     try {
         $baseModel = Model::load((string) $baseModel);
     } catch (Exception $e) {
         throw new Exception("Base model (" . (string) $baseModel . ") could not be loaded ({$e->getMessage()})");
     }
     $this->referencedFields = array();
     foreach ($baseModel->referencedFields as $field) {
         $this->referencedFields[] = $field["referencing_field"];
     }
 }