Пример #1
0
 /**
  * Initialize the plugin by loading admin scripts & styles and adding a
  * settings page and menu.
  *
  * @since     1.0.0
  */
 private function __construct()
 {
     // settings
     try {
         $this->set_api_key(get_option('api_key'));
         //	$this->set_client_id(get_option('client_id'));
         //	$this->set_client_secret(get_option('client_secret'));
     } catch (Exception $e) {
         $this->error_message = $e->getMessage();
         add_action('admin_notices', array($this, 'settings_missing_message'));
     }
     $plugin = Maps::get_instance();
     $this->plugin_slug = $plugin->get_plugin_slug();
     // Load admin style sheet and JavaScript.
     add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_styles'));
     add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'));
     // Add the options page and menu item.
     add_action('admin_menu', array($this, 'add_plugin_admin_menu'));
     // Add an action link pointing to the options page.
     $plugin_basename = plugin_basename(plugin_dir_path(__DIR__) . $this->plugin_slug . '.php');
     add_filter('plugin_action_links_' . $plugin_basename, array($this, 'add_action_links'));
     add_action('init', array($this, 'maps_register_locations'));
     add_action('save_post', array($this, 'save_map_meta'));
     //call register settings function
     add_action('admin_init', array($this, 'register_mysettings'));
     add_action('init', array($this, 'maps_acf_register_fields'));
 }
Пример #2
0
 static function getInstance()
 {
     if (self::$__instance === null) {
         $s = __CLASS__;
         self::$__instance = new $s();
         self::$__instance->init_vars();
     }
     return self::$__instance;
 }
Пример #3
0
 public function read_order($type = "cdrr", $id)
 {
     $main_array = array();
     $status = 'deleted';
     $log_array = array();
     if ($type == "cdrr") {
         $results = Cdrr::getCdrr($id);
         $main_array = $results[0];
         $main_array["ownCdrr_item"] = Cdrr_Item::getItems($id);
         $logs = Cdrr_Log::getHydratedLogs($id);
         $log_array['id'] = "";
         $log_array['description'] = $status;
         $log_array['created'] = date('Y-m-d H:i:s');
         $log_array['user_id'] = $this->session->userdata("user_id");
         $log_array['cdrr_id'] = $id;
         $logs[] = $log_array;
         $main_array['ownCdrr_log'] = $logs;
     } else {
         if ($type == "maps") {
             $results = Maps::getMap($id);
             $main_array = $results[0];
             $main_array["ownMaps_item"] = Maps_Item::getItems($id);
             $logs = Maps_Log::getHydratedLogs($id);
             $log_array['id'] = "";
             $log_array['description'] = $status;
             $log_array['created'] = date('Y-m-d H:i:s');
             $log_array['user_id'] = $this->session->userdata("user_id");
             $log_array['maps_id'] = $id;
             $logs[] = $log_array;
             $main_array['ownMaps_log'] = $logs;
         }
     }
     $main_array['status'] = $status;
     $main_array = array($main_array);
     $id = $this->extract_order($type, $main_array, $id);
     $this->session->set_flashdata('order_delete', "Your " . strtoupper($type) . " data was successfully " . $status . " !");
     redirect("order");
 }
