ILIAS  trunk Revision v11.0_alpha-1769-g99a433fe2dc
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilConsultationHoursCalendarBlockGUI.php
Go to the documentation of this file.
1 <?php
2 
19 declare(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  }
80  return $this->consultation_hour_links = \ilConsultationHourUtils::getConsultationHourLinksForRepositoryObject(
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 }
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