Пример #1
0
 /**
  * Action dedicated to change the settings of the user (language, ...)
  */
 public function properties()
 {
     $myFormContainer = new tao_actions_form_UserSettings($this->getUserSettings());
     $myForm = $myFormContainer->getForm();
     if ($myForm->isSubmited()) {
         if ($myForm->isValid()) {
             $currentUser = $this->userService->getCurrentUser();
             $userSettings = array(PROPERTY_USER_UILG => $myForm->getValue('ui_lang'), PROPERTY_USER_DEFLG => $myForm->getValue('data_lang'), PROPERTY_USER_TIMEZONE => $myForm->getValue('timezone'));
             $uiLang = new core_kernel_classes_Resource($myForm->getValue('ui_lang'));
             $dataLang = new core_kernel_classes_Resource($myForm->getValue('data_lang'));
             $userSettings[PROPERTY_USER_UILG] = $uiLang->getUri();
             $userSettings[PROPERTY_USER_DEFLG] = $dataLang->getUri();
             $binder = new tao_models_classes_dataBinding_GenerisFormDataBinder($currentUser);
             if ($binder->bind($userSettings)) {
                 \common_session_SessionManager::getSession()->refresh();
                 $uiLangCode = tao_models_classes_LanguageService::singleton()->getCode($uiLang);
                 $extension = common_ext_ExtensionsManager::singleton()->getExtensionById('tao');
                 tao_helpers_I18n::init($extension, $uiLangCode);
                 $this->setData('message', __('Settings updated'));
                 $this->setData('reload', true);
             }
         }
     }
     $userLabel = $this->userService->getCurrentUser()->getLabel();
     $this->setData('formTitle', sprintf(__("My settings (%s)"), __($userLabel)));
     $this->setData('myForm', $myForm->render());
     //$this->setView('form.tpl');
     $this->setView('form/settings_user.tpl');
 }
 /**
  * Dispalys a date/time
  * Should in theorie be dependant on the users locale and timezone
  *
  * @param mixed $timestamp            
  * @param int $format  The date format. See tao_helpers_Date's constants.
  * @return string The formatted date.
  */
 public static function displayeDate($timestamp, $format = self::FORMAT_LONG)
 {
     $returnValue = '';
     if (is_object($timestamp) && $timestamp instanceof core_kernel_classes_Literal) {
         $dateTime = new DateTime();
         $dateTime->setTimestamp($timestamp->__toString());
     } else {
         if (is_object($timestamp) && $timestamp instanceof DateTime) {
             $dateTime = $timestamp;
         } else {
             $dateTime = new DateTime();
             $dateTime->setTimestamp($timestamp);
         }
     }
     $dateTime->setTimezone(new DateTimeZone(common_session_SessionManager::getSession()->getTimeZone()));
     switch ($format) {
         case self::FORMAT_LONG:
             $returnValue = $dateTime->format('d/m/Y H:i:s');
             break;
         case self::FORMAT_DATEPICKER:
             $returnValue = $dateTime->format('Y-m-d H:i');
             break;
         case self::FORMAT_VERBOSE:
             $returnValue = $dateTime->format('F j, Y, g:i:s a');
             break;
         default:
             common_Logger::w('Unkown date format ' . $format . ' for ' . __FUNCTION__, 'TAO');
     }
     return $returnValue;
 }
