本文整理汇总了PHP中Map::Load方法的典型用法代码示例。如果您正苦于以下问题:PHP Map::Load方法的具体用法?PHP Map::Load怎么用?PHP Map::Load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Map
的用法示例。
在下文中一共展示了Map::Load方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: Execute
public function Execute()
{
$viewData = array();
// no user specified - redirect to user list page
if (!getCurrentUser()) {
Helper::Redirect("users.php");
}
// user is hidden - redirect to user list page
if (!getCurrentUser()->Visible) {
Helper::Redirect("users.php");
}
// the requested map
$map = new Map();
$map->Load($_GET["map"]);
if (!$map->ID) {
die("The map has been removed.");
}
DataAccess::UnprotectMapIfNeeded($map);
if (Helper::MapIsProtected($map)) {
die("The map is protected until " . date("Y-m-d H:i:s", Helper::StringToTime($map->ProtectedUntil, true)) . ".");
}
if ($map->UserID != getCurrentUser()->ID) {
die;
}
$viewData["Comments"] = DataAccess::GetCommentsByMapId($map->ID);
$viewData["Name"] = $map->Name . ' (' . date(__("DATE_FORMAT"), Helper::StringToTime($map->Date, true)) . ')';
// previous map in archive
$previous = DataAccess::GetPreviousMap(getCurrentUser()->ID, $map->ID, Helper::GetLoggedInUserID());
$viewData["PreviousName"] = $previous == null ? null : $previous->Name . ' (' . date(__("DATE_FORMAT"), Helper::StringToTime($previous->Date, true)) . ')';
// next map in archive
$next = DataAccess::GetNextMap(getCurrentUser()->ID, $map->ID, Helper::GetLoggedInUserID());
$viewData["NextName"] = $next == null ? null : $next->Name . ' (' . date(__("DATE_FORMAT"), Helper::StringToTime($next->Date, true)) . ')';
$size = $map->GetMapImageSize();
$viewData["ImageWidth"] = $size["Width"];
$viewData["ImageHeight"] = $size["Height"];
DataAccess::IncreaseMapViews($map);
$viewData["Map"] = $map;
$viewData["BackUrl"] = isset($_SERVER["HTTP_REFERER"]) && basename($_SERVER["HTTP_REFERER"]) == "users.php" ? "users.php" : "index.php?" . Helper::CreateQuerystring(getCurrentUser());
$viewData["Previous"] = $previous;
$viewData["Next"] = $next;
$viewData["ShowComments"] = isset($_GET["showComments"]) && ($_GET["showComments"] = true) || !__("COLLAPSE_VISITOR_COMMENTS");
$viewData["FirstMapImageName"] = Helper::GetMapImage($map);
if ($map->BlankMapImage) {
$viewData["SecondMapImageName"] = Helper::GetBlankMapImage($map);
}
$viewData["QuickRouteJpegExtensionData"] = $map->GetQuickRouteJpegExtensionData();
if (isset($viewData["QuickRouteJpegExtensionData"]) && $viewData["QuickRouteJpegExtensionData"]->IsValid) {
$categories = DataAccess::GetCategoriesByUserID(getCurrentUser()->ID);
$viewData["OverviewMapData"][] = Helper::GetOverviewMapData($map, true, false, false, $categories);
$viewData["GoogleMapsUrl"] = "http://maps.google.com/maps" . "?q=" . urlencode(Helper::GlobalPath("export_kml.php?id=" . $map->ID . "&format=kml")) . "&language=" . Session::GetLanguageCode();
}
if (USE_3DRERUN == '1' && DataAccess::GetSetting("LAST_WORLDOFO_CHECK_DOMA_TIME", "0") + RERUN_FREQUENCY * 3600 < time()) {
$viewData["RerunMaps"] = Helper::GetMapsForRerunRequest();
$viewData["TotalRerunMaps"] = count(explode(",", $viewData["RerunMaps"]));
$viewData["ProcessRerun"] = true;
}
return $viewData;
}
示例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;
}
示例4: Execute
public function Execute()
{
$viewData = array();
$errors = array();
$comment = new Comment();
Helper::WriteToLog("Comment ID: " . $_GET["cid"]);
if ($_GET["cid"] && is_numeric($_GET["cid"])) {
$cid = $_GET["cid"];
} else {
die("No comment ID");
}
$comment->Load($cid);
$userip = $_SERVER['REMOTE_ADDR'];
$map = new Map();
$map->Load($comment->MapID);
if ($comment->UserIP == $userip || $map->UserID == Helper::GetLoggedInUser()->ID) {
$comment->Delete();
} else {
die("No rights to delete comment!");
}
$viewData["Errors"] = $errors;
return $viewData;
}
示例5: Execute
public function Execute()
{
$viewData = array();
$errors = array();
// no user specified - redirect to user list page
if (!getCurrentUser()) {
Helper::Redirect("users.php");
}
if (!Helper::IsLoggedInUser()) {
Helper::Redirect("users.php");
}
if (isset($_GET["map"])) {
$mapID = $_GET["map"];
}
foreach ($_GET as $variable => $value) {
${$variable} = stripslashes($value);
}
foreach ($_POST as $variable => $value) {
${$variable} = stripslashes($value);
}
if (isset($cancel)) {
Helper::Redirect("index.php?" . Helper::CreateQuerystring(getCurrentUser()));
}
if (isset($save) || isset($delete) || isset($deleteConfirmed)) {
$map = new Map();
if (isset($mapID)) {
$map->Load($mapID);
if ($map->UserID != getCurrentUser()->ID) {
die("Access denied");
}
$isNewMap = false;
} else {
$isNewMap = true;
}
$map->UserID = getCurrentUser()->ID;
$map->CategoryID = $categoryID;
$map->Date = $date;
$map->Name = $name;
if (__("SHOW_ORGANISER")) {
$map->Organiser = $organiser;
}
if (__("SHOW_COUNTRY")) {
$map->Country = $country;
}
if (__("SHOW_DISCIPLINE")) {
$map->Discipline = $discipline;
}
if (__("SHOW_RELAY_LEG")) {
$map->RelayLeg = $relayLeg;
}
if (__("SHOW_MAP_AREA_NAME")) {
$map->MapName = $mapName;
}
if (__("SHOW_RESULT_LIST_URL")) {
$map->ResultListUrl = $resultListUrl;
}
if (__("SHOW_COMMENT")) {
$map->Comment = $comment;
}
$map->ProtectedUntil = $protectedUntil;
} else {
// first page load
if (isset($_GET["map"])) {
$map = new Map();
$map->Load($mapID);
if ($map->UserID != getCurrentUser()->ID) {
die("Access denied");
}
$isNewMap = false;
} else {
$map = new Map();
$map->Date = date("Y-m-d");
$map->CategoryID = getCurrentUser()->DefaultCategoryID;
$isNewMap = true;
}
}
if (isset($save)) {
// validate
// name
if (trim($map->Name) == "") {
$errors[] = __("NO_MAP_NAME_ENTERED");
}
// date
if (trim($map->Date) == "") {
$errors[] = __("NO_DATE_ENTERED");
}
if (!Helper::LocalizedStringToTime($map->Date, false)) {
$errors[] = __("INVALID_DATE");
} else {
$map->Date = gmdate("Y-m-d H:i:s", Helper::LocalizedStringToTime($map->Date, false));
}
// protected until
if (trim($map->ProtectedUntil) == "") {
$map->ProtectedUntil = null;
} else {
if (!Helper::LocalizedStringToTime($map->ProtectedUntil, false)) {
$errors[] = __("INVALID_PROTECTED_UNTIL");
} else {
$map->ProtectedUntil = gmdate("Y-m-d H:i:s", Helper::LocalizedStringToTime($map->ProtectedUntil, false));
}
//.........这里部分代码省略.........
示例6: dirname
<?php
include_once dirname(__FILE__) . "/config.php";
include_once dirname(__FILE__) . "/include/definitions.php";
if ($_POST["id"] && is_numeric($_POST["id"])) {
$map = new Map();
$map->Load($_POST["id"]);
if (!$map->IsGeocoded) {
$map->AddGeocoding();
if ($map->IsGeocoded) {
$map->Save();
Helper::WriteToLog("Added geocoding data to database for map with id " . $_POST["id"] . ".");
print "1";
} else {
Helper::WriteToLog("Failed to add geocoding data to database for map with id " . $_POST["id"] . ". Probably no QuickRoute jpeg file.");
print "2";
}
} else {
print "3";
}
}
示例7: dirname
<?php
include_once dirname(__FILE__) . "/include/main.php";
$format = $_GET["format"];
if ($format != "kmz") {
$format = "kml";
}
$id = $_GET["id"];
$map = new Map();
$map->Load($id);
$data = $map->CreateKmlString(Helper::LocalPath(MAP_IMAGE_PATH), Helper::GlobalPath(MAP_IMAGE_PATH), $format);
if ($format == "kml") {
header("Content-Type: application/vnd.google-earth.kml+xml; charset=UTF-8");
header('Content-Disposition: attachment; filename="map_' . $id . '.kml";');
} else {
header("Content-Type: application/vnd.google-earth.kmz");
header('Content-Disposition: attachment; filename="map_' . $id . '.kmz";');
}
print $data;