ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilObjectivesAlignmentTableGUI.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2008 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
24 include_once("Services/Table/classes/class.ilTable2GUI.php");
25 
35 {
36 
37  function __construct($a_parent_obj, $a_parent_cmd,
38  $a_tree, $a_slm_obj, $a_chap)
39  {
40  global $ilCtrl, $lng;
41 
42  parent::__construct($a_parent_obj, $a_parent_cmd);
43  $this->tree = $a_tree;
44  $this->slm_object = $a_slm_obj;
45  $this->chap = $a_chap;
46  $this->addColumn($lng->txt("sahs_sco_objective"), "", "50%");
47  $this->addColumn($lng->txt("sahs_questions"), "", "50%");
48  $this->setEnableHeader(true);
49  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
50  $this->setRowTemplate("tpl.objectives_alignment_table_row.html",
51  "Modules/Scorm2004");
52  $this->getScos();
53  $this->setNoEntriesText($lng->txt("sahs_oa_no_scos"));
54  //$this->setTitle($lng->txt("sahs_objectives_alignment"));
55  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
56  $this->setTitle(ilScorm2004Node::_lookupTitle($this->chap),
57  "icon_chap.gif");
58  }
59 
63  function getScos()
64  {
65  $nodes = $this->tree->getChilds($this->chap);
66  $scos = array();
67 
68  $nr = 1;
69  foreach($nodes as $node)
70  {
71  if ($node["type"] == "sco")
72  {
73  $node["nr"] = $nr++;
74  $scos[] = $node;
75  }
76  }
77 
78  $this->setDefaultOrderField("nr");
79  $this->setDefaultOrderDirection("asc");
80  $this->setData($scos);
81  }
82 
87  protected function fillRow($a_set)
88  {
89  global $lng, $ilCtrl;
90 
91  $lng->loadLanguageModule("assessment");
92  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004NodeFactory.php");
93  $node_object = ilSCORM2004NodeFactory::getInstance($this->slm_object,
94  $a_set["child"], false);
95  $tr_data = $node_object->getObjectives();
96 
97  // learning objectives
98  foreach($tr_data as $data)
99  {
100  $this->tpl->setCurrentBlock("objective");
101  $this->tpl->setVariable("TXT_LEARNING_OBJECTIVE", $data->getObjectiveID());
102  $this->tpl->setVariable("IMG_LOBJ", ilUtil::getImagePath("icon_lobj_s.gif"));
103  $this->tpl->parseCurrentBlock();
104  }
105 
106  // pages
107  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Page.php");
108  include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
109  $childs = $this->tree->getChilds($a_set["child"]);
110  foreach ($childs as $child)
111  {
112  // get question ids
113  $qids = ilSCORM2004Page::_getQuestionIdsForPage("sahs", $child["child"]);
114 
115  if (count($qids) > 0)
116  {
117  // output questions
118  foreach ($qids as $qid)
119  {
120  $this->tpl->setCurrentBlock("question");
121  //$qtitle = assQuestion::_getTitle($qid);
122  $qtype = assQuestion::_getQuestionType($qid);
123  $qtext = assQuestion::_getQuestionText($qid);
124  $this->tpl->setVariable("TXT_QUESTION", $qtext);
125  $this->tpl->setVariable("TXT_QTYPE", $lng->txt($qtype));
126  $this->tpl->setVariable("IMG_QST",
127  ilUtil::getImagePath("comment_question.gif"));
128  $this->tpl->parseCurrentBlock();
129  }
130 
131  // output page title
132  $page_title = ilSCORM2004Node::_lookupTitle($child["child"]);
133  $this->tpl->setCurrentBlock("page");
134  $this->tpl->setVariable("TXT_PAGE_TITLE", $page_title);
135  $this->tpl->setVariable("IMG_PAGE", ilUtil::getImagePath("icon_pg_s.gif"));
136  $ilCtrl->setParameterByClass("ilscorm2004pagenodegui", "obj_id", $child["child"]);
137  $this->tpl->setVariable("HREF_EDIT_PAGE",
138  $ilCtrl->getLinkTargetByClass("ilscorm2004pagenodegui",
139  "edit"));
140  $this->tpl->parseCurrentBlock();
141  }
142  }
143 
144  // sco title
145  $this->tpl->setVariable("TXT_SCO_TITLE", $a_set["title"]);
146  $this->tpl->setVariable("IMG_SCO", ilUtil::getImagePath("icon_sco_s.gif"));
147  $ilCtrl->setParameterByClass("ilscorm2004scogui", "obj_id", $a_set["child"]);
148  $this->tpl->setVariable("HREF_EDIT_SCO",
149  $ilCtrl->getLinkTargetByClass("ilscorm2004scogui",
150  "showProperties"));
151  }
152 
153 }
154 ?>