当前位置: 首页>>代码示例>>PHP>>正文


PHP ViewManager类代码示例

本文整理汇总了PHP中ViewManager的典型用法代码示例。如果您正苦于以下问题:PHP ViewManager类的具体用法?PHP ViewManager怎么用?PHP ViewManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ViewManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: getInstance

 public static function getInstance()
 {
     if (self::$viewmanager_singleton == null) {
         self::$viewmanager_singleton = new ViewManager();
     }
     return self::$viewmanager_singleton;
 }
开发者ID:agonbar,项目名称:pinchOS,代码行数:7,代码来源:ViewManager.php

示例4: handleAdminOverview

 /**
  * handle admin overview request
  */
 private function handleAdminOverview()
 {
     $view = ViewManager::getInstance();
     $log = Logger::getInstance();
     $logfile = $log->getLogFile();
     if ($view->isType(self::VIEW_FILE)) {
         $request = Request::getInstance();
         $extension = ".log";
         $filename = $request->getDomain() . $extension;
         header("Content-type: application/{$extension}");
         header("Content-Length: " . filesize($logfile));
         // stupid bastards of microsnob: ie does not like attachment option
         $browser = $request->getValue('HTTP_USER_AGENT', Request::SERVER);
         if (strstr($browser, 'MSIE')) {
             header("Content-Disposition: filename=\"{$filename}\"");
         } else {
             header("Content-Disposition: attachment; filename=\"{$filename}\"");
         }
         readfile($logfile);
         exit;
     } else {
         $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
         $template->setVariable('logfile', nl2br(file_get_contents($logfile)), false);
         $url = new Url(true);
         $url->setParameter($view->getUrlId(), self::VIEW_FILE);
         $template->setVariable('href_export', $url->getUrl(true), false);
         $this->template[$this->director->theme->getConfig()->main_tag] = $template;
     }
 }
开发者ID:rverbrugge,项目名称:dif,代码行数:32,代码来源:Logging.php

示例5: Init

 /**
  * Initialize Page Manager
  *
  * ## Overview
  *
  * @uses SatanBarbaraApp
  * @uses SessionManager
  * @uses ViewManager
  * @uses DebugManager
  * @uses RouteManager
  * @uses PageView
  *
  * @see RouteManager
  *
  * @param array An array of creds for SendGrid API.
  * @return true Always unless fatal error or exception is thrown.
  *
  * @version 2015-07-05.1
  * @since 0.5.1b
  * @author TronNet DevOps [Sean Murray] <smurray@tronnet.me>
  */
 public static function Init($params)
 {
     DebugManager::Log("Initializing Page Manager", '@');
     DebugManager::Log($params);
     $appConfig = SatanBarbaraApp::GetConfig();
     /**
      * @todo have config in it's own 'config' position instead of array_merge
      */
     $data = array('app' => array_merge($appConfig[SATANBARBARA_CURRENT_ENVIRONMENT], array()), 'page' => $params);
     DebugManager::Log("checking if logged in...", null, 3);
     if (SessionManager::IsLoggedIn()) {
         $data['session'] = array('is_auth' => true, 'account' => SessionManager::GetAccount());
         DebugManager::Log("Got an account, checking for a saved program...", null, 3);
     }
     $Page = ucfirst($params['page']) . 'View';
     DebugManager::Log("Searching for view with class name: " . $Page);
     if ($Page::HasAccess(SessionManager::GetAccessLevel())) {
         $Page::Init($data);
         ViewManager::Render($Page);
     } else {
         DebugManager::Log("looks like this page requires auth but user isn't authenticated!");
         RouteManager::GoToPageURI('login');
     }
     return true;
 }
开发者ID:tronnetdevops,项目名称:metalsite-www,代码行数:46,代码来源:PageManager.php

示例6: __construct

 public function __construct()
 {
     $this->view = ViewManager::getInstance();
     if (session_status() == PHP_SESSION_NONE) {
         session_start();
     }
     if (isset($_SESSION["currentuser"])) {
         $this->currentUser = $_SESSION["currentuser"];
         $this->view->setVariable("currentusername", $this->currentUser);
     }
 }
开发者ID:agonbar,项目名称:pinchOS,代码行数:11,代码来源:DBController.php

示例7: __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

示例8: run

 /**
  * Runs action
  * @return boolean
  */
 function run()
 {
     if (file_exists('actions/' . $this->sAction['action'] . '.php')) {
         require_once 'actions/' . $this->sAction['action'] . '.php';
     } else {
         ErrorProcessor::generateError('Action Not Found ;]');
         return false;
     }
     $name = explode('/', $this->sAction['action']);
     $action = new $name[1]();
     return ViewManager::makeView($action->perform(), $this->sAction);
 }
开发者ID:BackupTheBerlios,项目名称:nemesis-system,代码行数:16,代码来源:kernel.php

