public function add() { $play = DB::table(Playlist::$table)->insert_get_id(array('id_playlist' => null, 'name_playlist' => $this->_name_playlist, 'date_creation_playlist' => $this->_update)); $user = Session::get('user'); $admin = new adminPlaylist($user->get_id_user_lif(), $play, 'A'); $admin->add(); return $user; }
public function action_add_user_to_playlist() { $user = $this->is_logged(); if ($user === false) { return Redirect::to_action('login'); } else { $username = new User_lif(null, $_POST['username']); if ($username->check_exists($_POST['username'])) { $username->load_from_username(); $ap = new adminPlaylist($username->get_id_user_lif(), $_POST['id_playlist']); if ($ap->check_exists() == null) { $ap->set_code_admin('I'); $ap->add(); if ($ap->check_exists() == 1) { echo 1; } else { echo 0; } } else { echo -1; } } else { echo -2; } } }