X-Git-Url: https://disinclined.org/git/?a=blobdiff_plain;f=model%2Farchive.php;h=d0947c4d85cfb007e32d84f5da5d622c2f9374cc;hb=08d7e1f799b17025cc1066b1e9b09e1b44c66a67;hp=0f805d4a1678200418201c133573a3ea6b58e038;hpb=77022111c645ce69584a681c17662264ff370d7c;p=dylansserver.git diff --git a/model/archive.php b/model/archive.php index 0f805d4..d0947c4 100644 --- a/model/archive.php +++ b/model/archive.php @@ -2,6 +2,8 @@ class archive extends model { + public $notes = array(); + public function __construct() { parent::__construct(); } @@ -16,10 +18,11 @@ class archive extends model { } public function display() { + $this->fetch_notes(); require_once("view/archive.php"); } - public function display_notes() { + public function fetch_notes() { switch (true) { case (isset($_GET['year']) && !isset($_GET['month']) && !isset($_GET['day'])): @@ -50,28 +53,14 @@ class archive extends model { $_GET['day']); break; } - if (count($result) >= 1) { - echo "
Empty set (0.00 sec)"; + foreach ($result as $row => $entry) { + $entry['url'] = '/note/' . $entry['url']; + $date_posted = explode("-", $entry['date_posted']); + $entry['year_posted'] = $date_posted[0]; + $entry['month_posted'] = $date_posted[1]; + $entry['datetime_posted'] = explode(' ', $date_posted[2]); + $entry['day_posted'] = $entry['date_posted'][0]; + $this->notes[$row] = $entry; } }