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


PHP Page::addView方法代码示例

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


在下文中一共展示了Page::addView方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: post

 public static function post()
 {
     try {
         //Get list of user IDs of users that are a member this year
         $userIds = MembershipDB::getUserIdsThisYear();
         //Get list of last N winners
         $lastWinners = WeeklyWinnerDB::getLastNWinners(WeeklyWinnerConfig::MIN_WINNING_INTERVAL);
         //Get list of user IDs that have not won the last N times
         if ($lastWinners) {
             $possibleWinners = array_diff($userIds, $lastWinners);
         } else {
             $possibleWinners = $userIds;
         }
         //Pick a random user ID
         $winnerIdx = rand(0, count($possibleWinners) - 1);
         //Add chosen user ID as winner
         WeeklyWinnerDB::addWeeklyWinner($possibleWinners[$winnerIdx]);
         //Show the page again, this is the same as GETing so we just call get
         WeeklyWinnerController::get();
     } catch (Exception $ex) {
         $page = new Page();
         $page->addView('weeklyWinner/WeeklyWinnerTopView');
         $page->data['ErrorMessageNoDescriptionWithLinkView']['errorTitle'] = 'Kan geen nieuwe winnaar loten.';
         $page->data['ErrorMessageNoDescriptionWithLinkView']['tryAgainUrl'] = $_SERVER['REQUEST_URI'];
         $page->addView('error/ErrorMessageNoDescriptionWithLinkView');
         $page->showWithMenu();
     }
 }
开发者ID:JHDeStip,项目名称:Stippers,代码行数:28,代码来源:WeeklyWinnerController.php

示例2: post

 public static function post()
 {
     $page = new Page();
     $page->data['title'] = 'Wachtwoord resetten';
     $errMsgs = ResetPasswordViewValidator::validate($_POST);
     if (empty($errMsgs)) {
         try {
             //Get the user's password salt and calculate password hash
             $passwordSalt = UserDB::getPasswordSaltByEmail($_POST['email']);
             $newPassword = Random::getPassword();
             $newPasswordHash = hash_pbkdf2('sha256', $newPassword, $passwordSalt, SecurityConfig::N_PASSWORD_HASH_ITERATIONS);
             //Get user from database and reset password.
             $user = UserDB::getBasicUserByEmail($_POST['email']);
             UserDB::resetPassword($_POST['email'], $newPasswordHash);
             //Show success message
             $page->data['ResetSuccessfulView']['redirectUrl'] = 'login';
             $page->addView('resetPassword/ResetSuccessfulView');
             //Send email with password
             $failedEmails = Email::sendEmails('ResetPassword.html', 'JH De Stip - Wachtwoord reset', EmailConfig::FROM_ADDRESS, [$user], array($user->userId => array('newPassword' => $newPassword)));
             //If failedEmails is not empty the mail was not sent
             if (!empty($failedEmails)) {
                 $page->data['ErrorMessageNoDescriptionNoLinkView']['errorTitle'] = 'Kan e-mail met nieuwe wachtwoord niet verzenden.';
                 $page->addView('error/ErrorMessageNoDescriptionNoLinkView');
             }
         } catch (UserDBException $ex) {
             $page->data['ResetPasswordView']['reset_password_formAction'] = $_SERVER['REQUEST_URI'];
             $page->data['ResetPasswordView']['email'] = $_POST['email'];
             $page->data['ResetPasswordView']['errMsgs'] = ResetPasswordViewValidator::initErrMsgs();
             if ($ex->getCode() == UserDBException::NOUSERFOREMAIL) {
                 $page->data['ResetPasswordView']['errMsgs']['global'] = '<h2 class="error_message" id="reset_password_form_error_message">Er is geen gebruiker met dit e-mailadres.</h2>';
             } else {
                 $page->data['ResetPasswordView']['errMsgs']['global'] = '<h2 class="error_message" id="reset_password_form_error_message">Kan wachtwoord niet resetten, probeer het opnieuw.</h2>';
             }
             $page->addView('resetPassword/ResetPasswordView');
         } catch (EmailException $ex) {
             $page->data['ErrorMessageNoDescriptionNoLinkView']['errorTitle'] = 'Kan e-mail met nieuwe wachtwoord niet verzenden.';
             $page->addView('error/ErrorMessageNoDescriptionNoLinkView');
         } catch (Exception $ex) {
             $page->data['ResetPasswordView']['reset_password_formAction'] = $_SERVER['REQUEST_URI'];
             $page->data['ResetPasswordView']['email'] = $_POST['email'];
             $page->data['ResetPasswordView']['errMsgs']['global'] = '<h2 class="error_message" id="reset_password_form_error_message">Kan wachtwoord niet resetten, probeer het opnieuw.</h2>';
             $page->addView('resetPassword/ResetPasswordView');
         }
     } else {
         $page->data['ResetPasswordView']['reset_password_formAction'] = $_SERVER['REQUEST_URI'];
         $page->data['ResetPasswordView']['email'] = $_POST['email'];
         $page->data['ResetPasswordView']['errMsgs'] = ResetPasswordViewValidator::initErrMsgs();
         $page->data['ResetPasswordView']['errMsgs'] = array_merge($page->data['ResetPasswordView']['errMsgs'], $errMsgs);
         $page->addView('resetPassword/ResetPasswordView');
     }
     $page->showWithMenu();
 }
开发者ID:JHDeStip,项目名称:Stippers,代码行数:52,代码来源:ResetPasswordController.php

示例3: loadSearchResults

 /**
  * Get search results and load the data into the page.
  * 
  * @param Page $page
  */
 private static function loadSearchResults($page)
 {
     try {
         $users = UserDB::getSearchUsers(['firstName' => true, 'lastName' => true, 'email' => true], ['firstName' => $_POST['first_name'], 'lastName' => $_POST['last_name'], 'email' => $_POST['email']], null);
         if (count($users) == 0) {
             $page->addView('userSearch/UserSearchNoResultsView');
         } else {
             $page->data['RenewUserSearchResultsView']['users'] = $users;
             $page->addView('addRenewUser/renewUserSearch/RenewUserSearchResultsView');
         }
     } catch (Exception $ex) {
         $page->data['ErrorMessageNoDescriptionNoLinkView']['errorTitle'] = 'Kan gebruikers niet ophalen.';
         $page->addView('error/ErrorMessageNoDescriptionNoLinkView');
     }
 }
开发者ID:JHDeStip,项目名称:Stippers,代码行数:20,代码来源:RenewUserSearchController.php

示例4: get

 public static function get()
 {
     $page = new Page();
     $page->data['title'] = 'Home';
     $page->addView('home/HomeView');
     $page->showWithMenu();
 }
开发者ID:JHDeStip,项目名称:Stippers,代码行数:7,代码来源:HomeController.php

示例5: buildPage

 /**
  * Method to build page. We use it so we can handle both get ans post requests.
  */
 private static function buildPage()
 {
     $page = new Page();
     $page->data['title'] = 'Pagina niet gevonden';
     $page->addView('pageNotFound/PageNotFoundView');
     $page->showWithMenu();
 }
开发者ID:JHDeStip,项目名称:Stippers,代码行数:10,代码来源:PageNotFoundController.php

示例6: get

 public static function get()
 {
     $page = new Page();
     $page->data['title'] = 'Het vleeswiel';
     $page->addView('meatWheel/MeatWheelView');
     $page->addExtraJsFile('konva/konva.min.js');
     $page->showWithMenu();
 }
开发者ID:JHDeStip,项目名称:Stippers,代码行数:8,代码来源:MeatWheelController.php

示例7: get

 public static function get()
 {
     $page = new Page();
     $page->data['title'] = 'Gebruiker toevoegen of hernieuwen';
     $page->data['AddOrRenewUserView']['add_or_renew_user_formAction'] = $_SERVER['REQUEST_URI'];
     $page->addView('addRenewUser/AddOrRenewUserView');
     $page->showWithMenu();
 }
开发者ID:JHDeStip,项目名称:Stippers,代码行数:8,代码来源:AddOrRenewUserController.php

示例8: get

 public static function get()
 {
     $page = new Page();
     $page->data['title'] = 'Geen toegang';
     $page->data['ForcedLogoutView']['reLoginUrl'] = $_SERVER['REQUEST_URI'];
     $page->addView('authorization/ForcedLogoutView');
     $page->showBasic();
 }
开发者ID:JHDeStip,项目名称:Stippers,代码行数:8,代码来源:ForcedLogoutController.php

示例9: get

 public static function get()
 {
     $page = new Page();
     $page->data['title'] = 'Database error';
     $page->data['ErrorMessageNoDescriptionNoLinkView']['errorTitle'] = 'Kan authorizatiegegevens niet ophalen uit database.';
     $page->data['ErrorMessageNoDescriptionNoLinkView']['tryAgainUrl'] = $_SERVER['REQUEST_URI'];
     $page->addView('error/ErrorMessageNoDescriptionNoLinkView');
     $page->showWithMenu();
 }
开发者ID:JHDeStip,项目名称:Stippers,代码行数:9,代码来源:DBErrorController.php

示例10: get

 public static function get()
 {
     //Logging out means we simply destroy the session
     session_destroy();
     $page = new Page();
     $page->data['title'] = 'Afmelden';
     $page->addView('authorization/LogoutView');
     $page->showBasic();
 }
开发者ID:JHDeStip,项目名称:Stippers,代码行数:9,代码来源:LogoutController.php

示例11: fatalErrorHandler

 /**
  * Executes when php encounters a fatal error. This is used to show a 'nice' error page.
  */
 public static function fatalErrorHandler()
 {
     if (error_get_last()['type'] == E_ERROR) {
         $page = new Page();
         $page->data['title'] = 'Er is iets misgegaan';
         $page->data['ErrorMessageNoDescriptionNoLinkView']['errorTitle'] = 'Er is iets misgegaan :(';
         $page->addView('error/ErrorMessageNoDescriptionNoLinkView');
         $page->showWithMenu();
     }
 }
开发者ID:JHDeStip,项目名称:Stippers,代码行数:13,代码来源:ErrorHandler.php

示例12: get

 public static function get()
 {
     $page = new Page();
     $page->data['title'] = 'Transacties';
     //Gets the amount from GET or use default
     if (isset($_GET['amount'])) {
         $amount = $_GET['amount'];
     } else {
         $amount = MoneyTransactionsViewConfig::DEFAULT_AMOUNT;
     }
     try {
         //Get all transactions
         $transactions = MoneyTransactionDB::getTransactions($amount);
         $transactionCount = count($transactions);
         //If no transactions show no transactions view, otherwise show list with transactions
         if ($transactionCount > 0) {
             $page->data['TransactionsWithDetailsWithDiscountListView']['transactions'] = $transactions;
             $page->addView('transactions/TransactionsTitleView');
             $page->addView('transactions/TransactionsBackToManageUserLinkView');
             $page->addView('transactions/TransactionsWithDetailsWithDiscountListView');
         } else {
             $page->addView('transactions/TransactionsTitleView');
             $page->data['InfoMessageNoDescriptionWithLinkView']['infoTitle'] = 'Er zijn nog geen transacties';
             $page->data['InfoMessageNoDescriptionWithLinkView']['redirectUrl'] = 'manageuser';
             $page->addView('info/InfoMessageNoDescriptionWithLinkView');
         }
     } catch (Exception $ex) {
         $page->data['ErrorMessageNoDescriptionWithLinkView']['errorTitle'] = 'Kan gegevens niet ophalen uit de database';
         $page->data['ErrorMessageNoDescriptionWithLinkView']['tryAgainUrl'] = $_SERVER['REQUEST_URI'];
         $page->addView('error/ErrorMessageNoDescriptionWithLinkView');
     }
     $page->showWithMenu();
 }
开发者ID:JHDeStip,项目名称:Stippers,代码行数:33,代码来源:AllTransactionsController.php

示例13: get

 public static function get()
 {
     $page = new Page();
     $page->data['title'] = 'Browsers beheren';
     $page->addView('manageBrowser/ManageBrowserTopView');
     try {
         //Get list of existing browsers to show
         $browsers = BrowserDB::getBrowsers();
         if (count($browsers) > 0) {
             $page->data['ManageBrowserBrowserListView']['browsers'] = $browsers;
             $page->addView('manageBrowser/ManageBrowserBrowserListView');
         } else {
             $page->addView('manageBrowser/ManageBrowserNoBrowsersView');
         }
     } catch (Exception $ex) {
         $page->data['ErrorMessageNoDescriptionWithLinkView']['errorTitle'] = 'Kan browsers niet ophalen';
         $page->data['ErrorMessageNoDescriptionWithLinkView']['tryAgainUrl'] = $_SERVER['REQUEST_URI'];
         $page->addView('error/ErrorMessageNoDescriptionWithLinkView');
     }
     $page->data['ManageBrowserNewBrowserView']['new_browser_formAction'] = $_SERVER['REQUEST_URI'];
     $page->addView('manageBrowser/ManageBrowserNewBrowserView');
     $page->showWithMenu();
 }