示例9: handleHttpGetRequest

 /**
  * Handles data coming from a get request 
  * @param array HTTP request
  */
 public function handleHttpGetRequest()
 {
     $viewManager = ViewManager::getInstance();
     if ($viewManager->isType(ViewManager::OVERVIEW) && $this->director->isAdminSection()) {
         $viewManager->setType(ViewManager::ADMIN_OVERVIEW);
     }
     switch ($viewManager->getType()) {
         default:
             $this->handleAdminOverviewGet();
             break;
     }
 }
开发者ID:rverbrugge,项目名称:dif,代码行数:16,代码来源:UpdateHandler.php

示例10: control

 public function control()
 {
     $config = Config::getInstance();
     $this->addToView('is_registration_open', $config->getValue('is_registration_open'));
     if (isset($_POST['Submit']) && $_POST['Submit'] == 'Send Reset') {
         $this->disableCaching();
         $dao = DAOFactory::getDAO('OwnerDAO');
         $user = $dao->getByEmail($_POST['email']);
         if (isset($user)) {
             $token = $user->setPasswordRecoveryToken();
             $es = new ViewManager();
             $es->caching = false;
             $es->assign('apptitle', $config->getValue('app_title_prefix') . "ThinkUp");
             $es->assign('recovery_url', "session/reset.php?token={$token}");
             $es->assign('application_url', Utils::getApplicationURL($false));
             $es->assign('site_root_path', $config->getValue('site_root_path'));
             $message = $es->fetch('_email.forgotpassword.tpl');
             Mailer::mail($_POST['email'], $config->getValue('app_title_prefix') . "ThinkUp Password Recovery", $message);
             $this->addSuccessMessage('Password recovery information has been sent to your email address.');
         } else {
             $this->addErrorMessage('Error: account does not exist.');
         }
     }
     $this->view_mgr->addHelp('forgot', 'userguide/accounts/index');
     $this->setViewTemplate('session.forgot.tpl');
     return $this->generateView();
 }
开发者ID:kuthulas,项目名称:ProjectX,代码行数:27,代码来源:class.ForgotPasswordController.php

示例11: control

 public function control()
 {
     $this->redirectToSternIndiaEndpoint('forgot.php');
     $config = Config::getInstance();
     //$this->addToView('is_registration_open', $config->getValue('is_registration_open'));
     // if (isset($_POST['email']) && $_POST['Submit'] == 'Send Reset') {
     // /$_POST['email'] = 'prabhat@sternindia.com';
     if (isset($_POST['email'])) {
         $this->disableCaching();
         $dao = DAOFactory::getDAO('UserDAO');
         $user = $dao->getByEmail($_POST['email']);
         if (isset($user)) {
             $token = $user->setPasswordRecoveryToken();
             $es = new ViewManager();
             $es->caching = false;
             //$es->assign('apptitle', $config->getValue('app_title_prefix')."ThinkUp" );
             $es->assign('first_name', $user->first_name);
             $es->assign('recovery_url', "session/reset.php?token={$token}");
             $es->assign('application_url', Utils::getApplicationURL(false));
             $es->assign('site_root_path', $config->getValue('site_root_path'));
             $message = $es->fetch('_email.forgotpassword.tpl');
             $subject = $config->getValue('app_title_prefix') . "Stern India Password Recovery";
             //Will put the things in queue to mail the things.
             Resque::enqueue('user_mail', 'Mailer', array($_POST['email'], $subject, $message));
             $this->addToView('link_sent', true);
         } else {
             $this->addErrorMessage('Error: account does not exist.');
         }
     }
     $this->setViewTemplate('Session/forgot.tpl');
     return $this->generateView();
 }
开发者ID:prabhatse,项目名称:olx_hack,代码行数:32,代码来源:class.ForgotPasswordController.php

示例12: makeModel

 /**
  * @return str Object definition
  */
 public function makeModel()
 {
     //show full columns from table;
     $columns = array();
     try {
         $stmt = self::$pdo->query('SHOW FULL COLUMNS FROM ' . $this->table_name);
         while ($row = $stmt->fetch()) {
             $row['PHPType'] = $this->converMySQLTypeToPHP($row['Type']);
             $columns[$row['Field']] = $row;
         }
     } catch (Exception $e) {
         throw new Exception('Unable to show columns from "' . $this->table_name . '" - ' . $e->getMessage());
     }
     //instantiate Smarty, assign results to view
     $view_mgr = new ViewManager();
     $view_mgr->assign('fields', $columns);
     $view_mgr->assign('object_name', $this->object_name);
     //$view_mgr->assign('parent_name', $this->parent_name);
     $tpl_file = EFC_ROOT_PATH . 'makemodel/view/model_object.tpl';
     //output results
     $results = $view_mgr->fetch($tpl_file);
     return $results;
 }
