diff --git a/application/modules/admin/controllers/BibnumController.php b/application/modules/admin/controllers/BibnumController.php index 90821b401bc64c8f3d808660df34babadb4d05cb..d86a9af78a541a9ebbbea40042f4169a9fe6ff54 100644 --- a/application/modules/admin/controllers/BibnumController.php +++ b/application/modules/admin/controllers/BibnumController.php @@ -32,9 +32,8 @@ class Admin_BibnumController extends ZendAfi_Controller_Action { ->setAlbums(Class_Album::findAllBy(['cat_id' => 0])); $albums = []; - foreach ($categories as $category) { - $albums[] = $category->toArray(); - } + foreach ($categories as $category) + $albums[] = $category->getInfosForTree(); $bib = Class_Bib::getPortail(); diff --git a/library/Class/AlbumCategorie.php b/library/Class/AlbumCategorie.php index ac9554c0c208e21b77bfac15dda31fca8120ace4..953d6fad923313b803ee171503a80743f0d0b139 100644 --- a/library/Class/AlbumCategorie.php +++ b/library/Class/AlbumCategorie.php @@ -244,22 +244,22 @@ class Class_AlbumCategorie extends Storm_Model_Abstract { } - public function albumsToArray($albums) { + public function getAlbumsInfosForTree($albums) { $albums_array = []; foreach ($albums as $album) { - $albums_array []= $album->toArray(); + $albums_array []= $album->getInfosForTree(); } return $albums_array; } - public function toArray() { + public function getInfoForTree() { return ['id' => $this->getId(), 'label' => htmlspecialchars($this->getLibelle()), - 'categories' => $this->albumsToArray($this->getSousCategories()), + 'categories' => $this->getAlbumsInfosForTree($this->getSousCategories()), 'items' => []]; } } \ No newline at end of file