ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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  public function __construct(
18  $a_parent_obj,
19  $a_parent_cmd,
20  $a_tree,
21  $a_slm_obj,
22  $a_chap
23  ) {
24  global $DIC;
25 
26  $this->ctrl = $DIC->ctrl();
27  $this->lng = $DIC->language();
28  $ilCtrl = $DIC->ctrl();
29  $lng = $DIC->language();
30 
31  parent::__construct($a_parent_obj, $a_parent_cmd);
32  $this->tree = $a_tree;
33  $this->slm_object = $a_slm_obj;
34  $this->chap = $a_chap;
35  $this->addColumn($lng->txt("sahs_sco_objective"), "", "50%");
36  $this->addColumn($lng->txt("sahs_questions"), "", "50%");
37  $this->setEnableHeader(true);
38  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
39  $this->setRowTemplate(
40  "tpl.objectives_alignment_table_row.html",
41  "Modules/Scorm2004"
42  );
43  $this->getScos();
44  $this->setNoEntriesText($lng->txt("sahs_oa_no_scos"));
45  //$this->setTitle($lng->txt("sahs_objectives_alignment"));
46  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
47  $this->setTitle(
48  ilScorm2004Node::_lookupTitle($this->chap),
49  "icon_chap.svg"
50  );
51  }
52 
56  public function getScos()
57  {
58  if ($this->chap > 0) {
59  $nodes = $this->tree->getChilds($this->chap);
60  } else {
61  $nodes = $this->tree->getSubTree($this->tree->getNodeData($this->tree->root_id), true, array('sco'));
62  }
63 
64  $scos = array();
65 
66  $nr = 1;
67  foreach ($nodes as $node) {
68  if ($node["type"] == "sco") {
69  $node["nr"] = $nr++;
70  $scos[] = $node;
71  }
72  }
73 
74  $this->setDefaultOrderField("nr");
75  $this->setDefaultOrderDirection("asc");
76  $this->setData($scos);
77  }
78 
83  protected function fillRow($a_set)
84  {
85  $lng = $this->lng;
87 
88  $lng->loadLanguageModule("assessment");
89  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004NodeFactory.php");
91  $this->slm_object,
92  $a_set["child"],
93  false
94  );
95  $tr_data = $node_object->getObjectives();
96 
97  // learning objectives
98  foreach ($tr_data as $data) {
99  $this->tpl->setCurrentBlock("objective");
100  $this->tpl->setVariable(
101  "TXT_LEARNING_OBJECTIVE",
102  ilSCORM2004Sco::convertLists($data->getObjectiveID())
103  );
104  $this->tpl->setVariable("IMG_LOBJ", ilUtil::getImagePath("icon_lobj.svg"));
105  $this->tpl->parseCurrentBlock();
106  }
107 
108  // pages
109  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Page.php");
110  include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
111  $childs = $this->tree->getChilds($a_set["child"]);
112  foreach ($childs as $child) {
113  // get question ids
114  include_once("./Services/COPage/classes/class.ilPCQuestion.php");
115  $qids = ilPCQuestion::_getQuestionIdsForPage("sahs", $child["child"]);
116 
117  if (count($qids) > 0) {
118  // output questions
119  foreach ($qids as $qid) {
120  $this->tpl->setCurrentBlock("question");
121  //$qtitle = assQuestion::_getTitle($qid);
122  $qtype = assQuestion::_getQuestionType($qid);
123  //$qtext = assQuestion::_getQuestionText($qid);
124  $qtext = assQuestion::_getQuestionTitle($qid);
125  $this->tpl->setVariable("TXT_QUESTION", $qtext);
126  $this->tpl->setVariable("TXT_QTYPE", $lng->txt($qtype));
127  $this->tpl->setVariable(
128  "IMG_QST",
129  ilUtil::getImagePath("icon_tst.svg")
130  );
131  $this->tpl->parseCurrentBlock();
132  }
133 
134  // output page title
135  $page_title = ilSCORM2004Node::_lookupTitle($child["child"]);
136  $this->tpl->setCurrentBlock("page");
137  $this->tpl->setVariable("TXT_PAGE_TITLE", $page_title);
138  $this->tpl->setVariable("IMG_PAGE", ilUtil::getImagePath("icon_pg.svg"));
139  $ilCtrl->setParameterByClass("ilscorm2004pagenodegui", "obj_id", $child["child"]);
140  $this->tpl->setVariable(
141  "HREF_EDIT_PAGE",
142  $ilCtrl->getLinkTargetByClass(
143  "ilscorm2004pagenodegui",
144  "edit"
145  )
146  );
147  $this->tpl->parseCurrentBlock();
148  }
149  }
150 
151  // sco title
152  $this->tpl->setVariable("TXT_SCO_TITLE", $a_set["title"]);
153  $this->tpl->setVariable("IMG_SCO", ilUtil::getImagePath("icon_sco.svg"));
154  $ilCtrl->setParameterByClass("ilscorm2004scogui", "obj_id", $a_set["child"]);
155  $this->tpl->setVariable(
156  "HREF_EDIT_SCO",
157  $ilCtrl->getLinkTargetByClass(
158  "ilscorm2004scogui",
159  "showProperties"
160  )
161  );
162  }
163 }
static _lookupTitle($a_obj_id)
Lookup Title.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
TableGUI class for learning objectives alignments.
static _getQuestionIdsForPage($a_parent_type, $a_page_id, $a_lang="-")
Get all questions of a page.
static _getQuestionType($question_id)
Returns the question type of a question with a given id.
global $DIC
Definition: saml.php:7
static convertLists($a_text)
Convert * and # to lists.
setNoEntriesText($a_text)
Set text for an empty table.
global $ilCtrl
Definition: ilias.php:18
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
Class ilTable2GUI.
getScos()
Get scos for list (we may present this in an other way in the future)
static getInstance($a_slm_object, $a_id=0, $a_halt=true)
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
setRowTemplate($a_template, $a_template_dir="")
Set row template.
Create styles array
The data for the language used.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
__construct( $a_parent_obj, $a_parent_cmd, $a_tree, $a_slm_obj, $a_chap)
addColumn( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
setEnableHeader($a_enableheader)
Set Enable Header.
fillRow($a_set)
Standard Version of Fill Row.
static _getQuestionTitle($question_id)
Returns the question title of a question with a given id.