Пример #1
0
 public function renderDefault($goodsId)
 {
     $goods = $this->goods->get($goodsId);
     if (!$goods) {
         $this->error('Výrobek nebyl nalezen v databázi.', 404);
     }
     $this->template->goods = $goods;
     $this->template->item = $this->item->where('goods_id = ?', $goodsId);
 }
Пример #2
0
 public function deletePhoto($id)
 {
     try {
         unlink(self::SAVE_DIR . $id . '.big.jpg');
         unlink(self::SAVE_DIR . $id . '.small.jpg');
     } catch (\Exception $e) {
         return false;
     }
     $photo = new Photo($this->db);
     $photo->where('id', $id)->delete();
     return true;
 }
Пример #3
0
 public function singlePhotoAction(Request $request, Application $app)
 {
     $photo = Photo::where('photo_id', $request->get('id'))->first();
     $user = User::find($photo->user_id);
     return $app['twig']->render('photo.html.twig', $this->getParamsTwig(['photo' => $photo, 'user' => $user]));
 }