Esempio n. 1
0
 /**
  * Method to get the Venues
  *
  * @access public
  * @return array
  */
 function &getData()
 {
     $mainframe =& JFactory::getApplication();
     $menu =& JSite::getMenu();
     $item = $menu->getActive();
     $params =& $menu->getParams($item->id);
     $elsettings =& redEVENTHelper::config();
     // Lets load the content if it doesn't already exist
     if (empty($this->_data)) {
         $query = $this->_buildQuery();
         // Get a reference to the global cache object.
         $cache =& JFactory::getCache('redevent');
         $this->_data = $cache->call(array('RedeventModelCountriesmap', '_getResultList'), $query);
         $countrycoords = redEVENTHelperCountries::getCountrycoordArray();
         $k = 0;
         for ($i = 0; $i < count($this->_data); $i++) {
             $country =& $this->_data[$i];
             $country->flag = REOutput::getFlag($country->iso2);
             $country->flagurl = REOutput::getFlagUrl($country->iso2);
             $country->latitude = $countrycoords[$country->iso2][0];
             $country->longitude = $countrycoords[$country->iso2][1];
             //create target link
             $country->targetlink = JRoute::_(JURI::base() . 'index.php?option=com_redevent&view=countryevents&filter_country=' . $country->iso2);
             $k = 1 - $k;
         }
     }
     return $this->_data;
 }
Esempio n. 2
0
 /**
  * get venues countries
  * @return array
  */
 function getCountries()
 {
     $venues = $this->getData();
     $countries = array();
     foreach ((array) $venues as $v) {
         $countries[] = $v->country;
     }
     if (!count($countries)) {
         return array();
     }
     $countries = array_unique($countries);
     $countrycoords = redEVENTHelperCountries::getCountrycoordArray();
     $res = array();
     foreach ($countries as $c) {
         $country = new stdclass();
         $country->name = redEVENTHelperCountries::getCountryName($c);
         $country->flag = redEVENTHelperCountries::getCountryFlag($c);
         $country->flagurl = redEVENTHelperCountries::getIsoFlag($c);
         $country->latitude = redEVENTHelperCountries::getLatitude($c);
         $country->longitude = redEVENTHelperCountries::getLongitude($c);
         $res[] = $country;
     }
     return $res;
 }