ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 case strtolower(__CLASS__):
68 case '':
69
70 $command = $this->myCtrl->getCmd(self::CMD_SHOW) . 'Cmd';
71 $this->$command();
72 break;
73
74 default:
75
76 throw new ilTestQuestionPoolException('unsupported next class');
77 }
78 }
79
80 private function showCmd()
81 {
82 $this->initColumns();
83
84
85 $this->setData($this->buildTableRowsArray(
87 ));
88
89 $this->myTpl->setContent($this->myCtrl->getHTML($this));
90 }
91
92 protected function initColumns()
93 {
94 $this->addColumn($this->myLng->txt('qpl_qst_skl_usg_skill_col'), 'skill_title', '50%');
95 $this->addColumn($this->myLng->txt('qpl_qst_skl_usg_numq_col'), 'num_questions', '');
96 $this->addColumn($this->myLng->txt('qpl_qst_skl_usg_sklpnt_col'), 'max_skill_points', '');
97 }
98
99 public function fillRow($data)
100 {
101 $this->tpl->setVariable('SKILL_TITLE', $data['skill_title']);
102 $this->tpl->setVariable('SKILL_PATH', $data['skill_path']);
103 $this->tpl->setVariable('NUM_QUESTIONS', $data['num_questions']);
104 $this->tpl->setVariable('MAX_SKILL_POINTS', $data['max_skill_points']);
105 }
106
107 public function numericOrdering($a_field)
108 {
109 switch ($a_field) {
110 case 'num_questions':
111 case 'max_skill_points':
112 return true;
113 }
114
115 return false;
116 }
117
119 {
120 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignmentList.php';
121 $assignmentList = new ilAssQuestionSkillAssignmentList($this->myDb);
122
123 $assignmentList->setParentObjId($this->poolId);
124 $assignmentList->loadFromDb();
125 $assignmentList->loadAdditionalSkillData();
126
127 return $assignmentList->getUniqueAssignedSkills();
128 }
129
130 private function buildTableRowsArray($assignedSkills)
131 {
132 $rows = array();
133
134 foreach ($assignedSkills as $assignedSkill) {
135 $rows[] = array(
136 'skill_title' => $assignedSkill['skill_title'],
137 'skill_path' => $assignedSkill['skill_path'],
138 'num_questions' => $assignedSkill['num_assigns'],
139 'max_skill_points' => $assignedSkill['max_points'],
140 );
141 }
142
143 return $rows;
144 }
145}
An exception for terminatinating execution or to throw for unit testing.
numericOrdering($a_field)
Should this field be sorted numeric?
__construct(ilCtrl $myCtrl, ilTemplate $myTpl, ilLanguage $myLng, ilDBInterface $myDb, $poolId)
This class provides processing control methods.
language handling
Class ilTable2GUI.
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.
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.
setId($a_val)
Set id.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
special template class to simplify handling of ITX/PEAR
Interface ilDBInterface.
$rows
Definition: xhr_table.php:10