Daniel %!s(int64=9) %!d(string=hai) anos
pai
achega
0b4efeb2ed
Modificáronse 7 ficheiros con 622 adicións e 412 borrados
  1. 172 146
      .idea/workspace.xml
  2. 6 0
      app/models/Film.php
  3. 1 1
      app/models/Vote.php
  4. 363 260
      app/routes.php
  5. 2 1
      app/views/hello.blade.php
  6. 19 4
      app/views/seen.blade.php
  7. 59 0
      app/views/stats.blade.php

+ 172 - 146
.idea/workspace.xml

@@ -2,6 +2,12 @@
 <project version="4">
   <component name="ChangeListManager">
     <list default="true" id="80f2fc29-4939-4e5d-80a5-cd8ec589ca07" name="Default" comment="">
+      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/app/views/stats.blade.php" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/models/Film.php" afterPath="$PROJECT_DIR$/app/models/Film.php" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/models/Vote.php" afterPath="$PROJECT_DIR$/app/models/Vote.php" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/views/hello.blade.php" afterPath="$PROJECT_DIR$/app/views/hello.blade.php" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/routes.php" afterPath="$PROJECT_DIR$/app/routes.php" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/views/seen.blade.php" afterPath="$PROJECT_DIR$/app/views/seen.blade.php" />
       <change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
     </list>
     <ignored path="dumbo.iws" />
@@ -28,47 +34,37 @@
   </component>
   <component name="FileEditorManager">
     <leaf>
-      <file leaf-file-name="hello.blade.php" pinned="false" current-in-tab="false">
+      <file leaf-file-name="hello.blade.php" pinned="false" current-in-tab="true">
         <entry file="file://$PROJECT_DIR$/app/views/hello.blade.php">
           <provider selected="true" editor-type-id="text-editor">
-            <state vertical-scroll-proportion="-4.576271">
-              <caret line="15" column="67" selection-start-line="15" selection-start-column="67" selection-end-line="15" selection-end-column="67" />
+            <state vertical-scroll-proportion="0.69417477">
+              <caret line="75" column="31" selection-start-line="75" selection-start-column="31" selection-end-line="75" selection-end-column="31" />
               <folding />
             </state>
           </provider>
         </entry>
       </file>
-      <file leaf-file-name="index.blade.php" pinned="false" current-in-tab="true">
-        <entry file="file://$PROJECT_DIR$/app/views/index.blade.php">
+      <file leaf-file-name="film.blade.php" pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/app/views/film.blade.php">
           <provider selected="true" editor-type-id="text-editor">
-            <state vertical-scroll-proportion="0.6803279">
-              <caret line="100" column="8" selection-start-line="100" selection-start-column="8" selection-end-line="100" selection-end-column="8" />
-              <folding>
-                <element signature="e#264#310#0#HTML" expanded="true" />
-                <element signature="e#1033#1079#0#HTML" expanded="true" />
-                <element signature="e#2447#2493#0#HTML" expanded="true" />
-                <element signature="e#3867#3913#0#HTML" expanded="true" />
-                <element signature="e#5268#5295#0#HTML" expanded="true" />
-                <element signature="e#5592#5637#0#HTML" expanded="true" />
-                <element signature="e#5891#5920#0#HTML" expanded="true" />
-              </folding>
+            <state vertical-scroll-proportion="-28.296297">
+              <caret line="78" column="70" selection-start-line="78" selection-start-column="54" selection-end-line="78" selection-end-column="70" />
+              <folding />
             </state>
           </provider>
         </entry>
       </file>
-      <file leaf-file-name="film.blade.php" pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/app/views/film.blade.php">
+      <file leaf-file-name="stats.blade.php" pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/app/views/stats.blade.php">
           <provider selected="true" editor-type-id="text-editor">
-            <state vertical-scroll-proportion="-7.322034">
-              <caret line="78" column="276" selection-start-line="78" selection-start-column="276" selection-end-line="78" selection-end-column="276" />
+            <state vertical-scroll-proportion="-24.666666">
+              <caret line="37" column="123" selection-start-line="37" selection-start-column="123" selection-end-line="37" selection-end-column="123" />
               <folding>
-                <element signature="e#2694#2718#0#HTML" expanded="true" />
-                <element signature="e#2838#2881#0#HTML" expanded="true" />
-                <element signature="e#4487#4513#0#HTML" expanded="true" />
-                <element signature="e#5611#5636#0#HTML" expanded="true" />
-                <element signature="e#7160#7186#0#HTML" expanded="true" />
-                <element signature="e#7565#7590#0#HTML" expanded="true" />
-                <element signature="e#8470#8496#0#HTML" expanded="true" />
+                <element signature="e#559#583#0#HTML" expanded="true" />
+                <element signature="e#908#932#0#HTML" expanded="true" />
+                <element signature="e#1597#1622#0#HTML" expanded="true" />
+                <element signature="e#1745#1769#0#HTML" expanded="true" />
+                <element signature="e#2114#2138#0#HTML" expanded="true" />
               </folding>
             </state>
           </provider>
@@ -77,18 +73,21 @@
       <file leaf-file-name="seen.blade.php" pinned="false" current-in-tab="false">
         <entry file="file://$PROJECT_DIR$/app/views/seen.blade.php">
           <provider selected="true" editor-type-id="text-editor">
-            <state vertical-scroll-proportion="-17.703703">
-              <caret line="31" column="7" selection-start-line="31" selection-start-column="7" selection-end-line="31" selection-end-column="7" />
-              <folding />
+            <state vertical-scroll-proportion="-16.666666">
+              <caret line="25" column="22" selection-start-line="25" selection-start-column="22" selection-end-line="25" selection-end-column="22" />
+              <folding>
+                <marker date="1445430515071" expanded="true" signature="1732:1816" placeholder="..." />
+                <marker date="1445430515071" expanded="true" signature="1744:1810" placeholder="..." />
+              </folding>
             </state>
           </provider>
         </entry>
       </file>
-      <file leaf-file-name="users.blade.php" pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/app/views/users.blade.php">
+      <file leaf-file-name="Film.php" pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/app/models/Film.php">
           <provider selected="true" editor-type-id="text-editor">
-            <state vertical-scroll-proportion="-5.4915257">
-              <caret line="18" column="74" selection-start-line="18" selection-start-column="74" selection-end-line="18" selection-end-column="74" />
+            <state vertical-scroll-proportion="-7.3703704">
+              <caret line="26" column="41" selection-start-line="26" selection-start-column="41" selection-end-line="26" selection-end-column="41" />
               <folding />
             </state>
           </provider>
