-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproject.php
More file actions
63 lines (53 loc) · 2.19 KB
/
Copy pathproject.php
File metadata and controls
63 lines (53 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
/**
* project management
*/
require('./inc/config.php');
// Allowed ?
$user->checkAuthent();
$project = new Project;
$task = new Task;
// No $_POST or $_GET data -> display the list of projects
if (!count($_POST) && !count($_GET)) {
$smarty->assign('arrProject', $project->get());
$smarty->display('project.tpl');
}
// else $_GET data -> edit or add a project
elseif (count($_GET)) {
// if no "add" in URL -> prefill the form
if (empty($_GET['add'])) {
$arrProject = $project->get($_GET['intProjectId'], true);
if (count($arrProject) == 0) {
displayMessage(STR_PROJECT_NOT_FOUND_SILLAJ);
}
$smarty->assign( 'booEdit', true); // to fill the fields
$smarty->assign_by_ref( 'intProjectId', $_GET['intProjectId']);
$smarty->assign_by_ref( 'strProject', $arrProject[$_GET['intProjectId']]['strProject']);
$smarty->assign_by_ref( 'strRem', $arrProject[$_GET['intProjectId']]['strRem']);
$smarty->assign_by_ref( 'booShare', $arrProject[$_GET['intProjectId']]['booShare']);
$smarty->assign_by_ref( 'booUseInReport', $arrProject[$_GET['intProjectId']]['booUseInReport']);
$smarty->assign('arrTaskSelected', $project->getTask($_GET['intProjectId']));
$smarty->assign( 'strPageTitle', $smarty->get_template_vars('strPageTitle') . STR_SEP_SILLAJ . $arrProject[$_GET['intProjectId']]['strProject']);
}
$smarty->assign('arrTask', $task->get());
$smarty->display('edit_project.tpl');
}
// else $_POST data -> validate the form
elseif (count($_POST)) {
// todo : allow to migrate events from one task to another (or delete) if a project
// doesn't link to the task anymore
if (!empty($_POST['booDelete'])) {
$smarty->assign('strMessage', $project->del());
}
else {
if (empty($_POST['booEdit'])) {
$smarty->assign('strMessage', $project->add());
}
else {
$smarty->assign('strMessage', $project->set());
}
}
$smarty->assign('arrProject', $project->get());
$smarty->display('project.tpl');
}
?>