24 include_once(
'./Services/Table/classes/class.ilTable2GUI.php');
25 include_once
'./Modules/Course/classes/class.ilCourseObjective.php';
26 include_once(
'./Modules/Course/classes/class.ilCourseObjectiveMaterials.php');
27 include_once(
'./Modules/Course/classes/class.ilCourseObjectiveQuestion.php');
28 include_once
'./Modules/Course/classes/Objectives/class.ilLOUtils.php';
31 include_once
'./Modules/Course/classes/Objectives/class.ilLOSettings.php';
63 $this->course_obj = $a_course_obj;
70 $this->lng->loadLanguageModule(
'crs');
73 parent::__construct($a_parent_obj,
'listObjectives');
76 $this->
addColumn($this->lng->txt(
'position'),
'position',
'10em');
77 $this->
addColumn($this->lng->txt(
'title'),
'title',
'20%');
78 $this->
addColumn($this->lng->txt(
'crs_objective_assigned_materials'),
'materials');
81 $this->
addColumn($this->lng->txt(
'crs_objective_self_assessment'),
'self');
85 $this->
addColumn($this->lng->txt(
'crs_objective_tbl_col_final_tsts'),
'final');
87 $this->
addColumn($this->lng->txt(
'crs_objective_final_test'),
'final');
89 $this->
addColumn($this->lng->txt(
'actions'),
'5em');
91 $this->
setFormAction($this->ctrl->getFormAction($a_parent_obj));
92 $this->
setRowTemplate(
"tpl.crs_objectives_table_row.html",
"Modules/Course");
96 $this->
enable(
'select_all');
103 $this->
addMultiCommand(
'activateObjectives', $this->lng->txt(
'set_online'));
104 $this->
addMultiCommand(
'deactivateObjectives', $this->lng->txt(
'set_offline'));
105 $this->
addMultiCommand(
'askDeleteObjectives', $this->lng->txt(
'delete'));
132 $this->tpl->setVariable(
'VAL_ID', $a_set[
'id']);
133 $this->tpl->setVariable(
'VAL_POSITION', $a_set[
'position']);
136 if ($a_set[
'online']) {
137 $this->tpl->setVariable(
'VAL_ONOFFLINE', $this->lng->txt(
'online'));
138 $this->tpl->setVariable(
'ONOFFLINE_CLASS',
'smallgreen');
140 $this->tpl->setVariable(
'VAL_ONOFFLINE', $this->lng->txt(
'offline'));
141 $this->tpl->setVariable(
'ONOFFLINE_CLASS',
'smallred');
144 if ($a_set[
'passes']) {
145 $this->tpl->setVariable(
'PASSES_TXT', $this->lng->txt(
'crs_loc_passes_info'));
146 $this->tpl->setVariable(
'PASSES_VAL', $a_set[
'passes']);
151 $this->ctrl->setParameterByClass(
'ilcourseobjectivesgui',
'objective_id', $a_set[
'id']);
152 $this->tpl->setVariable(
'VAL_TITLE_LINKED', $this->ctrl->getLinkTargetByClass(
'ilcourseobjectivesgui',
'edit'));
155 $this->tpl->setVariable(
'VAL_TITLE', $a_set[
'title']);
156 if (strlen($a_set[
'description'])) {
157 $this->tpl->setVariable(
'VAL_DESC', $a_set[
'description']);
161 foreach ($a_set[
'materials'] as $ref_id =>
$data) {
162 if (
$data[
'items']) {
163 $this->tpl->touchBlock(
'ul_begin');
164 foreach (
$data[
'items'] as $pg_st) {
165 $this->tpl->setCurrentBlock(
'st_pg');
166 $this->tpl->setVariable(
'MAT_IMG', ilObject::_getIcon($pg_st[
'obj_id'],
"tiny", $pg_st[
'type']));
167 $this->tpl->setVariable(
'MAT_ALT', $this->lng->txt(
'obj_' . $pg_st[
'type']));
168 include_once(
'Modules/LearningModule/classes/class.ilLMObject.php');
170 $this->tpl->setVariable(
'MAT_TITLE',
$title);
171 $this->tpl->parseCurrentBlock();
173 $this->tpl->touchBlock(
'ul_end');
175 $this->tpl->touchBlock(
'new_line');
177 $this->tpl->setCurrentBlock(
'mat_row');
178 $this->tpl->setVariable(
'LM_IMG', ilObject::_getIcon(
$data[
'obj_id'],
"tiny",
$data[
'type']));
179 $this->tpl->setVariable(
'LM_ALT', $this->lng->txt(
'obj_' .
$data[
'type']));
182 include_once
'./Services/ContainerReference/classes/class.ilContainerReference.php';
183 $this->tpl->setVariable(
190 $this->tpl->parseCurrentBlock();
195 if ($this->
getSettings()->worksWithInitialTest()) {
196 if ($this->
getSettings()->hasSeparateInitialTests()) {
197 if ($a_set[
'initial']) {
198 include_once
'./Services/Link/classes/class.ilLink.php';
200 $this->tpl->setCurrentBlock(
'initial_test_per_objective');
201 $this->tpl->setVariable(
'IT_IMG', ilObject::_getIcon($obj_id,
'tiny'));
202 $this->tpl->setVariable(
'IT_ALT', $this->lng->txt(
'obj_tst'));
204 $this->tpl->setVariable(
'IT_TITLE_LINK',
ilLink::_getLink($a_set[
'initial']));
206 include_once
'./Services/Link/classes/class.ilLink.php';
207 $this->ctrl->setParameterByClass(
'ilobjtestgui',
'ref_id', $a_set[
'initial']);
208 $this->ctrl->setParameterByClass(
'ilobjtestgui',
'cmd',
'questionsTabGateway');
209 $this->tpl->setVariable(
211 $this->ctrl->getLinkTargetByClass(
'ilobjtestgui')
214 $this->tpl->parseCurrentBlock();
216 $this->tpl->touchBlock(
'initial_test_per_objective');
219 foreach ($a_set[
'self'] as
$test) {
221 foreach ((array) $test[
'questions'] as $question) {
222 $this->tpl->setCurrentBlock(
'self_qst_row');
223 $this->tpl->setVariable(
'SELF_QST_TITLE', $question[
'title']);
224 $this->tpl->parseCurrentBlock();
229 if (!count($a_set[
'self'])) {
230 $this->tpl->touchBlock(
'self_qst_row');
240 if ($a_set[
'final']) {
242 $this->tpl->setCurrentBlock(
'final_test_per_objective');
243 $this->tpl->setVariable(
'FT_IMG', ilObject::_getIcon($obj_id,
'tiny'));
244 $this->tpl->setVariable(
'FT_ALT', $this->lng->txt(
'obj_tst'));
247 include_once
'./Services/Link/classes/class.ilLink.php';
248 $this->ctrl->setParameterByClass(
'ilobjtestgui',
'ref_id', $a_set[
'final']);
249 $this->ctrl->setParameterByClass(
'ilobjtestgui',
'cmd',
'questionsTabGateway');
250 $this->tpl->setVariable(
252 $this->ctrl->getLinkTargetByClass(
'ilobjtestgui')
256 $this->tpl->parseCurrentBlock();
258 $this->tpl->touchBlock(
'final_test_per_objective');
261 foreach ((array) $a_set[
'final'] as
$test) {
262 foreach ((array) $test[
'questions'] as $question) {
263 $this->tpl->setCurrentBlock(
'final_qst_row');
264 $this->tpl->setVariable(
'FINAL_QST_TITLE', $question[
'title']);
265 $this->tpl->parseCurrentBlock();
268 #$this->tpl->setCurrentBlock('final_test_row'); 269 #$this->tpl->setVariable('FINAL_TST_IMG',ilUtil::getImagePath('icon_tst_s.png')); 270 #$this->tpl->setVariable('FINAL_TST_ALT',$this->lng->txt('obj_tst')); 271 #$this->tpl->setVariable('FINAL_TST_TITLE',ilObject::_lookupTitle($test['obj_id'])); 272 #$this->tpl->parseCurrentBlock(); 279 #$this->ctrl->setParameterByClass(get_class($this->getParentObject()),'objective_id',$a_set['id']); 280 $this->ctrl->setParameterByClass(
'ilcourseobjectivesgui',
'objective_id', $a_set[
'id']);
281 #$this->tpl->setVariable('EDIT_LINK',$this->ctrl->getLinkTargetByClass(get_class($this->getParentObject()),'edit')); 282 $this->tpl->setVariable(
'EDIT_LINK', $this->ctrl->getLinkTargetByClass(
'ilcourseobjectivesgui',
'edit'));
284 $this->tpl->setVariable(
'TXT_EDIT', $this->lng->txt(
'edit'));
286 include_once(
"./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
288 $alist->setId($a_set[
'id']);
292 $this->lng->txt(
'edit'),
294 $this->ctrl->getLinkTargetByClass(
'ilcourseobjectivesgui',
'edit')
298 $this->lng->txt(
'crs_objective_action_materials'),
300 $this->ctrl->getLinkTargetByClass(
'ilcourseobjectivesgui',
'materialAssignment')
305 $this->lng->txt(
'crs_objective_action_itest'),
307 $this->ctrl->getLinkTargetByClass(
'ilcourseobjectivesgui',
'selfAssessmentAssignment')
311 if ($this->
getSettings()->hasSeparateQualifiedTests()) {
313 # $this->lng->txt('crs_objective_action_qtest_sep'), 315 # $this->ctrl->getLinkTargetByClass('ilcourseobjectivesgui', 'finalSeparatedTestAssignment') 319 $this->lng->txt(
'crs_objective_action_qtest'),
321 $this->ctrl->getLinkTargetByClass(
'ilcourseobjectivesgui',
'finalTestAssignment')
325 $this->ctrl->setParameterByClass(
'illopagegui',
'objective_id', $a_set[
'id']);
327 $this->lng->txt(
'crs_edit_lo_introduction'),
329 $this->ctrl->getLinkTargetByClass(
'illopagegui',
'edit')
333 $this->tpl->setVariable(
'VAL_ACTIONS', $alist->getHTML());
345 public function parse($a_objective_ids)
348 foreach ($a_objective_ids as $objective_id) {
351 $objective_data = [];
352 $objective_data[
'id'] = $objective_id;
353 $objective_data[
'position'] = sprintf(
"%.1f", $position++) * 10;
354 $objective_data[
'title'] = $objective->getTitle();
355 $objective_data[
'description'] = $objective->getDescription();
358 $objective_data[
'online'] = $objective->isActive();
359 $objective_data[
'passes'] = $objective->getPasses();
363 $materials = array();
365 foreach ($ass_materials->getMaterials() as $material) {
369 switch ($material[
'type']) {
372 $materials[$material[
'ref_id']][
'items'][] = $material;
378 $objective_data[
'materials'] = $materials;
383 if ($this->
getSettings()->worksWithInitialTest()) {
384 if ($this->
getSettings()->hasSeparateInitialTests()) {
385 include_once
'./Modules/Course/classes/Objectives/class.ilLOTestAssignments.php';
389 $objective_data[
'initial'] = 0;
391 $test_id = $assignment->getTestRefId();
393 include_once
'./Services/Object/classes/class.ilObjectFactory.php';
395 $test_candidate =
$factory->getInstanceByRefId($test_id,
false);
396 if ($test_candidate instanceof
ilObjTest) {
397 $objective_data[
'initial'] = $test_id;
402 $objective_data[
'self'] = [];
404 $this->course_obj->getId(),
413 $test[
'questions'][] = array(
'title' => $qst);
415 $objective_data[
'self'] = array(
$test);
419 foreach ($question_obj->getSelfAssessmentTests() as
$test) {
420 $questions = array();
421 foreach ($question_obj->getQuestionsOfTest(
$test[
'obj_id']) as $qst) {
425 $tmp_test[
'questions'] = $questions;
429 $objective_data[
'self'] =
$tests;
438 include_once
'./Modules/Course/classes/Objectives/class.ilLOTestAssignments.php';
442 $objective_data[
'final'] = 0;
444 $test_id = $assignment->getTestRefId();
446 include_once
'./Services/Object/classes/class.ilObjectFactory.php';
448 $test_candidate =
$factory->getInstanceByRefId($test_id,
false);
449 if ($test_candidate instanceof
ilObjTest) {
450 $objective_data[
'final'] = $test_id;
453 } elseif ($this->
getSettings()->getQualifiedTest()) {
457 $this->course_obj->getId(),
466 $test[
'questions'][] = array(
'title' => $qst);
468 $objective_data[
'final'] = array(
$test);
472 foreach ($question_obj->getFinalTests() as
$test) {
473 $questions = array();
474 foreach ($question_obj->getQuestionsOfTest(
$test[
'obj_id']) as $qst) {
478 $tmp_test[
'questions'] = $questions;
482 $objective_data[
'final'] =
$tests;
486 $objectives[] = (array) $objective_data;
488 $this->
setData($objectives ? $objectives : array());
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
static getInstanceByObjId($a_obj_id)
get singleton instance
static getInstance($a_container_id)
Get instance by container id.
static _lookupTitle($a_id)
lookup object title
static _lookupTitle($a_obj_id)
Lookup title.
class ilCourseObjectiveMaterials
__construct($a_parent_obj, $a_course_obj)
Constructor.
static lookupRandomTest($a_test_obj_id)
Check if test is a random test.
setSelectAllCheckbox($a_select_all_checkbox, $a_select_all_on_top=false)
Set the name of the checkbox that should be toggled with a select all button.
parse($a_objective_ids)
parse
static _lookupObjId($a_id)
addMultiCommand($a_cmd, $a_text)
Add Command button.
enable($a_module_name)
enables particular modules of table
static _lookupTargetTitle($a_obj_id)
Lookup target title.
static lookupSequencesByType($a_container_id, $a_objective_id, $a_test_id, $a_test_type)
Lookup sequence ids type $ilDB.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
static _lookupType($a_id, $a_reference=false)
lookup object type
User interface class for advanced drop-down selection lists.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
getSettings()
Get settings.
disable($a_module_name)
diesables particular modules of table
setFormName($a_formname="")
Set Form name.
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.
const TYPE_TEST_QUALIFIED
const TYPE_QUALIFYING_SELECTED
class ilcourseobjectiveQuestion
static _getLink($a_ref_id, $a_type='', $a_params=array(), $append="")
static lookupQplBySequence($a_test_ref_id, $a_sequence_id)
Lookup assigned qpl name (including taxonomy) by sequence.
setLimit($a_limit=0, $a_default_limit=0)