/** * Add Organizations to this Project. Contact users are set as the first * manager/writer found in the Organization. * * @param array $orgs */ public function add_orgs(array $orgs) { foreach ($orgs as $org) { $po = new ProjectOrg(); $po->porg_org_id = $org->org_id; $po->porg_status = ProjectOrg::$STATUS_ACTIVE; $po->porg_contact_user_id = 1; // default // get the first related user who can writer and make them the contact. foreach ($org->UserOrg as $uo) { $mask = AdminRole::to_bitmask($uo->uo_ar_id); if ($mask & ACTION_ORG_PRJ_BE_CONTACT) { $po->porg_contact_user_id = $uo->uo_user_id; } } $this->ProjectOrg[] = $po; } }