ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilAppointmentPresentationCourseGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilAppointmentPresentationCourseGUI:
+ Collaboration diagram for ilAppointmentPresentationCourseGUI:

Public Member Functions

 collectPropertiesAndActions ()
 
- Public Member Functions inherited from ilAppointmentPresentationGUI
 __construct (array $a_appointment, ?ilInfoScreenGUI $a_info_screen, ?ilToolbarGUI $a_toolbar, ?Item $a_list_item)
 
 getObjIdForAppointment ()
 
 getToolbar ()
 
 getListItem ()
 Get list item. More...
 
 getInfoScreen ()
 
 getCatId (int $a_entry_id)
 
 getCatInfo ()
 
 executeCommand ()
 
 getHTML ()
 
 addContainerInfo (int $a_obj_id)
 Add course/group container info. More...
 
 addInfoSection (string $a_txt)
 Add info section. More...
 
 addInfoProperty (string $a_txt, string $a_val)
 Add info property. More...
 
 addListItemProperty (string $a_txt, string $a_val)
 Add list item property. More...
 
 addAction (string $a_txt, string $a_link)
 Add action. More...
 
 collectPropertiesAndActions ()
 Collect properties and actions. More...
 
 collectStandardPropertiesAndActions ()
 Collect standard properties and actions. More...
 
 addObjectLinks (int $obj_id, ?array $a_appointment=null)
 Add object link. More...
 
 getReadableRefIds (int $a_obj_id)
 
 addEventDescription (array $a_app)
 Add event description. More...
 
 addEventLocation (array $a_app)
 Add event location. More...
 
 addLastUpdate (array $a_app)
 Add last update. More...
 
 addCalendarInfo (array $cat_info)
 
 addCommonSection (array $a_app, int $a_obj_id=0, ?array $cat_info=null, bool $a_container_info=false)
 
 addMetaData (string $a_obj_type, int $a_obj_id, ?string $a_sub_obj_type=null, ?int $a_sub_obj_id=null)
 
 getUserName (int $a_user_id, bool $a_force_name=false)
 Get (linked if possible) user name. More...
 
 downloadFiles ()
 Download files from an appointment ( Modals ) More...
 

Additional Inherited Members

- Static Public Member Functions inherited from ilAppointmentPresentationGUI
static getInstance (array $a_appointment, ?ilInfoScreenGUI $a_info_screen, ?ilToolbarGUI $a_toolbar, ?Item $a_list_item)
 
- Protected Member Functions inherited from ilAppointmentPresentationGUI
 readObjIdForAppointment ()
 read obj_id for appointment More...
 
 buildDirectLinkForAppointment (int $a_ref_id, ?array $a_appointment=null)
 Build direct link for appointment. More...
 
- Protected Attributes inherited from ilAppointmentPresentationGUI
array $appointment
 
ilToolbarGUI $toolbar
 
ilInfoScreenGUI $infoscreen
 
ilLanguage $lng
 
ilTree $tree
 
UIServices $ui
 
ilCtrlInterface $ctrl
 
ilAccessHandler $access
 
ilRbacSystem $rbacsystem
 
ilObjUser $user
 
RefineryFactory $refinery
 
HttpServices $http
 
Item $list_item = null
 
array $info_items = []
 
array $list_properties = []
 
array $actions = []
 
array $readable_ref_ids
 
bool $has_files = false
 
int $obj_id = 0
 
- Static Protected Attributes inherited from ilAppointmentPresentationGUI
static self $instance
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning

Author
Jesús López Reyes lopez.nosp@m.@lei.nosp@m.fos.c.nosp@m.om ilAppointmentPresentationCourseGUI: ilCalendarAppointmentPresentationGUI

Definition at line 27 of file class.ilAppointmentPresentationCourseGUI.php.

Member Function Documentation

◆ collectPropertiesAndActions()

ilAppointmentPresentationCourseGUI::collectPropertiesAndActions ( )

Definition at line 29 of file class.ilAppointmentPresentationCourseGUI.php.

References $app, ilAppointmentPresentationGUI\$appointment, $email, $parts, ILIAS\LTI\ToolProvider\$settings, ilAppointmentPresentationGUI\$user, ilObject\_getAllReferences(), ilCalendarSettings\_getInstance(), ilLink\_getStaticLink(), ilCourseFile\_readFilesByCourse(), ilUtil\_sortIds(), ilAppointmentPresentationGUI\addAction(), ilAppointmentPresentationGUI\addCommonSection(), ilAppointmentPresentationGUI\addInfoProperty(), ilAppointmentPresentationGUI\addInfoSection(), ilAppointmentPresentationGUI\addLastUpdate(), ilAppointmentPresentationGUI\addListItemProperty(), ilAppointmentPresentationGUI\addMetaData(), ilMailFormCall\CONTEXT_KEY, ILIAS\Repository\ctrl(), ilAppointmentPresentationGUI\getCatInfo(), ilAppointmentPresentationGUI\getInfoScreen(), ilParticipants\getInstanceByObjId(), ilMailFormCall\getLinkTarget(), ilAppointmentPresentationGUI\getUserName(), ilCourseMailTemplateMemberContext\ID, IL_CAL_UNIX, ILIAS\Repository\lng(), ilUtil\makeClickable(), and ILIAS\Repository\ui().

29  : void
30  {
32  $this->lng->loadLanguageModule("crs");
33 
35 
36  $cat_info = $this->getCatInfo();
37 
38  $crs = new ilObjCourse($cat_info['obj_id'], false);
39  $files = ilCourseFile::_readFilesByCourse($cat_info['obj_id']);
40 
41  // get course ref id (this is possible, since courses only have one ref id)
42  $refs = ilObject::_getAllReferences($cat_info['obj_id']);
43  $crs_ref_id = current($refs);
44 
45  // add common section (title, description, object/calendar, location)
46  $this->addCommonSection($app, $cat_info['obj_id']);
47 
48  //count number of files
49  if (count($files)) {
50  $this->has_files = true;
51  }
52  // add specific section only if the event is autogenerated.
53  if ($app['event']->isAutoGenerated()) {
54  $this->addInfoSection($this->lng->txt("cal_crs_info"));
55 
56  if ($crs->getImportantInformation()) {
57  $this->addInfoProperty(
58  $this->lng->txt("crs_important_info"),
59  ilUtil::makeClickable(nl2br($crs->getImportantInformation()))
60  );
61  }
62 
63  if ($crs->getSyllabus()) {
64  $this->addInfoProperty(
65  $this->lng->txt("crs_syllabus"),
66  ilUtil::makeClickable(nl2br($crs->getSyllabus()))
67  );
68  }
69 
70  if ($this->has_files) {
71  $links = array();
72  foreach ($files as $file) {
73  $this->ctrl->setParameter($this, 'file_id', $file->getFileId());
74  $this->ctrl->setParameterByClass('ilobjcoursegui', 'file_id', $file->getFileId());
75  $this->ctrl->setParameterByClass('ilobjcoursegui', 'ref_id', $crs_ref_id);
76 
77  $file_name = $file->getFileName();
78  $links[$file_name] = $this->ui->renderer()->render(($this->ui->factory()->button()->shy(
79  $file_name,
80  $this->ctrl->getLinkTargetByClass(array("ilRepositoryGUI", "ilobjcoursegui"), 'sendfile')
81  )));
82 
83  $this->ctrl->setParameterByClass('ilobjcoursegui', 'ref_id', '');
84  }
85  ksort($links, SORT_NATURAL | SORT_FLAG_CASE);
86 
87  $this->addInfoProperty($this->lng->txt("files"), implode("<br>", $links));
88  $this->addListItemProperty($this->lng->txt("files"), implode(", ", $links));
89  }
90 
91  // tutorial support members
92  $parts = ilParticipants::getInstanceByObjId($cat_info['obj_id']);
93  //contacts is an array of user ids.
94  $contacts = $parts->getContacts();
95  $sorted_ids = ilUtil::_sortIds($contacts, 'usr_data', 'lastname', 'usr_id');
96 
97  $names = [];
98  foreach ($sorted_ids as $usr_id) {
99  $name_presentation = $this->getUserName((int) $usr_id, true);
100  if (strlen($name_presentation)) {
101  $names[] = $name_presentation;
102  }
103  }
104  if (count($names)) {
105  $this->addInfoProperty($this->lng->txt('crs_mem_contacts'), implode('<br/>', $names));
106  $this->addListItemProperty($this->lng->txt('crs_mem_contacts'), implode('<br />', $names));
107  }
108 
109  //course contact
110  $contact_fields = false;
111  $str = "";
112  if ($crs->getContactName()) {
113  $str .= $crs->getContactName() . "<br>";
114  }
115 
116  if ($crs->getContactEmail()) {
117  //TODO: optimize this
118  //$courseGUI = new ilObjCourseGUI("", $crs_ref_id);
119  $emails = explode(",", $crs->getContactEmail());
120  foreach ($emails as $email) {
121  $email = trim($email);
122  $etpl = new ilTemplate("tpl.crs_contact_email.html", true, true, 'Modules/Course');
123  $etpl->setVariable(
124  "EMAIL_LINK",
126  $this->getInfoScreen(),
127  'showSummary',
128  array(),
129  array(
130  'type' => 'new',
131  'rcp_to' => $email,
132  //'sig' => $courseGUI->createMailSignature()
133  ),
134  array(
136  'ref_id' => $crs->getRefId(),
137  'ts' => time()
138  )
139  )
140  );
141  $etpl->setVariable("CONTACT_EMAIL", $email);
142  $str .= $etpl->get() . "<br />";
143  }
144  }
145 
146  if ($crs->getContactPhone()) {
147  $str .= $this->lng->txt("crs_contact_phone") . ": " . $crs->getContactPhone() . "<br>";
148  }
149  if ($crs->getContactResponsibility()) {
150  $str .= $crs->getContactResponsibility() . "<br>";
151  }
152  if ($crs->getContactConsultation()) {
153  $str .= $crs->getContactConsultation() . "<br>";
154  }
155 
156  if ($str != "") {
157  $this->addInfoProperty($this->lng->txt("crs_contact"), $str);
158  $this->addListItemProperty($this->lng->txt("crs_contact"), str_replace("<br>", ", ", $str));
159  }
160 
161  $this->addMetaData('crs', $cat_info['obj_id']);
162 
163  // last edited
164  $this->addLastUpdate($app);
165  }
166 
167  $this->addAction($this->lng->txt("crs_open"), ilLink::_getStaticLink($crs_ref_id, "crs"));
168 
169  // register/unregister to appointment
170  if ($settings->isCGRegistrationEnabled()) {
171  if (!$app['event']->isAutoGenerated()) {
172  $reg = new ilCalendarRegistration($app['event']->getEntryId());
173 
174  if ($reg->isRegistered(
175  $this->user->getId(),
176  new ilDateTime($app['dstart'], IL_CAL_UNIX),
177  new ilDateTime($app['dend'], IL_CAL_UNIX)
178  )) {
179  //$this->ctrl->setParameterByClass('ilcalendarappointmentgui','seed',$this->getSeed()->get(IL_CAL_DATE));
180  $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $app['event']->getEntryId());
181  $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'dstart', $app['dstart']);
182  $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'dend', $app['dend']);
183 
184  $this->addAction(
185  $this->lng->txt('cal_reg_unregister'),
186  $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'confirmUnregister')
187  );
188  } else {
189  //$this->ctrl->setParameterByClass('ilcalendarappointmentgui','seed',$this->getSeed()->get(IL_CAL_DATE));
190  $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $app['event']->getEntryId());
191  $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'dstart', $app['dstart']);
192  $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'dend', $app['dend']);
193 
194  $this->addAction(
195  $this->lng->txt('cal_reg_register'),
196  $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'confirmRegister')
197  );
198  }
199 
200  $registered = $reg->getRegisteredUsers(
201  new \ilDateTime($app['dstart'], IL_CAL_UNIX),
202  new \ilDateTime($app['dend'], IL_CAL_UNIX)
203  );
204 
205  $users = "";
206  foreach ($registered as $user) {
207  $users .= $this->getUserName($user) . '<br />';
208  }
209  if ($users != "") {
210  $this->addInfoProperty($this->lng->txt("cal_reg_registered_users"), $users);
211  }
212  }
213  }
214  }
$app
Definition: cli.php:39
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200
addListItemProperty(string $a_txt, string $a_val)
Add list item property.
if($clientAssertionType !='urn:ietf:params:oauth:client-assertion-type:jwt-bearer'|| $grantType !='client_credentials') $parts
Definition: ltitoken.php:64
static _getAllReferences(int $id)
get all reference ids for object ID
static getInstanceByObjId(int $a_obj_id)
Get instance by obj type.
static getLinkTarget( $gui, string $cmd, array $gui_params=[], array $mail_params=[], array $context_params=[])
static _readFilesByCourse(int $a_course_id)
const IL_CAL_UNIX
addInfoSection(string $a_txt)
Add info section.
addInfoProperty(string $a_txt, string $a_val)
Add info property.
addLastUpdate(array $a_app)
Add last update.
registration for calendar appointments
getUserName(int $a_user_id, bool $a_force_name=false)
Get (linked if possible) user name.
if($orgName !==null) if($spconfig->hasValue('contacts')) $email
Definition: metadata.php:302
static _sortIds(array $a_ids, string $a_table, string $a_field, string $a_id_name)
Function that sorts ids by a given table field using WHERE IN E.g: __sort(array(6,7),&#39;usr_data&#39;,&#39;lastname&#39;,&#39;usr_id&#39;) => sorts by lastname.
addCommonSection(array $a_app, int $a_obj_id=0, ?array $cat_info=null, bool $a_container_info=false)
addAction(string $a_txt, string $a_link)
Add action.
addMetaData(string $a_obj_type, int $a_obj_id, ?string $a_sub_obj_type=null, ?int $a_sub_obj_id=null)
static makeClickable(string $a_text, bool $detectGotoLinks=false)
+ Here is the call graph for this function:

The documentation for this class was generated from the following file: