/**
  * Method to delete the records
  *
  * @access public
  * @return boolean
  */
 public function delete($cid = array())
 {
     $xmlhelper = new xmlHelper();
     if (count($cid)) {
         $cids = implode(',', $cid);
         for ($i = 0; $i < count($cid); $i++) {
             $result = $xmlhelper->getXMLExportInfo($cid[$i]);
             $rootpath = JPATH_COMPONENT_SITE . "/assets/xmlfile/export/" . $result->filename;
             if (is_file($rootpath)) {
                 unlink($rootpath);
             }
         }
         $query = 'DELETE FROM ' . $this->_table_prefix . 'xml_export_log ' . 'WHERE xmlexport_id IN (' . $cids . ')';
         $this->_db->setQuery($query);
         if (!$this->_db->query()) {
             $this->setError($this->_db->getErrorMsg());
             return false;
         }
         $query = 'DELETE FROM ' . $this->_table_prefix . 'xml_export_ipaddress ' . 'WHERE xmlexport_id IN (' . $cids . ')';
         $this->_db->setQuery($query);
         if (!$this->_db->query()) {
             $this->setError($this->_db->getErrorMsg());
             return false;
         }
         $query = 'DELETE FROM ' . $this->_table_prefix . 'xml_export ' . 'WHERE xmlexport_id IN (' . $cids . ')';
         $this->_db->setQuery($query);
         if (!$this->_db->query()) {
             $this->setError($this->_db->getErrorMsg());
             return false;
         }
     }
     return true;
 }
Esempio n. 2
0
 /**
  * Generate XML file.
  *
  * @return void
  */
 public function generateXMLExportFile()
 {
     $app = JFactory::getApplication();
     $option = JRequest::getVar('option', 'com_redshop', 'request', 'string');
     $xmlexport_id = JRequest::getInt('xmlexport_id');
     if ($xmlexport_id) {
         require_once JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/xmlhelper.php';
         $xmlHelper = new xmlHelper();
         $xmlHelper->writeXMLExportFile($xmlexport_id);
         $row = $xmlHelper->getXMLExportInfo($xmlexport_id);
         $link = JURI::root() . 'index.php?option=com_redshop&view=category&tmpl=component&task=download&file=' . $row->filename;
         $app->redirect($link);
     }
 }