film.blade.php 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. @extends('hello')
  2. @section('content')
  3. <div class="page-header">
  4. <h1>{{ $film->name }} <small>{{ $tfilm['tagline']}}</small></h1>
  5. </div>
  6. <div class="row">
  7. <div class="col-md-3">
  8. @if(!is_null($film->gesehen))
  9. <div class="label label-success"><span class="glyphicon glyphicon-check"></span> Gesehen am {{ \Carbon\Carbon::parse($film->gesehen)->format('d.m.Y') }}</div>
  10. @else
  11. <div class="label label-danger" <?php if(!is_null(Auth::user()) && Auth::user()->admin) { echo "id='gesehen'"; } ?> style="cursor: pointer;"><span class="glyphicon glyphicon-unchecked"></span> Nicht gesehen</div>
  12. @endif
  13. </div>
  14. <div class="col-md-9">
  15. <ul class="nav nav-tabs">
  16. <li class="active"><a href="#ueberblick" data-toggle="tab">Überblick</a></li>
  17. <li><a href="#cast" data-toggle="tab">Schauspieler</a></li>
  18. <li><a href="#trailer" data-toggle="tab">Trailer</a></li>
  19. </ul>
  20. </div>
  21. </div>
  22. <div class="row">
  23. <div class="col-md-3 thumbnail">
  24. <img src="{{ $poster }}" alt="{{ $film->name }} Poster">
  25. </div>
  26. <div class="col-md-9 tab-content">
  27. <div class="tab-pane active" id='ueberblick'>
  28. <div class="pull-right">
  29. <a class="btn btn-xs btn-primary" href="http://themoviedb.org/movie/{{ $film->tvdbid }}">themoviedb.org</a>
  30. <a class="btn btn-xs btn-warning" href="http://imdb.com/title/{{ $tfilm['imdb_id'] }}">IMDB</a>
  31. </div>
  32. <dl class="dl-horizontal">
  33. <dt>Originaltitel</dt>
  34. <dd>{{ $tfilm['original_title'] }}</dd>
  35. <dt>Erschienen</dt>
  36. <dd>
  37. {{ \Carbon\Carbon::parse($tfilm['release_date'])->format('d.m.Y')}} -
  38. @foreach($tfilm['production_countries'] as $pc)
  39. <abbr title="{{$pc['name']}}">{{$pc['iso_3166_1']}}</abbr>
  40. @endforeach
  41. @foreach($tfilm['production_companies'] as $pc)
  42. - {{$pc['name']}}
  43. @endforeach
  44. </dd>
  45. <dt>Genre</dt>
  46. <dd>
  47. @foreach($tfilm['genres'] as $g)
  48. <span class="label label-default">{{$g['name']}}</span>
  49. @endforeach
  50. </dd>
  51. <dt>Bewertung</dt>
  52. <dd>{{ $tfilm['vote_average']}} von 10 </dd>
  53. @if(!is_null($film->gesehen) && Comment::where('film', $film->id)->where('bewertung', '>', 0)->count() > 0)
  54. <dt>Eigene Bewertung</dt>
  55. <dd>
  56. <?php
  57. $count = Comment::where('film', $film->id)->where('bewertung', '>', 0)->count();
  58. $avg = Comment::where('film', $film->id)->where('bewertung', '>', 0)->sum('bewertung') / $count;
  59. ?>
  60. <div class="label label-{{$labels[round($avg)]}}">{{$avg}}</div>
  61. </dd>
  62. @endif
  63. @for($i = 0; $i < 3 && $i < count($cast['crew']); $i++)
  64. <dt>{{$cast['crew'][$i]['job']}}</dt>
  65. <dd>{{$cast['crew'][$i]['name']}}</dd>
  66. @endfor
  67. <p></p>
  68. <dt>Inhalt</dt>
  69. <dd>{{ nl2br($tfilm['overview']) }}</dd>
  70. </dl>
  71. </div>
  72. <div class="tab-pane" id="cast">
  73. <div class="row" style="margin-top:10px;">
  74. @for($i = 0; $i < 10 && $i < count($cast['cast']); $i++)
  75. <div class="col-md-6">
  76. <div class="pull-left" style="margin-right:5px; min-height: 80px;"><img class="img-thumbnail media-object" src="{{ !is_null($cast['cast'][$i]['profile_path']) ? $tmdb->getImageUrl($cast['cast'][$i]['profile_path'], TMDb::IMAGE_PROFILE, 'w185') : "http://d3a8mw37cqal2z.cloudfront.net/assets/649ae87ebcf4285/images/no-profile-w185.jpg"}}" alt="{{$cast['cast'][$i]['name']}}" width="55"></div>
  77. <div class="media-body">
  78. <h4 class="media-heading">{{$cast['cast'][$i]['name']}}</h4>
  79. {{$cast['cast'][$i]['character']}}
  80. </div>
  81. </div>
  82. @if($i % 2 == 1)
  83. </div><div class="row">
  84. @endif
  85. @endfor
  86. </div>
  87. </div>
  88. <div class="tab-pane" id="trailer">
  89. @foreach($trail['youtube'] as $yt)
  90. <iframe width="420" height="315" src="//www.youtube.com/embed/{{ $yt['source'] }}" frameborder="0" allowfullscreen></iframe>
  91. @endforeach
  92. </div>
  93. </div>
  94. </div>
  95. <div class="clearfix"></div>
  96. <hr>
  97. @if($votes > 0 || is_null($film->gesehen))
  98. @if($votes > 0)
  99. <h2>Abstimmung</h2>
  100. <p>Insgesamt haben <b>{{$votes}}</b> Personen abgestimmt. <b>{{$vposi}}</b> davon waren <i>daf&uuml;r</i>. @if($uvote[0])
  101. Du hast <i>{{ $uvote[1] ? "daf&uuml;r" : "dagegen"}}</i> gestimmt.
  102. @endif
  103. <div class="progress">
  104. <div class="progress-bar progress-bar-success tooltip-enable" style="width: {{ $vposi / $votes * 100}}%" data-toggle="tooltip" data-title="{{$pv}}">
  105. <span class="sr-only">{{$vposi}} von {{$votes}} (daf&uuml;r)</span>
  106. </div>
  107. <div class="progress-bar progress-bar-danger tooltip-enable" style="width: {{ ($votes - $vposi) / $votes * 100}}%" data-toggle="tooltip" data-title="{{$nv}}">
  108. <span class="sr-only">{{ $votes - $vposi}} von {{ $votes }} (dagegen)</span>
  109. </div>
  110. </div>
  111. @endif
  112. @if(is_null($film->gesehen) && !is_null(Auth::user()))
  113. <div class="container" style="text-align: center">
  114. <div class="btn-group">
  115. <a class="btn btn-lg btn-success <?php echo $uvote[0] && $uvote[1] ? "disabled" : ""; ?>" href="{{ url('vote', array('yes', Auth::user()->id, $film->id)) }}">
  116. <span class="glyphicon glyphicon-thumbs-up"></span> Daf&uuml;r
  117. </a>
  118. <a class="btn btn-lg btn-danger <?php echo $uvote[0] && !$uvote[1] ? "disabled" : ""; ?>" href="{{ url('vote', array('no', Auth::user()->id, $film->id)) }}">
  119. <span class="glyphicon glyphicon-thumbs-down"></span> Dagegen
  120. </a>
  121. </div>
  122. </div>
  123. @endif
  124. <hr>@endif
  125. <h2>Kommentare</h2>
  126. @if(is_null(Auth::user()))
  127. <p>Melde Dich an, um diesen Film zu kommentieren.</p>
  128. @else
  129. <div class="media">
  130. <div class="pull-left">
  131. <img class="media-object" src="{{ "http://www.gravatar.com/avatar/" . md5( strtolower( trim( Auth::user()->email ) ) ) . "?s=40" }}">
  132. </div>
  133. <div class="media-body">
  134. <h4 class="media-heading">Neuer Kommentar</h4>
  135. {{Form::open(array('route' => 'comment'))}}
  136. @if(!is_null(Auth::user()) && !is_null($film->gesehen) && Comment::where('user', Auth::user()->id)->where('film', $film->id)->where('bewertung', '>', 0)->count() < 1 )
  137. <p><div class="pull-left" style="margin-right: 5px">Bewerten:</div>
  138. <div class="btn-group btn-group-xs" data-toggle="buttons">
  139. @for($i = 1; $i < 11; $i++)
  140. <label class="btn btn-{{ $labels[$i] }}">
  141. <input type="radio" name="rate" id="rate{{ $i }}" value="{{ $i }}"> {{ $i }}
  142. </label>
  143. @endfor
  144. </div>
  145. </p>
  146. @endif
  147. <input type="hidden" name="user" value="{{Auth::user()->id}}">
  148. <input type="hidden" name="film" value="{{$film->id}}">
  149. <div class="form-group"><textarea class="form-control" rows="1" name="text"></textarea></div>
  150. <div class="form-group"><button type="submit" class="btn btn-primary btn-xs">Absenden</button></div>
  151. {{Form::close()}}
  152. </div>
  153. </div>
  154. @endif
  155. @foreach($comments as $comment)
  156. <div class="media">
  157. <div class="pull-left">
  158. <img class="media-object" src="{{ "http://www.gravatar.com/avatar/" . md5( strtolower( trim( $comment->autor->email ) ) ) . "?s=40" }}" alt="{{ $comment->autor->name }}">
  159. </div>
  160. <div class="media-body" id="comment{{$comment->id}}">
  161. <h5 class="media-heading">{{ $comment->autor->name }} <small>{{\Carbon\Carbon::parse($comment->created_at)->format('d.m.Y H:i')}}
  162. @if($comment->updated_at != $comment->created_at)
  163. &mdash; Zuletzt bearbeitet: {{\Carbon\Carbon::parse($comment->updated_at)->format('d.m.Y H:i')}}
  164. @endif
  165. </small></h5>
  166. @if(!is_null(Auth::user()) && Auth::user()->id === $comment->autor->id)
  167. <div class="collapse in" data-parent="#comment{{$comment->id}}" id="comment{{$comment->id}}comment">
  168. @if($comment->bewertung > 0)
  169. <div class="pull-left label label-{{ $labels[$comment->bewertung] }}" style="margin-right: 5px;">{{$comment->bewertung}}</div>
  170. @endif
  171. <p>{{$comment->text}}</p>
  172. <button type="button" class="btn btn-xs" onclick="toggleComment('#comment{{$comment->id}}')">Bearbeiten</button>
  173. </div>
  174. <div class="collapse" id="comment{{$comment->id}}edit">
  175. {{Form::open(array('route' => 'modcomment'))}}
  176. @if($comment->bewertung > 0)
  177. <p><div class="pull-left" style="margin-right: 5px">Bewerten:</div>
  178. <div class="btn-group btn-group-xs" data-toggle="buttons">
  179. @for($i = 1; $i < 11; $i++)
  180. <label class="btn btn-{{ $labels[$i] }}">
  181. <input type="radio" name="rate" id="rate{{ $i }}" value="{{ $i }}"> {{ $i }}
  182. </label>
  183. @endfor
  184. </div>
  185. </p>
  186. @endif
  187. <input type="hidden" name="id" value="{{$comment->id}}">
  188. <div class="form-group"><textarea class="form-control" rows="1" name="text">{{$comment->text}}</textarea></div>
  189. <div class="form-group">
  190. <button type="submit" class="btn btn-primary btn-xs">Absenden</button>
  191. <button type="button" class="btn btn-xs" onclick="toggleComment('#comment{{$comment->id}}')">Abbrechen</button>
  192. </div>
  193. {{Form::close()}}
  194. </div>
  195. @else
  196. @if($comment->bewertung > 0)
  197. <div class="pull-left label label-{{ $labels[$comment->bewertung] }}" style="margin-right: 5px;">{{$comment->bewertung}}</div>
  198. @endif
  199. <p>{{$comment->text}}</p>
  200. @endif
  201. </div>
  202. </div>
  203. @endforeach
  204. @stop
  205. @section('script')
  206. <script type="text/javascript">
  207. function toggleComment(id) {
  208. $(id + 'edit').collapse('toggle');
  209. $(id + 'comment').collapse('toggle');
  210. }
  211. $(function() {
  212. $('.tooltip-enable').tooltip({ html: true, placement: "bottom" });
  213. });
  214. $(function() {
  215. $('#gesehen').popover({
  216. html: true,
  217. placement: "right",
  218. trigger: "click",
  219. title: "Als gesehen markieren",
  220. content: "<div class='container'><a href='{{ url('mark-read/' . $film->id) }}' class='btn btn-success'>Film als gesehen markieren</a></div>"
  221. });
  222. });
  223. </script>
  224. @stop
  225. @section('title')
  226. {{ $film->name }} ~
  227. @stop