public function actionSearch() { $key = $_POST['key']; $search_results = MoviesModel::model()->where(" `en_name` LIKE '%" . $key . "%' OR `ru_name` LIKE '%" . $key . "%' AND type = '2' ")->findAll(); $i = 0; if (empty($key)) { $message = 'Ключ поиска пустой!'; } foreach ($search_results as $item) { $seasons = SeasonModel::model()->where(" `serial_id` = '" . $item->id . "' ")->findAll(); $season_count = 0; $series_count = 0; foreach ($seasons as $season) { $season_count++; $series = SeriesModel::model()->where(" `season_id` = '" . $season->id . "' ")->countAll(); $series_count = $series_count + $series; } //echo 'season_count = '.$season_count.'<br/>'; //echo 'series_count = '.$series_count.'<br/>'; $result[$i]['title'] = $item->ru_name; $result[$i]['poster'] = $item->poster; $result[$i]['seo_url'] = $item->seo_url; $result[$i]['title'] = $item->ru_name; $result[$i]['poster'] = $item->poster; $result[$i]['seo_url'] = $item->seo_url; $result[$i]['rating'] = $item->rating; $result[$i]['type'] = $item->type; $result[$i]['en_name'] = $item->en_name; //$result[$i]['seo_url'] = $item->seo_url; $result[$i]['seasons_count'] = $this->declension($season_count, array("сезон", "сезона", "сезонов")); $result[$i]['series_count'] = $this->declension($series_count, array("серии", "серии", "серий")); $i++; } $this->view("search_result", array("search_result" => $result, "search_key" => $key, "message" => $message), false); }
public static function fields($key) { $fields = array("id" => array("name" => "Id", "required" => false, "type" => "text"), "season_id" => array("name" => "Сезон", "required" => true, "type" => "list", "data" => function () { $data = array(); $seasons = SeasonModel::model()->select("serial_seasons.*, a.en_name")->join(" movies a ON serial_seasons.serial_id = a.id")->findAll(); foreach ($seasons as $season) { $data[$season->id] = $season->en_name . ", сезон " . $season->sort; } return $data; }), "name" => array("name" => "Название серии (Eng)", "required" => true, "type" => "text"), "ru_name" => array("name" => "Название серии (Rus)", "required" => true, "type" => "text"), "en_desc" => array("name" => "Английское описание", "required" => true, "type" => "textarea"), "ru_desc" => array("name" => "Русское описание", "required" => true, "type" => "textarea"), "kz_desc" => array("name" => "Казахское описание", "required" => true, "type" => "textarea"), "url" => array("name" => "Ссылка на видео", "required" => true, "type" => "text"), "en_sub" => array("name" => "Английские субтитры", "required" => true, "type" => "file"), "ru_sub" => array("name" => "Русские субтитры", "required" => true, "type" => "file"), "preview_image" => array("name" => "превью изображение", "required" => true, "type" => "file"), "sort" => array("name" => "Номер серии", "required" => true, "type" => "text"), "timing" => array("name" => "Время (кол-во мин.)", "required" => true, "type" => "text")); return isset($fields[$key]) ? $fields[$key] : false; }
/** * Initialize the addModel class */ public function init() { try { parent::init(); } catch (Exception $e) { throw new Exception('Une erreur est survenue durant le chargement du module: ' . $e->getMessage()); } try { $pdo_options[\PDO::ATTR_ERRMODE] = \PDO::ERRMODE_EXCEPTION; $this->db = new \PDO('mysql:host=' . _HOST_ . ';dbname=' . _DATABASE_, _LOGIN_, _PASSWORD_, $pdo_options); $this->db->exec('SET NAMES utf8'); } catch (Exception $e) { throw new Exception('Connexion à la base de données impossible: ' . $e->getMessage()); } }
public function notificationNewSeries() { $subject = "http://" . $_SERVER['SERVER_NAME'] . " Здравствуйте, у нас есть обновления по вашим подпискам"; $headers = "Content-type: text/html; charset=utf-8 \r\n"; $headers .= "From: support@cpiki.com"; $users = UsersModel::model()->where(" `subscribe_new_series` = '1' ")->findAll(); foreach ($users as $user) { echo $to = $user->email; $body = "<table width='700'><tr><td style='background-color: black;color: white;font-size: 22px;line-height: 40px; color:#fff; padding-left: 20px;'>cpiki</td></tr><tr><td style=' font-size: 20px; line-height: 100px;padding-left: 50px;'>Здравствуйте, у нас есть обновления по вашим подпискам</td></tr><tr><td>"; $body .= "<table>"; $num = 0; $serials = UserSubscribeModel::model()->where("`user_id` = {$user->id} ")->findAll(); foreach ($serials as $serial) { $movie = MoviesModel::model()->where("`id` = {$serial->serial_id} ")->findRow(); $seasons = SeasonModel::model()->where("`serial_id` = '{$movie->id}'")->findAll(); foreach ($seasons as $season) { $series = SeriesModel::model()->where(" `season_id` = {$season->id} ")->findAll(); foreach ($series as $single) { if (SeriesModel::isNewSeries($single->date)) { $sdSrc = $movie->poster; if (!file_exists($_SERVER['DOCUMENT_ROOT'] . $sdSrc)) { $sdSrc = "/assets/images/templates/no_image.png"; } $body .= "<tr><td style=' line-height: 40px;'><img width='150' src='http://" . $_SERVER['SERVER_NAME'] . $sdSrc . "' /></td>"; $body .= "<td style=' vertical-align: top; padding-left: 20px;' ><p style=' line-height: 80px; font-size: 20px;'><a href='http://" . $_SERVER['SERVER_NAME'] . "/serials/" . $movie->seo_url . "' >" . $movie->en_name . "</a></p>"; $body .= "<p style=' font-size: 16px; color: rgb(126, 126, 126);'>" . $single->sort . " серия " . $season->sort . "-го сезона </p></td></tr>"; $num++; } } } } $body .= "</table></td></tr></table>"; echo $body . "<br/>"; if ($num > 0) { mail($to, $subject, $body, $headers); } } }
public function actionSeriesEdit($id) { $model = SeriesModel::model()->where("`id`='" . (int) $id . "'")->findRow(); if (isset($_POST['Series'])) { $model->setAttrs($_POST['Series']); $model->date = date("Y-m-d H:i:s"); if ($_FILES['en_sub']['name']) { $model->en_sub = File::save($_FILES['en_sub'], "assets/subs"); } if ($_FILES['ru_sub']['name']) { $model->ru_sub = File::save($_FILES['ru_sub'], "assets/subs"); } $model->save(); $movieId = SeasonModel::model()->where("`id`='" . (int) $model->season_id . "'")->findRow()->serial_id; $movie_date = MoviesModel::model()->where("`id`='{$movieId}'")->findRow(); $movie_date->date = date("Y-m-d H:i:s"); $movie_date->save(); $this->redirect("/admin/series"); } $this->view("admin/serial/series_form", array("model" => $model), false); }
public function get_seriesSeason($series_id) { $movies = SeriesModel::model()->where("`id`='" . $series_id . " ' ")->findRow(); $season_table = SeasonModel::model()->where("`id`='" . $movies->season_id . "'")->findRow(); return $season_table; }
} ?> )</span></h2> <?php if (empty($movies)) { echo '<h1>Ви еще ничего не добавили в свои закладки.</h1></br>'; } ?> </div> <div class="col-md-12 list_favorites_film"> <ul> <?php foreach ($movies as $movie) { ?> <?php $season_count = SeasonModel::model()->where(" serial_id = " . $movie->id)->countAll(); ?> <li> <div class="img_block" onclick="window.location.href='/serials/<?php echo $movie->seo_url; ?> ';"> <?php if (!file_exists($_SERVER['DOCUMENT_ROOT'] . $movie->poster)) { echo '<img src="/assets/images/templates/no_image.png">'; } else { echo '<img src="' . $movie->poster . '" />'; } ?> </div> <div class="text_block" onclick="window.location.href='/serials/<?php
public function uplodingSeriesSelect() { $movieId = $_POST['movie_id']; $seriesId = $_POST['series_id']; $seasons = SeasonModel::model()->where(" `serial_id` = {$movieId} ")->findAll(); if ($seasons) { ?> <p>Серия :</p><select name="series_id"><?php foreach ($seasons as $season) { $series = SeriesModel::model()->where(" `season_id` = {$season->id} ")->findAll(); foreach ($series as $single) { ?> <option <?php if ($seriesId != 0) { if ($seriesId == $single->id) { ?> selected="selected"<?php } } ?> value="<?php echo $single->id; ?> "><?php echo $single->name; ?> </option><?php } } ?> </select><?php } }
public function actionPikibook() { $where = ""; $movie = MoviesModel::model()->where("`id` = '{$_GET['movie']}'")->findRow(); if (isset($_GET['movie']) && $_GET['movie'] != "0" && (!isset($_GET['season']) || $_GET['season'] == "0")) { $where = "`movie_id` = '{$_GET['movie']}'"; if ($movie->type == 2) { $seasons = SeasonModel::model()->where("`serial_id` = '{$_GET['movie']}'")->findAll(); } } elseif (isset($_GET['movie']) && $_GET['movie'] != "0" && $_GET['season'] != "0" && isset($_GET['season'])) { $where = "`movie_id` = '{$_GET['movie']}' AND `season_id` = '{$_GET['season']}'"; if ($movie->type == 2) { $seasons = SeasonModel::model()->where("`serial_id` = '{$_GET['movie']}'")->findAll(); } } $words = MovieWordModel::model()->where($where)->order(" id asc ")->findAll(); $movies = MoviesModel::model()->order(" ru_name asc ")->findAll(); $this->view("admin/pikibook/pikibook_list", array("words" => $words, "movies" => $movies, "seasons" => $seasons, "movie_type" => $movie->type), false); }
"> <td><?php echo $season->id; ?> </td> <td><?php echo $season->en_name; ?> </td> <td><?php echo $season->sort; ?> </td> <td> <?php $season = SeasonModel::model()->where("`id` = '{$season->id}'")->findRow(); ?> <a href="/admin/pikibook/?movie=<?php echo $season->serial_id; ?> &season=<?php echo $season->id; ?> ">PikiBook</a> </td> <td class="button-column"> <a class="update" title="Редактировать" rel="tooltip" href="/admin/seasons/edit/<?php echo $season->id; ?> "><i class="icon-pencil"></i></a><a class="delete" title="Удалить" rel="tooltip" href="/admin/seasons/delete/<?php echo $season->id;
public function actionAllMovies() { if (isset($_POST['category']) && $_POST['category'] != "0") { $query = " `cat_id` = '" . $_POST['category'] . "'"; } if (isset($_POST['difficulty']) && $_POST['difficulty'] != "0") { if (!empty($query)) { $query .= " AND "; } $query .= " `in_roles` = '" . $_POST['difficulty'] . "' "; } if (empty($query)) { $moovies_list = MoviesModel::model()->where(" `type` = '2' ")->findAll(); } else { $query .= " AND `type` = '2' "; $moovies_list = MoviesModel::model()->where($query)->findAll(); } $i = 0; //echo 'query = '.$query; foreach ($moovies_list as $item) { $seasons = SeasonModel::model()->where(" `serial_id` = '" . $item->id . "' ")->findAll(); $season_count = 0; $series_count = 0; foreach ($seasons as $season) { $season_count++; $series = SeriesModel::model()->where(" `season_id` = '" . $season->id . "' ")->countAll(); $series_count = $series_count + $series; } //echo 'season_count = '.$season_count.'<br/>'; //echo 'series_count = '.$series_count.'<br/>'; $result[$i]['id'] = $item->id; $result[$i]['title'] = $item->ru_name; $result[$i]['poster'] = $item->poster; $result[$i]['seo_url'] = $item->seo_url; $result[$i]['rating'] = $item->rating; $result[$i]['type'] = $item->type; $result[$i]['en_name'] = $item->en_name; //$result[$i]['seo_url'] = $item->seo_url; $result[$i]['seasons_count'] = $this->declension($season_count, array("сезон", "сезона", "сезонов")); $result[$i]['series_count'] = $this->declension($series_count, array("серии", "серии", "серий")); $i++; } $categories = CatsModel::model()->findAll(); $this->view("movies/moovies_list", array("moovies" => $result, "categories" => $categories, "chosed_category" => $_POST['category'], "chossed_difficulty" => $_POST['difficulty']), false); }