Пример #4
0
 /**
  * Return an instance of this class.
  *
  * @since     1.0.0
  *
  * @return    object    A single instance of this class.
  */
 public static function get_instance()
 {
     // If the single instance hasn't been set, set it now.
     if (null == self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Пример #5
0
<?php

require_once 'init.php';
if (isset($_REQUEST['restructure'])) {
    Maps::vWipeDatabase();
    Ad::vWipeDatabase();
}
if (isset($_REQUEST['ad_html'])) {
    $oAds = DirectDB::oSelectOne('ads', array('id' => intval($_REQUEST['ad_html'])));
    $oHtml = DirectDB::oSelectOne('ads_htmls', array('id' => intval($oAds->html_id)));
    $sHtml = $oHtml->html;
    ODT::vDump(WgGesuchtReader::oParseHtml(null, $sHtml));
    exit($sHtml);
}
$bFetch = isset($_REQUEST['fetch']) || isset($_REQUEST['fetch_and_parse']);
$bParse = isset($_REQUEST['parse']) || isset($_REQUEST['fetch_and_parse']);
if (isset($_REQUEST['search_html'])) {
    if (isset($_REQUEST['url'])) {
        $aWhere = array('url' => array('%like%' => $_REQUEST['url']));
        $oHtml = DirectDB::oSelectOne('ads_htmls', $aWhere, 'id , url', 'ORDER BY fetched DESC LIMIT 1');
        ODT::vDump($oHtml);
    }
}
if ($bFetch) {
    Ad::vDeleteDuplicateUrlAds();
    WgGesuchtReader::vFetch();
}
if ($bParse) {
    $iParse = intval($_REQUEST['parse']);
    if ($iParse) {
        $oAd = WgGesuchtReader::oParseHtml($iParse);
Пример #6
0
<?php

$map_id = isset($_GET['map']) ? intval($_GET['map']) : false;
if (!$map_id) {
    $map_id = isset($_GET['id']) ? intval($_GET['id']) : false;
}
$height = isset($_GET['height']) ? intval($_GET['height']) : false;
$width = isset($_GET['width']) ? intval($_GET['width']) : false;
if (!$map_id) {
    exit;
}
require_once 'AMP/BaseDB.php';
require_once "AMP/Geo/Maps.php";
$map = new Maps(AMP_Registry::getDbcon(), $map_id);
if ($height) {
    $map->P['map_height'] = $height;
}
if ($width) {
    $map->P['map_width'] = $width;
}
$result = $map->flash_map();
print AMP_js_write($result);
Пример #7
0
 public function executeDuplicate(sfWebRequest $request)
 {
     $match = $this->getRoute()->getObject();
     $this->forward404Unless($match);
     $newMatch = new Matchs();
     $newMatch->setIp($match->getIp());
     $newMatch->setServer($match->getServer());
     $newMatch->setSeason($match->getSeason());
     $newMatch->setTeamA($match->getTeamA());
     $newMatch->setTeamAFlag($match->getTeamAFlag());
     $newMatch->setTeamAName($match->getTeamAName());
     $newMatch->setTeamB($match->getTeamB());
     $newMatch->setTeamBFlag($match->getTeamBFlag());
     $newMatch->setTeamBName($match->getTeamBName());
     $newMatch->setScoreA(0);
     $newMatch->setScoreB(0);
     $newMatch->setMaxRound($match->getMaxRound());
     $newMatch->setRules($match->getRules());
     $newMatch->overtime_startmoney = $match->overtime_startmoney;
     $newMatch->overtime_max_round = $match->overtime_max_round;
     $newMatch->config_full_score = $match->config_full_score;
     $newMatch->config_ot = $match->config_ot;
     $newMatch->config_streamer = $match->config_streamer;
     $newMatch->config_knife_round = $match->config_knife_round;
     $newMatch->config_password = $match->config_password;
     $newMatch->map_selection_mode = $match->map_selection_mode;
     $newMatch->setConfigAuthkey(uniqid(mt_rand(), true));
     $newMatch->setStatus(Matchs::STATUS_NOT_STARTED);
     $newMatch->save();
     $maps = new Maps();
     $maps->setMatch($newMatch);
     $maps->setMapsFor("default");
     $maps->setNbOt(0);
     $maps->setStatus(0);
     $maps->score_1 = 0;
     $maps->score_2 = 0;
     $maps->current_side = $match->getMap()->getCurrentSide();
     $maps->setMapName("tba");
     $maps->save();
     $newMatch->setCurrentMap($maps);
     $newMatch->save();
     $this->getUser()->setFlash("notification_ok", $this->__("Match cloned with ID") . " " . $newMatch->getId());
     $this->redirect("matchs_current");
 }
Пример #8
0
<?php

require_once "AMP/BaseDB.php";
require_once "AMP/Geo/Maps.php";
$map_id = isset($_GET['id']) && $_GET['id'] ? intval($_GET['id']) : false;
if ($map_id) {
    $map = new Maps($dbcon, $map_id);
    echo $map->us_xml();
}
 /**
  * @return string the Map text display for the current account
  */
 public function getMapText()
 {
     $mapNameRecord = Maps::model()->findByAttributes(array('id' => $this->map_id));
     return $mapNameRecord->name;
 }
Пример #10
0
<?php

include "AMP/BaseDB.php";
include "AMP/BaseTemplate.php";
require_once "AMP/Geo/Maps.php";
$map_id = isset($_GET['map']) && $_GET['map'] ? intval($_GET['map']) : false;
if ($map_id) {
    $map = new Maps($dbcon, $map_id);
    echo "<h3>" . $map->P['title'] . "</h3>";
    echo "<p>" . $map->P['description'] . "</p>";
    if ($_REQUEST['zip'] && preg_match('/\\d{5}(-\\d{4})?/', $_REQUEST['zip'])) {
        $geo = new Geo($dbcon);
        $geo->Zip = $_REQUEST['zip'];
        $geo->zip_lookup();
        $lat = $geo->lat;
        $lng = $geo->long;
        $zoom = 10;
        if ($_REQUEST['zoom']) {
            $zoom = intval($_REQUEST['zoom']);
        }
    }
    if ($lat && $lng) {
        echo $map->google_map(500, 400, $zoom, $lat, $lng);
    } else {
        echo $map->google_map();
    }
} else {
    $sql = 'select id, name, description from maps ';
    $M = $dbcon->CacheExecute($sql) or die($sql . $dbcon->ErrorMsg());
    while (!$M->EOF) {
        echo "<p><a href = 'googlemap.php?map=" . $M->Fields("id") . "'>" . $M->Fields('name') . "</a>  " . $M->Fields("description") . "</p>";
Пример #11
0
 public static function oParseHtml($iHtmlID)
 {
     $oHtml = Ad::oGetHtml($iHtmlID);
     $oAd = new Ad();
     $oAd->oPage->iHtmlID = $oHtml->id;
     $oAd->oPage->sListID = $oHtml->list;
     $oAd->oPage->sFetched = $oHtml->fetched;
     $oAd->oPage->sDomain = $oHtml->domain_hash;
     $oAd->oPage->sUrl = $oHtml->url;
     $oDom = HtmlDomParser::str_get_html($oHtml->html);
     $oMainInfo = $oDom->find('.panel-body > .row', 0);
     $sOrange = $oDom->find('.headline-key-facts', 0)->innertext;
     $sSquareMeters = Utilitu::sPregRead('#röße:\\s+([,\\d]+)m#', $sOrange);
     $oAd->oPhysical->nSquareMeters = floatval($sSquareMeters);
     $aKostenRows = $oMainInfo->find('.col-sm-5 tbody tr');
     $aKostenRowsByLabel = array();
     foreach ($aKostenRows as $oKostenRow) {
         $aCells = $oKostenRow->find('td');
         $sLabel = trim($aCells[0]->plaintext, "\t\n :");
         $sValue = trim($aCells[1]->plaintext, "\t\n ");
         $iPrice = 100 * intval(str_replace(array(',', '&euro;'), array('.', ''), $sValue));
         $aKostenRowsByLabel[$sLabel] = array('oDom' => $oKostenRow, 'sLabel' => $sLabel, 'sValue' => $sValue, 'iPrice' => $iPrice);
     }
     $aKostenMap = array('iCold' => 'Miete', 'iNeben' => 'Nebenkosten', 'iOther' => 'Sonstige Kosten', 'iBail' => 'Kaution', 'iBuy' => 'Abschlagszahlung');
     foreach ($aKostenMap as $sTarget => $sSource) {
         if (isset($aKostenRowsByLabel[$sSource])) {
             $oAd->oPrice->{$sTarget} = $aKostenRowsByLabel[$sSource]['iPrice'];
         }
     }
     $oAd->oPrice->iWarm = $oAd->oPrice->iCold + $oAd->oPrice->iNeben;
     $sAddressHtml = $oMainInfo->find('.col-sm-4 > p', 0)->innertext;
     $sAddress = trim($sAddressHtml);
     $sAddress = str_replace("\n", '', $sAddress);
     $sAddress = preg_replace('#<br ?/?>\\s+#', "\n", $sAddress);
     $aAddress = explode("\n", $sAddress);
     $oAd->oAddress->sCity = 'Aachen';
     $oAd->oAddress->sZip = Utilitu::sPregRead('#\\s*(\\d+)#', $aAddress[0]);
     $oAd->oAddress->sStreet = trim($aAddress[1]);
     $sGeocodeAddress = $oAd->oAddress->sStreet . ', ' . $oAd->oAddress->sZip . ' ' . 'Aachen';
     $oCoords = Maps::oGetCoords($sGeocodeAddress);
     $oAd->oAddress->oCoords = $oCoords;
     $aImageDoms = $oDom->find('img.sp-image');
     foreach ($aImageDoms as $oImageDom) {
         if (!isset($oImageDom->attr['data-large'])) {
             continue;
         }
         $oImage = new StdClass();
         $oImage->sUrl = str_replace('/./', '/', $oImageDom->attr['data-large']);
         $sFileType = Utilitu::sPregRead('#\\.([^\\.]+)$#', $oImage->sUrl);
         $oImage->sFile = self::$sImagesFolder . md5($oImage->sUrl) . '.' . $sFileType;
         if (!file_exists($oImage->sFile)) {
             $sImage = Curl::sGet($oImage->sUrl);
             if (Curl::iGetLastStatus() == 200) {
                 file_put_contents($oImage->sFile, $sImage);
             }
         }
         if (file_exists($oImage->sFile)) {
             $oAd->oPage->aImages[] = $oImage;
         }
     }
     $aDescription = array();
     $aDescriptionBlocks = $oDom->find('#infobox_nachrichtsenden', 0)->parent->find('.freitext');
     foreach ($aDescriptionBlocks as $oDescriptionBlock) {
         $aDescription[] = $oDescriptionBlock->plaintext;
     }
     $oAd->oPage->sDescription = implode("\n\n", $aDescription);
     $oAd->oPage->sDescription = preg_replace('#\\n\\s+#', "\n", $oAd->oPage->sDescription);
     $oAd->oPage->sDescription = str_replace('&nbsp;', '', $oAd->oPage->sDescription);
     $aPotentialDates = $oDom->find('.col-sm-4 .col-sm-12');
     foreach ($aPotentialDates as $oPotentialDate) {
         if (preg_match('#^\\s*Angebot vom:\\s*(.+)\\s*$#', $oPotentialDate->plaintext, $aMatch)) {
             $sDate = date('Y-m-d H:i:s', strtotime($aMatch[1]));
             $oAd->oPage->sCreated = $sDate;
             $oAd->oPage->sChanged = $sDate;
         }
     }
     /// TODO: oContact
     Ad::iRemoveAdsByUrl($oHtml->url);
     $oAd->vSave();
     DirectDB::bUpdate('ads_htmls', array('parsed' => true), $oHtml->id);
     return $oAd;
 }
Пример #12
0
    		        </tr>
            <?php 
        }
        ?>
         </tbody>
        </table>
        <button type="submit" style="font-size: 1em;">Enregistrer les modifications</button>
        <?php 
    }
    // Affichage s'il s'agit d'un boîtage
} else {
    // Pour chaque immeuble trouvé, on regarde quel est son réel numéro
    $numeros = array();
    $numeros_sauv = array();
    foreach ($items as $immeuble) {
        $infos = Maps::buildingData($immeuble['immeuble_id']);
        $numeros[$immeuble['immeuble_id']] = preg_replace('#[^0-9]+#', '', $infos['building']);
        $numeros_sauv[$immeuble['immeuble_id']] = $infos['building'];
    }
    // On tri les immeubles
    asort($numeros);
    // On fait la boucle des immeubles
    ?>
            <h4>Reporting de la mission de boîtage</h4>
            		        
            <table class="reporting">
    	        <thead>
    		        <tr>
        		        <th style="font-size: .95em;">Immeuble</th>
        		        <th class="petit" style="font-size: .95em;">Non&nbsp;boîté</th>
        		        <th class="petit" style="font-size: .95em;">Boîté</th>
Пример #13
0
 /**
  * Display widget.
  *
  * @return Response
  */
 public function run()
 {
     $defaultMap = \Maps::getDefaultMap();
     return view('widget_frontend_zedx_maps::index', ['config' => $this->config, 'defaultMap' => $defaultMap]);
 }
Пример #14
0
<?php

/**
 * Recherche une ville
 *
 * PHP version 5
 *
 * @category Ajax
 * @package  LeQG
 * @author   Damien Senger <*****@*****.**>
 * @license  https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License 3.0
 * @link     http://leqg.info
 */
$cities = Maps::citySearch($_GET['ville']);
echo json_encode($cities);
Пример #15
0
 public function read_order($type = "cdrr", $id)
 {
     $main_array = array();
     $status = 'deleted';
     $log_array = array();
     if ($type == "cdrr") {
         $results = Cdrr::getCdrr($id);
         $main_array = $results[0];
         $main_array["ownCdrr_item"] = Cdrr_Item::getItems($id);
         $logs = Cdrr_Log::getHydratedLogs($id);
         $log_array['id'] = "";
         $log_array['description'] = $status;
         $log_array['created'] = date('Y-m-d H:i:s');
         $log_array['user_id'] = $this->session->userdata("api_id");
         $log_array['cdrr_id'] = $id;
         $logs[] = $log_array;
         $main_array['ownCdrr_log'] = $logs;
     } else {
         if ($type == "maps") {
             $results = Maps::getMap($id);
             $main_array = $results[0];
             $main_array["ownMaps_item"] = Maps_Item::getItems($id);
             $logs = Maps_Log::getHydratedLogs($id);
             $log_array['id'] = "";
             $log_array['description'] = $status;
             $log_array['created'] = date('Y-m-d H:i:s');
             $log_array['user_id'] = $this->session->userdata("api_id");
             $log_array['maps_id'] = $id;
             $logs[] = $log_array;
             $main_array['ownMaps_log'] = $logs;
         }
     }
     $main_array['status'] = $status;
     $main_array = array($main_array);
     //format to json
     $json_data = json_encode($main_array, JSON_PRETTY_PRINT);
     //get supplier
     $facility_code = $this->session->userdata("facility");
     $supplier = $this->get_supplier($facility_code);
     //save links
     if ($supplier != "KEMSA") {
         //Go to escm
         $url = $this->esm_url . $type . "/" . $id;
         $responses = $this->put_order($url, $json_data);
     } else {
         //Go to nascop
         $target_url = "sync/save/nascop/" . $type . "/" . $id;
         $url = $this->nascop_url . $target_url;
         $responses = $this->post_order($url, $json_data, $supplier);
     }
     $responses = json_decode($responses, TRUE);
     if (is_array($responses)) {
         if (!empty($responses)) {
             $id = $this->extract_order($type, $responses, $id);
             $this->session->set_flashdata('order_delete', "Your " . strtoupper($type) . " data was successfully " . $status . " !");
         } else {
             $this->session->set_flashdata('order_delete', "Your " . strtoupper($type) . " data was empty cannot be " . $status . " !");
         }
     } else {
         $this->session->set_flashdata('order_delete', "Your " . strtoupper($type) . " cannot be deleted!");
     }
     redirect("order");
 }
Пример #16
0
 function _display_basic($options)
 {
     $map_display = new Maps($this->dbcon, $options['map_config_id']);
     return $map_display->google_map($options['map_height'], $options['map_width'], $options['map_zoom'], $options['map_lat'], $options['map_lon']);
 }
Пример #17
0
<?php

/**
 * Recherche d'un bureau de vote
 *
 * PHP version 5
 *
 * @category Ajax
 * @package  LeQG
 * @author   Damien Senger <*****@*****.**>
 * @license  https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License 3.0
 * @link     http://leqg.info
 */
$polls = Maps::pollSearch($_GET['bureau']);
echo json_encode($polls);
Пример #18
0
<?php

/**
 * Ajout d'une nouvelle adresse à un contact
 *
 * PHP version 5
 *
 * @category Ajax
 * @package  LeQG
 * @author   Damien Senger <*****@*****.**>
 * @license  https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License 3.0
 * @link     http://leqg.info
 */
$rue = Maps::streetNew($_POST['rue'], $_POST['ville']);
$immeuble = Maps::buildingNew($_POST['immeuble'], $rue);
$zipcode = Maps::zipcodeNew($_POST['zipcode'], $_POST['ville']);
$adresse = Maps::addressNew($_POST['fiche'], $_POST['ville'], $zipcode, $rue, $immeuble);
$data = new People($_POST['fiche']);
$postal = $data->postal_address();
echo $postal['reel'];
Пример #19
0
 * @author   Damien Senger <*****@*****.**>
 * @license  https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License 3.0
 * @link     http://leqg.info
 */
$var = $_GET;
$var['criteres'] = trim($var['criteres'], ';');
$contacts = People::listing($var, 0, false);
$fichier = array();
$nomFichier = 'export-' . User::ID() . '-' . uniqid() . '.csv';
$file = fopen('exports/' . $nomFichier, 'w+');
$entete = ['nom', 'nom_usage', 'prenoms', 'sexe', 'date_naissance', 'age', 'adresse declaree', 'adresse electorale', 'bureau', 'ville', 'electeur', 'electeur_europeen', 'electeur_municipales', 'organisme', 'fonction', 'tags'];
fputcsv($file, $entete, ';', '"');
foreach ($contacts as $_contact) {
    $contact = new People($_contact);
    $address = $contact->postal_address();
    $poll = Maps::pollData($contact->get('bureau'));
    $birthdate = new DateTime($contact->get('date_naissance'));
    $_fichier = array($contact->get('nom'), $contact->get('nom_usage'), $contact->get('prenoms'), $contact->get('sexe'), $birthdate->format('d/m/Y'), $contact->age(), $address['reel'], $address['officiel'], $poll['number'], $poll['city'], $contact->get('electeur'), $contact->get('electeur_europeen'), $contact->get('electeur_municipales'), $contact->get('organisme'), $contact->get('fonction'), implode(',', $contact->get('tags')));
    fputcsv($file, $_fichier, ';', '"');
}
// On retraite le nom du fichier
$f = 'exports/' . $nomFichier;
if ($f) {
    $email = file_get_contents('tpl/mail/export-reussi.tpl.html');
    $objet = '[LeQG] Votre export est prêt à être téléchargé';
    $email = strtr($email, array('{URL}' => 'http://' . Configuration::read('url') . $f));
} else {
    $email = file_get_contents('tpl/mail/export-echec.tpl.html');
    $objet = '[LeQG] Votre export a provoqué un erreur';
}
$query = Core::query('user-data', 'core');
Пример #20
0
<?php

include "AMP/BaseDB.php";
include "AMP/BaseTemplate.php";
require_once "AMP/Geo/Maps.php";
$map_id = isset($_GET['map']) && $_GET['map'] ? intval($_GET['map']) : false;
if ($map_id) {
    $map = new Maps($dbcon, $map_id);
    echo "<h3>" . $map->P['title'] . "</h3>";
    echo "<p>" . $map->P['description'] . "</p>";
    echo $map->flash_map();
} else {
    $sql = 'select id, name, description from maps ';
    $M = $dbcon->CacheExecute($sql);
    while ($M && !$M->EOF) {
        echo "<p><a href = 'flashmap.php?map=" . $M->Fields("id") . "'>" . $M->Fields('name') . "</a>  " . $M->Fields("description") . "</p>";
        $M->MoveNext();
    }
}
require_once "AMP/BaseFooter.php";
Пример #21
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getMrMaps()
 {
     return $this->hasMany(Maps::className(), ['place_id' => 'id']);
 }
Пример #22
0
<?php

/**
 * Recherche de rues
 *
 * PHP version 5
 *
 * @category Ajax
 * @package  LeQG
 * @author   Damien Senger <*****@*****.**>
 * @license  https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License 3.0
 * @link     http://leqg.info
 */
$rues = Maps::streetSearch($_GET['rue']);
echo json_encode($rues);
Пример #23
0
<?php

/**
 * Modification de l'immeuble d'habitation d'un contact
 *
 * PHP version 5
 *
 * @category Ajax
 * @package  LeQG
 * @author   Damien Senger <*****@*****.**>
 * @license  https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License 3.0
 * @link     http://leqg.info
 */
$street = Maps::streetData($_POST['rue']);
$building = Maps::buildingNew($_POST['immeuble'], $street['id']);
$zipcode = Maps::zipcodeDetect($street['id']);
$city = Maps::cityData($street['city']);
$address = Maps::addressNew($_POST['fiche'], $city['id'], $zipcode, $street['id'], $building);
$data = new People($_POST['fiche']);
$postal = $data->postal_address();
echo $postal['reel'];
 protected function loadMap($mapId)
 {
     //if the project property is null, create it based on input id
     if ($this->_map === null) {
         $this->_map = Maps::model()->findByPk($mapId);
         if ($this->_map === null) {
             throw new CHttpException(404, 'The requested map does not exist.');
         }
     }
     return $this->_map;
 }
Пример #25
0
<?php

/**
 * Retourne les immeubles d'une rue
 *
 * PHP version 5
 *
 * @category Ajax
 * @package  LeQG
 * @author   Damien Senger <*****@*****.**>
 * @license  https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License 3.0
 * @link     http://leqg.info
 */
echo json_encode(Maps::streetBuildings($_GET['rue']));
Пример #26
0
<?php

// Protection de la page
User::protection(5);
// On récupère les données génériques sur la ville
$ville = Maps::cityData($_GET['code']);
$pays = Maps::countryData($ville['country']);
// On récupère les statistiques
$electeurs = Maps::cityVoters($ville['id']);
$emails = Maps::cityContactDetails($ville['id'], 'email');
$mobiles = Maps::cityContactDetails($ville['id'], 'mobile');
$fixes = Maps::cityContactDetails($ville['id'], 'fixe');
// Chargement du template
Core::loadHeader();
?>

<h2><?php 
echo mb_convert_case($ville['city'], MB_CASE_TITLE);
?>
</h2>

<div class="colonne demi gauche">
	<section class="contenu">
		<h4>Informations générales</h4>
		<ul class="informations">
			<li class="electeur"><span>Électeurs</span><span><strong><?php 
echo number_format($electeurs, 0, ',', ' ');
?>
</strong> <em>électeur<?php 
if ($electeurs > 1) {
    ?>
Пример #27
0
    } else {
        $address['street'] = null;
    }
    if (!is_null($adresse['building'])) {
        $building = Maps::buildingSearch($adresse['building'], $address['street']);
        if (count($building)) {
            $address['building'] = $building[0]['id'];
        } else {
            $building = Maps::buildingNew($adresse['building'], $address['street']);
            $address['building'] = $building;
        }
    } else {
        $address['building'] = null;
    }
    // On lance la création de l'adresse
    Maps::addressNew($person->get('id'), $address['ville'], $address['zip'], $address['street'], $address['building'], 'reel');
    $person->contact_details_add($contact['MAIL']);
    $person->tag_add('Sénateur PS');
    $person->tag_add($contact['REGION']);
    $query = $link->prepare('DELETE FROM `TABLE 30` WHERE `id` = :id');
    $query->bindValue(':id', $contact['id'], PDO::PARAM_INT);
    $query->execute();
}
$query = $link->query('SELECT COUNT(*) FROM `TABLE 30`');
$nb = $query->fetch(PDO::FETCH_NUM);
if ($nb[0]) {
    ?>
<script>
    var url = 'transfert.php';
    document.location.href = url;
</script>
Пример #28
0
/*** include the path for the library utill ***/
//todo:modle the autoload properly
/*** auto load model classes ***/
function __autoload($class_name)
{
    $filename = strtolower($class_name) . '.Model.php';
    $file = __SITE_PATH . '/model/' . $filename;
    if (file_exists($file) == false) {
        return false;
    }
    include $file;
}
/**A function used to load Dodeye library
 * @param String $path of the Class to inport e.g <"Dodeye.util.basic">
 * @return requirement to the path
 */
function pitch($path)
{
    $path = str_replace('.', "\\", $path);
    $path = $path . ".php";
    return require_once "{$path}";
}
/*** a new registry object ***/
$registry = new Registry();
$registry->dodeye = new Dodeye($registry);
/**creating the database reg object ***/
$registry->db = DB::getDB(LorbConfig::getConfig()->getDefaultDB());
$registry->cfg = LorbConfig::getConfig();
$registry->maps = Maps::getInstance();
Template::setBaseDir();
$registry->front = new FrontController($registry);
Пример #29
0
 function map($x, $y)
 {
     if (C('baidu_map')) {
         $transUrl = 'http://api.map.baidu.com/ag/coord/convert?from=2&to=4&x=' . $x . '&y=' . $y;
         $json = Http::fsockopenDownload($transUrl);
         if ($json == false) {
             $json = file_get_contents($transUrl);
         }
         $arr = json_decode($json, true);
         $x = base64_decode($arr['x']);
         $y = base64_decode($arr['y']);
     } else {
         $amap = new amap();
         $lact = $amap->coordinateConvert($y, $x, 'gps');
         $x = $lact['latitude'];
         $y = $lact['longitude'];
     }
     $user_request_model = M('User_request');
     $urWhere = array('token' => $this->_get('token'), 'msgtype' => 'text', 'uid' => $this->data['FromUserName']);
     $urWhere['time'] = array('gt', time() - 5 * 60);
     $user_request_row = $user_request_model->where($urWhere)->find();
     if (!(strpos($user_request_row['keyword'], '附近') === FALSE)) {
         $user = M('Nearby_user')->where(array('token' => $this->_get('token'), 'uid' => $this->data['FromUserName']))->find();
         $keyword = $user['keyword'];
         $radius = 2000;
         if (C('baidu_map')) {
             $map = new baiduMap($keyword, $x, $y);
             $str = $map->echoJson();
             $array = json_decode($str);
             $map = array();
             foreach ($array as $key => $vo) {
                 $map[] = array($vo->title, $key, rtrim($this->siteUrl, '/') . '/tpl/static/images/home.jpg', $vo->url);
             }
             if ($map) {
                 return array($map, 'news');
             } else {
                 $str = file_get_contents($this->siteUrl . '/map.php?keyword=' . urlencode($keyword) . '&x=' . $x . '&y=' . $y);
                 $array = json_decode($str);
                 $map = array();
                 foreach ($array as $key => $vo) {
                     $map[] = array($vo->title, $key, rtrim($this->siteUrl, '/') . '/tpl/static/images/home.jpg', $vo->url);
                 }
                 if ($map) {
                     return array($map, 'news');
                 } else {
                     return array('附近信息无法调出,请稍候再试一下(关键词' . $keyword . ',坐标:' . $x . '-' . $y . ')', 'text');
                 }
             }
         } else {
             $amamp = new amap();
             return $amamp->around($x, $y, $keyword, $radius);
         }
     } else {
         if (!(strpos($this->fun, 'lbsNews') === FALSE)) {
             $lbsImgClass = new lbsImgNews($this->token, $this->data['FromUserName'], $this->siteUrl);
             return $lbsImgClass->news($x, $y);
         }
         $mapAction = new Maps($this->token);
         if (!(strpos($user_request_row['keyword'], '开车去') === FALSE) || !(strpos($user_request_row['keyword'], '坐公交') === FALSE) || !(strpos($user_request_row['keyword'], '步行去') === FALSE)) {
             if (!(strpos($user_request_row['keyword'], '步行去') === FALSE)) {
                 $companyid = str_replace('步行去', '', $user_request_row['keyword']);
                 if (!$companyid) {
                     $companyid = 1;
                 }
                 return $mapAction->walk($x, $y, $companyid);
             }
             if (!(strpos($user_request_row['keyword'], '开车去') === FALSE)) {
                 $companyid = str_replace('开车去', '', $user_request_row['keyword']);
                 if (!$companyid) {
                     $companyid = 1;
                 }
                 return $mapAction->drive($x, $y, $companyid);
             }
             if (!(strpos($user_request_row['keyword'], '坐公交') === FALSE)) {
                 $companyid = str_replace('坐公交', '', $user_request_row['keyword']);
                 if (!$companyid) {
                     $companyid = 1;
                 }
                 return $mapAction->bus($x, $y, $companyid);
             }
         } else {
             switch ($user_request_row['keyword']) {
                 default:
                     return $this->companyMap();
                     break;
                 case '最近的':
                     return $mapAction->nearest($x, $y);
                     break;
             }
         }
     }
 }
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return Maps the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Maps::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }