📄 reportcreator.php
字号:
$FormParams = PrepStep('prop'); $FormParams['id'] = $myrow['id']; break; } $Params['Seq'][] = $_POST['TotalField']; } // Update field properties $sql = "UPDATE ".DBRptFields." SET params='".serialize($Params)."' WHERE id = ".$_POST['ID'].";"; $Result=DB_query($sql,$db,'','',false,true); $Params['TotalField']=''; $FormParams = PrepStep('prop'); $FormParams['id'] = $myrow['id']; break; case RPT_BTN_CHANGE: case RPT_BTN_ADDNEW: // Error Check input, see if user entered a bad fieldname or description, error and reload if ($_POST['TblField']=='' OR ($Params['index']=='Tbl' AND $_POST['TblDesc']=='')) { $usrMsg[] = array('message'=>RPT_BADFLD, 'level'=>'error'); // reload form with bad data entered as field defaults, ready to be editted if ($_POST['todo']==RPT_BTN_ADDNEW) $ButtonValue = RPT_BTN_ADDNEW; else $ButtonValue = RPT_BTN_CHANGE; $DisplayName =$_POST['DisplayName']; $FormParams = PrepStep('prop'); $FormParams['id'] = $myrow['id']; break; } if ($_POST['todo']==RPT_BTN_ADDNEW) $success = InsertFormSeq($Params,'insert'); else $success = InsertFormSeq($Params, 'update'); // continue on case RPT_BTN_UPDATE: case RPT_BTN_FINISH: // Enter the properties of a given field and return to the field setup screen // additional processing for the image upload in the form image type if ($Params['index']=='Img') { $success = ImportImage(); if ($success['result']=='error') { // image upload failed $usrMsg[] = array('message'=>$success['message'], 'level'=>'error'); $FormParams = PrepStep('prop'); $FormParams['id'] = $myrow['id']; break; } else { $Params['filename'] = $success['filename']; } } // reset the sequence defaults to null for Table type only if ($Params['index']=='Tbl' OR $Params['index']=='TBlk') { $Params['TblSeqNum'] = ''; $Params['TblField'] = ''; $Params['TblDesc'] = ''; $Params['Processing'] = ''; } // Update field properties $sql = "UPDATE ".DBRptFields." SET params='".serialize($Params)."' WHERE id = ".$_POST['ID'].";"; $Result=DB_query($sql,$db,'','',false,true); // check for update errors and reload if ($_POST['todo']==RPT_BTN_FINISH) { // no errors and finished so return to field setup $FieldListings = RetrieveFields('fieldlist'); $FormParams = PrepStep('5'); } else { // print error message if need be and reload parameter form $DisplayName =$_POST['DisplayName']; $FormParams = PrepStep('prop'); $FormParams['id'] = $myrow['id']; } break; default: // bail to reports home $DropDownString = RetrieveReports(); $FormParams = PrepStep('1'); break; } } break; case "step7": // entered from criteria setup page $OverrideDefaults = false; if (!isset($_POST['todo'])) { // then a sequence image button was pushed $SeqNum = $_POST['SeqNum']; //fetch the sequence number $EntryType = $_POST['EntryType']; //fetch the entry type if (isset($_POST['up_x'])) { // the shift up button was pushed if ($SeqNum<>1) $success = ChangeSequence($_POST['SeqNum'], $EntryType, 'up'); } elseif (isset($_POST['dn_x'])) { // the shift down button was pushed $sql = "SELECT seqnum FROM ".DBRptFields." WHERE reportid = ".$ReportID." AND entrytype = '".$EntryType."';"; $Result=DB_query($sql,$db,'','',false,true); if ($SeqNum<DB_num_rows($Result)) $success = ChangeSequence($_POST['SeqNum'], $EntryType, 'down'); } elseif (isset($_POST['ed_x'])) { // the sequence edit button was pushed $OverrideDefaults = true; // pre fill form with the field to edit and change button name $sql = "SELECT * FROM ".DBRptFields." WHERE reportid = ".$ReportID." AND entrytype = '".$EntryType."' AND seqnum=".$SeqNum.";"; $Result=DB_query($sql,$db,'','',false,true); $NewDefaults['defaults'] = DB_fetch_array($Result); $NewDefaults['defaults']['buttonvalue'] = RPT_BTN_CHANGE; } elseif (isset($_POST['rm_x'])) { // the sequence remove button was pushed $success = DeleteSequence($_POST['SeqNum'], $EntryType); } $reportname = $_POST['ReportName']; $FormParams = PrepStep('6'); } else { switch ($_POST['todo']) { case RPT_BTN_BACK: $reportname = $_POST['ReportName']; $FormParams = PrepStep('5'); break; case RPT_BTN_ADDNEW: case RPT_BTN_CHANGE: $EntryType = $_POST['EntryType']; //fetch the entry type // error check input $IsValidField = ValidateField($ReportID, $_POST['FieldName'], $_POST['DisplayDesc']); if (!$IsValidField) { // then user entered a bad fieldname or description, error and reload $usrMsg[] = array('message'=>RPT_BADFLD, 'level'=>'error'); // reload form with bad data entered as field defaults, ready to be editted $OverrideDefaults = true; $NewDefaults['defaults']['seqnum']=$_POST['SeqNum']; $NewDefaults['defaults']['fieldname']=$_POST['FieldName']; $NewDefaults['defaults']['displaydesc']=$_POST['DisplayDesc']; if (isset($_POST['Params'])) $NewDefaults['defaults']['params']=$_POST['Params']; if ($_POST['todo']==RPT_BTN_ADDNEW) { // add new so insert $NewDefaults['defaults']['buttonvalue'] = RPT_BTN_ADDNEW; } else { // exists, so update it. $NewDefaults['defaults']['buttonvalue'] = RPT_BTN_CHANGE; } } else { // fetch the input results and save them if ($_POST['todo']==RPT_BTN_ADDNEW) { // add new so insert $success = InsertSequence($_POST['SeqNum'], $EntryType); } else { // record exists, so update it. $success = UpdateSequence($EntryType); } } $reportname = $_POST['ReportName']; $FormParams = PrepStep('6'); break; case RPT_BTN_UPDATE: // update the date and general options fields, reload form case RPT_BTN_FINISH: // update fields and return to report manager screen default: // bail to reports home //fetch the entry type if (isset($_POST['EntryType'])) $EntryType = $_POST['EntryType']; else $EntryType = ''; // build date string of choices from user $DateString = ''; for ($i=1; $i<=count($DateChoices); $i++) { if (isset($_POST['DateRange'.$i])) $DateString .= $_POST['DateRange'.$i]; } // error check input for date if ($DateString=='' OR $DateString=='a') { // then the report is date independent $_POST['DateField'] = ''; // clear the date field since we don't need it $IsValidField = true; // } else { // check the input for a valid fieldname $IsValidField = ValidateField($ReportID, $_POST['DateField'], 'TestField'); } if ($Type=='frm' AND $IsValidField) { $IsValidField = ValidateField($ReportID, $_POST['FormBreakField'], 'TestField'); } if (!$IsValidField) { // then user entered a bad fieldname or description, error and reload $usrMsg[] = array('message'=>RPT_BADFLD, 'level'=>'error'); // reload form with bad data entered as field defaults, ready to be editted $DateListings['displaydesc'] = $DateString; $DateListings['params'] = $_POST['DefDate']; $DateListings['fieldname'] = $_POST['DateField']; if ($Type=='frm') $GroupListings['lists'][0]['fieldname'] = $_POST['FormBreakField']; $reportname = $_POST['ReportName']; $DateError = true; $FormParams = PrepStep('6'); break; } else { // fetch the input results and save them $DateError = false; $success = UpdateCritFields($ReportID, $DateString); } // read in fields for next form $reportname = $_POST['ReportName']; if ($_POST['todo']==RPT_BTN_FINISH) { // then finish was pressed $DropDownString = RetrieveReports(); // needed to return to reports manager home $FormParams = PrepStep('1'); } else { // update was pressed, return to criteria form $FormParams = PrepStep('6'); } break; } } // reload fields to display form $FieldListings = RetrieveFields('fieldlist'); // needed for GO Back (fields) screen // Below needed to reload criteria form if (!$DateError) { $DateListings = RetrieveFields('dateselect'); $DateListings = $DateListings['lists'][0]; // only need the first field } $TruncListings = RetrieveFields('trunclong'); $TruncListings = $TruncListings['lists'][0]; // only need the first field $SortListings = RetrieveFields('sortlist'); $GroupListings = RetrieveFields('grouplist'); $CritListings = RetrieveFields('critlist'); // override defaults used for edit of existing fields. if ($OverrideDefaults) { switch ($EntryType) { case "sortlist": $SortListings['defaults'] = $NewDefaults['defaults']; $SortListings['defaults']['buttonvalue'] = $NewDefaults['defaults']['buttonvalue']; break; case "grouplist": $GroupListings['defaults'] = $NewDefaults['defaults']; $GroupListings['defaults']['buttonvalue'] = $NewDefaults['defaults']['buttonvalue']; break; case "critlist": $CritListings['defaults'] = $NewDefaults['defaults']; $CritListings['defaults']['buttonvalue'] = $NewDefaults['defaults']['buttonvalue']; break; } } break; // End Step 7 case "step8": // Entered from import report form switch ($_POST['todo']) { case RPT_BTN_IMPORT: // Error check input and import the new report $success = ImportReport(trim($_POST['reportname'])); $usrMsg[] = array('message'=>$success['message'], 'level'=>$success['result']); if ($success['result']=='error') { $FormParams = PrepStep('imp'); break; } // All through and imported successfully, return to reports home page case RPT_BTN_BACK: default: $DropDownString = RetrieveReports(); $FormParams = PrepStep('1'); } break; // End Step 8} // end switch$title = $FormParams['title']; // fetch the title for the header.inc fileinclude ($PathPrefix . 'includes/header.inc');if ($usrMsg) foreach ($usrMsg as $temp) prnmsg($temp['message'],$temp['level']);include ($FormParams['IncludePage']);include ($PathPrefix . 'includes/footer.inc');// End main body?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -