fix download link
[grauphel.git] / controller / guicontroller.php
index 534f18ff4bdc848130eed03feb32589dd3de6baa..127daafb1ada681d6b5f4f94c95c5c0b602a27f3 100644 (file)
@@ -121,7 +121,7 @@ class GuiController extends Controller
             )
         );
 
-        $selectedRawtag = null;
+        $selectedRawtag = 'grauphel:special:untagged';
         if (count($note->tags) > 0) {
             $selectedRawtag = $note->tags[0];
         }
@@ -149,7 +149,7 @@ class GuiController extends Controller
      */
     public function tag($rawtag)
     {
-        $notes = $this->getNotes()->loadNotesOverview(null, $rawtag);
+        $notes = $this->getNotes()->loadNotesOverview(null, $rawtag, true);
         usort(
             $notes,
             function($noteA, $noteB) {
@@ -157,6 +157,17 @@ class GuiController extends Controller
             }
         );
 
+        foreach ($notes as &$note) {
+            $diffInDays = intval(
+                (time() - strtotime($note['last-change-date'])) / 86400
+            );
+            $value = 0 + $diffInDays;
+            if ($value > 160) {
+                $value = 160;
+            }
+            $note['dateColor'] = '#' . str_repeat(sprintf('%02X', $value), 3);
+        }
+
         $res = new TemplateResponse('grauphel', 'tag');
         $res->setParams(
             array(