X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/timetracker.git/blobdiff_plain/a0410750589c12e822f5f3d1f6ff7f020f41e0bf..ea116938e30f04a448b87956b7660baeec83876e:/WEB-INF/lib/ttProjectHelper.class.php diff --git a/WEB-INF/lib/ttProjectHelper.class.php b/WEB-INF/lib/ttProjectHelper.class.php index 362a2b62..31a88ccc 100644 --- a/WEB-INF/lib/ttProjectHelper.class.php +++ b/WEB-INF/lib/ttProjectHelper.class.php @@ -332,4 +332,23 @@ class ttProjectHelper { $affected = $mdb2->exec($sql); return (!is_a($affected, 'PEAR_Error')); } + + // getAssignedUsers - returns an array of user ids assigned to a project. + static function getAssignedUsers($project_id) { + global $user; + $mdb2 = getConnection(); + + $group_id = $user->getGroup(); + $org_id = $user->org_id; + + $result = array(); + $sql = "select user_id from tt_user_project_binds". + " where project_id = $project_id and group_id = $group_id and org_id = $org_id and status = 1"; + $res = $mdb2->query($sql); + if (is_a($res, 'PEAR_Error')) return false; + while ($row = $res->fetchRow()) { + $result[] = $row['user_id']; + } + return $result; + } }