Пример #3
0
 public static function getServiceStorage($serviceCallId)
 {
     $serviceService = ServiceManager::getServiceManager()->get('tao/stateStorage');
     $state = $serviceService->get(common_session_SessionManager::getSession()->getUserUri(), $serviceCallId);
     $submitUrl = _url('submitState', 'ServiceModule', 'tao', array('serviceCallId' => $serviceCallId));
     return 'new StateStorage(' . tao_helpers_Javascript::buildObject($state) . ', ' . tao_helpers_Javascript::buildObject($submitUrl) . ')';
 }
 public function index()
 {
     $userId = common_session_SessionManager::getSession()->getUserUri();
     if (is_null($userId)) {
         throw new common_exception_Error('No user is logged in');
     }
     $lang = common_session_SessionManager::getSession()->getDataLanguage();
     if ($this->hasRequestParameter('serviceCallId')) {
         $serviceCallId = $this->getRequestParameter('serviceCallId');
         $variableData = tao_models_classes_service_StateStorage::singleton()->get($userId, $serviceCallId);
         $this->setData('storageData', array('serial' => $serviceCallId, 'data' => is_null($variableData) ? array() : $variableData));
     }
     $directory = $this->getDirectory($this->getRequestParameter('itemPath'));
     $basepath = $directory->getPath();
     if (!file_exists($basepath . $lang) && file_exists($basepath . DEFAULT_LANG)) {
         $lang = DEFAULT_LANG;
     }
     $this->setData('itemPath', $directory->getPublicAccessUrl() . $lang . '/index.html');
     $this->setData('itemId', $this->getRequestParameter('itemUri'));
     $this->setData('resultServerEndpoint', $this->getResultServerEndpoint());
     $this->setData('resultServerParams', $this->getResultServerParams());
     $this->setData('client_timeout', $this->getClientTimeout());
     $this->setData('client_config_url', $this->getClientConfigUrl());
     $this->selectView();
 }
 /**
  * Compatibility class for old implementation
  * 
  * @param string $extension
  * @param string $controller
  * @param string $action
  * @param array $parameters
  * @return boolean
  * @deprecated
  */
 public function hasAccess($action, $controller, $extension, $parameters = array())
 {
     $user = common_session_SessionManager::getSession()->getUser();
     $uri = funcAcl_models_classes_ModuleAccessService::singleton()->makeEMAUri($extension, $controller);
     $controllerClassName = funcAcl_helpers_Map::getControllerFromUri($uri);
     return self::accessPossible($user, $controllerClassName, $action);
 }
Пример #6
0
 /**
  * (non-PHPdoc)
  * @see FrontController::loadModule()
  */
 public function loadModule()
 {
     $resolver = new Resolver($this->getRequest());
     // load the responsible extension
     $ext = common_ext_ExtensionsManager::singleton()->getExtensionById($resolver->getExtensionId());
     \Context::getInstance()->setExtensionName($resolver->getExtensionId());
     // load translations
     $uiLang = \common_session_SessionManager::getSession()->getInterfaceLanguage();
     \tao_helpers_I18n::init($ext, $uiLang);
     //if the controller is a rest controller we try to authenticate the user
     $controllerClass = $resolver->getControllerClass();
     if (is_subclass_of($controllerClass, 'tao_actions_CommonRestModule')) {
         $authAdapter = new \tao_models_classes_HttpBasicAuthAdapter(common_http_Request::currentRequest());
         try {
             $user = $authAdapter->authenticate();
             $session = new \common_session_RestSession($user);
             \common_session_SessionManager::startSession($session);
         } catch (\common_user_auth_AuthFailedException $e) {
             $class = new $controllerClass();
             $class->requireLogin();
         }
     }
     try {
         $enforcer = new ActionEnforcer($resolver->getExtensionId(), $resolver->getControllerClass(), $resolver->getMethodName(), $this->getRequest()->getParams());
         $enforcer->execute();
     } catch (InterruptedActionException $iE) {
         // Nothing to do here.
     }
 }
Пример #7
0
 /**
  * Get the URI (Uniform Resource Identifier) of the user the Test Session belongs to.
  *
  * @return string
  */
 public function getUserUri()
 {
     if (is_null($this->userUri)) {
         return \common_session_SessionManager::getSession()->getUserUri();
     }
     return $this->userUri;
 }
