public function remove($id) { $ids = implode(',', $id); $query = 'SELECT count(*)' . ' FROM #__acctexp_plans' . ' WHERE `id` IN (' . $ids . ')'; $this->db->setQuery($query); $total = $this->db->loadResult(); if ($total == 0) { echo "<script> alert('" . html_entity_decode(JText::_('AEC_MSG_NO_ITEMS_TO_DELETE')) . "'); window.history.go(-1);</script>\n"; exit; } foreach ($id as $planid) { if (SubscriptionPlanHandler::getPlanUserCount($planid) > 0) { $msg = JText::_('AEC_MSG_NO_DEL_W_ACTIVE_SUBSCRIBER'); aecRedirect('index.php?option=com_acctexp&task=showSubscriptionPlans', $msg); } else { $plan = new SubscriptionPlan(); $plan->load($planid); $plan->delete(); } } $msg = $total . ' ' . JText::_('AEC_MSG_ITEMS_DELETED'); aecRedirect('index.php?option=com_acctexp&task=showSubscriptionPlans', $msg); }