/**
  * Determine status
  *
  * @param	integer		object id
  * @param	integer		user id
  * @param	object		object (optional depends on object type)
  * @return	integer		status
  */
 function determineStatus($a_obj_id, $a_user_id, $a_obj = null)
 {
     global $ilObjDataCache, $ilDB;
     $status = LP_STATUS_NOT_ATTEMPTED_NUM;
     switch ($ilObjDataCache->lookupType($a_obj_id)) {
         case 'sess':
             include_once './Modules/Session/classes/class.ilEventParticipants.php';
             include_once './Modules/Session/classes/class.ilSessionAppointment.php';
             include_once './Modules/Session/classes/class.ilObjSession.php';
             $time_info = ilSessionAppointment::_lookupAppointment($a_obj_id);
             $registration = ilObjSession::_lookupRegistrationEnabled($a_obj_id);
             // If registration is disabled in_progress is not available
             // If event has occured in_progress is impossible
             if ($registration && $time_info['start'] >= time()) {
                 // is user registered -> in progress
                 if (ilEventParticipants::_isRegistered($a_user_id, $a_obj_id)) {
                     $status = LP_STATUS_IN_PROGRESS_NUM;
                 }
             }
             if (ilEventParticipants::_hasParticipated($a_user_id, $a_obj_id)) {
                 $status = LP_STATUS_COMPLETED_NUM;
             }
             break;
     }
     return $status;
 }
 /**
  * info screen
  *
  * @access protected
  * @param
  * @return
  */
 public function infoScreen()
 {
     global $ilAccess, $ilUser, $ilCtrl, $tree, $ilToolbar;
     $this->checkPermission('visible');
     $this->tabs_gui->setTabActive('info_short');
     $appointment_obj = $this->object->getFirstAppointment();
     include_once "./Services/InfoScreen/classes/class.ilInfoScreenGUI.php";
     $info = new ilInfoScreenGUI($this);
     if ($this->object->enabledRegistration()) {
         include_once './Modules/Session/classes/class.ilEventParticipants.php';
         if (ilEventParticipants::_isRegistered($ilUser->getId(), $this->object->getId())) {
             $ilToolbar->addFormButton($this->lng->txt('event_unregister'), 'join');
         } else {
             if (!isset($_SESSION['sess_hide_info'])) {
                 ilUtil::sendInfo($this->lng->txt('sess_join_info'));
             }
             $ilToolbar->addFormButton($this->lng->txt('join_session'), 'join', '', true);
         }
         $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
     }
     // Session information
     if (strlen($this->object->getLocation()) or strlen($this->object->getDetails())) {
         $info->addSection($this->lng->txt('event_section_information'));
     }
     if (strlen($location = $this->object->getLocation())) {
         $info->addProperty($this->lng->txt('event_location'), nl2br($this->object->getLocation()));
     }
     if (strlen($this->object->getDetails())) {
         $info->addProperty($this->lng->txt('event_details_workflow'), nl2br($this->object->getDetails()));
     }
     // Tutor information
     if ($this->object->hasTutorSettings()) {
         $info->addSection($this->lng->txt('event_tutor_data'));
         if (strlen($fullname = $this->object->getName())) {
             $info->addProperty($this->lng->txt('event_lecturer'), $fullname);
         }
         if (strlen($email = $this->object->getEmail())) {
             $info->addProperty($this->lng->txt('tutor_email'), $email);
         }
         if (strlen($phone = $this->object->getPhone())) {
             $info->addProperty($this->lng->txt('tutor_phone'), $phone);
         }
     }
     $html = '';
     include_once './Services/Object/classes/class.ilObjectActivation.php';
     include_once './Services/Container/classes/class.ilContainerSorting.php';
     include_once './Modules/Session/classes/class.ilSessionObjectListGUIFactory.php';
     $eventItems = ilObjectActivation::getItemsByEvent($this->object->getId());
     $parent_id = $tree->getParentId($this->object->getRefId());
     $parent_id = ilObject::_lookupObjId($parent_id);
     $eventItems = ilContainerSorting::_getInstance($parent_id)->sortSubItems('sess', $this->object->getId(), $eventItems);
     foreach ($eventItems as $item) {
         $list_gui = ilSessionObjectListGUIFactory::factory($item['type']);
         $list_gui->setContainerObject($this);
         $this->modifyItemGUI($list_gui, $item, false);
         $html .= $list_gui->getListItemHTML($item['ref_id'], $item['obj_id'], $item['title'], $item['description']);
     }
     if (strlen($html)) {
         $info->addSection($this->lng->txt('event_materials'));
         $info->addProperty(' ', $html);
     }
     // forward the command
     $this->ctrl->forwardCommand($info);
     // store read event
     require_once 'Services/Tracking/classes/class.ilChangeEvent.php';
     ilChangeEvent::_recordReadEvent($this->object->getType(), $this->object->getRefId(), $this->object->getId(), $ilUser->getId());
 }
