private function createBranchesInformationResponse($organisations) { $xml = AlmaBundle\AlmaUtils::createXmlHeader(); $get_organisations_response = $xml->addChild('getReservationBranchesResponse'); $status = $get_organisations_response->addChild('status'); $status->addAttribute('key', 'moduleNotAvailable'); $status->addAttribute('value', 'ok'); $_organisations = $get_organisations_response->addChild('organisations'); if (is_array($organisations) && !empty($organisations)) { foreach ($organisations as $org) { $lang = $org->getLanguage(); $_org = $_organisations->addChild('organisation'); $_org->addAttribute('id', $org->getId()); $codes = $_org->addChild('codes'); $code = $codes->addChild('code', $org->getCode()); $code->addAttribute('language', $lang); $shortnames = $_org->addChild('shortnames'); $shortname = $shortnames->addChild('shortname', $org->getShortname()); $shortname->addAttribute('language', $lang); $names = $_org->addChild('names'); $name = $names->addChild('name', $org->getName()); $name->addAttribute('language', $lang); $branches = $_org->addChild('branches'); if (is_array($org->branches) && !empty($org->branches)) { foreach ($org->branches as $branch) { $_branch = $branches->addChild('branch'); $_branch->addAttribute('id', $branch->getId()); $codes = $_branch->addChild('codes'); $code = $codes->addChild('code', $branch->getCode()); $code->addAttribute('language', $lang); $shortnames = $_branch->addChild('shortnames'); $shortname = $shortnames->addChild('shortname', $branch->getShortname()); $shortname->addAttribute('language', $lang); $names = $_branch->addChild('names'); $name = $names->addChild('name', $branch->getName()); $name->addAttribute('language', $lang); } } } } return $xml->asXML(); }
private function createAvailabilityInformation($ids) { $xml = AlmaBundle\AlmaUtils::createXmlHeader(); $response = $xml->addChild('getAvailabilityResponse'); $status = $response->addChild('status'); $status->addAttribute('key', 'moduleNotAvailable'); $status->addAttribute('value', 'ok'); $records = $response->addChild('catalogueRecords'); $true_false = array('true', 'false'); $yes_no = array('no', 'yes'); foreach ($ids as $id) { $record = $records->addChild('catalogueRecord'); $is_reservable = 0; $record->addAttribute('isReservable', $true_false[$is_reservable]); $is_available = 1; $record->addAttribute('isAvailable', $yes_no[$is_available]); $record->addAttribute('id', $id); } return $xml->asXML(); }
private function createDetailNotFoundInformationResponse() { $xml = AlmaBundle\AlmaUtils::createXmlHeader(); $get_branches_response = $xml->addChild('getCatalogueRecordDetailResponse'); $status = $get_branches_response->addChild('status'); $status->addAttribute('key', 'catalogueRecordNotFound'); $status->addAttribute('value', 'error'); return $xml->asXML(); }
private function pincodeChangeActionResponse($key, $value) { $xml = AlmaBundle\AlmaUtils::createXmlHeader(); $remove_reservation = $xml->addChild('changeAbsentDateResponse'); $status = $remove_reservation->addChild('status'); $status->addAttribute('key', $key); $status->addAttribute('value', $value); return $xml->asXML(); }