Пример #1
0
 public function __construct()
 {
     $this->view = ViewManager::getInstance();
     // get the current user and put it to the view
     if (session_status() == PHP_SESSION_NONE) {
         session_start();
     }
     if (isset($_SESSION["currentuser"])) {
         $this->currentUser = new User(NULL, $_SESSION["currentuser"]);
         //add current user to the view, since some views require it
         $usermapper = new UserMapper();
         $this->tipo = $usermapper->buscarPorLogin($_SESSION["currentuser"]);
         /* print_r($this->tipo);
            die();*/
         $this->view->setVariable("tipo", $this->tipo);
         $this->view->setVariable("currentusername", $this->currentUser->getLogin());
     }
     if (isset($_SESSION["currentcod1"]) && isset($_SESSION["currentcod2"]) && isset($_SESSION["currentcod3"])) {
         $codigomapper1 = new CodigoMapper();
         $this->currentCod1 = $codigomapper1->buscarPinchoPorCodigo($_SESSION["currentcod1"]);
         $codigomapper2 = new CodigoMapper();
         $this->currentCod2 = $codigomapper2->buscarPinchoPorCodigo($_SESSION["currentcod2"]);
         $codigomapper3 = new CodigoMapper();
         $this->currentCod3 = $codigomapper3->buscarPinchoPorCodigo($_SESSION["currentcod3"]);
     }
 }
Пример #2
0
 public function __construct()
 {
     $this->view = ViewManager::getInstance();
     // get the current user and put it to the view
     if (session_status() == PHP_SESSION_NONE) {
         session_start();
     }
     if (isset($_SESSION["currentuser"])) {
         $this->currentUser = new User($_SESSION["currentuser"]);
         //add current user to the view, since some views require it
         $this->view->setVariable("currentusername", $this->currentUser->getUsername());
     }
 }
Пример #3
0
 public function __construct()
 {
     $this->view = ViewManager::getInstance();
     // get the current user and put it to the view
     if (session_status() == PHP_SESSION_NONE) {
         session_start();
     }
     //inicializa la variable
     $this->friendDAO = new FriendDAO();
     if (isset($_SESSION["currentuser"])) {
         //En la sesion de currentuser se encuentra todo el usuario
         //ya que al hacer el login se introdujo todo el usuario en la sesion
         $this->currentUser = $_SESSION["currentuser"];
         $this->view->setVariable("currentusername", $this->currentUser);
         //consigue el numero total de solicitudes de amistad
         $numSolicitudes = $this->friendDAO->getNumSolicitudes($this->currentUser->getEmail());
         //Carga el num solicitudes en la vista
         $this->view->setVariable("numSolicitudes", $numSolicitudes);
     }
 }