ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilConsultationHoursCalendarBlockGUI.php
Go to the documentation of this file.
1<?php
2
20
25{
26 protected $new_rendering = true;
28
29 public function __construct()
30 {
32
33 $this->lng->loadLanguageModule("dateplaner");
34
35 $this->setBlockId('ch_' . $this->ctrl->getContextObjId());
36 $this->setLimit(5);
37 $this->setEnableNumInfo(false);
38 $this->setTitle($this->lng->txt('consultation_hours_block_title'));
39 $this->setPresentation(self::PRES_SEC_LIST);
40 }
41
42 public function getBlockType() : string
43 {
44 return 'chcal';
45 }
46
47 protected function isRepositoryObject() : bool
48 {
49 return false;
50 }
51
55 public function getTargetGUIClassPath() : array
56 {
57 $target_class = [];
58 if (!$this->getRepositoryMode()) {
59 $target_class = ["ildashboardgui", "ilcalendarpresentationgui"];
60 } else {
61 switch (ilObject::_lookupType((int) $_GET["ref_id"], true)) {
62 case "crs":
63 $target_class = ["ilobjcoursegui", "ilcalendarpresentationgui"];
64 break;
65
66 case "grp":
67 $target_class = ["ilobjgroupgui", "ilcalendarpresentationgui"];
68 break;
69 }
70 }
71 return $target_class;
72 }
73
74 public function getData() : array
75 {
76 if (isset($this->consultation_hour_links)) {
78 }
80 (int) $_GET['ref_id'],
81 $this->user->getId(),
82 $this->getTargetGUIClassPath()
83 );
84 }
85
86 protected function getListItemForData(array $data) : Item
87 {
88 $button = $this->ui->factory()->button()->shy(
89 $data['txt'] ?? '',
90 $data['link'] ?? ''
91 );
92 return $this->ui->factory()->item()->standard($button);
93 }
94
95 public function getHTMLNew() : string
96 {
97 if (empty($this->getData())) {
98 return '';
99 }
100 return parent::getHTMLNew();
101 }
102}
user()
Definition: user.php:4
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
This class represents a block method of a block.
setLimit($a_limit)
Set Limit.
getRepositoryMode()
Get RepositoryMode.
setPresentation(int $type)
Set presentation.
setTitle($a_title)
Set Title.
setBlockId($a_block_id=0)
Set Block Id.
setEnableNumInfo($a_enablenuminfo)
Set Enable Item Number Info.
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($a_id, $a_reference=false)
lookup object type
Common interface to all items.
Definition: Item.php:11
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
ui()
Definition: ui.php:5