ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5
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 
4 include_once('./Services/Table/classes/class.ilTable2GUI.php');
5 
14 {
15  public function __construct($a_parent_obj, $a_parent_cmd, $a_content_obj)
16  {
17  global $lng, $ilCtrl;
18 
19  $this->lng = $lng;
20  $this->ctrl = $ilCtrl;
21 
22  parent::__construct($a_parent_obj, $a_parent_cmd);
23 
24  $type = ilObject::_lookupType($a_content_obj->getId());
25  $this->lng->loadLanguageModule($type);
26 
27  $this->addColumn('','', 1);
28  $this->addColumn($this->lng->txt('title'), 'title');
29  $this->addColumn($this->lng->txt('description'), 'description');
30  $this->addColumn($this->lng->txt('unambiguousness'), 'unique');
31  $this->addColumn($this->lng->txt('groupings_assigned_obj_'.$type), 'assigned');
32  $this->addColumn('','');
33 
34 
35  $this->setTitle($this->lng->txt('groupings'));
36 
37  $this->addMultiCommand('askDeleteGrouping', $this->lng->txt('delete'));
38  $this->setSelectAllCheckbox('grouping');
39 
40  $this->setRowTemplate("tpl.groupings.html","Modules/Course");
41  $this->setFormAction($this->ctrl->getFormAction($a_parent_obj));
42 
43  $this->setDefaultOrderField('title');
44  $this->setDefaultOrderDirection('asc');
45 
46  $this->getItems($a_content_obj);
47  }
48 
49  protected function getItems($a_content_obj)
50  {
51  $items = ilObjCourseGrouping::_getVisibleGroupings($a_content_obj->getId());
52 
53  $data = array();
54  foreach($items as $grouping_id)
55  {
56  $tmp_obj = new ilObjCourseGrouping($grouping_id);
57 
58  $data[$grouping_id]['id'] = $grouping_id;
59  $data[$grouping_id]['title'] = $tmp_obj->getTitle();
60  $data[$grouping_id]['unique'] = $this->lng->txt($tmp_obj->getUniqueField());
61 
62  // Description
63  if(strlen($tmp_obj->getDescription()))
64  {
65  $data[$grouping_id]['description'] = $tmp_obj->getDescription();
66  }
67 
68  // Assigned items
69  $assigned_items = $tmp_obj->getAssignedItems();
70  foreach($assigned_items as $condition)
71  {
72  $data[$grouping_id]['assigned'][] = ilObject::_lookupTitle($condition['target_obj_id']);
73  }
74  }
75 
76  $this->setData($data);
77  }
78 
79  public function fillRow($a_set)
80  {
81  if(count($a_set["assigned"]))
82  {
83  foreach($a_set["assigned"] as $item)
84  {
85  $this->tpl->setCurrentBlock("assigned");
86  $this->tpl->setVariable("ITEM_TITLE", $item);
87  $this->tpl->parseCurrentBlock();
88  }
89  }
90  else
91  {
92  $this->tpl->setCurrentBlock("assigned");
93  $this->tpl->setVariable("ITEM_TITLE", $this->lng->txt('crs_grp_no_courses_assigned'));
94  $this->tpl->parseCurrentBlock();
95  }
96 
97  $this->tpl->setVariable("ID", $a_set["id"]);
98  $this->tpl->setVariable("TXT_TITLE", $a_set["title"]);
99  $this->tpl->setVariable("TXT_DESCRIPTION", $a_set["description"]);
100  $this->tpl->setVariable("TXT_UNIQUE", $a_set["unique"]);
101 
102  $this->ctrl->setParameter($this->parent_obj, 'obj_id', $a_set["id"]);
103  $this->tpl->setVariable("EDIT_LINK",
104  $this->ctrl->getLinkTarget($this->parent_obj, 'edit'));
105  $this->tpl->setVariable('TXT_EDIT',$this->lng->txt('edit'));
106  }
107 }
108 
109 ?>
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
static _lookupTitle($a_id)
lookup object title
global $ilCtrl
Definition: ilias.php:18
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
Class ilTable2GUI.
Class ilObj<module_name>
addMultiCommand($a_cmd, $a_text)
Add Command button.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
static _lookupType($a_id, $a_reference=false)
lookup object type
__construct($a_parent_obj, $a_parent_cmd, $a_content_obj)
_getVisibleGroupings($a_obj_id)
Returns a list of all groupings for which the current user hast write permission on all assigned obje...
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
global $lng
Definition: privfeed.php:40
setSelectAllCheckbox($a_select_all_checkbox)
Set the name of the checkbox that should be toggled with a select all button.
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.