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')); }
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; }