當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ViewManager::setVariable方法代碼示例

本文整理匯總了PHP中ViewManager::setVariable方法的典型用法代碼示例。如果您正苦於以下問題:PHP ViewManager::setVariable方法的具體用法?PHP ViewManager::setVariable怎麽用?PHP ViewManager::setVariable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ViewManager的用法示例。


在下文中一共展示了ViewManager::setVariable方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 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"]);
     }
 }
開發者ID:ragomez,項目名稱:abp2015,代碼行數:26,代碼來源:BaseController.php

示例2: __construct

 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());
     }
 }
開發者ID:xrlopez,項目名稱:ABP,代碼行數:13,代碼來源:BaseController.php

示例3: __construct

 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);
     }
 }
開發者ID:adri229,項目名稱:TSW_Proyect,代碼行數:20,代碼來源:BaseController.php


注:本文中的ViewManager::setVariable方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。