Пример #8
0
 /**
  *
  * @author Lionel Lecaque, lionel@taotesting.com
  */
 public function testDisplayDateDefaultTimeZone()
 {
     $mybirthday = DateTime::createFromFormat('Y-m-d H:i:s.u', '1980-02-01 10:00:00.012345', new \DateTimeZone(\common_session_SessionManager::getSession()->getTimeZone()));
     $this->assertEquals('01/02/1980 10:00:00', tao_helpers_Date::displayeDate($mybirthday));
     $this->assertEquals('01/02/1980 10:00:00', tao_helpers_Date::displayeDate($mybirthday, tao_helpers_Date::FORMAT_LONG));
     $this->assertEquals('1980-02-01 10:00', tao_helpers_Date::displayeDate($mybirthday, tao_helpers_Date::FORMAT_DATEPICKER));
     $this->assertEquals('February 1, 1980, 10:00:00 am', tao_helpers_Date::displayeDate($mybirthday, tao_helpers_Date::FORMAT_VERBOSE));
     $this->assertEquals('1980-02-01T10:00:00.012', tao_helpers_Date::displayeDate($mybirthday, tao_helpers_Date::FORMAT_ISO8601));
     $mybirthdayTs = $mybirthday->getTimeStamp();
     $this->assertEquals('01/02/1980 10:00:00', tao_helpers_Date::displayeDate($mybirthdayTs));
     $this->assertEquals('01/02/1980 10:00:00', tao_helpers_Date::displayeDate($mybirthdayTs, tao_helpers_Date::FORMAT_LONG));
     $this->assertEquals('1980-02-01 10:00', tao_helpers_Date::displayeDate($mybirthdayTs, tao_helpers_Date::FORMAT_DATEPICKER));
     $this->assertEquals('February 1, 1980, 10:00:00 am', tao_helpers_Date::displayeDate($mybirthdayTs, tao_helpers_Date::FORMAT_VERBOSE));
     $this->assertEquals('1980-02-01T10:00:00.000', tao_helpers_Date::displayeDate($mybirthdayTs, tao_helpers_Date::FORMAT_ISO8601));
     $literal = new \core_kernel_classes_Literal($mybirthdayTs);
     $this->assertEquals('01/02/1980 10:00:00', tao_helpers_Date::displayeDate($literal));
     $this->assertEquals('01/02/1980 10:00:00', tao_helpers_Date::displayeDate($literal, tao_helpers_Date::FORMAT_LONG));
     $this->assertEquals('1980-02-01 10:00', tao_helpers_Date::displayeDate($literal, tao_helpers_Date::FORMAT_DATEPICKER));
     $this->assertEquals('February 1, 1980, 10:00:00 am', tao_helpers_Date::displayeDate($literal, tao_helpers_Date::FORMAT_VERBOSE));
     $this->assertEquals('1980-02-01T10:00:00.000', tao_helpers_Date::displayeDate($literal, tao_helpers_Date::FORMAT_ISO8601));
     $ms = tao_helpers_Date::getTimeStampWithMicroseconds($mybirthday);
     $this->assertEquals('01/02/1980 10:00:00', tao_helpers_Date::displayeDate($ms));
     $this->assertEquals('01/02/1980 10:00:00', tao_helpers_Date::displayeDate($ms, tao_helpers_Date::FORMAT_LONG));
     $this->assertEquals('1980-02-01 10:00', tao_helpers_Date::displayeDate($ms, tao_helpers_Date::FORMAT_DATEPICKER));
     $this->assertEquals('February 1, 1980, 10:00:00 am', tao_helpers_Date::displayeDate($ms, tao_helpers_Date::FORMAT_VERBOSE));
     $this->assertEquals('1980-02-01T10:00:00.012', tao_helpers_Date::displayeDate($ms, tao_helpers_Date::FORMAT_ISO8601));
 }
 /**
  * Stores extended state information
  * @param string $testSessionId
  * @param array $extra
  */
 protected function saveExtra($testSessionId, $extra)
 {
     self::$cache[$testSessionId] = $extra;
     $storageService = \tao_models_classes_service_StateStorage::singleton();
     $userUri = \common_session_SessionManager::getSession()->getUserUri();
     $storageService->set($userUri, self::STORAGE_PREFIX . $testSessionId, json_encode($extra));
 }
 public function __construct()
 {
     parent::__construct();
     $tzName = $this->getRequestParameter('timeZone') === null ? \common_session_SessionManager::getSession()->getTimeZone() : $this->getRequestParameter('timeZone');
     $this->tz = new \DateTimeZone($tzName);
     $this->scheduleService = DeliveryScheduleService::singleton();
     $this->service = DeliveryAssemblyService::singleton();
     switch ($this->getRequestMethod()) {
         case "GET":
             $this->action = 'get';
             break;
         case "PUT":
             $this->action = 'update';
             break;
         case "POST":
             $this->action = 'create';
             break;
         case "DELETE":
             $this->action = 'deleteDelivery';
             break;
         default:
             $this->sendData(array('message' => 'Not found'), 404);
             exit;
     }
 }
