예제 #1
0
 /**
  * Deletes one or more groups
  *
  * @param  mixed $ids The ids to delete.
  */
 public static function deleteGroups($ids)
 {
     $db = BackendModel::getDB(true);
     // if $ids is not an array, make one
     $ids = !is_array($ids) ? array($ids) : $ids;
     /*
      * I know this is messy, but since you can remove multiple groups at the same time in the datagrid ànd remove the record in CM
      * we need to loop the ID's one by one
      */
     // loop the list
     foreach ($ids as $id) {
         // a list was deleted
         if (self::getCM()->deleteList(self::getCampaignMonitorID('list', $id))) {
             // delete group
             BackendMailmotorModel::deleteGroups($id);
             // delete CampaignMonitor reference
             $db->delete('mailmotor_campaignmonitor_ids', 'type = ? AND other_id = ?', array('list', $id));
         }
     }
 }