@@ -97,8 +96,8 @@
       <file leaf-file-name="suggest.blade.php" pinned="false" current-in-tab="false">
         <entry file="file://$PROJECT_DIR$/app/views/suggest.blade.php">
           <provider selected="true" editor-type-id="text-editor">
-            <state vertical-scroll-proportion="-9.762712">
-              <caret line="44" column="110" selection-start-line="44" selection-start-column="110" selection-end-line="44" selection-end-column="110" />
+            <state vertical-scroll-proportion="-24.0">
+              <caret line="39" column="18" selection-start-line="39" selection-start-column="18" selection-end-line="39" selection-end-column="18" />
               <folding />
             </state>
           </provider>
@@ -107,8 +106,8 @@
       <file leaf-file-name="routes.php" pinned="false" current-in-tab="false">
         <entry file="file://$PROJECT_DIR$/app/routes.php">
           <provider selected="true" editor-type-id="text-editor">
-            <state vertical-scroll-proportion="-16.666666">
-              <caret line="37" column="31" selection-start-line="37" selection-start-column="31" selection-end-line="37" selection-end-column="31" />
+            <state vertical-scroll-proportion="-1.7037038">
+              <caret line="502" column="92" selection-start-line="502" selection-start-column="92" selection-end-line="502" selection-end-column="92" />
               <folding>
                 <element signature="e#7#392#0#PHP" expanded="true" />
               </folding>
@@ -126,26 +125,6 @@
           </provider>
         </entry>
       </file>
-      <file leaf-file-name="Film.php" pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/app/models/Film.php">
-          <provider selected="true" editor-type-id="text-editor">
-            <state vertical-scroll-proportion="-26.37037">
-              <caret line="49" column="124" selection-start-line="49" selection-start-column="124" selection-end-line="49" selection-end-column="124" />
-              <folding />
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file leaf-file-name="User.php" pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/app/models/User.php">
-          <provider selected="true" editor-type-id="text-editor">
-            <state vertical-scroll-proportion="-26.666666">
-              <caret line="87" column="46" selection-start-line="87" selection-start-column="46" selection-end-line="87" selection-end-column="46" />
-              <folding />
-            </state>
-          </provider>
-        </entry>
-      </file>
     </leaf>
   </component>
   <component name="Git.Settings">
@@ -173,15 +152,19 @@
         <option value="$PROJECT_DIR$/app/models/User.php" />
         <option value="$PROJECT_DIR$/public/css/boostrap-paper.min.css" />
         <option value="$PROJECT_DIR$/public/css/bootstrap-superhero.min.css" />
-        <option value="$PROJECT_DIR$/app/views/hello.blade.php" />
-        <option value="$PROJECT_DIR$/app/models/Film.php" />
-        <option value="$PROJECT_DIR$/app/routes.php" />
         <option value="$PROJECT_DIR$/app/views/users.blade.php" />
         <option value="$PROJECT_DIR$/app/views/suggest.blade.php" />
         <option value="$PROJECT_DIR$/app/views/film.blade.php" />
-        <option value="$PROJECT_DIR$/app/views/seen.blade.php" />
         <option value="$PROJECT_DIR$/app/models/Comment.php" />
         <option value="$PROJECT_DIR$/app/views/index.blade.php" />
+        <option value="$PROJECT_DIR$/app/libraries/stats.php" />
+        <option value="$PROJECT_DIR$/app/config/constants.php" />
+        <option value="$PROJECT_DIR$/app/models/Film.php" />
+        <option value="$PROJECT_DIR$/app/views/seen.blade.php" />
+        <option value="$PROJECT_DIR$/app/models/Vote.php" />
+        <option value="$PROJECT_DIR$/app/views/stats.blade.php" />
+        <option value="$PROJECT_DIR$/app/routes.php" />
+        <option value="$PROJECT_DIR$/app/views/hello.blade.php" />
       </list>
     </option>
   </component>
@@ -232,10 +215,10 @@
     </include_path>
   </component>
   <component name="ProjectFrameBounds">
-    <option name="x" value="48" />
-    <option name="y" value="212" />
-    <option name="width" value="1797" />
-    <option name="height" value="955" />
+    <option name="x" value="138" />
+    <option name="y" value="27" />
+    <option name="width" value="1782" />
+    <option name="height" value="1045" />
   </component>
   <component name="ProjectInspectionProfilesVisibleTreeState">
     <entry key="Project Default">
@@ -279,8 +262,6 @@
       <sortByType />
     </navigator>
     <panes>
-      <pane id="Scratches" />
-      <pane id="Scope" />
       <pane id="ProjectPane">
         <subPane>
           <PATH>
@@ -349,8 +330,46 @@
               <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
             </PATH_ELEMENT>
           </PATH>
+          <PATH>
+            <PATH_ELEMENT>
+              <option name="myItemId" value="dumbo" />
+              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+            </PATH_ELEMENT>
+            <PATH_ELEMENT>
+              <option name="myItemId" value="dumbo" />
+              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+            </PATH_ELEMENT>
+            <PATH_ELEMENT>
+              <option name="myItemId" value="app" />
+              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+            </PATH_ELEMENT>
+            <PATH_ELEMENT>
+              <option name="myItemId" value="libraries" />
+              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+            </PATH_ELEMENT>
+          </PATH>
+          <PATH>
+            <PATH_ELEMENT>
+              <option name="myItemId" value="dumbo" />
+              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+            </PATH_ELEMENT>
+            <PATH_ELEMENT>
+              <option name="myItemId" value="dumbo" />
+              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+            </PATH_ELEMENT>
+            <PATH_ELEMENT>
+              <option name="myItemId" value="app" />
+              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+            </PATH_ELEMENT>
+            <PATH_ELEMENT>
+              <option name="myItemId" value="config" />
+              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+            </PATH_ELEMENT>
+          </PATH>
         </subPane>
       </pane>
+      <pane id="Scratches" />
+      <pane id="Scope" />
     </panes>
   </component>
   <component name="PropertiesComponent">
@@ -358,10 +377,13 @@
     <property name="list.type.of.created.stylesheet" value="CSS" />
     <property name="LayoutCode.rearrangeEntriesBlade" value="false" />
     <property name="FullScreen" value="false" />
-    <property name="settings.editor.selected.configurable" value="Errors" />
+    <property name="settings.editor.selected.configurable" value="preferences.sourceCode" />
     <property name="settings.editor.splitter.proportion" value="0.2" />
   </component>
   <component name="RecentsManager">
+    <key name="CopyFile.RECENT_KEYS">
+      <recent name="$PROJECT_DIR$/app/views" />
+    </key>
     <key name="MoveFile.RECENT_KEYS">
       <recent name="$PROJECT_DIR$/public/img" />
     </key>
@@ -435,33 +457,39 @@
       <option name="project" value="LOCAL" />
       <updated>1445406233308</updated>
     </task>
-    <option name="localTasksCounter" value="6" />
+    <task id="LOCAL-00006" summary="Index Layout">
+      <created>1445406247412</created>
+      <option name="number" value="00006" />
+      <option name="project" value="LOCAL" />
+      <updated>1445406247412</updated>
+    </task>
+    <option name="localTasksCounter" value="7" />
     <servers />
   </component>
   <component name="ToolWindowManager">
-    <frame x="48" y="212" width="1797" height="955" extended-state="0" />
+    <frame x="138" y="27" width="1782" height="1045" extended-state="0" />
     <editor active="true" />
     <layout>
-      <window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
       <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
       <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
       <window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
       <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
       <window_info id="Application Servers" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
-      <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.16771609" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
+      <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.16974595" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
       <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
       <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
       <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
       <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
       <window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
       <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
-      <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
       <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
+      <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
       <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
+      <window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
       <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
-      <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
-      <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
       <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
+      <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
+      <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
     </layout>
     <layout-to-restore>
       <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
@@ -481,9 +509,9 @@
       <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
       <window_info id="Application Servers" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="12" side_tool="false" content_ui="tabs" />
       <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.25551602" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
-      <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
-      <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
       <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
+      <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
+      <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
     </layout-to-restore>
   </component>
   <component name="Vcs.Log.UiProperties">
@@ -509,28 +537,6 @@
     <watches-manager />
   </component>
   <component name="editorHistoryManager">
-    <entry file="file://$PROJECT_DIR$/app/routes.php">
-      <provider selected="true" editor-type-id="text-editor">
-        <state vertical-scroll-proportion="0.0">
-          <caret line="39" column="23" selection-start-line="39" selection-start-column="23" selection-end-line="39" selection-end-column="23" />
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/public/.htaccess">
-      <provider selected="true" editor-type-id="text-editor">
-        <state vertical-scroll-proportion="0.0">
-          <caret line="6" column="31" selection-start-line="6" selection-start-column="31" selection-end-line="6" selection-end-column="31" />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/app/views/index.blade.php">
-      <provider selected="true" editor-type-id="text-editor">
-        <state vertical-scroll-proportion="0.0">
-          <caret line="11" column="65" selection-start-line="11" selection-start-column="65" selection-end-line="11" selection-end-column="65" />
-        </state>
-      </provider>
-    </entry>
     <entry file="file://$PROJECT_DIR$/app/views/hello.blade.php">
       <provider selected="true" editor-type-id="text-editor">
         <state vertical-scroll-proportion="0.0">
@@ -584,7 +590,9 @@
       <provider selected="true" editor-type-id="text-editor">
         <state vertical-scroll-proportion="0.0">
           <caret line="42" column="37" selection-start-line="42" selection-start-column="37" selection-end-line="42" selection-end-column="37" />
-          <folding />
+          <folding>
+            <element signature="e#7#392#0#PHP" expanded="true" />
+          </folding>
         </state>
       </provider>
     </entry>
@@ -786,7 +794,6 @@
       <provider selected="true" editor-type-id="text-editor">
         <state vertical-scroll-proportion="0.0">
           <caret line="27" column="94" selection-start-line="27" selection-start-column="94" selection-end-line="27" selection-end-column="94" />
-          <folding />
         </state>
       </provider>
     </entry>
@@ -808,78 +815,95 @@
     </entry>
     <entry file="file://$PROJECT_DIR$/app/models/User.php">
       <provider selected="true" editor-type-id="text-editor">
-        <state vertical-scroll-proportion="-26.666666">
+        <state vertical-scroll-proportion="0.0">
           <caret line="87" column="46" selection-start-line="87" selection-start-column="46" selection-end-line="87" selection-end-column="46" />
           <folding />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/app/routes.php">
+    <entry file="file://$PROJECT_DIR$/app/views/users.blade.php">
       <provider selected="true" editor-type-id="text-editor">
-        <state vertical-scroll-proportion="-16.666666">
-          <caret line="37" column="31" selection-start-line="37" selection-start-column="31" selection-end-line="37" selection-end-column="31" />
-          <folding>
-            <element signature="e#7#392#0#PHP" expanded="true" />
-          </folding>
+        <state vertical-scroll-proportion="0.0">
+          <caret line="18" column="74" selection-start-line="18" selection-start-column="74" selection-end-line="18" selection-end-column="74" />
+          <folding />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/app/views/suggest.blade.php">
+    <entry file="file://$PROJECT_DIR$/app/views/index.blade.php">
       <provider selected="true" editor-type-id="text-editor">
-        <state vertical-scroll-proportion="-9.762712">
-          <caret line="44" column="110" selection-start-line="44" selection-start-column="110" selection-end-line="44" selection-end-column="110" />
+        <state vertical-scroll-proportion="1.8504673">
+          <caret line="100" column="8" selection-start-line="100" selection-start-column="8" selection-end-line="100" selection-end-column="8" />
           <folding />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/app/views/users.blade.php">
+    <entry file="file://$PROJECT_DIR$/app/config/constants.php">
       <provider selected="true" editor-type-id="text-editor">
-        <state vertical-scroll-proportion="-5.4915257">
-          <caret line="18" column="74" selection-start-line="18" selection-start-column="74" selection-end-line="18" selection-end-column="74" />
-          <folding />
+        <state vertical-scroll-proportion="0.0">
+          <caret line="6" column="54" selection-start-line="6" selection-start-column="54" selection-end-line="6" selection-end-column="54" />
+          <folding>
+            <element signature="e#6#35#0#PHP" expanded="false" />
+          </folding>
         </state>
       </provider>
     </entry>
     <entry file="file://$PROJECT_DIR$/app/views/seen.blade.php">
       <provider selected="true" editor-type-id="text-editor">
-        <state vertical-scroll-proportion="-17.703703">
-          <caret line="31" column="7" selection-start-line="31" selection-start-column="7" selection-end-line="31" selection-end-column="7" />
+        <state vertical-scroll-proportion="-16.666666">
+          <caret line="25" column="22" selection-start-line="25" selection-start-column="22" selection-end-line="25" selection-end-column="22" />
+          <folding>
+            <marker date="1445430515071" expanded="true" signature="1732:1816" placeholder="..." />
+            <marker date="1445430515071" expanded="true" signature="1744:1810" placeholder="..." />
+          </folding>
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/app/models/Film.php">
+      <provider selected="true" editor-type-id="text-editor">
+        <state vertical-scroll-proportion="-7.3703704">
+          <caret line="26" column="41" selection-start-line="26" selection-start-column="41" selection-end-line="26" selection-end-column="41" />
           <folding />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/app/views/film.blade.php">
+    <entry file="file://$PROJECT_DIR$/app/models/Vote.php">
       <provider selected="true" editor-type-id="text-editor">
-        <state vertical-scroll-proportion="-7.322034">
-          <caret line="78" column="276" selection-start-line="78" selection-start-column="276" selection-end-line="78" selection-end-column="276" />
-          <folding>
-            <element signature="e#2694#2718#0#HTML" expanded="true" />
-            <element signature="e#2838#2881#0#HTML" expanded="true" />
-            <element signature="e#4487#4513#0#HTML" expanded="true" />
-            <element signature="e#5611#5636#0#HTML" expanded="true" />
-            <element signature="e#7160#7186#0#HTML" expanded="true" />
-            <element signature="e#7565#7590#0#HTML" expanded="true" />
-            <element signature="e#8470#8496#0#HTML" expanded="true" />
-          </folding>
+        <state vertical-scroll-proportion="-3.3333333">
+          <caret line="5" column="22" selection-start-line="5" selection-start-column="22" selection-end-line="5" selection-end-column="22" />
+          <folding />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/app/views/hello.blade.php">
+    <entry file="file://$PROJECT_DIR$/app/views/suggest.blade.php">
       <provider selected="true" editor-type-id="text-editor">
-        <state vertical-scroll-proportion="-4.576271">
-          <caret line="15" column="67" selection-start-line="15" selection-start-column="67" selection-end-line="15" selection-end-column="67" />
+        <state vertical-scroll-proportion="-24.0">
+          <caret line="39" column="18" selection-start-line="39" selection-start-column="18" selection-end-line="39" selection-end-column="18" />
           <folding />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/app/models/Film.php">
+    <entry file="file://$PROJECT_DIR$/app/views/film.blade.php">
       <provider selected="true" editor-type-id="text-editor">
-        <state vertical-scroll-proportion="-26.37037">
-          <caret line="49" column="124" selection-start-line="49" selection-start-column="124" selection-end-line="49" selection-end-column="124" />
+        <state vertical-scroll-proportion="-28.296297">
+          <caret line="78" column="70" selection-start-line="78" selection-start-column="54" selection-end-line="78" selection-end-column="70" />
           <folding />
         </state>
       </provider>
     </entry>
+    <entry file="file://$PROJECT_DIR$/app/views/stats.blade.php">
+      <provider selected="true" editor-type-id="text-editor">
+        <state vertical-scroll-proportion="-24.666666">
+          <caret line="37" column="123" selection-start-line="37" selection-start-column="123" selection-end-line="37" selection-end-column="123" />
+          <folding>
+            <element signature="e#559#583#0#HTML" expanded="true" />
+            <element signature="e#908#932#0#HTML" expanded="true" />
+            <element signature="e#1597#1622#0#HTML" expanded="true" />
+            <element signature="e#1745#1769#0#HTML" expanded="true" />
+            <element signature="e#2114#2138#0#HTML" expanded="true" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
     <entry file="file://$PROJECT_DIR$/app/models/Comment.php">
       <provider selected="true" editor-type-id="text-editor">
         <state vertical-scroll-proportion="-9.333333">
@@ -888,21 +912,23 @@
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/app/views/index.blade.php">
+    <entry file="file://$PROJECT_DIR$/app/routes.php">
       <provider selected="true" editor-type-id="text-editor">
-        <state vertical-scroll-proportion="0.6803279">
-          <caret line="100" column="8" selection-start-line="100" selection-start-column="8" selection-end-line="100" selection-end-column="8" />
+        <state vertical-scroll-proportion="-1.7037038">
+          <caret line="502" column="92" selection-start-line="502" selection-start-column="92" selection-end-line="502" selection-end-column="92" />
           <folding>
-            <element signature="e#264#310#0#HTML" expanded="true" />
-            <element signature="e#1033#1079#0#HTML" expanded="true" />
-            <element signature="e#2447#2493#0#HTML" expanded="true" />
-            <element signature="e#3867#3913#0#HTML" expanded="true" />
-            <element signature="e#5268#5295#0#HTML" expanded="true" />
-            <element signature="e#5592#5637#0#HTML" expanded="true" />
-            <element signature="e#5891#5920#0#HTML" expanded="true" />
+            <element signature="e#7#392#0#PHP" expanded="true" />
           </folding>
         </state>
       </provider>
     </entry>
+    <entry file="file://$PROJECT_DIR$/app/views/hello.blade.php">
+      <provider selected="true" editor-type-id="text-editor">
+        <state vertical-scroll-proportion="0.69417477">
+          <caret line="75" column="31" selection-start-line="75" selection-start-column="31" selection-end-line="75" selection-end-column="31" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
   </component>
 </project>

+ 6 - 0
app/models/Film.php

@@ -53,4 +53,10 @@ class Film extends Eloquent {
 
     }
 
+    public function getPoster() {
+        $tmdb = new TMDb(Config::get('constants.tvdb.apikey'), 'de', TRUE);
+        $tmovie = $tmdb->getMovie($this->tvdbid);
+        return $tmdb->getImageUrl($tmovie['poster_path'], TMDb::IMAGE_POSTER, 'w342');
+    }
+
 }

+ 1 - 1
app/models/Vote.php

@@ -3,7 +3,7 @@
 class Vote extends Eloquent {
 	protected $table = "votes";
 
-	public function film() {
+	public function oFilm() {
 		return $this->belongsTo('Film', 'film');
 	}
 

+ 363 - 260
app/routes.php

@@ -11,209 +11,210 @@
 |
 */
 
-define('TMDB_API_KEY', 'b187f8d9c5e72b1faecb741d5d04239a');
 
 Route::get('/', function()
 {
-	$gesehen = Film::zuletztGesehen()->get();
-	$vorgeschlagen = Film::neuesteVorschlage()->get();
+    $gesehen = Film::zuletztGesehen()->get();
+    $vorgeschlagen = Film::neuesteVorschlage()->get();
     $mg = Film::meistgewunschteVorschlage()->get();
 
-	$news = News::aktuell()->get();
-	$nextfilm = Dumbo::find(1)->film;
+    $news = News::aktuell()->get();
+    $nextfilm = Dumbo::find(1)->film;
 
-    $tmdb = new TMDb(TMDB_API_KEY, 'de', TRUE);
+    $tmdb = new TMDb(Config::get('constants.tvdb.apikey'), 'de', TRUE);
     foreach(array("top" => $mg[0], "neu" => $vorgeschlagen[0], "alt" => $gesehen[0]) as $key => $val) {
         $tmovie = $tmdb->getMovie($val->tvdbid);
         $images[$key] = $tmdb->getImageUrl($tmovie['poster_path'], TMDb::IMAGE_POSTER, 'w342');
     }
 
-	if(is_object($nextfilm)) {
-		$tmovie = $tmdb->getMovie($nextfilm->tvdbid);
-		$images["next"] = $tmdb->getImageUrl($tmovie['poster_path'], TMDb::IMAGE_POSTER, 'w342');
-	} else {
-		$images["next"] = "img/no-poster-w92.jpg";
-	}
+    if(is_object($nextfilm)) {
+        $tmovie = $tmdb->getMovie($nextfilm->tvdbid);
+        $images["next"] = $tmdb->getImageUrl($tmovie['poster_path'], TMDb::IMAGE_POSTER, 'w342');
+    } else {
+        $images["next"] = "img/no-poster-w92.jpg";
+    }
 
-	$kommentare = Comment::neueste()->get();
+    $kommentare = Comment::neueste()->get();
 
     $labels = array("", "danger", "danger", "warning", "warning", "info", "info", "primary", "primary", "success", "success");
 
     return View::make('index')
-		->with('gesehen', $gesehen)
-		->with('vorgeschlagen', $vorgeschlagen)
+        ->with('gesehen', $gesehen)
+        ->with('vorgeschlagen', $vorgeschlagen)
         ->with('meistgw', $mg)
-		->with('images', $images)
-		->with('news', $news)
-		->with('kommentare', $kommentare)
+        ->with('images', $images)
+        ->with('news', $news)
+        ->with('kommentare', $kommentare)
         ->with('labels', $labels)
-		->with('nextfilm', $nextfilm);
+        ->with('nextfilm', $nextfilm);
 });
 
 Route::get('film/{id}', array('as' => 'film', function($id) {
-	$film = Film::findOrFail($id);
-
-	$tmdb = new TMDb('b187f8d9c5e72b1faecb741d5d04239a', 'de', TRUE);
-	$tmovie = $tmdb->getMovie($film->tvdbid);
-	$tcast = $tmdb->getMovieCast($film->tvdbid);
-	$ttrail = $tmdb->getMovieTrailers($film->tvdbid);
-	$image = $tmdb->getImageUrl($tmovie['poster_path'], TMDb::IMAGE_POSTER, 'w342');
-
-	$votes = $film->votes()->count();
-	$vposi = $film->votes()->where('stimme', true)->count();
-
-	$pv = array();
-	foreach($film->votes()->where('stimme', true)->get() as $v) {
-		$pv[] = $v->voter;
-	}
-
-	$nv = array();
-	foreach($film->votes()->where('stimme', false)->get() as $v) {
-		$nv[] = $v->voter;
-	}
-
-	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();
-
-
-	$labels = array("", "danger", "danger", "warning", "warning", "info", "info", "primary", "primary", "success", "success");
-
-	return View::make('film')
-		->with('film', $film)
-		->with('tfilm', $tmovie)
-		->with('poster', $image)
-		->with('comments', $comments)
-		->with('cast', $tcast)
-		->with('trail', $ttrail)
-		->with('votes', $votes)
-		->with('uvote', $uvote)
-		->with('pv', $pv)
-		->with('nv', $nv)
-		->with('vposi', $vposi)
-		->with('labels', $labels)
-		->with('tmdb', $tmdb);
+    $film = Film::findOrFail($id);
+
+    $tmdb = new TMDb('b187f8d9c5e72b1faecb741d5d04239a', 'de', TRUE);
+    $tmovie = $tmdb->getMovie($film->tvdbid);
+    $tcast = $tmdb->getMovieCast($film->tvdbid);
+    $ttrail = $tmdb->getMovieTrailers($film->tvdbid);
+    $image = $tmdb->getImageUrl($tmovie['poster_path'], TMDb::IMAGE_POSTER, 'w342');
+
+    $votes = $film->votes()->count();
+    $vposi = $film->votes()->where('stimme', true)->count();
+
+    $pv = array();
+    foreach($film->votes()->where('stimme', true)->get() as $v) {
+        $pv[] = $v->voter;
+    }
+
+    $nv = array();
+    foreach($film->votes()->where('stimme', false)->get() as $v) {
+        $nv[] = $v->voter;
+    }
+
+    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();
+
+
+    $labels = array("", "danger", "danger", "warning", "warning", "info", "info", "primary", "primary", "success", "success");
+
+    return View::make('film')
+        ->with('film', $film)
+        ->with('tfilm', $tmovie)
+        ->with('poster', $image)
+        ->with('comments', $comments)
+        ->with('cast', $tcast)
+        ->with('trail', $ttrail)
+        ->with('votes', $votes)
+        ->with('uvote', $uvote)
+        ->with('pv', $pv)
+        ->with('nv', $nv)
+        ->with('vposi', $vposi)
+        ->with('labels', $labels)
+        ->with('tmdb', $tmdb);
 }));
 
 Route::get('vote/{stimme}/{user}/{film}', function($stimme, $user, $film) {
-	$v = Vote::where('user', $user)->where('film', $film)->first();
+    $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->stimme = $stimme == "yes" ? true : false;
-	}
+    if(!is_null($v)) {
+        $v->stimme = $stimme == "yes" ? true : false;
+    } else {
+        $v = new Vote();
+        $v->user = $user;
+        $v->film = $film;
+        $v->stimme = $stimme == "yes" ? true : false;
+    }
 
-	$v->save();
+    $v->save();
 
-	return Redirect::to('film/' . $film);
+    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->bewertung = !is_null(Input::get('rate')) ? Input::get('rate') : 0;
-	$c->save();
-	return Redirect::to('film/' . Input::get('film'));
+    $c = new Comment();
+    $c->film = Input::get('film');
+    $c->user = Input::get('user');
+    $c->text = Input::get('text');
+    $c->bewertung = !is_null(Input::get('rate')) ? Input::get('rate') : 0;
+    $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->bewertung = Input::get('rate');
-	$c->save();
-	return Redirect::to('film/' . $c->film);
+    $c = Comment::findOrFail(Input::get('id'));
+    $c->text = Input::get('text');
+    $c->bewertung = Input::get('rate');
+    $c->save();
+    return Redirect::to('film/' . $c->film);
 }));
 
 Route::get('login', array('as' => 'login', function() {
-	return View::make('login');
+    return View::make('login');
 }));
 
 Route::post('login', function() {
-	$userdata = array(
-		'name' => Input::get('user'),
-		'password' => Input::get('password'));
-	if(Auth::attempt($userdata, true)) {
-		return Redirect::intended('/');
-	} else {
-		echo "Login gescheitert.";
-		var_dump($userdata);
-		return Redirect::to('login')
-			->with('login_errors', true);
-	}
+    $userdata = array(
+        'name' => Input::get('user'),
+        'password' => Input::get('password'));
+    if(Auth::attempt($userdata, true)) {
+        return Redirect::intended('/');
+    } else {
+        echo "Login gescheitert.";
+        var_dump($userdata);
+        return Redirect::to('login')
+            ->with('login_errors', true);
+    }
 });
 
 Route::get('logout', array('as' => 'logout', function() {
-	Auth::logout();
-	return Redirect::to('/');
+    Auth::logout();
+    return Redirect::to('/');
 }));
 
 Route::get('beliebt', function() {
-	
-	$filme = DB::table(DB::raw('film_films'))
-	->select(DB::raw('film_films.*, COUNT(case when film_votes.stimme IS TRUE then 1 end) as upvotes, 
+
+    $filme = DB::table(DB::raw('film_films'))
+        ->select(DB::raw('film_films.*, COUNT(case when film_votes.stimme IS TRUE then 1 end) as upvotes,
 		COUNT(case when film_votes.stimme IS FALSE then 1 end) as downvotes, 
 		COUNT(case when film_votes.stimme IS TRUE then 1 end) as vcount'))
-	->leftJoin('votes', 'votes.film', '=', 'films.id')
-	->whereNull('films.gesehen')
-	->groupBy('id')
-	->orderBy('vcount', 'DESC')->orderBy('vorgeschlagen', 'ASC')
-	->paginate(25);
+        ->leftJoin('votes', 'votes.film', '=', 'films.id')
+        ->whereNull('films.gesehen')
+        ->groupBy('id')
+        ->orderBy('vcount', 'DESC')->orderBy('vorgeschlagen', 'ASC')
+        ->paginate(25);
 
-	return View::make('suggest')
-		->with('filme', $filme)
-		->with('titel', 'Vorschl&auml;ge nach Wertung');
+    return View::make('suggest')
+        ->with('filme', $filme)
+        ->with('titel', 'Vorschl&auml;ge nach Wertung');
 
 });
 
 Route::get('vorgeschlagen', function() {
 
-	$filme = DB::table(DB::raw('film_films'))
-		->select(DB::raw('film_films.*, COUNT(case when film_votes.stimme IS TRUE then 1 end) as upvotes,
+    $filme = DB::table(DB::raw('film_films'))
+        ->select(DB::raw('film_films.*, COUNT(case when film_votes.stimme IS TRUE then 1 end) as upvotes,
 		COUNT(case when film_votes.stimme IS FALSE then 1 end) as downvotes,
 		COUNT(case when film_votes.stimme IS TRUE then 1 end) as vcount'))
-		->leftJoin('votes', 'votes.film', '=', 'films.id')
-		->whereNull('films.gesehen')
-		->groupBy('id')
-		->orderBy('vorgeschlagen', 'DESC')
-		->paginate(25);
+        ->leftJoin('votes', 'votes.film', '=', 'films.id')
+        ->whereNull('films.gesehen')
+        ->groupBy('id')
+        ->orderBy('vorgeschlagen', 'DESC')
+        ->paginate(25);
 
-	return View::make('suggest')
-		->with('filme', $filme)
-		->with('titel', 'Vorschl&auml;ge nach Datum');
+    return View::make('suggest')
+        ->with('filme', $filme)
+        ->with('titel', 'Vorschl&auml;ge nach Datum');
 
 });
 
 Route::get('gesehen/{field?}/{order?}', function($field = "gesehen", $order = "desc") {
-	$filme = Film::whereNotNull('gesehen')->orderBy($field, $order)->paginate(25);
+    $filme = Film::whereNotNull('gesehen')->orderBy($field, $order)->paginate(25);
+    $labels = array("", "danger", "danger", "warning", "warning", "info", "info", "primary", "primary", "success", "success");
 
-	return View::make('seen')
-		->with('filme', $filme);
+    return View::make('seen')
+        ->with('labels', $labels)
+        ->with('filme', $filme);
 
 })->where(array('field' => '[a-z]+', 'order' => 'asc|desc'));
 
 Route::get('neu', array('before' => 'auth', function() {
 
-	return View::make('new');
+    return View::make('new');
 
 }));
 
 Route::post('neu', array('before' => 'auth', function() {
-	$tmdb = new TMDb('b187f8d9c5e72b1faecb741d5d04239a', 'de', TRUE);
-	$r = $tmdb->searchMovie(Input::get('search'));
+    $tmdb = new TMDb('b187f8d9c5e72b1faecb741d5d04239a', 'de', TRUE);
+    $r = $tmdb->searchMovie(Input::get('search'));
 
-	return View::make('new')->with('result', $r)->with('tmdb', $tmdb);
+    return View::make('new')->with('result', $r)->with('tmdb', $tmdb);
 }));
 
 Route::get('vorschlag/{id}', array('before' => 'auth', function($id) {
@@ -236,94 +237,94 @@ Route::get('vorschlag/{id}', array('before' => 'auth', function($id) {
 }));
 
 Route::get('mark-read/{id}', array('before' => 'auth', function($id) {
-	$film = Film::findOrFail($id);
-	$film->gesehen = \Carbon\Carbon::today();
-	$film->save();
-	if(Dumbo::find(1)->nextfilm == $film->id) {
-		$system = Dumbo::findOrFail(1);
-		$system->nextfilm = 0;
-		$system->save();
-	}
-	return Redirect::to('film/' . $film->id);
+    $film = Film::findOrFail($id);
+    $film->gesehen = \Carbon\Carbon::today();
+    $film->save();
+    if(Dumbo::find(1)->nextfilm == $film->id) {
+        $system = Dumbo::findOrFail(1);
+        $system->nextfilm = 0;
+        $system->save();
+    }
+    return Redirect::to('film/' . $film->id);
 }));
 
 Route::get('view-next/{id}', array('before' => 'auth', function($id) {
-	$system = Dumbo::findOrFail(1);
-	$system->nextfilm = $id;
-	$system->save();
-	return Redirect::to('film/' . $id);
+    $system = Dumbo::findOrFail(1);
+    $system->nextfilm = $id;
+    $system->save();
+    return Redirect::to('film/' . $id);
 }));
 
 Route::get('register', function() {
-	return View::make('register');
+    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!');
-	}
+    $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');
+    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());	
-		}
-	}
+    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());
+        }
+    }
 
     if($mode == 'avatar-reset') {
         /** @var User $u */
@@ -365,81 +366,81 @@ Route::post('settings/{mode}', array('before' => 'auth', function($mode) {
 }));
 
 Route::get('users', array('before' => 'auth', function() {
-	if(Auth::user()->admin) {
-		$u = User::orderBy('name')->paginate();
+    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.');	
-	}
+        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);
+    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);
 }));
 
 
 Route::get('news', array('before' => 'auth',  function() {
-	return View::make('news');
+    return View::make('news');
 }));
 
 Route::post('news', array('before' => 'auth', function() {
-	$vrules = array(
-		'headline' => 'required',
-		'body' => 'required'
-	);
-
-	$vfields = array(
-		'headline' => Input::get('headline'),
-		'body' => Input::get('body')
-	);
-
-	$val = Validator::make($vfields, $vrules);
-
-	if($val->fails()) {
-		return View::make('news')->with('errors', $val->messages());
-	} else {
-		$n = new News();
-		$n->author = Auth::user()->id;
-		$n->headline = Input::get('headline');
-		$n->body = Input::get('body');
-		$n->save();
-		return Redirect::to('/')->with('message', 'News erstellt!');
-	}
+    $vrules = array(
+        'headline' => 'required',
+        'body' => 'required'
+    );
+
+    $vfields = array(
+        'headline' => Input::get('headline'),
+        'body' => Input::get('body')
+    );
+
+    $val = Validator::make($vfields, $vrules);
+
+    if($val->fails()) {
+        return View::make('news')->with('errors', $val->messages());
+    } else {
+        $n = new News();
+        $n->author = Auth::user()->id;
+        $n->headline = Input::get('headline');
+        $n->body = Input::get('body');
+        $n->save();
+        return Redirect::to('/')->with('message', 'News erstellt!');
+    }
 }));
 
 Route::get('passwort-vergessen', function() {
-	return View::make('pwform');
+    return View::make('pwform');
 });
 
 Route::post('passwort-vergessen', function() {
-	$credentials = array('email' => Input::get('email'));
-	return Password::remind($credentials, function($message, $user) {
-		$message->subject('Passwort für Dumbo zurücksetzen.');
-	});
+    $credentials = array('email' => Input::get('email'));
+    return Password::remind($credentials, function($message, $user) {
+        $message->subject('Passwort für Dumbo zurücksetzen.');
+    });
 });
 
 Route::get('passwort-reset/{token}', function($token) {
-	return View::make('pwreset')->with('token', $token);
+    return View::make('pwreset')->with('token', $token);
 });
 
 Route::post('passwort-reset', function() {
@@ -456,4 +457,106 @@ Route::post('passwort-reset', function() {
 
         return Redirect::to('/');
     });
+});
+
+Route::get('stats', function() {
+    $stats = [
+        array(
+            'name' => 'Meiste Vorschl&auml;ge',
+            'entr' => array('Vorschlag', 'Vorschl&auml;ge'),
+            'vals' => Film::addSelect(DB::raw("film_films.*, COUNT(`id`) as count"))
+                ->groupBy('user')->orderBy('count', 'DESC')->take(3)->get(),
+            'prop' => 'besitzer',
+            'type' => 'User'
+        ),
+
+        array(
+            'name' => 'Meiste angenommene Vorschl&auml;ge',
+            'entr' => array('Vorschlag', 'Vorschl&auml;ge'),
+            'vals' => Film::addSelect(DB::raw("film_films.*, COUNT(`id`) as count"))
+                ->whereNotNull('gesehen')->groupBy('user')->orderBy('count', 'DESC')->take(3)->get(),
+            'prop' => 'besitzer',
+            'type' => 'User'
+        ),
+
+        array(
+            'name' => 'Meiste Kommentare',
+            'entr' => array('Kommentar', 'Kommentare'),
+            'vals' => Comment::addselect(DB::raw('film_comments.*, COUNT(`id`) as count'))
+                ->where('text', '!=', '')->groupBy('user')->orderBy('count', 'DESC')->take(3)->get(),
+            'prop' => 'autor',
+            'type' => 'User'
+        ),
+
+        array(
+            'name' => 'Meiste Bewertungen',
+            'entr' => array('Bewertung', 'Bewertungen'),
+            'vals' => Comment::addselect(DB::raw('film_comments.*, COUNT(`id`) as count'))
+                ->where('bewertung', '!=', 0)->groupBy('user')->orderBy('count', 'DESC')->take(3)->get(),
+            'prop' => 'autor',
+            'type' => 'User'
+        ),
+
+        array(
+            'name' => 'Bewertet am besten',
+            'entr' => array('', ''),
+            'vals' => Comment::addselect(DB::raw('film_comments.*, ROUND(AVG(`bewertung`),1) as count'))
+                ->where('bewertung', '!=', 0)->groupBy('user')->orderBy('count', 'DESC')->take(3)->get(),
+            'prop' => 'autor',
+            'type' => 'User'
+        ),
+        array(
+            'name' => 'Bewertet am schlechtesten',
+            'entr' => array('', ''),
+            'vals' => Comment::addselect(DB::raw('film_comments.*, ROUND(AVG(`bewertung`),1) as count'))
+                ->where('bewertung', '!=', 0)->groupBy('user')->orderBy('count', 'ASC')->take(3)->get(),
+            'prop' => 'autor',
+            'type' => 'User'
+        ),
+        array(
+            'name' => 'Meiste Filme wider Willen gesehen',
+            'entr' => array('Film', 'Filme'),
+            'vals' => Vote::addSelect(DB::raw('film_films.*, film_votes.*, COUNT(*) as count'))
+                ->leftJoin('films', 'films.id', '=', 'votes.film')->whereNotNull('gesehen')
+                ->whereRaw('stimme IS FALSE')->groupBy('votes.user')->orderBy('count', 'DESC')
+                ->take(3)->get(),
+            'prop' => 'voter',
+            'type' => 'User'
+        ),
+        array(
+            'name' => 'Unbeliebtester Film',
+            'entr' => array('Stimme', 'Stimmen'),
+            'prop' => 'oFilm',
+            'type' => 'Film',
+            'vals' => Vote::addSelect(DB::raw('film_votes.*, film_films.*, COUNT(*) as count'))
+                ->leftJoin('films', 'films.id', '=', 'votes.film')
+                ->whereRaw('stimme IS FALSE')->groupBy('film')->orderBy('count', 'DESC')
+                ->take(3)->get()
+        ),
+        array(
+            'name' => 'Schlechtbewertetster Film',
+            'entr' => array('', ''),
+            'prop' => 'objekt',
+            'type' => 'Film',
+            'vals' => Comment::addSelect(DB::raw('film_comments.*, film_films.*, ROUND(AVG(`bewertung`),1) as count'))
+                ->leftJoin('films', 'films.id', '=', 'comments.film')->whereNotNull('gesehen')
+                ->where('bewertung', '>', 0)->groupBy('film')->orderBy('count', 'ASC')
+                ->take(3)->get()
+        ),
+        array(
+            'name' => 'Bestbewertetster Film',
+            'entr' => array('', ''),
+            'prop' => 'objekt',
+            'type' => 'Film',
+            'vals' => Comment::addSelect(DB::raw('film_comments.*, film_films.*, ROUND(AVG(`bewertung`),1) as count'))
+                ->leftJoin('films', 'films.id', '=', 'comments.film')->whereNotNull('gesehen')
+                ->where('bewertung', '>', 0)->groupBy('film')->orderBy('count', 'DESC')
+                ->take(3)->get()
+        ),
+    ];
+
+
+//    dd(DB::getQueryLog());
+
+    return View::make('stats')->with('stats', $stats);
 });

+ 2 - 1
app/views/hello.blade.php

@@ -23,6 +23,7 @@
 					<li>{{ HTML::link('vorgeschlagen', 'Vorgeschlagen (Datum)') }}</li>
 					<li>{{ HTML::link('gesehen', 'Gesehen') }}</li>
 					<li>{{ HTML::link('neu', 'Film vorschlagen')}}
+					<li>{{ HTML::link('stats', 'Statistiken') }}</li>
 				</ul>
 				<ul class="nav navbar-nav pull-right">
 
@@ -72,7 +73,7 @@
 <footer id="footer">
 	<div class="container">
 		<hr>
-		<small>&copy; 2013 &mdash; Daniel M&uuml;llers</small>
+		<small>&copy; 2013-2016 &mdash; Daniel M&uuml;llers</small>
 	</div>
 </footer>
 

+ 19 - 4
app/views/seen.blade.php

@@ -8,18 +8,33 @@
 <table class="table">
 	<tr>
 		<th>Titel</th>
+        <th></th>
 		<th>Gesehen am</th>
 		<th>Vorgeschlagen von</th>
-		<th>Kommentare</th>
-	</tr>
+    </tr>
 @foreach($filme as $film)
+        <?php
+        $stimme = 2;
+        if(!is_null(Auth::user()) && Vote::where('film', $film->id)->where('user', Auth::user()->id)->count())
+            $stimme = Vote::where('film', $film->id)->where('user', Auth::user()->id)->first()->stimme;
+        ?>
 	<tr>
 		<td>{{ HTML::link('film/' . $film->id, $film->name) }}</td>
+        <td>
+            <span class="glyphicon glyphicon-comment"></span> {{ $film->comments()->count()}}
+            @if($film->getBewertung() > 0)
+                &nbsp;<span class="label label-{{$labels[round($film->getBewertung())]}}">{{$film->getBewertung()}}</span>
+            @endif
+            @if($stimme == 1)
+                &nbsp;<span class="label label-success tooltip-enable" data-toggle="tooltip" title="Daf&uuml;r gestimmt."><span class="glyphicon glyphicon-thumbs-up"></span></span>
+            @elseif($stimme == 0)
+                &nbsp;<span class="label label-default tooltip-enable"  data-toggle="tooltip" title="Nicht daf&uuml;r gestimmt."><span class="glyphicon glyphicon-hand-right"></span></span>
+            @endif
+        </td>
 		<td>{{ \Carbon\Carbon::parse($film->gesehen)->format('d.m.Y')}}</td>
 		<td><span class="badge">
-						<img class="img-circle" src="{{ $film->besitzer->getAvatar() }}" width="20"> {{$film->besitzer->name}}
+						<img class="img-circle pull-left" src="{{ $film->besitzer->getAvatar() }}" width="20"> {{$film->besitzer->name}}
 					</span></td>
-		<td><span class="glyphicon glyphicon-comment"></span> {{ $film->comments()->count()}}</td>
 	</tr>
 @endforeach
 </table>

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

@@ -0,0 +1,59 @@
+@extends('hello')
+
+@section('content')
+    <div class="page-header"><h1>Statistiken</h1></div>
+
+    <div class="row">
+        @foreach($stats as $stat)
+            <div class="col-md-4">
+                <div class="panel panel-default">
+                    <div class="panel-heading">{{$stat["name"]}}</div>
+                    <div class="panel-body">
+                        <?php $top = $stat["vals"]->shift() ?>
+                        <div>
+                            @if($stat['type'] === "User")
+                                <div class="pull-left" style="margin-right:5px">
+                                    <img class="img-circle media-object" src="{{$top->$stat['prop']->getAvatar()}}" width="47">
+                                </div>
+                            @endif
+                                @if($stat['type'] === "Film")
+                                    <div class="pull-left" style="margin-right:5px">
+                                        <img class="media-object" src="{{$top->$stat['prop']->getPoster()}}" height="47">
+                                    </div>
+                                @endif
+                            <div class="media-body">
+                                <h4 class="media-heading">{{is_object($top->$stat['prop']) ? $top->$stat['prop']->name : dd($top)}}</h4>
+                                <b>{{$top->count}}</b> {{$top->count ==1 ? $stat['entr'][0] : $stat['entr'][1] }}
+                            </div>
+                        </div>
+                        @foreach($stat['vals'] as $top)
+                            <div style="margin-top: 10px;">
+                                @if($stat['type'] === "User")
+                                    <div class="pull-left" style="margin-right:5px">
+                                        <img class="img-circle media-object" src="{{$top->$stat['prop']->getAvatar()}}" width="20">
+                                    </div>
+                                @endif
+                                    @if($stat['type'] === "Film")
+                                        <div class="pull-left" style="margin-right:5px">
+                                            <img class="media-object" src="{{$top->$stat['prop']->getPoster()}}" height="20">
+                                        </div>
+                                    @endif
+                                <div class="media-body">
+                                    <h5 class="media-heading">{{$top->$stat['prop']->name}} &mdash; <b>{{$top->count}}</b> {{$top->count ==1 ? $stat['entr'][0] : $stat['entr'][1] }}</h5>
+                                </div>
+                            </div>
+                        @endforeach
+                    </div>
+                </div>
+            </div>
+        @endforeach
+    </div>
+@stop
+
+@section('title')
+    Statistiken ~
+@stop
+
+@section('script')
+
+@stop