65 lines
1.8 KiB
PHP
65 lines
1.8 KiB
PHP
<?php
|
|
|
|
class ProjectController implements CRUD {
|
|
|
|
use RequiresAuth;
|
|
|
|
// 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){
|
|
$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){
|
|
|
|
$this->check_access($f3);
|
|
$f3->set('content', '../ui/views/project/edit.html');
|
|
echo \Template::instance()->render('../ui/templates/layout.html');
|
|
|
|
}
|
|
|
|
public function update($f3){}
|
|
|
|
} |