예제 #1
0
 public function actionPhoto($id)
 {
     $this->app->config->extensions->fotorama;
     $album = $this->data->album = Album::findByColumn('__id', $id);
     if ($album->__rgt - $album->__lft > 1) {
         $this->data->items = Album::findAllByQuery('SELECT __id, title FROM albums WHERE __lft >' . $album->__lft . ' AND __rgt <' . $album->__rgt);
     } else {
         $this->data->albumParent = Album::findByColumn('__id', $album->__prt);
         $this->data->items = Photo::findAllByColumn('__album_id', $id, ['order' => 'published DESC']);
     }
 }
예제 #2
0
 public function actionPhoto($id = null, $page = 1)
 {
     if ($id == null) {
         $id = $this->app->request->post->parent;
     }
     $this->data->url = $this->app->request->getPath() . '/?page=%d&id=' . $id;
     $album = $this->data->item = Album::findByColumn('__id', $id);
     $this->data->itemsCount = count(Album::findByPK($id)->photos->collect('__id'));
     $this->data->pageSize = self::PAGE_SIZE;
     $this->data->activePage = $page;
     $this->data->albums = Album::findAllByQuery('SELECT __id, title FROM albums WHERE __lft >' . $album->__lft . ' AND __rgt <' . $album->__rgt);
     if (!$album->__prt == null) {
         $this->data->albumParent = Album::findByColumn('__id', $album->__prt);
     }
     $this->data->photos = Photo::findAllByColumn('__album_id', $id, ['order' => 'published DESC', 'offset' => ($page - 1) * self::PAGE_SIZE, 'limit' => self::PAGE_SIZE]);
 }