public function actionAdmin() { $model = new Film('search'); $model->unsetAttributes(); if (isset($_GET['Film'])) { $model->setAttributes($_GET['Film']); } $this->render('admin', array('model' => $model)); }
function process() { $film = new Film($_POST['item']); $film->save($_POST['film']); if (!empty($GLOBALS['AA_ERROR'])) { return; } $this->ok_out['msg'] = $GLOBALS['strOKUpdate'] . ": " . $GLOBALS['strFilm'] . " " . $_POST['film'] . " (xSerie=" . $_POST['item'] . ")"; }
function getMovieById($id) { $responseMovie = $this->dbManager->getMovieInfo($id); $movie = $responseMovie->fetch(); $film = new Film(); $film->setFilm($movie); $result = array('id' => $film->id, 'title_vo' => $film->title_vo, 'title_vf' => $film->title_vf, 'title_other' => $film->title_other, 'year' => $film->year_orig, 'year_prod_begin' => $film->year_prod_begin, 'year_prod_end' => $film->year_prod_end, 'prod_country' => $film->prod_country, 'synopsis' => $film->synopsis, 'note' => $film->note, 'video_edition' => $film->video_edition, 'biblio' => $film->biblio, 'duration' => $film->tv_duration . " minutes", 'measurement' => $film->measurement, 'color' => $film->color, 'sound' => $film->sound, 'technical_process' => $film->technical_process, 'color_system' => $film->color_system, 'sound_system' => $film->sound_system); return $result; }
/** * Insert a new film * * @param Film $film * @return type */ public static function insert(Film $film) { $insertFilm = Db::pdoConnect()->prepare("INSERT INTO film SET film_name=:name, film_url=:url"); $insertFilm->bindValue(':name', $film->getName(), PDO::PARAM_STR); $insertFilm->bindValue(':url', $film->getUrl(), PDO::PARAM_STR); $insertFilm->execute(); $lastId = Db::pdoConnect()->lastInsertId(); $film->setId($lastId); return $film; }
public static function supprimerCategorie($nom) { $nomCat = Categorie::getDefaultCategorie(); require_once "../Modele/Film.class.php"; $films = Film::getListeFilms(); foreach ($films as $film) { if ($film['categorie'] == $nom) { Film::setDefaultCategorie($nomCat['nom'], $film['id']); } } SingletonRequete::getBase()->requeteParam("DELETE FROM Category WHERE category_name=?", array($nom)); }
public function parseText() { $file = $this->file['file']['tmp_name']; $text = file_get_contents($file); $films = explode("\n\n", $text); for ($i = 0; $i < count($films); $i++) { if ($films[$i] == "\n" || $films[$i] == '') { continue; } //make a film $filmList[$i] = new Film(Film::pasreFilm($films[$i])); } return $filmList; }
static function deleteByClefunique($clefunique) { $query = "select distinct idfilm as idfilm from torrentfilm "; $query .= "where clefunique=" . \core\Mysqli::real_escape_string_html($clefunique); \core\Mysqli::query($query); $tfs = \core\Mysqli::getObjectAndClose(true); $query = "delete from torrentfilm "; $query .= "where clefunique=" . \core\Mysqli::real_escape_string_html($clefunique); \core\Mysqli::query($query); $res = \core\Mysqli::nombreDeLigneAffecte() > 1; \core\Mysqli::close(); foreach ($tfs as $k => $tf) { $query = "select count(*) as cpt from torrentfilm "; $query .= "where idfilm=" . \core\Mysqli::real_escape_string_html($tf->idfilm); \core\Mysqli::query($query); $re = \core\Mysqli::getObjectAndClose(); if ($re->cpt === "0") { $res &= Film::delete($tf->idfilm); } } return $res; }
static function ajouteFilm($titre, $titreoriginal, $infos, $urlposter, $urlbackdrop, $anneeprod, $acteurs, $realisateurs, $idallocine = null, $idthemoviedb = null) { if ($f = Film::checkIdallocine($idallocine)) { return $f; } else { $film = new Film(); $film->titre = $titre; $film->titreoriginal = $titreoriginal; $film->infos = $infos; $film->idallocine = $idallocine; $film->idthemoviedb = $idthemoviedb; $film->urlbackdrop = $urlbackdrop; $film->urlposter = $urlposter; $film->acteurs = $acteurs; $film->anneeprod = $anneeprod; $film->realisateurs = $realisateurs; do { $film->id = \model\simple\String::random(10); } while (!$film->insert()); return $film; } }
public function indexAction() { $userInfo = $this->session->get('userInfo'); //验证会员是否已登录 if (empty($userInfo)) { $url = $this->url->get('user/login'); header("Location:{$url}"); exit; } $uid = $userInfo['id']; //分页 $page = $this->request->get('page') ? $this->request->get('page') : 1; $filter = array("uid={$uid}", 'order' => 'ctime desc'); //总数 $count = \Order::count($filter); $limit = 5; $filter['offset'] = ($page - 1) * $limit; $filter['limit'] = $limit; //查询订单信息 $userOrder = \Order::find($filter) ? \Order::find($filter)->toArray() : ''; //查询订单影片信息 foreach ($userOrder as &$val) { $val['film'] = Film::findFirst('id=' . $val['film_id'])->toArray(); $val['film_heat'] = FilmHeat::findFirst('film_id=' . $val['film_id'])->toArray(); $schedule = FilmSchedule::findFirst('id=' . $val['schedule_id'])->toArray(); if ($schedule) { $time = strtotime($schedule['starttime']); $week_arr = array('日', '一', '二', '三', '四', '五', '六'); $val['film_schedule'] = date('n', $time) . '月' . date('j', $time) . '日 周' . $week_arr[date('w', $time)] . ' ' . date('H:i', $time); } else { $val['film_schedule'] = ''; } } $page_html = \ToolStr::GetPage($count, $limit); $this->view->setVar('page_html', $page_html); $this->view->setVar('userInfo', $userInfo); $this->view->setVar('user_order', $userOrder); $this->view->setVar('title', '会员中心'); }
echo $form->textField($model, 'last_name', array('maxlength' => 45)); ?> <?php echo $form->error($model, 'last_name'); ?> </div><!-- row --> <div class="row"> <?php echo $form->labelEx($model, 'last_update'); ?> <?php echo $form->textField($model, 'last_update'); ?> <?php echo $form->error($model, 'last_update'); ?> </div><!-- row --> <label><?php echo GxHtml::encode($model->getRelationLabel('films')); ?> </label> <?php echo $form->checkBoxList($model, 'films', GxHtml::encodeEx(GxHtml::listDataEx(Film::model()->findAllAttributes(null, true)), false, true)); ?> <?php echo GxHtml::submitButton('Save'); $this->endWidget(); ?> </div><!-- form -->
<?php $this->breadcrumbs[] = Yii::t('crud', 'Inventories'); Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\$('.search-form').toggle();\nreturn false;\n});\n\$('.search-form form').submit(function(){\n\$.fn.yiiGridView.update('inventory-grid', {\ndata: \$(this).serialize()\n});\nreturn false;\n});\n"); ?> <?php $this->widget("TbBreadcrumbs", array("links" => $this->breadcrumbs)); ?> <h1> <?php echo Yii::t('crud', 'Inventories'); ?> <small><?php echo Yii::t('crud', 'Manage'); ?> </small> </h1> <?php $this->renderPartial("_toolbar", array("model" => $model)); $this->widget('TbGridView', array('id' => 'inventory-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'pager' => array('class' => 'TbPager', 'displayFirstAndLast' => true), 'columns' => array(array('class' => 'editable.EditableColumn', 'name' => 'inventory_id', 'editable' => array('url' => $this->createUrl('/sakila/hybrid/inventory/editableSaver'))), array('name' => 'film_id', 'value' => 'CHtml::value($data,\'film.itemLabel\')', 'filter' => CHtml::listData(Film::model()->findAll(array('limit' => 1000)), 'film_id', 'itemLabel')), array('name' => 'store_id', 'value' => 'CHtml::value($data,\'store.itemLabel\')', 'filter' => CHtml::listData(Store::model()->findAll(array('limit' => 1000)), 'store_id', 'itemLabel')), array('class' => 'editable.EditableColumn', 'name' => 'last_update', 'editable' => array('url' => $this->createUrl('/sakila/hybrid/inventory/editableSaver'))), array('class' => 'TbButtonColumn', 'viewButtonUrl' => "Yii::app()->controller->createUrl('view', array('inventory_id' => \$data->inventory_id))", 'updateButtonUrl' => "Yii::app()->controller->createUrl('update', array('inventory_id' => \$data->inventory_id))", 'deleteButtonUrl' => "Yii::app()->controller->createUrl('delete', array('inventory_id' => \$data->inventory_id))"))));
<?php $this->breadcrumbs[] = Yii::t('crud', 'Inventories'); Yii::app()->clientScript->registerScript('search', "\n \$('.search-button').click(function(){\n \$('.search-form').toggle();\n return false;\n });\n \$('.search-form form').submit(function(){\n \$.fn.yiiGridView.update(\n 'inventory-grid',\n {data: \$(this).serialize()}\n );\n return false;\n });\n "); ?> <?php $this->widget("TbBreadcrumbs", array("links" => $this->breadcrumbs)); ?> <h1> <?php echo Yii::t('crud', 'Inventories'); ?> <small><?php echo Yii::t('crud', 'Manage'); ?> </small> </h1> <?php $this->renderPartial("_toolbar", array("model" => $model)); ?> <?php $this->widget('TbGridView', array('id' => 'inventory-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'template' => '{pager}{items}{pager}{summary}', 'pager' => array('class' => 'TbPager', 'displayFirstAndLast' => true), 'columns' => array(array('class' => 'CLinkColumn', 'header' => '', 'labelExpression' => '$data->itemLabel', 'urlExpression' => 'Yii::app()->controller->createUrl("view", array("inventory_id" => $data["inventory_id"]))'), array('class' => 'editable.EditableColumn', 'name' => 'inventory_id', 'editable' => array('url' => $this->createUrl('/sakila/slim/inventory/editableSaver'))), array('name' => 'film_id', 'value' => 'CHtml::value($data,\'film.itemLabel\')', 'filter' => CHtml::listData(Film::model()->findAll(array('limit' => 1000)), 'film_id', 'itemLabel')), array('name' => 'store_id', 'value' => 'CHtml::value($data,\'store.itemLabel\')', 'filter' => CHtml::listData(Store::model()->findAll(array('limit' => 1000)), 'store_id', 'itemLabel')), array('class' => 'editable.EditableColumn', 'name' => 'last_update', 'editable' => array('url' => $this->createUrl('/sakila/slim/inventory/editableSaver'))), array('class' => 'TbButtonColumn', 'viewButtonUrl' => 'Yii::app()->controller->createUrl("view", array("inventory_id" => $data->inventory_id))', 'updateButtonUrl' => 'Yii::app()->controller->createUrl("update", array("inventory_id" => $data->inventory_id))', 'deleteButtonUrl' => 'Yii::app()->controller->createUrl("delete", array("inventory_id" => $data->inventory_id))'))));
/** * Retourne la liste de tous les films, avec la note probable pour un membre * @return array : liste des films avec la note probable du membre */ public function listeRecommandations($m) { // Création d'un tableau associant à chaque genre son coefficient pour le membre $listeStats = $this->listeStatsGenres($m); foreach ($listeStats as $s) { $genres[$s["genre"]] = $s["coefficient"]; } // Tableau à retourner : tableau avec les notes des films $i = 0; foreach ($this->listeFilms as $film) { $res[$i]["id"] = $film->getID(); $res[$i]["titre"] = $film->getTitre(); $moyenne = $film->getAverage($this); // moyenne du film $genresFilm = $film->getGenres(); // liste des genres du film $noteProbable = 0; for ($j = 0; $j < count($genresFilm); $j++) { // pour chaque genre du film, on multiplie la moyenne du film par le coeff du genre, et on l'ajoute à la note probable du film $noteProbable += $moyenne * $genres[$genresFilm[$j]->name]; } $res[$i]["noteProbable"] = $noteProbable / count($genresFilm); // on divise par le nombre de genres pour obtenir la moyenne des moyennes (oui, monsieur!) $i++; } // on supprime les films déjà vus par le membre foreach ($res as &$a) { $f = Film::createFromID($a["id"], $this); $noteDonnee = $f->getNote($m->getID()); if (!is_null($noteDonnee)) { $a["noteProbable"] = -1; } } // avant de retourner le tableau, on le trie pour afficher les meilleurs notes devant uasort($res, function ($a, $b) { return $b["noteProbable"] - $a["noteProbable"]; }); // puis on divise les notes par 100 pour faire un truc à peu près sur 10 foreach ($res as &$a) { $a["noteProbable"] /= 100; } return $res; }
/** * @return \yii\db\ActiveQuery */ public function getFilm() { return $this->hasOne(Film::className(), ['film_id' => 'film_id']); }
<?php //This script will update all records in the movieinfo table require_once dirname(__FILE__) . "/../../../bin/config.php"; use newznab\db\Settings; $pdo = new Settings(); $c = new \ColorCLI(); $movie = new \Film(['Echo' => true, 'Settings' => $pdo]); $movies = $pdo->queryDirect("SELECT imdbid FROM movieinfo WHERE tmdbid IS NULL ORDER BY id ASC"); if ($movies instanceof \Traversable) { echo $pdo->log->header("Updating movie info for " . number_format($movies->rowCount()) . " movies."); foreach ($movies as $mov) { $starttime = microtime(true); $mov = $movie->updateMovieInfo($mov['imdbid']); // tmdb limits are 30 per 10 sec, not certain for imdb $diff = floor((microtime(true) - $starttime) * 1000000); if (333333 - $diff > 0) { echo "sleeping\n"; usleep(333333 - $diff); } } echo "\n"; }
/** * @param Film $film * @return array */ public function search(Film $film) { $query = $this->createQueryBuilder('a'); $query->where('a.title LIKE :title')->setParameter('title', '%' . $film->getTitle() . '%')->orderBy('a.id', 'DESC'); return $query->getQuery()->getResult(); }
/** * Méthode de comparaison. * Compare par moyenne. * @param $f1 : le premier film à comparer * @param $f2 : le deuxième film à comparer * @return int : le résultat de la comparaison (-1, 0, 1) */ public static function compareMoyenne(self $f1, self $f2) { $m1 = $f1->getAverage($gestionnaire); if (!is_numeric($m1)) { $m1 = -1; } $m2 = $f2->getAverage($gestionnaire); if (!is_numeric($m2)) { $m2 = -1; } if ($m2 > $m1) { return -1; } else { if ($m1 > $m2) { return 1; } else { return 0; } } }
static function getPosterSetHeight($id, $height) { $myimage = new \model\simple\MyImage(Film::getPoster($id)); return $myimage->getImageHeightFixed($height); }
/** * @return \yii\db\ActiveQuery */ public function getFilms() { return $this->hasMany(Film::className(), ['film_id' => 'film_id'])->viaTable('film_category', ['category_id' => 'category_id']); }
<?php //run this once per day require_once "config.php"; $m = new Film(['Echo' => true]); $m->updateUpcoming();
<?php $this->breadcrumbs = array($model->label(2) => array('index'), 'Manage'); $this->menu = array(array('label' => 'List' . ' ' . $model->label(2), 'url' => array('index')), array('label' => 'Create' . ' ' . $model->label(), 'url' => array('create'))); Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$.fn.yiiGridView.update('inventory-grid', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n"); ?> <h1><?php echo 'Manage' . ' ' . GxHtml::encode($model->label(2)); ?> </h1> <p> You may optionally enter a comparison operator (<, <=, >, >=, <> or =) at the beginning of each of your search values to specify how the comparison should be done. </p> <?php echo GxHtml::link('Advanced Search', '#', array('class' => 'search-button')); ?> <div class="search-form"> <?php $this->renderPartial('_search', array('model' => $model)); ?> </div><!-- search-form --> <?php $this->widget('zii.widgets.grid.CGridView', array('id' => 'inventory-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array('inventory_id', array('name' => 'film_id', 'value' => 'GxHtml::valueEx($data->film)', 'filter' => GxHtml::listDataEx(Film::model()->findAllAttributes(null, true))), array('name' => 'store_id', 'value' => 'GxHtml::valueEx($data->store)', 'filter' => GxHtml::listDataEx(Store::model()->findAllAttributes(null, true))), 'last_update', array('class' => 'CButtonColumn'))));
if (!empty($r['imgdata'])) { $seriesimg[] = $r['imgdata']; $seriesid[] = $r['id']; } } $rage = array('releasetitle' => array_shift($seriesnames), 'description' => array_shift($seriesdescription), 'country' => array_shift($seriescountry), 'genre' => array_shift($seriesgenre), 'imgdata' => array_shift($seriesimg), 'id' => array_shift($seriesid)); } } $episodeArray = ''; if ($data['episodeinfoid'] > 0) { $episode = new Episode(); $episodeArray = $episode->getEpisodeInfoByID($data['episodeinfoid']); } $mov = ''; if ($data['imdbid'] != '' && $data['imdbid'] != 00) { $movie = new Film(); $mov = $movie->getMovieInfo($data['imdbid']); $trakt = new TraktTv(); $traktSummary = $trakt->movieSummary('tt' . $data['imdbid'], 'full'); if ($traktSummary !== false && isset($traktSummary['trailer']) && $traktSummary['trailer'] !== '' && preg_match('/[\\/?]v[\\/\\=](\\w+)$/i', $traktSummary['trailer'], $youtubeM)) { $mov['trailer'] = '<embed width="480" height="345" src="' . 'https://www.youtube.com/v/' . $youtubeM[1] . '" type="application/x-shockwave-flash"></embed>'; } else { $mov['trailer'] = \newznab\utility\Utility::imdb_trailers($data['imdbid']); } if ($mov && isset($mov['title'])) { $mov['title'] = str_replace(array('/', '\\'), '', $mov['title']); $mov['actors'] = $movie->makeFieldLinks($mov, 'actors'); $mov['genre'] = $movie->makeFieldLinks($mov, 'genre'); $mov['director'] = $movie->makeFieldLinks($mov, 'director'); } else { if ($traktSummary !== false) {
$path = "../"; require_once $path . "includes/session.php"; require_once $path . "Modele/Film.class.php"; require_once $path . "Modele/Categorie.class.php"; ?> <!doctype html> <html> <?php require_once $path . "includes/header.php"; ?> <body> <?php require_once $path . "includes/navbar.php"; if (isset($_GET['id'])) { $film = Film::getFilm($_GET['id']); } else { header("Location: " . $path . "index.php"); } ?> <div class="container"> <div class="jumbotron"> <h2>Modifier un film</h1> <form class="form-horizontal" role="form" enctype="multipart/form-data" action="<?php echo $path . "Controleur/films_controleur.php"; ?> " method="post"> <div class="form-group"> <label class="control-label col-sm-3" for="titre">Titre:</label> <div class="col-sm-7">
// Genres préférés (top 10) $nbMini = Gestionnaire::nbMiniMoyenneGenre; $contenu .= <<<HTML <div> <p class="titre">Genres préférés (mini {$nbMini} notes)</p> <ul> HTML; $tableauGenres = $g->listeStatsGenres($m); uasort($tableauGenres, function ($a, $b) { return $a["moyenne"] < $b["moyenne"]; }); $place = 1; foreach ($tableauGenres as $genre) { if ($place <= 10) { $moy = Film::formateNote($genre["moyenne"]); $contenu .= <<<HTML <li>{$place}/ {$genre["genre"]} ({$moy})</li> HTML; $place++; } else { break; } } $contenu .= <<<HTML </ul> </div> HTML; // Genres les + vus (top 10)
$path = '../'; require_once $path . 'includes/session.php'; require_once $path . 'Modele/Film.class.php'; require_once $path . 'includes/escape.php'; require_once $path . "Modele/Etoile.class.php"; ?> <!doctype html> <html> <?php require_once $path . 'includes/header.php'; ?> <body> <?php require_once $path . 'includes/navbar.php'; $movie = Film::getFilm($_GET['id']); ?> <div class='container'> <div class='jumbotron'> <div class='row'> <div class='col-md-6'> <img class='img-thumbnail' src='<?php echo escape($path . $movie['picture']); ?> ' /> </div> <div class='col-md-6'> <h1><?php echo escape($movie['title']); ?>
?> <p class="note"> Fields with <span class="required">*</span> are required. </p> <?php echo $form->errorSummary($model); ?> <div class="row"> <?php echo $form->labelEx($model, 'film_id'); ?> <?php echo $form->dropDownList($model, 'film_id', GxHtml::listDataEx(Film::model()->findAllAttributes(null, true))); ?> <?php echo $form->error($model, 'film_id'); ?> </div><!-- row --> <div class="row"> <?php echo $form->labelEx($model, 'store_id'); ?> <?php echo $form->dropDownList($model, 'store_id', GxHtml::listDataEx(Store::model()->findAllAttributes(null, true))); ?> <?php echo $form->error($model, 'store_id'); ?>
} } } $imdbids = array(); if (isset($obj) && count($obj) > 0) { foreach ($obj as $movie) { if (isset($movie['title']) && isset($movie['imdb_id'])) { $imdbids[] = str_replace('tt', '', $movie['imdb_id']); } } if (count($imdbids) == 0) { print "<h3 style='padding-top:30px;'>No results found</h3>"; } else { $ourmovieimdbs = array(); if (count($imdbids) > 0) { $m = new Film(['Settings' => $page->settings, 'TMDb' => $tmdb]); $allmovies = $m->getMovieInfoMultiImdb($imdbids); foreach ($allmovies as $ourmovie) { if ($ourmovie['relimdb'] != '') { $ourmovieimdbs[$ourmovie['imdbid']] = $ourmovie['imdbid']; } } } $userimdbs = array(); $usermovies = $um->getMovies($page->users->currentUserId()); foreach ($usermovies as $umovie) { $userimdbs[$umovie['imdbid']] = $umovie['imdbid']; } $page->smarty->assign('data', $obj); $page->smarty->assign('ourmovies', $ourmovieimdbs); $page->smarty->assign('userimdbs', $userimdbs);
<input type="radio" onclick="<?php echo "window.location.href='index.php?filtres=" . $categorie['nom'] . "'"; ?> "> <?php echo " " . $categorie['nom'] . " "; } } ?> </div> <?php if (isset($_GET['filtres'])) { $liste = Film::getListeFilmsCategorie($_GET['filtres']); } else { $liste = Film::getListeFilms(); } foreach ($liste as $film) { ?> <a <?php echo "href=Vue/film_vue.php?id=" . $film['id']; ?> ><h1><?php echo $film['title']; ?> </h1></a> <div class="row"> <div class="col-md-2"> <img class="img-thumbnail" src="<?php echo $path . $film['picture']; ?>
<?php require_once 'autoload.inc.php'; session_start(); $film = $_GET["film"]; $membre = $_GET["membre"]; if ($membre == $_SESSION["membre"]->getID()) { $gest = new Gestionnaire(); $film = $gest->getFilm($film); if ($film->supprimeNote($membre)) { // on supprime la note // mais on ajoute le message que si elle a été vraiment supprimée // (si ce n'est pas le cas, c'est qu'elle n'existait pas) $ancienneNote = $film->getNote($membre); $classNote = Film::getClass($ancienneNote) . "_comm"; $message = "J'ai supprimé ma note ! Elle était de <span class=\"{$classNote}\">{$ancienneNote}</span>"; $film->ajoutCommentaire($membre, $message); } }
public function loadModel($id) { $model = Film::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, Yii::t('crud', 'The requested page does not exist.')); } return $model; }