Categories now have their background color and font color, which effects the client and admin side

This commit is contained in:
2017-09-15 16:32:26 +07:00
parent ec548a46b7
commit 9ca1050979
6 changed files with 231 additions and 110 deletions

View File

@@ -75,10 +75,10 @@ class Posts
{
$this->checkValid();
$posts = [];
$datas = [];
$post = $this->model->showAll([
['status', '=', 1]
$data = $this->model->showJoin([
['pengumuman.status', '=', 1]
]);
$url = 'Data/pengumuman.html';
@@ -87,30 +87,31 @@ class Posts
$privilege = '';
if (Session::exists('userid')) {
$post = $this->model->showAll();
$data = $this->model->showJoin();
if ($args != '') {
$post = $this->model->showAll([
['status', '=', $args]
$data = $this->model->showJoin([
['pengumuman.status', '=', $args]
]);
}
$privilege = Session::get('privilege');
$status = 'loggedin';
}
if ($post !== false) {
if (array_key_exists(0, $post)) {
$posts = $post;
if ($data !== false) {
if (array_key_exists(0, $data)) {
$datas = $data;
} else {
$posts[] = $post;
$datas[] = $data;
}
// Replace \n or \r with <br />
for ($i=0; $i < count($posts); $i++) {
$posts[$i]['content'] = preg_replace('/\r\n/', '<br />', $posts[$i]['content']);
for ($i=0; $i < count($datas); $i++) {
$datas[$i]['content'] = preg_replace('/\r\n/', '<br />', $datas[$i]['content']);
}
}
View::render($url, [
'posts' => $posts,
'posts' => $datas,
'status' => $status,
'privilege' => $privilege,
'token' => Token::generate()
@@ -121,7 +122,7 @@ class Posts
{
if (Session::exists('userid')) {
$date = new \DateTime();
$now = $date->format("d-m-Y");
$now = $date->format("Y-m-d");
$get_categories = $this->model->showAll([], 'kategori');
$categories = [];
@@ -188,7 +189,7 @@ class Posts
], $table);
$date = new \DateTime();
$timestamp = $date->format("d-m-Y");
$timestamp = $date->format("Y-m-d");
View::render(
'Data/edit_pengumuman.html',