本文整理汇总了PHP中ViewManager类的典型用法代码示例。如果您正苦于以下问题:PHP ViewManager类的具体用法?PHP ViewManager怎么用?PHP ViewManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ViewManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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] <[email protected]>
*/
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'] = '[email protected]';
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
示例16: handleUserGet
/**
* handle user
*/
private function handleUserGet($retrieveFields = true)
{
$template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
$request = Request::getInstance();
if (!$request->exists('id')) {
throw new Exception('User group is missing.');
}
$id = intval($request->getValue('id'));
$template->setVariable('id', $id, false);
$key = array('id' => $id);
$user = $this->director->adminManager->getPlugin('User');
$usr_used = $request->getValue('usr_used');
if ($retrieveFields) {
$searchcriteria = array('grp_id' => $id);
$tmp = $user->getList($searchcriteria);
$usr_used = $tmp['data'];
}
$search_used = $usr_used ? array('id' => $usr_used) : NULL;
$search_free = $usr_used ? array('no_id' => $usr_used) : NULL;
$user_used = $usr_used ? $user->getList($search_used) : array('data' => '');
$user_free = $user->getList($search_free);
$template->setVariable('cbo_usr_used', Utils::getHtmlCombo($user_used['data'], NULL, NULL, 'id', 'formatName'));
$template->setVariable('cbo_usr_free', Utils::getHtmlCombo($user_free['data'], NULL, NULL, 'id', 'formatName'));
$view = ViewManager::getInstance();
$url = new Url(true);
$breadcrumb = array('name' => $view->getName(), 'path' => $url->getUrl(true));
$this->director->theme->addBreadcrumb($breadcrumb);
$url->setParameter($view->getUrlId(), ViewManager::ADMIN_OVERVIEW);
$template->setVariable('href_back', $url->getUrl(true), false);
$template->setVariable('title', $this->getName($key), false);
$this->template[$this->director->theme->getConfig()->main_tag] = $template;
}
开发者ID:rverbrugge,项目名称:dif,代码行数:35,代码来源:UserGroup.php
示例17: getRenderedInsightInHTML
/**
* Get fully-rendered HTML markup for this insight.
* @param Insight $insight Test insight to render in HTML.
* @return str Insight HTML with this insight
*/
protected function getRenderedInsightInHTML(Insight $insight)
{
if ($insight->related_data !== null && is_string($insight->related_data)) {
$insight->related_data = Serializer::unserializeString($insight->related_data);
}
$view = new ViewManager();
$view->caching = false;
$view->assign('insights', array($insight));
$view->assign('expand', true);
$view->assign('tpl_path', THINKUP_WEBAPP_PATH . 'plugins/insightsgenerator/view/');
$view->assign('enable_bootstrap', true);
$view->assign('thinkup_application_url', Utils::getApplicationURL());
$view->assign('site_root_path', 'https://thinkup.thinkup.com/');
$html_insight = $view->fetch(THINKUP_WEBAPP_PATH . '_lib/view/insights.tpl');
return $html_insight;
}
开发者ID:kakilang,项目名称:ThinkUp,代码行数:21,代码来源:class.ThinkUpInsightUnitTestCase.php
示例18: generateUpgradeToken
/**
* Generates a one time upgrade token, and emails admins with the token info.
*/
public static function generateUpgradeToken()
{
$token_file = FileDataManager::getDataPath('.htupgrade_token');
$md5_token = '';
if (!file_exists($token_file)) {
$fp = fopen($token_file, 'w');
if ($fp) {
$token = self::TOKEN_KEY . rand(0, time());
$md5_token = md5($token);
if (!fwrite($fp, $md5_token)) {
throw new OpenFileException("Unable to write upgrade token file: " + $token_file);
}
fclose($fp);
} else {
throw new OpenFileException("Unable to create upgrade token file: " + $token_file);
}
// email our admin with this token.
$owner_dao = DAOFactory::getDAO('OwnerDAO');
$admins = $owner_dao->getAdmins();
if ($admins) {
$tos = array();
foreach ($admins as $admin) {
$tos[] = $admin->email;
}
$to = join(',', $tos);
$upgrade_email = new ViewManager();
$upgrade_email->caching = false;
$upgrade_email->assign('application_url', Utils::getApplicationURL(false));
$upgrade_email->assign('token', $md5_token);
$message = $upgrade_email->fetch('_email.upgradetoken.tpl');
$config = Config::getInstance();
Mailer::mail($to, "Upgrade Your ThinkUp Database", $message);
}
}
}
开发者ID:randomecho,项目名称:ThinkUp,代码行数:38,代码来源:class.UpgradeDatabaseController.php
示例19: generateView
/**
* Generates plugin page options markup - Calls parent::generateView()
*
* @return str view markup
*/
protected function generateView()
{
// if we have some p[lugin option elements defined
// render them and add to the parent view...
if (count($this->option_elements) > 0) {
$this->setValues();
$view_mgr = new ViewManager();
$view_mgr->disableCaching();
// assign data
$view_mgr->assign('option_elements', $this->option_elements);
$view_mgr->assign('option_elements_json', json_encode($this->option_elements));
$view_mgr->assign('option_headers', $this->option_headers);
$view_mgr->assign('option_not_required', $this->option_not_required);
$view_mgr->assign('option_not_required_json', json_encode($this->option_not_required));
$view_mgr->assign('option_required_message', $this->option_required_message);
$view_mgr->assign('option_required_message_json', json_encode($this->option_required_message));
$view_mgr->assign('option_select_multiple', $this->option_select_multiple);
$view_mgr->assign('option_select_visible', $this->option_select_visible);
$view_mgr->assign('plugin_id', $this->plugin_id);
$view_mgr->assign('user_is_admin', $this->isAdmin());
$options_markup = '';
if ($this->profiler_enabled) {
$view_start_time = microtime(true);
$options_markup = $view_mgr->fetch(self::OPTIONS_TEMPLATE);
$view_end_time = microtime(true);
$total_time = $view_end_time - $view_start_time;
$profiler = Profiler::getInstance();
$profiler->add($total_time, "Rendered view (not cached)", false);
} else {
$options_markup = $view_mgr->fetch(self::OPTIONS_TEMPLATE);
}
$this->addToView('options_markup', $options_markup);
}
return parent::generateView();
}
开发者ID:JWFoxJr,项目名称:ThinkUp,代码行数:40,代码来源:class.PluginConfigurationController.php
示例20: renderForm
/**
* Manages form output rendering
* @param string Smarty template object
* @see GuiProvider::renderForm
*/
public function renderForm($theme)
{
$view = ViewManager::getInstance();
$template = $theme->getTemplate();
$template->setVariable($view->getUrlId(), $view->getName(), false);
foreach ($this->template as $key => $value) {
$template->setVariable($key, $value, false);
}
}
开发者ID:rverbrugge,项目名称:dif,代码行数:14,代码来源:CalendarComment.php
注:本文中的ViewManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论