ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
ilTestSkillQuestionAssignmentsGUI Class Reference
+ Collaboration diagram for ilTestSkillQuestionAssignmentsGUI:

Public Member Functions

 __construct (ilCtrl $ctrl, ilTemplate $tpl, ilLanguage $lng, ilDB $db, ilObjTest $testOBJ)
 
 executeCommand ()
 

Data Fields

const CMD_SHOW_SKILL_QUEST_ASSIGNS = 'showSkillQuestionAssignments'
 
const CMD_SAVE_SKILL_POINTS = 'saveSkillPoints'
 
const CMD_SHOW_SKILL_SELECT = 'showSkillSelection'
 
const CMD_ADD_SKILL_QUEST_ASSIGN = 'addSkillQuestionAssignment'
 
const CMD_REMOVE_SKILL_QUEST_ASSIGN = 'removeSkillQuestionAssignment'
 

Private Member Functions

 addSkillQuestionAssignmentCmd ()
 
 removeSkillQuestionAssignmentCmd ()
 
 showSkillSelectionCmd ()
 
 saveSkillPointsCmd ()
 
 showSkillQuestionAssignmentsCmd ()
 
 buildTableGUI ()
 
 buildSkillQuestionAssignmentList ()
 
 buildSkillSelectorGUI ()
 
 isTestQuestion ($questionId)
 

Private Attributes

 $ctrl
 
 $tpl
 
 $lng
 
 $db
 
 $testOBJ
 

Detailed Description

Definition at line 14 of file class.ilTestSkillQuestionAssignmentsGUI.php.

Constructor & Destructor Documentation

◆ __construct()

Member Function Documentation

◆ addSkillQuestionAssignmentCmd()

ilTestSkillQuestionAssignmentsGUI::addSkillQuestionAssignmentCmd ( )
private

Definition at line 62 of file class.ilTestSkillQuestionAssignmentsGUI.php.