Esempio n. 3
0
 /**
  * show join request
  */
 protected function showJoinRequestButton()
 {
     global $ilToolbar, $ilUser;
     if (!$this->getCurrentObject()->enabledRegistration() || $ilUser->isAnonymous()) {
         return FALSE;
     }
     include_once './Modules/Session/classes/class.ilSessionWaitingList.php';
     include_once './Services/Membership/classes/class.ilParticipants.php';
     $part = ilParticipants::getInstanceByObjId($this->getCurrentObject()->getId());
     include_once './Modules/Session/classes/class.ilEventParticipants.php';
     if (ilEventParticipants::_isRegistered($ilUser->getId(), $this->getCurrentObject()->getId())) {
         $ilToolbar->addFormButton($this->lng->txt('event_unregister'), 'unregister');
         $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
         return TRUE;
     } elseif ($part->isSubscriber($ilUser->getId())) {
         $ilToolbar->addFormButton($this->lng->txt('event_unregister'), 'unregister');
         $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
         return TRUE;
     } elseif (ilSessionWaitingList::_isOnList($ilUser->getId(), $this->getCurrentObject()->getId())) {
         $ilToolbar->addFormButton($this->lng->txt('leave_waiting_list'), 'unregister');
         $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
         return TRUE;
     }
     $event_part = new ilEventParticipants($this->getCurrentObject()->getId());
     if ($this->getCurrentObject()->isRegistrationUserLimitEnabled() and $this->getCurrentObject()->getRegistrationMaxUsers() and count($event_part->getRegistered()) >= $this->getCurrentObject()->getRegistrationMaxUsers()) {
         if ($this->getCurrentObject()->isRegistrationWaitingListEnabled()) {
             ilUtil::sendInfo($this->lng->txt('sess_reg_max_users_exceeded_wl'));
             $ilToolbar->addFormButton($this->lng->txt('mem_add_to_wl'), 'register');
             $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
             return TRUE;
         } else {
             ilUtil::sendInfo($this->lng->txt('sess_reg_max_users_exceeded'));
             return TRUE;
         }
     } else {
         if (!isset($_SESSION['sess_hide_info'])) {
             ilUtil::sendInfo($this->lng->txt('sess_join_info'));
             $ilToolbar->addFormButton($this->lng->txt('join_session'), 'register', '', true);
             $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
             return TRUE;
         }
     }
 }
 /**
  * update participants
  *
  * @access public
  * @param
  * @return
  */
 public function updateMembersObject()
 {
     global $tree;
     $this->checkPermission('write');
     $this->initContainer();
     $_POST['participants'] = is_array($_POST['participants']) ? $_POST['participants'] : array();
     include_once 'Modules/Session/classes/class.ilEventParticipants.php';
     $visible = $_POST['visible_participants'] ? $_POST['visible_participants'] : array();
     foreach ($visible as $user) {
         $part = new ilEventParticipants($this->object->getId());
         $part->setUserId($user);
         $part->setMark(ilUtil::stripSlashes($_POST['mark'][$user]));
         $part->setComment(ilUtil::stripSlashes($_POST['comment'][$user]));
         $part->setParticipated(isset($_POST['participants'][$user]) ? true : false);
         $part->setRegistered(ilEventParticipants::_isRegistered($user, $this->object->getId()));
         $part->updateUser();
     }
     ilUtil::sendSuccess($this->lng->txt('settings_saved'));
     $this->membersObject();
 }
 /**
  * Static function to check if a user is a participant of the container object
  *
  * @access public
  * @param int ref_id
  * @param int user id
  * @static
  */
 public static function _isParticipant($a_ref_id, $a_usr_id)
 {
     $obj_id = ilObject::_lookupObjId($a_ref_id);
     return ilEventParticipants::_isRegistered($a_usr_id, $obj_id);
 }