コード例 #1
0
 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);
 }
コード例 #2
0
 public function actionCatalog($symbol)
 {
     $symbol = urldecode($symbol);
     $symbol = str_replace(array("'", '"'), array(""), $symbol);
     $movies = MoviesModel::model()->where("`en_name` LIKE '{$symbol}%' OR `ru_name` LIKE '{$symbol}%'")->findAll();
     $this->view("category/catalog", array("movies" => $movies, "symbol" => $symbol), false);
 }
コード例 #3
0
ファイル: SeasonModel.php プロジェクト: bionicle12/testsite
 public static function fields($key)
 {
     $fields = array("id" => array("name" => "Id", "required" => false, "type" => "text"), "serial_id" => array("name" => "Сериал", "required" => true, "type" => "list", "data" => function () {
         $data = array();
         $serials = MoviesModel::model()->serials()->findAll();
         foreach ($serials as $serial) {
             $data[$serial->id] = $serial->en_name;
         }
         return $data;
     }), "sort" => array("name" => "Номер сезона", "required" => true, "type" => "text"));
     return isset($fields[$key]) ? $fields[$key] : false;
 }
コード例 #4
0
 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);
         }
     }
 }
コード例 #5
0
ファイル: MoviesModel.php プロジェクト: bionicle12/testsite
 public function perC($cur_time, $series_id)
 {
     $ser_timing = 0;
     $percents = 0;
     $serial_name = SeriesModel::model()->where("`id`='" . $series_id . " ' ")->findRow();
     if (!empty($serial_name->id)) {
         $ser_timing = $serial_name->timing;
     }
     if (empty($ser_timing) || $ser_timing == 0) {
         $movies_b = MoviesModel::model()->get_series($series_id);
         $ser_timing = MoviesModel::model()->getTimeToInt($movies_b->rating);
     }
     if ($cur_time < $ser_timing && !empty($ser_timing)) {
         $percents = $cur_time / $ser_timing * 100;
         $percents = (int) $percents;
     } else {
         $percents = 100;
     }
     return array($percents, $ser_timing);
 }