Пример #11
0
 /**
  * Run the controller
  * 
  * @param common_http_Request $pRequest
  * @throws \ActionEnforcingException
  * @throws \Exception
  * @throws \common_exception_Error
  * @throws \common_ext_ExtensionException
  */
 public function legacy(common_http_Request $pRequest)
 {
     $resolver = new Resolver($pRequest);
     // load the responsible extension
     $ext = common_ext_ExtensionsManager::singleton()->getExtensionById($resolver->getExtensionId());
     \Context::getInstance()->setExtensionName($resolver->getExtensionId());
     // load translations
     $uiLang = \common_session_SessionManager::getSession()->getInterfaceLanguage();
     \tao_helpers_I18n::init($ext, $uiLang);
     //if the controller is a rest controller we try to authenticate the user
     $controllerClass = $resolver->getControllerClass();
     if (is_subclass_of($controllerClass, \tao_actions_RestController::class)) {
         $authAdapter = new \tao_models_classes_HttpBasicAuthAdapter(common_http_Request::currentRequest());
         try {
             $user = $authAdapter->authenticate();
             $session = new \common_session_RestSession($user);
             \common_session_SessionManager::startSession($session);
         } catch (\common_user_auth_AuthFailedException $e) {
             $data['success'] = false;
             $data['errorCode'] = '401';
             $data['errorMsg'] = 'You are not authorized to access this functionality.';
             $data['version'] = TAO_VERSION;
             header('HTTP/1.0 401 Unauthorized');
             header('WWW-Authenticate: Basic realm="' . GENERIS_INSTANCE_NAME . '"');
             echo json_encode($data);
             exit(0);
         }
     }
     try {
         $enforcer = new ActionEnforcer($resolver->getExtensionId(), $resolver->getControllerClass(), $resolver->getMethodName(), $pRequest->getParams());
         $enforcer->execute();
     } catch (InterruptedActionException $iE) {
         // Nothing to do here.
     }
 }
 public function sendSelfMsg()
 {
     $message = new Message();
     $message->setTo(\common_session_SessionManager::getSession()->getUser());
     $message->setBody('<h1>Tao Dev Message send on the ' . \tao_helpers_Date::displayeDate(time()) . '</h1>');
     $success = MessagingService::singleton()->send($message);
     return $this->returnJson(array('success' => $success, 'message' => __('Send a message')));
 }
Пример #13
0
 /**
  * Get the flysystem path to the compilation folder described by $directory.
  * 
  * @param tao_models_classes_service_StorageDirectory $directory The root directory resource where the item is stored.
  * @return string The flysystem path to the private folder with a trailing directory separator.
  */
 public static function getPrivatePathByLanguage(tao_models_classes_service_StorageDirectory $directory)
 {
     $lang = \common_session_SessionManager::getSession()->getDataLanguage();
     if (!$directory->has($lang) && $directory->has(DEFAULT_LANG)) {
         $lang = DEFAULT_LANG;
     }
     return $lang . DIRECTORY_SEPARATOR;
 }
Пример #14
0
 /**
  * Returns the current LTI session
  * @return taoLti_models_classes_TaoLtiSession 
  */
 public function getLtiSession()
 {
     $session = common_session_SessionManager::getSession();
     if (!$session instanceof taoLti_models_classes_TaoLtiSession) {
         throw new taoLti_models_classes_LtiException(__FUNCTION__ . ' called on a non LTI session');
     }
     return $session;
 }
