| // +---------------------------------------------------------------------------+ class MapMgr extends SGL_Manager { function MapMgr() { SGL::logMessage(null, PEAR_LOG_DEBUG); parent::SGL_Manager(); $this->_aActionsMapping = array( 'view' => array('view'), ); } function validate($req, &$input) { SGL::logMessage(null, PEAR_LOG_DEBUG); $this->validated = true; if (empty($this->conf['MapMgr']['apiKey'])) { $this->validated = false; SGL::raiseMsg('You must enter an api key'); } $input->action = ($req->get('action')) ? $req->get('action') : 'view'; } function _cmd_view(&$input, &$output) { SGL::logMessage(null, PEAR_LOG_DEBUG); $output->template = 'viewMap.html'; $apiKey = $this->conf['MapMgr']['apiKey']; $output->addJavascriptFile('http://maps.google.com/maps?file=api&v=2&key=' . $apiKey); $output->addJavascriptFile('googlemaps/js/pruner.js'); $output->addJavascriptFile('googlemaps/js/googleMaps.js'); $output->addOnLoadEvent('loadGoogleMap()'); $output->addOnUnloadEvent('GUnload()'); $output->aCodes = $this->getUserGeoCodes(); } function getUserGeoCodes() { $query = " SELECT latitude, longitude FROM {$this->conf['table']['googlemaps_user_geocode']} "; $aCodes = $this->dbh->getAll($query, array(), DB_FETCHMODE_ASSOC); return $aCodes; } } ?>