ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilAssQuestionSkillUsagesTableGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4require_once 'Services/Table/classes/class.ilTable2GUI.php';
5
13{
14 const TABLE_ID = 'iaqsutg';
15
16 const CMD_SHOW = 'show';
17
21 private $myCtrl;
22
26 private $myTpl;
27
31 private $myLng;
32
36 private $myDb;
37
46 {
47 $this->myCtrl = $myCtrl;
48 $this->myTpl = $myTpl;
49 $this->myLng = $myLng;
50 $this->myDb = $myDb;
51
52 $this->poolId = $poolId;
53
54 $this->setId(self::TABLE_ID.$this->poolId);
55 $this->setPrefix(self::TABLE_ID.$this->poolId);
56 parent::__construct($this, self::CMD_SHOW);
57
58 $this->setRowTemplate("tpl.il_as_qpl_skl_assign_stat_row.html", "Modules/TestQuestionPool");#
59
60 $this->setDefaultOrderField("qpl_qst_skl_usg_skill_col");
61 $this->setDefaultOrderDirection("asc");
62 }
63
64 public function executeCommand()
65 {
66 switch( $this->myCtrl->getNextClass() )
67 {
68 case strtolower(__CLASS__):
69 case '':
70
71 $command = $this->myCtrl->getCmd(self::CMD_SHOW).'Cmd';
72 $this->$command();
73 break;
74
75 default:
76
77 throw new ilTestQuestionPoolException('unsupported next class');
78 }
79 }
80
81 private function showCmd()
82 {
83 $this->initColumns();
84
85
86 $this->setData($this->buildTableRowsArray(
88 ));
89
90 $this->myTpl->setContent($this->myCtrl->getHTML($this));
91 }
92
93 protected function initColumns()
94 {
95 $this->addColumn($this->myLng->txt('qpl_qst_skl_usg_skill_col'), 'skill_title', '50%');
96 $this->addColumn($this->myLng->txt('qpl_qst_skl_usg_numq_col'), 'num_questions', '');
97 $this->addColumn($this->myLng->txt('qpl_qst_skl_usg_sklpnt_col'), 'max_skill_points', '');
98 }
99
100 public function fillRow($data)
101 {
102 $this->tpl->setVariable('SKILL_TITLE', $data['skill_title']);
103 $this->tpl->setVariable('SKILL_PATH', $data['skill_path']);
104 $this->tpl->setVariable('NUM_QUESTIONS', $data['num_questions']);
105 $this->tpl->setVariable('MAX_SKILL_POINTS', $data['max_skill_points']);
106 }
107
108 public function numericOrdering($a_field)
109 {
110 switch($a_field)
111 {
112 case 'num_questions':
113 case 'max_skill_points':
114 return true;
115 }
116
117 return false;
118 }
119
121 {
122 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignmentList.php';
123 $assignmentList = new ilAssQuestionSkillAssignmentList($this->myDb);
124
125 $assignmentList->setParentObjId($this->poolId);
126 $assignmentList->loadFromDb();
127 $assignmentList->loadAdditionalSkillData();
128
129 return $assignmentList->getUniqueAssignedSkills();
130 }
131
132 private function buildTableRowsArray($assignedSkills)
133 {
134 $rows = array();
135
136 foreach($assignedSkills as $assignedSkill)
137 {
138 $rows[] = array(
139 'skill_title' => $assignedSkill['skill_title'],
140 'skill_path' => $assignedSkill['skill_path'],
141 'num_questions' => $assignedSkill['num_assigns'],
142 'max_skill_points' => $assignedSkill['max_points'],
143 );
144 }
145
146 return $rows;
147 }
148}
numericOrdering($a_field)
Should this field be sorted numeric?
__construct(ilCtrl $myCtrl, ilTemplate $myTpl, ilLanguage $myLng, ilDB $myDb, $poolId)
This class provides processing control methods.
Database Wrapper.
Definition: class.ilDB.php:29
language handling
Class ilTable2GUI.
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.
setPrefix($a_prefix)
set prefix for sort and offset fields (if you have two or more tables on a page that you want to sort...
setData($a_data)
set table data @access public
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
setId($a_val)
Set id.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
special template class to simplify handling of ITX/PEAR