本文整理汇总了PHP中WebRequest::postInt方法的典型用法代码示例。如果您正苦于以下问题:PHP WebRequest::postInt方法的具体用法?PHP WebRequest::postInt怎么用?PHP WebRequest::postInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WebRequest
的用法示例。
在下文中一共展示了WebRequest::postInt方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: 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", " ");
}
}
示例3: showChangeAccessPage
private function showChangeAccessPage()
{
if (WebRequest::wasPosted()) {
try {
$userid = WebRequest::getInt("id");
$level = WebRequest::postInt("accesslevel");
$user = InternalUser::getById($userid);
if ($user == null) {
throw new Exception("User does not exist");
}
$user->setAccessLevel($level);
$user->save();
global $cScriptPath;
$this->mHeaders[] = "Location: {$cScriptPath}/SystemUsers";
} catch (CreateUserException $ex) {
$this->mBasePage = "mgmt/iuserSetAccess.tpl";
$this->error($ex->getMessage());
}
} else {
$this->mSmarty->assign("userid", WebRequest::getInt("id"));
$this->mBasePage = "mgmt/iuserSetAccess.tpl";
}
}
示例4: showCal
public function showCal()
{
$this->mBasePage = "cal.tpl";
global $cWebPath;
$startdate = new DateTime(WebRequest::post("qbCheckin"));
$enddate = new DateTime(WebRequest::post("qbCheckout"));
$idlist = Room::getIdList();
$dates = array();
for ($date = $startdate; $date < $enddate; $date->modify("+1 day")) {
$dates[] = clone $date;
}
$availabilityMatrix = array();
$roomlist = array();
foreach ($idlist as $id) {
$r = Room::getById($id);
$roomlist[$id] = $r;
$availabilityMatrix[$id] = array();
foreach ($dates as $d) {
$availabilityMatrix[$id][array_search($d, $dates)] = !$r->isAvailable($d);
}
}
$this->mSmarty->assign("availmatrix", $availabilityMatrix);
$this->mSmarty->assign("datelist", $dates);
$this->mSmarty->assign("roomlist", $roomlist);
$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"));
$this->mSmarty->assign("valQbTitle", WebRequest::post("qbTitle"));
$this->mSmarty->assign("valQbFirstname", WebRequest::post("qbFirstname"));
$this->mSmarty->assign("valQbLastname", WebRequest::post("qbLastname"));
$this->mSmarty->assign("valQbAddress", WebRequest::post("qbAddress"));
$this->mSmarty->assign("valQbCity", WebRequest::post("qbCity"));
$this->mSmarty->assign("valQbPostcode", WebRequest::post("qbPostcode"));
$this->mSmarty->assign("valQbCountry", WebRequest::post("qbCountry"));
$this->mSmarty->assign("valQbEmail", WebRequest::post("qbEmail"));
}
示例5: 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());
}
}
}
示例6: 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);
}