film.blade.php 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  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" : "nicht daf&uuml;r"}}</i> gestimmt.
  102. @endif
  103. </p>
  104. <dl class="dl-horizontal">
  105. <dt>Daf&uuml;r</dt>
  106. <dd>
  107. @foreach($pv as $v)
  108. <span class="badge">{{$v}}</span>
  109. @endforeach
  110. </dd>
  111. <dt>Nicht daf&uuml;r</dt>
  112. <dd>
  113. @foreach($nv as $v)
  114. <span class="badge">{{$v}}</span>
  115. @endforeach
  116. </dd>
  117. </dl>
  118. @endif
  119. @if(is_null($film->gesehen) && !is_null(Auth::user()))
  120. <div class="container" style="text-align: center">
  121. <div class="btn-group">
  122. <a class="btn btn-lg btn-success <?php echo $uvote[0] && $uvote[1] ? "disabled" : ""; ?>" href="{{ url('vote', array('yes', Auth::user()->id, $film->id)) }}">
  123. <span class="glyphicon glyphicon-thumbs-up"></span> Daf&uuml;r
  124. </a>
  125. <a class="btn btn-lg btn-warning <?php echo $uvote[0] && !$uvote[1] ? "disabled" : ""; ?>" href="{{ url('vote', array('no', Auth::user()->id, $film->id)) }}">
  126. <span class="glyphicon glyphicon-hand-right"></span> Nicht daf&uuml;r
  127. </a>
  128. </div>
  129. </div>
  130. @endif
  131. <hr>@endif
  132. <h2>Kommentare</h2>
  133. @if(is_null(Auth::user()))
  134. <p>Melde Dich an, um diesen Film zu kommentieren.</p>
  135. @else
  136. <div class="media">
  137. <div class="pull-left">
  138. <img class="media-object" src="{{ Auth::user()->getAvatar() }}" width="64">
  139. </div>
  140. <div class="media-body">
  141. <h4 class="media-heading">Neuer Kommentar</h4>
  142. {{Form::open(array('route' => 'comment'))}}
  143. @if(!is_null(Auth::user()) && !is_null($film->gesehen) && Comment::where('user', Auth::user()->id)->where('film', $film->id)->where('bewertung', '>', 0)->count() < 1 )
  144. <p><div class="pull-left" style="margin-right: 5px">Bewerten:</div>
  145. <div class="btn-group btn-group-xs" data-toggle="buttons">
  146. @for($i = 1; $i < 11; $i++)
  147. <label class="btn btn-{{ $labels[$i] }}">
  148. <input type="radio" name="rate" id="rate{{ $i }}" value="{{ $i }}"> {{ $i }}
  149. </label>
  150. @endfor
  151. </div>
  152. </p>
  153. @endif
  154. <input type="hidden" name="user" value="{{Auth::user()->id}}">
  155. <input type="hidden" name="film" value="{{$film->id}}">
  156. <div class="form-group"><textarea class="form-control" rows="1" name="text"></textarea></div>
  157. <div class="form-group"><button type="submit" class="btn btn-primary btn-xs">Absenden</button></div>
  158. {{Form::close()}}
  159. </div>
  160. </div>
  161. @endif
  162. @foreach($comments as $comment)
  163. <div class="media">
  164. <div class="pull-left">
  165. <img class="media-object" src="{{ $comment->autor->getAvatar() }}" alt="{{ $comment->autor->name }}" width="64">
  166. </div>
  167. <div class="media-body" id="comment{{$comment->id}}">
  168. <h5 class="media-heading">{{ $comment->autor->name }} <small>{{\Carbon\Carbon::parse($comment->created_at)->format('d.m.Y H:i')}}
  169. @if($comment->updated_at != $comment->created_at)
  170. &mdash; Zuletzt bearbeitet: {{\Carbon\Carbon::parse($comment->updated_at)->format('d.m.Y H:i')}}
  171. @endif
  172. </small></h5>
  173. @if(!is_null(Auth::user()) && Auth::user()->id === $comment->autor->id)
  174. <div class="collapse in" data-parent="#comment{{$comment->id}}" id="comment{{$comment->id}}comment">
  175. @if($comment->bewertung > 0)
  176. <div class="pull-left label label-{{ $labels[$comment->bewertung] }}" style="margin-right: 5px;">{{$comment->bewertung}}</div>
  177. @endif
  178. <p>{{$comment->text}}</p>
  179. <button type="button" class="btn btn-xs" onclick="toggleComment('#comment{{$comment->id}}')">Bearbeiten</button>
  180. </div>
  181. <div class="collapse" id="comment{{$comment->id}}edit">
  182. {{Form::open(array('route' => 'modcomment'))}}
  183. @if($comment->bewertung > 0)
  184. <p><div class="pull-left" style="margin-right: 5px">Bewerten:</div>
  185. <div class="btn-group btn-group-xs" data-toggle="buttons">
  186. @for($i = 1; $i < 11; $i++)
  187. <label class="btn btn-{{ $labels[$i] }}">
  188. <input type="radio" name="rate" id="rate{{ $i }}" value="{{ $i }}"> {{ $i }}
  189. </label>
  190. @endfor
  191. </div>
  192. </p>
  193. @endif
  194. <input type="hidden" name="id" value="{{$comment->id}}">
  195. <div class="form-group"><textarea class="form-control" rows="1" name="text">{{$comment->text}}</textarea></div>
  196. <div class="form-group">
  197. <button type="submit" class="btn btn-primary btn-xs">Absenden</button>
  198. <button type="button" class="btn btn-xs" onclick="toggleComment('#comment{{$comment->id}}')">Abbrechen</button>
  199. </div>
  200. {{Form::close()}}
  201. </div>
  202. @else
  203. @if($comment->bewertung > 0)
  204. <div class="pull-left label label-{{ $labels[$comment->bewertung] }}" style="margin-right: 5px;">{{$comment->bewertung}}</div>
  205. @endif
  206. <p>{{$comment->text}}</p>
  207. @endif
  208. </div>
  209. </div>
  210. @endforeach
  211. @stop
  212. @section('script')
  213. <script type="text/javascript">
  214. function toggleComment(id) {
  215. $(id + 'edit').collapse('toggle');
  216. $(id + 'comment').collapse('toggle');
  217. }
  218. $(function() {
  219. $('.tooltip-enable').tooltip({ html: true, placement: "bottom" });
  220. });
  221. $(function() {
  222. $('#gesehen').popover({
  223. html: true,
  224. placement: "right",
  225. trigger: "click",
  226. title: "Als gesehen markieren",
  227. content: "<div class='container'><a href='{{ url('mark-read/' . $film->id) }}' class='btn btn-success'>Gesehen</a><a href='{{ url('view-next/' . $film->id) }}' class='btn btn-warning'>Als n&auml;chstes sehen</a></div>"
  228. });
  229. });
  230. </script>
  231. @stop
  232. @section('title')
  233. {{ $film->name }} ~
  234. @stop