新足迹

 找回密码
 注册

精华好帖回顾

· NSW州政府的Housing Delivery Program规划细节披露及讨论 (2013-3-18) Martin_2F · Lanshan:超极简单美味的甜点-Apple Crumble Slice(有详图) (2011-4-10) lanshan
· 大头做面食 -- 肉松葱油酥饼, 附送京糕 (2013-1-18) datou2z · 清洁生意之六怀念被移民政策逼走的奇才阿杰2楼更新 (2010-2-28) 大山
Advertisement
Advertisement
查看: 1206|回复: 3

php求指点,怎么替代地图? [复制链接]

头像被屏蔽

禁止发言

发表于 2012-2-1 23:18 |显示全部楼层
此文章由 hfwang 原创或转贴,不代表本站立场和观点,版权归 oursteps.com.au 和作者 hfwang 所有!转贴必须注明作者、出处和本声明,并保持内容完整
Manager说这不是个major effort...不过我还是没头脑,不怎么写过程序。。

http://www.unwired.com.au/availability/check_availability.php输入一个地址,比如10 fore st canterbury nsw 2193 就会显示一个地图,是否该地址在覆盖范围内。



这个地图是yahoo地图,现在我们单位要换到mapshed的地图。就是要替换掉这个地图,用类似http://maps.pdslive.com.au/vivid-stage/unwired?lat=-33.87779&lon=151.24382

请教怎么改check_availability.php才能读取新的地图,我连原地图引用的地方都没发现,不知道从何入手,望高人指点。

check_availability.php代码如下

<?php
/**
* $Id: check_availability.php 107900 2010-07-12 07:01:25Z smaram $
**/
require_once("utils_uw.php");
require_once('uw/common_html/shop_common.php');
require_once('uw/valid_contact.php');
require_once("services/sq/UIConstants.php");
require_once("services/sq/SQConstants.php");
session_start();

$logWebOnlineShop = new Object();
$logPrefix = IpAddressOracle::getRemoteIpAddress() . ":" . SuperGlobals::getServer("REMOTE_PORT") . " " . session_id();
$logWebOnlineShop->addFileLogger('/var/log/app/web/web-onlineshop.log', $logPrefix, Object:OG_LEVEL_INFO());


/**
* Parse address parameters - adapted from the method in UIController class
* @param         Array    $params The address search form data
* @param         Bool     $smallSearch True if the page was posted to from a small (limited fields) search form
* @param         String   $errorMsg A message stating what error has been found
* @return        Bool     True if address params are valid, false otherwise
**/
function parseAddrParams(&$params, $smallSearch, &$errorMsg)
{
   $errorMsg = null;
   $err = array(); $bol = false;

   // Now look for any missing fields
   if (empty($params[PARAM_STREET_NO]))
   {
      $errorMsg = "Address is incomplete. A street number must be provided";
      return false;
   }

   if (empty($params[PARAM_STREET_NAME]))
   {
      $errorMsg = "Address is incomplete. Street name must be provided";
      return false;
   }

   if (empty($params[PARAM_STREET_TYPE]) && !$smallSearch)
   {
      $errorMsg = "Address is incomplete. Street type must be selected";
      return false;
   }

   if (empty($params[PARAM_CITY]))
   {
      $errorMsg = "Name of a city/suburb must be provided.";
      return false;
   }

   if (empty($params[PARAM_STATE]) && !$smallSearch)
   {
      $errorMsg = "State must be provided.";
      return false;
   }

   if (empty($params[PARAM_POSTCODE]))
   {
      $errorMsg = "ostcode must be provided";
      return false;
   }

   if (!is_valid_postcode($params[PARAM_POSTCODE], $err, $bol))
   {
      $errorMsg = $err[0] . " eg: 2000";
      return false;
   }

   return true;
}

// all templating stuff
require_once("UnSmarty.php");
require_once("templates/_common/html_elements/smarty_contact.inc");

