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';
60 $this->course_obj = $a_course_obj;
67 $this->lng->loadLanguageModule(
'crs');
70 parent::__construct($a_parent_obj,
'listObjectives');
73 $this->
addColumn($this->lng->txt(
'position'),
'position',
'10em');
74 $this->
addColumn($this->lng->txt(
'title'),
'title',
'20%');
75 $this->
addColumn($this->lng->txt(
'crs_objective_assigned_materials'),
'materials');
78 $this->
addColumn($this->lng->txt(
'crs_objective_self_assessment'),
'self');
82 $this->
addColumn($this->lng->txt(
'crs_objective_tbl_col_final_tsts'),
'final');
84 $this->
addColumn($this->lng->txt(
'crs_objective_final_test'),
'final');
86 $this->
addColumn($this->lng->txt(
'actions'),
'5em');
88 $this->
setFormAction($this->ctrl->getFormAction($a_parent_obj));
89 $this->
setRowTemplate(
"tpl.crs_objectives_table_row.html",
"Modules/Course");
93 $this->
enable(
'select_all');
100 $this->
addMultiCommand(
'activateObjectives', $this->lng->txt(
'set_online'));
101 $this->
addMultiCommand(
'deactivateObjectives', $this->lng->txt(
'set_offline'));
102 $this->
addMultiCommand(
'askDeleteObjectives', $this->lng->txt(
'delete'));
129 $this->tpl->setVariable(
'VAL_ID', $a_set[
'id']);
130 $this->tpl->setVariable(
'VAL_POSITION', $a_set[
'position']);
133 if ($a_set[
'online']) {
134 $this->tpl->setVariable(
'VAL_ONOFFLINE', $this->lng->txt(
'online'));
135 $this->tpl->setVariable(
'ONOFFLINE_CLASS',
'smallgreen');
137 $this->tpl->setVariable(
'VAL_ONOFFLINE', $this->lng->txt(
'offline'));
138 $this->tpl->setVariable(
'ONOFFLINE_CLASS',
'smallred');
141 if ($a_set[
'passes']) {
142 $this->tpl->setVariable(
'PASSES_TXT', $this->lng->txt(
'crs_loc_passes_info'));
143 $this->tpl->setVariable(
'PASSES_VAL', $a_set[
'passes']);
148 $this->ctrl->setParameterByClass(
'ilcourseobjectivesgui',
'objective_id', $a_set[
'id']);
149 $this->tpl->setVariable(
'VAL_TITLE_LINKED', $this->ctrl->getLinkTargetByClass(
'ilcourseobjectivesgui',
'edit'));
152 $this->tpl->setVariable(
'VAL_TITLE', $a_set[
'title']);
153 if (strlen($a_set[
'description'])) {
154 $this->tpl->setVariable(
'VAL_DESC', $a_set[
'description']);
158 foreach ($a_set[
'materials'] as $ref_id =>
$data) {
159 if (
$data[
'items']) {
160 $this->tpl->touchBlock(
'ul_begin');
161 foreach (
$data[
'items'] as $pg_st) {
162 $this->tpl->setCurrentBlock(
'st_pg');
163 $this->tpl->setVariable(
'MAT_IMG',
ilObject::_getIcon($pg_st[
'obj_id'],
"tiny", $pg_st[
'type']));
164 $this->tpl->setVariable(
'MAT_ALT', $this->lng->txt(
'obj_' . $pg_st[
'type']));
165 include_once(
'Modules/LearningModule/classes/class.ilLMObject.php');
167 $this->tpl->setVariable(
'MAT_TITLE',
$title);
168 $this->tpl->parseCurrentBlock();
170 $this->tpl->touchBlock(
'ul_end');
172 $this->tpl->touchBlock(
'new_line');
174 $this->tpl->setCurrentBlock(
'mat_row');
176 $this->tpl->setVariable(
'LM_ALT', $this->lng->txt(
'obj_' .
$data[
'type']));
178 if (
$data[
'type'] ==
'catr' or
$data[
'type'] ==
'crsr' or
$data[
'type'] ==
'grpr') {
179 include_once
'./Services/ContainerReference/classes/class.ilContainerReference.php';
180 $this->tpl->setVariable(
187 $this->tpl->parseCurrentBlock();
192 if ($this->
getSettings()->worksWithInitialTest()) {
193 if ($this->
getSettings()->hasSeparateInitialTests()) {
194 if ($a_set[
'initial']) {
195 include_once
'./Services/Link/classes/class.ilLink.php';
197 $this->tpl->setCurrentBlock(
'initial_test_per_objective');
199 $this->tpl->setVariable(
'IT_ALT', $this->lng->txt(
'obj_tst'));
201 $this->tpl->setVariable(
'IT_TITLE_LINK',
ilLink::_getLink($a_set[
'initial']));
203 include_once
'./Services/Link/classes/class.ilLink.php';
204 $this->ctrl->setParameterByClass(
'ilobjtestgui',
'ref_id', $a_set[
'initial']);
205 $this->ctrl->setParameterByClass(
'ilobjtestgui',
'cmd',
'questionsTabGateway');
206 $this->tpl->setVariable(
208 $this->ctrl->getLinkTargetByClass(
'ilobjtestgui')
211 $this->tpl->parseCurrentBlock();
213 $this->tpl->touchBlock(
'initial_test_per_objective');
216 foreach ($a_set[
'self'] as
$test) {
218 foreach ((
array) $test[
'questions'] as $question) {
219 $this->tpl->setCurrentBlock(
'self_qst_row');
220 $this->tpl->setVariable(
'SELF_QST_TITLE', $question[
'title']);
221 $this->tpl->parseCurrentBlock();
226 if (!count($a_set[
'self'])) {
227 $this->tpl->touchBlock(
'self_qst_row');
237 if ($a_set[
'final']) {
239 $this->tpl->setCurrentBlock(
'final_test_per_objective');
241 $this->tpl->setVariable(
'FT_ALT', $this->lng->txt(
'obj_tst'));
244 include_once
'./Services/Link/classes/class.ilLink.php';
245 $this->ctrl->setParameterByClass(
'ilobjtestgui',
'ref_id', $a_set[
'final']);
246 $this->ctrl->setParameterByClass(
'ilobjtestgui',
'cmd',
'questionsTabGateway');
247 $this->tpl->setVariable(
249 $this->ctrl->getLinkTargetByClass(
'ilobjtestgui')
253 $this->tpl->parseCurrentBlock();
255 $this->tpl->touchBlock(
'final_test_per_objective');
259 foreach ((
array) $test[
'questions'] as $question) {
260 $this->tpl->setCurrentBlock(
'final_qst_row');
261 $this->tpl->setVariable(
'FINAL_QST_TITLE', $question[
'title']);
262 $this->tpl->parseCurrentBlock();
265 #$this->tpl->setCurrentBlock('final_test_row'); 266 #$this->tpl->setVariable('FINAL_TST_IMG',ilUtil::getImagePath('icon_tst_s.png')); 267 #$this->tpl->setVariable('FINAL_TST_ALT',$this->lng->txt('obj_tst')); 268 #$this->tpl->setVariable('FINAL_TST_TITLE',ilObject::_lookupTitle($test['obj_id'])); 269 #$this->tpl->parseCurrentBlock(); 276 #$this->ctrl->setParameterByClass(get_class($this->getParentObject()),'objective_id',$a_set['id']); 277 $this->ctrl->setParameterByClass(
'ilcourseobjectivesgui',
'objective_id', $a_set[
'id']);
278 #$this->tpl->setVariable('EDIT_LINK',$this->ctrl->getLinkTargetByClass(get_class($this->getParentObject()),'edit')); 279 $this->tpl->setVariable(
'EDIT_LINK', $this->ctrl->getLinkTargetByClass(
'ilcourseobjectivesgui',
'edit'));
281 $this->tpl->setVariable(
'TXT_EDIT', $this->lng->txt(
'edit'));
283 include_once(
"./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
285 $alist->setId($a_set[
'id']);
289 $this->lng->txt(
'edit'),
291 $this->ctrl->getLinkTargetByClass(
'ilcourseobjectivesgui',
'edit')
295 $this->lng->txt(
'crs_objective_action_materials'),
297 $this->ctrl->getLinkTargetByClass(
'ilcourseobjectivesgui',
'materialAssignment')
302 $this->lng->txt(
'crs_objective_action_itest'),
304 $this->ctrl->getLinkTargetByClass(
'ilcourseobjectivesgui',
'selfAssessmentAssignment')
308 if ($this->
getSettings()->hasSeparateQualifiedTests()) {
310 # $this->lng->txt('crs_objective_action_qtest_sep'), 312 # $this->ctrl->getLinkTargetByClass('ilcourseobjectivesgui', 'finalSeparatedTestAssignment') 316 $this->lng->txt(
'crs_objective_action_qtest'),
318 $this->ctrl->getLinkTargetByClass(
'ilcourseobjectivesgui',
'finalTestAssignment')
322 $this->ctrl->setParameterByClass(
'illopagegui',
'objective_id', $a_set[
'id']);
324 $this->lng->txt(
'crs_edit_lo_introduction'),
326 $this->ctrl->getLinkTargetByClass(
'illopagegui',
'edit')
330 $this->tpl->setVariable(
'VAL_ACTIONS', $alist->getHTML());
342 public function parse($a_objective_ids)
345 foreach ($a_objective_ids as $objective_id) {
348 $objective_data = [];
349 $objective_data[
'id'] = $objective_id;
350 $objective_data[
'position'] = sprintf(
"%.1f", $position++) * 10;
351 $objective_data[
'title'] = $objective->getTitle();
352 $objective_data[
'description'] = $objective->getDescription();
355 $objective_data[
'online'] = $objective->isActive();
356 $objective_data[
'passes'] = $objective->getPasses();
360 $materials =
array();
362 foreach ($ass_materials->getMaterials() as $material) {
366 switch ($material[
'type']) {
369 $materials[$material[
'ref_id']][
'items'][] = $material;
375 $objective_data[
'materials'] = $materials;
380 if ($this->
getSettings()->worksWithInitialTest()) {
381 if ($this->
getSettings()->hasSeparateInitialTests()) {
382 include_once
'./Modules/Course/classes/Objectives/class.ilLOTestAssignments.php';
386 $objective_data[
'initial'] = 0;
388 $test_id = $assignment->getTestRefId();
390 include_once
'./Services/Object/classes/class.ilObjectFactory.php';
392 $test_candidate =
$factory->getInstanceByRefId($test_id,
false);
393 if ($test_candidate instanceof
ilObjTest) {
394 $objective_data[
'initial'] = $test_id;
399 $objective_data[
'self'] = [];
401 $this->course_obj->getId(),
410 $test[
'questions'][] =
array(
'title' => $qst);
416 foreach ($question_obj->getSelfAssessmentTests() as
$test) {
417 $questions =
array();
418 foreach ($question_obj->getQuestionsOfTest(
$test[
'obj_id']) as $qst) {
422 $tmp_test[
'questions'] = $questions;
424 $tests[] = $tmp_test;
426 $objective_data[
'self'] = $tests;
435 include_once
'./Modules/Course/classes/Objectives/class.ilLOTestAssignments.php';
439 $objective_data[
'final'] = 0;
441 $test_id = $assignment->getTestRefId();
443 include_once
'./Services/Object/classes/class.ilObjectFactory.php';
445 $test_candidate =
$factory->getInstanceByRefId($test_id,
false);
446 if ($test_candidate instanceof
ilObjTest) {
447 $objective_data[
'final'] = $test_id;
450 } elseif ($this->
getSettings()->getQualifiedTest()) {
454 $this->course_obj->getId(),
463 $test[
'questions'][] =
array(
'title' => $qst);
469 foreach ($question_obj->getFinalTests() as
$test) {
470 $questions =
array();
471 foreach ($question_obj->getQuestionsOfTest(
$test[
'obj_id']) as $qst) {
475 $tmp_test[
'questions'] = $questions;
477 $tests[] = $tmp_test;
479 $objective_data[
'final'] = $tests;
483 $objectives[] = (
array) $objective_data;
static _getIcon( $a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
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.
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.
Create styles array
The data for the language used.
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
setSelectAllCheckbox($a_select_all_checkbox)
Set the name of the checkbox that should be toggled with a select all button.
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)