From 01ce24fd39e73e3e9a9b5780a4f864952eb6c469 Mon Sep 17 00:00:00 2001 From: Gregorio Chiko Putra Date: Wed, 6 Sep 2017 11:19:44 +0700 Subject: [PATCH] Added edit validation --- App/Controllers/Posts.php | 3 +-- App/Views/Data/edit_pengumuman.html | 15 +++++++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/App/Controllers/Posts.php b/App/Controllers/Posts.php index 1c18c14..038d835 100644 --- a/App/Controllers/Posts.php +++ b/App/Controllers/Posts.php @@ -61,7 +61,6 @@ class Posts $status = 'admin'; } - // $x = 0; for ($i=0; $i < count($posts); $i++) { $posts[$i]['content'] = preg_replace('/[\r]/', '', $posts[$i]['content']); $posts[$i]['content'] = preg_replace('/[\n]/', "
", $posts[$i]['content']); @@ -109,7 +108,7 @@ class Posts $editor_now = Session::get('userid'); $date = new \DateTime(); - $timestamp = $date->format("Y/m/d H:i:s"); + $timestamp = $date->format("Y-m-d"); View::render( 'Data/edit_pengumuman.html', diff --git a/App/Views/Data/edit_pengumuman.html b/App/Views/Data/edit_pengumuman.html index 9f64aab..595848b 100644 --- a/App/Views/Data/edit_pengumuman.html +++ b/App/Views/Data/edit_pengumuman.html @@ -40,7 +40,14 @@
- + + + {{ post.valid_at }} + + +
+ + {{ post.expired_at }} @@ -49,7 +56,7 @@ - {% if post.edited_at == "0000-00-00 00:00:00" %} + {% if post.edited_at is empty %} Tidak pernah {% else %} {{ post.edited_at }} @@ -61,7 +68,7 @@ - {% if post.editor == "0" %} + {% if post.editor is empty %} - {% else %} {{ editor.name }} @@ -92,7 +99,7 @@