コード例 #6
0
ファイル: show.php プロジェクト: bionicle12/testsite
?>
							</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 {
						display: inline-block;
						vertical-align: top;
						width: 42px !important;
						height: 42px !important;
						background: #87a1e5 !important;
						margin-right: 46px;
						position: relative;    float: left;
					}
					.bx-wrapper .bx-controls-direction a.bx-prev:before, .bx-wrapper .bx-controls-direction a.bx-next:before {
コード例 #7
0
ファイル: list.php プロジェクト: bionicle12/testsite
foreach ($movies as $movie) {
    ?>
   <tr class="<?php 
    echo $movie->id % 2 == 0 ? 'odd' : 'even';
    ?>
">
   <td><?php 
    echo $movie->id;
    ?>
</td>
   <td><?php 
    echo $movie->en_name;
    ?>
</td>
   <td><?php 
    echo MoviesModel::itemAlias($movie->type);
    ?>
</td>
   <td>
	<!--  <a href="/admin/pikibook/?movie=<?php 
    echo $movie->id;
    ?>
">PikiBook</a> -->
   </td>
   <td>
	 <!-- <a href="/admin/explanation/?movie=<?php 
    echo $movie->id;
    ?>
">Видеообъяснения</a>  -->
   </td>
   <td class="button-column">
コード例 #8
0
    public function search()
    {
        $key = $_POST['key'];
        $learned = $_POST['learned'];
        $words = DictModel::model()->where(" (en_word LIKE '%" . $key . "%' OR ru_word LIKE '%" . $key . "%') AND `user_id` = '" . Auth::getUser()['id'] . "' ")->findAll();
        $html = '<div class="dictionary_items_table" id="toPrint">
				<table class="table">
					<tr> 
						<td class="title">
							Слово:
						</td>
						<td class="title">
							Фраза:
						</td>
						<td class="title">
							Добавлено:
						</td>
					</tr>	';
        foreach ($words as $word) {
            $moovie = MoviesModel::model()->where("`id`='" . $word->movie_id . "' ")->findRow();
            $series = SeriesModel::model()->where("`id`='" . $word->series_id . "' ")->findRow();
            $from = $moovie->en_name . " - " . $series->name;
            /*$html .= '<tr>
            			<input type="hidden" id="learned_'.$word->id.'" />
            			<td><input type="checkbox" id="check_'.$word->id.'" onchange="check(\''.$word->id.'\');" /></td> 
            			<td>'.$word->en_word.' - '.$word->ru_word.'</td> 
            			<td>'.$word->phrase.'</td> <td>'.$from.'</td>
            		</tr>';*/
            $html .= '<tr><input type="hidden" id="learned_' . $word->id . '" />
						<td>
							<div class="checkbox check_item">
								<label><input type="checkbox" id="check_' . $word->id . '" onchange="check(\'' . $word->id . '\');" /></label>
							</div> <i class="glyphicon glyphicon-volume-up"></i>
							<div class="ttext">
								' . $word->en_word . ' - ' . $word->ru_word . '
							</div>
						</td>
						<td>
							<i class="glyphicon glyphicon-volume-up"></i>
							<div class="ttext">
								' . $word->phrase . '.<br/>
								<span class="grey_color">Кэрол вывезла свои вещи сегодня.</span>
							</div>													
						</td>
						<td>
							<div class="ttext">
								<span class="grey_color">Взято 20.05.2015 из:</span><br/>
									' . $from . '
							</div>													
						</td>
					</tr>';
        }
        $html .= '</table>';
        echo $html;
    }
コード例 #9
0
 public function sendTextErrorSeries()
 {
     $userAdmin = UsersModel::model()->where(" `id` = '1' ")->findRow();
     $user = UsersModel::model()->where(" `id` = '{$_SESSION['user']['id']}' ")->findRow();
     $series = SeriesModel::model()->where(" `id` = '{$_POST['series_id']}'  ")->findRow();
     $movie = MoviesModel::model()->where(" `id` = '{$_POST['movie_id']}'  ")->findRow();
     $to = $userAdmin->email;
     $subject = "http://" . $_SERVER['SERVER_NAME'] . " Сообщение об ошибке";
     $body = "<p>Сериал: id: " . $movie->id . ", en_name: " . $movie->en_name . ", ru_name: " . $movie->ru_name . "</p>";
     $body .= "<p>Сезон: id: " . $_POST['season_id'] . "</p>";
     $body .= "<p>Серия: id: " . $series->id . ", name: " . $series->name . "</p>";
     $body .= "<p>Пользователь: id: " . $user->id . " login: "******"</p>";
     $body .= "<p>Ошибка: " . $_POST['text'] . "</p>";
     $headers = "Content-type: text/html; charset=utf-8 \r\n";
     $headers .= "From: support@cpiki.com";
     echo "Отправлено";
     mail($to, $subject, $body, $headers);
 }
コード例 #10
0
 private function getMovies()
 {
     $sort = isset($_GET['sort']) ? $_GET['sort'] : 'id';
     $type = isset($_GET['type']) ? $_GET['type'] : 'desc';
     return MoviesModel::model()->order("{$sort} {$type}")->findAll();
 }
コード例 #11
0
 private function advancedSearch()
 {
     $sort = $_GET['sortby'] . " " . strtoupper($_GET['resorder']);
     if (isset($_GET['all_word_search'])) {
         $q = $_GET['q'];
     } else {
         $q = "%" . $_GET['q'] . "%";
     }
     $where = "`en_name` LIKE '{$q}' OR `ru_name` LIKE '{$q}'";
     if ((int) $_GET['cat'] != 0) {
         $where .= " AND `cat_id` = '{$_GET['cat']}'";
     }
     return MoviesModel::model()->where($where)->order($sort)->findAll();
 }
コード例 #12
0
 public function actionPikibookEdit($id)
 {
     if (isset($_POST['save'])) {
         $model = new MovieWordModel();
         $model->id = $_POST['id'];
         $model->en_word = $_POST['en_word'];
         $model->ru_word = $_POST['ru_word'];
         $model->movie_id = $_POST['movie_id'];
         $model->series_id = $_POST['series_id'];
         $model->save();
         $this->redirect("/admin/pikibook");
     } else {
         $movies = MoviesModel::model()->order(" ru_name asc ")->findAll();
         $word = MovieWordModel::model()->where("`id`='{$id}'")->findRow();
         $this->view("admin/pikibook/pikibook_edit", array("word" => $word, "movies" => $movies), false);
     }
 }
コード例 #13
0
ファイル: words.php プロジェクト: bionicle12/testsite
										<a onclick="open_group_list();" role="button"  data-toggle="modal"><img src="/assets/images/icons5.png" alt="" class="img-resp"></a>
										<div class="arrow_tooltip">
											<span class="arrow_grey "><i class="arrow_box arrow_box_top">Перенести в набор</i></span></div>
										</li>
									</ul>
								</div>

							</div>

								<div class="table-wrap">
									<table>

										<?php 
    foreach ($words as $word) {
        $ids .= $word->id . ',';
        $moovie = MoviesModel::model()->where("`id`='" . $word->movie_id . "' ")->findRow();
        $series = SeriesModel::model()->where("`id`='" . $word->series_id . "' ")->findRow();
        if (!empty($moovie->en_name) && !empty($series->name)) {
            $from = $moovie->en_name . " - " . $series->name;
        }
        ?>
											<tr><input type="hidden" id="row_<?php 
        echo $word->id;
        ?>
" />
												<td class="checkbox t1" onselectstart="return false" onmousedown="return false"><input type="checkbox" id="check_<?php 
        echo $word->id;
        ?>
" onchange="check('<?php 
        echo $word->id;
        ?>
コード例 #14
0
ファイル: show.php プロジェクト: bionicle12/testsite
							</div>
							<?php 
    } else {
        foreach ($viewed_series as $view) {
            $serial_id = MoviesModel::model()->get_series($view->series_id);
            $serial_name = MoviesModel::model()->get_seriesName($view->series_id);
            //$season_table = MoviesModel::model()->get_seriesSeason($view->series_id);
            $on = $view->series_id;
            $newdate = strtotime($view->date);
            $month = date('m', $newdate);
            $month = MoviesModel::model()->getRusMonth($month);
            //$userSV = UserSeriesViewedModel::model()->where(" `series_id` = '{$view->series_id}' AND `user_id`= '{$_SESSION['user']['id']}' ")->findRow();
            if (!empty($view->id)) {
                $v_time = $view->viewed;
                if (!empty($v_time) && !empty($view->series_id)) {
                    $perc = MoviesModel::perC($v_time, $view->series_id);
                    if (!empty($perc[0])) {
                        $per = $perc[0];
                    } else {
                        $per = 0;
                    }
                    if (!empty($perc[1])) {
                        $time = $perc[1];
                    } else {
                        $time = 'N/A';
                    }
                } else {
                    $v_time = 0;
                }
            }
            ?>
コード例 #15
0
</h2>
					<h3><?php 
echo $collections->description;
?>
</h3>
				</div>
			</div>
			<div class="">
				<div class="col-md-12">
				<div class="list_film_in_sezon serials_list">
					<ul>
						<?php 
foreach ($content_collections as $collection) {
    $issetFreeSeries = MoviesModel::issetFreeSeries($collection->serial_id);
    $issetPikiBookSeries = MoviesModel::issetPikiBookSeries($collection->serial_id);
    $movie = MoviesModel::model()->where("`id`='{$collection->serial_id}'")->findRow();
    ?>
							<li>
							<div class="img_block">
							   <img class="series-link-to-play  single_id-1209" series_id="6" single_id="1209" id="series_id-6" data-target="#show-video" onclick="window.location.href='/serials/<?php 
    echo $movie->seo_url;
    ?>
';" src="<?php 
    if (file_exists($_SERVER['DOCUMENT_ROOT'] . $movie->poster)) {
        echo $movie->poster;
    } else {
        echo '/assets/images/templates/no_image.png';
    }
    ?>
" alt="<?php 
    echo $collection->ru_name;
コード例 #16
0
<th class="button-column" id="city-grid_c2">&nbsp;</th></tr>
</thead>
<tbody>
<?php 
foreach ($explanations as $word) {
    ?>
   <tr class="<?php 
    echo $word->id % 2 == 0 ? 'odd' : 'even';
    ?>
">
	  <td><?php 
    echo $word->id;
    ?>
</td>
	  <td><?php 
    $movie = MoviesModel::model()->where("`id` = '{$word->movie_id}' ")->findRow();
    echo $movie->ru_name;
    ?>
</td>
	  <td><?php 
    echo $word->series_id;
    ?>
</td>
	  <td><?php 
    echo $word->link;
    ?>
</td>
	  <td><?php 
    echo $word->text;
    ?>
</td>
コード例 #17
0
 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);
 }
コード例 #18
0
 public function actionDict()
 {
     $userId = Auth::getUser()['id'];
     $favors = FavoritesModel::model()->where("`user_id`='{$userId}'")->findAll();
     $in = "(";
     foreach ($favors as $favor) {
         $in .= "'{$favor->video_id}'" . ", ";
     }
     $in = substr($in, 0, -2);
     $in .= ")";
     if ($in == ")") {
         $movies = array();
     } else {
         $movies = MoviesModel::model()->where("`id` IN {$in}")->findAll();
     }
     $movies_count = MoviesModel::model()->where("`id` IN {$in}")->countAll();
     $dicts = DictModel::model()->where("`user_id`='" . Auth::getUser()['id'] . "'")->countAll();
     //echo $dicts;
     $dict_groups = DictGroupsModel::model()->where("`user_id`='" . Auth::getUser()['id'] . "'")->findAll();
     $this->view("profile/dict", array("dicts" => $dicts, "groups" => $dict_groups, "movies_count" => $movies_count), false);
 }
コード例 #19
0
ファイル: show.php プロジェクト: bionicle12/testsite
    if (sizeof($viewed_series) == 0) {
        ?>
							<div class="col-xs-12 margin_top_30 margin_30_0">
								На данный момент история просмотров пуста!
							</div>
							<?php 
    } else {
        ?>
							<div class="col-xs-6 text-right mobile_align dop_info_history">
								<i class="glyphicon glyphicon-star"></i><span>- просмотренные видео (<a id="hide_show_link">скрыть</a>)</span>
							</div>
							<div class="col-xs-12 margin_top_30 ">
								<ul class="history_list">
									<?php 
        foreach ($viewed_series as $view) {
            $serial_id = MoviesModel::model()->get_series($view->series_id);
            ?>
												<li>
													<table class="table table_history_user">
															  <tr>
																		 <td><i class="glyphicon glyphicon-star"></i></td>
																		 <td><i class="glyphicon glyphicon-calendar"></i> <span><?php 
            echo $view->date;
            ?>
</span></td>										
																		 <td><i class="icon_mouse"></i> <span><?php 
            echo $serial_id->en_name;
            ?>
</span></td>
															  </tr>									
													</table>
コード例 #20
0
ファイル: page.php プロジェクト: bionicle12/testsite
">Колекция</a></th>
<th id="city-grid_c1"><a class="sort-link" href="<?php 
echo Admin::makeSort("description");
?>
">Сериал</a></th>
<th class="button-column" id="city-grid_c2">&nbsp;</th></tr>
</thead>
<tbody>
<?php 
foreach ($model as $conentent) {
    ?>
   <?php 
    $collectionName = CollectionsModel::model()->where("`id`=" . $conentent->collection_id)->findRow();
    ?>
   <?php 
    $serialName = MoviesModel::model()->where("`type`='2' and `id`=" . $conentent->serial_id)->findRow();
    ?>
    
   <tr class="<?php 
    echo $conentent->id % 2 == 0 ? 'odd' : 'even';
    ?>
">
   <td><?php 
    echo $conentent->id;
    ?>
</td>
   
   <td><?php 
    echo $collectionName->name;
    ?>
</td>
コード例 #21
0
 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);
 }