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


PHP WebRequest::wasPosted方法代码示例

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


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

示例1: onEditPageImportFormData

 /**
  * Concatenate categories on EditPage POST
  *
  * @param EditPage $editPage
  * @param WebRequest $request
  *
  * @return Boolean because it's a hook
  */
 public static function onEditPageImportFormData($editPage, $request)
 {
     $app = F::app();
     if ($request->wasPosted()) {
         $categories = $editPage->safeUnicodeInput($request, 'categories');
         $categories = CategoryHelper::changeFormat($categories, 'json', 'array');
         // Concatenate categories to article wikitext (if there are any).
         if (!empty($categories)) {
             if (!empty($app->wg->EnableAnswers)) {
                 // don't add categories if the page is a redirect
                 $magicWords = $app->wg->ContLang->getMagicWords();
                 $redirects = $magicWords['redirect'];
                 // first element doesn't interest us
                 array_shift($redirects);
                 // check for localized versions of #REDIRECT
                 foreach ($redirects as $alias) {
                     if (stripos($editPage->textbox1, $alias) === 0) {
                         return true;
                     }
                 }
             }
             // Extract categories from the article, merge them with those passed in, weed out
             // duplicates and finally append them back to the article (BugId:99348).
             $data = CategoryHelper::extractCategoriesFromWikitext($editPage->textbox1, true);
             $categories = CategoryHelper::getUniqueCategories($data['categories'], $categories);
             $categories = CategoryHelper::changeFormat($categories, 'array', 'wikitext');
             // Remove trailing whitespace (BugId:11238)
             $editPage->textbox1 = $data['wikitext'] . rtrim($categories);
         }
     }
     return true;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:40,代码来源:CategorySelectHooksHelper.class.php

示例2: showEditRoomPage

 private function showEditRoomPage()
 {
     if (WebRequest::wasPosted()) {
         try {
             // get variables
             $rname = WebRequest::post("rname");
             $rtype = WebRequest::postInt("rtype");
             $rmin = WebRequest::postInt("rmin");
             $rmax = WebRequest::postInt("rmax");
             $rprice = WebRequest::postFloat("rprice");
             $id = WebRequest::getInt("id");
             // data validation
             if ($rname == "") {
                 throw new CreateRoomException("blank-roomname");
             }
             if ($rtype == 0) {
                 throw new CreateRoomException("blank-roomtype");
             }
             if ($rmax < 1 || $rmin < 0) {
                 throw new CreateRoomException("room-capacity-too-small");
             }
             if ($rmin > $rmax) {
                 throw new CreateRoomException("room-capacity-min-gt-max");
             }
             if ($rprice != abs($rprice)) {
                 throw new CreateRoomException("room-price-negative");
             }
             $room = Room::getById($id);
             if ($room == null) {
                 throw new Exception("Room does not exist");
             }
             // set values
             $room->setName($rname);
             $room->setType($rtype);
             $room->setMinPeople($rmin);
             $room->setMaxPeople($rmax);
             $room->setPrice($rprice);
             $room->save();
             global $cScriptPath;
             $this->mHeaders[] = "Location: {$cScriptPath}/Rooms";
         } catch (CreateRoomException $ex) {
             $this->mBasePage = "mgmt/roomEdit.tpl";
             $this->error($ex->getMessage());
         }
     } else {
         $this->mBasePage = "mgmt/roomEdit.tpl";
         $room = Room::getById(WebRequest::getInt("id"));
         if ($room == null) {
             throw new Exception("Room does not exist");
         }
         $this->mSmarty->assign("roomid", $room->getId());
         $this->mSmarty->assign("rname", $room->getName());
         $this->mSmarty->assign("rmin", $room->getMinPeople());
         $this->mSmarty->assign("rmax", $room->getMaxPeople());
         $this->mSmarty->assign("rprice", $room->getPrice());
         $this->mSmarty->assign("rtype", $room->getType()->getId());
     }
     $this->mSmarty->assign("rtlist", RoomType::$data);
 }
开发者ID:vulnerabilityCode,项目名称:hotel-system,代码行数:59,代码来源:MPageRooms.php

示例3: execute

 /**
  * Main execution point
  *
  * @param User $user
  * @param OutputPage $output
  * @param WebRequest $request
  * @param int $mode
  */
 public function execute($user, $output, $request, $mode)
 {
     global $wgUser;
     if (wfReadOnly()) {
         $output->readOnlyPage();
         return;
     }
     switch ($mode) {
         case self::EDIT_CLEAR:
             // The "Clear" link scared people too much.
             // Pass on to the raw editor, from which it's very easy to clear.
         // The "Clear" link scared people too much.
         // Pass on to the raw editor, from which it's very easy to clear.
         case self::EDIT_RAW:
             $output->setPageTitle(wfMsg('watchlistedit-raw-title'));
             if ($request->wasPosted() && $this->checkToken($request, $wgUser)) {
                 $wanted = $this->extractTitles($request->getText('titles'));
                 $current = $this->getWatchlist($user);
                 if (count($wanted) > 0) {
                     $toWatch = array_diff($wanted, $current);
                     $toUnwatch = array_diff($current, $wanted);
                     $this->watchTitles($toWatch, $user);
                     $this->unwatchTitles($toUnwatch, $user);
                     $user->invalidateCache();
                     if (count($toWatch) > 0 || count($toUnwatch) > 0) {
                         $output->addHtml(wfMsgExt('watchlistedit-raw-done', 'parse'));
                     }
                     if (($count = count($toWatch)) > 0) {
                         $output->addHtml(wfMsgExt('watchlistedit-raw-added', 'parse', $count));
                         $this->showTitles($toWatch, $output, $wgUser->getSkin());
                     }
                     if (($count = count($toUnwatch)) > 0) {
                         $output->addHtml(wfMsgExt('watchlistedit-raw-removed', 'parse', $count));
                         $this->showTitles($toUnwatch, $output, $wgUser->getSkin());
                     }
                 } else {
                     $this->clearWatchlist($user);
                     $user->invalidateCache();
                     $output->addHtml(wfMsgExt('watchlistedit-raw-removed', 'parse', count($current)));
                     $this->showTitles($current, $output, $wgUser->getSkin());
                 }
             }
             $this->showRawForm($output, $user);
             break;
         case self::EDIT_NORMAL:
             $output->setPageTitle(wfMsg('watchlistedit-normal-title'));
             if ($request->wasPosted() && $this->checkToken($request, $wgUser)) {
                 $titles = $this->extractTitles($request->getArray('titles'));
                 $this->unwatchTitles($titles, $user);
                 $user->invalidateCache();
                 $output->addHtml(wfMsgExt('watchlistedit-normal-done', 'parse', $GLOBALS['wgLang']->formatNum(count($titles))));
                 $this->showTitles($titles, $output, $wgUser->getSkin());
             }
             $this->showNormalForm($output, $user);
     }
 }
开发者ID:BackupTheBerlios,项目名称:shoutwiki-svn,代码行数:64,代码来源:WatchlistEditor.php

示例4: runPage

 protected function runPage()
 {
     global $gLogger;
     $gLogger->log("Login page initialising");
     if (WebRequest::wasPosted()) {
         $this->handleLogin();
     } else {
         $this->showLoginForm();
     }
 }
开发者ID:vulnerabilityCode,项目名称:hotel-system,代码行数:10,代码来源:MPageLogin.php

示例5: setupLanguage

 /**
  * Initializes language-related variables.
  */
 public function setupLanguage()
 {
     global $wgLang, $wgContLang, $wgLanguageCode;
     if ($this->getSession('test') === null && !$this->request->wasPosted()) {
         $wgLanguageCode = $this->getAcceptLanguage();
         $wgLang = $wgContLang = Language::factory($wgLanguageCode);
         $this->setVar('wgLanguageCode', $wgLanguageCode);
         $this->setVar('_UserLang', $wgLanguageCode);
     } else {
         $wgLanguageCode = $this->getVar('wgLanguageCode');
         $wgContLang = Language::factory($wgLanguageCode);
     }
 }
开发者ID:Grprashanthkumar,项目名称:ColfusionWeb,代码行数:16,代码来源:WebInstaller.php

示例6: showAddBillItemPage

 private function showAddBillItemPage()
 {
     $rt = WebRequest::getInt("id");
     if (WebRequest::wasPosted()) {
         $bi = new Bill_item();
         $bi->setBooking(Booking::getById($rt));
         $bi->setName(WebRequest::post("billname"));
         $bi->setPrice(WebRequest::post("billprice"));
         $bi->save();
         global $cScriptPath;
         $this->mHeaders[] = "Location: {$cScriptPath}/Billing?action=view&id={$rt}";
     } else {
         $this->mSmarty->assign("bid", $rt);
         $this->mBasePage = "mgmt/billcreate.tpl";
     }
 }
开发者ID:vulnerabilityCode,项目名称:hotel-system,代码行数:16,代码来源:MPageBilling.php

示例7: LoginForm

 /**
  * Constructor
  * @param WebRequest $request A WebRequest object passed by reference
  */
 function LoginForm(&$request, $par = '')
 {
     global $wgLang, $wgAllowRealName, $wgEnableEmail;
     global $wgAuth;
     $this->mType = $par == 'signup' ? $par : $request->getText('type');
     # Check for [[Special:Userlogin/signup]]
     $this->mName = $request->getText('wpName');
     $this->mPassword = $request->getText('wpPassword');
     $this->mRetype = $request->getText('wpRetype');
     $this->mRetypeEmail = $request->getText('wpRetypeEmail');
     $this->mDomain = $request->getText('wpDomain');
     $this->mReturnTo = $request->getVal('returnto');
     $this->mAutoRedirect = $request->getVal('autoredirect');
     $this->mFromSite = $request->getVal('sitelogin');
     $this->mCookieCheck = $request->getVal('wpCookieCheck');
     $this->mPosted = $request->wasPosted();
     $this->mCreateaccount = $request->getCheck('wpCreateaccount');
     $this->mCreateaccountMail = $request->getCheck('wpCreateaccountMail') && $wgEnableEmail;
     $this->mMailmypassword = $request->getCheck('wpMailmypassword') && $wgEnableEmail;
     $this->mLoginattempt = $request->getCheck('wpLoginattempt');
     $this->mAction = $request->getVal('action');
     $this->mRemember = $request->getCheck('wpRemember');
     $this->mLanguage = $request->getText('uselang');
     if ($wgEnableEmail) {
         $this->mEmail = $request->getText('wpEmail');
     } else {
         $this->mEmail = '';
     }
     if ($wgAllowRealName && $request->getText('wpUseRealNameAsDisplay') == "on") {
         $this->mRealName = @strip_tags($request->getText('wpRealName'));
     } else {
         $this->mRealName = '';
     }
     if (!$wgAuth->validDomain($this->mDomain)) {
         $this->mDomain = 'invaliddomain';
     }
     $wgAuth->setDomain($this->mDomain);
     # When switching accounts, it sucks to get automatically logged out
     if ($this->mReturnTo == $wgLang->specialPage('Userlogout')) {
         $this->mReturnTo = '';
     }
     if ($this->mAutoRedirect == $wgLang->specialPage('Userlogout')) {
         $this->mAutoRedirect = '';
     }
 }
开发者ID:ErdemA,项目名称:wikihow,代码行数:49,代码来源:SpecialUserlogin.php

示例8: runPage

 protected function runPage()
 {
     try {
         self::checkAccess('edit-access-levels');
         $this->mSmarty->assign("readonly", '');
     } catch (AccessDeniedException $ex) {
         // caution: if you're copying this, this is a hack to make sure
         //			users know they don't have the access to do this, not
         // 			to actually stop them from doing it, though it will have
         // 			that effect to the non-tech-savvy.
         $this->mSmarty->assign("readonly", 'disabled="disabled"');
     }
     if (WebRequest::wasPosted()) {
         // make SURE we have the right access level for this operation
         self::checkAccess('edit-access-levels');
         foreach (WebRequest::getPostKeys() as $k) {
             $entry = StaffAccess::getById($k);
             if ($entry == null) {
                 continue;
             }
             if ($entry->getLevel() != WebRequest::postInt($k)) {
                 $entry->setLevel(WebRequest::postInt($k));
                 $entry->save();
             }
         }
         global $cWebPath;
         $this->mHeaders[] = "HTTP/1.1 303 See Other";
         $this->mHeaders[] = "Location: " . $cWebPath . "/management.php/Access";
         return;
     }
     $this->mBasePage = "mgmt/access.tpl";
     $accesslist = array();
     $accessKeys = StaffAccess::getKnownActions();
     foreach ($accessKeys as $k) {
         $accessEntry = StaffAccess::getByAction($k);
         global $gLogger;
         $gLogger->log("Access entry {$accessEntry->getAction()}({$accessEntry->getLevel()}) found!");
         $accesslist[] = array(id => $accessEntry->getId(), name => $accessEntry->getAction(), value => $accessEntry->getLevel());
     }
     $this->mSmarty->assign("accesslist", $accesslist);
 }
开发者ID:vulnerabilityCode,项目名称:hotel-system,代码行数:41,代码来源:MPageAccess.php

示例9: runPage

 protected function runPage()
 {
     $this->mBasePage = "book.tpl";
     global $cWebPath;
     $this->mStyles[] = $cWebPath . '/style/jsDatePick_ltr.min.css';
     $this->mScripts[] = $cWebPath . '/scripts/jsDatePick.full.1.3.js';
     // set up the default values for the
     if (WebRequest::wasPosted()) {
         $this->mSmarty->assign("valQbCheckin", WebRequest::postString("qbCheckin"));
         $this->mSmarty->assign("valQbCheckout", WebRequest::postString("qbCheckout"));
         $this->mSmarty->assign("valQbAdults", WebRequest::postInt("qbAdults"));
         $this->mSmarty->assign("valQbChildren", WebRequest::postInt("qbChildren"));
         $this->mSmarty->assign("valQbPromoCode", WebRequest::postString("qbPromoCode"));
     } else {
         $this->mSmarty->assign("valQbCheckin", "");
         $this->mSmarty->assign("valQbCheckout", "");
         $this->mSmarty->assign("valQbAdults", "");
         $this->mSmarty->assign("valQbChildren", "");
         $this->mSmarty->assign("valQbPromoCode", "");
     }
     if (Session::isCustomerLoggedIn()) {
         $customer = Customer::getById(Session::getLoggedInCustomer());
         $this->mSmarty->assign("qbTitle", $customer->getTitle());
         $this->mSmarty->assign("qbFirstname", $customer->getFirstname());
         $this->mSmarty->assign("qbLastname", $customer->getSurname());
         $this->mSmarty->assign("qbAddress", $customer->getAddress()->getLine1());
         $this->mSmarty->assign("qbCity", $customer->getAddress()->getCity());
         $this->mSmarty->assign("qbPostcode", $customer->getAddress()->getPostcode());
         $this->mSmarty->assign("qbCountry", $customer->getAddress()->getCountry());
         $this->mSmarty->assign("qbEmail", $customer->getEmail());
     } else {
         $this->mSmarty->assign("qbTitle", "");
         $this->mSmarty->assign("qbFirstname", "");
         $this->mSmarty->assign("qbLastname", "");
         $this->mSmarty->assign("qbAddress", "");
         $this->mSmarty->assign("qbCity", "");
         $this->mSmarty->assign("qbPostcode", "");
         $this->mSmarty->assign("qbEmail", "");
         $this->mSmarty->assign("qbCountry", " ");
     }
 }
开发者ID:vulnerabilityCode,项目名称:hotel-system,代码行数:41,代码来源:PageBook.php

示例10: runPage

 protected function runPage()
 {
     if (WebRequest::wasPosted()) {
         if (!($email = WebRequest::postString("lgEmail"))) {
             // no email address specified
             $this->redirect("noemail");
             return;
         }
         if (!($password = WebRequest::postString("lgPasswd"))) {
             // no password specified
             $this->redirect("nopass");
             return;
         }
         $cust = Customer::getByEmail($email);
         if ($cust == null) {
             // customer doesn't exist. offer to signup or retry?
             $this->redirect("invalid");
             return;
         }
         if (!$cust->isMailConfirmed()) {
             // customer hasn't confirmed their email
             $this->redirect("noconfirm");
             return;
         }
         if (!$cust->authenticate($password)) {
             // not a valid password
             $this->redirect("invalid");
             return;
         }
         // seems to be ok.
         // set up the session
         Session::setLoggedInCustomer($cust->getId());
         // redirect back to the main page.
         $this->redirect();
     } else {
         // urm, something's not quite right here...
         // redirect back to the main page.
         $this->mHeaders[] = "HTTP/1.1 303 See Other";
         $this->mHeaders[] = "Location: " . $cWebPath . "/index.php";
     }
 }
开发者ID:vulnerabilityCode,项目名称:hotel-system,代码行数:41,代码来源:PageLogin.php

示例11: loadDataFromRequest

 /**
  * @param WebRequest $request
  *
  * @return string
  */
 function loadDataFromRequest($request)
 {
     if ($this->mParent->getMethod() == 'post') {
         if ($request->wasPosted()) {
             # Checkboxes are just not added to the request arrays if they're not checked,
             # so it's perfectly possible for there not to be an entry at all
             return $request->getArray($this->mName, array());
         } else {
             # That's ok, the user has not yet submitted the form, so show the defaults
             return $this->getDefault();
         }
     } else {
         # This is the impossible case: if we look at $_GET and see no data for our
         # field, is it because the user has not yet submitted the form, or that they
         # have submitted it with all the options unchecked? We will have to assume the
         # latter, which basically means that you can't specify 'positive' defaults
         # for GET forms.
         # @todo FIXME...
         return $request->getArray($this->mName, array());
     }
 }
开发者ID:eliagbayani,项目名称:LiteratureEditor,代码行数:26,代码来源:HTMLMultiSelectField.php

示例12: LoginForm

 /**
  * Constructor
  * @param WebRequest $request A WebRequest object passed by reference
  */
 function LoginForm(&$request)
 {
     global $wgLang, $wgAllowRealName, $wgEnableEmail;
     global $wgAuth;
     $this->mType = $request->getText('type');
     $this->mName = $request->getText('wpName');
     $this->mPassword = $request->getText('wpPassword');
     $this->mRetype = $request->getText('wpRetype');
     $this->mDomain = $request->getText('wpDomain');
     $this->mReturnTo = $request->getVal('returnto');
     $this->mCookieCheck = $request->getVal('wpCookieCheck');
     $this->mPosted = $request->wasPosted();
     $this->mCreateaccount = $request->getCheck('wpCreateaccount');
     $this->mCreateaccountMail = $request->getCheck('wpCreateaccountMail') && $wgEnableEmail;
     $this->mMailmypassword = $request->getCheck('wpMailmypassword') && $wgEnableEmail;
     $this->mLoginattempt = $request->getCheck('wpLoginattempt');
     $this->mAction = $request->getVal('action');
     $this->mRemember = $request->getCheck('wpRemember');
     $this->mLanguage = $request->getText('uselang');
     if ($wgEnableEmail) {
         $this->mEmail = $request->getText('wpEmail');
     } else {
         $this->mEmail = '';
     }
     if ($wgAllowRealName) {
         $this->mRealName = $request->getText('wpRealName');
     } else {
         $this->mRealName = '';
     }
     if (!$wgAuth->validDomain($this->mDomain)) {
         $this->mDomain = 'invaliddomain';
     }
     $wgAuth->setDomain($this->mDomain);
     # When switching accounts, it sucks to get automatically logged out
     if ($this->mReturnTo == $wgLang->specialPage('Userlogout')) {
         $this->mReturnTo = '';
     }
 }
开发者ID:Jobava,项目名称:diacritice-meta-repo,代码行数:42,代码来源:SpecialUserlogin.php

示例13: CategorySelectImportFormData

/**
 * Concatenate categories on EditPage POST
 *
 * @param EditPage $editPage
 * @param WebRequest $request
 *
 * @author Maciej Błaszkowski <marooned at wikia-inc.com>
 * @author Lucas Garczewski <tor@wikia-inc.com>
 */
function CategorySelectImportFormData($editPage, $request)
{
    global $wgCategorySelectCategoriesInWikitext, $wgContLang, $wgEnableAnswers;
    if ($request->wasPosted()) {
        $sourceType = $request->getVal('wpCategorySelectSourceType');
        if ($sourceType == 'wiki') {
            $categories = "\n" . trim($editPage->safeUnicodeInput($request, 'csWikitext'));
        } else {
            //json
            $categories = $editPage->safeUnicodeInput($request, 'wpCategorySelectWikitext');
            $categories = CategorySelectChangeFormat($categories, 'json', 'wiki');
            if (trim($categories) == '') {
                $categories = '';
            }
        }
        if ($editPage->preview || $editPage->diff) {
            $data = CategorySelect::SelectCategoryAPIgetData($editPage->textbox1 . $categories);
            $editPage->textbox1 = $data['wikitext'];
            $categories = CategorySelectChangeFormat($data['categories'], 'array', 'wiki');
        } else {
            //saving article
            if (!empty($wgEnableAnswers)) {
                // don't add categories if the page is a redirect
                $magicWords = $wgContLang->getMagicWords();
                $redirects = $magicWords['redirect'];
                array_shift($redirects);
                // first element doesn't interest us
                // check for localized versions of #REDIRECT
                foreach ($redirects as $alias) {
                    if (stripos($editPage->textbox1, $alias) === 0) {
                        return true;
                    }
                }
            }
            // rtrim needed because of BugId:11238
            $editPage->textbox1 .= rtrim($categories);
        }
        $wgCategorySelectCategoriesInWikitext = $categories;
    }
    return true;
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:50,代码来源:CategorySelect.php

示例14: runPage

 protected function runPage()
 {
     if (WebRequest::wasPosted()) {
         if (!WebRequest::postInt("calroom")) {
             $this->showCal();
             return;
         }
         $startdate = new DateTime(WebRequest::post("qbCheckin"));
         $enddate = new DateTime(WebRequest::post("qbCheckout"));
         $room = Room::getById(WebRequest::postInt("calroom"));
         for ($date = $startdate; $date < $enddate; $date->modify("+1 day")) {
             if (!$room->isAvailable($date)) {
                 $this->error("room-not-available");
                 $this->showCal();
                 return;
             }
         }
         // search for customer
         if (!($customer = Customer::getByEmail(WebRequest::post("qbEmail")))) {
             $customer = new Customer();
             $suTitle = WebRequest::post("qbTitle");
             $suFirstname = WebRequest::post("qbFirstname");
             $suLastname = WebRequest::post("qbLastname");
             $suAddress = WebRequest::post("qbAddress");
             $suCity = WebRequest::post("qbCity");
             $suPostcode = WebRequest::post("qbPostcode");
             $suCountry = WebRequest::post("qbCountry");
             $suEmail = WebRequest::post("qbEmail");
             $customer->setPassword($suEmail);
             // set values
             $customer->setTitle($suTitle);
             $customer->setFirstname($suFirstname);
             $customer->setSurname($suLastname);
             $address = new Address();
             $address->setLine1($suAddress);
             $address->setCity($suCity);
             $address->setPostCode($suPostcode);
             $address->setCountry($suCountry);
             $address->save();
             $customer->setAddress($address);
             $customer->setEmail($suEmail);
             // save it
             $customer->save();
             $customer->sendMailConfirm();
             // save it again
             $customer->save();
         }
         $booking = new Booking();
         $booking->setStartDate(WebRequest::post("qbCheckin"));
         $booking->setEndDate(WebRequest::post("qbCheckout"));
         $booking->setAdults(WebRequest::post("qbAdults"));
         $booking->setChildren(WebRequest::post("qbChildren"));
         $booking->setPromocode(WebRequest::post("qbPromoCode"));
         $booking->setRoom($room->getId());
         $booking->setCustomer($customer->getId());
         $booking->save();
         $msg = Message::getMessage("booking-confirmation");
         $msg = str_replace("\$1", $booking->getStartDate(), $msg);
         $msg = str_replace("\$2", $booking->getEndDate(), $msg);
         $msg = str_replace("\$3", $booking->getAdults(), $msg);
         $msg = str_replace("\$4", $booking->getChildren(), $msg);
         $msg = str_replace("\$5", $booking->getRoom()->getName(), $msg);
         Mail::send($customer->getEmail(), Message::getMessage("booking-confimation-subject"), $msg);
         $this->mSmarty->assign("content", $msg);
         return;
     }
     throw new YouShouldntBeDoingThatException();
 }
开发者ID:vulnerabilityCode,项目名称:hotel-system,代码行数:68,代码来源:PageCalendar.php

示例15: showEditBookingPage

 private function showEditBookingPage()
 {
     if (WebRequest::wasPosted()) {
         try {
             // get variables
             $bcust = WebRequest::postInt("bcust");
             $badults = WebRequest::postInt("badults");
             $bchildren = WebRequest::postInt("bchildren");
             $bstart = WebRequest::post("bstart");
             $bend = WebRequest::post("bend");
             $bpromo = WebRequest::postInt("bpromo");
             $broom = WebRequest::PostInt("broom");
             $id = WebRequest::getInt("id");
             // data validation
             if ($badults == 0) {
                 throw new CreateBookingException("no-adults");
             }
             if ($bstart == null) {
                 throw new CreateBookingException("no-start-date");
             }
             if ($bend == null) {
                 throw new CreateBookingException("no-end-date");
             }
             if ($bcust == null) {
                 throw new CreateBookingException("no-customer-for-booking");
             }
             $booking = Booking::getById($id);
             if ($booking == null) {
                 throw new CreateBookingException("Booking does not exist");
             }
             // set values
             $booking->setCustomer($bcust);
             $booking->setAdults($badults);
             $booking->setChildren($rmin);
             $booking->setStartDate($rmax);
             $booking->setEndDate($rprice);
             $booking->setPromocode($bpromo);
             $booking->setRoom($broom);
             $booking->save();
             global $cScriptPath;
             $this->mHeaders[] = "Location: {$cScriptPath}/Bookings";
         } catch (CreateBookingException $ex) {
             $this->mBasePage = "mgmt/bookingEdit.tpl";
             $this->error($ex->getMessage());
         }
     } else {
         try {
             $this->mBasePage = "mgmt/bookingEdit.tpl";
             $booking = Booking::getById(WebRequest::getInt("id"));
             if ($booking == null) {
                 throw new Exception("Booking does not exist");
             }
             $this->mSmarty->assign("bookingid", $booking->getId());
             $this->mSmarty->assign("bcust", $booking->getCustomer()->getId());
             $this->mSmarty->assign("badults", $booking->getAdults());
             $this->mSmarty->assign("bchildren", $booking->getChildren());
             $this->mSmarty->assign("bstart", $booking->getStartDate());
             $this->mSmarty->assign("bend", $booking->getEndDate());
             $this->mSmarty->assign("bpromo", $booking->getPromocode());
             $this->mSmarty->assign("broom", $booking->getRoom()->getId());
         } catch (Exception $ex) {
             $this->mBasePage = "mgmt/bookingEdit.tpl";
             $this->error($ex->getMessage());
         }
     }
 }
开发者ID:vulnerabilityCode,项目名称:hotel-system,代码行数:66,代码来源:MPageBookings.php


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