ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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
34 $login = $this->addFilterItemByMetaType(
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 {
45 $role = $this->addFilterItemByMetaType(
46 'roles',
48 false,
49 $this->lng->txt('objs_role')
50 );
51
52 $options = array();
53 $options[0] = $this->lng->txt('all_roles');
54 $role->setOptions($options + $this->getParentObject()->getLocalRoles());
55 $this->current_filter['roles'] = $role->getValue();
56 }
57
58 if($this->isColumnSelected('org_units'))
59 {
60 include_once './Modules/OrgUnit/classes/class.ilObjOrgUnit.php';
62 include_once './Modules/OrgUnit/classes/class.ilObjOrgUnitTree.php';
64 $nodes = $tree->getAllChildren($root);
65
66 include_once './Modules/OrgUnit/classes/PathStorage/class.ilOrgUnitPathStorage.php';
68 ilLoggerFactory::getLogger('crs')->dump($paths);
69
70
71 $options[0] = $this->lng->txt('select_one');
72 foreach($paths as $org_ref_id => $path)
73 {
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
93 public function getSelectableColumns()
94 {
95 global $ilSetting;
96
97 $GLOBALS['lng']->loadLanguageModule('ps');
98 if(self::$all_columns)
99 {
100 # return self::$all_columns;
101 }
102
103 include_once './Services/PrivacySecurity/classes/class.ilExportFieldsInfo.php';
105 self::$all_columns = $ef->getSelectableFieldsInfo($this->getRepositoryObject()->getId());
106
107 if($ilSetting->get('user_portfolios'))
108 {
109 self::$all_columns['prtf'] = array(
110 'txt' => $this->lng->txt('obj_prtf'),
111 'default' => false
112 );
113 }
114
115 $login = array_splice(self::$all_columns,0,1);
116 self::$all_columns = array_merge(
117 array(
118 'roles' =>
119 array(
120 'txt' => $this->lng->txt('objs_role'),
121 'default' => true
122 )
123 ),
124 self::$all_columns
125 );
126 self::$all_columns = array_merge($login, self::$all_columns);
127 return self::$all_columns;
128 }
129
133 protected function getRepositoryObject()
134 {
135 return $this->rep_object;
136 }
137
138
143 protected function getParticipants()
144 {
145 return $this->participants;
146 }
147
153 public function checkAcceptance($a_usr_id)
154 {
155 if(!self::$confirmation_required)
156 {
157 return true;
158 }
159 if(!self::$export_allowed)
160 {
161 return false;
162 }
163 return in_array($a_usr_id,self::$accepted_ids);
164 }
165
170 protected function initSettings()
171 {
172 if(self::$accepted_ids !== NULL)
173 {
174 return true;
175 }
176 self::$export_allowed = ilPrivacySettings::_getInstance()->checkExportAccess($this->getRepositoryObject()->getRefId());
177
178 self::$confirmation_required = ($this->getRepositoryObject()->getType() == 'crs')
179 ? ilPrivacySettings::_getInstance()->courseConfirmationRequired()
180 : ilPrivacySettings::_getInstance()->groupConfirmationRequired();
181
182 include_once 'Services/Membership/classes/class.ilMemberAgreement.php';
184
185 include_once('Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php');
186 self::$has_odf_definitions = ilCourseDefinedFieldDefinition::_hasFields($this->getRepositoryObject()->getId());
187 }
188
194 protected function showActionLinks($a_set)
195 {
196 $loc_enabled = (
197 $this->getRepositoryObject()->getType() == 'crs' and
198 $this->getRepositoryObject()->getViewMode() == IL_CRS_VIEW_OBJECTIVE
199 );
200
201 if(!self::$has_odf_definitions and !$loc_enabled)
202 {
203 $this->ctrl->setParameter($this->parent_obj, 'member_id', $a_set['usr_id']);
204 $this->tpl->setCurrentBlock('link');
205 $this->tpl->setVariable('LINK_NAME', $this->ctrl->getLinkTarget($this->parent_obj, 'editMember'));
206 $this->tpl->setVariable('LINK_TXT', $this->lng->txt('edit'));
207 $this->tpl->parseCurrentBlock();
208 return true;
209 }
210
211 // show action menu
212 include_once './Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php';
213 $list = new ilAdvancedSelectionListGUI();
214 $list->setSelectionHeaderClass('small');
215 $list->setItemLinkClass('small');
216 $list->setId('actl_'.$a_set['usr_id'].'_'.$this->getId());
217 $list->setListTitle($this->lng->txt('actions'));
218
219 $this->ctrl->setParameter($this->parent_obj, 'member_id', $a_set['usr_id']);
220 $list->addItem($this->lng->txt('edit'), '', $this->ctrl->getLinkTarget($this->getParentObject(),'editMember'));
221
222 if(self::$has_odf_definitions)
223 {
224 $this->ctrl->setParameterByClass('ilobjectcustomuserfieldsgui','member_id',$a_set['usr_id']);
225 $trans = $this->lng->txt($this->getRepositoryObject()->getType().'_cdf_edit_member');
226 $list->addItem($trans, '', $this->ctrl->getLinkTargetByClass('ilobjectcustomuserfieldsgui','editMember'));
227 }
228
229 if($loc_enabled)
230 {
231 $this->ctrl->setParameterByClass('illomembertestresultgui','uid', $a_set['usr_id']);
232 $list->addItem(
233 $this->lng->txt('crs_loc_mem_show_res'),
234 '',
235 $this->ctrl->getLinkTargetByClass('illomembertestresultgui','')
236 );
237 }
238
239 $this->tpl->setVariable('ACTION_USER',$list->getHTML());
240
241 }
242
243}
244?>
$path
Definition: aliased.php:25
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 getLogger($a_component_id)
Get component logger.
static lookupAcceptedAgreements($a_obj_id)
Lookup users who have accepted the agreement.
static getRootOrgRefId()
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?
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
global $ilSetting
Definition: privfeed.php:17
if(!is_array($argv)) $options