function groups_to_soap($groups) { $return = array(); foreach ($groups as $group_id => $group) { if (!$group || $group->isError()) { //skip if error } else { $return[] = group_to_soap($group); } } return $return; }
/** * getGroupById : returns the SOAPGroup associated with the given ID * * @global $Language * * @param string $sessionKey the session hash associated with the session opened by the person who calls the service * @param string $group_id the ID of the group we want to get * @return array the SOAPGroup associated with the given ID */ function getGroupById($sessionKey, $group_id) { if (session_continue($sessionKey)) { try { $pm = ProjectManager::instance(); $group = $pm->getGroupByIdForSoap($group_id, 'getGroupById'); $soap_group = group_to_soap($group); return $soap_group; } catch (SoapFault $e) { return $e; } } else { return new SoapFault(invalid_session_fault, 'Invalid Session', 'getGroup'); } }