/**
  * This method return a singleton instance of __SessionManager
  *
  * @return __SessionManager A singleton reference to the __SessionManager
  */
 public static function &getInstance()
 {
     if (self::$_instance == null) {
         // Use "Lazy initialization"
         self::$_instance = new __SessionManager();
     }
     return self::$_instance;
 }
 public function handleEvent(__UIEvent &$event)
 {
     $event_name = strtoupper($event->getEventName());
     switch ($event_name) {
         case 'UPLOADING':
             //free the session to allow more incoming requests:
             //@todo change the session handler to synchronize sessions between requests
             __SessionManager::getInstance()->endSession();
             $this->setStatus(__IUploaderComponent::UPLOAD_STATUS_UPLOADING);
             $this->setProgress(0);
             while ($this->getStatus() == __IUploaderComponent::UPLOAD_STATUS_UPLOADING) {
                 $this->updateStatus();
                 sleep(1);
             }
             break;
         case 'CANCELUPLOAD':
             $this->reset();
             $this->setStatus(__IUploaderComponent::UPLOAD_STATUS_CANCELLED);
             break;
     }
 }
Ejemplo n.º 3
0
 /**
  * Gets the session associated to current context
  *
  * @return __Session
  */
 public function &getSession()
 {
     return __SessionManager::getInstance()->getSession($this->_context_id);
 }