<th id="city-grid_c1"><a class="sort-link" href="<?php echo Admin::makeSort("description"); ?> ">Колекция</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"> </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
public function actionIndex() { /*$serieses = SeriesModel::model()->order('date DESC')->findAll(); $j=0; foreach($serieses as $single) { $seasons = SeasonModel::model()->where("`id` = '{$single->season_id}'")->findAll(); $season_num = 0; $series_num = 0; foreach($seasons as $one){ $season_num++; $series = SeriesModel::model()->where(" `season_id` = {$one->id} ")->findAll(); $seriesess = SeriesModel::model()->where(" `season_id` = '".$one->id."' ")->countAll(); $series_num = $series_num + $seriesess; $movie = MoviesModel::model()->order('date DESC')->findAll(); foreach($movie as $one_mov){ if($j <=20){ $news1[$j]['id'] = $one_mov->id; $news1[$j]['title'] = $one_mov->ru_name; $news1[$j]['poster'] = $one_mov->poster; $news1[$j]['seo_url'] = $one_mov->seo_url; $news1[$j]['seasons_count'] = $this->declension($season_num,array("сезон","сезона","сезонов")); $news1[$j]['series_count'] = $this->declension($series_num,array("серии","серии","серий")); $j++; } } } }*/ /* function getUniqueArray($key, $array) { $arrayKeys = array(); $resultArray = array(); foreach($array as $one) { if(!in_array($one[$key], $arrayKeys)) { $arrayKeys[] = $one[$key]; $resultArray[] = $one; } } return $resultArray; // возвращаем массив } $allnews = getUniqueArray("title", $news1); */ /* $Allpopular = MoviesModel::model()->order("rating DESC")->limit('30')->serials()->findAll(); $j = 0; foreach ($Allpopular as $one_popular) { $season_popular = SeasonModel::model()->where("`serial_id`={$one_popular->id}")->findAll(); $season_num = 0; $series_num = 0; foreach ($season_popular as $one_season){ $season_num++; $serieses = SeriesModel::model()->where(" `season_id` = '".$one_season->id."' ")->countAll(); $series_num = $series_num + $serieses; } $popular[$j]['id'] = $one_popular->id; $popular[$j]['title'] = $one_popular->ru_name; $popular[$j]['poster'] = $one_popular->poster; $popular[$j]['seo_url'] = $one_popular->seo_url; $popular[$j]['seasons_count'] = $this->declension($season_num,array("сезон","сезона","сезонов")); $popular[$j]['series_count'] = $this->declension($series_num,array("серии","серии","серий")); $j++; } $movies = MoviesModel::model()->serials()->countAll(); $str .= $this->declension("<b>".$movies."</b>",array(Lang::get("num_series_1"),Lang::get("num_series_2"),Lang::get("num_series_3"))); $allSer = SeriesModel::model()->countAll(); $allSeries .= $this->declension("<b>".$allSer."</b>",array(Lang::get("series_1"),Lang::get("series_2"),Lang::get("series_3")));*/ $collections = CollectionsModel::model()->order("id DESC")->findAll(); if (isset($_POST['captcha'])) { $code = $_POST['captcha']; session_start(); if (isset($_SESSION['captcha']) && strtoupper($_SESSION['captcha']) == strtoupper($code)) { if (UsersModel::model()->where("`login`='" . $_POST['name'] . "'")->findRow()) { $this->view("error", array("message" => Lang::get("login_exist")), false); } else { $random_password = rand(10000, 99999); $model = new UsersModel(); $model->login = $_POST['name']; $model->password = md5($random_password); $model->email = $_POST['name']; $model->is_admin = 0; $model->status = 1; $model->card_main_id = 1; $model->card_main_new_id = 2; $model->hash = md5($model->login . $model->password . $model->email . "hash"); $model->type = 1; $model->save(); $to = $_POST['name']; $subject = "Регистрация аккаунта " . $_POST['name'] . " на SPEAKY"; $body = "Здравствуйте уважаемый пользователь " . $_SERVER[HTTP_HOST] . $_SERVER[REQUEST_URI] . "<br/>Вы зарегистрировались на сайте под логином:" . $_POST['name'] . "<br/>" . "Ваш пароль:" . $random_password . "<br/><br/>"; // ."Обязательно подтвердите вашу регистрацию, перейдя по ссылке <a href='http://".$_SERVER[HTTP_HOST]."/activate/". $model->hash."'>подтверждения регистрации</a>"; $headers = "From: support@speak.addic.tk"; $headers .= "Support " . $_SERVER[HTTP_HOST] . " " . "\r\n"; $headers .= "Content-type: text/html; charset=utf-8" . "\r\n"; $headers .= 'X-Mailer: PHP/' . phpversion(); if (empty($to)) { echo "<script>alert('No email to send');</script>"; } else { if (mail($to, $subject, $body, $headers)) { echo "<script>window.location.href = '/successful_registration';</script>"; } } } } else { echo "<script>alert('Капча введена не правильно')</script>"; } } $user = UsersModel::model()->where("`id`='" . Auth::getUser()['id'] . "'")->findRow(); //заглушка //$explanation = ExplanationModel::model()->countAll(); // $explanation_decl .= $this->declension("<b>".$explanation."</b>",array("видео-объяснение","видео-объяснения","видео-объяснений")); // $seasons = SeasonModel::model()->where("`serial_id` = '{$movie->id}'")->order("sort asc")->findAll(); $this->view("home", array("collect" => $collections, "user" => $user), false); }
public function actioncollectionsDelete($id) { CollectionsModel::model()->where("`id`='" . (int) $id . "'")->delete(); $this->redirect("/admin/collections"); }
public function actionCollectionsShow($seoUrl) { $Collections = CollectionsModel::model()->where("`seo_url`='{$seoUrl}'")->findRow(); $content_collections = CollectionContentModel::model()->where("`collection_id` = '{$Collections->id}'")->findAll(); if (Auth::isLogged()) { $this->view("collections/collectionShow", array("content_collections" => $content_collections, "collections" => $Collections), false); } else { $this->redirect("/"); } }