Exemple #1
0
 function ehMain()
 {
     // This is the only validation.
     $allowed = array('HTML', 'PDF', 'SQL', 'CSV');
     if (!in_array($this->display, $allowed)) {
         echo "Error: Report format may be any of " . implode(',', $allowed);
         return;
     }
     $rep = $this->report_id;
     // Get resolved table names based on security
     $tReports = DDTable_IDResolve('reports');
     // Get Report Information
     $report = SQL_OneRow("Select * from reports where report=" . SQLFC($rep));
     if (!$report) {
         echo "Error: Report " . hFormat($rep) . " not on file";
     }
     $this->row_rep = $report;
     $this->hTitle = $report['description'];
     // Either do custom or run standard report
     //if($report['custom']<>'')
     if (false) {
         include $rep . '_rep.php';
     } else {
         $this->RepStandard();
     }
 }
Exemple #2
0
function scDBUpdateOrInsert($table, $colvals)
{
    $table_id = $table["table_id"];
    $tabflat =& $table["flat"];
    // First query for the pk value.  If not found we will
    // just do an insert
    //
    $abort = false;
    $a_pk = explode(',', $table['pks']);
    $s_where = '';
    foreach ($a_pk as $colname) {
        if (!isset($colvals[$colname])) {
            $abort = true;
            break;
        }
        $a_where[] = $colname . ' = ' . SQL_Format($tabflat[$colname]['type_id'], $colvals[$colname]);
    }
    if ($abort) {
        $skey = false;
    } else {
        $s_where = implode(' AND ', $a_where);
        $sql = 'SELECT skey FROM ' . DDTable_IDResolve($table_id) . ' WHERE ' . $s_where;
        $skey = SQL_OneValue('skey', $sql);
    }
    // STD says on 12/15/2006 that this routine should not put errors on screen
    //if (Errors()) echo HTMLX_Errors();
    if (!$skey) {
        //echo "insert into ".$table_id."\n";
        $retval = SQLX_Insert($table, $colvals, false);
        if (Errors()) {
            // STD says on 12/15/2006 that this routine should not put errors on screen
            //echo HTMLX_Errors();
            //echo $sql;
            $retval = 0;
        }
    } else {
        //echo "update ".$table_id." on $skey\n";
        $colvals['skey'] = $skey;
        $retval = -$skey;
        SQLX_Update($table, $colvals);
        if (Errors()) {
            // STD says on 12/15/2006 that this routine should not put errors on screen
            //echo HTMLX_Errors();
            //echo $sql;
            $retval = 0;
        }
    }
    return $retval;
}
Exemple #3
0
 function __construct($table_id = '')
 {
     // Grab table ID if given, otherwise try to figure
     // one out, but only if we don't have one
     if ($table_id != '') {
         $this->table_id = $table_id;
     } else {
         if ($this->table_id == '') {
             $this->table_id = get_class($this);
         }
     }
     // Load data dictionary.  This is not a tragedy if
     // the page has no table, just forget about it.
     $this->table = DD_TableRef($this->table_id);
     $this->view_id = '';
     if (is_array($this->table)) {
         if (isset($this->table['projections']['_uisearch'])) {
             // capure this directly so it can be overridden
             $this->projections['_uisearch'] = $this->table['projections']['_uisearch'];
         }
         $this->view_id = DDTable_IDResolve($this->table_id);
     }
     // Look for an application-level variable for button_images
     /**
     level:class
     
     The property "button_images" can be overridden by setting
     an application-level property with the [[vgaSet()]] function.
     */
     if (vgaGet('button_images', '') != '') {
         $this->button_images = vgaGet('button_images');
     }
     // Set the page subtitle if we can find it
     if ($this->PageSubtitle == '') {
         $this->PageSubtitle = ArraySafe($this->table, "description", "PLEASE SET -PageSubtitle-");
     }
     // Set the flag_buffer to false if we detect any flags
     // that would do that
     if (gpExists('gp_ajaxcol')) {
         $this->flag_buffer = false;
     }
     if (gpExists('gp_fbproc')) {
         $this->flag_buffer = false;
     }
     if (gpExists('gp_xajax')) {
         $this->flag_buffer = false;
     }
     if (gpExists('fwajax')) {
         $this->flag_buffer = false;
     }
     // This array can be used to override properties on
     // child objects invoked by this object
     $this->children = array();
     // Now set all child tables to be 'drilldown', unless
     // overridden in datadictionary
     if (isset($this->table['fk_children'])) {
         foreach ($this->table['fk_children'] as $table_child => $tabinfo) {
             $display = trim(ArraySafe($tabinfo, 'uidisplay', 'drilldown'));
             $this->children[$table_child]['display'] = $display != '' ? $display : 'drilldown';
         }
     }
     // KFD 6/30/07, allow a gp variable to specify which control to
     //   set focus.  Do it early so it can be overrridden
     if (gpexists('html_focus')) {
         vgfset('HTML_focus', 'x2t_' . hx(gp('html_focus')));
     }
     // ((((((((((((((((((((((((((((*))))))))))))))))))))))))))))))))
     // ((((((((((((((((( Run Custom-level Construct ))))))))))))))))
     $this->construct_custom();
     $this->custom_construct();
     // ((((((((((((((((( Run Custom-level Construct ))))))))))))))))
     // ((((((((((((((((((((((((((((*))))))))))))))))))))))))))))))))
     // Now pass through child tables again, removing any setting
     // that is not allowed by security privs.  Notice we do this
     // after the custom_construct, since that is where a setting might
     // be that conflicts with security setting.
     if (isset($this->table['fk_children'])) {
         $a = array_keys($this->table['fk_children']);
         foreach ($this->table['fk_children'] as $table_child => $tabinfo) {
             if (!DDUserPerm($table_child, 'menu')) {
                 $this->children[$table_child]['display'] = 'none';
             }
         }
     }
 }