示例#1
0
 public static function getInstance()
 {
     $backendFactory = BackendProvider::getInstance();
     return new StudiumController($backendFactory->newVSES017Factory(), $backendFactory->getServerTime(), LoginManager::getInstance(), DisplayManager::getInstance(), Router::getInstance(), Warnings::getInstance(), SessionStorageProvider::getInstance());
 }
示例#2
0
 public static function getInstance()
 {
     $backendFactory = BackendProvider::getInstance();
     return new PredmetyController($backendFactory->newVSST060Factory(), $backendFactory->getServerTime(), DisplayManager::getInstance(), Router::getInstance());
 }
示例#3
0
文件: Fajr.php 项目: BGCX067/fajr-git
 public function runLogic(Trace $trace)
 {
     try {
         $params = $this->router->routeCurrentRequest();
     } catch (ResourceNotFoundException $e) {
         return $this->displayManager->renderResponse('notfound', array(), 'html', 404);
     }
     $action = $params['_action'];
     $controllerClass = $params['_controller'];
     $session = SessionStorageProvider::getInstance();
     $loginManager = LoginManager::getInstance();
     // If we are going to log in, we need a clean session.
     // This needs to be done before a connection
     // is created, because we pass cookie file name
     // that contains session_id into AIS2CurlConnection
     if ($action == 'Login') {
         $loginManager->destroySession();
     }
     $connection = ConnectionProvider::getInstance();
     $server = $this->serverManager->getActiveServer();
     $serverConnection = new AIS2ServerConnection($connection, new AIS2ServerUrlMap($server->getServerName()));
     $connService = LazyServerConnection::getInstance();
     $connService->setReal($serverConnection);
     $loggedIn = $loginManager->isLoggedIn($serverConnection);
     if (!$loggedIn) {
         try {
             $loggedIn = $loginManager->relogin();
         } catch (ReloginFailedException $ex) {
             $loginManager->destroySession();
             return new \Symfony\Component\HttpFoundation\RedirectResponse($this->router->generateUrl('homepage'));
         }
     }
     $this->displayManager->setDefaultParams(array('loggedIn' => $loggedIn));
     if ($loggedIn) {
         $backendFactory = BackendProvider::getInstance();
         $mainScreen = $backendFactory->newAIS2MainScreen();
         if (($aisVersion = $session->read('ais/aisVersion')) == null) {
             $aisVersion = $mainScreen->getAisVersion($trace->addChild('Get AIS version'));
             $session->write('ais/aisVersion', $aisVersion);
         }
         $this->displayManager->setDefaultParams(array('aisVersion' => $aisVersion, 'aisVersionIncompatible' => !($aisVersion >= regression\VersionRange::getMinVersion() && $aisVersion <= regression\VersionRange::getMaxVersion())));
         if (($aisApps = $session->read('ais/aisApps')) == null) {
             $aisModules = array('SP', 'LZ', 'ES', 'ST', 'RH', 'UB', 'AS', 'RP');
             $aisApps = $mainScreen->getAllAvailableApplications($trace->addChild('Get all applications'), $aisModules);
             $session->write('ais/aisApps', $aisApps);
         }
         if (($userName = $session->read('ais/aisUserName')) == null) {
             $userName = $mainScreen->getFullUserName($trace->addChild('Get user name'));
             $session->write('ais/aisUserName', $userName);
         }
         $this->displayManager->setDefaultParams(array('aisUserName' => $userName));
     }
     $controller = call_user_func(array($controllerClass, 'getInstance'));
     if (!$controller instanceof Controller) {
         throw new Exception('Class "' . $controllerClass . '" is not a controller');
     }
     try {
         $subTrace = $trace->addChild('Action ' . $controllerClass . '->' . $action);
         return $controller->invokeAction($subTrace, $action, $this->request);
     } catch (AuthenticationRequiredException $ex) {
         return new \Symfony\Component\HttpFoundation\RedirectResponse($this->router->generateUrl('homepage'));
     }
 }