/** * Get singelton instance * * @return ilViteroSettings */ public static function getInstance() { if (self::$instance) { return self::$instance; } return self::$instance = new ilViteroSettings(); }
protected function initClient($a_file_id, $a_file) { $clientConf = array('to' => $this->getSettings()->getServerUrl() . '/', 'useSOAP' => '1.1', 'useMTOM' => true, 'responseXOP' => true, 'CACert' => '/home/stefan/public_html/certs/vitero/cert.pem'); if (ilViteroSettings::getInstance()->getMTOMCert()) { $clientConf['CACert'] = ilViteroSettings::getInstance()->getMTOMCert(); } $this->client = new WSClient($clientConf); }
/** * Get available room sizes * * @return array */ public static function getRoomSizeList() { try { $licence_service = new ilViteroLicenceSoapConnector(); $modules = $licence_service->getModulesForCustomer(ilViteroSettings::getInstance()->getCustomer()); } catch (ilViteroConnectorException $e) { return array(); } $available_rooms = array(); foreach ((array) $modules->modules->module as $key => $mod) { if ($mod->type != 'ROOM') { continue; } $available_rooms[(int) $mod->roomsize] = (int) $mod->roomsize . ' ' . ilViteroPlugin::getInstance()->txt('participants'); } return $available_rooms; }
protected function createAppointment() { global $ilTabs; $form = $this->initAppointmentCreationForm(); $ilTabs->activateTab('content'); if (!$form->checkInput()) { $form->setValuesByPost(); ilUtil::sendFailure($this->lng->txt('err_check_input')); $GLOBALS['tpl']->setContent($form->getHTML()); return false; } // Save and create appointment $settings = ilViteroSettings::getInstance(); $room = new ilViteroRoom(); $room->setRoomSize($form->getInput('room_size')); if ($settings->isCafeEnabled() and $settings->isStandardRoomEnabled()) { if ($form->getInput('atype') == ilViteroRoom::TYPE_CAFE) { $room = $this->loadCafeSettings($form, $room); } else { $room = $this->loadStandardRoomSettings($form, $room); } $room->isCafe($form->getInput('atype') == ilViteroRoom::TYPE_CAFE); } elseif ($settings->isCafeEnabled()) { $this->loadCafeSettings($form, $room); } else { $this->loadStandardRoomSettings($form, $room); } try { $this->object->initAppointment($room); ilUtil::sendSuccess(ilViteroPlugin::getInstance()->txt('created_vitero'), true); $this->ctrl->redirect($this, 'showContent'); return true; } catch (ilViteroConnectorException $e) { ilUtil::sendFailure($e->getViteroMessage(), true); $form->setValuesByPost(); $GLOBALS['tpl']->setContent($form->getHTML()); } }
/** * Save form input (currently does not save anything to db) * */ public function save() { global $tpl, $lng, $ilCtrl, $ilTabs; $ilTabs->activateTab('settings'); $pl = $this->getPluginObject(); $form = $this->initConfigurationForm(); if ($form->checkInput()) { $this->getPluginObject()->includeClass('class.ilViteroSettings.php'); $settings = ilViteroSettings::getInstance(); $settings->setServerUrl($form->getInput('server_uri')); $settings->setAdminUser($form->getInput('admin_user')); if (strlen($form->getInput('admin_pass'))) { $settings->setAdminPass($form->getInput('admin_pass')); } $settings->setCustomer($form->getInput('customer')); $settings->useLdap($form->getInput('ldap')); $settings->enableCafe($form->getInput('cafe')); $settings->enableContentAdministration($form->getInput('content')); $settings->enableStandardRoom($form->getInput('std_room')); $settings->setWebstartUrl($form->getInput('webstart')); $settings->setUserPrefix($form->getInput('uprefix')); $settings->setStandardGracePeriodBefore($form->getInput('grace_period_before')); $settings->setStandardGracePeriodAfter($form->getInput('grace_period_after')); $settings->enableAvatar((int) $form->getInput('avatar')); $settings->setMTOMCert($form->getInput('mtom_cert')); $settings->save(); ilUtil::sendSuccess($lng->txt('settings_saved'), true); $ilCtrl->redirect($this, "configure"); } else { ilUtil::sendFailure($lng->txt('err_check_input'), true); $form->setValuesByPost(); $tpl->setContent($form->getHtml()); } }
/** * Load user data from ilias user object * @param stdclass $user * @param ilObjUser $iu */ private function loadFromUser($user, ilObjUser $iu) { $prefix = ilViteroSettings::getInstance()->getUserPrefix(); $user->username = $prefix . $iu->getLogin(); $user->surname = $iu->getLastname(); $user->firstname = $iu->getFirstname(); $user->email = $iu->getEmail(); $user->company = $iu->getInstitution(); $user->locale = in_array($iu->getLanguage(), $this->available_locales) ? $iu->getLanguage() : "en"; #$user->timezone = trim($iu->getTimeZone()); $GLOBALS['ilLog']->write(__METHOD__ . ': Time zone is ' . $iu->getTimeZone()); $user->phone = $iu->getPhoneOffice(); $user->fax = $iu->getFax(); $user->mobile = $iu->getPhoneMobile(); $user->country = $iu->getCountry(); $user->zip = $iu->getZipcode(); $user->city = $iu->getCity(); $user->street = $iu->getStreet(); }
public function initCustomer() { $this->customerid = (int) ilViteroSettings::getInstance()->getCustomer(); }
public function parseAdminTable(ilDateTime $start, ilDateTime $end) { $booking_list = array(); try { $con = new ilViteroBookingSoapConnector(); $bookings = $con->getBookingListByDate(ilViteroSettings::getInstance()->getCustomer(), $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); $booking_list[$counter]['rec'] = $booking->repetitionpattern; $booking_list[$counter]['id'] = $booking->bookingid; $booking_list[$counter]['start'] = $fstart; $booking_list[$counter]['startt'] = $fstart->get(IL_CAL_UNIX); $bend = ilViteroUtils::parseSoapDate($booking->end); $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)); } $booking_list[$counter]['group'] = ilObjVitero::lookupObjIdByGroupId($booking->groupid); $counter++; } $this->setMaxCount(count($booking_list)); $this->setData($booking_list); }
/** * Get instance */ public function __construct() { $this->plugin = ilViteroPlugin::getInstance(); $this->settings = ilViteroSettings::getInstance(); }