/**
  * The main editor
  * @author Ivan Rodriguez
  */
 public function editorAction()
 {
     if (!$this->view->is_admin) {
         throw new Exception("Access Denied");
     }
     $this->_helper->layout->disableLayout();
     /* Get the appropriate files and show them in a nice little combobox */
     $config = new Zend_Config_Ini(APPLICATION_PATH . "/configs/application.ini", APPLICATION_ENV);
     $xml_path = $config->xml->import_path;
     //My_Logger::log("in QuestionTemplateController::editorAction()");
     //My_Logger::log("the xml path is " . $xml_path);
     $this->view->available_files = array("" => 'Select ...') + $this->getAvailableFiles($xml_path);
     $this->view->selected_xml = $selected_xml = $this->_getParam("q");
     if ($selected_xml) {
         $question = Model_Shell_QuestionTemplate::load($xml_path . "/" . $selected_xml . ".xml");
     } else {
         $question = new Model_Shell_QuestionTemplate();
     }
     $this->view->question = $question;
     $this->view->fontSizes = $this->getFontSizeOptions();
     $this->view->substitutions = json_encode($question->getSubstitutions());
     //added by Ivan. Force for now, comment out in release
     //Model_Shell_Debug::getInstance()->saveToDisk();
 }
 function testOld()
 {
     //$this->clearAll();
     //$this->clearTemp();
     $filename = 'old.xml';
     $filepath = $this->path . "/" . $filename;
     $xml = simplexml_load_file($filepath);
     $concept = (string) $xml->concepts->concept;
     //from source
     //$importer = $this->createXmlImporter($this->path);
     //$importer->parseFile($filename);
     $obj = Model_Shell_QuestionTemplate::load($filepath);
     $this->assertEquals(trim((string) $xml->instructions), trim($obj->getInstructions()));
     $this->assertEquals(2, count($obj->getSubstitutions()));
     //Here comes the compilation. After this single call, all the artifacts are produced
     //ini_set("display_errors", 0);
     //$this->assertEquals(trim((string)$xml->instructions), $mQuestion->getInstructions());
     //ini_set("display_errors", 0);
 }