ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilConsultationHourGroupTableGUI.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
6 
12 {
13  private int $user_id = 0;
14 
15  public function __construct(object $a_parent_obj, string $a_parent_cmd, int $a_user_id)
16  {
17  $this->user_id = $a_user_id;
18  $this->setId('chgrp_' . $this->user_id);
19  parent::__construct($a_parent_obj, $a_parent_cmd);
20  $this->initTable();
21  }
22 
26  protected function initTable(): void
27  {
28  $this->setRowTemplate('tpl.ch_group_row.html', 'Services/Calendar');
29 
30  $this->setTitle($this->lng->txt('cal_ch_grps'));
31  $this->setFormAction($this->ctrl->getFormAction($this->getParentObject(), $this->getParentCmd()));
32 
33  $this->addColumn($this->lng->txt('title'), 'title');
34  $this->addColumn($this->lng->txt('cal_ch_assigned_apps'), 'apps');
35  $this->addColumn($this->lng->txt('cal_ch_max_books'), 'max_books');
36  $this->addColumn($this->lng->txt('actions'), '');
37 
38  $this->enable('sort');
39  $this->enable('header');
40  $this->enable('num_info');
41  $this->setDefaultOrderField('title');
42  }
43 
47  protected function fillRow(array $a_set): void
48  {
49  $this->tpl->setVariable('TITLE', $a_set['title']);
50  $this->tpl->setVariable('MAX_BOOKINGS', $a_set['max_books']);
51  $this->tpl->setVariable('ASSIGNED', $a_set['assigned']);
52 
53  $list = new ilAdvancedSelectionListGUI();
54  $list->setId('act_chgrp_' . $this->user_id . '_' . $a_set['id']);
55  $list->setListTitle($this->lng->txt('actions'));
56 
57  $this->ctrl->setParameter($this->getParentObject(), 'grp_id', $a_set['id']);
58  $list->addItem(
59  $this->lng->txt('edit'),
60  '',
61  $this->ctrl->getLinkTarget($this->getParentObject(), 'editGroup')
62  );
63 
64  // add members
65  if ($a_set['assigned']) {
66  $list->addItem(
67  $this->lng->txt('cal_ch_assign_participants'),
68  '',
69  $this->ctrl->getLinkTargetByClass('ilRepositorySearchGUI', '')
70  );
71  }
72 
73  $list->addItem(
74  $this->lng->txt('delete'),
75  '',
76  $this->ctrl->getLinkTarget($this->getParentObject(), 'confirmDeleteGroup')
77  );
78 
79  $this->tpl->setVariable('ACTIONS', $list->getHTML());
80  }
81 
86  public function parse(array $groups): void
87  {
88  $rows = array();
89  $counter = 0;
90  foreach ($groups as $group) {
91  $rows[$counter]['id'] = $group->getGroupId();
92  $rows[$counter]['title'] = $group->getTitle();
93  $rows[$counter]['max_books'] = $group->getMaxAssignments();
94  $rows[$counter]['assigned'] = count(
96  $this->user_id,
97  $group->getGroupId(),
98  null
99  )
100  );
101  ++$counter;
102  }
103  $this->setData($rows);
104  }
105 }
setData(array $a_data)
enable(string $a_module_name)
setFormAction(string $a_form_action, bool $a_multipart=false)
setId(string $a_val)
__construct(object $a_parent_obj, string $a_parent_cmd, int $a_user_id)
setDefaultOrderField(string $a_defaultorderfield)
static getAppointmentIdsByGroup(int $a_user_id, int $a_ch_group_id, ?ilDateTime $start=null)
Get appointment ids by consultation hour group.
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
$rows
Definition: xhr_table.php:10
__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)