示例#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);
 }
 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 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;
    }
示例#4
0
 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);
 }
示例#5
0
 public function actionSeriesDelete($id)
 {
     SeriesModel::model()->where("`id`='" . (int) $id . "'")->delete();
     $this->redirect("/admin/series");
 }
 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);
 }
示例#7
0
										<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;
        ?>
');" /></td>
示例#8
0
        $sdWordCount = MovieWordModel::model()->where("`movie_id`='{$movie->id}' AND `series_id`='{$single->id}'")->countAll();
        if ($user_major || $single->is_free == 1 || $_SESSION['user']['admin'] == 1) {
            $userSingleAdminS = 0;
        } else {
            $userSingleAdminS = 1;
        }
        $onclickSeriesPlay = "scriptNextSeriesPlayUpdate2(" . $single->id . "); scrPlayPr(); playVideo('" . $single->url . "', '" . $single->en_sub . "', '" . $single->ru_sub . "','" . $single->sort . "'," . $season->sort . ",'" . $sdSrc . "','" . $single->id . "'," . $single->season_id . "," . $movie->id . ", '" . $sdWordCount . "', '" . $explanationCount . "'," . $userSingleAdminS . "," . $user->id . ");";
        ?>

									<div class="film-item <?php 
        if (!empty($userSeriesViewsed->id)) {
            echo 'viewed';
        }
        ?>
 <?php 
        if (SeriesModel::isNewSeries($single->date) && empty($userSeriesViewsed->id)) {
            echo 'new';
        }
        ?>
" style="background-image: url(<?php 
        echo $sdSrc;
        ?>
)">
										<a href="#" class="series-link-to-play <?php 
        echo $sdIdFirst;
        ?>
 single_id-<?php 
        echo $single->id;
        ?>
" series_id="<?php 
        echo $sdNum;
示例#9
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);
 }