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; }
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; }
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(); }
public function LoadCountriesListFromXMLFile() { require_once JPATH_COMPONENT . '/helpers/xmldata.php'; $this->countriesList = XMLDataHelper::getCountries(); }