ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilCourseGroupingTableGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once('./Services/Table/classes/class.ilTable2GUI.php');
5
14{
18 private $logger = null;
19
20 public function __construct($a_parent_obj, $a_parent_cmd, $a_content_obj)
21 {
22 global $DIC;
23
24 $lng = $DIC['lng'];
25 $ilCtrl = $DIC['ilCtrl'];
26
27 $this->lng = $lng;
28 $this->ctrl = $ilCtrl;
29
30 $this->logger = $DIC->logger()->ac();
31
32 parent::__construct($a_parent_obj, $a_parent_cmd);
33
34 $type = ilObject::_lookupType($a_content_obj->getId());
35 $this->lng->loadLanguageModule($type);
36
37 $this->addColumn('', '', 1);
38 $this->addColumn($this->lng->txt('title'), 'title');
39 $this->addColumn($this->lng->txt('description'), 'description');
40 $this->addColumn($this->lng->txt('unambiguousness'), 'unique');
41 $this->addColumn($this->lng->txt('groupings_assigned_obj_' . $type), 'assigned');
42 $this->addColumn('', '');
43
44
45 $this->setTitle($this->lng->txt('groupings'));
46
47 $this->addMultiCommand('askDeleteGrouping', $this->lng->txt('delete'));
48 $this->setSelectAllCheckbox('grouping');
49
50 $this->setRowTemplate("tpl.groupings.html", "Modules/Course");
51 $this->setFormAction($this->ctrl->getFormAction($a_parent_obj));
52
53 $this->setDefaultOrderField('title');
54 $this->setDefaultOrderDirection('asc');
55
56 $this->getItems($a_content_obj);
57 }
58
59 protected function getItems($a_content_obj)
60 {
61 $items = ilObjCourseGrouping::_getVisibleGroupings($a_content_obj->getId());
62
63 $data = array();
64 foreach ($items as $grouping_id) {
65 $tmp_obj = new ilObjCourseGrouping($grouping_id);
66
67 $data[$grouping_id]['id'] = $grouping_id;
68 $data[$grouping_id]['source_ref_id'] = $tmp_obj->getContainerRefId();
69 $data[$grouping_id]['assigned'] = [];
70 $data[$grouping_id]['title'] = $tmp_obj->getTitle();
71 $data[$grouping_id]['unique'] = $this->lng->txt($tmp_obj->getUniqueField());
72
73 // Description
74 if (strlen($tmp_obj->getDescription())) {
75 $data[$grouping_id]['description'] = $tmp_obj->getDescription();
76 }
77
78 // Assigned items
79 $assigned_items = $tmp_obj->getAssignedItems();
80 foreach ($assigned_items as $condition) {
81 $data[$grouping_id]['assigned'][] = ilObject::_lookupTitle($condition['target_obj_id']);
82 }
83 }
84
85 $this->setData($data);
86 }
87
88 public function fillRow($a_set)
89 {
90 if (is_array($a_set["assigned"]) && count($a_set["assigned"]) > 0) {
91 foreach ($a_set["assigned"] as $item) {
92 $this->tpl->setCurrentBlock("assigned");
93 $this->tpl->setVariable("ITEM_TITLE", $item);
94 $this->tpl->parseCurrentBlock();
95 }
96 } else {
97 $this->tpl->setCurrentBlock("assigned");
98 $this->tpl->setVariable("ITEM_TITLE", $this->lng->txt('crs_grp_no_courses_assigned'));
99 $this->tpl->parseCurrentBlock();
100 }
101
102 if (array_key_exists('source_ref_id', $a_set) && $a_set['source_ref_id']) {
103 $path = new \ilPathGUI();
104 $path->enableHideLeaf(false);
105 $path->enableTextOnly(false);
106 $path->setUseImages(true);
107
108 $this->tpl->setCurrentBlock('path');
109 $this->tpl->setVariable('OBJ_PATH', $path->getPath(ROOT_FOLDER_ID, $a_set['source_ref_id']));
110 $this->tpl->parseCurrentBlock();
111 }
112
113 $this->tpl->setVariable("ID", $a_set["id"]);
114 $this->tpl->setVariable("TXT_TITLE", $a_set["title"]);
115 $this->tpl->setVariable("TXT_DESCRIPTION", $a_set["description"]);
116 $this->tpl->setVariable("TXT_UNIQUE", $a_set["unique"]);
117
118 $this->ctrl->setParameter($this->parent_obj, 'obj_id', $a_set["id"]);
119 $this->tpl->setVariable(
120 "EDIT_LINK",
121 $this->ctrl->getLinkTarget($this->parent_obj, 'edit')
122 );
123 $this->tpl->setVariable('TXT_EDIT', $this->lng->txt('edit'));
124 }
125}
$path
Definition: aliased.php:25
An exception for terminatinating execution or to throw for unit testing.
fillRow($a_set)
Standard Version of Fill Row.
__construct($a_parent_obj, $a_parent_cmd, $a_content_obj)
ilTable2GUI constructor.
Class ilObj<module_name>
static _getVisibleGroupings($a_obj_id)
static _lookupTitle($a_id)
lookup object title
static _lookupType($a_id, $a_reference=false)
lookup object type
Class ilTable2GUI.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
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.
setData($a_data)
set table data @access public
setRowTemplate($a_template, $a_template_dir="")
Set row template.
addMultiCommand($a_cmd, $a_text)
Add Command button.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
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.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
global $ilCtrl
Definition: ilias.php:18
$type
global $DIC
Definition: saml.php:7