// initialiase some variables
$fromSmallSearchForm = false;
$searchValid = false;
$errMsg = null;
$mapBatch = null;
$vividZone = null;
$zoomRange = null;

// HTTP_REFERER value in $_SERVER gives the url that sent control to this script
// if user provided address on homepage, then we need to do a search immediately
if (param_script(FROM_SMALL_SEARCH_FORM) != null )
{
   $fromSmallSearchForm = true;
}

$formParams = array( PARAM_STREET_NO => fixParamScript(PARAM_STREET_NO),
                     PARAM_STREET_NAME => fixParamScript(PARAM_STREET_NAME),
                     PARAM_STREET_TYPE => fixParamScript(PARAM_STREET_TYPE),
                     PARAM_CITY => fixParamScript(PARAM_CITY),
                     PARAM_POSTCODE => fixParamScript(PARAM_POSTCODE),
                     PARAM_STATE => fixParamScript(PARAM_STATE) );

$searchValid = parseAddrParams($formParams, $fromSmallSearchForm, $errMsg);

// set up template
$S = new UnSmarty();
$S->assign("page_title","Current Coverage");

require_once("site/section.php");
$section = trim(section());
$S->assign("section",$section);

require_once("site/nav.php");
$S->assign("menu", menu());

require_once("nav.php");
$S->assign("availability_menu", availability_menu());

// if the small search form is used, i.e: the one on the homepage
// then pre-populate the search form and hide it
if ($searchValid) {
   $S->assign("displayAddressSearchForm", DISPLAY_NONE);
   $S->assign("displayMap", DISPLAY_INLINE);

   $fullSuppliedAddress = buildSearchAddress('FULL');
   $vividUrlAddress = buildSearchAddress('URL');
   $vividServiceRegion = buildSearchAddress('REGION');

   $S->assign("fullSuppliedAddress", $fullSuppliedAddress);
   $S->assign("vividUrlAddress", $vividUrlAddress);
   $S->assign("vividServiceRegion", $vividServiceRegion);

   $S->assign("addressMapTitle", $fullSuppliedAddress);
   $S->assign("addressErrMsg", "");

   // If we have a 'batch' URL parameter, use it and change the zoom range
   $mapBatch = fixParamScript('batch');
   if (!empty($mapBatch))
   {
      $zoomRange = '3, 6';
   }
   else
   {
      getAppConfigValueByName($logWebOnlineShop, "UW_YAHOO_MAPS_BATCH_NO", $mapBatch);
      $zoomRange = '3, 4';
   }
   $S->assign("mapBatch", 0 + $mapBatch);
   $S->assign("zoomRange", $zoomRange);

   getVividSQZoneJSArray($logWebOnlineShop, $vividZone);
   $S->assign("vividZone", $vividZone);

} else {
   $S->assign("displayAddressSearchForm", DISPLAY_INLINE);
   $S->assign("displayMap", DISPLAY_NONE);

   $S->assign("fullSuppliedAddress", "");
   $S->assign("vividUrlAddress", "");
   $S->assign("vividServiceRegion", "");

   $S->assign("addressMapTitle", "");
   $S->assign("zoomRange", $zoomRange);

   // No need to look up the batch or get the vivid zone if we are only collecting the address
   $S->assign("mapBatch", 0);
   $S->assign("vividZone", '[]');

   if ( (param_script('nextbutton') != null) || $fromSmallSearchForm )
   {
      $S->assign("addressErrMsg", $errMsg);
   }
   else
   {
      $S->assign("addressErrMsg", "");
   }
}

// assign default values to the form fields
$S->assign(PARAM_STREET_NO, fixParamScript(PARAM_STREET_NO));
$S->assign(PARAM_STREET_NAME, fixParamScript(PARAM_STREET_NAME));
$S->assign(PARAM_STREET_TYPE, fixParamScript(PARAM_STREET_TYPE));
$S->assign(STREET_TYPE_OPTIONS, streetTypes());
$S->assign(PARAM_CITY, fixParamScript(PARAM_CITY));

