function deleteData() { $wasDeleted = parent::deleteData(); // initialize different variables if ($wasDeleted) { // read the ids of the records seleted for deletion $cid = JRequest::getVar('cid', array(), 'post', 'array'); JArrayHelper::toInteger($cid); if (count($cid) > 0) { $cids = implode(',', $cid); } else { $cids = '-1'; } $this->deleteOtherInfo($cids); } return true; }
function deleteData() { parent::deleteData(); // initialize different variables $db = JFactory::getDBO(); // read the ids of the records seleted for deletion $cid = JRequest::getVar('cid', array(), 'post', 'array'); JArrayHelper::toInteger($cid); if (count($cid) > 0) { $profiles_ids = $cid; $cids = implode(',', $cid); } else { $profiles_ids = null; $cids = '-1'; } $query = 'DELETE FROM `#__aicontactsafe_contactinformations` where profile_id IN ( ' . $cids . ' )'; // delete records $db->setQuery($query); if (!$db->query()) { JError::raiseError(500, $db->getErrorMsg()); return false; } if (is_array($profiles_ids)) { // import joomla clases to manage file system jimport('joomla.filesystem.file'); foreach ($profiles_ids as $pf_id) { $css_file = JPath::clean(JPATH_ROOT . '/' . 'media' . '/' . 'aicontactsafe' . '/' . 'cssprofiles' . '/' . 'profile_css_' . $pf_id . '.css'); if (JFile::exists($css_file)) { JFile::delete($css_file); } $mail_file = JPath::clean(JPATH_ROOT . '/' . 'media' . '/' . 'aicontactsafe' . '/' . 'mailtemplates' . '/' . 'mail_' . $pf_id . '.php'); if (JFile::exists($mail_file)) { JFile::delete($mail_file); } } } return true; }