diff --git a/App/Controllers/Posts.php b/App/Controllers/Posts.php index 442416a..38330ae 100644 --- a/App/Controllers/Posts.php +++ b/App/Controllers/Posts.php @@ -96,9 +96,7 @@ class Posts ]); $url = 'Data/pengumuman.html'; - - $status = ''; - $privilege = ''; + $user = []; if (Session::exists('userid')) { $data = $this->model->showJoin(); @@ -107,8 +105,8 @@ class Posts ['pengumuman.status', '=', $args] ]); } - $privilege = Session::get('privilege'); - $status = 'loggedin'; + $user = $_SESSION; + unset($user['tokens']); } if ($data !== false) { @@ -126,8 +124,7 @@ class Posts View::render($url, [ 'posts' => $datas, - 'status' => $status, - 'privilege' => $privilege, + 'user' => $user, 'token' => Token::generate() ]); } diff --git a/App/Models/Post.php b/App/Models/Post.php index c1b0e9f..2038a2f 100644 --- a/App/Models/Post.php +++ b/App/Models/Post.php @@ -122,7 +122,7 @@ class Post extends \Core\Model try { $db = static::connectDB(); - $sql = "SELECT pengumuman.id, kategori.background, kategori.foreground, pengumuman.valid_at, pengumuman.expired_at, pengumuman.content, pengumuman.status FROM pengumuman INNER JOIN kategori ON pengumuman.category=kategori.id"; + $sql = "SELECT pengumuman.id, kategori.background, kategori.foreground, pengumuman.valid_at, pengumuman.expired_at, pengumuman.creator, pengumuman.editor, pengumuman.content, pengumuman.status FROM pengumuman INNER JOIN kategori ON pengumuman.category=kategori.id"; if ($conditions) { $sql .= " WHERE"; diff --git a/App/Views/Data/pengumuman.html b/App/Views/Data/pengumuman.html index 8f8823b..3b35860 100644 --- a/App/Views/Data/pengumuman.html +++ b/App/Views/Data/pengumuman.html @@ -6,8 +6,8 @@