Example #1
0
 protected function renderCollection()
 {
     //show items which are included in this collection
     $albumsOfCollection = Collect::albumsOfCollection();
     //if user is editor or admin, we will show all items
     //to permit to include its in collection
     if ($this->levelAccess) {
         //get all items which aren't already in this collection
         $albumsNotInCollection = Collect::albumsNotInCollection();
         //there are some items not in collection and some in collection
         if ($albumsOfCollection && $albumsNotInCollection) {
             $arrAllAlbums = array_merge($albumsOfCollection, $albumsNotInCollection);
         }
         if ($albumsOfCollection && !$albumsNotInCollection) {
             $arrAllAlbums = $albumsOfCollection;
         }
         if (!$albumsOfCollection && $albumsNotInCollection) {
             $arrAllAlbums = $albumsNotInCollection;
         }
         if (!$albumsOfCollection && !$albumsNotInCollection) {
             $arrAllAlbums = array();
         }
         if ($arrAllAlbums) {
             $arrItems = array();
             foreach ($arrAllAlbums as $item) {
                 $arrItems[] = $this->render('editorShop/itemCollectionShop', array('item' => $item), true);
             }
             $this->render('editorShop/viewSortableCollectionShop', array('arrItems' => $arrItems));
         } else {
             echo $this->tr('noAlbumExists');
         }
     } else {
         $this->render('shop/_viewCollectionShop', array('items' => $albumsOfCollection));
     }
 }