<?php use App\System\Models\Production; use App\System\Library\Complements\DateUtil; ?> @extends("user/templates/gen",array("title"=>"<span class='glyphicon glyphicon-time'></span> Actividad: Comentarios")) @section("content") @foreach($comments as $comment) <?php $production = Production::findOrNew($comment->production_id); $date = new DateUtil($comment->created_at); ?> <div class="col-sm-3 date-activity">{{$date->getDay()}} de {{$date->getMonth()}} del {{$date->getYear()}}</div> <div class="col-sm-9 description-activity"> <span class="glyphicon glyphicon-comment tooltip-top" style="color:#0072FF;" title="{{$comment->content}}"></span> Realizaste un comentario en <a target="_blank" href="{{URL::to("production/".$production->slug)}}">{{$production->title}}</a>. </div> @endforeach <div class="text-center clearfix"> {{$comments->render()}} </div> @stop
function getPlayChapter($slug, $id_chapter) { $id_chapter = Hash::decrypt(urldecode($id_chapter)); $production = Production::where(Production::ATTR_SLUG, $slug)->get(); if (count($production) == 0) { //Verifica en el log el slug if (is_null($id = Slug::getIdProduction($slug))) { return abort(404); } else { return redirect("production/" . Production::findOrNew($id)->slug . "/play"); } } $production = $production[0]; //Verifica que el id del capitulo exista if (Chapter::where(Chapter::ATTR_ID, $id_chapter)->count() == 0 || !is_numeric($id_chapter)) { return redirect("production/" . $production->slug); } //Verifica si la pelicula esta activa if ($production->state != Production::STATE_ACTIVE) { return redirect("production/" . $slug); } if (Auth::user()->state != User::STATE_ACTIVED_ACCOUNT) { return view("frontend/contents/production/play-forbbiden")->with("production", $production)->with("title", "¡ACTIVA TU CUENTA!")->with("message", view("ui/msg/contents/activa-tu-cuenta")->render()); } //Obtiene los datos de la ultima reproduccion del usuario list($play_date, $play_ip, $play_production, $play_chapter) = Auth::user()->getLastPlayBack(); //Verifica la restriccion de usuario gratis, en la que solo permite ver una pelicula por dia if (Auth::user()->role == User::ROLE_SUSCRIPTOR) { if (!is_null($play_production)) { /** * EL usuario gratis tiene 24 horas para ver la produccion que escogio */ $play_date = new DateUtil($play_date); //Agrega un dia, para determinar la proxima reproduccion $play_date->addDays(1); $next_date = $play_date->year . "-" . DateUtil::numberAdapt($play_date->month) . "-" . DateUtil::numberAdapt($play_date->day) . " 00:00:00"; //Calcula la diferencia de tiempo entre el tiempo actual y la fecha de la proxima reproduccion $time = DateUtil::difSec(DateUtil::getCurrentTime(), $next_date); if ($time > 0 && $id_chapter != $play_chapter) { return view("frontend/contents/production/play-forbbiden")->with("production", $production)->with("message", view("ui/msg/contents/play-forbidden-production-in-play")->with("production", Production::find($play_production))->with("time", $time)->with("chapter", Chapter::find($play_chapter))->render())->with("script", "assets/plugins/countdown/js/countdown.js")->with("css", array("assets/plugins/countdown/css/styles.css")); } } } $id_video = Chapter::find($id_chapter)->video; return view("ui/media/videoplayer")->with("production", $production)->with("id_video", $id_video); }
function postEdit(Request $request) { $data = $request->all(); $production = Production::findOrNew($data[Production::ATTR_ID]); $data[Production::ATTR_SLUG] = Util::createSlug($data[Production::ATTR_TITLE] . " " . $data[Production::ATTR_YEAR]); $production->fill($data); $production->save(); $terms = $production->terms; //Categorias $cats = array(); foreach ($data as $index => $value) { if (strpos($index, "cat-") !== false) { $cats[] = $value; } } $terms_id = array(); foreach ($terms as $term) { $terms_id[] = $term->id; } //Obtiene los terminos a disociar $unset = array_diff($terms_id, $cats); //Obtiene los termino a asociar $set = array_diff($cats, $terms_id); foreach ($unset as $index => $value) { $production->terms()->detach($value); } foreach ($set as $index => $value) { $production->terms()->attach($value); } return redirect()->back()->with(UI::message(UI::MESSAGE_TYPE_WARNING, trans("msg.info.change.saved"), null, 2)); }
<?php use App\System\Models\Production; use App\System\Library\Complements\DateUtil; ?> @extends("user/templates/gen",array("title"=>"<span class='glyphicon glyphicon-time'></span> Actividad: Puntuaciones")) @section("content") @foreach($ratings as $rating) <?php $production = Production::findOrNew($rating->production_id); $date = new DateUtil($rating->date); ?> <div class="col-sm-3 date-activity">{{$date->getDay()}} de {{$date->getMonth()}} del {{$date->getYear()}}</div> <div class="col-sm-9 description-activity">Puntuaste <img class="tooltip-top" title="{{trans("attr.production.rating.rating_".$rating->rating)}}" width="20px" src="{{URL::to("assets/images/ratings/".$rating->rating.".png")}}"> a <a target="_blank" href="{{URL::to("production/".$production->slug)}}">{{$production->title}}</a>. </div> @endforeach <div class="text-center clearfix"> {{$ratings->render()}} </div> @stop