ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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 
9 
15 {
16  private int $user_id = 0;
17 
20 
21  public function __construct(object $a_parent_obj, string $a_parent_cmd, int $a_user_id)
22  {
23  global $DIC;
24 
25  $this->user_id = $a_user_id;
26  $this->setId('chgrp_' . $this->user_id);
27  parent::__construct($a_parent_obj, $a_parent_cmd);
28 
29  $this->renderer = $DIC->ui()->renderer();
30  $this->uiFactory = $DIC->ui()->factory();
31 
32  $this->initTable();
33  }
34 
38  protected function initTable(): void
39  {
40  $this->setRowTemplate('tpl.ch_group_row.html', 'Services/Calendar');
41 
42  $this->setTitle($this->lng->txt('cal_ch_grps'));
43  $this->setFormAction($this->ctrl->getFormAction($this->getParentObject(), $this->getParentCmd()));
44 
45  $this->addColumn($this->lng->txt('title'), 'title');
46  $this->addColumn($this->lng->txt('cal_ch_assigned_apps'), 'apps');
47  $this->addColumn($this->lng->txt('cal_ch_max_books'), 'max_books');
48  $this->addColumn($this->lng->txt('actions'), '');
49 
50  $this->enable('sort');
51  $this->enable('header');
52  $this->enable('num_info');
53  $this->setDefaultOrderField('title');
54  }
55 
59  protected function fillRow(array $a_set): void
60  {
61  $this->tpl->setVariable('TITLE', $a_set['title']);
62  $this->tpl->setVariable('MAX_BOOKINGS', $a_set['max_books']);
63  $this->tpl->setVariable('ASSIGNED', $a_set['assigned']);
64 
65  $dropDownItems[] = array();
66 
67  $this->ctrl->setParameter($this->getParentObject(), 'grp_id', $a_set['id']);
68 
69  $dropDownItems[] = $this->uiFactory->button()->shy(
70  $this->lng->txt('edit'),
71  $this->ctrl->getLinkTarget($this->getParentObject(), 'editGroup')
72  );
73 
74  // add members
75  if ($a_set['assigned']) {
76  $dropDownItems[] = $this->uiFactory->button()->shy(
77  $this->lng->txt('cal_ch_assign_participants'),
78  $this->ctrl->getLinkTargetByClass('ilRepositorySearchGUI', '')
79  );
80  }
81 
82  $dropDownItems[] = $this->uiFactory->button()->shy(
83  $this->lng->txt('delete'),
84  $this->ctrl->getLinkTarget($this->getParentObject(), 'confirmDeleteGroup')
85  );
86  $dropDown = $this->uiFactory->dropdown()->standard($dropDownItems)
87  ->withLabel($this->lng->txt('actions'));
88  $this->tpl->setVariable('ACTIONS', $this->renderer->render($dropDown));
89  }
90 
95  public function parse(array $groups): void
96  {
97  $rows = array();
98  $counter = 0;
99  foreach ($groups as $group) {
100  $rows[$counter]['id'] = $group->getGroupId();
101  $rows[$counter]['title'] = $group->getTitle();
102  $rows[$counter]['max_books'] = $group->getMaxAssignments();
103  $rows[$counter]['assigned'] = count(
105  $this->user_id,
106  $group->getGroupId(),
107  null
108  )
109  );
110  ++$counter;
111  }
112  $this->setData($rows);
113  }
114 }
setData(array $a_data)
enable(string $a_module_name)
setFormAction(string $a_form_action, bool $a_multipart=false)
setId(string $a_val)
global $DIC
Definition: feed.php:28
__construct(object $a_parent_obj, string $a_parent_cmd, int $a_user_id)
__construct(VocabulariesInterface $vocabularies)
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="")
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)