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));
|
return array_values(array_map(array($this, 'AddFiles'), $books));
|
||||||
}
|
}
|
||||||
|
|
||||||
private function AddFiles(array $book)
|
private function GetFiles(array $ids)
|
||||||
{
|
{
|
||||||
if(!isset($book['code'])) {
|
$ids = array_map('intval', $ids);
|
||||||
return $book;
|
|
||||||
}
|
|
||||||
|
|
||||||
$uri = sprintf("%s%s",
|
$uri = sprintf("%s%s",
|
||||||
Configuration::get('checkfile_url'),
|
Configuration::get('checkfile_url'),
|
||||||
http_build_query(array(
|
http_build_query(array(
|
||||||
"client" => $this->client,
|
"client" => $this->client,
|
||||||
"login" => $this->login,
|
"login" => $this->login,
|
||||||
"book" => intval($book['code'])
|
"book" => implode(',', $ids),
|
||||||
))
|
))
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -246,9 +244,15 @@ class NetBiblio extends WebService
|
|||||||
$json = curl_exec($ch);
|
$json = curl_exec($ch);
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
|
|
||||||
$files = json_decode($json, true);
|
return json_decode($json, true);
|
||||||
if (is_array($files)) {
|
}
|
||||||
$book['files'] = $files;
|
|
||||||
|
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 {
|
} else {
|
||||||
$book['files'] = array();
|
$book['files'] = array();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user