protected function availabilityToString() { switch ($this->object->getAvailabilityType()) { case ilObjRemoteTest::ACTIVATION_OFFLINE: return $this->lng->txt('offline'); case ilObjRemoteTest::ACTIVATION_UNLIMITED: return $this->lng->txt('grp_unlimited'); case ilObjRemoteTest::ACTIVATION_LIMITED: return ilDatePresentation::formatPeriod(new ilDateTime($this->object->getStartingTime(), IL_CAL_UNIX), new ilDateTime($this->object->getEndingTime(), IL_CAL_UNIX)); } return ''; }
/** * Parse bookings * @param int $a_groupid * @param ilDate $start * @param ilDate $end * * throws ilViteroConnectionException */ public function parse($a_groupid, ilDateTime $start, ilDateTime $end) { $booking_list = array(); try { $con = new ilViteroBookingSoapConnector(); $bookings = $con->getByGroupAndDate($a_groupid, $start, $end); } catch (Exception $e) { throw $e; } $booking_arr = array(); if (is_object($bookings->booking)) { $booking_arr = array($bookings->booking); } elseif (is_array($bookings->booking)) { $booking_arr = $bookings->booking; } $counter = 0; foreach ($booking_arr as $booking) { $fstart = ilViteroUtils::parseSoapDate($booking->start); $fend = ilViteroUtils::parseSoapDate($booking->end); $duration = $fend->get(IL_CAL_UNIX) - $fstart->get(IL_CAL_UNIX); foreach (ilViteroUtils::calculateBookingAppointments($start, $end, $booking) as $dl) { $booking_list[$counter]['rec'] = $booking->repetitionpattern; $booking_list[$counter]['id'] = $booking->bookingid; $booking_list[$counter]['start'] = $dl; $booking_list[$counter]['startt'] = $dl->get(IL_CAL_UNIX); $bend = clone $dl; $bend->setDate($dl->get(IL_CAL_UNIX) + $duration, IL_CAL_UNIX); $booking_list[$counter]['end'] = $bend; if ($booking->cafe) { $booking_list[$counter]['start'] = new ilDate($booking_list[$counter]['startt'], IL_CAL_UNIX); $booking_list[$counter]['time'] = ilDatePresentation::formatDate($booking_list[$counter]['start']); } else { $booking_list[$counter]['time'] = ilDatePresentation::formatPeriod($booking_list[$counter]['start'], $booking_list[$counter]['end']); } $booking_list[$counter]['duration'] = ilFormat::_secondsToString($booking_list[$counter]['end']->get(IL_CAL_UNIX) - $booking_list[$counter]['start']->get(IL_CAL_UNIX), false); if ($booking->repetitionpattern) { $repend = ilViteroUtils::parseSoapDate($booking->repetitionenddate); $booking_list[$counter]['ends'] = ilDatePresentation::formatDate(new ilDate($repend->get(IL_CAL_UNIX), IL_CAL_UNIX)); } $counter++; } } $this->setMaxCount(count($booking_list)); $this->setData($booking_list); }
/** * Prepares history table and displays it. * * @global ilTemplate $tpl * @global ilLanguage $lng * @param array $messages * @param ilPropertyFormGUI $durationForm */ private function showMessages($messages, $durationForm, $export = false, $psessions = array(), $from, $to) { //global $tpl, $ilUser, $ilCtrl, $lng; global $tpl, $lng, $ilCtrl; include_once 'Modules/Chatroom/classes/class.ilChatroom.php'; if (!ilChatroom::checkUserPermissions('read', $this->gui->ref_id)) { $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", ROOT_FOLDER_ID); $ilCtrl->redirectByClass("ilrepositorygui", ""); } $this->gui->switchToVisibleMode(); $tpl->addCSS('Modules/Chatroom/templates/default/style.css'); // should be able to grep templates if ($export) { $roomTpl = new ilTemplate('tpl.history_export.html', true, true, 'Modules/Chatroom'); } else { $roomTpl = new ilTemplate('tpl.history.html', true, true, 'Modules/Chatroom'); } $scopes = array(); if ($export) { ilDatePresentation::setUseRelativeDates(false); } global $ilUser; $time_format = $ilUser->getTimeFormat(); $prevDate = ''; $messagesShown = 0; $lastDateTime = null; foreach ($messages as $message) { $message['message']->message = json_decode($message['message']->message); switch ($message['message']->type) { case 'message': if ($_REQUEST['scope'] && $message['message']->sub == $_REQUEST['scope'] || !$_REQUEST['scope'] && !$message['message']->sub) { $date = new ilDate($message['timestamp'], IL_CAL_UNIX); $dateTime = new ilDateTime($message['timestamp'], IL_CAL_UNIX); $currentDate = ilDatePresentation::formatDate($dateTime); $roomTpl->setCurrentBlock('MESSAGELINE'); $roomTpl->setVariable('MESSAGECONTENT', $message['message']->message->content); // oops... it is a message? ^^ $roomTpl->setVariable('MESSAGESENDER', $message['message']->user->username); if (null == $lastDateTime || date('d', $lastDateTime->get(IL_CAL_UNIX)) != date('d', $dateTime->get(IL_CAL_UNIX)) || date('m', $lastDateTime->get(IL_CAL_UNIX)) != date('m', $dateTime->get(IL_CAL_UNIX)) || date('Y', $lastDateTime->get(IL_CAL_UNIX)) != date('Y', $dateTime->get(IL_CAL_UNIX))) { $roomTpl->setVariable('MESSAGEDATE', ilDatePresentation::formatDate($date)); } if ($prevDate != $currentDate) { switch ($time_format) { case ilCalendarSettings::TIME_FORMAT_24: $date_string = $dateTime->get(IL_CAL_FKT_DATE, 'H:i', $ilUser->getTimeZone()); break; case ilCalendarSettings::TIME_FORMAT_12: $date_string = $dateTime->get(IL_CAL_FKT_DATE, 'g:ia', $ilUser->getTimeZone()); break; } $roomTpl->setVariable('MESSAGETIME', $date_string); $prevDate = $currentDate; } $roomTpl->parseCurrentBlock(); $lastDateTime = $dateTime; ++$messagesShown; } break; } } foreach ($psessions as $session) { $scopes[$session['proom_id']] = $session['title']; } if (isset($scopes[''])) { unset($scopes['']); } if (!$messagesShown) { //$roomTpl->touchBlock('NO_MESSAGES'); $roomTpl->setVariable('LBL_NO_MESSAGES', $lng->txt('no_messages')); } asort($scopes, SORT_STRING); $scopes = array($lng->txt('main')) + $scopes; if (count($scopes) > 1) { $select = new ilSelectInputGUI($lng->txt('scope'), 'scope'); $select->setOptions($scopes); if (isset($_REQUEST['scope'])) { $select->setValue($_REQUEST['scope']); } $durationForm->addItem($select); } $room = ilChatroom::byObjectId($this->gui->object->getId()); //if ($room->getSetting('private_rooms_enabled')) { $prevUseRelDates = ilDatePresentation::useRelativeDates(); ilDatePresentation::setUseRelativeDates(false); $unixFrom = $from->getUnixTime(); $unixTo = $to->getUnixTime(); if ($unixFrom == $unixTo) { $date = new ilDate($unixFrom, IL_CAL_UNIX); $date_sub = ilDatePresentation::formatDate($date); } else { $date1 = new ilDate($unixFrom, IL_CAL_UNIX); $date2 = new ilDate($unixTo, IL_CAL_UNIX); $date_sub = ilDatePresentation::formatPeriod($date1, $date2); } ilDatePresentation::setUseRelativeDates($prevUseRelDates); $isPrivateRoom = (bool) (int) $_REQUEST['scope']; if ($isPrivateRoom) { $roomTpl->setVariable('ROOM_TITLE', sprintf($lng->txt('history_title_private_room'), $scopes[(int) $_REQUEST['scope']]) . ' (' . $date_sub . ')'); } else { $roomTpl->setVariable('ROOM_TITLE', sprintf($lng->txt('history_title_general'), $this->gui->object->getTitle()) . ' (' . $date_sub . ')'); } //} if ($export) { header("Content-Type: text/html"); header("Content-Disposition: attachment; filename=\"" . urlencode($scopes[(int) $_REQUEST['scope']] . '.html') . "\""); echo $roomTpl->get(); exit; } $roomTpl->setVariable('PERIOD_FORM', $durationForm->getHTML()); $tpl->setVariable('ADM_CONTENT', $roomTpl->get()); }
/** * fill row * * @access protected * @param array set of data * @return */ protected function fillRow($a_set) { global $ilUser, $lng; if ($a_set["milestone"]) { $this->tpl->setCurrentBlock("img_ms"); $this->tpl->setVariable("IMG_MS", ilUtil::getImagePath("icon_ms_s.png")); $this->tpl->setVariable("ALT_MS", $lng->txt("cal_milestone")); $this->tpl->parseCurrentBlock(); } $this->tpl->setVariable('VAL_DESCRIPTION', $a_set['description']); $this->tpl->setVariable('VAL_TITLE_LINK', $a_set['title']); $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $a_set['id']); $this->tpl->setVariable('VAL_LINK', $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'edit')); switch ($a_set['frequence']) { case IL_CAL_FREQ_DAILY: $this->tpl->setVariable('VAL_FREQUENCE', $this->lng->txt('cal_daily')); break; case IL_CAL_FREQ_WEEKLY: $this->tpl->setVariable('VAL_FREQUENCE', $this->lng->txt('cal_weekly')); break; case IL_CAL_FREQ_MONTHLY: $this->tpl->setVariable('VAL_FREQUENCE', $this->lng->txt('cal_monthly')); break; case IL_CAL_FREQ_YEARLY: $this->tpl->setVariable('VAL_FREQUENCE', $this->lng->txt('cal_yearly')); break; default: #$this->tpl->setVariable('VAL_FREQUENCE',$this->lng->txt('cal_no_recurrence')); break; } if ($a_set['fullday']) { $date = ilDatePresentation::formatPeriod(new ilDate($a_set['begin'], IL_CAL_UNIX), new ilDate($a_set['end'], IL_CAL_UNIX)); } else { $date = ilDatePresentation::formatPeriod(new ilDateTime($a_set['begin'], IL_CAL_UNIX), new ilDateTime($a_set['end'], IL_CAL_UNIX)); } $this->tpl->setVariable('VAL_BEGIN', $date); /* if($a_set['duration']) { if($a_set['milestone']) { $this->tpl->setVariable('VAL_DURATION','-'); } else { $this->tpl->setVariable('VAL_DURATION',ilFormat::_secondsToString($a_set['duration'])); } } else { $this->tpl->setVariable('VAL_DURATION',''); } */ $update = new ilDateTime($a_set['last_update'], IL_CAL_UNIX, $ilUser->getTimeZone()); $this->tpl->setVariable('VAL_LAST_UPDATE', ilDatePresentation::formatDate($update)); }
/** * Get item properties * * @return array array of property arrays: * 'alert' (boolean) => display as an alert property (usually in red) * 'property' (string) => property name * 'value' (string) => property value */ public function getProperties() { $props = array(); $this->plugin->includeClass('class.ilObjAdobeConnect.php'); $objectData = ilObjAdobeConnect::getObjectData($this->obj_id); if ($objectData->permanent_room == 1) { $props[] = array('alert' => false, 'value' => $this->plugin->txt('permanent_room')); } else { if ((int) $objectData->start_date > time() || (int) $objectData->end_date < time()) { $props[] = array('alert' => false, 'value' => $this->plugin->txt('meeting_not_available')); } else { $props[] = array('alert' => false, 'property' => $this->txt('start_date'), 'value' => ilDatePresentation::formatDate(new ilDateTime($objectData->start_date, IL_CAL_UNIX))); $props[] = array('alert' => false, 'property' => $this->txt('duration'), 'value' => ilDatePresentation::formatPeriod(new ilDateTime($objectData->start_date, IL_CAL_UNIX), new ilDateTime($objectData->end_date, IL_CAL_UNIX))); } } return $props; }
/** * Init attendance list object * * @return ilAttendanceList */ protected function initAttendanceList() { $members_obj = $this->initContainer(true); include_once 'Services/Membership/classes/class.ilAttendanceList.php'; $list = new ilAttendanceList($this, $members_obj); $list->setId('sessattlst'); $event_app = $this->object->getFirstAppointment(); ilDatePresentation::setUseRelativeDates(false); $desc = ilDatePresentation::formatPeriod($event_app->getStart(), $event_app->getEnd()); ilDatePresentation::setUseRelativeDates(true); $desc .= " " . $this->object->getTitle(); $list->setTitle($this->lng->txt('sess_attendance_list'), $desc); $list->addPreset('mark', $this->lng->txt('trac_mark'), true); $list->addPreset('comment', $this->lng->txt('trac_comment'), true); if ($this->object->enabledRegistration()) { $list->addPreset('registered', $this->lng->txt('event_tbl_registered'), true); } $list->addPreset('participated', $this->lng->txt('event_tbl_participated'), true); $list->addBlank($this->lng->txt('sess_signature')); $list->addUserFilter('registered', $this->lng->txt('event_list_registered_only')); return $list; }
/** * fill row * * @access public * @param * @return */ public function fillRow($a_set) { global $ilAccess; $this->tpl->setVariable('VAL_ID', $a_set['usr_id']); $this->tpl->setVariable('VAL_NAME', $a_set['lastname'] . ', ' . $a_set['firstname']); if (!$ilAccess->checkAccessOfUser($a_set['usr_id'], 'read', '', $this->getParentObject()->object->getRefId()) and is_array($info = $ilAccess->getInfo())) { $this->tpl->setCurrentBlock('access_warning'); $this->tpl->setVariable('PARENT_ACCESS', $info[0]['text']); $this->tpl->parseCurrentBlock(); } if (!ilObjUser::_lookupActive($a_set['usr_id'])) { $this->tpl->setCurrentBlock('access_warning'); $this->tpl->setVariable('PARENT_ACCESS', $this->lng->txt('usr_account_inactive')); $this->tpl->parseCurrentBlock(); } foreach ($this->getSelectedColumns() as $field) { switch ($field) { case 'gender': $a_set['gender'] = $a_set['gender'] ? $this->lng->txt('gender_' . $a_set['gender']) : ''; $this->tpl->setCurrentBlock('custom_fields'); $this->tpl->setVariable('VAL_CUST', $a_set[$field]); $this->tpl->parseCurrentBlock(); break; case 'birthday': $a_set['birthday'] = $a_set['birthday'] ? ilDatePresentation::formatDate(new ilDate($a_set['birthday'], IL_CAL_DATE)) : $this->lng->txt('no_date'); $this->tpl->setCurrentBlock('custom_fields'); $this->tpl->setVariable('VAL_CUST', $a_set[$field]); $this->tpl->parseCurrentBlock(); break; case 'consultation_hour': $this->tpl->setCurrentBlock('custom_fields'); $dts = array(); foreach ((array) $a_set['consultation_hours'] as $ch) { $tmp = ilDatePresentation::formatPeriod(new ilDateTime($ch['dt'], IL_CAL_UNIX), new ilDateTime($ch['dtend'], IL_CAL_UNIX)); if ($ch['explanation']) { $tmp .= ' ' . $ch['explanation']; } $dts[] = $tmp; } $dt_string = implode('<br />', $dts); $this->tpl->setVariable('VAL_CUST', $dt_string); $this->tpl->parseCurrentBlock(); break; case 'prtf': $tmp = array(); if (is_array($a_set['prtf'])) { foreach ($a_set['prtf'] as $prtf_url => $prtf_txt) { $tmp[] = '<a href="' . $prtf_url . '">' . $prtf_txt . '</a>'; } } $this->tpl->setVariable('VAL_CUST', implode('<br />', $tmp)); break; case 'odf_last_update': $this->tpl->setVariable('VAL_EDIT_INFO', (string) $a_set['odf_info_txt']); break; default: $this->tpl->setCurrentBlock('custom_fields'); $this->tpl->setVariable('VAL_CUST', isset($a_set[$field]) ? (string) $a_set[$field] : ''); $this->tpl->parseCurrentBlock(); break; } } if ($this->privacy->enabledCourseAccessTimes()) { $this->tpl->setVariable('VAL_ACCESS', $a_set['access_time']); } if ($this->show_learning_progress) { $this->tpl->setCurrentBlock('lp'); switch ($a_set['progress']) { case ilLPStatus::LP_STATUS_COMPLETED: $this->tpl->setVariable('LP_STATUS_ALT', $this->lng->txt($a_set['progress'])); $this->tpl->setVariable('LP_STATUS_PATH', ilUtil::getImagePath('scorm/complete.svg')); break; case ilLPStatus::LP_STATUS_IN_PROGRESS: $this->tpl->setVariable('LP_STATUS_ALT', $this->lng->txt($a_set['progress'])); $this->tpl->setVariable('LP_STATUS_PATH', ilUtil::getImagePath('scorm/incomplete.svg')); break; case ilLPStatus::LP_STATUS_NOT_ATTEMPTED: $this->tpl->setVariable('LP_STATUS_ALT', $this->lng->txt($a_set['progress'])); $this->tpl->setVariable('LP_STATUS_PATH', ilUtil::getImagePath('scorm/not_attempted.svg')); break; case ilLPStatus::LP_STATUS_FAILED: $this->tpl->setVariable('LP_STATUS_ALT', $this->lng->txt($a_set['progress'])); $this->tpl->setVariable('LP_STATUS_PATH', ilUtil::getImagePath('scorm/failed.svg')); break; } $this->tpl->parseCurrentBlock(); } if ($this->type == 'admin') { $this->tpl->setVariable('VAL_POSTNAME', 'admins'); $this->tpl->setVariable('VAL_NOTIFICATION_ID', $a_set['usr_id']); $this->tpl->setVariable('VAL_NOTIFICATION_CHECKED', $a_set['notification'] ? 'checked="checked"' : ''); } elseif ($this->type == 'tutor') { $this->tpl->setVariable('VAL_POSTNAME', 'tutors'); $this->tpl->setVariable('VAL_NOTIFICATION_ID', $a_set['usr_id']); $this->tpl->setVariable('VAL_NOTIFICATION_CHECKED', $a_set['notification'] ? 'checked="checked"' : ''); } elseif ($this->type == 'member') { $this->tpl->setCurrentBlock('blocked'); $this->tpl->setVariable('VAL_POSTNAME', 'members'); $this->tpl->setVariable('VAL_BLOCKED_ID', $a_set['usr_id']); $this->tpl->setVariable('VAL_BLOCKED_CHECKED', $a_set['blocked'] ? 'checked="checked"' : ''); $this->tpl->parseCurrentBlock(); } else { $this->tpl->setCurrentBlock('blocked'); $this->tpl->setVariable('VAL_BLOCKED_ID', $a_set['usr_id']); $this->tpl->setVariable('VAL_BLOCKED_CHECKED', $a_set['blocked'] ? 'checked="checked"' : ''); $this->tpl->parseCurrentBlock(); $this->tpl->setVariable('VAL_POSTNAME', 'roles'); } $this->tpl->setVariable('VAL_PASSED_ID', $a_set['usr_id']); $this->tpl->setVariable('VAL_PASSED_CHECKED', $a_set['passed'] ? 'checked="checked"' : ''); if ($this->show_lp_status_sync) { $this->tpl->setVariable('PASSED_INFO', $a_set["passed_info"]); } $this->showActionLinks($a_set); if ($a_set['passed'] && $this->enable_certificates) { $this->tpl->setCurrentBlock('link'); $this->tpl->setVariable('LINK_NAME', $this->ctrl->getLinkTarget($this->parent_obj, 'deliverCertificate')); $this->tpl->setVariable('LINK_TXT', $this->lng->txt('download_certificate')); $this->tpl->parseCurrentBlock(); } $this->ctrl->clearParameters($this->parent_obj); if ($this->show_timings) { $this->ctrl->setParameterByClass('ilcoursecontentgui', 'member_id', $a_set['usr_id']); $this->tpl->setCurrentBlock('link'); $this->tpl->setVariable('LINK_NAME', $this->ctrl->getLinkTargetByClass('ilcoursecontentgui', 'showUserTimings')); $this->tpl->setVariable('LINK_TXT', $this->lng->txt('timings_timings')); $this->tpl->parseCurrentBlock(); } }
/** * show information screen */ function infoScreen() { global $ilErr, $ilAccess, $ilUser, $ilSetting; $this->checkPermission('visible'); // Fill meta header tags include_once 'Services/MetaData/classes/class.ilMDUtils.php'; ilMDUtils::_fillHTMLMetaTags($this->object->getId(), $this->object->getId(), 'crs'); $this->tabs_gui->setTabActive('info_short'); include_once "./Services/InfoScreen/classes/class.ilInfoScreenGUI.php"; include_once 'Modules/Course/classes/class.ilCourseFile.php'; $files =& ilCourseFile::_readFilesByCourse($this->object->getId()); $info = new ilInfoScreenGUI($this); $info->enablePrivateNotes(); $info->enableFeedback(); $info->enableNews(); if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) { $info->enableNewsEditing(); } if (strlen($this->object->getImportantInformation()) or strlen($this->object->getSyllabus()) or count($files)) { $info->addSection($this->lng->txt('crs_general_informations')); } if (strlen($this->object->getImportantInformation())) { $info->addProperty($this->lng->txt('crs_important_info'), "<strong>" . nl2br(ilUtil::makeClickable($this->object->getImportantInformation(), true) . "</strong>")); } if (strlen($this->object->getSyllabus())) { $info->addProperty($this->lng->txt('crs_syllabus'), nl2br(ilUtil::makeClickable($this->object->getSyllabus(), true))); } // files if (count($files)) { $tpl = new ilTemplate('tpl.event_info_file.html', true, true, 'Modules/Course'); foreach ($files as $file) { $tpl->setCurrentBlock("files"); $this->ctrl->setParameter($this, 'file_id', $file->getFileId()); $tpl->setVariable("DOWN_LINK", $this->ctrl->getLinkTarget($this, 'sendfile')); $tpl->setVariable("DOWN_NAME", $file->getFileName()); $tpl->setVariable("DOWN_INFO_TXT", $this->lng->txt('crs_file_size_info')); $tpl->setVariable("DOWN_SIZE", $file->getFileSize()); $tpl->setVariable("TXT_BYTES", $this->lng->txt('bytes')); $tpl->parseCurrentBlock(); } $info->addProperty($this->lng->txt('crs_file_download'), $tpl->get()); } include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php'; $record_gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_INFO, 'crs', $this->object->getId()); $record_gui->setInfoObject($info); $record_gui->parse(); // meta data $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType()); // contact if ($this->object->hasContactData()) { $info->addSection($this->lng->txt("crs_contact")); } if (strlen($this->object->getContactName())) { $info->addProperty($this->lng->txt("crs_contact_name"), $this->object->getContactName()); } if (strlen($this->object->getContactResponsibility())) { $info->addProperty($this->lng->txt("crs_contact_responsibility"), $this->object->getContactResponsibility()); } if (strlen($this->object->getContactPhone())) { $info->addProperty($this->lng->txt("crs_contact_phone"), $this->object->getContactPhone()); } if ($this->object->getContactEmail()) { require_once 'Services/Mail/classes/class.ilMailFormCall.php'; $emails = split(",", $this->object->getContactEmail()); foreach ($emails as $email) { $email = trim($email); $etpl = new ilTemplate("tpl.crs_contact_email.html", true, true, 'Modules/Course'); $etpl->setVariable("EMAIL_LINK", ilMailFormCall::getLinkTarget($info, 'showSummary', array(), array('type' => 'new', 'rcp_to' => $email, 'sig' => $this->createMailSignature()))); $etpl->setVariable("CONTACT_EMAIL", $email); $mailString .= $etpl->get() . "<br />"; } $info->addProperty($this->lng->txt("crs_contact_email"), $mailString); } if (strlen($this->object->getContactConsultation())) { $info->addProperty($this->lng->txt("crs_contact_consultation"), nl2br($this->object->getContactConsultation())); } // // access // // #10360 $this->lng->loadLanguageModule("rep"); $info->addSection($this->lng->txt("rep_activation_availability")); $info->showLDAPRoleGroupMappingInfo(); // activation if ($this->object->getActivationUnlimitedStatus()) { $info->addProperty($this->lng->txt("rep_activation_access"), $this->lng->txt('crs_visibility_limitless')); } else { $info->addProperty($this->lng->txt('rep_activation_access'), ilDatePresentation::formatPeriod(new ilDateTime($this->object->getActivationStart(), IL_CAL_UNIX), new ilDateTime($this->object->getActivationEnd(), IL_CAL_UNIX))); } switch ($this->object->getSubscriptionLimitationType()) { case IL_CRS_SUBSCRIPTION_DEACTIVATED: $txt = $this->lng->txt("crs_info_reg_deactivated"); break; default: switch ($this->object->getSubscriptionType()) { case IL_CRS_SUBSCRIPTION_CONFIRMATION: $txt = $this->lng->txt("crs_info_reg_confirmation"); break; case IL_CRS_SUBSCRIPTION_DIRECT: $txt = $this->lng->txt("crs_info_reg_direct"); break; case IL_CRS_SUBSCRIPTION_PASSWORD: $txt = $this->lng->txt("crs_info_reg_password"); break; } } // subscription $info->addProperty($this->lng->txt("crs_info_reg"), $txt); if ($this->object->getSubscriptionLimitationType() != IL_CRS_SUBSCRIPTION_DEACTIVATED) { if ($this->object->getSubscriptionUnlimitedStatus()) { $info->addProperty($this->lng->txt("crs_reg_until"), $this->lng->txt('crs_unlimited')); } elseif ($this->object->getSubscriptionStart() < time()) { $info->addProperty($this->lng->txt("crs_reg_until"), $this->lng->txt('crs_to') . ' ' . ilDatePresentation::formatDate(new ilDateTime($this->object->getSubscriptionEnd(), IL_CAL_UNIX))); } elseif ($this->object->getSubscriptionStart() > time()) { $info->addProperty($this->lng->txt("crs_reg_until"), $this->lng->txt('crs_from') . ' ' . ilDatePresentation::formatDate(new ilDateTime($this->object->getSubscriptionStart(), IL_CAL_UNIX))); } if ($this->object->isSubscriptionMembershipLimited()) { include_once './Services/Membership/classes/class.ilParticipants.php'; $info->addProperty($this->lng->txt("mem_free_places"), max(0, $this->object->getSubscriptionMaxMembers() - ilParticipants::lookupNumberOfMembers($this->object->getRefId()))); } } // archive if ($this->object->getViewMode() == IL_CRS_VIEW_ARCHIVE) { if ($this->object->getArchiveType() != IL_CRS_ARCHIVE_NONE) { $info->addProperty($this->lng->txt("crs_archive"), ilDatePresentation::formatPeriod(new ilDateTime($this->object->getArchiveStart(), IL_CAL_UNIX), new ilDateTime($this->object->getArchiveStart(), IL_CAL_UNIX))); } } // Confirmation include_once 'Services/PrivacySecurity/classes/class.ilPrivacySettings.php'; $privacy = ilPrivacySettings::_getInstance(); include_once 'Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php'; if ($privacy->courseConfirmationRequired() or ilCourseDefinedFieldDefinition::_getFields($this->object->getId()) or $privacy->enabledCourseExport()) { include_once 'Services/PrivacySecurity/classes/class.ilExportFieldsInfo.php'; $field_info = ilExportFieldsInfo::_getInstanceByType($this->object->getType()); $this->lng->loadLanguageModule('ps'); $info->addSection($this->lng->txt('crs_user_agreement_info')); $info->addProperty($this->lng->txt('ps_export_data'), $field_info->exportableFieldsToInfoString()); if ($fields = ilCourseDefinedFieldDefinition::_fieldsToInfoString($this->object->getId())) { $info->addProperty($this->lng->txt('ps_crs_user_fields'), $fields); } } $info->enableLearningProgress(true); // forward the command $this->ctrl->forwardCommand($info); }
public function infoScreen() { global $tpl; $this->pluginObj->includeClass('class.ilAdobeConnectUserUtil.php'); $this->pluginObj->includeClass('class.ilAdobeConnectServer.php'); $this->pluginObj->includeClass('class.ilAdobeConnectQuota.php'); $this->pluginObj->includeClass("class.ilObjAdobeConnectAccess.php"); $settings = ilAdobeConnectServer::_getInstance(); $this->tabs->setTabActive('info_short'); include_once "./Services/InfoScreen/classes/class.ilInfoScreenGUI.php"; $info = new ilInfoScreenGUI($this); $info->removeFormAction(); $info->addSection($this->pluginObj->txt('general')); if ($this->object->getPermanentRoom() == 1 && ilAdobeConnectServer::getSetting('enable_perm_room', '1')) { $duration_text = $this->pluginObj->txt('permanent_room'); } else { $duration_text = ilDatePresentation::formatPeriod(new ilDateTime($this->object->getStartDate()->getUnixTime(), IL_CAL_UNIX), new ilDateTime($this->object->getEndDate()->getUnixTime(), IL_CAL_UNIX)); } $presentation_url = $settings->getPresentationUrl(); $form = new ilPropertyFormGUI(); $form->setTitle($this->pluginObj->txt('access_meeting_title')); $this->object->doRead(); if ($this->object->getStartDate() != NULL) { $ilAdobeConnectUser = new ilAdobeConnectUserUtil($this->user->getId()); $ilAdobeConnectUser->ensureAccountExistance(); $xavc_login = $ilAdobeConnectUser->getXAVCLogin(); $quota = new ilAdobeConnectQuota(); } // show link if (($this->object->getPermanentRoom() == 1 || $this->doProvideAccessLink()) && $this->object->isParticipant($xavc_login)) { if (!$quota->mayStartScheduledMeeting($this->object->getScoId())) { $href = $this->txt("meeting_not_available_no_slots"); } else { $href = '<a href="' . $this->ctrl->getLinkTarget($this, 'performSso') . '" target="_blank" >' . $presentation_url . $this->object->getURL() . '</a>'; } } else { $href = $this->txt("meeting_not_available"); } $info->addProperty($this->pluginObj->txt('duration'), $duration_text); $info->addProperty($this->pluginObj->txt('meeting_url'), $href); $tpl->setContent($info->getHTML() . $this->getPerformTriggerHtml()); }
function replacePlaceholders($a_string, &$a_user, $a_amail, $a_lang) { global $ilSetting, $tree; // determine salutation switch ($a_user->getGender()) { case "f": $gender_salut = $a_amail["sal_f"]; break; case "m": $gender_salut = $a_amail["sal_m"]; break; default: $gender_salut = $a_amail["sal_g"]; } $gender_salut = trim($gender_salut); $a_string = str_replace("[MAIL_SALUTATION]", $gender_salut, $a_string); $a_string = str_replace("[LOGIN]", $a_user->getLogin(), $a_string); $a_string = str_replace("[FIRST_NAME]", $a_user->getFirstname(), $a_string); $a_string = str_replace("[LAST_NAME]", $a_user->getLastname(), $a_string); // BEGIN Mail Include E-Mail Address in account mail $a_string = str_replace("[EMAIL]", $a_user->getEmail(), $a_string); // END Mail Include E-Mail Address in account mail $a_string = str_replace("[PASSWORD]", $this->getUserPassword(), $a_string); $a_string = str_replace("[ILIAS_URL]", ILIAS_HTTP_PATH . "/login.php?client_id=" . CLIENT_ID, $a_string); $a_string = str_replace("[CLIENT_NAME]", CLIENT_NAME, $a_string); $a_string = str_replace("[ADMIN_MAIL]", $ilSetting->get("admin_email"), $a_string); // (no) password sections if ($this->getUserPassword() == "") { // #12232 $a_string = preg_replace("/\\[IF_PASSWORD\\].*\\[\\/IF_PASSWORD\\]/imsU", "", $a_string); $a_string = preg_replace("/\\[IF_NO_PASSWORD\\](.*)\\[\\/IF_NO_PASSWORD\\]/imsU", "\$1", $a_string); } else { $a_string = preg_replace("/\\[IF_NO_PASSWORD\\].*\\[\\/IF_NO_PASSWORD\\]/imsU", "", $a_string); $a_string = preg_replace("/\\[IF_PASSWORD\\](.*)\\[\\/IF_PASSWORD\\]/imsU", "\$1", $a_string); } // #13346 if (!$a_user->getTimeLimitUnlimited()) { // #6098 $a_string = preg_replace("/\\[IF_TIMELIMIT\\](.*)\\[\\/IF_TIMELIMIT\\]/imsU", "\$1", $a_string); $timelimit_from = new ilDateTime($a_user->getTimeLimitFrom(), IL_CAL_UNIX); $timelimit_until = new ilDateTime($a_user->getTimeLimitUntil(), IL_CAL_UNIX); $timelimit = ilDatePresentation::formatPeriod($timelimit_from, $timelimit_until); $a_string = str_replace("[TIMELIMIT]", $timelimit, $a_string); } else { $a_string = preg_replace("/\\[IF_TIMELIMIT\\](.*)\\[\\/IF_TIMELIMIT\\]/imsU", "", $a_string); } // target $tar = false; if ($_GET["target"] != "") { $tarr = explode("_", $_GET["target"]); if ($tree->isInTree($tarr[1])) { $obj_id = ilObject::_lookupObjId($tarr[1]); $type = ilObject::_lookupType($obj_id); if ($type == $tarr[0]) { $a_string = str_replace("[TARGET_TITLE]", ilObject::_lookupTitle($obj_id), $a_string); $a_string = str_replace("[TARGET]", ILIAS_HTTP_PATH . "/goto.php?client_id=" . CLIENT_ID . "&target=" . $_GET["target"], $a_string); // this looks complicated, but we may have no initilised $lng object here // if mail is send during user creation in authentication include_once "./Services/Language/classes/class.ilLanguage.php"; $a_string = str_replace("[TARGET_TYPE]", ilLanguage::_lookupEntry($a_lang, "common", "obj_" . $tarr[0]), $a_string); $tar = true; } } } // (no) target section if (!$tar) { $a_string = preg_replace("/\\[IF_TARGET\\].*\\[\\/IF_TARGET\\]/imsU", "", $a_string); } else { $a_string = preg_replace("/\\[IF_TARGET\\](.*)\\[\\/IF_TARGET\\]/imsU", "\$1", $a_string); } return $a_string; }
protected function initBookingNumbersForm(array $a_objects_counter, $a_group_id) { include_once 'Services/Form/classes/class.ilPropertyFormGUI.php'; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this, "confirmedBooking")); $form->setTitle($this->lng->txt("book_confirm_booking_schedule_number_of_objects")); $form->setDescription($this->lng->txt("book_confirm_booking_schedule_number_of_objects_info")); include_once 'Modules/BookingManager/classes/class.ilBookingObject.php'; $section = false; foreach ($a_objects_counter as $id => $counter) { $id = explode("_", $id); $book_id = $id[0] . "_" . $id[1] . "_" . $id[2] . "_" . $counter; $obj = new ilBookingObject($id[0]); if (!$section) { $section = new ilFormSectionHeaderGUI(); $section->setTitle($obj->getTitle()); $form->addItem($section); $section = true; } $period = ilDatePresentation::formatPeriod(new ilDateTime($id[1], IL_CAL_UNIX), new ilDateTime($id[2], IL_CAL_UNIX)); $nr_field = new ilNumberInputGUI($period, "conf_nr__" . $book_id); $nr_field->setValue(1); $nr_field->setSize(3); $nr_field->setMaxValue($counter); $nr_field->setMinValue(1); $nr_field->setRequired(true); $form->addItem($nr_field); } if ($a_group_id) { $grp = new ilHiddenInputGUI("grp_id"); $grp->setValue($a_group_id); $form->addItem($grp); } $form->addCommandButton("confirmedBookingNumbers", $this->lng->txt("confirm")); $form->addCommandButton("render", $this->lng->txt("cancel")); return $form; }
public function displayPostInfo() { global $tpl, $ilUser, $lng, $ilCtrl; $id = (int) $_GET["object_id"]; if (!$id) { return; } // placeholder include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php'; $book_ids = ilBookingReservation::getObjectReservationForUser($id, $ilUser->getId(), true); $tmp = array(); $rsv_ids = explode(";", $_GET["rsv_ids"]); foreach ($book_ids as $book_id) { if (in_array($book_id, $rsv_ids)) { $obj = new ilBookingReservation($book_id); $from = $obj->getFrom(); $to = $obj->getTo(); if ($from > time()) { $tmp[$from . "-" . $to]++; } } } $olddt = ilDatePresentation::useRelativeDates(); ilDatePresentation::setUseRelativeDates(false); $period = array(); ksort($tmp); foreach ($tmp as $time => $counter) { $time = explode("-", $time); $time = ilDatePresentation::formatPeriod(new ilDateTime($time[0], IL_CAL_UNIX), new ilDateTime($time[1], IL_CAL_UNIX)); if ($counter > 1) { $time .= " (" . $counter . ")"; } $period[] = $time; } $book_id = array_shift($book_ids); ilDatePresentation::setUseRelativeDates($olddt); $obj = new ilBookingReservation($book_id); if ($obj->getUserId() != $ilUser->getId()) { return; } include_once 'Modules/BookingManager/classes/class.ilBookingObject.php'; $obj = new ilBookingObject($id); $pfile = $obj->getPostFile(); $ptext = $obj->getPostText(); $mytpl = new ilTemplate('tpl.booking_reservation_post.html', true, true, 'Modules/BookingManager'); $mytpl->setVariable("TITLE", $lng->txt('book_post_booking_information')); if ($ptext) { // placeholder $ptext = str_replace("[OBJECT]", $obj->getTitle(), $ptext); $ptext = str_replace("[PERIOD]", implode("<br />", $period), $ptext); $mytpl->setVariable("POST_TEXT", nl2br($ptext)); } if ($pfile) { $ilCtrl->setParameter($this, "object_id", $obj->getId()); $url = $ilCtrl->getLinkTarget($this, 'deliverPostFile'); $ilCtrl->setParameter($this, "object_id", ""); $mytpl->setVariable("DOWNLOAD", $lng->txt('download')); $mytpl->setVariable("URL_FILE", $url); $mytpl->setVariable("TXT_FILE", $pfile); } $mytpl->setVariable("TXT_SUBMIT", $lng->txt('ok')); $mytpl->setVariable("URL_SUBMIT", $ilCtrl->getLinkTargetByClass('ilobjbookingpoolgui', 'render')); $tpl->setContent($mytpl->get()); }
/** * set appointments * * @access public * @return */ public function setAppointments($a_apps) { include_once './Services/Calendar/classes/class.ilCalendarEntry.php'; include_once './Services/Calendar/classes/class.ilCalendarRecurrences.php'; include_once './Services/Calendar/classes/class.ilCalendarCategory.php'; $cat = new ilCalendarCategory($this->cat_id); foreach ($a_apps as $cal_entry_id) { $entry = new ilCalendarEntry($cal_entry_id); $rec = ilCalendarRecurrences::_getFirstRecurrence($entry->getEntryId()); // booking if ($cat->getType() == ilCalendarCategory::TYPE_CH) { include_once 'Services/Booking/classes/class.ilBookingEntry.php'; $book = new ilBookingEntry($entry->getContextId()); if ($book) { $title = $entry->getTitle(); if ($book->isOwner()) { $max = (int) $book->getNumberOfBookings(); $current = (int) $book->getCurrentNumberOfBookings($entry->getEntryId()); if ($max > 1) { $title .= ' (' . $current . '/' . $max . ')'; } else { if ($current == $max) { $title .= ' (' . $this->lng->txt('cal_booked_out') . ')'; } else { $title .= ' (' . $this->lng->txt('cal_book_free') . ')'; } } } else { if ($book->hasBooked($entry->getEntryId())) { $title .= ' (' . $this->lng->txt('cal_date_booked') . ')'; } } } } else { $title = $entry->getPresentationTitle(); } $tmp_arr['id'] = $entry->getEntryId(); $tmp_arr['title'] = $title; $tmp_arr['description'] = $entry->getDescription(); $tmp_arr['fullday'] = $entry->isFullday(); $tmp_arr['begin'] = $entry->getStart()->get(IL_CAL_UNIX); $tmp_arr['end'] = $entry->getEnd()->get(IL_CAL_UNIX); $tmp_arr['dt_sort'] = $entry->getStart()->get(IL_CAL_UNIX); $tmp_arr['dt'] = ilDatePresentation::formatPeriod($entry->getStart(), $entry->getEnd()); #$tmp_arr['duration'] = ($dur = $tmp_arr['end'] - $tmp_arr['begin']) ? $dur : 60 * 60 * 24; $tmp_arr['duration'] = $tmp_arr['end'] - $tmp_arr['begin']; if ($tmp_arr['fullday']) { $tmp_arr['duration'] += 60 * 60 * 24; } if (!$tmp_arr['fullday'] and $tmp_arr['end'] == $tmp_arr['begin']) { $tmp_arr['duration'] = ''; } $tmp_arr['frequence'] = $rec->getFrequenceType(); $tmp_arr['deletable'] = (!$entry->isAutoGenerated() and $this->is_editable); $appointments[] = $tmp_arr; } $this->setData($appointments ? $appointments : array()); }
function rsvConfirmCancelAggregationForm($a_ids) { include_once 'Services/Form/classes/class.ilPropertyFormGUI.php'; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this, "rsvCancel")); $form->setTitle($this->lng->txt("book_confirm_cancel_aggregation")); include_once 'Modules/BookingManager/classes/class.ilBookingObject.php'; include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php'; ilDatePresentation::setUseRelativeDates(false); foreach ($a_ids as $idx => $ids) { if (is_array($ids)) { $first = $ids; $first = array_shift($first); } else { $first = $ids; } $rsv = new ilBookingReservation($first); $obj = new ilBookingObject($rsv->getObjectId()); $caption = $obj->getTitle() . ", " . ilDatePresentation::formatPeriod(new ilDateTime($rsv->getFrom(), IL_CAL_UNIX), new ilDateTime($rsv->getTo() + 1, IL_CAL_UNIX)); $item = new ilNumberInputGUI($caption, "rsv_id_" . $idx); $item->setRequired(true); $item->setMinValue(0); $item->setSize(4); $form->addItem($item); if (is_array($ids)) { $item->setMaxValue(sizeof($ids)); foreach ($ids as $id) { $hidden = new ilHiddenInputGUI("rsv_aggr[" . $idx . "][]"); $hidden->setValue($id); $form->addItem($hidden); } } else { $item->setMaxValue(1); $hidden = new ilHiddenInputGUI("rsv_aggr[" . $idx . "]"); $hidden->setValue($ids); $form->addItem($hidden); } if ($_POST["rsv_id_" . $idx]) { $item->setValue((int) $_POST["rsv_id_" . $idx]); } } $form->addCommandButton("rsvCancel", $this->lng->txt("confirm")); $form->addCommandButton("log", $this->lng->txt("cancel")); return $form; }
/** * Get timing details for list gui * * @param ilObjectListGUI $a_list_gui * @param array &$a_item * @return array caption, value */ public static function addListGUIActivationProperty(ilObjectListGUI $a_list_gui, array &$a_item) { global $lng; self::addAdditionalSubItemInformation($a_item); if (isset($a_item['timing_type'])) { if (!isset($a_item['masked_start'])) { $start = $a_item['start']; $end = $a_item['end']; } else { $start = $a_item['masked_start']; $end = $a_item['masked_end']; } $activation = ''; switch ($a_item['timing_type']) { case ilObjectActivation::TIMINGS_ACTIVATION: $activation = ilDatePresentation::formatPeriod(new ilDateTime($start, IL_CAL_UNIX), new ilDateTime($end, IL_CAL_UNIX)); break; case ilObjectActivation::TIMINGS_PRESETTING: $activation = ilDatePresentation::formatPeriod(new ilDate($start, IL_CAL_UNIX), new ilDate($end, IL_CAL_UNIX)); break; } if ($activation != "") { global $lng; $lng->loadLanguageModule('crs'); $a_list_gui->addCustomProperty($lng->txt($a_item['activation_info']), $activation, false, true); } } }
/** * Write data * @return */ protected function write() { // Add header line $row = 0; $col = 0; foreach ($all_fields = $this->getOrderedExportableFields() as $field) { switch ($field) { case 'role': #$this->csv->addColumn($this->lng->txt($this->getType().'_role_status')); $this->addCol($this->lng->txt($this->getType() . '_role_status'), $row, $col++); break; case 'agreement': #$this->csv->addColumn($this->lng->txt('ps_agreement_accepted')); $this->addCol($this->lng->txt('ps_agreement_accepted'), $row, $col++); break; case 'consultation_hour': $this->lng->loadLanguageModule('dateplaner'); $this->addCol($this->lng->txt('cal_ch_field_ch'), $row, $col++); break; default: if (substr($field, 0, 4) == 'udf_') { $field_id = explode('_', $field); include_once 'Services/User/classes/class.ilUserDefinedFields.php'; $udf = ilUserDefinedFields::_getInstance(); $def = $udf->getDefinition($field_id[1]); #$this->csv->addColumn($def['field_name']); $this->addCol($def['field_name'], $row, $col++); } elseif (substr($field, 0, 4) == 'cdf_') { $field_id = explode('_', $field); #$this->csv->addColumn(ilCourseDefinedFieldDefinition::_lookupName($field_id[1])); $this->addCol(ilCourseDefinedFieldDefinition::_lookupName($field_id[1]), $row, $col++); } else { #$this->csv->addColumn($this->lng->txt($field)); $this->addCol($this->lng->txt($field), $row, $col++); } break; } } #$this->csv->addRow(); $this->addRow(); // Add user data foreach ($this->user_ids as $usr_id) { $row++; $col = 0; $udf_data = new ilUserDefinedData($usr_id); foreach ($all_fields as $field) { // Handle course defined fields if ($this->addUserDefinedField($udf_data, $field, $row, $col)) { $col++; continue; } if ($this->addCourseField($usr_id, $field, $row, $col)) { $col++; continue; } switch ($field) { case 'role': switch ($this->user_course_data[$usr_id]['role']) { case IL_CRS_ADMIN: #$this->csv->addColumn($this->lng->txt('crs_admin')); $this->addCol($this->lng->txt('crs_admin'), $row, $col++); break; case IL_CRS_TUTOR: #$this->csv->addColumn($this->lng->txt('crs_tutor')); $this->addCol($this->lng->txt('crs_tutor'), $row, $col++); break; case IL_CRS_MEMBER: #$this->csv->addColumn($this->lng->txt('crs_member')); $this->addCol($this->lng->txt('crs_member'), $row, $col++); break; case IL_GRP_ADMIN: #$this->csv->addColumn($this->lng->txt('il_grp_admin')); $this->addCol($this->lng->txt('il_grp_admin'), $row, $col++); break; case IL_GRP_MEMBER: #$this->csv->addColumn($this->lng->txt('il_grp_member')); $this->addCol($this->lng->txt('il_grp_member'), $row, $col++); break; case 'subscriber': #$this->csv->addColumn($this->lng->txt($this->getType().'_subscriber')); $this->addCol($this->lng->txt($this->getType() . '_subscriber'), $row, $col++); break; default: #$this->csv->addColumn($this->lng->txt('crs_waiting_list')); $this->addCol($this->lng->txt('crs_waiting_list'), $row, $col++); break; } break; case 'agreement': if (isset($this->agreement[$usr_id])) { if ($this->agreement[$usr_id]['accepted']) { #$this->csv->addColumn(ilFormat::formatUnixTime($this->agreement[$usr_id]['acceptance_time'],true)); $this->addCol(ilFormat::formatUnixTime($this->agreement[$usr_id]['acceptance_time'], true), $row, $col++); } else { #$this->csv->addColumn($this->lng->txt('ps_not_accepted')); $this->addCol($this->lng->txt('ps_not_accepted'), $row, $col++); } } else { #$this->csv->addColumn($this->lng->txt('ps_not_accepted')); $this->addCol($this->lng->txt('ps_not_accepted'), $row, $col++); } break; // These fields are always enabled // These fields are always enabled case 'username': #$this->csv->addColumn($this->user_profile_data[$usr_id]['login']); $this->addCol($this->user_profile_data[$usr_id]['login'], $row, $col++); break; case 'firstname': case 'lastname': #$this->csv->addColumn($this->user_profile_data[$usr_id][$field]); $this->addCol($this->user_profile_data[$usr_id][$field], $row, $col++); break; case 'consultation_hour': include_once './Services/Booking/classes/class.ilBookingEntry.php'; $bookings = ilBookingEntry::lookupManagedBookingsForObject($this->obj_id, $GLOBALS['ilUser']->getId()); $uts = array(); foreach ((array) $bookings[$usr_id] as $ut) { ilDatePresentation::setUseRelativeDates(false); $tmp = ilDatePresentation::formatPeriod(new ilDateTime($ut['dt'], IL_CAL_UNIX), new ilDateTime($ut['dtend'], IL_CAL_UNIX)); if (strlen($ut['explanation'])) { $tmp .= ' ' . $ut['explanation']; } $uts[] = $tmp; } $uts_str = implode(',', $uts); $this->addCol($uts_str, $row, $col++); break; default: // Check aggreement if (!$this->privacy->courseConfirmationRequired() and !ilCourseDefinedFieldDefinition::_getFields($this->obj_id) or $this->agreement[$usr_id]['accepted']) { #$this->csv->addColumn($this->user_profile_data[$usr_id][$field]); $this->addCol($this->user_profile_data[$usr_id][$field], $row, $col++); } else { #$this->csv->addColumn(''); $this->addCol('', $row, $col++); } break; } } #$this->csv->addRow(); $this->addRow(); } }
function getData() { global $ilCtrl, $lng; $seed = new ilDate(date('Y-m-d', time()), IL_CAL_DATE); include_once './Services/Calendar/classes/class.ilCalendarSchedule.php'; $schedule = new ilCalendarSchedule($seed, ilCalendarSchedule::TYPE_INBOX); $events = $schedule->getEvents(); $data = array(); if (sizeof($events)) { foreach ($events as $event) { $ilCtrl->clearParametersByClass('ilcalendardaygui'); $ilCtrl->setParameterByClass('ilcalendardaygui', 'seed', $event->getStart()); $link = $ilCtrl->getLinkTargetByClass('ilcalendardaygui', ''); $ilCtrl->clearParametersByClass('ilcalendardaygui'); $data[] = array("date" => ilDatePresentation::formatPeriod($event->getStart(), $event->getEnd()), "title" => $event->getPresentationTitle(), "url" => $link); } $this->setEnableNumInfo(true); } else { $data[] = array("date" => $lng->txt("msg_no_search_result"), "title" => "", "url" => ""); $this->setEnableNumInfo(false); } return $data; }
protected function export() { global $ilCtrl; $params = $this->viewToolbar(); if ($params) { // data $tfr = explode("-", (string) $params["month"]); $day_from = date("Y-m-d", mktime(0, 0, 1, $tfr[1] - ($params["scope"] - 1), 1, $tfr[0])); $day_to = date("Y-m-d", mktime(0, 0, 1, $tfr[1] + 1, 0, $tfr[0])); unset($tfr); $chart_data = $this->getChartData($params["figure"], $params["scope"], $day_from, $day_to); // excel $period = ilDatePresentation::formatPeriod(new ilDate($day_from, IL_CAL_DATE), new ilDate($day_to, IL_CAL_DATE)); $filename = ilObject::_lookupTitle($this->wiki_id); if ($this->page_id) { $filename .= " - " . ilWikiPage::lookupTitle($this->page_id); } $filename .= " - " . ilWikiStat::getFigureTitle($params["figure"]) . " - " . $period . ".xls"; include_once "./Services/Excel/classes/class.ilExcelUtils.php"; include_once "./Services/Excel/classes/class.ilExcelWriterAdapter.php"; $adapter = new ilExcelWriterAdapter($filename, true); $workbook = $adapter->getWorkbook(); $worksheet = $workbook->addWorksheet(); // $worksheet->setLandscape(); /* $worksheet->setColumn(0, 0, 20); $worksheet->setColumn(1, 1, 40); */ $row = 0; foreach ($chart_data as $day => $value) { $row++; $worksheet->writeString($row, 0, $day); $worksheet->writeNumber($row, 1, $value); } $workbook->close(); exit; } $ilCtrl->redirect($this, "view"); }
/** * Confirmation screen to cancel consultation appointment or ressource booking * depends on calendar category */ public function cancelBooking() { global $ilUser, $tpl; $entry = (int) $_GET['app_id']; include_once 'Services/Calendar/classes/class.ilCalendarEntry.php'; $entry = new ilCalendarEntry($entry); $category = $this->calendarEntryToCategory($entry); if ($category->getType() == ilCalendarCategory::TYPE_CH) { include_once 'Services/Booking/classes/class.ilBookingEntry.php'; $booking = new ilBookingEntry($entry->getContextId()); if (!$booking->hasBooked($entry->getEntryId())) { $this->ctrl->returnToParent($this); return false; } $entry_title = ' ' . $entry->getTitle() . " (" . ilObjUser::_lookupFullname($booking->getObjId()) . ')'; } else { if ($category->getType() == ilCalendarCategory::TYPE_BOOK) { $entry_title = ' ' . $entry->getTitle(); } else { $this->ctrl->returnToParent($this); return false; } } $title = ilDatePresentation::formatPeriod($entry->getStart(), $entry->getEnd()); include_once 'Services/Utilities/classes/class.ilConfirmationGUI.php'; $conf = new ilConfirmationGUI(); $conf->setFormAction($this->ctrl->getFormAction($this)); $conf->setHeaderText($this->lng->txt('cal_cancel_booking_info')); $conf->setConfirm($this->lng->txt('cal_cancel_booking'), 'cancelconfirmed'); $conf->setCancel($this->lng->txt('cancel'), 'cancel'); $conf->addItem('app_id', $entry->getEntryId(), $title . ' - ' . $entry_title); $tpl->setContent($conf->getHTML()); }
protected function buildData($a_time_from, $a_time_to, $a_title) { global $lng; // basic data - time related $maxed_out_duration = round(ilSessionStatistics::getMaxedOutDuration($a_time_from, $a_time_to) / 60); $counters = ilSessionStatistics::getNumberOfSessionsByType($a_time_from, $a_time_to); $opened = (int) $counters["opened"]; $closed_limit = (int) $counters["closed_limit"]; unset($counters["opened"]); unset($counters["closed_limit"]); // build center column $data = array(); ilDatePresentation::setUseRelativeDates(false); $data["title"] = $a_title . " (" . ilDatePresentation::formatPeriod(new ilDateTime($a_time_from, IL_CAL_UNIX), new ilDateTime($a_time_to, IL_CAL_UNIX)) . ")"; $data["maxed_out_time"] = array($lng->txt("trac_maxed_out_time"), $maxed_out_duration); $data["maxed_out_counter"] = array($lng->txt("trac_maxed_out_counter"), $closed_limit); $data["opened"] = array($lng->txt("trac_sessions_opened"), $opened); $data["closed"] = array($lng->txt("trac_sessions_closed"), array_sum($counters)); foreach ($counters as $type => $counter) { $data["closed_details"][] = array($lng->txt("trac_" . $type), (int) $counter); } $data["active"] = ilSessionStatistics::getActiveSessions($a_time_from, $a_time_to); return $data; }
/** * Get session data for given objects and user * * @param int $a_user_id * @param array $obj_ids * @return array */ protected static function getSessionData($a_user_id, array $obj_ids) { global $ilDB; $query = "SELECT obj_id, title, e_start, e_end, CASE WHEN participated = 1 THEN 2 WHEN registered = 1 THEN 1 ELSE NULL END AS status," . " mark, e_comment" . " FROM event" . " JOIN event_appointment ON (event.obj_id = event_appointment.event_id)" . " LEFT JOIN event_participants ON (event_participants.event_id = event.obj_id AND usr_id = " . $ilDB->quote($a_user_id, "integer") . ")" . " WHERE " . $ilDB->in("obj_id", $obj_ids, false, "integer"); $set = $ilDB->query($query); $sessions = array(); while ($rec = $ilDB->fetchAssoc($set)) { $rec["comment"] = $rec["e_comment"]; unset($rec["e_comment"]); $date = ilDatePresentation::formatPeriod(new ilDateTime($rec["e_start"], IL_CAL_DATETIME), new ilDateTime($rec["e_end"], IL_CAL_DATETIME)); if ($rec["title"]) { $rec["title"] = $date . ': ' . $rec["title"]; } else { $rec["title"] = $date; } $sessions[$rec["obj_id"]] = $rec; } return $sessions; }
/** * Get formatted mail body text of user profile data. * * @param object Language object (choose user language of recipient) or null to use language of current user */ function getProfileAsString(&$a_language) { include_once './Services/AccessControl/classes/class.ilObjRole.php'; include_once './Services/Utilities/classes/class.ilFormat.php'; global $lng, $rbacreview; $language =& $a_language; $language->loadLanguageModule('registration'); $language->loadLanguageModule('crs'); $body = ''; $body .= $language->txt("login") . ": " . $this->getLogin() . "\n"; if (strlen($this->getUTitle())) { $body .= $language->txt("title") . ": " . $this->getUTitle() . "\n"; } if (strlen($this->getGender())) { $gender = $this->getGender() == 'm' ? $language->txt('gender_m') : $language->txt('gender_f'); $body .= $language->txt("gender") . ": " . $gender . "\n"; } if (strlen($this->getFirstname())) { $body .= $language->txt("firstname") . ": " . $this->getFirstname() . "\n"; } if (strlen($this->getLastname())) { $body .= $language->txt("lastname") . ": " . $this->getLastname() . "\n"; } if (strlen($this->getInstitution())) { $body .= $language->txt("institution") . ": " . $this->getInstitution() . "\n"; } if (strlen($this->getDepartment())) { $body .= $language->txt("department") . ": " . $this->getDepartment() . "\n"; } if (strlen($this->getStreet())) { $body .= $language->txt("street") . ": " . $this->getStreet() . "\n"; } if (strlen($this->getCity())) { $body .= $language->txt("city") . ": " . $this->getCity() . "\n"; } if (strlen($this->getZipcode())) { $body .= $language->txt("zipcode") . ": " . $this->getZipcode() . "\n"; } if (strlen($this->getCountry())) { $body .= $language->txt("country") . ": " . $this->getCountry() . "\n"; } if (strlen($this->getSelectedCountry())) { $body .= $language->txt("sel_country") . ": " . $this->getSelectedCountry() . "\n"; } if (strlen($this->getPhoneOffice())) { $body .= $language->txt("phone_office") . ": " . $this->getPhoneOffice() . "\n"; } if (strlen($this->getPhoneHome())) { $body .= $language->txt("phone_home") . ": " . $this->getPhoneHome() . "\n"; } if (strlen($this->getPhoneMobile())) { $body .= $language->txt("phone_mobile") . ": " . $this->getPhoneMobile() . "\n"; } if (strlen($this->getFax())) { $body .= $language->txt("fax") . ": " . $this->getFax() . "\n"; } if (strlen($this->getEmail())) { $body .= $language->txt("email") . ": " . $this->getEmail() . "\n"; } if (strlen($this->getHobby())) { $body .= $language->txt("hobby") . ": " . $this->getHobby() . "\n"; } if (strlen($this->getComment())) { $body .= $language->txt("referral_comment") . ": " . $this->getComment() . "\n"; } if (strlen($this->getMatriculation())) { $body .= $language->txt("matriculation") . ": " . $this->getMatriculation() . "\n"; } if (strlen($this->getCreateDate())) { ilDatePresentation::setUseRelativeDates(false); ilDatePresentation::setLanguage($language); $date = ilDatePresentation::formatDate(new ilDateTime($this->getCreateDate(), IL_CAL_DATETIME)); ilDatePresentation::resetToDefaults(); $body .= $language->txt("create_date") . ": " . $date . "\n"; } foreach ($rbacreview->getGlobalRoles() as $role) { if ($rbacreview->isAssigned($this->getId(), $role)) { $gr[] = ilObjRole::_lookupTitle($role); } } if (count($gr)) { $body .= $language->txt('reg_role_info') . ': ' . implode(',', $gr) . "\n"; } // Time limit if ($this->getTimeLimitUnlimited()) { $body .= $language->txt('time_limit') . ": " . $language->txt('crs_unlimited') . "\n"; } else { ilDatePresentation::setUseRelativeDates(false); ilDatePresentation::setLanguage($language); $period = ilDatePresentation::formatPeriod(new ilDateTime($this->getTimeLimitFrom(), IL_CAL_UNIX), new ilDateTime($this->getTimeLimitUntil(), IL_CAL_UNIX)); ilDatePresentation::resetToDefaults(); $start = new ilDateTime($this->getTimeLimitFrom(), IL_CAL_UNIX); $end = new ilDateTime($this->getTimeLimitUntil(), IL_CAL_UNIX); $body .= $language->txt('time_limit') . ': ' . $start->get(IL_CAL_DATETIME); $body .= $language->txt('time_limit') . ': ' . $end->get(IL_CAL_DATETIME); #$body .= $language->txt('time_limit').': '.$period; /* $body .= ($language->txt('time_limit').": ".$language->txt('crs_from')." ". ilFormat::formatUnixTime($this->getTimeLimitFrom(), true)." ". $language->txt('crs_to')." ". ilFormat::formatUnixTime($this->getTimeLimitUntil(), true)."\n"); */ } return $body; }
/** * * @param ilLanguage $lng * @return */ public function appointmentToMailString($lng) { $body = $lng->txt('cal_details'); $body .= "\n\n"; $body .= $lng->txt('title') . ': ' . $this->getTitle() . "\n"; ilDatePresentation::setUseRelativeDates(false); $body .= $lng->txt('date') . ': ' . ilDatePresentation::formatPeriod($this->getStart(), $this->getEnd()) . "\n"; ilDatePresentation::setUseRelativeDates(true); if (strlen($this->getLocation())) { $body .= $lng->txt('cal_where') . ': ' . $this->getLocation() . "\n"; } if (strlen($this->getDescription())) { $body .= $lng->txt('description') . ': ' . $this->getDescription() . "\n"; } return $body; }
/** * Fill table row * @param array $a_set */ protected function fillRow($a_set) { global $lng, $ilAccess, $ilCtrl, $ilUser; $this->tpl->setVariable("TXT_TITLE", $a_set["title"]); $this->tpl->setVariable("RESERVATION_ID", $a_set["booking_reservation_id"]); if (in_array($a_set['status'], array(ilBookingReservation::STATUS_CANCELLED, ilBookingReservation::STATUS_IN_USE))) { $this->tpl->setVariable("TXT_STATUS", $lng->txt('book_reservation_status_' . $a_set['status'])); } // #11995 $uname = ilObjUser::_lookupFullName($a_set['user_id']); if (!trim($uname)) { $uname = "[" . $lng->txt("user_deleted") . "]"; } else { $ilCtrl->setParameter($this->parent_obj, 'user_id', $a_set['user_id']); $this->tpl->setVariable("HREF_PROFILE", $ilCtrl->getLinkTarget($this->parent_obj, 'showprofile')); $ilCtrl->setParameter($this->parent_obj, 'user_id', ''); } $this->tpl->setVariable("TXT_CURRENT_USER", $uname); if ($this->has_schedule) { $date_from = new ilDateTime($a_set['date_from'], IL_CAL_UNIX); $date_to = new ilDateTime($a_set['date_to'], IL_CAL_UNIX); $this->tpl->setVariable("VALUE_DATE", ilDatePresentation::formatPeriod($date_from, $date_to)); } if (!$this->has_schedule || $date_from->get(IL_CAL_UNIX) > time()) { include_once "./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php"; $alist = new ilAdvancedSelectionListGUI(); $alist->setId($a_set['booking_reservation_id']); $alist->setListTitle($lng->txt("actions")); $ilCtrl->setParameter($this->parent_obj, 'reservation_id', $a_set['booking_reservation_id']); if (!$a_set['group_id']) { if ($ilAccess->checkAccess('write', '', $this->ref_id)) { if ($a_set['status'] == ilBookingReservation::STATUS_CANCELLED) { /* // can be uncancelled? if(ilBookingReservation::getAvailableObject(array($a_set['object_id']), $date_from->get(IL_CAL_UNIX), $date_to->get(IL_CAL_UNIX))) { $alist->addItem($lng->txt('book_set_not_cancel'), 'not_cancel', $ilCtrl->getLinkTarget($this->parent_obj, 'rsvUncancel')); } */ } else { if ($a_set['status'] != ilBookingReservation::STATUS_IN_USE) { if ($this->has_schedule) { $alist->addItem($lng->txt('book_set_in_use'), 'in_use', $ilCtrl->getLinkTarget($this->parent_obj, 'rsvInUse')); } $alist->addItem($lng->txt('book_set_cancel'), 'cancel', $ilCtrl->getLinkTarget($this->parent_obj, 'rsvCancel')); } else { if ($this->has_schedule) { $alist->addItem($lng->txt('book_set_not_in_use'), 'not_in_use', $ilCtrl->getLinkTarget($this->parent_obj, 'rsvNotInUse')); } } } } else { if ($a_set['user_id'] == $ilUser->getId() && $a_set['status'] != ilBookingReservation::STATUS_CANCELLED) { $alist->addItem($lng->txt('book_set_cancel'), 'cancel', $ilCtrl->getLinkTarget($this->parent_obj, 'rsvCancel')); } } } else { if ($ilAccess->checkAccess('write', '', $this->ref_id) || $a_set['user_id'] == $ilUser->getId()) { $alist->addItem($lng->txt('details'), 'details', $ilCtrl->getLinkTarget($this->parent_obj, 'logDetails')); } } if (sizeof($alist->getItems())) { if (!$a_set['group_id']) { $this->tpl->setVariable('MULTI_ID', $a_set['booking_reservation_id']); } $this->tpl->setVariable('LAYER', $alist->getHTML()); } } }
/** * condition to string * @return */ public function conditionToString() { global $lng; switch ($this->getMappingType()) { case self::TYPE_FIXED: if ($this->getFieldName() == 'part_id') { return $lng->txt('ecs_field_' . $this->getFieldName()) . ': ' . $this->participantsToString(); } return $lng->txt('ecs_field_' . $this->getFieldName()) . ': ' . $this->getMappingValue(); case self::TYPE_DURATION: include_once './Services/Calendar/classes/class.ilDatePresentation.php'; return $lng->txt('ecs_field_' . $this->getFieldName()) . ': ' . ilDatePresentation::formatPeriod($this->getDateRangeStart(), $this->getDateRangeEnd()); case self::TYPE_BY_TYPE: return $lng->txt('type') . ': ' . $lng->txt('obj_' . $this->getByType()); } }
/** * get HTML * * @access public * @param * @return */ public function getHTML($a_app) { global $tree, $lng, $ilUser; self::$counter++; $this->tpl = new ilTemplate('tpl.appointment_panel.html', true, true, 'Services/Calendar'); // Panel variables $this->tpl->setVariable('PANEL_NUM', self::$counter); $this->tpl->setVariable('PANEL_TITLE', str_replace(' ()', '', $a_app['event']->getPresentationTitle(false))); if ($a_app["event"]->isMilestone()) { $this->tpl->setVariable('PANEL_DETAILS', $this->lng->txt('cal_ms_details')); } else { $this->tpl->setVariable('PANEL_DETAILS', $this->lng->txt('cal_details')); } $this->tpl->setVariable('PANEL_TXT_DATE', $this->lng->txt('date')); if ($a_app['fullday']) { $this->tpl->setVariable('PANEL_DATE', ilDatePresentation::formatPeriod(new ilDate($a_app['dstart'], IL_CAL_UNIX), new ilDate($a_app['dend'], IL_CAL_UNIX))); } else { $this->tpl->setVariable('PANEL_DATE', ilDatePresentation::formatPeriod(new ilDateTime($a_app['dstart'], IL_CAL_UNIX), new ilDateTime($a_app['dend'], IL_CAL_UNIX))); } if ($a_app['event']->getLocation()) { $this->tpl->setVariable('PANEL_TXT_WHERE', $this->lng->txt('cal_where')); $this->tpl->setVariable('PANEL_WHERE', ilUtil::makeClickable($a_app['event']->getLocation()), true); } if ($a_app['event']->getDescription()) { $this->tpl->setVariable('PANEL_TXT_DESC', $this->lng->txt('description')); $this->tpl->setVariable('PANEL_DESC', ilUtil::makeClickable(nl2br($a_app['event']->getDescription()))); } if ($a_app['event']->isMilestone() && $a_app['event']->getCompletion() > 0) { $this->tpl->setVariable('PANEL_TXT_COMPL', $this->lng->txt('cal_task_completion')); $this->tpl->setVariable('PANEL_COMPL', $a_app['event']->getCompletion() . " %"); } if ($a_app['event']->isMilestone()) { // users responsible $users = $a_app['event']->readResponsibleUsers(); $delim = ""; foreach ($users as $r) { $value .= $delim . $r["lastname"] . ", " . $r["firstname"] . " [" . $r["login"] . "]"; $delim = "<br />"; } if (count($users) > 0) { $this->tpl->setVariable('PANEL_TXT_RESP', $this->lng->txt('cal_responsible')); $this->tpl->setVariable('PANEL_RESP', $value); } } include_once './Services/Calendar/classes/class.ilCalendarCategoryAssignments.php'; $cat_id = ilCalendarCategoryAssignments::_lookupCategory($a_app['event']->getEntryId()); $cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo($cat_id); $entry_obj_id = isset($cat_info['subitem_obj_ids'][$cat_id]) ? $cat_info['subitem_obj_ids'][$cat_id] : $cat_info['obj_id']; $this->tpl->setVariable('PANEL_TXT_CAL_TYPE', $this->lng->txt('cal_cal_type')); switch ($cat_info['type']) { case ilCalendarCategory::TYPE_GLOBAL: $this->tpl->setVariable('PANEL_CAL_TYPE', $this->lng->txt('cal_type_system')); break; case ilCalendarCategory::TYPE_USR: $this->tpl->setVariable('PANEL_CAL_TYPE', $this->lng->txt('cal_type_personal')); break; case ilCalendarCategory::TYPE_OBJ: $type = ilObject::_lookupType($cat_info['obj_id']); $this->tpl->setVariable('PANEL_CAL_TYPE', $this->lng->txt('cal_type_' . $type)); // Course group appointment registration if ($this->settings->isCGRegistrationEnabled() and $type == 'crs' or type == 'grp') { if (!$a_app['event']->isAutoGenerated()) { include_once './Services/Calendar/classes/class.ilCalendarRegistration.php'; $reg = new ilCalendarRegistration($a_app['event']->getEntryId()); if ($reg->isRegistered($ilUser->getId(), new ilDateTime($a_app['dstart'], IL_CAL_UNIX), new ilDateTime($a_app['dend'], IL_CAL_UNIX))) { $this->tpl->setCurrentBlock('panel_cancel_book_link'); $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $this->getSeed()->get(IL_CAL_DATE)); $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $a_app['event']->getEntryId()); $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'dstart', $a_app['dstart']); $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'dend', $a_app['dend']); $this->tpl->setVariable('TXT_PANEL_CANCELBOOK', $this->lng->txt('cal_reg_unregister')); $this->tpl->setVariable('PANEL_CANCELBOOK_HREF', $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'confirmUnregister')); $this->tpl->parseCurrentBlock(); } else { $this->tpl->setCurrentBlock('panel_book_link'); $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $this->getSeed()->get(IL_CAL_DATE)); $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $a_app['event']->getEntryId()); $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'dstart', $a_app['dstart']); $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'dend', $a_app['dend']); $this->tpl->setVariable('TXT_PANEL_BOOK', $this->lng->txt('cal_reg_register')); $this->tpl->setVariable('PANEL_BOOK_HREF', $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'confirmRegister')); $this->tpl->parseCurrentBlock(); } include_once './Services/Link/classes/class.ilLink.php'; $registrations = array(); foreach ($reg->getRegisteredUsers(new ilDateTime($a_app['dstart'], IL_CAL_UNIX), new ilDateTime($a_app['dend'], IL_CAL_UNIX)) as $usr_data) { $usr_id = $usr_data['usr_id']; $this->ctrl->setParameterByClass('ilconsultationhoursgui', 'user', $usr_id); $registrations[] = '<a href="' . $this->ctrl->getLinkTargetByClass('ilconsultationhoursgui', 'showprofile') . '">' . ilObjUser::_lookupFullname($usr_id); $this->ctrl->setParameterByClass('ilconsultationhoursgui', 'user', ''); } if (count($registrations)) { $this->tpl->setCurrentBlock('panel_current_booking'); $this->tpl->setVariable('PANEL_TXT_CURRENT_BOOKING', $this->lng->txt('cal_reg_registered_users')); $this->tpl->setVariable('PANEL_CURRENT_BOOKING', implode('<br />', $registrations)); $this->tpl->parseCurrentBlock(); } } } break; case ilCalendarCategory::TYPE_CH: $this->tpl->setVariable('PANEL_CAL_TYPE', $this->lng->txt('cal_ch_ch')); include_once 'Services/Booking/classes/class.ilBookingEntry.php'; $entry = new ilBookingEntry($a_app['event']->getContextId()); $is_owner = $entry->isOwner(); $user_entry = $cat_info['obj_id'] == $ilUser->getId(); if ($user_entry && !$is_owner) { // find source calendar entry in owner calendar include_once 'Services/Calendar/classes/ConsultationHours/class.ilConsultationHourAppointments.php'; $apps = ilConsultationHourAppointments::getAppointmentIds($entry->getObjId(), $a_app['event']->getContextId(), $a_app['event']->getStart()); $ref_event = $apps[0]; } else { $ref_event = $a_app['event']->getEntryId(); } $this->tpl->setCurrentBlock('panel_booking_owner'); $this->tpl->setVariable('PANEL_TXT_BOOKING_OWNER', $this->lng->txt('cal_ch_booking_owner')); $this->tpl->setVariable('PANEL_BOOKING_OWNER', ilObjUser::_lookupFullname($entry->getObjId())); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock('panel_max_booking'); $this->tpl->setVariable('PANEL_TXT_MAX_BOOKING', $this->lng->txt('cal_ch_num_bookings')); $this->tpl->setVariable('PANEL_MAX_BOOKING', $entry->getNumberOfBookings()); $this->tpl->parseCurrentBlock(); if (!$is_owner) { if ($entry->hasBooked($ref_event)) { if (ilDateTime::_after($a_app['event']->getStart(), new ilDateTime(time(), IL_CAL_UNIX))) { $this->tpl->setCurrentBlock('panel_cancel_book_link'); $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $ref_event); $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $this->getSeed()->get(IL_CAL_DATE)); $this->tpl->setVariable('TXT_PANEL_CANCELBOOK', $this->lng->txt('cal_ch_cancel_booking')); $this->tpl->setVariable('PANEL_CANCELBOOK_HREF', $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'cancelBooking')); $this->tpl->parseCurrentBlock(); } } elseif ($entry->isAppointmentBookableForUser($ref_event, $GLOBALS['ilUser']->getId())) { $this->tpl->setCurrentBlock('panel_book_link'); $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $ref_event); $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $this->getSeed()->get(IL_CAL_DATE)); $this->tpl->setVariable('TXT_PANEL_BOOK', $this->lng->txt('cal_ch_book')); $this->tpl->setVariable('PANEL_BOOK_HREF', $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'book')); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock('panel_current_booking'); $this->tpl->setVariable('PANEL_TXT_CURRENT_BOOKING', $this->lng->txt('cal_ch_current_bookings')); $this->tpl->setVariable('PANEL_CURRENT_BOOKING', $entry->getCurrentNumberOfBookings($ref_event)); $this->tpl->parseCurrentBlock(); } else { $obj_ids = $entry->getTargetObjIds(); foreach ($obj_ids as $obj_id) { $title = ilObject::_lookupTitle($obj_id); $refs = ilObject::_getAllReferences($obj_id); include_once './Services/Link/classes/class.ilLink.php'; $this->tpl->setCurrentBlock('panel_booking_target_row'); $this->tpl->setVariable('PANEL_BOOKING_TARGET_TITLE', $title); $this->tpl->setVariable('PANEL_BOOKING_TARGET', ilLink::_getLink(end($refs))); $this->tpl->parseCurrentBlock(); } if ($obj_ids) { $this->tpl->setCurrentBlock('panel_booking_target'); $this->tpl->setVariable('PANEL_TXT_BOOKING_TARGET', $this->lng->txt('cal_ch_target_object')); $this->tpl->parseCurrentBlock(); } $link_users = true; if (ilCalendarCategories::_getInstance()->getMode() == ilCalendarCategories::MODE_PORTFOLIO_CONSULTATION) { $link_users = false; } include_once './Services/Link/classes/class.ilLink.php'; $bookings = array(); $this->ctrl->setParameterByClass('ilconsultationhoursgui', 'panel', 1); foreach ($entry->getCurrentBookings($a_app['event']->getEntryId()) as $user_id) { if ($link_users) { $this->ctrl->setParameterByClass('ilconsultationhoursgui', 'user', $user_id); $bookings[] = '<a href="' . $this->ctrl->getLinkTargetByClass('ilconsultationhoursgui', 'showprofile') . '">' . ilObjUser::_lookupFullname($user_id) . '</a>'; $this->ctrl->setParameterByClass('ilconsultationhoursgui', 'user', ''); } else { $bookings[] = ilObjUser::_lookupFullname($user_id); } } $this->ctrl->setParameterByClass('ilconsultationhoursgui', 'panel', ''); $this->tpl->setCurrentBlock('panel_current_booking'); $this->tpl->setVariable('PANEL_TXT_CURRENT_BOOKING', $this->lng->txt('cal_ch_current_bookings')); $this->tpl->setVariable('PANEL_CURRENT_BOOKING', implode('<br />', $bookings)); $this->tpl->parseCurrentBlock(); } break; case ilCalendarCategory::TYPE_BOOK: $this->tpl->setVariable('PANEL_CAL_TYPE', $this->lng->txt('cal_ch_booking')); $this->tpl->setCurrentBlock('panel_cancel_book_link'); $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $a_app['event']->getEntryId()); $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $this->getSeed()->get(IL_CAL_DATE)); $this->tpl->setVariable('TXT_PANEL_CANCELBOOK', $this->lng->txt('cal_ch_cancel_booking')); $this->tpl->setVariable('PANEL_CANCELBOOK_HREF', $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'cancelBooking')); $this->tpl->parseCurrentBlock(); break; } $this->tpl->setVariable('PANEL_TXT_CAL_NAME', $this->lng->txt('cal_calendar_name')); $this->tpl->setVariable('PANEL_CAL_NAME', $cat_info['title']); if ($cat_info['editable'] and !$a_app['event']->isAutoGenerated()) { $this->tpl->setCurrentBlock('panel_edit_link'); $this->tpl->setVariable('TXT_PANEL_EDIT', $this->lng->txt('edit')); $this->ctrl->clearParametersByClass('ilcalendarappointmentgui'); $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $this->getSeed()->get(IL_CAL_DATE)); $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $a_app['event']->getEntryId()); $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'dt', $a_app['dstart']); $this->tpl->setVariable('PANEL_EDIT_HREF', $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'askEdit')); $this->tpl->setCurrentBlock('panel_delete_link'); $this->tpl->setVariable('TXT_PANEL_DELETE', $this->lng->txt('delete')); $this->ctrl->clearParametersByClass('ilcalendarappointmentgui'); $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $this->getSeed()->get(IL_CAL_DATE)); $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $a_app['event']->getEntryId()); $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'dt', $a_app['dstart']); $this->tpl->setVariable('PANEL_DELETE_HREF', $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'askdelete')); $this->tpl->parseCurrentBlock(); } include_once './Services/Calendar/classes/class.ilCalendarCategory.php'; if ($cat_info['type'] == ilCalendarCategory::TYPE_OBJ) { $refs = ilObject::_getAllReferences($entry_obj_id); $type = ilObject::_lookupType($entry_obj_id); $title = ilObject::_lookupTitle($entry_obj_id) ? ilObject::_lookupTitle($entry_obj_id) : $lng->txt('obj_' . $type); include_once './Services/Link/classes/class.ilLink.php'; $href = ilLink::_getStaticLink(current($refs), ilObject::_lookupType($entry_obj_id)); $parent = $tree->getParentId(current($refs)); $parent_title = ilObject::_lookupTitle(ilObject::_lookupObjId($parent)); $this->tpl->setVariable('PANEL_TXT_LINK', $this->lng->txt('ext_link')); $this->tpl->setVariable('PANEL_LINK_HREF', $href); $this->tpl->setVariable('PANEL_LINK_NAME', $title); $this->tpl->setVariable('PANEL_PARENT', $parent_title); } return $this->tpl->get(); }
function getData() { global $ilCtrl, $lng; $seed = new ilDate(date('Y-m-d', time()), IL_CAL_DATE); include_once './Services/Calendar/classes/class.ilCalendarSchedule.php'; $schedule = new ilCalendarSchedule($seed, ilCalendarSchedule::TYPE_PD_UPCOMING); $schedule->addSubitemCalendars(true); // #12007 $schedule->setEventsLimit(20); $schedule->calculate(); $events = $schedule->getScheduledEvents(); // #13809 $data = array(); if (sizeof($events)) { foreach ($events as $item) { $start = $item["dstart"]; $end = $item["dend"]; if ($item["fullday"]) { $start = new ilDate($start, IL_CAL_UNIX); $end = new ilDate($end, IL_CAL_UNIX); } else { $start = new ilDateTime($start, IL_CAL_UNIX); $end = new ilDateTime($end, IL_CAL_UNIX); } $ilCtrl->clearParametersByClass('ilcalendardaygui'); $ilCtrl->setParameterByClass('ilcalendardaygui', 'seed', $start->get(IL_CAL_DATE)); $link = $ilCtrl->getLinkTargetByClass('ilcalendardaygui', ''); $ilCtrl->clearParametersByClass('ilcalendardaygui'); $data[] = array("date" => ilDatePresentation::formatPeriod($start, $end), "title" => $item["event"]->getPresentationTitle(), "url" => $link); } $this->setEnableNumInfo(true); } else { $data[] = array("date" => $lng->txt("msg_no_search_result"), "title" => "", "url" => ""); $this->setEnableNumInfo(false); } return $data; }
/** * Add info items * @param ilInfoScreenGUI $info */ public function addInfoItems($info) { global $ilCtrl, $ilUser; $access = true; if (ilViteroLockedUser::isLocked($ilUser->getId(), $this->object->getVGroupId())) { ilUtil::sendFailure(ilViteroPlugin::getInstance()->txt('user_locked_info')); $access = false; } $booking_id = ilViteroUtils::getOpenRoomBooking($this->object->getVGroupId()); if ($booking_id and $access) { $this->ctrl->setParameter($this, 'bid', $booking_id); $info->setFormAction($ilCtrl->getFormAction($this), '_blank'); $big_button = '<div class="il_ButtonGroup" style="margin:25px; text-align:center; font-size:25px;">' . '<input type="submit" class="submit" name="cmd[startSession]" value="' . ilViteroPlugin::getInstance()->txt('start_session') . '" style="padding:10px;" /></div>'; $info->addSection(""); $info->addProperty("", $big_button); } $start = new ilDateTime(time(), IL_CAL_UNIX); $end = clone $start; $end->increment(IL_CAL_YEAR, 1); $booking = ilViteroUtils::lookupNextBooking($start, $end, $this->object->getVGroupId()); if (!$booking['start'] instanceof ilDateTime) { return true; } ilDatePresentation::setUseRelativeDates(false); $info->addSection(ilViteroPlugin::getInstance()->txt('info_next_appointment')); $info->addProperty(ilViteroPlugin::getInstance()->txt('info_next_appointment_dt'), ilDatePresentation::formatPeriod($booking['start'], $booking['end'])); }
public static function _appointmentToString($start, $end, $fulltime) { global $lng; if ($fulltime) { return ilDatePresentation::formatPeriod(new ilDate($start, IL_CAL_UNIX), new ilDate($end, IL_CAL_UNIX)); } else { return ilDatePresentation::formatPeriod(new ilDateTime($start, IL_CAL_UNIX), new ilDateTime($end, IL_CAL_UNIX)); } }
/** * Fill table row * @param array $a_set */ protected function fillRow($a_set) { global $lng, $ilCtrl, $ilUser; $has_booking = false; $booking_possible = true; $has_reservations = false; $this->tpl->setVariable("TXT_TITLE", $a_set["title"]); $this->tpl->setVariable("TXT_DESC", nl2br($a_set["description"])); if (!$this->has_schedule) { include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php'; $reservation = ilBookingReservation::getList(array($a_set['booking_object_id']), 1000, 0, array()); $cnt = 0; $user_ids = array(); foreach ($reservation["data"] as $item) { if ($item["status"] != ilBookingReservation::STATUS_CANCELLED) { $cnt++; $user_ids[$item["user_id"]] = ilObjUser::_lookupFullName($item['user_id']); if ($item["user_id"] == $ilUser->getId()) { $has_booking = true; } $has_reservations = true; } } $this->tpl->setVariable("VALUE_AVAIL", $a_set["nr_items"] - $cnt); $this->tpl->setVariable("VALUE_AVAIL_ALL", $a_set["nr_items"]); if ($a_set["nr_items"] <= $cnt) { $booking_possible = false; } if ($this->may_edit) { if ($user_ids) { $this->tpl->setVariable("TXT_CURRENT_USER", implode("<br />", array_unique($user_ids))); } else { $this->tpl->setVariable("TXT_CURRENT_USER", ""); } } } else { if ($this->may_edit) { include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php'; $reservation = ilBookingReservation::getCurrentOrUpcomingReservation($a_set['booking_object_id']); if ($reservation) { $date_from = new ilDateTime($reservation['date_from'], IL_CAL_UNIX); $date_to = new ilDateTime($reservation['date_to'], IL_CAL_UNIX); $this->tpl->setVariable("TXT_CURRENT_USER", ilObjUser::_lookupFullName($reservation['user_id'])); $this->tpl->setVariable("VALUE_DATE", ilDatePresentation::formatPeriod($date_from, $date_to)); $has_reservations = true; } else { $this->tpl->setVariable("TXT_CURRENT_USER", ""); $this->tpl->setVariable("VALUE_DATE", ""); } } } $items = array(); $ilCtrl->setParameter($this->parent_obj, 'object_id', $a_set['booking_object_id']); if ($a_set['info_file']) { $items['info'] = array($lng->txt('book_download_info'), $ilCtrl->getLinkTarget($this->parent_obj, 'deliverInfo')); } if (!$has_booking) { if ($booking_possible) { $items['book'] = array($lng->txt('book_book'), $ilCtrl->getLinkTarget($this->parent_obj, 'book')); } } else { if (trim($a_set['post_text']) || $a_set['post_file']) { $items['post'] = array($lng->txt('book_post_booking_information'), $ilCtrl->getLinkTarget($this->parent_obj, 'displayPostInfo')); } $items['cancel'] = array($lng->txt('book_set_cancel'), $ilCtrl->getLinkTarget($this->parent_obj, 'rsvCancelUser')); } if ($this->may_edit) { // #10890 if (!$has_reservations) { $items['delete'] = array($lng->txt('delete'), $ilCtrl->getLinkTarget($this->parent_obj, 'confirmDelete')); } $items['edit'] = array($lng->txt('edit'), $ilCtrl->getLinkTarget($this->parent_obj, 'edit')); } if (sizeof($items)) { $this->tpl->setCurrentBlock("actions"); foreach ($items as $item) { $this->tpl->setVariable("ACTION_CAPTION", $item[0]); $this->tpl->setVariable("ACTION_LINK", $item[1]); $this->tpl->parseCurrentBlock(); } } }