public function indexAction() { $id = (int) $this->dispatcher->getParam('id', 'int'); $video = Video::findFirst($id); $videos = Video::find(array('order' => 'sortorder ASC')); $this->helper->title()->append($video->getTitle()); $this->view->video = $video; $this->view->videos = $videos; }
public function deleteAction($id) { $model = Video::findFirst($id); if ($this->request->isPost()) { $model->delete(); $this->redirect('/video/admin'); } $this->view->model = $model; }
public function addAction() { $logged = $this->getConnection(); $form = new VideoForm(); $form->get('submit')->setValue('Add'); $request = $this->getRequest(); if ($request->isPost()) { $video = new Video(); $form->setInputFilter($video->getInputFilter()); $post = $request->getPost()->toArray(); $post['idMembre'] = $logged; $form->setData($post); if ($form->isValid()) { $data = $form->getData(); $saveVideo = array('idMembre' => $logged, 'description' => $post['description'], 'titre' => $post['titre'], 'lien' => $post['lien']); $video->exchangeArray($saveVideo); $this->getVideoTable()->saveVideo($video); // Redirect to list of videos return $this->redirect()->toRoute('video'); } } return array('form' => $form); }