From 6854cb3f4d8219cf1829e32122eb2502a916eae9 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Sat, 1 Feb 2020 09:05:48 +0100 Subject: initial checkin --- scripts/newtask.php | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 scripts/newtask.php (limited to 'scripts/newtask.php') diff --git a/scripts/newtask.php b/scripts/newtask.php new file mode 100644 index 0000000..8cd3dc2 --- /dev/null +++ b/scripts/newtask.php @@ -0,0 +1,53 @@ +can_open_task($proj)) { + Flyspray::show_error(15); +} + +$page->setTitle($fs->prefs['page_title'] . $proj->prefs['project_title'] . ': ' . L('newtask')); + +$result = $db->query(' + SELECT u.user_id, u.user_name, u.real_name, g.group_id, g.group_name, g.project_id + FROM {users} u + JOIN {users_in_groups} uig ON u.user_id = uig.user_id + JOIN {groups} g ON g.group_id = uig.group_id + WHERE (g.show_as_assignees = 1 OR g.is_admin = 1) + AND (g.project_id = 0 OR g.project_id = ?) AND u.account_enabled = 1 + ORDER BY g.project_id ASC, g.group_name ASC, u.user_name ASC', $proj->id); + +$userlist = array(); +$userids=array(); +while ($row = $db->fetchRow($result)) { + if (!in_array($row['user_id'], $userids)){ + $userlist[$row['group_id']][] = array( + 0 => $row['user_id'], + 1 => sprintf('%s (%s)', $row['user_name'], $row['real_name']), + 2 => $row['project_id'], + 3 => $row['group_name'] + ); + $userids[]=$row['user_id']; + } else{ + # user is probably in a global group with assignee permission listed, so no need to show second time in a project group. + } +} + +$assignees = array(); +if (is_array(Post::val('rassigned_to'))) { + $assignees = Post::val('rassigned_to'); +} + +$page->assign('assignees', $assignees); +$page->assign('userlist', $userlist); +$page->assign('old_assigned', ''); +$page->pushTpl('newtask.tpl'); + +?> -- cgit v1.2.3-70-g09d2