Пример #15
0
 public function restore()
 {
     $currentSession = \common_session_SessionManager::getSession();
     if ($currentSession instanceof \common_session_RestrictedSession) {
         $currentSession->restoreOriginal();
     }
     $this->redirect(_url('index', 'Main', 'tao'));
 }
 public static function getCurrentUserMap()
 {
     $user = \common_session_SessionManager::getSession()->getUser();
     if (is_null(self::$current) || self::$current->getUserId() != $user->getIdentifier()) {
         self::$current = new self($user->getIdentifier());
     }
     return self::$current;
 }
 protected function getDescription()
 {
     $propMaxExec = $this->delivery->getOnePropertyValue(new core_kernel_classes_Property(TAO_DELIVERY_MAXEXEC_PROP));
     $maxExecs = is_null($propMaxExec) ? 0 : $propMaxExec->literal;
     $user = \common_session_SessionManager::getSession()->getUser();
     $countExecs = count(\taoDelivery_models_classes_execution_ServiceProxy::singleton()->getUserExecutions($this->delivery, $user->getIdentifier()));
     return $this->buildDescriptionFromData($this->startTime, $this->endTime, $countExecs, $maxExecs);
 }
Пример #18
0
 /**
  * Get the absolute path to the compilation folder described by $directory.
  * 
  * @param tao_models_classes_service_StorageDirectory $director The root directory resource where the item is stored.
  * @return string The local path to the private folder with a trailing directory separator.
  */
 public static function getPrivateFolderPath(tao_models_classes_service_StorageDirectory $directory)
 {
     $lang = \common_session_SessionManager::getSession()->getDataLanguage();
     $basepath = $directory->getPath();
     if (!file_exists($basepath . $lang) && file_exists($basepath . DEFAULT_LANG)) {
         $lang = DEFAULT_LANG;
     }
     return $basepath . $lang . DIRECTORY_SEPARATOR;
 }
Пример #19
0
 public function getUserPropertyValues()
 {
     if (!$this->hasRequestParameter('property')) {
         throw new common_exception_MissingParameter('property');
     }
     $property = $this->getRequestParameter('property');
     $values = common_session_SessionManager::getSession()->getUserPropertyValues($property);
     echo json_encode(array('success' => true, 'data' => array($property => $values)));
 }
 /**
  * (non-PHPdoc)
  * @see \oat\taoRevision\model\Repository::restore()
  */
 public function restore(Revision $revision)
 {
     $lockManager = LockManager::getImplementation();
     $resource = new \core_kernel_classes_Resource($revision->getResourceId());
     if ($lockManager->isLocked($resource)) {
         $userId = \common_session_SessionManager::getSession()->getUser()->getIdentifier();
         $lockManager->releaseLock($resource, $userId);
     }
     return $this->getInner()->restore($revision);
 }
Пример #21
0
 public function getEvaluatedValue()
 {
     $returnValue = $this->getRawValue();
     if (!empty($returnValue)) {
         $tz = new DateTimeZone(common_session_SessionManager::getSession()->getTimeZone());
         $dt = new DateTime($returnValue, $tz);
         $returnValue = $dt->getTimestamp() . '';
     }
     return $returnValue;
 }
 public function repeat()
 {
     $delivery = new \core_kernel_classes_Resource($this->getRequestParameter('delivery'));
     // is allowed?
     // is active?
     $remoteLink = \taoLti_models_classes_LtiService::singleton()->getLtiSession()->getLtiLinkResource();
     $userId = \common_session_SessionManager::getSession()->getUserUri();
     $newExecution = LTIDeliveryTool::singleton()->startDelivery($delivery, $remoteLink, $userId);
     $this->redirect(_url('runDeliveryExecution', null, null, array('deliveryExecution' => $newExecution->getIdentifier())));
 }
 /**
  * Return edit delivery form markup
  */
 public function editDeliveryForm()
 {
     $clazz = new \core_kernel_classes_Class(CLASS_COMPILEDDELIVERY);
     $formContainer = new EditDeliveryForm($clazz);
     $myForm = $formContainer->getForm();
     $this->setData('form', $myForm);
     $this->setData('userTimeZone', \common_session_SessionManager::getSession()->getTimeZone());
     $this->setData('timeZones', DeliveryScheduleService::singleton()->getTimeZones());
     $this->setView('editDeliveryForm.tpl');
 }
