Exemple #1
0
 public function deleteOrganisationById($orgId)
 {
     $wepModel = new Model_Wep();
     // Delete Activities
     $actCollModel = new Model_ActivityCollection();
     $activities = $actCollModel->getActivityIdsByAccount($orgId);
     $activityModel = new Model_Activity();
     foreach ($activities as $activity) {
         $activityModel->deleteActivityById($activity['id']);
     }
     // Delete Defaults
     $wepModel->deleteRow('default_field_groups', 'account_id', $orgId);
     $wepModel->deleteRow('default_field_values', 'account_id', $orgId);
     // Delete registry info
     $regModel = new Model_RegistryInfo();
     $regModel->deleteRegistryInfo($orgId);
     // Delete Users
     $userModel = new Model_User();
     $users = $userModel->getAllUsersByAccountId($orgId);
     foreach ($users as $user) {
         $this->deleteUserById($user['user_id']);
     }
     // Delete account
     $wepModel->deleteRow('iati_activities', 'account_id', $orgId);
     $wepModel->deleteRow('account', 'id', $orgId);
 }
Exemple #2
0
 /**
  * Fetch all activity ids from account id. User activitycollection model
  */
 public function getActivityIds($accountId)
 {
     $ids = array();
     $actModel = new Model_ActivityCollection();
     $activityIds = $actModel->getActivityIdsByAccount($accountId);
     if (!empty($activityIds)) {
         foreach ($activityIds as $id) {
             $ids[] = $id['id'];
         }
     }
     return $ids;
 }