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