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


PHP UserDao::getUserByID方法代码示例

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


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

示例1: updateReservationStatus

 public static function updateReservationStatus($resId, $status, $sendEmail)
 {
     Database::doQuery("UPDATE " . Database::addPrefix(ReservationDao::table_name) . " SET mod_status = '" . Database::makeStringSafe($status) . "'" . " WHERE res_id = '" . Database::makeStringSafe($resId) . "'");
     if ($sendEmail) {
         $reservation = ReservationDao::getReservation($resId);
         $user = UserDao::getUserByID($reservation->userId);
         EmailUtil::sendUpdateReservationNotice($user, $reservation);
     }
 }
开发者ID:ramielrowe,项目名称:Reservation-System-V2,代码行数:9,代码来源:ReservationDao.php

示例2: createUser

 public static function createUser($username, $name, $email, $userlevel, $password)
 {
     $username = Database::makeStringSafe($username);
     $name = Database::makeStringSafe($name);
     $email = Database::makeStringSafe($email);
     $userlevel = Database::makeStringSafe($userlevel);
     $encPassword = Database::makeStringSafe(CryptoUtil::encrypt($password));
     Database::doQuery("INSERT INTO " . Database::addPrefix(UserDao::table_name) . " SET username = '" . $username . "', name = '" . $name . "', email = '" . $email . "', user_level = '" . $userlevel . "', password = '" . $encPassword . "'");
     return UserDao::getUserByID(mysql_insert_id());
 }
开发者ID:ramielrowe,项目名称:Reservation-System-V2,代码行数:10,代码来源:UserDao.php

示例3: sendWarningNoticeToUser

 public static function sendWarningNoticeToUser(Warning $warning)
 {
     $user = UserDao::getUserByID($warning->userId);
     if ($warning->type == RES_WARNING_NOTE) {
         $body = "You have been issued a Notification, you can view it at: " . Config::location . "index.php?pageid=viewWarning&warnid=" . $warning->id;
         EmailUtil::sendEmail($user->email, "New Notification", $body);
     } else {
         $body = "You have been issued an " . $warning->getTypeString() . " Warning, you can view it at: " . Config::location . "index.php?pageid=viewWarning&warnid=" . $warning->id;
         EmailUtil::sendEmail($user->email, "New " . $warning->getTypeString() . " Warning Notice", $body);
     }
 }
开发者ID:ramielrowe,项目名称:Reservation-System-V2,代码行数:11,代码来源:EmailUtil.php

示例4: generateHTML

 public function generateHTML()
 {
     $reservation = ReservationDao::getReservation($_GET['resid']);
     if ($reservation == null) {
         $this->context->addError("Reservation Doesn't Exist.");
         return $this->context->getErrorHTML();
     }
     $user = UserDao::getUserByID($reservation->userId);
     $equip = EquipmentDao::getEquipmentByID($reservation->equipId);
     return "\n\t\t\t<center><h3>Reseravation Info</h3></center>\n\t\t\t<table class=\"viewreservation\">\n\t\t\t\t<tr>\n\t\t\t\t\t\n\t\t\t\t\t<td colspan=4 class=\"header\">User Information</td>\n\t\t\t\t\t\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\n\t\t\t\t\t<td class=\"centeredcellbold\">Name</th>\n\t\t\t\t\t<td class=\"centeredcell\">" . $user . "</td>\n\t\t\t\t\t<td class=\"centeredcellbold\">Warnings</th>\n\t\t\t\t\t<td class=\"centeredcell\"><a href=\"./index.php?pageid=viewWarnings&userid=" . $user->id['user_id'] . "\">" . WarningDao::getWarningCountForUserByType($user->id, RES_WARNING_ACTIVE) . "(" . WarningDao::getWarningCountForUser($user->id) . ")</a></td>\n\t\t\t\t\t\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t\n\t\t\t\t\t<td colspan=4 class=\"header\">Equipment Information</td>\n\t\t\t\t\t\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t\n\t\t\t\t\t<td colspan=2 class=\"centeredcellbold\">Name</th>\n\t\t\t\t\t<td colspan=2 class=\"centeredcell\">" . $equip . "</td>\n\t\t\t\t\t\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t\n\t\t\t\t\t<td colspan=4 class=\"header\">Reservation Information</td>\n\t\t\t\t\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\n\t\t\t\t\t<td class=\"centeredcellbold\">Start Date</td>\n\t\t\t\t\t<td class=\"centeredcell\">" . $reservation->startDate . "</td>\n\t\t\t\t\t<td class=\"centeredcellbold\">End Date</td>\n\t\t\t\t\t<td class=\"centeredcell\">" . $reservation->endDate . "</td>\n\t\t\t\t\t\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td colspan=4 class=\"centeredcellbold\">Current Status: " . $reservation->getColoredModStatusString() . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t\n\t\t\t\t\t<td colspan=4 class=\"centeredcellbold\">User Comment</td>\n\t\t\t\t\t\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t\n\t\t\t\t\t<td colspan=4 class=\"topaligncell\">&nbsp;" . $reservation->userComment . "</td>\n\t\t\t\t\t\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t\n\t\t\t\t\t<td colspan=4 class=\"centeredcellbold\">Admin Comment</td>\n\t\t\t\t\t\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t\n\t\t\t\t\t<td colspan=4 class=\"topaligncell\">&nbsp;" . $reservation->adminComment . "</td>\n\t\t\t\t\t\n\t\t\t\t</tr>\n\t\t\t\t" . $this->getCheckinRow($reservation) . "\n\t\t\t\n\t\t\t</table>\n\t\t\n\t\t";
 }