开发者ID:prabhatse,项目名称:olx_hack,代码行数:26,代码来源:class.ModelMaker.php

示例13: handleExtensionPost

 private function handleExtensionPost()
 {
     $request = Request::getInstance();
     $template = new TemplateEngine();
     $view = ViewManager::getInstance();
     $this->renderExtension = true;
     if (!$request->exists('ext_id')) {
         throw new Exception('Extension ontbreekt.');
     }
     $id = intval($request->getValue('ext_id'));
     $template->setVariable('ext_id', $id, false);
     $url = new Url(true);
     $url_back = clone $url;
     $url_back->setParameter($view->getUrlId(), ViewManager::ADMIN_OVERVIEW);
     $url_back->clearParameter('ext_id');
     $extension = $this->director->extensionManager->getExtensionFromId(array('id' => $id));
     $extension->setReferer($this);
     $this->director->theme->handleAdminLinks($template, $this->getName(array('id' => $id)), $url_detail);
     $extension->handleHttpPostRequest();
 }
开发者ID:rverbrugge,项目名称:dif,代码行数:20,代码来源:ExtensionHandler.php

示例14: _updateTmpProducts

 public function _updateTmpProducts($array_product, $key)
 {
     $view_manager = new ViewManager();
     $result = $view_manager->_getSqlChangedProducts($array_product, $key);
     $connection = connectionServer();
     foreach ($result as $sql) {
         $res = null;
         $res = mysql_query($sql, $connection);
         if ($res) {
         } else {
             $errno = mysql_errno($connection);
             $error = mysql_error($connection);
             switch ($errno) {
                 case 1062:
                     throw new HandleOperationsException($error);
                     break;
                 default:
                     throw new HandleOperationsException($error);
                     break;
             }
         }
     }
     closeConnectionServer($connection);
 }
开发者ID:valucifer,项目名称:S-SoldP-Pal,代码行数:24,代码来源:UpdateTmpTables.php

示例15: sendDigestSinceWithTemplate

 /**
  * Send out insight email digest for a given time period.
  * @param Owner $owner Owner to send for
  * @param str $start When to start insight lookup
  * @param str $template Email view template to use
  * @param array $options Plugin options
  * return bool Whether email was sent
  */
 private function sendDigestSinceWithTemplate($owner, $start, $template, &$options)
 {
     $insights_dao = DAOFactory::GetDAO('InsightDAO');
     $start_time = date('Y-m-d H:i:s', strtotime($start, $this->current_timestamp));
     $insights = $insights_dao->getAllOwnerInstanceInsightsSince($owner->id, $start_time);
     if (count($insights) == 0) {
         return false;
     }
     $config = Config::getInstance();
     $view = new ViewManager();
     $view->caching = false;
     // If we've got a Mandrill key and template, send HTML
     if ($config->getValue('mandrill_api_key') != null && !empty($options['mandrill_template'])) {
         $view->assign('insights', $insights);
         $insights = $view->fetch(Utils::getPluginViewDirectory($this->folder_name) . '_email.insights_html.tpl');
         $parameters = array();
         $parameters['insights'] = $insights;
         $parameters['app_title'] = $config->getValue('app_title_prefix') . "ThinkUp";
         $parameters['app_url'] = Utils::getApplicationURL();
         $parameters['unsub_url'] = Utils::getApplicationURL() . 'account/index.php?m=manage#instances';
         // It's a weekly digest if we're going back more than a day or two.
         $days_ago = ($this->current_timestamp - strtotime($start)) / (60 * 60 * 24);
         $parameters['weekly_or_daily'] = $days_ago > 2 ? 'Weekly' : 'Daily';
         try {
             Mailer::mailHTMLViaMandrillTemplate($owner->email, 'ThinkUp has new insights for you!', $options['mandrill_template']->option_value, $parameters);
             return true;
         } catch (Mandrill_Unknown_Template $e) {
             // In this case, we'll fall back to plain text sending and warn the user in the log
             $logger = Logger::getInstance();
             $logger->logUserError("Invalid mandrill template configured:" . $options['mandrill_template']->option_value . ".", __METHOD__ . ',' . __LINE__);
             unset($options['mandrill_template']);
         }
     }
     $view->assign('apptitle', $config->getValue('app_title_prefix') . "ThinkUp");
     $view->assign('application_url', Utils::getApplicationURL());
     $view->assign('insights', $insights);
     $message = $view->fetch(Utils::getPluginViewDirectory($this->folder_name) . $template);
     list($subject, $message) = explode("\n", $message, 2);
     Mailer::mail($owner->email, $subject, $message);
     return true;
 }
开发者ID:jkuehl-carecloud,项目名称:ThinkUp,代码行数:49,代码来源:class.InsightsGeneratorPlugin.php


注:本文中的ViewManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。