示例#1
0
 public function remove($id)
 {
     $ids = implode(',', $id);
     $query = 'SELECT count(*)' . ' FROM #__acctexp_microintegrations' . ' 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;
     }
     // Call On-Deletion function
     foreach ($id as $k) {
         $mi = new microIntegration();
         $mi->load($k);
         if ($mi->callIntegration()) {
             $mi->delete();
         }
     }
     // Micro Integrations from table
     $query = 'DELETE FROM #__acctexp_microintegrations' . ' WHERE `id` IN (' . $ids . ')';
     $this->db->setQuery($query);
     if (!$this->db->query()) {
         echo "<script> alert('" . $this->db->getErrorMsg() . "'); window.history.go(-1); </script>\n";
         exit;
     }
     $this->setMessage($total . ' ' . JText::_('AEC_MSG_ITEMS_DELETED'));
 }