public function actionIndex($seo) { $cat = CatsModel::model()->where("`seo_url`='{$seo}'")->findRow(); if (!$cat) { Error::httpError(404); } $movies = MoviesModel::model()->where("`cat_id`='{$cat->id}'")->findAll(); $this->view("category/list", array("movies" => $movies, "cat" => $cat), false); }
echo Lang::get("search_on_genres"); ?> </legend> <div style="padding:3px"> <div><select style="width:95%;height:200px;" name="cat" size="13" multiple="multiple"><option selected="selected" value="0"><?php echo Lang::get("search_in_all_genres"); ?> </option> <?php foreach (CatsModel::model()->order("name ASC")->findAll() as $cat) { ?> <option style="color: black" value="<?php echo $cat->id; ?> "><?php echo CatsModel::getName($cat); ?> </option> <?php } ?> </select></div> </div> </fieldset> </td> </tr> <tr> <td class="search" colspan="2"> <div style="margin-top:6px">
<input rows="6" cols="50" name="Movie[en_name]" id="en_name" type="text" /> </div> <div class="row" style="border-top: 1px dashed #ccc;"> <label for="type" class="required">Тип <span class="required">*</span></label> <select name="Movie[type]" id="type"> <option value="1">Фильм</option> <option value="2">Сериал</option> <option value="3">Ролик</option> </select> </div> <div class="row"> <label for="cat" class="required">Категория <span class="required">*</span></label> <?php echo Form::makeList("Movie[cat_id]", "cat_id", array("data" => function () { $result = array(); $data = CatsModel::model()->findAll(); foreach ($data as $cat) { $result[$cat->id] = $cat->ru_name; } return $result; }), false); ?> </div> <div class="row movie"> <input type="checkbox" name="Movie[abonement]" id="checkbox" /> <label for="checkbox">Только для абонементов</label> </div> <div style="clear:both;"></div> <div class="row" style="width:99.5%; border-top: 1px dashed #ccc;">
<div> <?php if ($movie->producer) { ?> <?php echo $movie->producer; ?> <?php } ?> </div> </div> <div class="content-page-sidebar-block"> Жанр <div><?php echo CatsModel::getName(CatsModel::model()->where("`id`='{$movie->cat_id}'")->findRow()); ?> </div> </div> </div> <div class="content-page-wrap content-page-text"> <h1>О фильме</h1> <p><?php echo MoviesModel::getDesc($movie); ?> </p> </div> </div> <style> .bx-wrapper .bx-controls-direction a {
private function getCats() { $sort = isset($_GET['sort']) ? $_GET['sort'] : 'id'; $type = isset($_GET['type']) ? $_GET['type'] : 'desc'; return CatsModel::model()->order("{$sort} {$type}")->findAll(); }
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); }