ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilParticipantsTableGUI.php
Go to the documentation of this file.
1<?php
2
3include_once('./Services/Table/classes/class.ilTable2GUI.php');
4
5/*
6 * Abstract base class for course, group participants table guis
7 * @author Stefan Meyer <smeyer.ilias@gmx.de
8 */
9abstract class ilParticipantTableGUI extends ilTable2GUI
10{
11 protected static $export_allowed = false;
12 protected static $confirmation_required = true;
13 protected static $accepted_ids = null;
14 protected static $all_columns = null;
15 protected static $has_odf_definitions = false;
16
17 protected $participants = null;
18
19 protected $current_filter = array();
20
24 protected $rep_object;
25
26
30 public function initFilter()
31 {
32 $this->setDefaultFilterVisiblity(true);
33
35 'login',
37 false,
38 $this->lng->txt('name')
39 );
40 $this->current_filter['login'] = $login->getValue();
41
42
43 if ($this->isColumnSelected('roles')) {
44 $role = $this->addFilterItemByMetaType(
45 'roles',
47 false,
48 $this->lng->txt('objs_role')
49 );
50
51 $options = array();
52 $options[0] = $this->lng->txt('all_roles');
53 $role->setOptions($options + $this->getParentObject()->getLocalRoles());
54 $this->current_filter['roles'] = $role->getValue();
55 }
56
57 if ($this->isColumnSelected('org_units')) {
58 include_once './Modules/OrgUnit/classes/PathStorage/class.ilOrgUnitPathStorage.php';
60
61 $options[0] = $this->lng->txt('select_one');
62 foreach ($paths as $org_ref_id => $path) {
63 $options[$org_ref_id] = $path;
64 }
65
66 $org = $this->addFilterItemByMetaType(
67 'org_units',
69 false,
70 $this->lng->txt('org_units')
71 );
72 $org->setOptions($options);
73 $this->current_filter['org_units'] = $org->getValue();
74 }
75 }
76
77
82 public function getSelectableColumns()
83 {
84 global $DIC;
85
86 $ilSetting = $DIC['ilSetting'];
87
88 $GLOBALS['DIC']['lng']->loadLanguageModule('ps');
89 if (self::$all_columns) {
90 # return self::$all_columns;
91 }
92
93 include_once './Services/PrivacySecurity/classes/class.ilExportFieldsInfo.php';
95 self::$all_columns = $ef->getSelectableFieldsInfo($this->getRepositoryObject()->getId());
96
97 if ($ilSetting->get('user_portfolios')) {
98 self::$all_columns['prtf'] = array(
99 'txt' => $this->lng->txt('obj_prtf'),
100 'default' => false
101 );
102 }
103
104 $login = array_splice(self::$all_columns, 0, 1);
105 self::$all_columns = array_merge(
106 array(
107 'roles' =>
108 array(
109 'txt' => $this->lng->txt('objs_role'),
110 'default' => true
111 )
112 ),
113 self::$all_columns
114 );
115 self::$all_columns = array_merge($login, self::$all_columns);
116 return self::$all_columns;
117 }
118
122 protected function getRepositoryObject()
123 {
124 return $this->rep_object;
125 }
126
127
132 protected function getParticipants()
133 {
134 return $this->participants;
135 }
136
142 public function checkAcceptance($a_usr_id)
143 {
144 if (!self::$confirmation_required) {
145 return true;
146 }
147 if (!self::$export_allowed) {
148 return false;
149 }
150 return in_array($a_usr_id, self::$accepted_ids);
151 }
152
157 protected function initSettings()
158 {
159 if (self::$accepted_ids !== null) {
160 return true;
161 }
162 self::$export_allowed = ilPrivacySettings::_getInstance()->checkExportAccess($this->getRepositoryObject()->getRefId());
163
164 self::$confirmation_required = ($this->getRepositoryObject()->getType() == 'crs')
165 ? ilPrivacySettings::_getInstance()->courseConfirmationRequired()
166 : ilPrivacySettings::_getInstance()->groupConfirmationRequired();
167
168 include_once 'Services/Membership/classes/class.ilMemberAgreement.php';
170
171 include_once('Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php');
172 self::$has_odf_definitions = ilCourseDefinedFieldDefinition::_hasFields($this->getRepositoryObject()->getId());
173 }
174
180 protected function showActionLinks($a_set)
181 {
182 $loc_enabled = (
183 $this->getRepositoryObject()->getType() == 'crs' and
184 $this->getRepositoryObject()->getViewMode() == IL_CRS_VIEW_OBJECTIVE
185 );
186
187 if (!self::$has_odf_definitions and !$loc_enabled) {
188 $this->ctrl->setParameter($this->parent_obj, 'member_id', $a_set['usr_id']);
189 $this->tpl->setCurrentBlock('link');
190 $this->tpl->setVariable('LINK_NAME', $this->ctrl->getLinkTarget($this->parent_obj, 'editMember'));
191 $this->tpl->setVariable('LINK_TXT', $this->lng->txt('edit'));
192 $this->tpl->parseCurrentBlock();
193 return true;
194 }
195
196 // show action menu
197 include_once './Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php';
198 $list = new ilAdvancedSelectionListGUI();
199 $list->setSelectionHeaderClass('small');
200 $list->setItemLinkClass('small');
201 $list->setId('actl_' . $a_set['usr_id'] . '_' . $this->getId());
202 $list->setListTitle($this->lng->txt('actions'));
203
204 $this->ctrl->setParameter($this->parent_obj, 'member_id', $a_set['usr_id']);
205 $list->addItem($this->lng->txt('edit'), '', $this->ctrl->getLinkTarget($this->getParentObject(), 'editMember'));
206
207 if (self::$has_odf_definitions) {
208 $this->ctrl->setParameterByClass('ilobjectcustomuserfieldsgui', 'member_id', $a_set['usr_id']);
209 $trans = $this->lng->txt($this->getRepositoryObject()->getType() . '_cdf_edit_member');
210 $list->addItem($trans, '', $this->ctrl->getLinkTargetByClass('ilobjectcustomuserfieldsgui', 'editMember'));
211 }
212
213 if ($loc_enabled) {
214 $this->ctrl->setParameterByClass('illomembertestresultgui', 'uid', $a_set['usr_id']);
215 $list->addItem(
216 $this->lng->txt('crs_loc_mem_show_res'),
217 '',
218 $this->ctrl->getLinkTargetByClass('illomembertestresultgui', '')
219 );
220 }
221
222 $this->tpl->setVariable('ACTION_USER', $list->getHTML());
223 }
224}
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
An exception for terminatinating execution or to throw for unit testing.
const IL_CRS_VIEW_OBJECTIVE
User interface class for advanced drop-down selection lists.
static _hasFields($a_container_id)
Check if there are any define fields.
static _getInstanceByType($a_type)
Get Singleton Instance.
static lookupAcceptedAgreements($a_obj_id)
Lookup users who have accepted the agreement.
static getTextRepresentationOfOrgUnits($sort_by_title=true)
Get ref id path array.
getSelectableColumns()
Get selectable columns.
showActionLinks($a_set)
show edit links
checkAcceptance($a_usr_id)
Check acceptance.
static _getInstance()
Get instance of ilPrivacySettings.
Class ilTable2GUI.
getParentObject()
Get parent object.
setDefaultFilterVisiblity($a_status)
Set default filter visiblity.
getId()
Get element id.
addFilterItemByMetaType($id, $type=self::FILTER_TEXT, $a_optional=false, $caption=null)
Add filter by standard type.
isColumnSelected($a_col)
Is given column selected?
$login
Definition: cron.php:13
global $DIC
Definition: goto.php:24
global $ilSetting
Definition: privfeed.php:17