/**
  * Standard Version of Fill Row. Most likely to
  * be overwritten by derived class.
  */
 protected function fillRow($a_set)
 {
     global $lng, $ilCtrl;
     $lng->loadLanguageModule("assessment");
     include_once "./Modules/Scorm2004/classes/class.ilSCORM2004NodeFactory.php";
     $node_object = ilSCORM2004NodeFactory::getInstance($this->slm_object, $a_set["child"], false);
     $tr_data = $node_object->getObjectives();
     // learning objectives
     foreach ($tr_data as $data) {
         $this->tpl->setCurrentBlock("objective");
         $this->tpl->setVariable("TXT_LEARNING_OBJECTIVE", ilSCORM2004Sco::convertLists($data->getObjectiveID()));
         $this->tpl->setVariable("IMG_LOBJ", ilUtil::getImagePath("icon_lobj.svg"));
         $this->tpl->parseCurrentBlock();
     }
     // pages
     include_once "./Modules/Scorm2004/classes/class.ilSCORM2004Page.php";
     include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
     $childs = $this->tree->getChilds($a_set["child"]);
     foreach ($childs as $child) {
         // get question ids
         include_once "./Services/COPage/classes/class.ilPCQuestion.php";
         $qids = ilPCQuestion::_getQuestionIdsForPage("sahs", $child["child"]);
         if (count($qids) > 0) {
             // output questions
             foreach ($qids as $qid) {
                 $this->tpl->setCurrentBlock("question");
                 //$qtitle = assQuestion::_getTitle($qid);
                 $qtype = assQuestion::_getQuestionType($qid);
                 //$qtext = assQuestion::_getQuestionText($qid);
                 $qtext = assQuestion::_getQuestionTitle($qid);
                 $this->tpl->setVariable("TXT_QUESTION", $qtext);
                 $this->tpl->setVariable("TXT_QTYPE", $lng->txt($qtype));
                 $this->tpl->setVariable("IMG_QST", ilUtil::getImagePath("icon_tst.svg"));
                 $this->tpl->parseCurrentBlock();
             }
             // output page title
             $page_title = ilSCORM2004Node::_lookupTitle($child["child"]);
             $this->tpl->setCurrentBlock("page");
             $this->tpl->setVariable("TXT_PAGE_TITLE", $page_title);
             $this->tpl->setVariable("IMG_PAGE", ilUtil::getImagePath("icon_pg.svg"));
             $ilCtrl->setParameterByClass("ilscorm2004pagenodegui", "obj_id", $child["child"]);
             $this->tpl->setVariable("HREF_EDIT_PAGE", $ilCtrl->getLinkTargetByClass("ilscorm2004pagenodegui", "edit"));
             $this->tpl->parseCurrentBlock();
         }
     }
     // sco title
     $this->tpl->setVariable("TXT_SCO_TITLE", $a_set["title"]);
     $this->tpl->setVariable("IMG_SCO", ilUtil::getImagePath("icon_sco.svg"));
     $ilCtrl->setParameterByClass("ilscorm2004scogui", "obj_id", $a_set["child"]);
     $this->tpl->setVariable("HREF_EDIT_SCO", $ilCtrl->getLinkTargetByClass("ilscorm2004scogui", "showProperties"));
 }
 /**
  * Get question ids
  *
  * note: this method must be called afer exportXMLPageContent
  */
 function getQuestionIds()
 {
     include_once "./Services/COPage/classes/class.ilPCQuestion.php";
     return ilPCQuestion::_getQuestionIdsForPage($this->content_object->getType(), $this->getId());
 }
 function exportXMLPageObjects($a_target_dir, &$a_xml_writer, $a_inst, &$expLog)
 {
     global $ilBench;
     include_once "./Modules/Scorm2004/classes/class.ilSCORM2004PageNode.php";
     include_once "./Modules/Scorm2004/classes/class.ilSCORM2004Page.php";
     $tree = new ilTree($this->slm_id);
     $tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
     $tree->setTreeTablePK("slm_id");
     $pages = $tree->getSubTree($tree->getNodeData($this->getId()), true, 'page');
     foreach ($pages as $page) {
         $expLog->write(date("[y-m-d H:i:s] ") . "Page Object " . $page["obj_id"]);
         // export xml to writer object
         $page_obj = new ilSCORM2004Page($page["obj_id"]);
         $page_obj->exportXML($a_xml_writer, "normal", $a_inst);
         //collect media objects
         $mob_ids = $page_obj->getMediaObjectIds();
         foreach ($mob_ids as $mob_id) {
             $this->mob_ids[$mob_id] = $mob_id;
         }
         // collect all file items
         $file_ids = $page_obj->getFileItemIds();
         foreach ($file_ids as $file_id) {
             $this->file_ids[$file_id] = $file_id;
         }
         include_once "./Services/COPage/classes/class.ilPCQuestion.php";
         $q_ids = ilPCQuestion::_getQuestionIdsForPage("sahs", $page["obj_id"]);
         if (count($q_ids) > 0) {
             include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
             foreach ($q_ids as $q_id) {
                 $q_obj =& assQuestion::_instanciateQuestion($q_id);
                 $qti_file = fopen($a_target_dir . "/qti_" . $q_id . ".xml", "w");
                 fwrite($qti_file, $q_obj->toXML());
                 fclose($qti_file);
             }
         }
         unset($page_obj);
     }
 }
 function sahs_questions()
 {
     global $tpl, $lng, $ilCtrl;
     $this->setTabs();
     $this->setLocator();
     include_once "./Services/Table/classes/class.ilTableGUI.php";
     include_once "./Modules/Scorm2004/classes/class.ilSCORM2004Page.php";
     include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
     include_once "./Services/COPage/classes/class.ilPCQuestionGUI.php";
     // load template for table
     $tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.table.html");
     $tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.scormeditor_sco_question.html", "Modules/Scorm2004");
     $tbl = new ilTableGUI();
     $tbl->setTitle("Questions for " . $this->node_object->getTitle());
     $tbl->setHeaderNames(array("Question", "Page"));
     $cols = array("question", "page");
     $tbl->setHeaderVars($cols, $header_params);
     $tbl->setColumnWidth(array("50%", "50%"));
     $tbl->disable("sort");
     $tbl->disable("footer");
     $tree = new ilTree($this->slm_object->getId());
     $tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
     $tree->setTreeTablePK("slm_id");
     foreach ($tree->getSubTree($tree->getNodeData($this->node_object->getId()), true, 'page') as $page) {
         // get question ids
         include_once "./Services/COPage/classes/class.ilPCQuestion.php";
         $qids = ilPCQuestion::_getQuestionIdsForPage("sahs", $page["obj_id"]);
         if (count($qids) > 0) {
             // output questions
             foreach ($qids as $qid) {
                 $tpl->setCurrentBlock("tbl_content");
                 $tpl->setVariable("TXT_PAGE_TITLE", $page["title"]);
                 $ilCtrl->setParameterByClass("ilscorm2004pagenodegui", "obj_id", $page["obj_id"]);
                 $tpl->setVariable("HREF_EDIT_PAGE", $ilCtrl->getLinkTargetByClass("ilscorm2004pagenodegui", "edit"));
                 $qtitle = assQuestion::_getTitle($qid);
                 $tpl->setVariable("TXT_QUESTION", $qtitle);
                 $ilCtrl->setParameterByClass("ilscorm2004pagenodegui", "obj_id", $page["obj_id"]);
                 //$tpl->setVariable("HREF_EDIT_QUESTION", $ilCtrl->getLinkTargetByClass("ilscorm2004pagenodegui", "edit"));
                 $tpl->setVariable("CSS_ROW", ilUtil::switchColor($i++, "tblrow1", "tblrow2"));
                 $tpl->parseCurrentBlock();
             }
         }
     }
     $tbl->render();
 }
 /**
  * export all pages of learning module to html file
  */
 function exportHTMLPages(&$a_lm_gui, $a_target_dir, $a_lang = "")
 {
     global $tpl, $ilBench, $ilLocator;
     $pages = ilLMPageObject::getPageList($this->getId());
     $lm_tree =& $this->getLMTree();
     $first_page = $lm_tree->fetchSuccessorNode($lm_tree->getRootId(), "pg");
     $this->first_page_id = $first_page["child"];
     // iterate all learning module pages
     $mobs = array();
     $int_links = array();
     $this->offline_files = array();
     include_once "./Services/COPage/classes/class.ilPageContentUsage.php";
     include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
     // get html export id mapping
     $lm_set = new ilSetting("lm");
     $exp_id_map = array();
     if ($lm_set->get("html_export_ids")) {
         foreach ($pages as $page) {
             $exp_id = ilLMPageObject::getExportId($this->getId(), $page["obj_id"]);
             if (trim($exp_id) != "") {
                 $exp_id_map[$page["obj_id"]] = trim($exp_id);
             }
         }
     }
     //exit;
     if ($a_lang == "") {
         $a_lang = "-";
     }
     reset($pages);
     foreach ($pages as $page) {
         if (ilLMPage::_exists($this->getType(), $page["obj_id"])) {
             $ilLocator->clearItems();
             $ilBench->start("ExportHTML", "exportHTMLPage");
             $ilBench->start("ExportHTML", "exportPageHTML");
             $this->exportPageHTML($a_lm_gui, $a_target_dir, $page["obj_id"], "", $exp_id_map);
             $ilBench->stop("ExportHTML", "exportPageHTML");
             // get all snippets of page
             $pcs = ilPageContentUsage::getUsagesOfPage($page["obj_id"], $this->getType() . ":pg", 0, false, $a_lang);
             foreach ($pcs as $pc) {
                 if ($pc["type"] == "incl") {
                     $incl_mobs = ilObjMediaObject::_getMobsOfObject("mep:pg", $pc["id"]);
                     foreach ($incl_mobs as $incl_mob) {
                         $mobs[$incl_mob] = $incl_mob;
                     }
                 }
             }
             // get all media objects of page
             $pg_mobs = ilObjMediaObject::_getMobsOfObject($this->getType() . ":pg", $page["obj_id"], 0, $a_lang);
             foreach ($pg_mobs as $pg_mob) {
                 $mobs[$pg_mob] = $pg_mob;
             }
             // get all internal links of page
             $pg_links = ilInternalLink::_getTargetsOfSource($this->getType() . ":pg", $page["obj_id"], $a_lang);
             $int_links = array_merge($int_links, $pg_links);
             // get all files of page
             include_once "./Modules/File/classes/class.ilObjFile.php";
             $pg_files = ilObjFile::_getFilesOfObject($this->getType() . ":pg", $page["obj_id"], 0, $a_lang);
             $this->offline_files = array_merge($this->offline_files, $pg_files);
             // collect all questions
             include_once "./Services/COPage/classes/class.ilPCQuestion.php";
             $q_ids = ilPCQuestion::_getQuestionIdsForPage($this->getType(), $page["obj_id"], $a_lang);
             foreach ($q_ids as $q_id) {
                 $this->q_ids[$q_id] = $q_id;
             }
             $ilBench->stop("ExportHTML", "exportHTMLPage");
         }
     }
     $this->offline_mobs = $mobs;
     $this->offline_int_links = $int_links;
 }