X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=project_add.php;h=004168045875f4920af774fd288b86149b28e639;hb=96e8b431e4b1dadd919b831e4ae184d29ebf1235;hp=e00a0316fdd6e99e051e3abba117db70566f2227;hpb=6ab97ede1a08afd9f703a713b0eb6addd560a589;p=timetracker.git diff --git a/project_add.php b/project_add.php index e00a0316..00416804 100644 --- a/project_add.php +++ b/project_add.php @@ -49,6 +49,7 @@ foreach ($users as $user_item) $tasks = ttGroupHelper::getActiveTasks(); foreach ($tasks as $task_item) $all_tasks[$task_item['id']] = $task_item['name']; +$show_tasks = MODE_PROJECTS_AND_TASKS == $user->getTrackingMode() && count($tasks) > 0; if ($request->isPost()) { $cl_name = trim($request->getParameter('project_name')); @@ -66,7 +67,7 @@ $form = new Form('projectForm'); $form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'project_name','style'=>'width: 250px;','value'=>$cl_name)); $form->addInput(array('type'=>'textarea','name'=>'description','style'=>'width: 250px; height: 40px;','value'=>$cl_description)); $form->addInput(array('type'=>'checkboxgroup','name'=>'users','data'=>$all_users,'layout'=>'H','value'=>$cl_users)); -if (MODE_PROJECTS_AND_TASKS == $user->getTrackingMode()) +if ($show_tasks) $form->addInput(array('type'=>'checkboxgroup','name'=>'tasks','data'=>$all_tasks,'layout'=>'H','value'=>$cl_tasks)); $form->addInput(array('type'=>'submit','name'=>'btn_add','value'=>$i18n->get('button.add'))); @@ -74,6 +75,8 @@ if ($request->isPost()) { // Validate user input. if (!ttValidString($cl_name)) $err->add($i18n->get('error.field'), $i18n->get('label.thing_name')); if (!ttValidString($cl_description, true)) $err->add($i18n->get('error.field'), $i18n->get('label.description')); + if (!ttGroupHelper::validateCheckboxGroupInput($cl_users, 'tt_users')) $err->add($i18n->get('error.field'), $i18n->get('label.users')); + if (!ttGroupHelper::validateCheckboxGroupInput($cl_tasks, 'tt_tasks')) $err->add($i18n->get('error.field'), $i18n->get('label.tasks')); if ($err->no()) { if (!ttProjectHelper::getProjectByName($cl_name)) { @@ -92,9 +95,9 @@ if ($request->isPost()) { } // isPost $smarty->assign('forms', array($form->getName()=>$form->toArray())); -$smarty->assign('show_users', count($users) > 0); -$smarty->assign('show_tasks', count($tasks) > 0); $smarty->assign('onload', 'onLoad="document.projectForm.project_name.focus()"'); +$smarty->assign('show_users', count($users) > 0); +$smarty->assign('show_tasks', $show_tasks); $smarty->assign('title', $i18n->get('title.add_project')); $smarty->assign('content_page_name', 'project_add.tpl'); $smarty->display('index.tpl');