Esempio n. 1
0
 public static function downloadXML($id)
 {
     $userId = JFactory::getUser()->get('id');
     if ($userId) {
         require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'helpers' . DS . 'xmldata.php';
         if ($id == 'countries') {
             XMLDataHelper::downloadFile('http://booking.gruda.lt/tours/api/?method=exportCountries', 'countries.xml');
         } else {
             XMLDataHelper::downloadFile('http://booking.gruda.lt/tours/api/?method=getTravels&travelType=' . $id, "travels{$id}.xml");
         }
     }
     return null;
 }
Esempio n. 2
0
 public static function getTravels($travelTypeId, $countryId)
 {
     require_once JPATH_COMPONENT . '/helpers/data.php';
     $file = XMLDataHelper::downloadFile('http://booking.gruda.lt/tours/api/?method=getTravels&travelType=' . $travelTypeId, "travels{$travelTypeId}.xml");
     $fullXML = simplexml_load_file($file);
     $XML = $fullXML->xpath('getTravels');
     $keliones = new Keliones();
     foreach ($XML[0] as $item) {
         if ($item->visible) {
             $keliones->addFromXML($item);
         }
     }
     return $keliones;
 }
Esempio n. 3
0
 public function getCountries()
 {
     require_once JPATH_COMPONENT . '/helpers/xmldata.php';
     return XMLDataHelper::getCountries();
 }
 public function getItems()
 {
     require_once JPATH_COMPONENT . '/helpers/xmldata.php';
     return XMLDataHelper::getTravelTypes();
 }
Esempio n. 5
0
 public function LoadCountriesListFromXMLFile()
 {
     require_once JPATH_COMPONENT . '/helpers/xmldata.php';
     $this->countriesList = XMLDataHelper::getCountries();
 }