diff --git a/app/controllers/ProjectController.php b/app/controllers/ProjectController.php index 322559f..eda40cf 100644 --- a/app/controllers/ProjectController.php +++ b/app/controllers/ProjectController.php @@ -7,23 +7,59 @@ // list all projects public function index($f3){ $this->check_access($f3); + + $db = $f3->get('DB'); + + // retrieve projects + $projects = $db->exec('SELECT * FROM projects ORDER BY created_at DESC'); + + $f3->set('projects', $projects); + + $f3->set('content', '../ui/views/project/index.html'); echo \Template::instance()->render('../ui/templates/layout.html'); + + $f3->clear('SESSION.error'); } // create a new project public function createForm($f3){ + $this->check_access($f3); + $f3->set('content', '../ui/views/project/create.html'); + echo \Template::instance()->render('../ui/templates/layout.html'); } + public function create($f3){ } // show project details including links, tickets, events, tasks - public function view($f3){} + public function view($f3){ + $this->check_access($f3); + + $project_id = $f3->get('PARAMS.id'); + $db = $f3->get('DB'); + + $result = $db->exec( + 'SELECT * FROM projects WHERE id = ? LIMIT 1', [$project_id] + ); + $project = $result[0]; + $f3->set('project', $project); + + $f3->set('content', '../ui/views/project/view.html'); + echo \Template::instance()->render('../ui/templates/layout.html'); + } // update project details - public function editForm($f3){} + public function editForm($f3){ + + $this->check_access($f3); + $f3->set('content', '../ui/views/project/edit.html'); + echo \Template::instance()->render('../ui/templates/layout.html'); + + } + public function update($f3){} } \ No newline at end of file diff --git a/app/extensions/ParsedownHelper.php b/app/extensions/ParsedownHelper.php index 43e7d08..c6e6b3d 100644 --- a/app/extensions/ParsedownHelper.php +++ b/app/extensions/ParsedownHelper.php @@ -16,7 +16,7 @@ class ParsedownHelper extends \Prefab { } - return '
'.print_r($args,1).'
';
+        // return '
'.print_r($args,1).'
'; $content = $args[0]; $content_token = \Template::instance()->token($content); diff --git a/public/index.php b/public/index.php index 24c553b..962675e 100644 --- a/public/index.php +++ b/public/index.php @@ -43,6 +43,7 @@ $f3->route('GET /dashboard', function($f3){ } echo 'Welcome to the dashboard' . $f3->get('SESSION.username'); echo 'logout'; + }); // tickets - CRUD (CREATE, READ, UPDATE, DELETE) diff --git a/ui/templates/layout.html b/ui/templates/layout.html index 672f845..75cb4ec 100644 --- a/ui/templates/layout.html +++ b/ui/templates/layout.html @@ -42,9 +42,9 @@