ILIAS  release_8 Revision v8.23
class.ilConsultationHoursCalendarBlockGUI.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
27 {
28  protected bool $new_rendering = true;
29  protected array $consultation_hour_links;
30 
31  public function __construct()
32  {
34 
35  $this->lng->loadLanguageModule("dateplaner");
36 
37  $this->setBlockId('ch_' . $this->ctrl->getContextObjId());
38  $this->setLimit(5);
39  $this->setEnableNumInfo(false);
40  $this->setTitle($this->lng->txt('consultation_hours_block_title'));
41  $this->setPresentation(self::PRES_SEC_LIST);
42  }
43 
44  public function getBlockType(): string
45  {
46  return 'chcal';
47  }
48 
49  protected function isRepositoryObject(): bool
50  {
51  return false;
52  }
53 
57  public function getTargetGUIClassPath(): array
58  {
59  $target_class = [];
60  if (!$this->getRepositoryMode()) {
61  $target_class = ["ildashboardgui", "ilcalendarpresentationgui"];
62  } else {
63  switch (ilObject::_lookupType((int) $this->requested_ref_id, true)) {
64  case "crs":
65  $target_class = ["ilobjcoursegui", "ilcalendarpresentationgui"];
66  break;
67 
68  case "grp":
69  $target_class = ["ilobjgroupgui", "ilcalendarpresentationgui"];
70  break;
71  }
72  }
73  return $target_class;
74  }
75 
76  public function getData(): array
77  {
78  if (isset($this->consultation_hour_links)) {
80  }
81  return $this->consultation_hour_links = \ilConsultationHourUtils::getConsultationHourLinksForRepositoryObject(
82  (int) $this->requested_ref_id,
83  $this->user->getId(),
84  $this->getTargetGUIClassPath()
85  );
86  }
87 
88  protected function getListItemForData(array $data): Item
89  {
90  $button = $this->ui->factory()->button()->shy(
91  $data['txt'] ?? '',
92  $data['link'] ?? ''
93  );
94  return $this->ui->factory()->item()->standard($button);
95  }
96 
97  public function getHTMLNew(): string
98  {
99  if (empty($this->getData())) {
100  return '';
101  }
102  return parent::getHTMLNew();
103  }
104 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setLimit(int $a_limit)
setBlockId(string $a_block_id="0")
setEnableNumInfo(bool $a_enablenuminfo)
static getConsultationHourLinksForRepositoryObject(int $ref_id, int $current_user_id, array $ctrl_class_structure)
getTargetGUIClassPath()
Get target gui class path (for presenting the calendar)
Common interface to all items.
Definition: Item.php:31
__construct(Container $dic, ilPlugin $plugin)
setTitle(string $a_title)
This class represents a block method of a block.
static _lookupType(int $id, bool $reference=false)
setPresentation(int $type)
ilConsultationHoursCalendarBlockGUI: ilColumnGUI