19declare(strict_types=1);
74 $this->main_tpl =
$DIC->ui()->mainTemplate();
76 $this->
http = $DIC->http();
78 $this->appointment = $a_appointment;
79 $this->infoscreen = $a_info_screen;
80 $this->info_items = [];
82 $this->
lng = $DIC->language();
83 $this->
lng->loadLanguageModule(
"dateplaner");
84 $this->tree =
$DIC->repositoryTree();
85 $this->
ui = $DIC->ui();
86 $this->list_item = $a_list_item;
87 $this->
ctrl = $DIC->ctrl();
88 $this->
access = $DIC->access();
89 $this->rbacsystem =
$DIC->rbac()->system();
90 $this->
user = $DIC->user();
104 $cat_id = $this->
getCatId($this->appointment[
'event']->getEntryId());
106 $this->obj_id = $category->getObjId();
110 array $a_appointment,
115 return new static($a_appointment, $a_info_screen, $a_toolbar, $a_list_item);
120 return $this->toolbar;
129 return $this->list_item;
137 return $this->infoscreen;
147 $cat_id = $this->getCatId($this->appointment[
'event']->getEntryId());
153 $next_class = $this->
ctrl->getNextClass();
154 $cmd = $this->
ctrl->getCmd(
"getHTML");
155 switch ($next_class) {
163 $this->collectStandardPropertiesAndActions();
164 $this->collectPropertiesAndActions();
167 $infoscreen = $this->getInfoScreen();
169 foreach ($this->info_items as $i) {
170 switch ($i[
"type"]) {
181 $toolbar = $this->getToolbar();
185 if ($settings->isBatchFileDownloadsEnabled() && $this->has_files) {
187 $this->
ctrl->setParameter($this,
"app_id", $this->appointment[
'event']->getEntryId());
188 $download_btn = $ui->
factory()->button()->standard(
189 $this->
lng->txt(
"cal_download_files"),
190 $this->ctrl->getLinkTarget($this,
'downloadFiles')
192 $this->
ctrl->setParameter($this,
"app_id",
'');
197 foreach ($this->actions as
$a) {
198 $btn = $this->
ui->factory()->button()->standard(
207 $list_item = $this->getListItem();
209 $dd = $list_item->getActions();
214 $actions = $dd->getItems();
215 $label = $dd->getLabel();
219 foreach ($this->actions as
$a) {
220 $actions[] = $ui->
factory()->button()->shy(
$a[
"txt"],
$a[
"link"]);
222 foreach ($this->list_properties as $lp) {
223 $properties[$lp[
"txt"]] = $lp[
"val"];
226 $new_dd = $ui->
factory()->dropdown()
229 $this->list_item = $list_item
230 ->withActions($new_dd)
241 $refs = $this->getReadableRefIds($a_obj_id);
243 if (count($refs) == 1 &&
$ref_id > 0) {
245 $f = $this->
ui->factory();
246 $r = $this->
ui->renderer();
250 if ($cont_ref_id == 0) {
254 if ($cont_ref_id > 0) {
258 $this->addInfoProperty(
259 $this->
lng->txt(
"obj_" . $type),
260 $r->render(
$f->button()->shy($parent_title, $href))
262 $this->addListItemProperty(
263 $this->
lng->txt(
"obj_" . $type),
264 $r->render(
$f->button()->shy($parent_title, $href))
275 $this->info_items[] = array(
"type" =>
"section",
"txt" => $a_txt);
283 $this->info_items[] = array(
"type" =>
"property",
"txt" => $a_txt,
"val" => $a_val);
292 $this->list_properties[] = array(
"txt" => $a_txt,
"val" => $a_val);
298 public function addAction(
string $a_txt,
string $a_link): void
300 $this->actions[] = array(
"txt" => $a_txt,
"link" => $a_link);
315 $cat_info = $this->getCatInfo();
318 if ($cat_info[
'editable'] && !$this->appointment[
'event']->isAutoGenerated()) {
319 $this->
ctrl->clearParametersByClass(
'ilcalendarappointmentgui');
321 $this->
ctrl->setParameterByClass(
322 'ilcalendarappointmentgui',
324 $this->appointment[
'event']->getEntryId()
326 $this->
ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'dt', $this->appointment[
'dstart']);
329 $this->
lng->txt(
"edit"),
330 $this->ctrl->getLinkTargetByClass(array(
'ilcalendarappointmentgui'),
'askEdit')
333 $this->
ctrl->clearParametersByClass(
'ilcalendarappointmentgui');
335 $this->
ctrl->setParameterByClass(
336 'ilcalendarappointmentgui',
338 $this->appointment[
'event']->getEntryId()
340 $this->
ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'dt', $this->appointment[
'dstart']);
343 $this->
lng->txt(
"delete"),
344 $this->ctrl->getLinkTargetByClass(array(
'ilcalendarappointmentgui'),
'askDelete')
354 $refs = $this->getReadableRefIds($obj_id);
359 $link_title = $title;
360 if (count($refs) > 1) {
361 $par_ref = $this->tree->getParentId(
$ref_id);
365 $link = $this->buildDirectLinkForAppointment(
$ref_id, $a_appointment);
367 $buttons[] = $this->
ui->renderer()->render(
368 $this->
ui->factory()->button()->shy($link_title, $link)
372 $prop_value = $title;
374 $prop_value = implode(
"<br>", $buttons);
376 if ($prop_value !=
'') {
396 if (!isset($this->readable_ref_ids[$a_obj_id])) {
399 if ($this->
access->checkAccess(
"read",
"", $ref_id)) {
403 $this->readable_ref_ids[$a_obj_id] = $ref_ids;
405 return $this->readable_ref_ids[$a_obj_id];
413 if ($a_app[
'event']->getDescription()) {
414 $this->addInfoProperty(
415 $this->
lng->txt(
"description"),
426 if ($a_app[
'event']->getLocation()) {
427 $this->addInfoProperty($this->
lng->txt(
"cal_where"), $a_app[
'event']->getLocation());
428 $this->addListItemProperty($this->
lng->txt(
"location"), $a_app[
'event']->getLocation());
438 $a_app[
"event"]->getLastUpdate()->
get(
IL_CAL_UNIX),
440 $this->
user->getTimeZone()
447 $this->
ctrl->setParameterByClass(
"ilCalendarPresentationGUI",
"category_id", $cat_info[
"cat_id"]);
449 $link = $this->
ui->renderer()->render(
450 $this->
ui->factory()->button()->shy(
452 $this->ctrl->getLinkTargetByClass(array(
"ilDashboardGUI",
"ilCalendarPresentationGUI"),
"")
456 $this->
ctrl->setParameterByClass(
"ilCalendarPresentationGUI",
"category_id",
'');
457 $this->addInfoProperty($this->
lng->txt(
"calendar"), $link);
458 $this->addListItemProperty($this->
lng->txt(
"calendar"), $link);
464 ?array $cat_info =
null,
465 bool $a_container_info =
false
468 $this->addInfoSection($a_app[
"event"]->getPresentationTitle(false));
471 $this->addEventDescription($a_app);
475 $this->addObjectLinks($a_obj_id, $a_app);
479 if ($a_container_info) {
480 $this->addContainerInfo($a_obj_id);
484 $this->addEventLocation($a_app);
487 if ($cat_info !=
null) {
488 $this->addCalendarInfo($cat_info);
495 ?
string $a_sub_obj_type =
null,
496 ?
int $a_sub_obj_id =
null
503 (string) $a_sub_obj_type,
506 $md_items = $record_gui->
parse();
507 if (count($md_items)) {
508 foreach ($md_items as $md_item) {
509 $this->addInfoProperty($md_item[
'title'], $md_item[
'value']);
510 $this->addListItemProperty($md_item[
'title'], $md_item[
'value']);
518 public function getUserName(
int $a_user_id,
bool $a_force_name =
false): string
521 if ($this->
http->wrapper()->query()->has(
'ref_id')) {
522 $ref_id = $this->
http->wrapper()->query()->retrieve(
528 $ctrl_path = array();
529 if ($type ==
"crs") {
530 $ctrl_path[] =
"ilobjcoursegui";
532 if ($type ==
"grp") {
533 $ctrl_path[] =
"ilobjgroupgui";
536 if ($this->
http->wrapper()->query()->has(
'baseClass')) {
537 $baseClass = $this->
http->wrapper()->query()->retrieve(
539 $this->
refinery->kindlyTo()->string()
542 if (strtolower($baseClass) ==
"ildashboardgui") {
543 $ctrl_path[] =
"ildashboardgui";
545 $ctrl_path[] =
"ilCalendarPresentationGUI";
546 $ctrl_path[] = PublicProfileGUI::class;
552 $this->
ctrl->getParentReturn($this),
567 if (empty($this->appointment)) {
569 if ($this->
http->wrapper()->query()->has(
'app_id')) {
570 $entry_id = $this->
http->wrapper()->query()->retrieve(
577 if ($entry->getStart()) {
578 $this->appointment = array(
580 "dstart" => $entry->getStart(),
581 "dend" => $entry->getEnd(),
582 "fullday" => $entry->isFullday()
585 $this->main_tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"obj_not_found"),
true);
586 $this->
ctrl->returnToParent($this);
591 $download_job->setBucketTitle($this->
lng->txt(
"cal_calendar_download") .
" " . $this->appointment[
'event']->getTitle());
592 $download_job->setEvents(array($this->appointment));
593 if ($download_job->run()) {
594 $this->main_tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'cal_download_files_started'),
true);
596 $this->
ctrl->returnToParent($this);
Provides fluid interface to RBAC services.
factory()
Get the factory that crafts UI components.
GUI class for public user profile presentation.
addContainerInfo(int $a_obj_id)
Add course/group container info.
addInfoProperty(string $a_txt, string $a_val)
Add info property.
addMetaData(string $a_obj_type, int $a_obj_id, ?string $a_sub_obj_type=null, ?int $a_sub_obj_id=null)
readObjIdForAppointment()
read obj_id for appointment
addEventLocation(array $a_app)
Add event location.
ilInfoScreenGUI $infoscreen
getCatId(int $a_entry_id)
addCommonSection(array $a_app, int $a_obj_id=0, ?array $cat_info=null, bool $a_container_info=false)
getListItem()
Get list item.
addEventDescription(array $a_app)
Add event description.
buildDirectLinkForAppointment(int $a_ref_id, ?array $a_appointment=null)
Build direct link for appointment.
downloadFiles()
Download files from an appointment ( Modals )
collectStandardPropertiesAndActions()
Collect standard properties and actions.
getReadableRefIds(int $a_obj_id)
addObjectLinks(int $obj_id, ?array $a_appointment=null)
Add object link.
addLastUpdate(array $a_app)
Add last update.
ilGlobalTemplateInterface $main_tpl
RefineryFactory $refinery
addAction(string $a_txt, string $a_link)
Add action.
getUserName(int $a_user_id, bool $a_force_name=false)
Get (linked if possible) user name.
collectPropertiesAndActions()
Collect properties and actions.
addCalendarInfo(array $cat_info)
addInfoSection(string $a_txt)
Add info section.
addListItemProperty(string $a_txt, string $a_val)
Add list item property.
static getInstance(array $a_appointment, ?ilInfoScreenGUI $a_info_screen, ?ilToolbarGUI $a_toolbar, ?Item $a_list_item)
__construct(array $a_appointment, ?ilInfoScreenGUI $a_info_screen, ?ilToolbarGUI $a_toolbar, ?Item $a_list_item)
static _getInstance($a_usr_id=0)
get singleton instance
static _lookupCategory(int $a_cal_id)
static getInstanceByCategoryId(int $a_cat_id)
Model for a calendar entry.
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
@classDescription Date and time handling
Description of class class.
addSection(string $a_title)
addProperty(string $a_name, string $a_value, string $a_link="")
add a property to current section
static _getStaticLink(?int $a_ref_id, string $a_type='', bool $a_fallback_goto=true, string $append="")
static _lookupObjectId(int $ref_id)
static _lookupType(int $id, bool $reference=false)
static _getAllReferences(int $id)
get all reference ids for object ID
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
class ilRbacSystem system function like checkAccess, addActiveRole ... Supporting system functions ar...
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
checkForParentType(int $a_ref_id, string $a_type, bool $a_exclude_source_check=false)
Check for parent type e.g check if a folder (ref_id 3) is in a parent course obj => checkForParentTyp...
static getNamePresentation( $a_user_id, bool $a_user_image=false, bool $a_profile_link=false, string $a_profile_back_link='', bool $a_force_first_lastname=false, bool $a_omit_login=false, bool $a_sortable=true, bool $a_return_data_array=false, $a_ctrl_path=null)
Default behaviour is:
static makeClickable(string $a_text, bool $detectGotoLinks=false, ?string $ilias_http_path=null)
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Common interface to all items.
withProperties(array $properties)
Get a new item with the given properties as key-value pairs.
getProperties()
Get the properties of the appointment.
Interface ilAccessHandler This interface combines all available interfaces which can be called via gl...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static http()
Fetches the global http state from ILIAS.
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples