Daniel Müllers 11 rokov pred
rodič
commit
7d21be1a66

+ 2 - 1
app/database/migrations/2013_09_07_032049_create_tables.php

@@ -13,12 +13,13 @@ class CreateTables extends Migration {
 	{
 		Schema::create('users', function($table) {
 			$table->increments('id');
-			$table->string('name');
+			$table->string('name')->unique();
 			$table->string('email');
 			$table->string('password');
 			$table->boolean('admin');
 			$table->text('settings');
 			$table->timestamps();
+			$table->softDeletes();
 		});
 
 		Schema::create('films', function($table) {

+ 1 - 1
app/models/Film.php

@@ -16,7 +16,7 @@ class Film extends Eloquent {
 	}
 
 	public function scopeZuletztGesehen($query) {
-		return $query->whereNotNull('gesehen')->orderBy('gesehen')->take(5);
+		return $query->whereNotNull('gesehen')->orderBy('gesehen', 'DESC')->take(5);
 	}
 
 	public function scopeNeuesteVorschlage($query) {

+ 2 - 0
app/models/User.php

@@ -12,6 +12,8 @@ class User extends Eloquent implements UserInterface, RemindableInterface {
 	 */
 	protected $table = 'users';
 
+	protected $softDelete = true;
+
 	/**
 	 * The attributes excluded from the model's JSON form.
 	 *

+ 1 - 1
app/models/Vote.php

@@ -7,7 +7,7 @@ class Vote extends Eloquent {
 		return $this->belongsTo('Film', 'film');
 	}
 
-	public function user() {
+	public function voter() {
 		return $this->belongsTo('User', 'user');
 	}
 }

+ 208 - 2
app/routes.php

@@ -31,6 +31,23 @@ Route::get('film/{id}', array('as' => 'film', function($id) {
 
 	$votes = $film->votes()->count();
 	$vposi = $film->votes()->where('stimme', true)->count();
+	$pv = "";
+	foreach($film->votes()->where('stimme', true)->get() as $v) {
+		$pv .= $v->voter->name . "<br> ";
+	}
+
+	$nv = "";
+	foreach($film->votes()->where('stimme', false)->get() as $v) {
+		$nv = $v->voter->name . "<br> ";
+	}
+
+	if(!is_null(Auth::user()) && $film->votes()->where('user', Auth::user()->id)->count() > 0) {
+		$uvote[0] = true;
+		$uvote[1] = $film->votes()->where('user', Auth::user()->id)->first()->stimme;
+	} else {
+		$uvote[0] = false;
+	}
+		
 
 	$comments = $film->comments()->orderBy('id', 'DESC')->get();
 
@@ -42,18 +59,54 @@ Route::get('film/{id}', array('as' => 'film', function($id) {
 		->with('cast', $tcast)
 		->with('trail', $ttrail)
 		->with('votes', $votes)
+		->with('uvote', $uvote)
+		->with('pv', $pv)
+		->with('nv', $nv)
 		->with('vposi', $vposi)
 		->with('tmdb', $tmdb);
 }));
 
+Route::get('vote/{stimme}/{user}/{film}', function($stimme, $user, $film) {
+	$v = Vote::where('user', $user)->where('film', $film)->first();
+
+	if(!is_null($v)) {
+		$v->stimme = $stimme == "yes" ? true : false;
+	} else {
+		$v = new Vote();
+		$v->user = $user;
+		$v->film = $film;
+		$v->stimmer = $stimme == "yes" ? true : false;
+	}
+
+	$v->save();
+
+	return Redirect::to('film/' . $film);
+});
+
+Route::post('comment', array('as' => 'comment', function() {
+	$c = new Comment();
+	$c->film = Input::get('film');
+	$c->user = Input::get('user');
+	$c->text = Input::get('text');
+	$c->save();
+	return Redirect::to('film/' . Input::get('film'));
+}));
+
+Route::post('comment/edit', array('as'=> 'modcomment', function () {
+	$c = Comment::findOrFail(Input::get('id'));
+	$c->text = Input::get('text');
+	$c->save();
+	return Redirect::to('film/' . $c->film);
+}));
+
 Route::get('login', array('as' => 'login', function() {
 	return View::make('login');
 }));
 
 Route::post('login', function() {
 	$userdata = array(
-		'name' => Input::get('iSpieler'),
-		'password' => Input::get('iPassword'));
+		'name' => Input::get('user'),
+		'password' => Input::get('password'));
 	if(Auth::attempt($userdata)) {
 		return Redirect::intended('/');
 	} else {
@@ -67,4 +120,157 @@ Route::post('login', function() {
 Route::get('logout', array('as' => 'logout', function() {
 	Auth::logout();
 	return Redirect::to('/');
+}));
+
+Route::get('vorgeschlagen/{field?}/{order?}', function($field = "vorgeschlagen", $order = "desc") {
+	$filme = Film::whereNull('gesehen')->orderBy($field, $order)->paginate();
+
+	return View::make('suggest')
+		->with('filme', $filme);
+
+})->where(array('field' => '[a-z]+', 'order' => 'asc|desc'));
+
+Route::get('gesehen/{field?}/{order?}', function($field = "gesehen", $order = "desc") {
+	$filme = Film::whereNotNull('gesehen')->orderBy($field, $order)->paginate();
+
+	return View::make('seen')
+		->with('filme', $filme);
+
+})->where(array('field' => '[a-z]+', 'order' => 'asc|desc'));
+
+Route::get('neu', array('before' => 'auth', function() {
+
+	return View::make('new');
+
+}));
+
+Route::post('neu', array('before' => 'auth', function() {
+	$tmdb = new TMDb('b187f8d9c5e72b1faecb741d5d04239a', 'de', TRUE);
+	$r = $tmdb->searchMovie(Input::get('search'));
+
+	return View::make('new')->with('result', $r)->with('tmdb', $tmdb);
+}));
+
+Route::get('vorschlag/{id}', array('before' => 'auth', function($id) {
+	$tmdb = new TMDb('b187f8d9c5e72b1faecb741d5d04239a', 'de', TRUE);
+	$f = $tmdb->getMovie($id);
+	$film = new Film();
+	$film ->name = $f['title'];
+	$film->tvdbid = $id;
+	$film->vorgeschlagen = \Carbon\Carbon::today();
+	$film->user = Auth::user()->id;
+	$film->save();
+	return Redirect::to('film/' . $film->id);
+}));
+
+Route::get('mark-read/{id}', array('before' => 'auth', function($id) {
+	$film = Film::findOrFail($id);
+	$film->gesehen = \Carbon\Carbon::today();
+	$film->save();
+	return Redirect::to('film/' . $film->id);
+}));
+
+Route::get('register', function() {
+	return View::make('register');
+});
+
+Route::post('register', function() {
+	$vrules = array(
+		'name' => 'required|unique:users',
+		'email' => 'required|email',
+		'password' => 'required|confirmed',
+		'fire' => array('required', 'regex:/^Kreis$/i')
+	);
+
+	$vfields = array(
+		'name' => Input::get('user'),
+		'email' => Input::get('email'),
+		'password' => Input::get('password'),
+		'password_confirmation' => Input::get('pw-confirm'),
+		'fire' => Input::get('fire')
+	);
+
+	$val = Validator::make($vfields, $vrules);
+
+	if($val->fails()) {
+		return View::make('register')->with('errors', $val->messages());
+	} else {
+		$u = new User();
+		$u->name = Input::get('user');
+		$u->email = Input::get('email');
+		$u->password = Hash::make(Input::get('password'));
+		$u->save();
+		return Redirect::to('/')->with('message', 'Registriert!');
+	}
+});
+
+Route::get('settings', array('before' => 'auth', function() {
+	return View::make('settings');
+}));
+
+Route::post('settings/{mode}', array('before' => 'auth', function($mode) {
+	Validator::extend('pass', function($attribute, $value, $parameters) {
+			return Hash::check($value, Auth::user()->password);
+	});
+	if($mode == 'password') {
+		var_dump(Hash::check(Input::get('oldpw'), Auth::user()->password));
+		$vfields = array('oldpw' => Input::get('oldpw'), 'newpw' => Input::get('newpw'), 'newpw_confirmation' => Input::get('newpw2'));
+		$vrules = array( 'oldpw' => 'required|pass', 'newpw' => 'required|confirmed' );
+		$val = Validator::make($vfields, $vrules);
+		if($val->passes()) {
+			$u = Auth::user();
+			$u->password = Hash::make(Input::get('newpw'));
+			$u->save();
+			return View::make('settings')->with('message', 'Passwort geändert.');
+		} else {
+			return View::make('settings')->with('errors', $val->messages());
+		}
+	}
+
+	if($mode == 'email') {
+		$vfields = array('pw' => Input::get('pw'), 'email' => Input::get('email'), 'email_confirmation' => Input::get('email2'));
+		$vrules = array('pw' => 'required|pass', 'email' => 'required|confirmed');
+		$val = Validator::make($vfields,  $vrules);
+		if($val->passes()) {
+			$u = Auth::user();
+			$u->email = Input::get('email');
+			$u->save();
+			return View::make('settings')->with('message', 'Email geändert.');
+		} else {
+			return View::make('settings')->with('errors', $val->messages());	
+		}
+	}
+}));
+
+Route::get('users', array('before' => 'auth', function() {
+	if(Auth::user()->admin) {
+		$u = User::orderBy('name')->paginate();
+
+		return View::make('users')->with('users', $u);
+	} else {
+		App::abort(401, 'Diese Seite ist nicht für Dich.');	
+	}
+}));
+
+Route::get('users/{operation}/{id}', array('before' => 'auth', function($operation, $id) {
+	if(!Auth::user()->admin) App::abort(401, 'Diese Seite ist nicht für Dich.');
+	$u = User::findOrFail($id);
+	switch($operation) {
+		case 'mkadm':
+			$u->admin = true;
+			$u->save();
+			$msg = $u->name . " ist jetzt ein Admin.";
+			break;
+		case 'rmadm':
+			$u->admin = false;
+			$u->save();
+			$msg = $u->name . " ist kein Admin mehr.";
+			break;
+		case 'rmusr':
+			$msg = $u->name . " wurde gelöscht.";
+			$u->delete();
+			break;
+	}
+
+	return Redirect::to('users')->with('message', $msg);
 }));

+ 94 - 19
app/views/film.blade.php

@@ -7,11 +7,11 @@
 
 <div class="row">
 	<div class="col-md-3">
-				@if(!is_null($film->gesehen))
-					<div class="label label-success"><span class="glyphicon glyphicon-check"></span> Gesehen am {{ $film->gesehen }}</div>
-				@else
-					<div class="label label-danger"><span class="glyphicon glyphicon-unchecked"></span> Nicht gesehen</div>
-				@endif
+		@if(!is_null($film->gesehen))
+			<div class="label label-success"><span class="glyphicon glyphicon-check"></span> Gesehen am {{ \Carbon\Carbon::parse($film->gesehen)->format('d.m.Y') }}</div>
+		@else
+			<div class="label label-danger" <?php if(Auth::user()->admin) { echo "id='gesehen'"; } ?> style="cursor: pointer;"><span class="glyphicon glyphicon-unchecked"></span> Nicht gesehen</div>
+		@endif
 	</div>
 	<div class="col-md-9">
 		<ul class="nav nav-tabs">
@@ -37,7 +37,7 @@
 				<dd>{{ $tfilm['original_title'] }}</dd>
 				<dt>Erschienen</dt>
 				<dd>
-					{{ $tfilm['release_date']}} -
+					{{ \Carbon\Carbon::parse($tfilm['release_date'])->format('d.m.Y')}} -
 					@foreach($tfilm['production_countries'] as $pc)
 						<abbr title="{{$pc['name']}}">{{$pc['iso_3166_1']}}</abbr> 
 					@endforeach
@@ -61,7 +61,7 @@
 
 				<p></p>
 				<dt>Inhalt</dt>
-				<dd>{{ $tfilm['overview'] }}</dd>
+				<dd>{{ nl2br($tfilm['overview']) }}</dd>
 			</dl>
 		</div>
 		<div class="tab-pane" id="cast">
@@ -90,41 +90,116 @@
 
 <div class="clearfix"></div>
 <hr>
+@if($votes > 0 || is_null($film->gesehen))
 @if($votes > 0)
 <h2>Abstimmung</h2>
-<p>Insgesamt haben <b>{{$votes}}</b> Personen abgestimmt. <b>{{$vposi}}</b> davon waren <i>dafür</i>.
+<p>Insgesamt haben <b>{{$votes}}</b> Personen abgestimmt. <b>{{$vposi}}</b> davon waren <i>daf&uuml;r</i>. @if($uvote[0])
+	Du hast <i>{{ $uvote[1] ? "daf&uuml;r" : "dagegen"}}</i> gestimmt.
+@endif
 
 <div class="progress">
-  <div class="progress-bar progress-bar-success" style="width: {{ $vposi / $votes * 100}}%">
-    <span class="sr-only">{{$vposi}} von {{$votes}} (dafür)</span>
+  <div class="progress-bar progress-bar-success tooltip-enable" style="width: {{ $vposi / $votes * 100}}%" data-toggle="tooltip" data-title="{{$pv}}">
+    <span class="sr-only">{{$vposi}} von {{$votes}} (daf&uuml;r)</span>
   </div>
-  <div class="progress-bar progress-bar-danger" style="width: 10%">
-    <span class="sr-only">{{ $votes - $vposi}} von {{ $votes }} Complete (dagegen)</span>
+  <div class="progress-bar progress-bar-danger tooltip-enable" style="width: {{ ($votes - $vposi) / $votes * 100}}%" data-toggle="tooltip" data-title="{{$nv}}">
+    <span class="sr-only">{{ $votes - $vposi}} von {{ $votes }} (dagegen)</span>
   </div>
 </div>
-
+@endif
+@if(is_null($film->gesehen))
+<div class="container" style="text-align: center">
+	<div class="btn-group">
+		<a class="btn btn-lg btn-success <?php echo $uvote[0] && $uvote[1] ? "disabled" : ""; ?>" href="{{ url('vote', array('yes', Auth::user()->id, $film->id)) }}">
+			<span class="glyphicon glyphicon-thumbs-up"></span> Daf&uuml;r
+		</a>
+		<a class="btn btn-lg btn-danger <?php echo $uvote[0] && !$uvote[1] ? "disabled" : ""; ?>"  href="{{ url('vote', array('no', Auth::user()->id, $film->id)) }}">
+			<span class="glyphicon glyphicon-thumbs-down"></span> Dagegen
+		</a>
+	</div>
+</div>
+@endif
 <hr>@endif
 
 <h2>Kommentare</h2>
 
+@if(is_null(Auth::user()))
 <p>Melde Dich an, um diesen Film zu kommentieren.</p>
+@else
+<div class="media">
+	<div class="pull-left">
+		<img class="media-object" src="{{ "http://www.gravatar.com/avatar/" . md5( strtolower( trim( Auth::user()->email ) ) ) . "?s=40" }}">
+	</div>
+	<div class="media-body">
+		<h4 class="media-heading">Neuer Kommentar</h4>
+		{{Form::open(array('route' => 'comment'))}}
+			<input type="hidden" name="user" value="{{Auth::user()->id}}">
+			<input type="hidden" name="film" value="{{$film->id}}">
+			<div class="form-group"><textarea class="form-control" rows="1" name="text"></textarea></div>
+			<div class="form-group"><button type="submit" class="btn btn-primary btn-xs">Absenden</button></div>
+		{{Form::close()}}
+	</div>
+</div>
+@endif
 
 @foreach($comments as $comment)
 
 <div class="media">
-	<a class="pull-left" href="#">
+	<div class="pull-left">
 		<img class="media-object" src="{{ "http://www.gravatar.com/avatar/" . md5( strtolower( trim( $comment->autor->email ) ) ) . "?s=40" }}" alt="{{ $comment->autor->name }}">
-	</a>
-	<div class="media-body">
-		<h4 class="media-heading">{{ $comment->autor->name }} <small>{{$comment->updated_at}}</small></h4>
-		{{$comment->text}}
+	</div>
+	<div class="media-body" id="comment{{$comment->id}}">
+		<h5 class="media-heading">{{ $comment->autor->name }} <small>{{\Carbon\Carbon::parse($comment->created_at)->format('d.m.Y H:i')}}
+		@if($comment->updated_at != $comment->created_at)
+		 &mdash; Zuletzt bearbeitet: {{\Carbon\Carbon::parse($comment->updated_at)->format('d.m.Y H:i')}}
+		@endif
+		</small></h5>
+		@if(!is_null(Auth::user()) && Auth::user()->id === $comment->autor->id)
+		<div class="collapse in" data-parent="#comment{{$comment->id}}" id="comment{{$comment->id}}comment">
+			<p>{{$comment->text}}</p>
+			<button type="button" class="btn btn-xs" onclick="toggleComment('#comment{{$comment->id}}')">Bearbeiten</button>
+		</div>
+		<div class="collapse" id="comment{{$comment->id}}edit">
+			{{Form::open(array('route' => 'modcomment'))}}
+				<input type="hidden" name="id" value="{{$comment->id}}">
+				<div class="form-group"><textarea class="form-control" rows="1" name="text">{{$comment->text}}</textarea></div>
+				<div class="form-group">
+					<button type="submit" class="btn btn-primary btn-xs">Absenden</button>
+					<button type="button" class="btn btn-xs" onclick="toggleComment('#comment{{$comment->id}}')">Abbrechen</button>
+				</div>
+			{{Form::close()}}
+		</div>
+		@else
+		<p>{{$comment->text}}</p>
+		@endif
 	</div>
 </div>
-
 @endforeach
 
 
 
+@stop
+
+@section('script')
+<script type="text/javascript">
+	function toggleComment(id) {
+		$(id + 'edit').collapse('toggle');
+		$(id + 'comment').collapse('toggle');
+	}
+
+	$(function() {
+		$('.tooltip-enable').tooltip({ html: true, placement: "bottom" });
+	});
+
+	$(function() {
+		$('#gesehen').popover({
+			html: true,
+			placement: "right",
+			trigger: "click",
+			title: "Als gesehen markieren",
+			content: "<div class='container'><a href='{{ url('mark-read/' . $film->id) }}' class='btn btn-success'>Film als gesehen markieren</a></div>"
+		});
+	});
+</script>
 @stop
 
 @section('title')

+ 36 - 4
app/views/hello.blade.php

@@ -21,16 +21,47 @@
 			</div>     
 		    <div class="navbar-collapse collapse">
 				<ul class="nav navbar-nav">
-					<li>{{ HTML::link('/', 'Vorschläge') }}</li>
-					<li>{{ HTML::link('/', 'Liste') }}</li>
+					<li>{{ HTML::link('vorgeschlagen', 'Vorgeschlagen') }}</li>
+					<li>{{ HTML::link('gesehen', 'Gesehen') }}</li>
+					<li>{{ HTML::link('neu', 'Film vorschlagen')}}
 				</ul>
-				<ul class="nav navbar-nav pull-right">
+				<ul class="nav navbar-nav pull-right">			$U->save;
+
+					@if(is_null(Auth::user()))
 					<li>{{ HTML::link('login', 'Login') }}</li>
+					@else
+					<li class="dropdown">
+						<a class="dropdown-toggle" data-toggle="dropdown" href="#">{{Auth::user()->name}} <span class="caret"></span></a>
+						<ul class="dropdown-menu">
+							<li>{{ HTML::link('settings', 'Passwort &amp; Email &auml;ndern')}}</li>
+							@if(Auth::user()->admin)
+							<li>{{ HTML::link('users', 'Benutzerverwaltung')}}</li>
+							@endif
+							<li class="divider"></li>
+							<li>{{ HTML::link('logout', "Logout")}}
+						</ul>
+					</li>
+					@endif
 				</ul>
 		    </div>
 	    </div>
     </div>
-
+@if(isset($message))
+<div class="container">
+	<div class="alert alert-success alert-dismissable">
+	  <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
+	  {{ $message }}
+	</div>
+</div>
+@endif
+@if(Session::has('message'))
+<div class="container">
+	<div class="alert alert-success alert-dismissable">
+	  <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
+	  {{ Session::get('message') }}
+	</div>
+</div>
+@endif
 <div class="container" id="content">
 	@yield('content')
 </div>
@@ -45,5 +76,6 @@
 
 <script type="text/javascript" src="{{ asset('js/jquery-2.0.3.min.js') }}"></script>
 <script type="text/javascript" src="{{ asset('js/bootstrap.min.js') }}"></script>
+@yield('script')
 </body>
 </html>

+ 33 - 1
app/views/login.blade.php

@@ -1,7 +1,39 @@
 @extends('hello')
 
 @section('content')
-
+<div class="container" style="margin-top: 40px;">
+	<div class="row">
+		<div class="col-md-8 col-md-offset-2">
+			<div class="panel panel-default">
+				<div class="panel-heading"><h2 class="panel-title">Login</h2></div>
+				<div class="panel-body">
+					
+				{{ Form::open(array('route' => 'login')) }}
+					<div class="input-group form-group">
+						<span class="input-group-addon"><span class="glyphicon glyphicon-user"></span></span>
+						<input type="text" class="form-control " name="user" placeholder="Benutzername">
+					</div>
+					<div class="input-group form-group">
+						<span class="input-group-addon"><span class="glyphicon glyphicon-lock"></span></span>
+						<input type="password" class="form-control " name="password" placeholder="Passwort">
+					</div>
+					@if(Session::has('login_errors'))
+						<div class="alert alert-danger alert-dismissable">
+							<button type="button" class="close" data-dismiss="alert">&times;</button>
+							Login-Daten fehlerhaft!
+						</div>
+					@endif
+					<div class="form-group">
+						<button type="submit" class="btn btn-primary">Anmelden</button>
+						<p class="help-block"><a href="#">Passwort vergessen?</a><br>
+						<a href="{{ url('register') }}">Registrieren</a></p>
+					</div>
+				{{ Form::close()}}
+				</div>
+			</div>
+		</div>
+	</div>
+</div>
 @stop
 
 @section('title')

+ 59 - 0
app/views/new.blade.php

@@ -0,0 +1,59 @@
+@extends('hello')
+
+@section('content')
+	<div class="page-header"><h1>Film vorschlagen</h1></div>
+
+	<div class="container">
+		{{ Form::open(array('url' => 'neu')) }}
+		<div class="input-group">
+			<span class="input-group-addon"><span class="glyphicon glyphicon-search"></span></span>
+			<input type="search" name="search" class="form-control" placeholder="Filmname...">
+			<span class="input-group-btn">
+				<button type="submit" value="Suchen" class="btn btn-primary">
+					Suchen
+				</button>
+			</span>
+		</div>
+		{{ Form::close() }}
+	</div>
+
+
+<h2>Suchergebnisse</h2>
+	<p></p>
+
+@if(isset($result))
+<section id="results">
+	<table class="table">
+		<tr>
+			<th></th>
+			<th>Titel</th>
+			<th>Originaltitel</th>
+			<th>Veröffentlichung</th>
+			<th></th>
+		</tr>
+		@foreach($result['results'] as $r)
+		<tr>
+			<td>
+				<img src="{{ $tmdb->getImageUrl($r['poster_path'], TMDb::IMAGE_POSTER, 'w92'); }}" class="img-responsive img-thumbnail">
+			</td>
+			<td>{{ $r['title' ]}}</td>
+			<td>{{ $r['original_title']}}</td>
+			<td>{{ \Carbon\Carbon::parse($r['release_date'])->format('d.m.Y') }}</td>
+			<td>
+				<p><a class="btn btn-primary btn-xs" href="http://themoviedb.com/movie/{{$r['id']}}">themoviedb.org</a></p>
+				<p><a class="btn btn-default btn-xs" href="{{ url('vorschlag/' . $r['id']) }}">Film vorschlagen</a></p>
+			</td>
+		</tr>
+		@endforeach
+	</table>
+</section>
+
+
+<pre>{{var_dump($result)}}</pre>
+
+@endif
+@stop
+
+@section('title')
+	Neuer Film ~ 
+@stop

+ 63 - 0
app/views/register.blade.php

@@ -0,0 +1,63 @@
+@extends('hello')
+
+@section('content')
+<div class="container" style="margin-top: 40px;">
+	<div class="row">
+		<div class="col-md-8 col-md-offset-2">
+			<div class="panel panel-default">
+				<div class="panel-heading"><h2 class="panel-title">Registrieren</h2></div>
+				<div class="panel-body">
+					{{Form::open(array('url' => 'register'))}}
+						@if(count($errors->all()) > 0)
+							<div class="alert alert-danger alert-dismissable">
+								<button type="button" class="close" data-dismiss="alert">&times;</button>
+								Deine Registrierungsdaten sind fehlerhaft!
+							</div>
+						@endif
+						<div class="input-group form-group <?php if($errors->has('name')) echo "has-error" ?>">
+							<span class="input-group-addon">
+								<span class="glyphicon glyphicon-user"></span>
+							</span>
+							<input type="text" class="form-control" name="user" placeholder="Benutzername" <?php if(!is_null(Input::get('user'))) echo "value='" . Input::get('user') . "'"; ?>>
+						</div>
+						<div class="input-group form-group  <?php if($errors->has('email')) echo "has-error" ?>">
+							<span class="input-group-addon">
+								<span class="glyphicon glyphicon-envelope"></span>
+							</span>
+							<input type="email" class="form-control" name="email" placeholder="name@domain.tld" <?php if(!is_null(Input::get('email'))) echo "value='" . Input::get('email') . "'"; ?>>
+						</div>
+						<div class="input-group form-group  <?php if($errors->has('password')) echo "has-error" ?>">
+							<span class="input-group-addon">
+								<span class="glyphicon glyphicon-lock"></span>
+							</span>
+							<input type="password" class="form-control" name="password" placeholder="Passwort">
+						</div>
+						<div class="input-group form-group  <?php if($errors->has('password')) echo "has-error" ?>">
+							<span class="input-group-addon">
+								<span class="glyphicon glyphicon-lock"></span>
+							</span>
+							<input type="password" class="form-control" name="pw-confirm" placeholder="Passwort bestätigen">
+						</div>
+						<div class="form-group  <?php if($errors->has('fire')) echo "has-error" ?>">
+							<div class="input-group">
+								<span class="input-group-addon">
+									<span class="glyphicon glyphicon-fire"></span>
+								</span>
+								<input type="text" class="form-control" name="fire" placeholder="&pi; (pi) beschreibt welche geometrische Figur?" <?php if(!is_null(Input::get('fire'))) echo "value='" . Input::get('fire') . "'"; ?>>
+							</div>
+							<p class="help-block">Beantworte die Frage, um zu beweisen, dass Du kein Bot bist.</p>
+						</div>
+						<div class="form-group">
+							<button type="submit" class="btn btn-primary">Registrieren</button>
+						</div>
+					{{ Form::close() }}
+				</div>
+			</div>
+		</div>
+	</div>
+</div>
+@stop
+
+@section('title')
+Registrieren ~ 
+@stop

+ 39 - 0
app/views/seen.blade.php

@@ -0,0 +1,39 @@
+@extends('hello')
+
+@section('content')
+<div class="page-header"><h1>Gesehen</h1></div>
+
+{{ $filme->links() }}
+
+<table class="table">
+	<tr>
+		<th>Titel</th>
+		<th>Gesehen am</th>
+		<th>Vorgeschlagen von</th>
+		<th>Kommentare</th>
+	</tr>
+@foreach($filme as $film)
+	<tr>
+		<td>{{ HTML::link('film/' . $film->id, $film->name) }}</td>
+		<td>{{ \Carbon\Carbon::parse($film->gesehen)->format('d.m.Y')}}</td>
+		<td>{{ $film->besitzer->name }}</td>
+		<td>{{ $film->comments()->count()}}</td>
+	</tr>
+@endforeach
+</table>
+
+{{ $filme->links() }}
+
+@stop
+
+@section('title')
+Vorschläge ~
+@stop
+
+@section('script')
+<script type="text/javascript">
+	$(function() {
+		$('.tooltip-enable').tooltip({ html: true, placement: "bottom" });
+	});
+</script>
+@stop

+ 72 - 0
app/views/settings.blade.php

@@ -0,0 +1,72 @@
+@extends('hello')
+
+@section('content')
+<div class="container" style="margin-top: 40px;">
+	<div class="row">
+		<div class="col-md-8 col-md-offset-2">
+			<div class="panel panel-default">
+				<div class="panel-heading"><h2 class="panel-title">Passwort ändern</h2></div>
+				<div class="panel-body">
+					{{ Form::open(array('url' => 'settings/password')) }}
+						{{ $errors->first() }}
+						<div class="input-group form-group <?php if($errors->has('oldpw')) echo "has-error" ?>">
+							<span class="input-group-addon">
+								<span class="glyphicon glyphicon-lock"></span>
+							</span>
+							<input type="password" class="form-control" name="oldpw" placeholder="Altes Passwort">
+						</div>
+						<div class="input-group form-group <?php if($errors->has('newpw')) echo "has-error" ?>">
+							<span class="input-group-addon">
+								<span class="glyphicon glyphicon-lock"></span>
+							</span>
+							<input type="password" class="form-control" name="newpw" placeholder="Neues Passwort">
+						</div>
+						<div class="input-group form-group <?php if($errors->has('newpw')) echo "has-error" ?>">
+							<span class="input-group-addon">
+								<span class="glyphicon glyphicon-lock"></span>
+							</span>
+							<input type="password" class="form-control" name="newpw2" placeholder="Neues Passwort bestätigen">
+						</div>
+						<button type="submit" class="btn btn-primary">Absenden</button>
+					{{ Form::close() }}
+				</div>
+			</div>
+		</div>
+	</div>
+
+	<div class="row">
+		<div class="col-md-8 col-md-offset-2">
+			<div class="panel panel-default">
+				<div class="panel-heading"><h2 class="panel-title">Email ändern</h2></div>
+				<div class="panel-body">
+					{{ Form::open(array('url' => 'settings/email')) }}
+						<div class="input-group form-group <?php if($errors->has('pw')) echo "has-error" ?>">
+							<span class="input-group-addon">
+								<span class="glyphicon glyphicon-lock"></span>
+							</span>
+							<input type="password" class="form-control" name="pw" placeholder="Passwort">
+						</div>
+						<div class="input-group form-group <?php if($errors->has('email')) echo "has-error" ?>">
+							<span class="input-group-addon">
+								<span class="glyphicon glyphicon-envelope"></span>
+							</span>
+							<input type="email" class="form-control" name="email" placeholder="Neue Email">
+						</div>
+						<div class="input-group form-group <?php if($errors->has('email')) echo "has-error" ?>">
+							<span class="input-group-addon">
+								<span class="glyphicon glyphicon-envelope"></span>
+							</span>
+							<input type="email" class="form-control" name="email2" placeholder="Neue Email bestätigen">
+						</div>
+						<button type="submit" class="btn btn-primary">Absenden</button>
+					{{ Form::close() }}
+				</div>
+			</div>
+		</div>
+	</div>
+</div>
+@stop
+
+@section('title')
+Einstellungen ~
+@stop

+ 52 - 0
app/views/suggest.blade.php

@@ -0,0 +1,52 @@
+@extends('hello')
+
+@section('content')
+<div class="page-header"><h1>Vorschläge</h1></div>
+
+{{ $filme->links() }}
+
+<table class="table">
+	<tr>
+		<th>Titel</th>
+		<th>Stimmen</th>
+		<th>Vorgeschlagen am</th>
+		<th>Vorgeschlagen von</th>
+	</tr>
+@foreach($filme as $film)
+	<tr>
+		<td>{{ HTML::link('film/' . $film->id, $film->name) }}</td>
+		<td>
+			<?php 
+				$vp = $film->votes()->where('stimme', true)->count(); 
+				$np = $film->votes()->where('stimme', false)->count();
+			?>
+			<div class="progress tooltip-enable" data-toggle="tooltip" title="{{ $vp }}/{{ $np }}">
+  				<div class="progress-bar progress-bar-success" style="width: <?php if(($vp + $np) > 0) echo ($vp / ($vp + $np)  * 100); else echo 0; ?>%">
+    				<span class="sr-only">{{$vp}} von {{$vp + $np}} (daf&uuml;r)</span>
+  				</div>
+  				<div class="progress-bar progress-bar-danger" style="width: <?php if(($vp + $np) > 0) echo ($vp / ($vp + $np)  * 100); else echo 0; ?>%">
+    				<span class="sr-only">{{$np}} von {{$vp + $np}} (dagegen)</span>
+  				</div>
+			</div>
+		</td>
+		<td>{{ \Carbon\Carbon::parse($film->vorgeschlagen)->format('d.m.Y')}}</td>
+		<td>{{ $film->besitzer->name }}</td>
+	</tr>
+@endforeach
+</table>
+
+{{ $filme->links() }}
+
+@stop
+
+@section('title')
+Vorschläge ~
+@stop
+
+@section('script')
+<script type="text/javascript">
+	$(function() {
+		$('.tooltip-enable').tooltip({ html: true, placement: "bottom" });
+	});
+</script>
+@stop

+ 45 - 0
app/views/users.blade.php

@@ -0,0 +1,45 @@
+@extends('hello')
+
+@section('content')
+<div class="page-header"><h1>Benutzerverwaltung</h1></div>
+
+{{$users->links()}}
+
+<table class="table">
+	<tr>
+		<th>Name</th>
+		<th>Email</th>
+		<th>Filme</th>
+		<th>Kommentare</th>
+		<th>Aktion</th>
+	</tr>
+@foreach($users as $user)
+	<tr>
+		<td>{{$user->name}}</td>
+		<td>{{$user->email}}</td>
+		<td>{{$user->films()->count()}}</td>
+		<td>{{$user->comments()->count()}}</td>
+		<td>
+			@if($user->admin)
+				@if($user->name != "Daniel")
+				<button class="btn btn-primary btn-xs" type="button">Admin</button>
+				<a class="btn btn-warning btn-xs" type="button" href="{{ url('users/rmadm/' . $user->id) }}">Rechte entziehen</a>
+				@else
+				&mdash;
+				@endif
+			@else
+				<a class="btn btn-default btn-xs" type="button" href="{{ url('users/mkadm/' . $user->id) }}">Zum Admin machen</a>
+				<a class="btn btn-danger btn-xs" type="button" href="{{ url('users/rmusr/' . $user->id) }}">Löschen</a>
+			@endif
+		</td>
+	</tr>
+@endforeach
+</table>
+
+{{$users->links()}}
+
+@stop
+
+@section('title')
+Benutzerverwaltung ~ 
+@stop