Пример #1
0
 public function indexAction()
 {
     $profilMapper = new UserMapper();
     $galleryMapper = new GalleryMapper();
     $profil = $profilMapper->getUserById($this->getRequest()->getParam('user'));
     $this->getLayout()->getHmenu()->add($this->getTranslator()->trans('menuUserList'), array('controller' => 'index'))->add($profil->getName(), array('action' => 'index', 'user' => $this->getRequest()->getParam('user')));
     $this->getView()->set('profil', $profil);
     $this->getView()->set('galleryAllowed', $this->getConfig()->get('usergallery_allowed'));
     $this->getView()->set('gallery', $galleryMapper->getCountGalleryByUser($this->getRequest()->getParam('user')));
 }
Пример #2
0
 public function showImageAction()
 {
     $profilMapper = new UserMapper();
     $commentMapper = new CommentMapper();
     $imageMapper = new GalleryImageMapper();
     $galleryMapper = new GalleryMapper();
     $id = $this->getRequest()->getParam('id');
     $galleryId = $this->getRequest()->getParam('gallery');
     $userId = $this->getRequest()->getParam('user');
     $gallery = $galleryMapper->getGalleryById($galleryId);
     $comments = $commentMapper->getCommentsByKey('user/gallery/showimage/user/' . $userId . '/gallery/' . $galleryId . '/id/' . $id);
     $image = $imageMapper->getImageById($id);
     $profil = $profilMapper->getUserById($this->getRequest()->getParam('user'));
     $this->getLayout()->set('metaTitle', $this->getTranslator()->trans('gallery') . ' - ' . $gallery->getTitle() . ' - ' . $image->getImageTitle());
     $this->getLayout()->set('metaDescription', $this->getTranslator()->trans('gallery') . ' - ' . $gallery->getDesc());
     $this->getLayout()->getHmenu()->add($this->getTranslator()->trans('menuUserList'), array('controller' => 'index'))->add($profil->getName(), array('controller' => 'profil', 'action' => 'index', 'user' => $this->getRequest()->getParam('user')))->add($this->getTranslator()->trans('menuGallery'), array('controller' => 'gallery', 'action' => 'index', 'user' => $this->getRequest()->getParam('user')))->add($gallery->getTitle(), array('action' => 'show', 'user' => $this->getRequest()->getParam('user'), 'id' => $galleryId))->add($image->getImageTitle(), array('action' => 'showimage', 'user' => $this->getRequest()->getParam('user'), 'gallery' => $galleryId, 'id' => $id));
     if ($this->getRequest()->getPost('saveComment')) {
         $date = new \Ilch\Date();
         $commentModel = new CommentModel();
         if ($this->getRequest()->getPost('fkId')) {
             $commentModel->setKey('user/gallery/showimage/user/' . $userId . '/gallery/' . $galleryId . '/id/' . $id . '/id_c/' . $this->getRequest()->getPost('fkId'));
             $commentModel->setFKId($this->getRequest()->getPost('fkId'));
         } else {
             $commentModel->setKey('user/gallery/showimage/user/' . $userId . '/gallery/' . $galleryId . '/id/' . $id);
         }
         $commentModel->setText($this->getRequest()->getPost('gallery_comment_text'));
         $commentModel->setDateCreated($date);
         $commentModel->setUserId($this->getUser()->getId());
         $commentMapper->save($commentModel);
     }
     $model = new GalleryImageModel();
     $model->setImageId($image->getImageId());
     $model->setVisits($image->getVisits() + 1);
     $imageMapper->saveVisits($model);
     $this->getView()->set('image', $imageMapper->getImageById($id));
     $this->getView()->set('comments', $comments);
 }
Пример #3
0
 public function treatGalleryImageAction()
 {
     $imageMapper = new GalleryImageMapper();
     $galleryMapper = new GalleryMapper();
     $id = (int) $this->getRequest()->getParam('id');
     $galleryId = (int) $this->getRequest()->getParam('gallery');
     $gallery = $galleryMapper->getGalleryById($galleryId);
     $this->getLayout()->getHmenu()->add($this->getTranslator()->trans('menuPanel'), array('controller' => 'panel', 'action' => 'index'))->add($this->getTranslator()->trans('menuGallery'), array('controller' => 'panel', 'action' => 'gallery'))->add($gallery->getTitle(), array('controller' => 'panel', 'action' => 'treatgallery', 'id' => $galleryId))->add($this->getTranslator()->trans('treatImage'), array('action' => 'treatgalleryimage', 'gallery' => $galleryId, 'id' => $id));
     if ($this->getRequest()->getPost()) {
         $imageTitle = $this->getRequest()->getPost('imageTitle');
         $imageDesc = $this->getRequest()->getPost('imageDesc');
         $model = new GalleryImageModel();
         $model->setId($id);
         $model->setImageTitle($imageTitle);
         $model->setImageDesc($imageDesc);
         $imageMapper->saveImageTreat($model);
         $this->addMessage('saveSuccess');
     }
     $this->getView()->set('image', $imageMapper->getImageById($id));
 }