ILIAS  trunk Revision v11.0_alpha-1769-g99a433fe2dc
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilGroupEditParticipantsTableGUI.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
28 {
29  protected ilObject $rep_object;
32 
40  public function __construct(object $a_parent_obj, ilObject $rep_object)
41  {
42  global $DIC;
43 
44  $this->rep_object = $rep_object;
45 
46  $this->privacy = ilPrivacySettings::getInstance();
47  $this->participants = ilGroupParticipants::_getInstanceByObjId($this->rep_object->getId());
48  parent::__construct($a_parent_obj, 'editMembers');
49  $this->lng->loadLanguageModule('grp');
50  $this->setFormName('participants');
51  $this->setFormAction($this->ctrl->getFormAction($a_parent_obj));
52 
53  $this->addColumn($this->lng->txt('name'), 'name', '20%');
54  $this->addColumn($this->lng->txt('login'), 'login', '25%');
55 
56  if ($this->privacy->enabledGroupAccessTimes()) {
57  $this->addColumn($this->lng->txt('last_access'), 'access_time');
58  }
59  $this->addColumn($this->lng->txt('grp_mem_contacts'), 'contact');
60  $this->addColumn($this->lng->txt('grp_notification'), 'notification');
61  $this->addColumn($this->lng->txt('objs_role'), 'roles');
62 
63  $this->addCommandButton('updateParticipants', $this->lng->txt('save'));
64  $this->addCommandButton('participants', $this->lng->txt('cancel'));
65 
66  $this->setRowTemplate("tpl.edit_participants_row.html", "components/ILIAS/Group");
67 
68  $this->disable('sort');
69  $this->enable('header');
70  $this->enable('numinfo');
71  $this->disable('select_all');
72  }
73 
74  protected function fillRow(array $a_set): void
75  {
76  $this->tpl->setVariable('VAL_ID', $a_set['usr_id']);
77  $this->tpl->setVariable('VAL_NAME', $a_set['lastname'] . ', ' . $a_set['firstname']);
78 
79  $this->tpl->setVariable('VAL_LOGIN', $a_set['login']);
80 
81  if ($this->privacy->enabledGroupAccessTimes()) {
82  $this->tpl->setVariable('VAL_ACCESS', $a_set['access_time']);
83  }
84  $this->tpl->setVariable('VAL_CONTACT_CHECKED', $a_set['contact'] ? 'checked="checked"' : '');
85  $this->tpl->setVariable('VAL_NOTIFICATION_ID', $a_set['usr_id']);
86  $this->tpl->setVariable('VAL_NOTIFICATION_CHECKED', $a_set['notification'] ? 'checked="checked"' : '');
87 
88  $this->tpl->setVariable('NUM_ROLES', count($this->participants->getRoles()));
89 
90  $assigned = $this->participants->getAssignedRoles((int) $a_set['usr_id']);
91  foreach ($this->rep_object->getLocalGroupRoles(true) as $name => $role_id) {
92  $this->tpl->setCurrentBlock('roles');
93  $this->tpl->setVariable('ROLE_ID', $role_id);
94  $this->tpl->setVariable('ROLE_NAME', $name);
95 
96  if (in_array($role_id, $assigned)) {
97  $this->tpl->setVariable('ROLE_CHECKED', 'selected="selected"');
98  }
99  $this->tpl->parseCurrentBlock();
100  }
101  }
102 }
enable(string $a_module_name)
setFormAction(string $a_form_action, bool $a_multipart=false)
addCommandButton(string $a_cmd, string $a_text, string $a_onclick='', string $a_id="", string $a_class="")
setFormName(string $a_name="")
Singleton class that stores all privacy settings.
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
global $DIC
Definition: shib_login.php:22
__construct(object $a_parent_obj, ilObject $rep_object)
Constructor.
Base class for course and group participants.
static _getInstanceByObjId(int $a_obj_id)
Get singleton instance.
__construct(Container $dic, ilPlugin $plugin)
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
disable(string $a_module_name)