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');
60 parent::__construct($a_parent_obj,
'materialAssignment');
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");
68 #$this->disable('sort'); 69 #$this->disable('header'); 70 #$this->disable('numinfo'); 71 #$this->disable('select_all'); 79 $this->
addCommandButton(
'updateMaterialAssignment', $this->lng->txt(
'crs_wiz_next'));
80 #$this->addMultiCommand('updateMaterialAssignment', $this->lng->txt('crs_wiz_next')); 95 foreach ($a_set[
'sub'] as $sub_data) {
97 for (
$i = $sub_data[
'depth'];
$i > 1;
$i--) {
98 $this->tpl->touchBlock(
'begin_depth');
99 $this->tpl->touchBlock(
'end_depth');
102 $this->tpl->setCurrentBlock(
'chapter');
103 include_once(
'Modules/LearningModule/classes/class.ilLMObject.php');
105 if ($this->objective_lm->isChapterAssigned($a_set[
'id'], $sub_data[
'id'])) {
106 $this->tpl->setVariable(
'CHAP_CHECKED',
'checked="checked"');
110 $this->tpl->setVariable(
'CHAP_ID', $a_set[
'id'] .
'_' . $sub_data[
'id']);
111 $this->tpl->setVariable(
'CHAP_TYPE_IMG',
ilObject::_getIcon($sub_data[
'id'],
"tiny", $sub_data[
'type']));
112 $this->tpl->setVariable(
'CHAP_TYPE_ALT', $this->lng->txt(
'obj_' . $sub_data[
'type']));
113 $this->tpl->parseCurrentBlock();
115 if (count($a_set[
'sub'])) {
116 $this->tpl->setVariable(
'TXT_CHAPTER', $this->lng->txt(
'objs_st'));
119 $this->tpl->setVariable(
'VAL_ID', $a_set[
'id']);
121 if ($this->objective_lm->isAssigned($a_set[
'id'])) {
122 $this->tpl->setVariable(
'VAL_CHECKED',
'checked="checked"');
125 $this->tpl->setVariable(
'ROW_TYPE_IMG',
ilObject::_getIcon($a_set[
'obj_id'],
"tiny", $a_set[
'type']));
126 $this->tpl->setVariable(
'ROW_TYPE_ALT', $this->lng->txt(
'obj_' . $a_set[
'type']));
128 $this->tpl->setVariable(
'VAL_TITLE', $a_set[
'title']);
129 if (strlen($a_set[
'description'])) {
130 $this->tpl->setVariable(
'VAL_DESC', $a_set[
'description']);
141 public function parse($a_assignable)
143 global $objDefinition;
145 $materials =
array();
146 foreach ($a_assignable as $node) {
148 if ($objDefinition->isSideBlock($node[
'type'])) {
153 $subobjects =
array();
155 if ($node[
'type'] ==
'lm') {
156 include_once(
'./Modules/LearningModule/classes/class.ilLMObject.php');
160 foreach ($chapters = $this->
getAllSubObjects($node[
'child']) as $chapter => $chapter_data) {
162 $sub[
'id'] = $chapter;
163 $sub[
'depth'] = $chapter_data[
'depth'];
164 $sub[
'type'] = $chapter_data[
'type'];
166 $subobjects[] = $sub;
170 $tmp_data[
'sub'] = $subobjects;
171 $tmp_data[
'title'] = $node[
'title'];
172 $tmp_data[
'description'] = $node[
'description'];
173 $tmp_data[
'type'] = $node[
'type'];
174 $tmp_data[
'id'] = $node[
'child'];
175 $tmp_data[
'obj_id'] = $node[
'obj_id'];
177 $materials[] = $tmp_data;
192 $tree->setTableNames(
'lm_tree',
'lm_data');
193 $tree->setTreeTablePK(
"lm_id");
195 foreach ($tree->getSubTree($tree->getNodeData($tree->getRootId())) as $node) {
196 if ($node[
'type'] ==
'st' or $node[
'type'] ==
'pg') {
197 $depth = $node[
'depth'] - 1;
198 $child = $node[
'child'];
199 $chapter[$child][
'depth'] = $depth;
200 $chapter[$child][
'type'] = $node[
'type'];
203 return $chapter ? $chapter :
array();
215 include_once(
'./Modules/Course/classes/class.ilCourseObjective.php');
216 $this->objective =
new ilCourseObjective($this->course_obj, $this->objective_id);
218 include_once
'./Modules/Course/classes/class.ilCourseObjectiveMaterials.php';
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.
parse($a_assignable)
parse
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
__construct($a_parent_obj, $a_course_obj, $a_objective_id)
Constructor.
static _lookupTitle($a_obj_id)
Lookup title.
setNoEntriesText($a_text)
Set text for an empty table.
TableGUI for material assignments of course objectives.
class ilCourseObjectiveMaterials
initObjectiveAssignments()
init objective assignments
static _lookupObjId($a_id)
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
setRowTemplate($a_template, $a_template_dir="")
Set row template.
Create styles array
The data for the language used.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
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.
getAllSubObjects($a_ref_id)
get all subobject (structure and page objects) of a lm
setLimit($a_limit=0, $a_default_limit=0)