diff --git a/include/class.collaborator.php b/include/class.collaborator.php index 18cae5f4147a1939aa3fee67823ae8704a15ddc3..e04d8571226f539cf82546a0c641a87eb1a026e3 100644 --- a/include/class.collaborator.php +++ b/include/class.collaborator.php @@ -108,6 +108,25 @@ class Collaborator { return false; } + static function forTicket($tid, $criteria=array()) { + + $collaborators = array(); + + $sql='SELECT id FROM '.TICKET_COLLABORATOR_TABLE + .' WHERE ticket_id='.db_input($tid); + + if(isset($criteria['isactive'])) + $sql.=' AND isactive='.db_input($criteria['isactive']); + + //TODO: sort by name of the user + + if(($res=db_query($sql)) && db_num_rows($res)) + while(list($id)=db_fetch_row($res)) + $collaborators[] = self::lookup($id); + + return $collaborators; + } + static function getIdByInfo($info) { $sql='SELECT id FROM '.TICKET_COLLABORATOR_TABLE