ILIAS  release_4-3 Revision
 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.png");
39  }
40 
44  function getScos()
45  {
46  if ($this->chap > 0)
47  {
48  $nodes = $this->tree->getChilds($this->chap);
49  }
50  else
51  {
52  $nodes = $this->tree->getSubTree($this->tree->getNodeData($this->tree->root_id),true,array('sco'));
53  }
54 
55  $scos = array();
56 
57  $nr = 1;
58  foreach($nodes as $node)
59  {
60  if ($node["type"] == "sco")
61  {
62  $node["nr"] = $nr++;
63  $scos[] = $node;
64  }
65  }
66 
67  $this->setDefaultOrderField("nr");
68  $this->setDefaultOrderDirection("asc");
69  $this->setData($scos);
70  }
71 
76  protected function fillRow($a_set)
77  {
78  global $lng, $ilCtrl;
79 
80  $lng->loadLanguageModule("assessment");
81  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004NodeFactory.php");
82  $node_object = ilSCORM2004NodeFactory::getInstance($this->slm_object,
83  $a_set["child"], false);
84  $tr_data = $node_object->getObjectives();
85 
86  // learning objectives
87  foreach($tr_data as $data)
88  {
89  $this->tpl->setCurrentBlock("objective");
90  $this->tpl->setVariable("TXT_LEARNING_OBJECTIVE",
91  ilSCORM2004Sco::convertLists($data->getObjectiveID()));
92  $this->tpl->setVariable("IMG_LOBJ", ilUtil::getImagePath("icon_lobj_s.png"));
93  $this->tpl->parseCurrentBlock();
94  }
95 
96  // pages
97  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Page.php");
98  include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
99  $childs = $this->tree->getChilds($a_set["child"]);
100  foreach ($childs as $child)
101  {
102  // get question ids
103  $qids = ilSCORM2004Page::_getQuestionIdsForPage("sahs", $child["child"]);
104 
105  if (count($qids) > 0)
106  {
107  // output questions
108  foreach ($qids as $qid)
109  {
110  $this->tpl->setCurrentBlock("question");
111  //$qtitle = assQuestion::_getTitle($qid);
112  $qtype = assQuestion::_getQuestionType($qid);
113  //$qtext = assQuestion::_getQuestionText($qid);
114  $qtext = assQuestion::_getQuestionTitle($qid);
115  $this->tpl->setVariable("TXT_QUESTION", $qtext);
116  $this->tpl->setVariable("TXT_QTYPE", $lng->txt($qtype));
117  $this->tpl->setVariable("IMG_QST",
118  ilUtil::getImagePath("comment_question.png"));
119  $this->tpl->parseCurrentBlock();
120  }
121 
122  // output page title
123  $page_title = ilSCORM2004Node::_lookupTitle($child["child"]);
124  $this->tpl->setCurrentBlock("page");
125  $this->tpl->setVariable("TXT_PAGE_TITLE", $page_title);
126  $this->tpl->setVariable("IMG_PAGE", ilUtil::getImagePath("icon_pg_s.png"));
127  $ilCtrl->setParameterByClass("ilscorm2004pagenodegui", "obj_id", $child["child"]);
128  $this->tpl->setVariable("HREF_EDIT_PAGE",
129  $ilCtrl->getLinkTargetByClass("ilscorm2004pagenodegui",
130  "edit"));
131  $this->tpl->parseCurrentBlock();
132  }
133  }
134 
135  // sco title
136  $this->tpl->setVariable("TXT_SCO_TITLE", $a_set["title"]);
137  $this->tpl->setVariable("IMG_SCO", ilUtil::getImagePath("icon_sco_s.png"));
138  $ilCtrl->setParameterByClass("ilscorm2004scogui", "obj_id", $a_set["child"]);
139  $this->tpl->setVariable("HREF_EDIT_SCO",
140  $ilCtrl->getLinkTargetByClass("ilscorm2004scogui",
141  "showProperties"));
142  }
143 
144 }
145 ?>