Example #1
0
function getPackages($session_ser, $group_id)
{
    continue_session($session_ser);
    $grp =& group_get_object($group_id);
    if (!$grp || !is_object($grp)) {
        return new soap_fault('', 'getPackages', 'Could Not Get Group', 'Could Not Get Group');
    } elseif ($grp->isError()) {
        return new soap_fault('', 'getPackages', $grp->getErrorMessage(), $grp->getErrorMessage());
    }
    $pkg_arr = get_frs_packages($grp);
    return packages_to_soap($pkg_arr);
}
Example #2
0
 /**
  * getPackages - returns an array of FRSPackages that belongs to the project identified by group_id
  *
  * @param string $sessionKey the session hash associated with the session opened by the person who calls the service
  * @param int $group_id the ID of the group we want to retrieve the array of packages
  * @return array the array of SOAPFRSPackage that belongs to the project identified by $group_id, or a soap fault if group_id does not match with a valid project.
  */
 function getPackages($sessionKey, $group_id)
 {
     if (session_continue($sessionKey)) {
         try {
             $pm = ProjectManager::instance();
             $pm->getGroupByIdForSoap($group_id, 'getPackages');
         } catch (SoapFault $e) {
             return $e;
         }
         $pkg_fact = new FRSPackageFactory();
         // we get only the active packages, even if we are project admin or file admin
         $packages =& $pkg_fact->getFRSPackagesFromDb($group_id, 1);
         // 1 for active packages
         return packages_to_soap($packages);
     } else {
         return new SoapFault(invalid_session_fault, 'Invalid Session', 'getPackages');
     }
 }