63 {
64 $questionId = (int)$_GET['question_id'];
65
66 $skillParameter = explode(':',$_GET['selected_skill']);
67 $skillBaseId = (int)$skillParameter[0];
68 $skillTrefId = (int)$skillParameter[1];
69
70 if( $this->isTestQuestion($questionId) && $skillBaseId )
71 {
72 require_once 'Modules/Test/classes/class.ilTestSkillQuestionAssignment.php';
73 $assignment = new ilTestSkillQuestionAssignment($this->db);
74
75 $assignment->setTestId($this->testOBJ->getTestId());
76 $assignment->setQuestionId($questionId);
77 $assignment->setSkillBaseId($skillBaseId);
78 $assignment->setSkillTrefId($skillTrefId);
79
80 if( !$assignment->dbRecordExists() )
81 {
83
84 $assignment->saveToDb();
85 }
86 }
87
88 $this->ctrl->redirect($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
89 }
$_GET["client_id"]

References $_GET, ilTestSkillQuestionAssignment\DEFAULT_COMPETENCE_POINTS, and isTestQuestion().

+ Here is the call graph for this function:

◆ buildSkillQuestionAssignmentList()

ilTestSkillQuestionAssignmentsGUI::buildSkillQuestionAssignmentList ( )
private

Definition at line 187 of file class.ilTestSkillQuestionAssignmentsGUI.php.

188 {
189 require_once 'Modules/Test/classes/class.ilTestSkillQuestionAssignmentList.php';
190 $assignmentList = new ilTestSkillQuestionAssignmentList($this->db);
191 $assignmentList->setTestId($this->testOBJ->getTestId());
192
193 return $assignmentList;
194 }

Referenced by showSkillQuestionAssignmentsCmd().

+ Here is the caller graph for this function:

◆ buildSkillSelectorGUI()

ilTestSkillQuestionAssignmentsGUI::buildSkillSelectorGUI ( )
private

Definition at line 196 of file class.ilTestSkillQuestionAssignmentsGUI.php.

197 {
198 require_once 'Services/Skill/classes/class.ilSkillSelectorGUI.php';
199
200 $skillSelectorGUI = new ilSkillSelectorGUI(
201 $this, self::CMD_SHOW_SKILL_SELECT, $this, self::CMD_ADD_SKILL_QUEST_ASSIGN
202 );
203
204 return $skillSelectorGUI;
205 }
Explorer class that works on tree objects (Services/Tree)

Referenced by showSkillSelectionCmd().

+ Here is the caller graph for this function:

◆ buildTableGUI()

ilTestSkillQuestionAssignmentsGUI::buildTableGUI ( )
private

Definition at line 179 of file class.ilTestSkillQuestionAssignmentsGUI.php.

180 {
181 require_once 'Modules/Test/classes/tables/class.ilTestSkillQuestionAssignmentsTableGUI.php';
182 $table = new ilTestSkillQuestionAssignmentsTableGUI($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS, $this->ctrl, $this->lng);
183
184 return $table;
185 }

Referenced by showSkillQuestionAssignmentsCmd().

+ Here is the caller graph for this function:

◆ executeCommand()

ilTestSkillQuestionAssignmentsGUI::executeCommand ( )

Definition at line 55 of file class.ilTestSkillQuestionAssignmentsGUI.php.

56 {
57 $cmd = $this->ctrl->getCmd(self::CMD_SHOW_SKILL_QUEST_ASSIGNS) . 'Cmd';
58
59 $this->$cmd();
60 }
$cmd
Definition: sahs_server.php:35

References $cmd.

◆ isTestQuestion()

ilTestSkillQuestionAssignmentsGUI::isTestQuestion (   $questionId)
private

Definition at line 207 of file class.ilTestSkillQuestionAssignmentsGUI.php.

208 {
209 foreach($this->testOBJ->getTestQuestions() as $question)
210 {
211 if( $question['question_id'] == $questionId )
212 {
213 return true;
214 }
215 }
216
217 return false;
218 }

Referenced by addSkillQuestionAssignmentCmd(), removeSkillQuestionAssignmentCmd(), and saveSkillPointsCmd().

+ Here is the caller graph for this function:

◆ removeSkillQuestionAssignmentCmd()

ilTestSkillQuestionAssignmentsGUI::removeSkillQuestionAssignmentCmd ( )
private

Definition at line 91 of file class.ilTestSkillQuestionAssignmentsGUI.php.

92 {
93 $questionId = (int)$_GET['question_id'];
94 $skillBaseId = (int)$_GET['skill_base_id'];
95 $skillTrefId = (int)$_GET['skill_tref_id'];
96
97 if( $this->isTestQuestion($questionId) && $skillBaseId )
98 {
99 require_once 'Modules/Test/classes/class.ilTestSkillQuestionAssignment.php';
100 $assignment = new ilTestSkillQuestionAssignment($this->db);
101
102 $assignment->setTestId($this->testOBJ->getTestId());
103 $assignment->setQuestionId($questionId);
104 $assignment->setSkillBaseId($skillBaseId);
105 $assignment->setSkillTrefId($skillTrefId);
106
107 if( $assignment->dbRecordExists() )
108 {
109 $assignment->deleteFromDb();
110 }
111 }
112
113 $this->ctrl->redirect($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
114 }

References $_GET, and isTestQuestion().

+ Here is the call graph for this function:

◆ saveSkillPointsCmd()

ilTestSkillQuestionAssignmentsGUI::saveSkillPointsCmd ( )
private

Definition at line 128 of file class.ilTestSkillQuestionAssignmentsGUI.php.

129 {
130 if( is_array($_POST['quantifiers']) )
131 {
132 require_once 'Modules/Test/classes/class.ilTestSkillQuestionAssignment.php';
133
134 $success = false;
135
136 foreach($_POST['quantifiers'] as $assignmentKey => $quantifier)
137 {
138 $assignmentKey = explode(':',$assignmentKey);
139 $skillBaseId = (int)$assignmentKey[0];
140 $skillTrefId = (int)$assignmentKey[1];
141 $questionId = (int)$assignmentKey[2];
142
143 if( $this->isTestQuestion($questionId) && (int)$quantifier > 0 )
144 {
145 $assignment = new ilTestSkillQuestionAssignment($this->db);
146
147 $assignment->setTestId($this->testOBJ->getTestId());
148 $assignment->setQuestionId($questionId);
149 $assignment->setSkillBaseId($skillBaseId);
150 $assignment->setSkillTrefId($skillTrefId);
151
152 if( $assignment->dbRecordExists() )
153 {
154 $assignment->setSkillPoints((int)$quantifier);
155 $assignment->saveToDb();
156 }
157 }
158 }
159 }
160
161 ilUtil::sendSuccess($this->lng->txt('tst_msg_skl_qst_assign_points_saved'), true);
162 $this->ctrl->redirect($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
163 }
$success
Definition: Utf8Test.php:87
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12

References $_POST, $success, isTestQuestion(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ showSkillQuestionAssignmentsCmd()

ilTestSkillQuestionAssignmentsGUI::showSkillQuestionAssignmentsCmd ( )
private

Definition at line 165 of file class.ilTestSkillQuestionAssignmentsGUI.php.

166 {
167 $table = $this->buildTableGUI();
168
169 $assignmentList = $this->buildSkillQuestionAssignmentList();
170 $assignmentList->loadFromDb();
171 $assignmentList->loadAdditionalSkillData();
172 $table->setSkillQuestionAssignmentList($assignmentList);
173
174 $table->setData($this->testOBJ->getTestQuestions());
175
176 $this->tpl->setContent($this->ctrl->getHTML($table));
177 }

References buildSkillQuestionAssignmentList(), and buildTableGUI().

+ Here is the call graph for this function:

◆ showSkillSelectionCmd()

ilTestSkillQuestionAssignmentsGUI::showSkillSelectionCmd ( )
private

Definition at line 116 of file class.ilTestSkillQuestionAssignmentsGUI.php.

117 {
118 $skillSelectorGUI = $this->buildSkillSelectorGUI();
119
120 if( !$skillSelectorGUI->handleCommand() )
121 {
122 $this->ctrl->saveParameter($this, 'question_id');
123
124 $this->tpl->setContent($this->ctrl->getHTML($skillSelectorGUI));
125 }
126 }

References buildSkillSelectorGUI().

+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilTestSkillQuestionAssignmentsGUI::$ctrl
private

Definition at line 24 of file class.ilTestSkillQuestionAssignmentsGUI.php.

Referenced by __construct().

◆ $db

ilTestSkillQuestionAssignmentsGUI::$db
private

Definition at line 39 of file class.ilTestSkillQuestionAssignmentsGUI.php.

Referenced by __construct().

◆ $lng

ilTestSkillQuestionAssignmentsGUI::$lng
private

Definition at line 34 of file class.ilTestSkillQuestionAssignmentsGUI.php.

Referenced by __construct().

◆ $testOBJ

ilTestSkillQuestionAssignmentsGUI::$testOBJ
private

Definition at line 44 of file class.ilTestSkillQuestionAssignmentsGUI.php.

Referenced by __construct().

◆ $tpl

ilTestSkillQuestionAssignmentsGUI::$tpl
private

Definition at line 29 of file class.ilTestSkillQuestionAssignmentsGUI.php.

Referenced by __construct().

◆ CMD_ADD_SKILL_QUEST_ASSIGN

const ilTestSkillQuestionAssignmentsGUI::CMD_ADD_SKILL_QUEST_ASSIGN = 'addSkillQuestionAssignment'

Definition at line 19 of file class.ilTestSkillQuestionAssignmentsGUI.php.

◆ CMD_REMOVE_SKILL_QUEST_ASSIGN

const ilTestSkillQuestionAssignmentsGUI::CMD_REMOVE_SKILL_QUEST_ASSIGN = 'removeSkillQuestionAssignment'

◆ CMD_SAVE_SKILL_POINTS

const ilTestSkillQuestionAssignmentsGUI::CMD_SAVE_SKILL_POINTS = 'saveSkillPoints'

◆ CMD_SHOW_SKILL_QUEST_ASSIGNS

const ilTestSkillQuestionAssignmentsGUI::CMD_SHOW_SKILL_QUEST_ASSIGNS = 'showSkillQuestionAssignments'

◆ CMD_SHOW_SKILL_SELECT

const ilTestSkillQuestionAssignmentsGUI::CMD_SHOW_SKILL_SELECT = 'showSkillSelection'

The documentation for this class was generated from the following file: