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


PHP DataAccess::GetUserByID方法代码示例

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


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

示例1: GetUser

 public function GetUser()
 {
     if (!$this->User) {
         $this->User = DataAccess::GetUserByID($this->UserID);
     }
     return $this->User;
 }
开发者ID:andopor,项目名称:doma-project,代码行数:7,代码来源:map_class.php

示例2: getMapCornerPositionsAndRouteCoordinates

function getMapCornerPositionsAndRouteCoordinates($id)
{
    $map = new Map();
    $map->Load($id);
    $user = DataAccess::GetUserByID($map->UserID);
    $categories = DataAccess::GetCategoriesByUserID($user->ID);
    return Helper::GetOverviewMapData($map, true, false, false, $categories);
}
开发者ID:andopor,项目名称:doma-project,代码行数:8,代码来源:ajax_server.php

示例3: Execute

 public function Execute()
 {
     $viewData = array();
     $errors = array();
     $comment = new Comment();
     // no user specified - redirect to user list page
     if (isset($_POST["comment_text"])) {
         $comment->Comment = stripslashes(strip_tags(urldecode($_POST["comment_text"])));
     } else {
         die("No comment text");
     }
     if (isset($_POST["user_name"])) {
         $comment->Name = stripslashes(strip_tags(urldecode($_POST["user_name"])));
     } else {
         die("No user name");
     }
     if (isset($_POST["map_id"]) && is_numeric($_POST["map_id"])) {
         $comment->MapID = $_POST["map_id"];
     } else {
         die("No valid map ID");
     }
     if (isset($_POST["user_email"])) {
         $comment->Email = stripslashes(strip_tags($_POST["user_email"]));
     }
     $comment->UserIP = $_SERVER['REMOTE_ADDR'];
     $comment->DateCreated = date("Y-m-d H:i:s");
     $comment->Save();
     $map = new Map();
     $map->Load($comment->MapID);
     if (__("EMAIL_VISITOR_COMMENTS") && $map->UserID != Helper::GetLoggedInUser()->ID) {
         $user = DataAccess::GetUserByID($map->UserID);
         $fromName = __("DOMA_ADMIN_EMAIL_NAME");
         $subject = __("NEW_COMMENT_EMAIL_SUBJECT");
         $mapAddress = Helper::GlobalPath("show_map.php?user=" . $user->Username . "&map=" . $map->ID . "&showComments=true");
         $body = sprintf(__("NEW_COMMENT_EMAIL_BODY"), $map->Name, $mapAddress, $comment->Name, $comment->Email, $comment->Comment);
         $emailSentSuccessfully = Helper::SendEmail($fromName, $user->Email, $subject, $body);
         if (!$emailSentSuccessfully) {
             $errors[] = __("EMAIL_ERROR");
         }
     }
     $viewData["Errors"] = $errors;
     $viewData["Comment"] = $comment;
     $viewData["Map"] = $map;
     return $viewData;
 }
开发者ID:andopor,项目名称:doma-project,代码行数:45,代码来源:add_comment.controller.php

示例4: Execute

 public function Execute()
 {
     $viewData = array();
     // no user specified - redirect to user list page
     if (!getCurrentUser()) {
         $singleUserID = DataAccess::GetSingleUserID();
         if (!$singleUserID) {
             Helper::Redirect("users.php");
         }
         Helper::SetUser(DataAccess::GetUserByID($singleUserID));
     }
     // user is hidden - redirect to user list page
     if (!getCurrentUser()->Visible) {
         Helper::Redirect("users.php");
     }
     $searchCriteria = Session::GetSearchCriteria(getCurrentUser()->ID);
     if (!isset($searchCriteria)) {
         // default search criteria
         $searchCriteria = array("selectedYear" => date("Y"), "selectedCategoryID" => getCurrentUser()->DefaultCategoryID, "filter" => null);
     }
     $viewData["Errors"] = array();
     if (isset($_GET["error"]) && $_GET["error"] == "thumbnailCreationFailure") {
         // calculate max image size for auto-generation of thumbnail
         $memoryLimit = ini_get("memory_limit");
         if (stripos($memoryLimit, "M")) {
             $memoryLimit = (int) str_replace("M", "", $memoryLimit) * 1024 * 1024;
         }
         $memoryLimit -= memory_get_usage();
         $size = round(sqrt($memoryLimit / 4) / 100) * 100;
         $viewData["Errors"][] = sprintf(__("THUMBNAIL_CREATION_FAILURE"), $size . "x" . $size);
     }
     // get all categories
     $allCategoriesItem = new Category();
     $allCategoriesItem->ID = 0;
     $allCategoriesItem->Name = __("ALL_CATEGORIES");
     $categories = DataAccess::GetCategoriesByUserID(getCurrentUser()->ID);
     $viewData["Categories"] = $categories;
     $viewData["CategoriesWithText"] = array_merge(array(0 => $allCategoriesItem), $categories);
     // get all years
     $years = DataAccess::GetYearsByUserID(getCurrentUser()->ID, Helper::GetLoggedInUserID());
     $years = array_reverse($years);
     $viewData["YearsWithText"][0] = array("value" => 0, "text" => __("ALL_YEARS"));
     foreach ($years as $year) {
         $viewData["YearsWithText"][$year] = array("value" => $year, "text" => $year);
     }
     if (!in_array($searchCriteria["selectedYear"], array_keys($viewData["YearsWithText"])) && count($years) > 0) {
         $searchCriteria["selectedYear"] = $years[0];
     }
     $categoryIds = array_keys($categories);
     if ($searchCriteria["selectedCategoryID"] != 0 && !in_array($searchCriteria["selectedCategoryID"], $categoryIds) && count($categories) > 0) {
         $searchCriteria["selectedCategoryID"] = $categoryIds[0];
     }
     if (isset($_GET["year"])) {
         $searchCriteria["selectedYear"] = $_GET["year"];
     }
     if (isset($_GET["categoryID"])) {
         $searchCriteria["selectedCategoryID"] = $_GET["categoryID"];
     }
     if (isset($_GET["filter"])) {
         $searchCriteria["filter"] = $_GET["filter"];
     }
     if (isset($_GET["displayMode"])) {
         $viewData["DisplayMode"] = $_GET["displayMode"];
     } else {
         $viewData["DisplayMode"] = "list";
     }
     $startDate = $searchCriteria["selectedYear"] == 0 ? 0 : Helper::StringToTime($searchCriteria["selectedYear"] . "-01-01", true);
     $endDate = $searchCriteria["selectedYear"] == 0 ? 0 : Helper::StringToTime($searchCriteria["selectedYear"] . "-12-31", true);
     $viewData["SearchCriteria"] = $searchCriteria;
     // get map data
     $viewData["Maps"] = DataAccess::GetMaps(getCurrentUser()->ID, $startDate, $endDate, $searchCriteria["selectedCategoryID"], $searchCriteria["filter"], 0, "date", Helper::GetLoggedInUserID());
     $viewData["GeocodedMapsExist"] = false;
     foreach ($viewData["Maps"] as $map) {
         $mapInfo = array();
         $mapInfo["URL"] = $map->MapImage ? 'show_map.php?' . Helper::CreateQuerystring(getCurrentUser(), $map->ID) : "";
         $mapInfo["Name"] = $map->Name . ' (' . date(__("DATE_FORMAT"), Helper::StringToTime($map->Date, true)) . ')';
         $mapInfo["MapThumbnailHtml"] = Helper::EncapsulateLink('<img src="' . Helper::GetThumbnailImage($map) . '" alt="' . $mapInfo["Name"] . '" height="' . THUMBNAIL_HEIGHT . '" width="' . THUMBNAIL_WIDTH . '" />', $mapInfo["URL"]);
         $atoms = array();
         if (__("SHOW_MAP_AREA_NAME") && $map->MapName) {
             $atoms[] = $map->MapName;
         }
         if (__("SHOW_ORGANISER") && $map->Organiser) {
             $atoms[] = $map->Organiser;
         }
         if (__("SHOW_COUNTRY") && $map->Country) {
             $atoms[] = $map->Country;
         }
         $mapInfo["MapAreaOrganiserCountry"] = join(", ", $atoms);
         if ($map->Comment) {
             $maxLength = 130;
             $strippedComment = strip_tags($map->Comment);
             $mapInfo["IsExpandableComment"] = !($strippedComment == $map->Comment && strlen($map->Comment) <= $maxLength);
             if ($mapInfo["IsExpandableComment"]) {
                 $mapInfo["ContractedComment"] = substr($strippedComment, 0, $maxLength) . "...";
             }
         }
         $viewData["MapInfo"][$map->ID] = $mapInfo;
         if ($viewData["DisplayMode"] == "overviewMap" && $map->IsGeocoded) {
             $viewData["OverviewMapData"][] = Helper::GetOverviewMapData($map, false, true, false, $categories, $searchCriteria["selectedCategoryID"]);
         }
//.........这里部分代码省略.........
开发者ID:andopor,项目名称:doma-project,代码行数:101,代码来源:index.controller.php


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