24 include_once(
'./Services/Table/classes/class.ilTable2GUI.php');
49 public function __construct($a_parent_obj,$a_course_obj,$a_objective_id)
53 $this->objective_id = $a_objective_id;
54 $this->course_obj = $a_course_obj;
57 $this->lng->loadLanguageModule(
'crs');
63 $this->
addColumn($this->lng->txt(
'type'),
'type',
"1px");
64 $this->
addColumn($this->lng->txt(
'title'),
'title',
'99%');
66 $this->
setFormAction($this->ctrl->getFormAction($a_parent_obj));
67 $this->
setRowTemplate(
"tpl.crs_objective_list_materials_row.html",
"Modules/Course");
73 #$this->setDefaultOrderField('title');
79 $this->
addCommandButton(
'updateMaterialAssignment',$this->lng->txt(
'crs_wiz_next'));
95 foreach($a_set[
'sub'] as $sub_data)
98 for($i = $sub_data[
'depth'];$i > 1;$i--)
100 $this->tpl->touchBlock(
'begin_depth');
101 $this->tpl->touchBlock(
'end_depth');
104 $this->tpl->setCurrentBlock(
'chapter');
105 include_once(
'Modules/LearningModule/classes/class.ilLMObject.php');
107 if($this->objective_lm->isChapterAssigned($a_set[
'id'],$sub_data[
'id']))
109 $this->tpl->setVariable(
'CHAP_CHECKED',
'checked="checked"');
113 $this->tpl->setVariable(
'CHAP_ID',$a_set[
'id'].
'_'.$sub_data[
'id']);
115 $this->tpl->setVariable(
'CHAP_TYPE_ALT',$this->lng->txt(
'obj_'.$sub_data[
'type']));
116 $this->tpl->parseCurrentBlock();
120 if(count($a_set[
'sub']))
122 $this->tpl->setVariable(
'TXT_CHAPTER',$this->lng->txt(
'objs_st'));
125 $this->tpl->setVariable(
'VAL_ID',$a_set[
'id']);
127 if($this->objective_lm->isAssigned($a_set[
'id']))
129 $this->tpl->setVariable(
'VAL_CHECKED',
'checked="checked"');
133 $this->tpl->setVariable(
'ROW_TYPE_ALT',$this->lng->txt(
'obj_'.$a_set[
'type']));
135 $this->tpl->setVariable(
'VAL_TITLE',$a_set[
'title']);
136 if(strlen($a_set[
'description']))
138 $this->tpl->setVariable(
'VAL_DESC',$a_set[
'description']);
149 public function parse($a_assignable)
151 global $objDefinition;
153 $materials = array();
154 foreach($a_assignable as $node)
157 if($objDefinition->isSideBlock($node[
'type']))
163 $subobjects = array();
165 if($node[
'type'] ==
'lm')
167 include_once(
'./Modules/LearningModule/classes/class.ilLMObject.php');
171 foreach($chapters = $this->
getAllSubObjects($node[
'child']) as $chapter => $chapter_data)
174 $sub[
'id'] = $chapter;
175 $sub[
'depth'] = $chapter_data[
'depth'];
176 $sub[
'type'] = $chapter_data[
'type'];
178 $subobjects[] = $sub;
182 $tmp_data[
'sub'] = $subobjects;
183 $tmp_data[
'title'] = $node[
'title'];
184 $tmp_data[
'description'] = $node[
'description'];
185 $tmp_data[
'type'] = $node[
'type'];
186 $tmp_data[
'id'] = $node[
'child'];
187 $tmp_date[
'obj_id'] = $node[
'obj_id'];
189 $materials[] = $tmp_data;
204 $tree->setTableNames(
'lm_tree',
'lm_data');
205 $tree->setTreeTablePK(
"lm_id");
207 foreach($tree->getSubTree($tree->getNodeData($tree->getRootId())) as $node)
209 if($node[
'type'] ==
'st' or $node[
'type'] ==
'pg')
211 $depth = $node[
'depth'] - 1;
212 $child = $node[
'child'];
213 $chapter[$child][
'depth'] = $depth;
214 $chapter[$child][
'type'] = $node[
'type'];
217 return $chapter ? $chapter : array();
229 include_once(
'./Modules/Course/classes/class.ilCourseObjective.php');
232 include_once
'./Modules/Course/classes/class.ilCourseObjectiveMaterials.php';