prepare the way for batch files getting
This commit is contained in:
@@ -225,18 +225,16 @@ class NetBiblio extends WebService
|
||||
return array_values(array_map(array($this, 'AddFiles'), $books));
|
||||
}
|
||||
|
||||
private function AddFiles(array $book)
|
||||
private function GetFiles(array $ids)
|
||||
{
|
||||
if(!isset($book['code'])) {
|
||||
return $book;
|
||||
}
|
||||
$ids = array_map('intval', $ids);
|
||||
|
||||
$uri = sprintf("%s%s",
|
||||
Configuration::get('checkfile_url'),
|
||||
http_build_query(array(
|
||||
"client" => $this->client,
|
||||
"login" => $this->login,
|
||||
"book" => intval($book['code'])
|
||||
"book" => implode(',', $ids),
|
||||
))
|
||||
);
|
||||
|
||||
@@ -246,9 +244,15 @@ class NetBiblio extends WebService
|
||||
$json = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
|
||||
$files = json_decode($json, true);
|
||||
if (is_array($files)) {
|
||||
$book['files'] = $files;
|
||||
return json_decode($json, true);
|
||||
}
|
||||
|
||||
private function AddFiles(array $book)
|
||||
{
|
||||
$files = $this->GetFiles(array($book['code']));
|
||||
|
||||
if (is_array($files) && isset($files[$book['code']])) {
|
||||
$book['files'] = $files[$book['code']];
|
||||
} else {
|
||||
$book['files'] = array();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user