Exemple #1
0
 protected static function _sonnbPhotoIndexParams()
 {
     $albumModel = self::$controller->getModelFromCache('Nobita_Teams_Model_XenGallery_Album');
     $options = XenForo_Application::get('options');
     $visitor = XenForo_Visitor::getInstance();
     $galleryAlbumModel = self::$controller->getModelFromCache('sonnb_XenGallery_Model_Album');
     $page = max(1, self::$input->filterSingle('page', XenForo_Input::UINT));
     $albumPerPage = $options->Teams_photosPerPage;
     $order = self::$input->filterSingle('order', XenForo_Input::STRING);
     $orderDirection = self::$input->filterSingle('direction', XenForo_Input::STRING);
     Nobita_Teams_sonnb_XenGallery_Helper::getAlbumSort($order, $orderDirection, $defaultOrder, $defaultOrderDirection);
     $conditions = self::_getDefaultConditions($team);
     $fetchElements = self::_getAlbumFetchElements($conditions);
     $albumFetchConditions = $fetchElements['conditions'];
     $albumFetchOptions = $fetchElements['options'] + array('perPage' => $albumPerPage, 'page' => $page, 'order' => $order, 'orderDirection' => $orderDirection);
     $totalAlbums = $galleryAlbumModel->countAlbums($albumFetchConditions);
     $pageRoute = TEAM_ROUTE_PREFIX . '/photos';
     self::$controller->canonicalizePageNumber($page, $albumPerPage, $totalAlbums, $pageRoute, $team);
     $albums = $galleryAlbumModel->getAlbums($albumFetchConditions, $albumFetchOptions);
     $albums = $galleryAlbumModel->prepareAlbums($albums, $albumFetchOptions);
     foreach ($albums as $albumId => $album) {
         if (!$galleryAlbumModel->canViewAlbum($album)) {
             unset($albums[$albumId]);
         }
     }
     $albums = $galleryAlbumModel->attachCoversToAlbums($albums, $albumFetchOptions);
     $pageNavParams = array();
     $pageNavParams['order'] = $order != $defaultOrder ? $order : false;
     $pageNavParams['direction'] = $orderDirection != $defaultOrderDirection ? $orderDirection : false;
     return array('templateName' => 'Team_photo', 'viewName' => 'sonnb_XenGallery_ViewPublic_Album_List', 'canCreateAlbum' => $albumModel->canCreateAlbum(), 'albums' => $albums, 'displayMostViewed' => false, 'order' => $order, 'orderDirection' => $orderDirection, 'pageNavParams' => $pageNavParams, 'page' => $page, 'canEmbedVideos' => false, 'albumsPerPage' => $albumPerPage, 'totalAlbums' => $totalAlbums, 'pageRoute' => $pageRoute, 'provider' => 'sonnb_xengallery');
 }