Пример #24
0
 public function createTask($actionId, $parameters)
 {
     $task = new JsonTask($actionId, $parameters);
     $platform = $this->getPersistence()->getPlatForm();
     $query = 'INSERT INTO ' . self::QUEUE_TABLE_NAME . ' (' . self::QUEUE_OWNER . ', ' . self::QUEUE_TASK . ', ' . self::QUEUE_STATUS . ', ' . self::QUEUE_ADDED . ', ' . self::QUEUE_UPDATED . ') ' . 'VALUES  (?, ?, ?, ?, ?)';
     $persitence = $this->getPersistence();
     $returnValue = $persitence->exec($query, array(\common_session_SessionManager::getSession()->getUser()->getIdentifier(), json_encode($task), Task::STATUS_CREATED, $platform->getNowExpression(), $platform->getNowExpression()));
     $task->setId($persitence->lastInsertId(self::QUEUE_TABLE_NAME));
     return $task;
 }
 /**
  * Overriden export from QTI items.
  *
  * @param array $options An array of options.
  * @see taoItems_models_classes_ItemExporter::export()
  */
 public function export($options = array())
 {
     $asApip = isset($options['apip']) && $options['apip'] === true;
     $lang = \common_session_SessionManager::getSession()->getDataLanguage();
     $basePath = $this->buildBasePath();
     $dataFile = (string) $this->getItemModel()->getOnePropertyValue(new core_kernel_classes_Property(TAO_ITEM_MODEL_DATAFILE_PROPERTY));
     $content = $this->getItemService()->getItemContent($this->getItem());
     $resolver = new ItemMediaResolver($this->getItem(), $lang);
     // get the local resources and add them
     foreach ($this->getAssets($this->getItem(), $lang) as $assetUrl) {
         $mediaAsset = $resolver->resolve($assetUrl);
         $mediaSource = $mediaAsset->getMediaSource();
         if (get_class($mediaSource) !== 'oat\\tao\\model\\media\\sourceStrategy\\HttpSource') {
             $srcPath = $mediaSource->download($mediaAsset->getMediaIdentifier());
             $fileInfo = $mediaSource->getFileInfo($mediaAsset->getMediaIdentifier());
             $filename = $fileInfo['filePath'];
             $replacement = $mediaAsset->getMediaIdentifier();
             if ($mediaAsset->getMediaIdentifier() !== $fileInfo['uri']) {
                 $replacement = $filename;
             }
             $destPath = ltrim($filename, '/');
             if (file_exists($srcPath)) {
                 $this->addFile($srcPath, $basePath . '/' . $destPath);
                 $content = str_replace($assetUrl, $replacement, $content);
             } else {
                 throw new \Exception('Missing resource ' . $srcPath);
             }
         }
     }
     if ($asApip === true) {
         // 1. let's merge qti.xml and apip.xml.
         // 2. retrieve apip related assets.
         $apipService = ApipService::singleton();
         $apipContentDoc = $apipService->getApipAccessibilityContent($this->getItem());
         if ($apipContentDoc === null) {
             \common_Logger::i("No APIP accessibility content found for item '" . $this->getItem()->getUri() . "', default inserted.");
             $apipContentDoc = $apipService->getDefaultApipAccessibilityContent($this->getItem());
         }
         $qtiItemDoc = new DOMDocument('1.0', 'UTF-8');
         $qtiItemDoc->formatOutput = true;
         $qtiItemDoc->loadXML($content);
         // Let's merge QTI and APIP Accessibility!
         Apip::mergeApipAccessibility($qtiItemDoc, $apipContentDoc);
         $content = $qtiItemDoc->saveXML();
         $fileHrefElts = $qtiItemDoc->getElementsByTagName('fileHref');
         for ($i = 0; $i < $fileHrefElts->length; $i++) {
             $fileHrefElt = $fileHrefElts->item($i);
             $destPath = $basePath . '/' . $fileHrefElt->nodeValue;
             $sourcePath = $this->getItemLocation() . $fileHrefElt->nodeValue;
             $this->addFile($sourcePath, $destPath);
         }
     }
     // add xml file
     $this->getZip()->addFromString($basePath . '/' . $dataFile, $content);
 }
