public static function event() { $cmd = geolocCmd::byId(init('id')); if (!is_object($cmd)) { throw new Exception(__('Commande ID geoloc inconnu : ', __FILE__) . init('id')); } if ($cmd->getEqLogic()->getEqType_name() != 'geoloc') { throw new Exception(__('Cette commande n\'est pas de type geoloc : ', __FILE__) . init('id')); } if ($cmd->getConfiguration('mode') != 'dynamic') { throw new Exception(__('Cette commande de géoloc n\'est pas dynamique : ', __FILE__) . init('id')); } $value = init('value'); if (strpos($value, 'https://') !== false || strpos($value, 'http://') !== false) { $url = parse_url($value); parse_str($url['query'], $output); if (isset($output['q'])) { $value = $output['q']; } if (isset($output['ll'])) { $value = $output['ll']; } } //For compatibility with older version which not use the Value property, set the Value if needed foreach ($cmd->getEqLogic()->getCmd('info') as $distance) { if ($distance->getConfiguration('mode') == 'distance' || $distance->getConfiguration('mode') == 'travelDistance' || $distance->getConfiguration('mode') == 'travelTime') { if ($distance->setDependency()) { $distance->save(); } } } $cmd->event($value); $cmd->getEqLogic()->refreshWidget(); }
public static function event() { $cmd = geolocCmd::byId(init('id')); if (!is_object($cmd)) { throw new Exception('Commande ID geoloc inconnu : ' . init('id')); } if ($cmd->getEqLogic()->getEqType_name() != 'geoloc') { throw new Exception('Cette commande n\'est pas de type geoloc : ' . init('id')); } if ($cmd->getConfiguration('mode') != 'dynamic') { throw new Exception('Cette commande de géoloc n\'est pas dynamique : ' . init('id')); } $cmd->event(init('value')); }
<input type="text" class="eqLogicAttr form-control hidestart" data-l1key="configuration" data-l2key="latdepart" placeholder="{{48.856614}}"/> </div> <label class="col-lg-1 control-label hidestart">{{Longitude}}</label> <div class="col-lg-2"> <input type="text" class="eqLogicAttr form-control hidestart" data-l1key="configuration" data-l2key="londepart" placeholder="{{2.3522219000000177}}"/> </div> </div> <div class="form-group"> <label class="col-lg-1 control-label"><i class="fa fa-location-arrow"></i> {{Arrivée}}</label> <label class="col-lg-1 control-label">{{Géolocalisation}}</label> <div class="col-lg-2"> <select class="form-control eqLogicAttr configuration geolocend" id="geoloc" data-l1key="configuration" data-l2key="geolocend"> <option value="none">{{Manuel}}</option> <?php foreach (eqLogic::byType('geoloc') as $geoloc) { foreach (geolocCmd::byEqLogicId($geoloc->getId()) as $geoinfo) { if ($geoinfo->getConfiguration('mode') == 'fixe' || $geoinfo->getConfiguration('mode') == 'dynamic') { echo '<option value="normal|' . $geoinfo->getId() . '">' . $geoinfo->getHumanName(true) . '</option>'; } } } foreach (eqLogic::byType('geoloc_ios') as $geoloc) { foreach (geoloc_iosCmd::byEqLogicId($geoloc->getId()) as $geoinfo) { if (($geoinfo->getConfiguration('mode') == 'fixe' || $geoinfo->getConfiguration('mode') == 'dynamic') && $geoinfo->getName() != 'Refresh') { echo '<option value="ios|' . $geoinfo->getId() . '">' . $geoinfo->getHumanName(true) . '</option>'; } } } ?> </select> </div>
public function getPosition($_point = 'start') { $return = array(); $point = $_point == 'start' ? 'depart' : 'arrive'; if ($this->getConfiguration('geoloc' . $_point, '') == 'none') { $return['lat'] = $this->getConfiguration('lat' . $point); $return['lon'] = $this->getConfiguration('lon' . $point); } else { $geoloc = $this->getConfiguration('geoloc' . $_point, ''); $typeId = explode('|', $geoloc); if ($typeId[0] == 'ios') { $geolocCmd = geoloc_iosCmd::byId($typeId[1]); } else { $geolocCmd = geolocCmd::byId($typeId[1]); } $geoloctab = explode(',', $geolocCmd->execCmd(null, 0)); if (isset($geoloctab[0]) && isset($geoloctab[1])) { $return['lat'] = $geoloctab[0]; $return['lon'] = $geoloctab[1]; } else { throw new Exception(__('Position de départ invalide', __FILE__)); } } return $return; }