1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
<?php
namespace SIW\Plato;
class Import_Workcamps extends Import {
protected $endpoint = 'GetAllProjects';
protected $name = 'importeren groepsprojecten';
protected $properties = [
'project_id',
'code',
'project_type',
'work',
'start_date',
'end_date',
'name',
'location',
'country',
'region',
'languages',
'participation_fee',
'participation_fee_currency',
'min_age',
'max_age',
'disabled_vols',
'numvol',
'vegetarian',
'family',
'description',
'descr_partner',
'descr_work',
'descr_accomodation_and_food',
'descr_location_and_leisure',
'descr_requirements',
'airport',
'train_bus_station',
'numvol_m',
'numvol_f',
'max_vols_per_country',
'max_teenagers',
'max_national_vols',
'lat_project',
'lng_project',
'notes',
'lat_station',
'lng_station',
'bi_tri_multi',
'ho_description',
'project_summary',
'accessibility',
'last_update',
];
protected function process_xml() {
$projects = $this->xml_response->xpath( '//project' );
foreach ( $projects as $project ) {
$project_data = [];
foreach ( $this->properties as $property ) {
$project_data[ $property ] = (string) $project->$property;
}
$image_urls = $project->xpath( "*[starts-with(local-name(),'url_prj_photo')]" );
$project_data['images'] = [];
foreach ( $image_urls as $image_url ) {
$url_query = parse_url( (string) $image_url, PHP_URL_QUERY );
parse_str( $url_query, $query );
$project_data['images'][] = $query['fileIdentifier'];
}
$this->data[] = $project_data;
}
return;
}
}