Example #1
0
function FetchReportDetails($ReportID)
{
    global $db;
    $sql = "SELECT reportname, reporttype, groupname, papersize, paperorientation,\n\t\t\tmargintop, marginbottom, marginleft, marginright,\n\t\t\ttable1, table2, table2criteria, table3, table3criteria, table4, table4criteria,\n\t\t\ttable5, table5criteria, table6, table6criteria\n\t\tFROM " . DBReports . " \n\t\tWHERE id = " . $ReportID . ";";
    $Result = DB_query($sql, $db, '', '', false, true);
    $myrow = DB_fetch_assoc($Result);
    foreach ($myrow as $key => $value) {
        $Prefs[$key] = $value;
    }
    // Build drop down menus for selectable criteria
    $Temp = RetrieveFields($ReportID, 'dateselect');
    $Prefs['DateListings'] = $Temp[0];
    // only need the first field
    $Prefs['GroupListings'] = RetrieveFields($ReportID, 'grouplist');
    $Prefs['CritListings'] = RetrieveFields($ReportID, 'critlist');
    return $Prefs;
}
Example #2
0
 }
 // 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;
                $result = $db->Execute($sql);
                if ($result->AffectedRows() == 0) {
                    // create the field, first see if it is there
                    $result = $db->Execute("select id from " . TABLE_REPORT_FIELDS . " where reportid = " . $ReportID . " and entrytype = 'security'");
                    if ($result->RecordCount() == 0) {
                        $sql = "insert into " . TABLE_REPORT_FIELDS . " set \r\n\t\t\t\t\t\t\treportid = " . $ReportID . ",\r\n\t\t\t\t\t\t\tentrytype = 'security',\r\n\t\t\t\t\t\t\tparams = '" . $params . "'";
                        $result = $db->Execute($sql);
                    }
                }
                // read in fields for next form
                if ($todo == 'finish') {
                    // then finish was pressed
                    $FormParams = PrepStep('1');
                } else {
                    // update was pressed, return to criteria form
                    $temp = RetrieveFields('security');
                    $temp = array_pop($temp['lists']);
                    $Security = explode(';', $temp['params']);
                    $presets = array();
                    foreach ($Security as $value) {
                        $presets[substr($value, 0, 1)] = explode(':', substr($value, 2));
                    }
                    $FormParams = PrepStep('sec');
                }
        }
        break;
        // end step 9
    // end step 9
    default:
        die('Bad action number: ' . $action);
}
Example #4
0
function FetchReportDetails($ReportID)
{
    global $db;
    $sql = "SELECT *\tFROM " . DBReports . " WHERE id = '" . $ReportID . "'";
    $Result = DB_query($sql, $db, '', '', false, true);
    $myrow = DB_fetch_assoc($Result);
    foreach ($myrow as $key => $value) {
        $Prefs[$key] = $value;
    }
    // Build drop down menus for selectable criteria; need $ReportID
    $Temp = RetrieveFields($ReportID, 'dateselect');
    $Prefs['DateListings'] = $Temp[0];
    // only need the first field
    $Temp = RetrieveFields($ReportID, 'trunclong');
    $Prefs['TruncListings'] = $Temp[0];
    // only need the first field
    $Prefs['SortListings'] = RetrieveFields($ReportID, 'sortlist');
    $Prefs['GroupListings'] = RetrieveFields($ReportID, 'grouplist');
    $Prefs['CritListings'] = RetrieveFields($ReportID, 'critlist');
    $Prefs['FieldListings'] = RetrieveFields($ReportID, 'fieldlist');
    return $Prefs;
}
function FetchReportDetails($ReportID)
{
    global $db;
    $result = $db->Execute("select * from " . TABLE_REPORTS . " where id = " . $ReportID);
    $result->fields['description'] = stripslashes($result->fields['description']);
    foreach ($result->fields as $key => $value) {
        $Prefs[$key] = $value;
    }
    // load the page fields
    $result = $db->Execute("select params from " . TABLE_REPORT_FIELDS . " \r\n\t\twhere reportid = " . $ReportID . " and entrytype = 'pagelist'");
    if ($result->RecordCount() > 0) {
        $params = unserialize($result->fields['params']);
        $params['title1desc'] = stripslashes($params['title1desc']);
        $params['title2desc'] = stripslashes($params['title2desc']);
        $Prefs = array_merge($Prefs, $params);
    }
    // Report/Form properties
    $Prefs['GroupListings'] = RetrieveFields($ReportID, 'grouplist');
    $Prefs['CritListings'] = RetrieveFields($ReportID, 'critlist');
    $Prefs['SortListings'] = RetrieveFields($ReportID, 'sortlist');
    $Prefs['FieldListings'] = RetrieveFields($ReportID, 'fieldlist');
    return $Prefs;
}
function PrepStep($StepNum, $template = '')
{
    global $db, $Type, $paperwidth, $paperheight, $paperorientation, $marginleft, $marginright, $ReportID;
    $head_type = ($Type == 'frm' ? TEXT_FORM : TEXT_REPORT) . ': ';
    // This function sets the titles and include information to prepare for the defined step number
    switch ($StepNum) {
        case '1':
            // closes the popup window and triggers a reload of opener window
        // closes the popup window and triggers a reload of opener window
        default:
            $FormParams['IncludePage'] = false;
            break;
        case '2':
            // id, copy, new report name form
            $FormParams['title'] = RW_TITLE_RPRBLDR . RW_TITLE_STEP2;
            $FormParams['heading'] = RW_RPT_RPTID;
            $FormParams['IncludePage'] = 'template_id.php';
            break;
        case '3':
            // page setup form
            $FormParams['title'] = RW_TITLE_RPRBLDR . RW_TITLE_STEP3;
            $FormParams['heading'] = $head_type;
            $FormParams['IncludePage'] = 'template_page_setup.php';
            break;
        case '4':
            // db setup form
            $FormParams['title'] = RW_TITLE_RPRBLDR . RW_TITLE_STEP4;
            $FormParams['heading'] = $head_type;
            $FormParams['IncludePage'] = 'template_db_setup.php';
            break;
        case '5':
            // field setup form
            // Load the javascript values
            $PageListings = RetrieveFields('pagelist');
            $temp = $PageListings['lists'][0]['params'];
            $pageproperties = explode(':', $temp['papersize']);
            $paperwidth = $pageproperties[1];
            $paperheight = $pageproperties[2];
            $paperorientation = $temp['paperorientation'];
            $marginleft = $temp['marginleft'];
            $marginright = $temp['marginright'];
            // Prep the form
            $FormParams['title'] = RW_TITLE_RPRBLDR . RW_TITLE_STEP5;
            $FormParams['heading'] = $head_type;
            $FormParams['IncludePage'] = 'template_field_setup.php';
            break;
        case 'prop':
            // Form field properties form
            global $Params;
            // we need the form type from the Params variable to load the correct form
            $FormParams['title'] = RW_TITLE_RPRBLDR . TEXT_PROPERTIES;
            $FormParams['heading'] = $head_type;
            $FormParams['IncludePage'] = 'template_TplFrm' . $template . '.php';
            break;
        case '6':
            // criteria setup form
            $sql = "select params from " . TABLE_REPORT_FIELDS . " where reportid = " . $ReportID . " and entrytype = 'pagelist'";
            $result = $db->Execute($sql);
            $FormParams['Prefs'] = unserialize($result->fields['params']);
            $FormParams['title'] = RW_TITLE_RPRBLDR . RW_TITLE_STEP6;
            $FormParams['heading'] = $head_type;
            $FormParams['IncludePage'] = 'template_crit_setup.php';
            break;
        case 'imp':
            // import form
            $FormParams['title'] = RW_TITLE_RPRBLDR . RW_RPT_RPTIMPORT;
            $FormParams['heading'] = RW_RPT_RPTIMPORT;
            $FormParams['IncludePage'] = 'template_import.php';
            break;
        case 'sec':
            // criteria setup form
            $FormParams['title'] = RW_TITLE_RPRBLDR . RW_TITLE_SECURITY;
            $FormParams['heading'] = $head_type;
            $FormParams['IncludePage'] = 'template_security_setup.php';
            break;
    }
    // end switch $StepNum
    return $FormParams;
}