ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilAppointmentPresentationGroupGUI.php
Go to the documentation of this file.
1 <?php
2 include_once './Services/Calendar/interfaces/interface.ilCalendarAppointmentPresentation.php';
3 include_once './Services/Calendar/classes/AppointmentPresentation/class.ilAppointmentPresentationGUI.php';
4 
15 {
16  public function collectPropertiesAndActions()
17  {
18  global $DIC;
19 
20  include_once "./Modules/Group/classes/class.ilObjGroup.php";
21 
23  $user = $DIC->user();
24 
25  $app = $this->appointment;
26 
27  $this->lng->loadLanguageModule("grp");
28 
29  $cat_info = $this->getCatInfo();
30 
31  $grp = new ilObjGroup($cat_info['obj_id'], false);
32 
33  $refs = ilObject::_getAllReferences($cat_info['obj_id']);
34  $grp_ref_id = current($refs);
35 
36  // add common section (title, description, object/calendar, location)
37  $this->addCommonSection($app, $cat_info['obj_id']);
38 
39  if ($app['event']->isAutogenerated() && $grp->getInformation()) {
40  $this->addInfoSection($this->lng->txt("cal_grp_info"));
41  $this->addInfoProperty($this->lng->txt("grp_information"), ilUtil::makeClickable(nl2br($grp->getInformation())));
42  }
43 
44  // last edited
45  $this->addLastUpdate($app);
46 
47  $this->addAction($this->lng->txt("grp_grp_open"), ilLink::_getStaticLink($grp_ref_id, "grp"));
48 
49  // register/unregister to appointment
50  if ($settings->isCGRegistrationEnabled()) {
51  if (!$app['event']->isAutoGenerated()) {
52  include_once './Services/Calendar/classes/class.ilCalendarRegistration.php';
53  $reg = new ilCalendarRegistration($app['event']->getEntryId());
54 
55  if ($reg->isRegistered($user->getId(), new ilDateTime($app['dstart'], IL_CAL_UNIX), new ilDateTime($app['dend'], IL_CAL_UNIX))) {
56  //$this->ctrl->setParameterByClass('ilcalendarappointmentgui','seed',$this->getSeed()->get(IL_CAL_DATE));
57  $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $app['event']->getEntryId());
58  $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'dstart', $app['dstart']);
59  $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'dend', $app['dend']);
60 
61  $this->addAction($this->lng->txt('cal_reg_unregister'), $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'confirmUnregister'));
62  } else {
63  //$this->ctrl->setParameterByClass('ilcalendarappointmentgui','seed',$this->getSeed()->get(IL_CAL_DATE));
64  $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $app['event']->getEntryId());
65  $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'dstart', $app['dstart']);
66  $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'dend', $app['dend']);
67 
68  $this->addAction($this->lng->txt('cal_reg_register'), $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'confirmRegister'));
69  }
70  $registered = $reg->getRegisteredUsers(
71  new \ilDateTime($app['dstart'], IL_CAL_UNIX),
72  new \ilDateTime($app['dend'], IL_CAL_UNIX)
73  );
74 
75  $users = "";
76  foreach ($registered as $user) {
77  $users .= $this->getUserName($user) . '<br />';
78  }
79  if ($users != "") {
80  $this->addInfoProperty($this->lng->txt("cal_reg_registered_users"), $users);
81  }
82  }
83  }
84  }
85 }
addInfoProperty($a_txt, $a_val)
Add info property.
static _getInstance()
get singleton instance
getUserName($a_user_id, $a_force_name=false)
Get (linked if possible) user name.
global $DIC
Definition: saml.php:7
const IL_CAL_UNIX
static _getAllReferences($a_id)
get all reference ids of object
addCommonSection($a_app, $a_obj_id=0, $cat_info=null, $a_container_info=false)
Add common section.
static makeClickable($a_text, $detectGotoLinks=false)
makeClickable In Texten enthaltene URLs und Mail-Adressen klickbar machen
registration for calendar appointments
Date and time handling
$user
Definition: migrateto20.php:57
$users
Definition: authpage.php:44
Class ilObjGroup.