Exemple #1
0
 public function __construct()
 {
     global $osC_Language, $osC_MessageStack;
     parent::__construct();
     $this->_page_contents = 'delete.php';
     if (isset($_POST['subaction']) && $_POST['subaction'] == 'confirm') {
         if (osC_Currencies_Admin::delete($_GET['cID'])) {
             $osC_MessageStack->add($this->_module, $osC_Language->get('ms_success_action_performed'), 'success');
         } else {
             $osC_MessageStack->add($this->_module, $osC_Language->get('ms_error_action_not_performed'), 'error');
         }
         osc_redirect_admin(osc_href_link_admin(FILENAME_DEFAULT, $this->_module));
     }
 }
Exemple #2
0
 public function __construct()
 {
     global $osC_Language, $osC_MessageStack;
     parent::__construct();
     if (isset($_POST['batch']) && is_array($_POST['batch']) && !empty($_POST['batch'])) {
         $this->_page_contents = 'batch_delete.php';
         if (isset($_POST['subaction']) && $_POST['subaction'] == 'confirm') {
             $error = false;
             foreach ($_POST['batch'] as $id) {
                 if (!osC_Currencies_Admin::delete($id)) {
                     $error = true;
                     break;
                 }
             }
             if ($error === false) {
                 $osC_MessageStack->add($this->_module, $osC_Language->get('ms_success_action_performed'), 'success');
             } else {
                 $osC_MessageStack->add($this->_module, $osC_Language->get('ms_error_action_not_performed'), 'error');
             }
             osc_redirect_admin(osc_href_link_admin(FILENAME_DEFAULT, $this->_module));
         }
     }
 }
Exemple #3
0
 function deleteCurrencies()
 {
     global $toC_Json, $osC_Database, $osC_Language;
     $batch = explode(',', $_REQUEST['batch']);
     $Qcurrencies = $osC_Database->query('select currencies_id, title, code from :table_currencies where currencies_id in (":currencies_id") order by title');
     $Qcurrencies->bindTable(':table_currencies', TABLE_CURRENCIES);
     $Qcurrencies->bindRaw(':currencies_id', implode('", "', array_unique(array_filter(array_slice($batch, 0, MAX_DISPLAY_SEARCH_RESULTS), 'is_numeric'))));
     $Qcurrencies->execute();
     $error = false;
     $feedback = array();
     while ($Qcurrencies->next()) {
         if ($Qcurrencies->value('code') == DEFAULT_CURRENCY) {
             $error = true;
             $feedback[] = $osC_Language->get('introduction_delete_currency_invalid');
             break;
         }
     }
     if ($error === false) {
         foreach ($batch as $id) {
             if (!osC_Currencies_Admin::delete($id)) {
                 $error = true;
                 break;
             }
         }
         if ($error === false) {
             $response = array('success' => true, 'feedback' => $osC_Language->get('ms_success_action_performed'));
         } else {
             $response = array('success' => false, 'feedback' => $osC_Language->get('ms_error_action_not_performed'));
         }
     } else {
         $response = array('success' => false, 'feedback' => $osC_Language->get('ms_error_action_not_performed') . '<br />' . implode('<br />', $feedback));
     }
     echo $toC_Json->encode($response);
 }