Пример #26
0
 /**
  * Does not respect params
  * 
  * @param string $url
  * @return boolean
  */
 public static function hasAccessUrl($url)
 {
     $user = common_session_SessionManager::getSession()->getUser();
     try {
         $resolver = new ActionResolver($url);
         return AclProxy::hasAccess($user, $resolver->getController(), $resolver->getAction(), array());
         $className = $resolver->getController();
     } catch (ResolverException $e) {
         return false;
     }
 }
 /**
  * Gets a list of available deliveries
  *
  * @return array
  * @throws ServiceNotFoundException
  * @throws \common_Exception
  * @throws \common_exception_Error
  */
 private function getDeliveries()
 {
     $deliveryService = $this->getServiceManager()->get('taoProctoring/delivery');
     $currentUser = \common_session_SessionManager::getSession()->getUser();
     $deliveries = $deliveryService->getProctorableDeliveries($currentUser);
     $entries = array();
     foreach ($deliveries as $delivery) {
         $entries[] = array('url' => _url('index', 'ProctorDelivery', null, array('id' => $delivery->getId())), 'label' => $delivery->getLabel(), 'text' => __('Manage'));
     }
     return $entries;
 }
 /**
  * Gets a list of available test sites
  *
  * @param array [$options]
  * @return array
  * @throws ServiceNotFoundException
  * @throws \common_Exception
  * @throws \common_exception_Error
  */
 public static function getTestCenters($options = array())
 {
     $testCenterService = TestCenterService::singleton();
     $currentUser = \common_session_SessionManager::getSession()->getUser();
     $testCenters = $testCenterService->getTestCentersByProctor($currentUser, $options);
     $entries = array();
     foreach ($testCenters as $testCenter) {
         $entries[] = array('id' => $testCenter->getUri(), 'url' => _url('testCenter', 'TestCenter', null, array('testCenter' => $testCenter->getUri())), 'label' => $testCenter->getLabel(), 'text' => __('Go to'));
     }
     return $entries;
 }
Пример #29
0
 /**
  * (non-PHPdoc)
  * @see \oat\taoRevision\model\Repository::commit()
  */
 public function commit($resourceId, $message, $version)
 {
     $user = \common_session_SessionManager::getSession()->getUser();
     $userId = is_null($user) ? null : $user->getIdentifier();
     $created = time();
     // save data
     $resource = new \core_kernel_classes_Resource($resourceId);
     $data = CloneHelper::deepCloneTriples($resource->getRdfTriples());
     $revision = $this->getStorage()->addRevision($resourceId, $version, $created, $userId, $message, $data);
     return $revision;
 }
Пример #30
0
 /**
  * constructor: initialize the service and the default data
  * @access public
  */
 public function notCompatibleEnvironment()
 {
     $entryPoints = $this->getServiceManager()->get(EntryPointService::SERVICE_ID)->getEntryPoints();
     $deliveryServerUrl = $entryPoints['deliveryServer']->getUrl();
     $this->setData('client_config_url', $this->getClientConfigUrl());
     $this->setData('returnUrl', $deliveryServerUrl);
     $this->setData('showControls', false);
     $this->setData('userLabel', \common_session_SessionManager::getSession()->getUserLabel());
     $this->setData('content-template', 'Error/notCompatibleEnvironment.tpl');
     $this->setData('content-extension', 'taoClientRestrict');
     $this->setView('DeliveryServer/layout.tpl', 'taoDelivery');
 }