public function save(Movie $movie) { $commentData = array('mov_id' => $movie->getcategory()->getId(), 'mov_description_short' => $movie->getMovie()); if ($movie->getId()) { $this->getDb()->update('movie', $movieData, array('mov_id' => $movie->getId())); } else { $this->getDb()->insert('mov', $movieData); $id = $this->getDb()->lastInsertId(); $movie->setId($id); } }
public function movie() { if (isset($_GET['id'])) { $movie = new Movie(); $id = $_GET['id']; $movie_data = $movie->getMovie($id); //no movie is found. Redirect to movies page if ($movie_data['id'] === null) { $this->index("Wrong movie index."); } else { $this->registry->template->show('movie', $movie_data); } } }
if ($user_id && $target_id && $target_type) { $data = array(); $data['user_id'] = $user_id; $data['target_id'] = $target_id; $data['target_type'] = $target_type; $data['date_added'] = date("Y-m-d H:i:s"); $res = $stream->addWatch($data); if ($res) { $data = array(); $data['user_id'] = $user_id; $data['target_id'] = $target_id; $data['user_data'] = $_SESSION['loggeduser_details']; $data['target_type'] = $target_type; if ($target_type == 1) { // show $show = new Show(); $data['target_data'] = $show->getShow($target_id, 0); } elseif ($target_type == 2) { // movie $movie = new Movie(); $data['target_data'] = $movie->getMovie($target_id); } elseif ($target_type == 3) { // episode $show = new Show(); $data['target_data'] = $show->getEpisodeById($target_id); } $data['event_type'] = 5; $data['event_date'] = date("Y-m-d H:i:s"); $stream->addActivity($data); } }