Example #1
0
             $FormParams = PrepStep('2');
             break;
         case RPT_BTN_DEL:
             // after confirmation, delete the report and go to the main report admin menu
             $sql = "DELETE FROM " . DBReports . " WHERE id = " . $ReportID . ";";
             $Result = DB_query($sql, $db, '', '', false, true);
             $sql = "DELETE FROM " . DBRptFields . " WHERE reportid = " . $ReportID . ";";
             $Result = DB_query($sql, $db, '', '', false, true);
             // reload main entry form
         // reload main entry form
         default:
             $DropDownString = RetrieveReports();
             $FormParams = PrepStep('1');
             break;
         case RPT_BTN_EXPORT:
             ExportReport($ReportID);
             // We don't return from here, we exit the script
             break;
         case RPT_BTN_IMPORT:
             // show the file import form
             $ReportName = '';
             $FormParams = PrepStep('imp');
             break;
     }
     break;
     // End Step 2
 // End Step 2
 case "step3":
     // entered from id setup page
     switch ($_POST['todo']) {
         case RPT_BTN_REPLACE:
         // Copy a report was selected
         $FormParams = PrepStep('2');
         break;
     case 'delete':
         // after confirmation, delete the report and go to the main report admin menu
         $sql = "delete from " . TABLE_REPORTS . " where id = " . $ReportID;
         $result = $db->Execute($sql);
         $sql = "delete from " . TABLE_REPORT_FIELDS . " where reportid = " . $ReportID;
         $result = $db->Execute($sql);
         // reload main entry form
     // reload main entry form
     default:
         $FormParams = PrepStep('1');
         break;
     case 'export':
         $success = ExportReport($ReportID);
         // We don't return from hereif download
         // we are here so there was an error or the report was saved locally
         if ($success) {
             $messageStack->add_session(RW_RPT_EXPORT_SUCCESS, 'success');
         } else {
             $messageStack->add_session(RW_RPT_EXPORT_FAILED, 'error');
         }
         $FormParams = PrepStep('1');
         break;
     case 'import':
         // show the file import form
         $ReportName = '';
         $FormParams = PrepStep('imp');
         break;
 }