ILIAS  release_8 Revision v8.24
class.ilParticipantTableGUI.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
21/*
22 * Abstract base class for course, group participants table guis
23 * @author Stefan Meyer <smeyer.ilias@gmx.de
24 */
25abstract class ilParticipantTableGUI extends ilTable2GUI
26{
27 protected static bool $export_allowed = false;
28 protected static bool $confirmation_required = true;
32 protected static ?array $accepted_ids = null;
33 protected static ?array $all_columns = null;
34 protected static bool $has_odf_definitions = false;
35
36 protected ?ilParticipants $participants = null;
37 protected array $current_filter = [];
39
43 public function initFilter(): void
44 {
45 $this->setDefaultFilterVisiblity(true);
46
47 $login = $this->addFilterItemByMetaType(
48 'login',
50 false,
51 $this->lng->txt('name')
52 );
53 $this->current_filter['login'] = (string) $login->getValue();
54 $this->current_filter['roles'] = 0;
55 if ($this->isColumnSelected('roles')) {
56 $role = $this->addFilterItemByMetaType(
57 'roles',
59 false,
60 $this->lng->txt('objs_role')
61 );
62
63 $options = array();
64 $options[0] = $this->lng->txt('all_roles');
65 $role->setOptions($options + $this->getParentObject()->getLocalRoles());
66 $this->current_filter['roles'] = (int) $role->getValue();
67 }
68
69 if ($this->isColumnSelected('org_units')) {
71
72 $options[0] = $this->lng->txt('select_one');
73 foreach ($paths as $org_ref_id => $path) {
74 $options[$org_ref_id] = $path;
75 }
76
77 $org = $this->addFilterItemByMetaType(
78 'org_units',
80 false,
81 $this->lng->txt('org_units')
82 );
83 $org->setOptions($options);
84 $this->current_filter['org_units'] = $org->getValue();
85 }
86 }
87
88 public function getSelectableColumns(): array
89 {
90 global $DIC;
91
92 $ilSetting = $DIC['ilSetting'];
93
94 $GLOBALS['DIC']['lng']->loadLanguageModule('ps');
95 if (self::$all_columns) {
96 # return self::$all_columns;
97 }
98
100 self::$all_columns = $ef->getSelectableFieldsInfo($this->getRepositoryObject()->getId());
101
102 if ($ilSetting->get('user_portfolios')) {
103 self::$all_columns['prtf'] = array(
104 'txt' => $this->lng->txt('obj_prtf'),
105 'default' => false
106 );
107 }
108
109 $login = array_splice(self::$all_columns, 0, 1);
110 self::$all_columns = array_merge(
111 array(
112 'roles' =>
113 array(
114 'txt' => $this->lng->txt('objs_role'),
115 'default' => true
116 )
117 ),
118 self::$all_columns
119 );
120 self::$all_columns = array_merge($login, self::$all_columns);
121 return self::$all_columns;
122 }
123
124 protected function getRepositoryObject(): ilObject
125 {
126 return $this->rep_object;
127 }
128
129 protected function getParticipants(): ?\ilParticipants
130 {
131 return $this->participants;
132 }
133
134 public function checkAcceptance(int $a_usr_id): bool
135 {
136 if (!self::$confirmation_required) {
137 return true;
138 }
139 if (!self::$export_allowed) {
140 return false;
141 }
142 return in_array($a_usr_id, self::$accepted_ids);
143 }
144
145 protected function initSettings(): void
146 {
147 if (self::$accepted_ids !== null) {
148 return;
149 }
150 self::$export_allowed = ilPrivacySettings::getInstance()->checkExportAccess($this->getRepositoryObject()->getRefId());
151
152 self::$confirmation_required = ($this->getRepositoryObject()->getType() === 'crs')
153 ? ilPrivacySettings::getInstance()->courseConfirmationRequired()
154 : ilPrivacySettings::getInstance()->groupConfirmationRequired();
155
157
158 self::$has_odf_definitions = (bool) ilCourseDefinedFieldDefinition::_hasFields($this->getRepositoryObject()->getId());
159 }
160
161 protected function showActionLinks($a_set): void
162 {
163 $loc_enabled = (
164 $this->getRepositoryObject()->getType() === 'crs' and
166 );
167
168 if (!self::$has_odf_definitions && !$loc_enabled) {
169 $this->ctrl->setParameter($this->parent_obj, 'member_id', $a_set['usr_id']);
170 $this->tpl->setCurrentBlock('link');
171 $this->tpl->setVariable('LINK_NAME', $this->ctrl->getLinkTarget($this->parent_obj, 'editMember'));
172 $this->tpl->setVariable('LINK_TXT', $this->lng->txt('edit'));
173 $this->tpl->parseCurrentBlock();
174 return;
175 }
176
177 // show action menu
178 $list = new ilAdvancedSelectionListGUI();
179 $list->setSelectionHeaderClass('small');
180 $list->setItemLinkClass('small');
181 $list->setId('actl_' . $a_set['usr_id'] . '_' . $this->getId());
182 $list->setListTitle($this->lng->txt('actions'));
183
184 $this->ctrl->setParameter($this->parent_obj, 'member_id', $a_set['usr_id']);
185 $list->addItem($this->lng->txt('edit'), '', $this->ctrl->getLinkTarget($this->getParentObject(), 'editMember'));
186
187 if (self::$has_odf_definitions) {
188 $this->ctrl->setParameterByClass('ilobjectcustomuserfieldsgui', 'member_id', $a_set['usr_id']);
189 $trans = $this->lng->txt($this->getRepositoryObject()->getType() . '_cdf_edit_member');
190 $list->addItem($trans, '', $this->ctrl->getLinkTargetByClass('ilobjectcustomuserfieldsgui', 'editMember'));
191 }
192
193 if ($loc_enabled) {
194 $this->ctrl->setParameterByClass('illomembertestresultgui', 'uid', $a_set['usr_id']);
195 $list->addItem(
196 $this->lng->txt('crs_loc_mem_show_res'),
197 '',
198 $this->ctrl->getLinkTargetByClass('illomembertestresultgui', '')
199 );
200 }
201 $this->tpl->setVariable('ACTION_USER', $list->getHTML());
202 }
203}
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _hasFields(int $a_container_id)
Check if there are any define fields.
static _getInstanceByType(string $a_type)
Get Singleton Instance.
static lookupAcceptedAgreements(int $a_obj_id)
Lookup users who have accepted the agreement.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getTextRepresentationOfOrgUnits(bool $sort_by_title=true)
Get ref id path array.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getSelectableColumns()
Get selectable columns.
Base class for course and group participants.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
isColumnSelected(string $col)
addFilterItemByMetaType(string $id, int $type=self::FILTER_TEXT, bool $a_optional=false, string $caption="")
Add filter by standard type.
setDefaultFilterVisiblity(bool $a_status)
global $DIC
Definition: feed.php:28
$path
Definition: ltiservices.php:32
global $ilSetting
Definition: privfeed.php:17