public function handleGet($get, $post, $files, $cookies)
 {
     /* Set up common page parts */
     $this->htmlHeader($cookies);
     /* Set up breadcrumbs */
     $breadcrumbs = new Views\BreadcrumbView();
     $breadcrumbs->openGraphObjects[] = $this;
     $breadcrumbs->render();
     /* Set up grid */
     $start = isset($get['start']) ? $get['start'] : 0;
     $obs = array();
     foreach ($this->model->getTags() as $tag) {
         $obs[] = new TagController($tag->record['id']);
     }
     /* Set up grid */
     $grid = new Views\GridView();
     $grid->openGraphObjects = $obs;
     $grid->render();
     /* Set up page selector */
     $pageSelector = new Views\PageSelectorView();
     $pageSelector->start = $start;
     $pageSelector->total = $this->model->getPhotoCount();
     $pageSelector->render();
     /* Render footer */
     $this->htmlFooter();
 }
Ejemplo n.º 2
0
 public function handleGet($get, $post, $files, $cookies)
 {
     $start = isset($get['start']) ? $get['start'] : 0;
     $section = isset($get['section']) ? $get['section'] : null;
     $this->model->setPage($start);
     $photoCount = $this->model->getPhotoCount();
     $folderCount = $this->model->getFolderCount();
     $gridObjects = array();
     if (!$photoCount || $section == 'folders') {
         foreach ($this->model->getFolders() as $folder) {
             $gridObjects[] = new FolderController($folder->id);
         }
     } else {
         foreach ($this->model->getPhotos() as $photo) {
             $gridObjects[] = new PhotoController($photo->id);
         }
     }
     $photos = $this->model->getPhotos();
     $firstPhoto = NULL;
     if (count($photos) > 0) {
         $firstPhoto = $photos[0];
     }
     /* Set up common page parts */
     $this->htmlHeader($cookies);
     if ($firstPhoto) {
         $view = new Views\BackgroundBlurView();
         $view->imageURL = $firstPhoto->getMediaURL('thumbnail');
         $view->render();
     }
     /* Set up breadcrumbs */
     $breadcrumbs = new Views\BreadcrumbView();
     foreach ($this->model->getAncestors() as $ancestor) {
         $openGraph = new FolderController($ancestor->path);
         $openGraph->title = basename($openGraph->title);
         $breadcrumbs->openGraphObjects[] = $openGraph;
     }
     $openGraph = clone $this;
     $openGraph->title = basename($openGraph->title);
     $breadcrumbs->openGraphObjects[] = $openGraph;
     $breadcrumbs->openGraphObjects[0]->title = '(All photos)';
     $breadcrumbs->render();
     /* Set up tabs */
     $tabs = new Views\TabView();
     if ($photoCount && $folderCount) {
         $tabs->openGraphObjects[0] = clone $this;
         $tabs->openGraphObjects[0]->title = "{$photoCount} photos";
         $tabs->openGraphObjects[1] = clone $this;
         $tabs->openGraphObjects[1]->title = "{$folderCount} folders";
         $tabs->render();
     }
     /* Set up grid */
     $grid = new Views\GridView();
     $grid->openGraphObjects = $gridObjects;
     $grid->render();
     /* Set up page selector */
     $pageSelector = new Views\PageSelectorView();
     $pageSelector->start = $start;
     $pageSelector->total = $photoCount;
     $pageSelector->url = $this->url;
     $pageSelector->render();
     /* Render footer */
     $this->htmlFooter();
 }