ILIAS  release_8 Revision v8.23
VEventFactory.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
22 
24 use ilObjUser;
26 
27 final class VEventFactory
28 {
36  public static function getInstanceFromTalk(ilObjEmployeeTalk $talk, string $status = VEventStatus::CONFIRMED): VEvent
37  {
38  $data = $talk->getData();
39  $superior = new ilObjUser($talk->getOwner());
40  $employee = new ilObjUser($talk->getData()->getEmployee());
41  $superiorName = $superior->getFullname();
42 
43  return new VEvent(
44  md5($talk->getType() . $talk->getId()),
45  self::msOutlook2013Workaround($talk),
46  $talk->getTitle(),
47  0,
48  $status,
49  $superiorName,
50  $superior->getEmail(),
51  $employee->getFullname(),
52  $employee->getEmail(),
53  $data->getStartDate()->getUnixTime(),
54  $data->getEndDate()->getUnixTime(),
55  $data->isAllDay(),
56  '',
57  $data->getLocation()
58  );
59  }
60 
61  private static function msOutlook2013Workaround(ilObjEmployeeTalk $talk): string
62  {
63 
67  global $DIC;
68  $superior = new ilObjUser($talk->getOwner());
69  $employee = new ilObjUser($talk->getData()->getEmployee());
70  $language = $DIC->language();
71  $language->loadLanguageModule('crs');
72 
73  //The string \n must not be parsed by PHP, the email / calendar clients handel the line breaks by them self
74  $description = $language->txt('title') . ': ' . $talk->getTitle() . '\n';
75  $description .= $language->txt('desc') . ': ' . $talk->getLongDescription() . '\n';
76  $description .= $language->txt('location') . ': ' . $talk->getLongDescription() . '\n';
77  $description .= $language->txt('il_orgu_superior') . ': ' . $superior->getFullname() . '\n';
78  $description .= $language->txt('il_orgu_employee') . ': ' . $employee->getFullname() . '\n';
79 
80  return $description;
81  }
82 }
getFullname(int $a_max_strlen=0)
global $DIC
Definition: feed.php:28
static getInstanceFromTalk(ilObjEmployeeTalk $talk, string $status=VEventStatus::CONFIRMED)
getLongDescription()
get object long description (stored in object_description)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...