ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilObjectivesAlignmentTableGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 include_once("Services/Table/classes/class.ilTable2GUI.php");
6 
16 {
17 
18  function __construct($a_parent_obj, $a_parent_cmd,
19  $a_tree, $a_slm_obj, $a_chap)
20  {
21  global $ilCtrl, $lng;
22 
23  parent::__construct($a_parent_obj, $a_parent_cmd);
24  $this->tree = $a_tree;
25  $this->slm_object = $a_slm_obj;
26  $this->chap = $a_chap;
27  $this->addColumn($lng->txt("sahs_sco_objective"), "", "50%");
28  $this->addColumn($lng->txt("sahs_questions"), "", "50%");
29  $this->setEnableHeader(true);
30  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
31  $this->setRowTemplate("tpl.objectives_alignment_table_row.html",
32  "Modules/Scorm2004");
33  $this->getScos();
34  $this->setNoEntriesText($lng->txt("sahs_oa_no_scos"));
35  //$this->setTitle($lng->txt("sahs_objectives_alignment"));
36  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
37  $this->setTitle(ilScorm2004Node::_lookupTitle($this->chap),
38  "icon_chap.gif");
39  }
40 
44  function getScos()
45  {
46  $nodes = $this->tree->getChilds($this->chap);
47  $scos = array();
48 
49  $nr = 1;
50  foreach($nodes as $node)
51  {
52  if ($node["type"] == "sco")
53  {
54  $node["nr"] = $nr++;
55  $scos[] = $node;
56  }
57  }
58 
59  $this->setDefaultOrderField("nr");
60  $this->setDefaultOrderDirection("asc");
61  $this->setData($scos);
62  }
63 
68  protected function fillRow($a_set)
69  {
70  global $lng, $ilCtrl;
71 
72  $lng->loadLanguageModule("assessment");
73  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004NodeFactory.php");
74  $node_object = ilSCORM2004NodeFactory::getInstance($this->slm_object,
75  $a_set["child"], false);
76  $tr_data = $node_object->getObjectives();
77 
78  // learning objectives
79  foreach($tr_data as $data)
80  {
81  $this->tpl->setCurrentBlock("objective");
82  $this->tpl->setVariable("TXT_LEARNING_OBJECTIVE", $data->getObjectiveID());
83  $this->tpl->setVariable("IMG_LOBJ", ilUtil::getImagePath("icon_lobj_s.gif"));
84  $this->tpl->parseCurrentBlock();
85  }
86 
87  // pages
88  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Page.php");
89  include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
90  $childs = $this->tree->getChilds($a_set["child"]);
91  foreach ($childs as $child)
92  {
93  // get question ids
94  $qids = ilSCORM2004Page::_getQuestionIdsForPage("sahs", $child["child"]);
95 
96  if (count($qids) > 0)
97  {
98  // output questions
99  foreach ($qids as $qid)
100  {
101  $this->tpl->setCurrentBlock("question");
102  //$qtitle = assQuestion::_getTitle($qid);
103  $qtype = assQuestion::_getQuestionType($qid);
104  $qtext = assQuestion::_getQuestionText($qid);
105  $this->tpl->setVariable("TXT_QUESTION", $qtext);
106  $this->tpl->setVariable("TXT_QTYPE", $lng->txt($qtype));
107  $this->tpl->setVariable("IMG_QST",
108  ilUtil::getImagePath("comment_question.gif"));
109  $this->tpl->parseCurrentBlock();
110  }
111 
112  // output page title
113  $page_title = ilSCORM2004Node::_lookupTitle($child["child"]);
114  $this->tpl->setCurrentBlock("page");
115  $this->tpl->setVariable("TXT_PAGE_TITLE", $page_title);
116  $this->tpl->setVariable("IMG_PAGE", ilUtil::getImagePath("icon_pg_s.gif"));
117  $ilCtrl->setParameterByClass("ilscorm2004pagenodegui", "obj_id", $child["child"]);
118  $this->tpl->setVariable("HREF_EDIT_PAGE",
119  $ilCtrl->getLinkTargetByClass("ilscorm2004pagenodegui",
120  "edit"));
121  $this->tpl->parseCurrentBlock();
122  }
123  }
124 
125  // sco title
126  $this->tpl->setVariable("TXT_SCO_TITLE", $a_set["title"]);
127  $this->tpl->setVariable("IMG_SCO", ilUtil::getImagePath("icon_sco_s.gif"));
128  $ilCtrl->setParameterByClass("ilscorm2004scogui", "obj_id", $a_set["child"]);
129  $this->tpl->setVariable("HREF_EDIT_SCO",
130  $ilCtrl->getLinkTargetByClass("ilscorm2004scogui",
131  "showProperties"));
132  }
133 
134 }
135 ?>