ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilParticipantsTableGUI.php
Go to the documentation of this file.
1 <?php
2 
3 include_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  */
9 abstract 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/class.ilObjOrgUnit.php';
60  include_once './Modules/OrgUnit/classes/class.ilObjOrgUnitTree.php';
62  $nodes = $tree->getAllChildren($root);
63 
64  include_once './Modules/OrgUnit/classes/PathStorage/class.ilOrgUnitPathStorage.php';
66 
67  $options[0] = $this->lng->txt('select_one');
68  foreach ($paths as $org_ref_id => $path) {
69  $options[$org_ref_id] = $path;
70  }
71 
72  $org = $this->addFilterItemByMetaType(
73  'org_units',
75  false,
76  $this->lng->txt('org_units')
77  );
78  $org->setOptions($options);
79  $this->current_filter['org_units'] = $org->getValue();
80  }
81  }
82 
83 
88  public function getSelectableColumns()
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 
99  include_once './Services/PrivacySecurity/classes/class.ilExportFieldsInfo.php';
101  self::$all_columns = $ef->getSelectableFieldsInfo($this->getRepositoryObject()->getId());
102 
103  if ($ilSetting->get('user_portfolios')) {
104  self::$all_columns['prtf'] = array(
105  'txt' => $this->lng->txt('obj_prtf'),
106  'default' => false
107  );
108  }
109 
110  $login = array_splice(self::$all_columns, 0, 1);
111  self::$all_columns = array_merge(
112  array(
113  'roles' =>
114  array(
115  'txt' => $this->lng->txt('objs_role'),
116  'default' => true
117  )
118  ),
119  self::$all_columns
120  );
121  self::$all_columns = array_merge($login, self::$all_columns);
122  return self::$all_columns;
123  }
124 
128  protected function getRepositoryObject()
129  {
130  return $this->rep_object;
131  }
132 
133 
138  protected function getParticipants()
139  {
140  return $this->participants;
141  }
142 
148  public function checkAcceptance($a_usr_id)
149  {
150  if (!self::$confirmation_required) {
151  return true;
152  }
153  if (!self::$export_allowed) {
154  return false;
155  }
156  return in_array($a_usr_id, self::$accepted_ids);
157  }
158 
163  protected function initSettings()
164  {
165  if (self::$accepted_ids !== null) {
166  return true;
167  }
168  self::$export_allowed = ilPrivacySettings::_getInstance()->checkExportAccess($this->getRepositoryObject()->getRefId());
169 
170  self::$confirmation_required = ($this->getRepositoryObject()->getType() == 'crs')
171  ? ilPrivacySettings::_getInstance()->courseConfirmationRequired()
172  : ilPrivacySettings::_getInstance()->groupConfirmationRequired();
173 
174  include_once 'Services/Membership/classes/class.ilMemberAgreement.php';
175  self::$accepted_ids = ilMemberAgreement::lookupAcceptedAgreements($this->getRepositoryObject()->getId());
176 
177  include_once('Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php');
178  self::$has_odf_definitions = ilCourseDefinedFieldDefinition::_hasFields($this->getRepositoryObject()->getId());
179  }
180 
186  protected function showActionLinks($a_set)
187  {
188  $loc_enabled = (
189  $this->getRepositoryObject()->getType() == 'crs' and
190  $this->getRepositoryObject()->getViewMode() == IL_CRS_VIEW_OBJECTIVE
191  );
192 
193  if (!self::$has_odf_definitions and !$loc_enabled) {
194  $this->ctrl->setParameter($this->parent_obj, 'member_id', $a_set['usr_id']);
195  $this->tpl->setCurrentBlock('link');
196  $this->tpl->setVariable('LINK_NAME', $this->ctrl->getLinkTarget($this->parent_obj, 'editMember'));
197  $this->tpl->setVariable('LINK_TXT', $this->lng->txt('edit'));
198  $this->tpl->parseCurrentBlock();
199  return true;
200  }
201 
202  // show action menu
203  include_once './Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php';
205  $list->setSelectionHeaderClass('small');
206  $list->setItemLinkClass('small');
207  $list->setId('actl_' . $a_set['usr_id'] . '_' . $this->getId());
208  $list->setListTitle($this->lng->txt('actions'));
209 
210  $this->ctrl->setParameter($this->parent_obj, 'member_id', $a_set['usr_id']);
211  $list->addItem($this->lng->txt('edit'), '', $this->ctrl->getLinkTarget($this->getParentObject(), 'editMember'));
212 
213  if (self::$has_odf_definitions) {
214  $this->ctrl->setParameterByClass('ilobjectcustomuserfieldsgui', 'member_id', $a_set['usr_id']);
215  $trans = $this->lng->txt($this->getRepositoryObject()->getType() . '_cdf_edit_member');
216  $list->addItem($trans, '', $this->ctrl->getLinkTargetByClass('ilobjectcustomuserfieldsgui', 'editMember'));
217  }
218 
219  if ($loc_enabled) {
220  $this->ctrl->setParameterByClass('illomembertestresultgui', 'uid', $a_set['usr_id']);
221  $list->addItem(
222  $this->lng->txt('crs_loc_mem_show_res'),
223  '',
224  $this->ctrl->getLinkTargetByClass('illomembertestresultgui', '')
225  );
226  }
227 
228  $this->tpl->setVariable('ACTION_USER', $list->getHTML());
229  }
230 }
showActionLinks($a_set)
show edit links
$path
Definition: aliased.php:25
if(isset($_REQUEST['delete'])) $list
Definition: registry.php:41
const IL_CRS_VIEW_OBJECTIVE
if($argc< 2) $paths
Definition: migrateto20.php:44
global $DIC
Definition: saml.php:7
addFilterItemByMetaType($id, $type=self::FILTER_TEXT, $a_optional=false, $caption=null)
Add filter by standard type.
setDefaultFilterVisiblity($a_status)
Set default filter visiblity.
getParentObject()
Get parent object.
Class ilTable2GUI.
static getTextRepresentationOfOrgUnits($sort_by_title=true)
Get ref id path array.
static _getInstanceByType($a_type)
Get Singleton Instance.
$root
Definition: sabredav.php:45
getSelectableColumns()
Get selectable columns.
static _hasFields($a_container_id)
Check if there are any define fields.
static getRootOrgRefId()
isColumnSelected($a_col)
Is given column selected?
User interface class for advanced drop-down selection lists.
global $ilSetting
Definition: privfeed.php:17
$login
Definition: cron.php:13
checkAcceptance($a_usr_id)
Check acceptance.
static _getInstance()
Get instance of ilPrivacySettings.
getId()
Get element id.
static lookupAcceptedAgreements($a_obj_id)
Lookup users who have accepted the agreement.
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.