ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilRepositoryObjectResultTableGUI.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
16{
23 public function __construct($a_parent_obj, $a_parent_cmd, $a_allow_object_selection = false)
24 {
25 global $DIC;
26
27 $ilCtrl = $DIC['ilCtrl'];
28 $lng = $DIC['lng'];
29 $ilAccess = $DIC['ilAccess'];
30 $lng = $DIC['lng'];
31
32 parent::__construct($a_parent_obj, $a_parent_cmd);
33
34 $this->addColumn("", "", "1", true);
35 $this->addColumn($this->lng->txt("title"), "title", "80%");
36 $this->addColumn($this->lng->txt("members"), "member", "20%");
37
38 $this->setFormAction($ilCtrl->getFormAction($this->parent_obj));
39 $this->setRowTemplate("tpl.rep_search_obj_result_row.html", "Services/Search");
40 $this->setTitle($this->lng->txt('search_results'));
41 $this->setEnableTitle(true);
42 $this->setId("group_table");
43 $this->setDefaultOrderField("title");
44 $this->setDefaultOrderDirection("asc");
45 $this->enable('select_all');
46 $this->setSelectAllCheckbox("obj[]");
47
48 switch ($this->parent_obj->search_type) {
49 case 'grp':
50 case 'crs':
51 if ($this->parent_obj->role_callback) {
52 $this->addMultiCommand('addRole', $this->lng->txt('add_member_role'));
53 }
54 $this->addMultiCommand('listUsers', $this->lng->txt('grp_list_members'));
55 break;
56
57 case 'role':
58 if ($this->parent_obj->role_callback) {
59 $this->addMultiCommand('addRole', $this->lng->txt('add_role'));
60 }
61 $this->addMultiCommand('listUsers', $this->lng->txt('grp_list_users'));
62 break;
63 }
64
65 if ((bool) $a_allow_object_selection) {
66 $this->addMultiCommand('selectObject', $this->lng->txt('grp_select_object'));
67 }
68 }
69
75 public function fillRow($row)
76 {
77 /*
78 TODO: Checkboxes must be always enabled now because of role assignment. An alternative to pretend showing
79 an empty list of users could be a warning message
80 */
81 //if($row['member'])
82 //{
83 $this->tpl->setVariable('VAL_ID', $row['id']);
84 //}
85 $this->tpl->setVariable('VAL_TITLE', $row['title']);
86 if (strlen($row['desc'])) {
87 $this->tpl->setVariable('VAL_DESC', $row['desc']);
88 }
89 $this->tpl->setVariable('VAL_MEMBER', $row['member']);
90 return true;
91 }
92
93
99 public function parseObjectIds($a_ids)
100 {
101 foreach ($a_ids as $object_id) {
102 $row = array();
103 $type = ilObject::_lookupType($object_id);
104
105 if ($type == 'role') {
106 if ($GLOBALS['DIC']['rbacreview']->isRoleDeleted($object_id)) {
107 continue;
108 }
109 }
110
111
112 $row['title'] = ilObject::_lookupTitle($object_id);
113 $row['desc'] = ilObject::_lookupDescription($object_id);
114 $row['id'] = $object_id;
115
116 switch ($type) {
117
118 case 'crs':
119 case 'grp':
120
121 include_once './Services/Membership/classes/class.ilParticipants.php';
123 $row['member'] = count(ilParticipants::getInstanceByObjId($object_id)->getParticipants());
124 } else {
125 $row['member'] = 0;
126 }
127 break;
128
129 case 'role':
130 global $DIC;
131
132 $rbacreview = $DIC['rbacreview'];
133 include_once './Services/User/classes/class.ilUserFilter.php';
134 $row['member'] = count(ilUserFilter::getInstance()->filter($rbacreview->assignedUsers($object_id)));
135 break;
136 }
137
138 $data[] = $row;
139 }
140 $this->setData($data ? $data : array());
141 }
142
147 public function numericOrdering($a_field)
148 {
149 if ($a_field == "member") {
150 return true;
151 }
152 return false;
153 }
154}
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
An exception for terminatinating execution or to throw for unit testing.
static _lookupTitle($a_id)
lookup object title
static _lookupDescription($a_id)
lookup object description
static _lookupType($a_id, $a_reference=false)
lookup object type
static hasParticipantListAccess($a_obj_id, $a_usr_id=null)
Check if (current) user has access to the participant list.
static getInstanceByObjId($a_obj_id)
Get instance by obj type.
TableGUI class object (course,group and role) search results Used in member search.
__construct($a_parent_obj, $a_parent_cmd, $a_allow_object_selection=false)
Constructor.
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
setEnableTitle($a_enabletitle)
Set Enable Title.
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.
setId($a_val)
Set id.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
enable($a_module_name)
enables particular modules of table
static getInstance()
Singelton get instance.
filter()
Definition: filter.php:2
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$type