开发者ID:JHDeStip,项目名称:Stippers,代码行数:23,代码来源:ManageBrowserController.php

示例14: get

 public static function get()
 {
     $page = new Page();
     $page->data['title'] = 'Transacties';
     //Checks if user is set, if not redirect to manage user
     if (!isset($_GET['user'])) {
         header('Location: manageuser', true, 303);
     } else {
         //Gets the amount from GET or use default
         if (isset($_GET['amount'])) {
             $amount = $_GET['amount'];
         } else {
             $amount = MoneyTransactionsViewConfig::DEFAULT_AMOUNT;
         }
         try {
             //Get user for his name
             $page->data['TransactionsNameView']['fullName'] = UserDB::getBasicUserById($_GET['user'])->getFullName();
             //Get transactions for user
             $transactions = MoneyTransactionDB::getTransactionsByUserId($_GET['user'], $amount);
             $transactionCount = count($transactions);
             //If no transactions show no transactions view, otherwise show list with transactions
             if ($transactionCount > 0) {
                 $page->data['TransactionsWithDiscountListView']['transactions'] = $transactions;
                 $page->data['TransactionsWithDiscountListView']['totalAmount'] = $transactionCount;
                 $page->addView('transactions/TransactionsTitleView');
                 $page->addView('transactions/TransactionsNameView');
                 $page->addView('transactions/TransactionsBackToManageUserLinkView');
                 $page->addView('transactions/TransactionsWithDiscountListView');
             } else {
                 $page->data['InfoMessageNoDescriptionWithLinkView']['infoTitle'] = 'Er zijn nog geen transacties';
                 $page->data['InfoMessageNoDescriptionWithLinkView']['redirectUrl'] = 'manageuser';
                 $page->addView('transactions/TransactionsTitleView');
                 $page->addView('transactions/TransactionsNameView');
                 $page->addView('info/InfoMessageNoDescriptionWithLinkView');
             }
         } catch (Exception $ex) {
             $page->data['ErrorMessageNoDescriptionWithLinkView']['errorTitle'] = 'Kan gegevens niet ophalen uit de database';
             $page->data['ErrorMessageNoDescriptionWithLinkView']['tryAgainUrl'] = $_SERVER['REQUEST_URI'];
             $page->addView('error/ErrorMessageNoDescriptionWithLinkView');
         }
         $page->showWithMenu();
     }
 }
开发者ID:JHDeStip,项目名称:Stippers,代码行数:43,代码来源:UserTransactionsController.php

示例15: post

 public static function post()
 {
     //If the file in get doesn't exist redirect to manageemail page
     if (!isset($_GET['filename']) || !file_exists(EmailConfig::EMAILFILESDIR . '/' . $_GET['filename'])) {
         header('Location: manageemail', true, 303);
     } elseif (isset($_POST['download'])) {
         header('Content-Type: application/octet-stream');
         header('Content-Transfer-Encoding: Binary');
         header('Content-disposition: attachment; filename=' . $_GET['filename']);
         readfile(EmailConfig::EMAILFILESDIR . '/' . $_GET['filename']);
     } elseif (isset($_POST['delete'])) {
         unlink(EmailConfig::EMAILFILESDIR . '/' . $_GET['filename']);
         $page = new Page();
         $page->data['title'] = 'E-mail bewerken';
         $page->data['SuccessMessageNoDescriptionWithLinkView']['successTitle'] = 'E-mail succesvol verwijderd';
         $page->data['SuccessMessageNoDescriptionWithLinkView']['redirectUrl'] = 'manageemail';
         $page->addView('success/SuccessMessageNoDescriptionWithLinkView');
         $page->showWithMenu();
     } else {
         header('Location: manageemail', true, 303);
     }
 }
开发者ID:JHDeStip,项目名称:Stippers,代码行数:22,代码来源:EditEmailController.php


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