本文整理汇总了PHP中SessionUtil::getUserlevel方法的典型用法代码示例。如果您正苦于以下问题:PHP SessionUtil::getUserlevel方法的具体用法?PHP SessionUtil::getUserlevel怎么用?PHP SessionUtil::getUserlevel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SessionUtil
的用法示例。
在下文中一共展示了SessionUtil::getUserlevel方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __toString
public function __toString()
{
if (SessionUtil::getUserlevel() >= RES_USERLEVEL_ADMIN) {
return "<a href=\"./index.php?pageid=editUser&userid=" . $this->id . "\">" . $this->name . "</a>";
}
return $this->name;
}
示例2: handleForm
public function handleForm(Context $context, $action)
{
if ($action == "createReservation") {
if (isset($_POST['equip_id']) && $_POST['equip_id'] != "" && (isset($_POST['start_date']) && $_POST['start_date'] != "") && (isset($_POST['length']) && $_POST['length'] != "")) {
$equipId = $_POST['equip_id'];
$equip = EquipmentDao::getEquipmentByID($equipId);
if ($equip != null) {
if (SessionUtil::getUserlevel() >= $equip->minUserLevel) {
$startDate = $_POST['start_date'];
$endDate = DateUtil::incrementDate($startDate, $_POST['length']);
$reservations = ReservationDao::getReservationsForEquipmentByDate($equipId, $startDate, $endDate);
if (count($reservations) == 0) {
$user = UserDao::getUserByUsername(SessionUtil::getUsername());
$reservation = ReservationDao::createReservation($user->id, $equipId, $_POST['length'], $startDate, $endDate, $_POST['user_comment']);
EmailUtil::sendNewReservationNotices($user, $reservation);
} else {
$context->addError("Reservations already exist during selected dates ({$startDate} and {$endDate}).");
}
} else {
$context->addError("Cannot reserve equipment (User Level).");
}
} else {
$context->addError("No such equipment.");
}
} else {
$context->addError("Required Field Left Blank.");
}
} else {
$context->addError("Incorrect Action.");
}
}
示例3: generateHTML
public function generateHTML()
{
if (SessionUtil::getUserlevel() >= $this->getMinimumUserLevel()) {
return $this->layout->generateHTML();
} else {
return $this->userLevelErrorLayout->generateHTML();
}
}
示例4: getCheckinRow
private function getCheckinRow(Reservation $reservation)
{
if (SessionUtil::getUserlevel() == RES_USERLEVEL_ADMIN) {
return "<tr>\n\t\t\t\t\t\n\t\t\t\t\t<form action=\"./index.php?pageid=viewReservation\" method=\"POST\">\n\t\t\t\t\t<td class=\"centeredcellbold\">\n\t\t\t\t\t" . $this->getCheckinCell($reservation) . "\n\t\t\t\t\t</td>\n\t\t\t\t\t</form>\n\t\t\t\t\t<form action=\"./index.php?pageid=viewReservation\" method=\"POST\" onSubmit=\"return confirm('Are you sure you want to delete this reservation?')\">\n\t\t\t\t\t<td class=\"centeredcellbold\">\n\t\t\t\t\t\t<input type=\"hidden\" value=\"delete\" name=\"action\">\n\t\t\t\t\t\t<input type=\"hidden\" value=\"" . $reservation->id . "\" name=\"resid\">\n\t\t\t\t\t\t<input type=\"submit\" value=\"Delete\">\n\t\t\t\t\t</td>\n\t\t\t\t\t</form>\n\t\t\t\t\t<form action=\"./index.php?pageid=viewReservation\" method=\"POST\">\n\t\t\t\t\t<td class=\"centeredcellbold\">\n\t\t\t\t\t\t<input type=\"hidden\" value=\"" . $reservation->id . "\" name=\"resid\">\n\t\t\t\t\t\t<select name=\"status\">\n\t\t\t\t\t\t\t<option value=\"" . RES_STATUS_CONFIRMED . "\">Approve</option>\n\t\t\t\t\t\t\t<option value=\"" . RES_STATUS_DENIED . "\">Deny</option>\n\t\t\t\t\t\t</select>\n\t\t\t\t\t</td>\n\t\t\t\t\t<td class=\"centeredcellbold\">\n\t\t\t\t\t\t<input type=\"hidden\" value=\"updateStatus\" name=\"action\">\n\t\t\t\t\t\t<input type=\"hidden\" value=\"" . $reservation->id . "\" name=\"resid\">\n\t\t\t\t\t\t<input type=\"submit\" value=\"Update\">\n\t\t\t\t\t</td>\n\t\t\t\t\t</form>\n\t\t\t\t\t\n\t\t\t\t</tr>";
} else {
return "";
}
}
示例5: generateHTML
public function generateHTML()
{
if (!SessionUtil::isLoggedIn() && $this->layout->getBody() instanceof LoginBody) {
return $this->layout->generateHTML();
} else {
if (SessionUtil::isLoggedIn() && SessionUtil::getUserlevel() >= $this->getMinimumUserLevel()) {
return $this->layout->generateHTML();
} else {
return $this->userLevelErrorLayout->generateHTML();
}
}
}
示例6: generateHTML
public function generateHTML()
{
$user = UserDao::getUserByUsername(SessionUtil::getUsername());
if (WarningDao::getWarningCountForUserByType($user->id, RES_WARNING_ACTIVE) > RES_WARNING_MAX_ACTIVE) {
$this->context->addError("You have too many Active Warnings (more than " . RES_WARNING_MAX_ACTIVE . ") on your account to place Reservations.");
return $this->context->getErrorHTML() . $this->context->getMessagesHTML();
}
//TODO: do we need this?
$allEquipment = EquipmentDao::getAllEquipment();
$equipArray = array();
//^^^^^^^^^^^^^^^^^^^^^^^^^^
$page = "";
$success = false;
if (isset($_POST['equip_id']) && $_POST['equip_id'] != "") {
if (count($this->context->getErrors()) == 0) {
$page = "Successfully Created Reservation.";
$success = true;
} else {
$_GET['equipid'] = $_POST['equip_id'];
}
}
if (!$success && isset($_GET['equipid']) && $_GET['equipid'] != "") {
$equip = EquipmentDao::getEquipmentByID($_GET['equipid']);
if ($equip != null) {
if (SessionUtil::getUserlevel() >= $equip->minUserLevel) {
$lengthOptions = "";
for ($i = 1; $i <= $equip->maxLength; $i++) {
if ($i > 1) {
$lengthOptions = $lengthOptions . "<option value=\"" . $i . "\">" . $i . " Days</option>";
} else {
$lengthOptions = $lengthOptions . "<option value=\"" . $i . "\">" . $i . " Day</option>";
}
}
$page = "\n\n\t\t<form name=\"reservation\" action=\"./index.php?pageid=placeReservation\" method=\"POST\" onsubmit=\"return checkDate();\">\n\t\t<input type=\"hidden\" name=\"action\" value=\"createReservation\">\n\t\t<input type=\"hidden\" name=\"equip_id\" value=\"" . $_GET['equipid'] . "\">\n\t\t<table class=\"reservation\">\n\t\t\n\t\t\t<tr>\n\t\t\t\n\t\t\t\t<td colspan=4 class=\"header\">Reserve the " . $equip->name . "</td>\n\t\t\t\n\t\t\t</tr>\n\t\t\n\t\t\t<tr>\n\t\t\t\n\t\t\t\t<td class=\"centeredcellbold\">Date (YYYY-MM-DD)</td>\n\t\t\t\t<td class=\"centeredcell\">\n\t\t\t\t\t<input type=\"text\" readonly name=\"start_date\" id=\"startdate\" class=\"date\" value=\"blah\"/>\n\t\t\t\t</td>\n\t\t\t\t<td class=\"centeredcellbold\">Length</td>\n\t\t\t\t<td class=\"centeredcell\"><select name=\"length\">" . $lengthOptions . "</select></td>\n\t\t\n\t\t\t</tr>\n\n\t\t\t<tr>\n\t\t\t\n\t\t\t\t<td colspan=1 class=\"centeredcellbold\">User Comment</th>\n\t\t\t\t<td class=\"centeredcell\" colspan=3><textarea rows=5 cols=45 name=\"user_comment\"></textarea></td>\n\t\t\t\n\t\t\t</tr>\n\t\t\t\t\n\t\t\t\t<tr>\n\t\t\t\t\n\t\t\t\t\t<td colspan=4 class=\"centeredcell\"><input type=\"submit\" value=\"Reserve\"></td>\n\t\t\n\t\t\t\t</tr>\n\t\t\t\t\n\t\t\t</table>\n\t\t\t</form></div>";
} else {
$this->context->addError("Cannot reserve equipment (User Level).");
}
} else {
$this->context->addError("No equipment with ID '" . $_GET['equipid'] . "'.");
}
} else {
if (!$success) {
$this->context->addError("No equipment selected.");
}
}
return "<center><h3>Place Reservation</h3>" . $this->context->getErrorHTML() . "</center>" . $page;
}
示例7: generateHTML
public function generateHTML()
{
if (SessionUtil::isLoggedIn()) {
$userlevel = SessionUtil::getUserlevel();
$navi = "";
if ($userlevel == RES_USERLEVEL_NOLOGIN) {
$navi = $navi . "<tr><td class=\"navi\">\n\t\t\t\t\t\t\t<a href=\"./index.php?pageid=logout\" class=\"navi\">Logout</a>\n\t\t\t\t\t\t</td></tr>";
}
if ($userlevel > RES_USERLEVEL_NOLOGIN) {
$navi = $navi . "<tr><td class=\"navi\">\n\t\t\t\t\t\t\t<a href=\"./index.php?pageid=home\" class=\"navi\">Home</a> - \n\t\t\t\t\t\t\t<a href=\"./index.php?pageid=ourEquip\" class=\"navi\">Our Equipment</a> - \n\t\t\t\t\t\t\t<a href=\"./index.php?pageid=myAccount\" class=\"navi\">My Account</a> - \n\t\t\t\t\t\t\t<a href=\"./index.php?pageid=logout\" class=\"navi\">Logout</a>\n\t\t\t\t\t\t</td></tr>";
}
if ($userlevel == 3) {
$navi = $navi . "<tr>\n\t\t\t\t\t\t<td class=\"adminnaviouter\">\n\t\t\t\t\t\t\t<table cellpadding=0 cellspacing=0 border=0 class=\"adminnavi\">\n\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t<td class=\"adminnaviinner\">\n\t\t\t\t\t\t\t\t\t\t  <a href=\"./index.php?pageid=browseres\" class=\"navi\">Browse Reservations</a>  \n\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t</table>\n\t\t\t\t\t\t</td>";
}
if ($userlevel >= RES_USERLEVEL_ADMIN) {
$navi = $navi . "<tr>\n\t\t\t\t\t\n\t\t\t\t\t\t<td class=\"adminnaviouter\">\n\t\t\t\t\t\t\t<table cellpadding=0 cellspacing=0 border=0 class=\"adminnavi\">\n\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t<td class=\"adminnaviinner\">\n\t\t\t\t\t\t\t\t\t\t <a href=\"./index.php?pageid=userAdmin\" class=\"navi\">Users</a> - \n\t\t\t\t\t\t\t\t\t\t<a href=\"./index.php?pageid=manageequip\" class=\"navi\">Equipment</a> - \n\t\t\t\t\t\t\t\t\t\t<a href=\"./index.php?pageid=browseres\" class=\"navi\">Browse Reservations</a> - \n\t\t\t\t\t\t\t\t\t\t<a href=\"./index.php?pageid=makeres\" class=\"navi\">Make Reservation</a> - \n\t\t\t\t\t\t\t\t\t\t<a href=\"./index.php?pageid=manageblackouts\" class=\"navi\">Blackouts</a> - \n\t\t\t\t\t\t\t\t\t\t<a href=\"./index.php?pageid=messages\" class=\"navi\">Messages</a> \n\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t</table>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\n\t\t\t\t\t</tr>";
}
return $navi;
}
}
示例8: getEquipmentTable
private function getEquipmentTable($equipKeys, $equipArray)
{
$ourequipment = "";
foreach ($equipKeys as $key) {
$ourequipment = $ourequipment . "<h3>" . $key . "</h3><table class=\"ourequip\">\n\t\t\t\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t\n\t\t\t\t\t\t<td width=\"40%\" class=\"header\" id=\"" . $key . "\">Equipment Name</th>\n\t\t\t\t\t\t<td width=\"15%\" class=\"header\">--</th>\n\t\t\t\t\t\t<td width=\"25%\" class=\"header\">Status</th>\n\t\t\t\t\t\t<td width=\"20%\" class=\"header\">--</th>\n\t\t\t\t\t\t\n\t\t\t\t\t</tr>";
foreach ($equipArray[$key] as $row) {
$status = "-";
/*
The current piece of equipment is NOT at Calhoun
*/
//if(isEquipmentOut($row['equip_id'], getCurrentMySQLDate())){
//$status = "Out";
//}
/*
The current piece of equipment will be out of Calhoun in a few days
-For exact length see isEquipmentReserved() in functions.php
*/
//else if(isEquipmentReserved($row['equip_id'], getCurrentMySQLDate())){
//$status = "Reserved";
//}
//else{
//$status = "Available";
//}
/*
Check logged in user's user level against the equipments min user level
*/
if (SessionUtil::getUserlevel() >= $row->minUserLevel) {
if ($row->checkOutFrom == -1) {
$ourequipment = $ourequipment . "<tr><td class=\"centeredcell\">" . $row->name . "</td><td class=\"centeredcell\"><a href=\"./index.php?pageid=moreInfo&equipid=" . $row->id . "\">More Info</a></td><td class=\"centeredcell\">" . $status . "</td><td class=\"centeredcell\"><a href=\"./index.php?pageid=placeReservation&equipid=" . $row->id . "\">Reserve</a></td></tr>";
} else {
$user = UserDao::getUserByID($row->checkOutFrom);
$ourequipment = $ourequipment . "<tr><td class=\"centeredcell\">" . $row->name . "</td><td class=\"centeredcell\"><a href=\"./index.php?pageid=moreInfo&equipid=" . $row->id . "\">More Info</a></td><td class=\"centeredcell\" colspan=2>Checkout from<br><a href=\"mailto:" . $user->email . "\">" . $user->name . "</a></td></tr>";
}
}
}
$ourequipment = $ourequipment . "</table>";
}
return $ourequipment;
}
示例9: handleForm
public function handleForm(Context $context, $action)
{
if ($action == "delete") {
if (SessionUtil::getUserlevel() == RES_USERLEVEL_ADMIN) {
ReservationDao::deleteReservation($_POST['resid']);
} else {
$context->addError("Action Not Allowed (Userlevel)");
}
} else {
if ($action == "checkin") {
if (SessionUtil::getUserlevel() >= RES_USERLEVEL_LEADER) {
ReservationDao::updateReservationStatus($_POST['resid'], RES_STATUS_CHECKED_IN, false);
} else {
$context->addError("Action Not Allowed (Userlevel)");
}
} else {
if ($action == "checkout") {
if (SessionUtil::getUserlevel() >= RES_USERLEVEL_LEADER) {
ReservationDao::updateReservationStatus($_POST['resid'], RES_STATUS_CHECKED_OUT, false);
} else {
$context->addError("Action Not Allowed (Userlevel)");
}
} else {
if ($action == "updateStatus") {
if (SessionUtil::getUserlevel() == RES_USERLEVEL_ADMIN) {
ReservationDao::updateReservationStatus($_POST['resid'], $_POST['status'], true);
} else {
$context->addError("Action Not Allowed (Userlevel)");
}
} else {
$context->addError("Incorrect Action.");
}
}
}
}
}