ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 
21  public function getSelectableColumns()
22  {
23  global $ilSetting;
24 
25  $GLOBALS['lng']->loadLanguageModule('ps');
26  if(self::$all_columns)
27  {
28  # return self::$all_columns;
29  }
30 
31  include_once './Services/PrivacySecurity/classes/class.ilExportFieldsInfo.php';
32  $ef = ilExportFieldsInfo::_getInstanceByType($this->getParentObject()->object->getType());
33  self::$all_columns = $ef->getSelectableFieldsInfo($this->getParentObject()->object->getId());
34 
35  if ($this->type == 'member' &&
36  $ilSetting->get('user_portfolios'))
37  {
38  self::$all_columns['prtf'] = array(
39  'txt' => $this->lng->txt('obj_prtf'),
40  'default' => false
41  );
42  }
43 
44  return self::$all_columns;
45  }
46 
52  public function checkAcceptance($a_usr_id)
53  {
54  if(!self::$confirmation_required)
55  {
56  return true;
57  }
58  if(!self::$export_allowed)
59  {
60  return false;
61  }
62  return in_array($a_usr_id,self::$accepted_ids);
63  }
64 
69  protected function initSettings()
70  {
71  if(self::$accepted_ids !== NULL)
72  {
73  return true;
74  }
75  self::$export_allowed = ilPrivacySettings::_getInstance()->checkExportAccess($this->getParentObject()->object->getRefId());
76  self::$confirmation_required = ilPrivacySettings::_getInstance()->groupConfirmationRequired();
77 
78  include_once 'Services/Membership/classes/class.ilMemberAgreement.php';
79  self::$accepted_ids = ilMemberAgreement::lookupAcceptedAgreements($this->getParentObject()->object->getId());
80 
81  include_once('Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php');
82  self::$has_odf_definitions = ilCourseDefinedFieldDefinition::_hasFields($this->getParentObject()->object->getId());
83  }
84 
90  protected function showActionLinks($a_set)
91  {
92  if(!$this->show_edit_link)
93  {
94  return true;
95  }
96 
97  if(!self::$has_odf_definitions)
98  {
99  $this->ctrl->setParameter($this->parent_obj, 'member_id', $a_set['usr_id']);
100  $this->tpl->setCurrentBlock('link');
101  $this->tpl->setVariable('LINK_NAME', $this->ctrl->getLinkTarget($this->parent_obj, 'editMember'));
102  $this->tpl->setVariable('LINK_TXT', $this->lng->txt('edit'));
103  $this->tpl->parseCurrentBlock();
104  return true;
105  }
106 
107  // show action menu
108  include_once './Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php';
109  $list = new ilAdvancedSelectionListGUI();
110  $list->setSelectionHeaderClass('small');
111  $list->setItemLinkClass('small');
112  $list->setId('actl_'.$a_set['usr_id'].'_'.$this->getId());
113  $list->setListTitle($this->lng->txt('actions'));
114 
115  $this->ctrl->setParameter($this->parent_obj, 'member_id', $a_set['usr_id']);
116  $list->addItem($this->lng->txt('edit'), '', $this->ctrl->getLinkTarget($this->getParentObject(),'editMember'));
117 
118  $this->ctrl->setParameterByClass('ilobjectcustomuserfieldsgui','member_id',$a_set['usr_id']);
119 
120  $trans = $this->lng->txt($this->getParentObject()->object->getType().'_cdf_edit_member');
121  $list->addItem($trans, '', $this->ctrl->getLinkTargetByClass('ilobjectcustomuserfieldsgui','editMember'));
122 
123 
124  $this->tpl->setVariable('ACTION_USER',$list->getHTML());
125 
126  }
127 
128 }
129 ?>