24 include_once(
'./Services/Table/classes/class.ilTable2GUI.php');
48 $this->course_obj = $a_course_obj;
51 $this->lng->loadLanguageModule(
'crs');
56 $this->
addColumn($this->lng->txt(
'title'),
'title',
'33%');
57 $this->
addColumn($this->lng->txt(
'crs_objective_self_assessment'),
'self',
'33%%');
58 $this->
addColumn($this->lng->txt(
'crs_objective_final_test'),
'final',
'33%');
60 $this->
setFormAction($this->ctrl->getFormAction($a_parent_obj));
61 $this->
setRowTemplate(
"tpl.crs_questions_table_row.html",
"Modules/Course");
65 $this->
enable(
'select_all');
80 static $row_counter = 1;
82 $this->tpl->setVariable(
'VAL_TITLE',$a_set[
'title']);
83 if(strlen($a_set[
'description']))
85 $this->tpl->setVariable(
'VAL_DESC',$a_set[
'description']);
88 foreach($a_set[
'self_tests'] as $tst)
90 foreach($tst[
'questions'] as $qst)
92 $this->tpl->setCurrentBlock(
'self_qst');
93 $this->tpl->setVariable(
'SELF_QST_TITLE',$qst[
'title']);
94 if(strlen($qst[
'description']))
96 $this->tpl->setVariable(
'SELF_QST_DESCRIPTION',$qst[
'description']);
98 $this->tpl->setVariable(
'SELF_QST_POINTS',$qst[
'points']);
99 $this->tpl->setVariable(
'SELF_QST_TXT_POINTS',$this->lng->txt(
'crs_objective_points'));
100 $this->tpl->parseCurrentBlock();
102 $this->tpl->setCurrentBlock(
'self_tst');
103 $this->tpl->setVariable(
'SELF_TST_TITLE',$tst[
'title']);
104 if(strlen($tst[
'description']))
106 $this->tpl->setVariable(
'SELF_TST_DESC',$tst[
'description']);
109 $this->tpl->setVariable(
'SELF_TYPE_ALT',$this->lng->txt(
'obj_tst'));
110 $this->tpl->parseCurrentBlock();
112 if(count($a_set[
'self_tests']))
114 $this->tpl->setVariable(
'SELF_TXT_ALL_POINTS',$this->lng->txt(
'crs_objective_all_points'));
115 $this->tpl->setVariable(
'SELF_TXT_POINTS',$this->lng->txt(
'crs_objective_points'));
116 $this->tpl->setVariable(
'SELF_TXT_REQ_POINTS',$this->lng->txt(
'crs_obj_required_points'));
117 $this->tpl->setVariable(
'SELF_POINTS',$a_set[
'self_max_points']);
118 $this->tpl->setVariable(
'SELF_ID',$a_set[
'id']);
119 $this->tpl->setVariable(
'SELF_LIMIT',$a_set[
'self_limit']);
122 foreach($a_set[
'final_tests'] as $tst)
124 foreach($tst[
'questions'] as $qst)
126 $this->tpl->setCurrentBlock(
'final_qst');
127 $this->tpl->setVariable(
'FINAL_QST_TITLE',$qst[
'title']);
128 if(strlen($qst[
'description']))
130 $this->tpl->setVariable(
'FINAL_QST_DESCRIPTION',$qst[
'description']);
132 $this->tpl->setVariable(
'FINAL_QST_POINTS',$qst[
'points']);
133 $this->tpl->setVariable(
'FINAL_QST_TXT_POINTS',$this->lng->txt(
'crs_objective_points'));
134 $this->tpl->parseCurrentBlock();
136 $this->tpl->setCurrentBlock(
'final_tst');
137 $this->tpl->setVariable(
'FINAL_TST_TITLE',$tst[
'title']);
138 if(strlen($tst[
'description']))
140 $this->tpl->setVariable(
'FINAL_TST_DESC',$tst[
'description']);
143 $this->tpl->setVariable(
'FINAL_TYPE_ALT',$this->lng->txt(
'obj_tst'));
144 $this->tpl->parseCurrentBlock();
146 if(count($a_set[
'final_tests']))
148 $this->tpl->setVariable(
'FINAL_TXT_ALL_POINTS',$this->lng->txt(
'crs_objective_all_points'));
149 $this->tpl->setVariable(
'FINAL_TXT_POINTS',$this->lng->txt(
'crs_objective_points'));
150 $this->tpl->setVariable(
'FINAL_TXT_REQ_POINTS',$this->lng->txt(
'crs_obj_required_points'));
151 $this->tpl->setVariable(
'FINAL_POINTS',$a_set[
'final_max_points']);
152 $this->tpl->setVariable(
'FINAL_ID',$a_set[
'id']);
153 $this->tpl->setVariable(
'FINAL_LIMIT',$a_set[
'final_limit']);
156 $this->tpl->setVariable(
'TST_CSS',
ilUtil::switchColor($row_counter++,
'tblrow1',
'tblrow2'));
166 public function parse($a_objective_ids)
168 include_once
'./Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
170 $objectives = array();
171 foreach($a_objective_ids as $objective_id)
179 foreach($question_obj->getSelfAssessmentTests() as $tmp_test)
181 if(isset($_POST[
'self'][$objective_id]))
183 $objective_data[
'self_limit'] = $_POST[
'self'][$objective_id];
187 $objective_data[
'self_limit'] = $tmp_test[
'limit'];
189 $questions = array();
190 foreach($question_obj->getQuestionsOfTest($tmp_test[
'obj_id']) as $tmp_question)
192 $qst[
'title'] = $tmp_question[
'title'];
193 $qst[
'description'] = $tmp_question[
'description'];
194 $qst[
'points'] = $tmp_question[
'points'];
198 $tst[
'questions'] = $questions;
204 $objective_data[
'self_tests'] =
$tests;
205 $objective_data[
'self_max_points'] = $question_obj->getSelfAssessmentPoints();
209 foreach($question_obj->getFinalTests() as $tmp_test)
211 if(isset($_POST[
'final'][$objective_id]))
213 $objective_data[
'final_limit'] = $_POST[
'final'][$objective_id];
217 $objective_data[
'final_limit'] = $tmp_test[
'limit'];
220 $questions = array();
221 foreach($question_obj->getQuestionsOfTest($tmp_test[
'obj_id']) as $tmp_question)
223 $qst[
'title'] = $tmp_question[
'title'];
224 $qst[
'description'] = $tmp_question[
'description'];
225 $qst[
'points'] = $tmp_question[
'points'];
229 $tst[
'questions'] = $questions;
236 $objective_data[
'final_tests'] =
$tests;
237 $objective_data[
'final_max_points'] = $question_obj->getFinalTestPoints();
239 $objective_data[
'id'] = $objective_id;
240 $objective_data[
'title'] = $objective->getTitle();
242 $objective_data[
'description'] = $objective->getDescription();
244 $objectives[] = $objective_data;
247 $this->
setData($objectives ? $objectives : array());