开发者ID:ramielrowe,项目名称:Reservation-System-V2,代码行数:11,代码来源:ViewReservationBody.php

示例5: generateHTML

 public function generateHTML()
 {
     if (isset($_GET['userid'])) {
         $userId = $_GET['userid'];
     } else {
         if (isset($_POST['userId'])) {
             $userId = $_POST['userId'];
         } else {
             $this->context->addError("No user selected.");
             return $this->context->getErrorHTML() . $this->context->getMessagesHTML();
         }
     }
     $user = UserDao::getUserByID($userId);
     return "<center><h3>Create Warning For " . $user . "</h3></center>" . $this->context->getErrorHTML() . $this->context->getMessagesHTML() . "<br /><form action=\"./index.php?pageid=warnUser\" method=\"POST\">\n\t\t<input type=\"hidden\" name=\"action\" value=\"createWarning\">\n\t\t<input type=\"hidden\" name=\"userId\" value=\"" . $user->id . "\">\n\t\t\t<table class=\"warning\">\n\t\t\t\n\t\t\t\t<tr>\n\t\t\t\t\n\t\t\t\t\t<td colspan=2 class=\"header\">Warn Reason</td>\n\t\t\t\t\t\n\t\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=2 class=\"centeredcellbold\"><textarea cols=\"55\" rows=\"7\" name=\"reason\"></textarea></td>\n\t\t\t\t\n\t\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 class=\"centeredcell\"><select name=\"type\"><option value=\"1\">Active</option><option value=\"2\">Notification</option><option value=\"3\">Inactive</option></select></td>\n\t\t\t\t\t<td class=\"centeredcell\"><input type=\"submit\" value=\"Warn\"></textarea></td>\n\t\t\t\t\n\t\t\t\t</tr>\n\t\t\t\n\t\t\t</table>\n\t\t\n\t\t</form>";
 }
开发者ID:ramielrowe,项目名称:Reservation-System-V2,代码行数:15,代码来源:WarnUserBody.php

示例6: generateHTML

 public function generateHTML()
 {
     $myuser = UserDao::getUserByUsername(SessionUtil::getUsername());
     $user = UserDao::getUserByID($_GET['userid']);
     if ($myuser->userlevel < RES_USERLEVEL_ADMIN) {
         $this->context->addError("Not Authorized.");
         return $this->context->getErrorHTML();
     }
     $warnings = WarningDao::getAllWarningsForUser($user->id);
     $options = "";
     foreach ($warnings as $warning) {
         $options .= $warning->toOptionHTML();
     }
     $warningSelect = $user . " has no warnings.";
     if ($options != "") {
         $warningSelect = "<form action=\"./index.php\" method=\"GET\">" . "<input type=\"hidden\" name=\"pageid\" value=\"viewWarning\" />" . "<select name=\"warnid\">" . $options . "</select>" . "<input type=\"submit\" value=\"View\" />" . "</form>";
     }
     return "<center><h3>View Warnings For " . $user . "</h3></center>" . $warningSelect;
 }
开发者ID:ramielrowe,项目名称:Reservation-System-V2,代码行数:19,代码来源:ViewWarningsBody.php

示例7: generateHTML

 public function generateHTML()
 {
     $userid;
     if (isset($_GET['userid'])) {
         $userid = $_GET['userid'];
     } else {
         if (isset($_POST['userid'])) {
             $userid = $_POST['userid'];
         }
     }
     if (isset($userid)) {
         $user = UserDao::getUserByID($userid);
         $passwordRows = "";
         if (Config::login_type == LOGIN_TYPE_DB) {
             $passwordRows = $this->generatePasswordRows($user);
         }
         return $this->context->getErrorHTML() . $this->context->getMessagesHTML() . "<table class=\"userinfo\">\n\t\t\n\t\t\t<tr>\n\t\t\t\n\t\t\t\t<td colspan=4 class=\"header\">User Information</td>\n\t\t\t\n\t\t\t</tr>\n\t\t\n\t\t\t<tr>\n\t\n\t\t\t\t<td class=\"centeredcellbold\">Username</th>\n\t\t\t\t<td colspan=3 class=\"centeredcell\">" . $user->username . "</td>\n\t\t\t\t\n\t\t\t</tr>\n\t\t\n\t\t\t<tr>\n\t\t\t\t<form action=\"./index.php?pageid=editUser\" method=\"POST\">\n\t\t\t\t<input type=\"hidden\" name=\"action\" value=\"saveName\">\n\t\t\t\t<input type=\"hidden\" name=\"userid\" value=\"" . $user->id . "\">\n\t\t\t\t<td class=\"centeredcellbold\">Name</td>\n\t\t\t\t<td colspan=3 class=\"centeredcell\"><input type=\"text\" name=\"name\" size=\"25\" value=\"" . $user->name . "\"><input type=\"submit\" value=\"Save Name\"></td>\n\t\t\t\t</form>\n\t\t\t\t\n\t\t\t</tr>\n\t\t\t\n\t\t\t" . $passwordRows . "\n\t\t\n\t\t\t<tr>\n\t\t\t\t\n\t\t\t\t<td colspan=1 class=\"centeredcellbold\">Email</td>\n\t\t\t\t<form action=\"./index.php?pageid=editUser\" method=\"POST\">\n\t\t\t\t<input type=\"hidden\" name=\"action\" value=\"saveEmail\">\n\t\t\t\t<input type=\"hidden\" name=\"userid\" value=\"" . $user->id . "\">\n\t\t\t\t<td colspan=3 class=\"centeredcell\"><input type=\"text\" name=\"email\" size=30 value=\"" . $user->email . "\"><input type=\"submit\" value=\"Save Email\"></td>\n\t\t\t\t</form>\n\t\t\t\t\t\n\t\t\t</tr>\n\t\t\n\t\t\t<tr>\n\t\t\t\t\n\t\t\t\t<td colspan=1 class=\"centeredcellbold\">Userlevel</td>\n\t\t\t\t<form action=\"./index.php?pageid=editUser\" method=\"POST\">\n\t\t\t\t<td colspan=3 class=\"centeredcell\">\n\t\t\t\t<input type=\"hidden\" name=\"action\" value=\"saveUserLevel\">\n\t\t\t\t<input type=\"hidden\" name=\"userid\" value=\"" . $user->id . "\">\n\t\t\t\t" . $this->generateUserLevelDropdown("level", $user->userlevel) . "<input type=\"submit\" value=\"Save Level\"></td>\n\t\t\t\t</form>\n\t\t\t\t\t\n\t\t\t</tr>\n\t\n\t\t\t<tr>\n\t\t\t\n\t\t\t\t<td colspan=1 class=\"centeredcellbold\">Warnings</td>\n\t\t\t\t<td class=\"centeredcell\" colspan=2><a href=\"./index.php?pageid=viewWarnings&userid=" . $user->id['user_id'] . "\">" . WarningDao::getWarningCountForUserByType($user->id, RES_WARNING_ACTIVE) . "(" . WarningDao::getWarningCountForUser($user->id) . ")</a></td>\n\t\t\t\t<td class=\"centeredcell\" colspan=1><a href=\"./index.php?pageid=warnUser&userid=" . $user->id . "\">Warn User</a></td>\n\t\t\t\n\t\t\t</tr>\n\t\t\t\n\t\t\t<tr>\n\t\t\t\n\t\t\t\t<td colspan=4 class=\"centeredcellbold\">User Notes</th>\n\t\t\t\n\t\t\t</tr>\n\t\t\t\n\t\t\t<tr>\n\t\t\t\n\t\t\t\t<td colspan=4 class=\"centeredcellbold\">\n\t\t\t\t<br><form action=\"./index.php?pageid=editUser\" method=\"POST\">\n\t\t\t\t<input type=\"hidden\" name=\"action\" value=\"saveNotes\">\n\t\t\t\t<input type=\"hidden\" name=\"userid\" value=\"" . $user->id . "\">\n\t\t\t\t<textarea cols=60 rows=8 name=\"notes\">" . $user->notes . "</textarea>\n\t\t\t\t<br><input type=\"submit\" value=\"Save Notes\"></form></th>\n\t\t\t\n\t\t\t</tr>\n\t\t\t\t\n\t\t</table>";
     } else {
         $this->context->addError("No User Selected");
         return $this->context->getErrorHTML() . $this->context->getMessagesHTML();
     }
 }
开发者ID:ramielrowe,项目名称:Reservation-System-V2,代码行数:22,代码来源:EditUserBody.php

示例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;
 }
开发者ID:ramielrowe,项目名称:Reservation-System-V2,代码行数:39,代码来源:OurEquipBody.php

示例9: handleForm

 public function handleForm(Context $context, $action)
 {
     if (UserDao::getUserByUsername(SessionUtil::getUsername())->userlevel == RES_USERLEVEL_ADMIN) {
         if ($action == "createWarning") {
             if (isset($_POST['userId']) && $_POST['userId'] != "" && (isset($_POST['reason']) && $_POST['reason'] != "") && (isset($_POST['type']) && $_POST['type'] != "")) {
                 $user = UserDao::getUserByID($_POST['userId']);
                 if ($user != null) {
                     $warning = WarningDao::warnUser($_POST['userId'], $_POST['reason'], $_POST['type']);
                     EmailUtil::sendWarningNoticeToUser($warning);
                     $context->addMessage("Successfully warned " . $user);
                 } else {
                     $context->addError("No such user.");
                 }
             } else {
                 $context->addError("Required field left blank.");
             }
         } else {
             $context->addError("Incorrect Action.");
         }
     } else {
         $context->addError("Not Authorized.");
     }
 }
开发者ID:ramielrowe,项目名称:Reservation-System-V2,代码行数:23,代码来源:WarnUserHandler.php

示例10: generateHTML

 public function generateHTML()
 {
     $myuser = UserDao::getUserByUsername(SessionUtil::getUsername());
     $warning = WarningDao::getWarningByID($_GET['warnid']);
     $user = UserDao::getUserByID($warning->userId);
     if ($user->id != $myuser->id && $myuser->userlevel < RES_USERLEVEL_ADMIN) {
         $this->context->addError("Not Authorized.");
         return $this->context->getErrorHTML();
     }
     $warnings = WarningDao::getAllWarningsForUser($user->id);
     $options = "";
     foreach ($warnings as $warning) {
         $options .= $warning->toOptionHTML();
     }
     $warningSelect = $user . " has no warnings.";
     if ($options != "") {
         $warningSelect = "<form action=\"./index.php\" method=\"GET\">" . "<input type=\"hidden\" name=\"pageid\" value=\"viewWarning\" />" . "<select>" . $options . "</select>" . "<input type=\"submit\" value=\"View\" />" . "</form>";
     }
     $adminRow = "";
     if ($myuser->userlevel >= RES_USERLEVEL_ADMIN) {
         $adminRow = "<tr><form action=\"./index.php?pageid=adminWarning\" method=\"POST\">" . "<td colspan=2 class=\"centeredcellbold\">" . "<input type=\"hidden\" name=\"action\" value=\"deleteWarning\" />" . "<input type=\"hidden\" name=\"warnId\" value=\"" . $warning->id . "\" />" . "<input type=\"submit\" value=\"Delete\" /></td></form></tr>";
     }
     return "<center><h3>View Warning For " . $user . "</h3></center><table class=\"warning\">\n\t\t\t\n\t\t\t<tr>\n\t\t\t\n\t\t\t\t<td class=\"header\">Type</td>\n\t\t\t\t<td class=\"header\">Time</td>\n\t\t\t\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\n\t\t\t\t<td class=\"centeredcell\">" . $warning->getTypeString() . "</td>\n\t\t\t\t<td class=\"centeredcell\">" . $warning->datetime . "</td>\n\t\t\t\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\n\t\t\t\t<td colspan=2 class=\"header\">Warning Reason</td>\n\t\t\t\n\t\t\t</tr>\n\t\t\t\n\t\t\t<tr>\n\t\t\t\n\t\t\t\t<td colspan=2 class=\"centeredcell\"><textarea cols=\"55\" rows=\"7\" readonly>" . $warning->reason . "</textarea></td>\n\t\t\t\n\t\t\t</tr>\n\t\t\t" . $adminRow . "\n\t\t\n\t\t</table>";
 }
开发者ID:ramielrowe,项目名称:Reservation-System-V2,代码行数:24,代码来源:ViewWarningBody.php


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