public function generateAddActions($arrData, $id, Watchlist $objWatchlist) { global $objPage; if ($objPage === null) { return; } if (\Validator::isUuid($id)) { $objFile = \FilesModel::findByUuid($id); } else { $objFile = \FilesModel::findBy('path', $id); } $objItem = new WatchlistItemModel(); $objItem->pid = Watchlist::getInstance()->getId(); $objItem->uuid = $objFile->uuid; $objItem->pageID = $objPage->id; $objItem->cid = $arrData['id']; $objItem->type = $arrData['type']; $objT = new \FrontendTemplate('watchlist_add_actions'); $objT->addHref = ampersand(\Controller::generateFrontendUrl($objPage->row()) . '?act=' . WATCHLIST_ACT_ADD . '&cid=' . $objItem->cid . '&type=' . $objItem->type . '&id=' . $strUuid . '&title=' . urlencode($objItem->getTitle())); $objT->addTitle = $GLOBALS['TL_LANG']['WATCHLIST']['addTitle']; $objT->addLink = $GLOBALS['TL_LANG']['WATCHLIST']['addLink']; $objT->active = $objWatchlist->isInList($strUuid); $objT->id = $strUuid; return $objT->parse(); }
public function addToWatchList($art_id) { $input = new Watchlist(); $input->art_id = $art_id; $input->user_id = Auth::user()->id; $input->save(); return Redirect::back(); }
public function getWatchedRecords() { if ([] == $this->watchedRecords) { $this->watchedRecords = Watchlist::query()->leftJoin('Episodes', 'Episodes.id = Watchlist.currentEpisode_id')->where('Watchlist.movie_id = :movie:', ['movie' => $this->id])->andWhere('Watchlist.status = "done"')->columns(['Watchlist.*', 'Episodes.*'])->execute(); } return $this->watchedRecords; }
protected function runAction() { global $objPage; switch (\Input::get('act')) { case WATCHLIST_ACT_DELETE: Watchlist::getInstance()->deleteItem(\Input::get('id')); break; case WATCHLIST_ACT_ADD: $objItem = new WatchlistItemModel(); $objItem->pid = Watchlist::getInstance()->getId(); $objItem->uuid = \Input::get('id'); $objItem->pageID = $objPage->id; $objItem->cid = \Input::get('cid'); $objItem->type = \Input::get('type'); $objItem->title = \Input::get('title'); $objItem->tstamp = time(); Watchlist::getInstance()->addItem($objItem); break; case WATCHLIST_ACT_DELETE_ALL: Watchlist::getInstance()->deleteAll(); break; case WATCHLIST_ACT_DOWNLOAD_ALL: Watchlist::getInstance()->downloadAll(); break; } // if ajax -> return the content of the watchlist if (\Environment::get('isAjaxRequest')) { die(json_encode(array('action' => \Input::get('act'), 'watchlist' => Watchlist::getInstance()->generate(), 'notification' => Watchlist::getInstance()->generateNotifications(), 'count' => Watchlist::getInstance()->count(), 'cssClass' => Watchlist::getInstance()->count() > 0 ? 'not-empty' : 'empty'))); } // no js support -- redirect and remove GET parameters \Controller::redirect(\Controller::generateFrontendUrl($objPage->row())); }
public function getMyWatchListMovies() { if ([] == $this->watchListMovies) { $auth = \Phalcon\Di::getDefault()->get('auth'); $this->watchListMovies = Watchlist::query()->leftJoin('Movies', 'Movies.id = Watchlist.movie_id')->leftJoin('Episodes', 'Episodes.id = Watchlist.currentEpisode_id')->where('Watchlist.user_id = :user:'******'user' => $auth->id])->andWhere('Watchlist.status != "done" ')->orderBy('Watchlist.updated_at DESC')->columns(['Watchlist.*', 'Movies.*', 'Episodes.*'])->execute(); } return $this->watchListMovies; }
?> </head> <body> <section id="head-bar"> <?php include_once 'navbar.php'; ?> </section> <div class="container"> <h1>My Watchlist</h1> <?php if (isset($_SESSION['authenticated_user'])) { require_once 'watchlist.php'; require_once 'mediapost.php'; $watchlist = new Watchlist(); $post = new MediaPost(); if ($_SERVER['REQUEST_METHOD'] === 'POST') { if (!empty($_POST['title'])) { $media_id = $post->getMediaIdByTitle($_POST['title']); $watchlist->storeListMedia($_SESSION['authenticated_user'], $media_id); } } else { if ($_SERVER['REQUEST_METHOD'] === 'GET') { if (!empty($_GET['remove_media'])) { $media_id = $_GET['remove_media']; $watchlist->removeMediaFromWatchlist($_SESSION['authenticated_user'], $media_id); } } } $list_items = $watchlist->getWatchlistForUser($_SESSION['authenticated_user']);
public function testUrl() { $this->assertSame(Watchlist::classUrl(), '/watchlists'); }
function displayWatchlist($feed, $user) { global $wgOut, $IP; require_once "{$IP}/includes/specials/SpecialWatchlist.php"; $watchlist = new Watchlist(); $feed->outHeader(); $watchlist->prepare(); while ($obj = $watchlist->getItem()) { $title = Title::makeTitle($obj->rc_namespace, $obj->rc_title); $talkpage = $title->getTalkPage(); $item = new FeedItem($title->getFullText(), $this->rcFormatDiff($obj), $title->getFullURL(), $obj->rc_timestamp, $obj->rc_user_text, $talkpage->getFullURL()); $feed->outItem($item); } $watchlist->cleanup(); $feed->outFooter(); }
public function WatchCount($id) { return Watchlist::where('uw_fl_id', $id)->count(); }
public function updateWatchListAction($movie, $episode, Watchlist $watchList) { // dd($watchList); $watchList->currentEpisode_id = $episode; $watchList->status = 'doing'; $watchList->save(); return $this->redirectByRoute(['for' => 'movies.showEpisode', 'movie' => $movie, 'episode' => $episode]); }
?> </head> <body> <section id="head-bar"> <?php include_once 'navbar.php'; ?> </section> <div class="container"> <?php if (isset($_SESSION['authenticated_user'])) { require_once 'watchlist.php'; require_once 'mediapost.php'; require_once 'user.php'; $watchlist = new Watchlist(); $post = new MediaPost(); $user = new User(); if ($_SERVER['REQUEST_METHOD'] === 'POST') { if (!empty($_POST['friend_email'])) { $new_friend_id = $user->getIdByEmail($_POST['friend_email']); if (!$new_friend_id) { echo "<h2 style='color: white; background-color: #d61616;'>User not found with email address " . $_POST['friend_email'] . ". Try again.</h2>"; } else { $date_created = date("Y-m-d H:i:s"); $watchlist->addNewBoy($_SESSION['authenticated_user'], $new_friend_id, $date_created); } } } $this_user = $_SESSION['authenticated_user']; $friends = $watchlist->getMyBoys($this_user);