本文整理汇总了PHP中FabrikString::mapStrToCoords方法的典型用法代码示例。如果您正苦于以下问题:PHP FabrikString::mapStrToCoords方法的具体用法?PHP FabrikString::mapStrToCoords怎么用?PHP FabrikString::mapStrToCoords使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FabrikString
的用法示例。
在下文中一共展示了FabrikString::mapStrToCoords方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onLoadJavascriptInstance
/**
* Return the javascript to create an instance of the class defined in formJavascriptClass
*
* @param array $args Array [0] => string table's form id to contain plugin
*
* @return bool
*/
public function onLoadJavascriptInstance($args)
{
parent::onLoadJavascriptInstance($args);
if (!is_object($this->getMapElement())) {
return false;
}
$params = $this->getParams();
list($latitude, $longitude) = $this->getSearchLatLon();
$opts = $this->getElementJSOptions();
$containerOverride = FArrayHelper::getValue($args, 0, '');
if (strstr($containerOverride, 'visualization')) {
$opts->ref = str_replace('visualization_', '', $containerOverride);
}
$opts->steps = (int) $params->get('radius_max', 100);
$opts->unit = $params->get('radius_unit', 'km');
$opts->value = $this->getValue();
$opts->lat = $latitude;
$opts->lon = $longitude;
$preFilterDistance = $params->get('prefilter_distance', '');
$opts->prefilter = $preFilterDistance === '' ? false : true;
$opts->prefilterDone = (bool) $this->app->input->getBool('radius_prefilter', false);
$opts->prefilterDistance = $preFilterDistance;
$opts->myloc = $params->get('myloc', 1) == 1 ? true : false;
$o = FabrikString::mapStrToCoords($params->get('geocode_default', ''));
$opts->geocode_default_lat = $o->lat;
$opts->geocode_default_long = $o->long;
$opts->geocode_default_zoom = (int) $o->zoom;
$opts->geoCodeAsType = $params->get('geocode_as_type', 1);
$opts->renderOrder = $this->renderOrder;
$opts->offset_y = (int) $params->get('window_offset_y', '0');
$opts = json_encode($opts);
$this->jsInstance = "new FbListRadius_search({$opts})";
JText::script('PLG_LIST_RADIUS_SEARCH_CLEAR_CONFIRM');
JText::script('PLG_LIST_RADIUS_SEARCH_GEOCODE_ERROR');
return true;
}
示例2: render
/**
* Draws the html form element
*
* @param array $data To pre-populate element with
* @param int $repeatCounter Repeat group counter
*
* @return string elements html
*/
public function render($data, $repeatCounter = 0)
{
$id = $this->getHTMLId($repeatCounter);
$name = $this->getHTMLName($repeatCounter);
$element = $this->getElement();
$val = $this->getValue($data, $repeatCounter);
$params = $this->getParams();
$w = $params->get('fb_gm_mapwidth');
$h = $params->get('fb_gm_mapheight');
$str = '';
if ($this->_useStaticMap()) {
return $this->_staticMap($val, null, null, null, $repeatCounter, false, $data);
} else {
if ($element->hidden == '1') {
return $this->getHiddenField($name, $data[$name], $id);
}
if (!$this->isEditable() && $val != '' || $this->isEditable()) {
$layout = $this->getLayout('form');
$layoutData = new stdClass();
$layoutData->id = $id;
$coords = FabrikString::mapStrToCoords($val);
$layoutData->coords = $coords->coords;
$layoutData->geoCodeEvent = $params->get('fb_gm_geocode_event', 'button');
$layoutData->geocode = $params->get('fb_gm_geocode');
$layoutData->editable = $this->isEditable();
$layoutData->width = $w;
$layoutData->height = $h;
$layoutData->name = $name;
$layoutData->label = $element->label;
$layoutData->value = htmlspecialchars($val, ENT_QUOTES);
$layoutData->dms = $this->_strToDMS($val);
$layoutData->osref = "";
$layoutData->staticmap = $params->get('fb_gm_staticmap');
$layoutData->showdms = $params->get('fb_gm_latlng_dms');
$layoutData->showlatlng = $params->get('fb_gm_latlng');
$layoutData->showosref = $params->get('fb_gm_latlng_osref');
return $layout->render($layoutData);
} else {
$str .= FText::_('PLG_ELEMENT_GOOGLEMAP_NO_LOCATION_SELECTED');
}
/*
* $$$ hugh - not sure why we still do this. If they want to show lat/lng details, they can use the
* gm_latlng option. Problem with showing this is we never change it, so it's misleading.
*/
// $str .= $this->_microformat($val);
return $str;
}
}