From: Nik Okuntseff Date: Sun, 25 Nov 2018 14:17:17 +0000 (+0000) Subject: Added group selector on projects.php. X-Git-Tag: timetracker_1.19-1~551 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=05cc6905eba759b924e2dc4efc884a930711f928;p=timetracker.git Added group selector on projects.php. --- diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index dee9c5e1..4cb0d912 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.18.28.4514 | Copyright © Anuko | +  Anuko Time Tracker 1.18.28.4515 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/WEB-INF/templates/projects.tpl b/WEB-INF/templates/projects.tpl index 58999365..09966a84 100644 --- a/WEB-INF/templates/projects.tpl +++ b/WEB-INF/templates/projects.tpl @@ -6,6 +6,16 @@
{if $user->can('manage_projects')} + {if $group_dropdown} +{$forms.projectsForm.open} {* projectsForm consists only of one dropdown group control *} + + + + +
{$i18n.label.group}: {$forms.projectsForm.group.control}
+{$forms.projectsForm.close} + {/if} + {if $inactive_projects} diff --git a/projects.php b/projects.php index d206fe8c..3845db67 100644 --- a/projects.php +++ b/projects.php @@ -39,14 +39,41 @@ if (MODE_PROJECTS != $user->tracking_mode && MODE_PROJECTS_AND_TASKS != $user->t header('Location: feature_disabled.php'); exit(); } +if ($request->isPost() && !$user->isGroupValid($request->getParameter('group'))) { + header('Location: access_denied.php'); // Wrong group id in post. + exit(); +} // End of access checks. +if ($request->isPost()) { + $group_id = $request->getParameter('group'); + $user->setOnBehalfGroup($group_id); +} else { + $group_id = $user->getActiveGroup(); +} + +$form = new Form('projectsForm'); +if ($user->can('manage_subgroups')) { + $groups = $user->getGroupsForDropdown(); + if (count($groups) > 1) { + $form->addInput(array('type'=>'combobox', + 'onchange'=>'this.form.submit();', + 'name'=>'group', + 'style'=>'width: 250px;', + 'value'=>$group_id, + 'data'=>$groups, + 'datakeys'=>array('id','name'))); + $smarty->assign('group_dropdown', 1); + } +} + if($user->can('manage_projects')) { - $active_projects = ttTeamHelper::getActiveProjects($user->group_id); - $inactive_projects = ttTeamHelper::getInactiveProjects($user->group_id); + $active_projects = ttTeamHelper::getActiveProjects($group_id); + $inactive_projects = ttTeamHelper::getInactiveProjects($group_id); } else $active_projects = $user->getAssignedProjects(); +$smarty->assign('forms', array($form->getName()=>$form->toArray())); $smarty->assign('active_projects', $active_projects); $smarty->assign('inactive_projects', $inactive_projects); $smarty->assign('title', $i18n->get('title.projects'));
{$i18n.form.projects.active_projects}