$state_params = array("name" => PARAM_STATE,
                  "extra" => null,
                  "selected" => fixParamScript(PARAM_STATE));
$state_html = smarty_select_state($state_params, $smarty, "text width120");
$S->assign(STATE_HTML, $state_html);

$S->assign(PARAM_POSTCODE, fixParamScript(PARAM_POSTCODE));

$prodtype_params = array("name" => "prodType",
                  "extra" => null,
                  "selected" => fixParamScript("prodType"));

$prodtype_html   = smarty_select_prodtype($prodtype_params, $smarty, "text width170");
$S->assign(PARAM_PROD_TYPE, $prodtype_html);

// add the what to do next button and it's url
$S->assign("whatNextImg", "../images/btn_orderNowOrange.gif");
$S->assign("whatNextURL", "../get/order.php");
$S->assign("whatNextId", "nextButtonOrder");

$S->assign("pushOut", false);
$S->assign("registerURL", "/availability/future.php");


require_once("uw/common_html/suburbs.php");
$S->display("availability/check_availability.tpl");
?>


Mapshed的参数如下:

<?php
// $Id: vivid_map_coverage_map.tpl.php

/**
* @file vivid_map_coverage_map.tpl.php
*/

?>
<div class="clear-block">
<?php
   $regions = array(
      ''    => 'perth',
      'syd' => 'sydney',
      'mel' => 'melbourne',
      'per' => 'perth',
      'ade' => 'adelaide',
      'bri' => 'brisbane',
      'can' => 'canberra',
   );

   $parameters = array(
//         'searchby'        => base64_encode(serialize(array('Latitude and Longitude ' => '1', 'Address' => 2, 'Layer' => 3, 'Archive date' => 4 ))),
//         'version'         => 1,
//         'method'          => 1,
//         'lat'             => -33.896388,
//         'lon'             => 151.194416,
//         'zl'              => 15,
//         'streetnumber'    => 24,
//         'streetname'      => 'malga',
//         'streetnype'      => 'Ave',
//         'locality'        => 'Roseville Chase',
//         'state'           => 'NSW',
//         'postcode'        => 2069,
//         'predictionname'  => 'USB',
//         'predictiondate'  => 20120131,
//         'maptypeid'       => 'google.maps.MapTypeId.ROADMAP',
         'region'          => $regions[htmlentities($_GET['sr'])]
   );

   $url = "http://maps.pdslive.com.au/vivid-stage/coveragemap?";

   foreach ($parameters as $name => $value)
   {
      $url .= "$name=$value&";
   }
?>
   <iframe
      name='map'
      id="map"
      src="<?php echo $url?>"
      frameborder="0"
      border="0"
      cellspacing="0"
      scrolling="no"
      style="border-style: none;">
   </iframe>
</div>


请教大概如何整合,谢谢!
Advertisement
Advertisement

特殊贡献奖章

发表于 2012-2-2 00:16 |显示全部楼层
此文章由 kr2000 原创或转贴,不代表本站立场和观点,版权归 oursteps.com.au 和作者 kr2000 所有!转贴必须注明作者、出处和本声明,并保持内容完整
乍一看好像是把数据用availability/check_availability.tpl显示
这个check_availability不只一个文件啊

把整个文件夹搜索一下yahoo.com.au应该可以找到yahoo的api在哪里

发表于 2012-2-9 16:15 |显示全部楼层
此文章由 porcorosso 原创或转贴,不代表本站立场和观点,版权归 oursteps.com.au 和作者 porcorosso 所有!转贴必须注明作者、出处和本声明,并保持内容完整
有kr2000在我就懒得看上面的码了

呵呵呵

发表于 2012-2-9 17:15 |显示全部楼层
此文章由 stevenbian 原创或转贴,不代表本站立场和观点,版权归 oursteps.com.au 和作者 stevenbian 所有!转贴必须注明作者、出处和本声明,并保持内容完整
改UnSmarty.php的display?

发表回复

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Advertisement
Advertisement
返回顶部