コード例 #1
0
ファイル: orders_status.php プロジェクト: Doluci/tomatocart
 function saveOrdersStatus()
 {
     global $toC_Json, $osC_Language;
     $data = array('name' => $_REQUEST['name'], 'public_flag' => isset($_REQUEST['public_flag']) && $_REQUEST['public_flag'] == 'on' ? 1 : 0, 'downloads_flag' => isset($_REQUEST['downloads_flag']) && $_REQUEST['downloads_flag'] == 'on' ? 1 : 0, 'returns_flag' => isset($_REQUEST['returns_flag']) && $_REQUEST['returns_flag'] == 'on' ? 1 : 0, 'gift_certificates_flag' => isset($_REQUEST['gift_certificates_flag']) && $_REQUEST['gift_certificates_flag'] == 'on' ? 1 : 0);
     if (osC_OrdersStatus_Admin::save(isset($_REQUEST['orders_status_id']) ? $_REQUEST['orders_status_id'] : null, $data, isset($_REQUEST['default']) && $_REQUEST['default'] == 'on' ? true : 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'));
     }
     echo $toC_Json->encode($response);
 }
コード例 #2
0
 function __construct()
 {
     global $osC_Language, $osC_MessageStack;
     $this->_page_title = $osC_Language->get('heading_title');
     if (!isset($_GET['action'])) {
         $_GET['action'] = '';
     }
     if (!isset($_GET['page']) || isset($_GET['page']) && !is_numeric($_GET['page'])) {
         $_GET['page'] = 1;
     }
     if (!empty($_GET['action'])) {
         switch ($_GET['action']) {
             case 'save':
                 if (isset($_GET['osID']) && is_numeric($_GET['osID'])) {
                     $this->_page_contents = 'edit.php';
                 } else {
                     $this->_page_contents = 'new.php';
                 }
                 if (isset($_POST['subaction']) && $_POST['subaction'] == 'confirm') {
                     $data = array('name' => $_POST['name']);
                     if (osC_OrdersStatus_Admin::save(isset($_GET['osID']) ? $_GET['osID'] : null, $data, isset($_POST['default']) && $_POST['default'] == 'on' ? true : 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 . '&page' . $_GET['page']));
                 }
                 break;
             case 'delete':
                 $this->_page_contents = 'delete.php';
                 if (isset($_POST['subaction']) && $_POST['subaction'] == 'confirm') {
                     if (osC_OrdersStatus_Admin::delete($_GET['osID'])) {
                         $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 . '&page=' . $_GET['page']));
                 }
                 break;
             case 'batchDelete':
                 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_OrdersStatus_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 . '&page=' . $_GET['page']));
                     }
                 }
                 break;
         }
     }
 }