本文整理汇总了PHP中View::generate方法的典型用法代码示例。如果您正苦于以下问题:PHP View::generate方法的具体用法?PHP View::generate怎么用?PHP View::generate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类View
的用法示例。
在下文中一共展示了View::generate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Action_login
public function Action_login()
{
$model = new Model_index();
$model->login();
$view = new View();
$view->generate('index', $model->getName());
}
示例2: checkIfUserOwnWebsite
private function checkIfUserOwnWebsite($id_website)
{
$model = new ModelForeground();
$userOwnWebsite = $model->userOwnWebsite($_SESSION["id_user"], $id_website);
if ($userOwnWebsite != 1) {
$view = new View("RestrictedAction");
$view->generate();
die;
}
}
示例3: displayHome
public function displayHome()
{
session_start();
if (isset($_SESSION["username"])) {
header('Location: index.php?page=foreground');
} else {
$view = new View("Home", "Modules/Home/");
$view->generate();
}
}
示例4: displayResearch
public function displayResearch()
{
if (!isset($_POST["search"])) {
header('Location: index.php');
die;
}
$view = new View("Search", dirname("PHP/") . "/Modules/Search/", "user.css");
$searchResult = $this->search($_POST["search"]);
$view->generate(array("searchValue" => $_POST["search"], "searchResult" => $searchResult, "resultsNumber" => count($searchResult)));
}
示例5: Action_index
public function Action_index()
{
if (!$this->login()) {
$model = new Model_index('Главная', ' ', ' ');
$model->view();
$view = new View();
$view->generate("index", $model);
} else {
header('Location: /chat');
}
}
示例6: Action_new
public function Action_new()
{
if ($this->login() && $this->rank() == 1) {
$model = new Model_chat('Chat 1.0', ' ', ' ');
$model->new_room();
$view = new View();
$view->generate("new_room", $model);
} else {
header('Location: /');
}
}
示例7: checkIfFileIsAnImage
private function checkIfFileIsAnImage($file)
{
$check = @getimagesize($file);
if ($check !== false) {
return $file;
} else {
$view = new View("ErrorUpload", "Modules/Upload/", "user.css");
$view->generate(array('error_msg' => "Le fichier que vous avez essayer d'uploader n'est pas une image ou il est trop lourd."));
die;
}
}
示例8: createPersonnalDirectory
private function createPersonnalDirectory($username)
{
$username = parent::normalize($username);
$working_dir = $GLOBALS['working_dir'];
$directory1_OK = mkdir($working_dir . "/Users/{$username}/", 0777);
if (!$directory1_OK) {
$view = new View("Error", "", "user.css");
$view->generate(array('errormsg' => "Erreur lors de la création du dossier personnel"));
die;
}
$copyAccountPictureOK = copy($working_dir . "/assets/img/default_picture.jpg", $working_dir . "/Users/" . $username . "/account_picture.jpg");
$copyBannerPictureOK = copy($working_dir . "/assets/img/default_banner.jpg", $working_dir . "/Users/" . $username . "/banner_picture.jpg");
}
示例9: displayUserFollowers
public function displayUserFollowers($username)
{
session_start();
if (!isset($username) && isset($_SESSION["username"])) {
$username = $_SESSION["username"];
}
$this->checkUserValidity($username);
$userfollowers = $this->getFollowers($username);
if (isset($_SESSION["username"]) && $username == $_SESSION["username"]) {
$view = new View("UserWithRights", "Modules/User/");
$view->generate($userdatas);
die;
}
}
示例10: processSignup
public function processSignup()
{
$this->checkConnectedEntry("index.php");
$username = $_POST["inputUsername"];
$email = $_POST["inputEmail"];
$password = $_POST["inputPassword"];
$firstname = $_POST["inputFirstname"];
$lastname = $_POST["inputLastname"];
$IBAN = $_POST["inputIBAN"];
$password = crypt($password, $GLOBALS['salt']);
$model = new ModelSignup();
$emailExists = $model->getEmail($email)->fetch(PDO::FETCH_OBJ)->emailexists;
if ($emailExists != 0) {
$view = new View("Signup", "Modules/Signup/");
$view->generate(array('incorrectSignup' => true));
die;
}
$model->insertUser($username, $email, $password, $firstname, $lastname, $IBAN);
header('Location: index.php?page=signupsuccess');
}
示例11: processConnect
public function processConnect()
{
$this->checkConnectedEntry("index.php");
$model = new ModelSignin();
$email = $_POST["inputEmail"];
$password = $_POST["inputPassword"];
$password = crypt($password, $GLOBALS['salt']);
$emailExists = $model->getEmail($email);
$correctPassword = $model->getPassword($email);
if ($emailExists == 0 || $correctPassword != $password) {
$view = new View("Signin", "Modules/Signin/");
$view->generate(array('incorrectSignin' => true));
die;
}
session_start();
$_SESSION["username"] = $model->getUsernameAndId($email)->username;
$_SESSION["id_user"] = $model->getUsernameAndId($email)->id_user;
$_SESSION["email"] = $email;
header('Location: index.php');
}
示例12: run
public function run($app = '', $ac = '')
{
$c = sha1(url());
$S = !empty($_SESSION['pe_s'][$c]) ? $_SESSION['pe_s'][$c] : '';
for ($i = 1; $i <= 9; ++$i) {
if (isset($_REQUEST['pe_try' . $i]) && !empty($_REQUEST['pe_s']) && $_REQUEST['pe_s'] == $S) {
$this->try = $i;
$this->form = !empty($_REQUEST['pe_f']) ? trim($_REQUEST['pe_f']) : '';
$_SESSION['pe_s'][$c] = 0;
break;
}
}
if (empty($_SESSION['pe_s'][$c])) {
$_SESSION['pe_s'][$c] = sha1(uniqid() . 'PHPPE' . VERSION);
}
if (!empty($_SESSION['pe_v'])) {
self::$v = $_SESSION['pe_v'];
}
View::init();
if (empty($this->maintenance)) {
list($app, $ac, $args) = HTTP::urlMatch($app, $ac, $this->url);
list($app, $ac) = self::event('route', [$app, $ac]);
$c = $app . '_' . $ac;
if (strpos($c, '..') !== false || strpos($c, '/') !== false || substr($app, -4) == '.php' || substr($ac, -4) == '.php') {
$app = $this->template = '403';
} else {
$this->template = self::$w ? $app . '_' . $ac : '';
}
$appCls = $app;
foreach (['PHPPE\\Ctrl\\' . $app . ucfirst($ac), 'PHPPE\\Ctrl\\' . $app, 'PHPPE\\' . $app, $app] as $a) {
if (ClassMap::has($a)) {
$appCls = $a;
if ($a[0] == "\\") {
$a = substr($a, 1);
}
$p = dirname(ClassMap::$map[strtolower($a)]);
if (basename($p) == "ctrl" || basename($p) == "libs") {
$p = dirname($p);
}
self::$paths[strtolower($app)] = $p;
break;
}
}
if (!ClassMap::has($appCls)) {
if (!self::$w) {
die($this->app == 'cron' ? self::event('cron' . ucfirst($this->action), 0) : 'PHPPE-C: ' . L($this->app . '_' . $this->action . ' not found!') . "\n");
}
$appCls = 'PHPPE\\Content';
$ac = 'action';
}
$appObj = new $appCls();
View::setPath(self::$paths[strtolower($app)]);
View::assign('app', $appObj);
self::log('D', $this->url . " ->{$app}::{$ac} " . $this->template, 'routes');
$N = 'p_' . sha1($this->base . $this->url . '/' . self::$user->id . '/' . self::$client->lang);
if (empty($this->nocache) && !self::isTry()) {
$T = View::fromCache($N);
}
if (empty($T)) {
Content::getDDS($appObj);
self::event('ctrl', [$app, $ac]);
if (!method_exists($appObj, $ac)) {
$ac = 'action';
}
if (method_exists($appObj, $ac)) {
!empty($args) ? call_user_func_array([$appObj, $ac], $args) : $appObj->{$ac}($this->item);
}
$T = View::generate($this->template, $N);
}
} else {
session_destroy();
$T = View::template('maintenance');
if (empty($T)) {
$T = L('Site is temporarily down for maintenance');
}
}
if ((@in_array('--dump', $_SERVER['argv']) || isset($_REQUEST['--dump'])) && $this->runlevel > 0) {
View::dump();
}
DS::close();
$T = self::event('view', $T);
View::output($T);
session_write_close();
}
示例13: displayGlobalDashboard
public function displayGlobalDashboard()
{
$this->checkDisconnectedEntry("index.php?page=signin");
$view = new View("BackgroundGlobalDashboard", "Modules/Background/");
$view->generate();
}
示例14: View
function action_index()
{
$view = new View();
$view->generate('404.html');
}
示例15: routerError
/**
* error handler with exception
*/
private function routerError(Exception $exception)
{
$view = new View("viewError");
$view->generate(array('msgError' => $exception->getMessage()));
}