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(); } }
function addData($rows) { $dd = ddTable($this->hp['x6table']); foreach ($rows as $row) { $this->addRow($row['skey']); foreach ($this->columns as $colinfo) { if ($colinfo['column_id'] == '') { continue; } $column_id = trim($colinfo['column_id']); if (isset($row[$column_id])) { $type_id = $dd['flat'][$column_id]['type_id']; $x6view = arr($dd['flat'][$column_id], 'x6view', 'text'); if (!($type_id == 'text' && $x6view == 'window')) { $value = hFormat($type_id, $row[$column_id]); } else { $t = $this->hp['x6table']; $c = $column_id; $s = $row['skey']; $a = html('a'); $a->setHtml('View'); $a->hp['href'] = "javascript:x6inputs.viewClob({$s},'{$t}','{$c}')"; $value = $a; } $this->addCell($value); } else { $this->addCell(''); } } } }
function hDisplayOnscreen($filters = array(), &$parent_row) { $parent_pks = $filters; // capture for later reference //hprint_r($filters); // Pull the rows so we know how many we have if (count($filters) != 0) { //$filters=ConSet('table',$this->table_id,'search',$filters); processPost_TableSearchResultsClear($this->table_id); } $rows = rowsFromUserSearch($this->table, $this->projections['_uisearch'], $filters, true); $early_return = $this->hDisplayOnscreenOverride($rows, $filters, $parent_row); if ($early_return != '') { return $early_return; } // Pull the nav bar. Do this after pulling rows so we // know how many rows there are, what page we're on, etc. $hNavBar = $this->hBrowse_NavBar(); // Generate the table header $cols1 = asliceValsFromKeys($this->table['flat'], 'description', $this->projections['_uisearch']); $cols2 = array('Edit'); if (DDUserPerm($this->table_id, 'del')) { $cols2[] = 'Delete'; } $cols = array_merge($cols1, $cols2); if (count($rows) == 0) { $hContent = "<tr><td colspan=99 class=\"dlite\">" . "<b>There are no records to display</b>" . "</td></tr>\n"; } else { // Convert last column to hyperlink to that page/row foreach ($rows as $index => $row) { $slipin1 = hLinkPostFromArray('', 'Edit', array('gp_dd_page' => $this->table_id, 'gp_skey' => $row['skey'], 'gp_mode' => 'upd')); //$slipin1=array('_edit'=>$slipin); $slipin2 = ''; if (DDUserPerm($this->table_id, 'del')) { $slipin2 = hLinkPostFromArray('', 'Delete', array('gp_delskey_' . $this->table_id => $row['skey'], 'gp_mode' => 'upd', 'gp_skey' => gp('gp_skey'))); } //$slipin=array('_del'=>$slipin); // Get the formatted value foreach ($row as $colname => $colvalue) { $value = hFormat($this->table['flat'][$colname]['type_id'], $colvalue); $rows[$index][$colname] = $value; } if (isset($row['skey'])) { unset($rows[$index]['skey']); } $rows[$index][] = $slipin1; $rows[$index][] = $slipin2; //$rows[$index]=array_merge($rows[$index],$slipin); } $hContent = hTBodyFromRows('', $rows); } // Add an empty row for inserting $empty_row = ''; $table_id = $this->table['table_id']; /* foreach($cols1 as $column=>$description){ $value = ''; $name_id = 'gp_onscreen_'.$table_id.'_'.$column.''; $iname = 'name="'.$name_id.'" '.'id="'.$name_id.'"'; $value = '<input type="text" '.$iname.'></input>'; $empty_row .= hTD('',$value,''); } */ $empty_row = ''; $parent_skey = $parent_row['skey']; $pkcols = explode(',', $this->table['pks']); // KFD 1/11/07, unconditionally copied in all values supplied // from parent. foreach ($pkcols as $pkcol) { if (!isset($parent_row[$pkcol])) { continue; } $prefilled[$pkcol] = $parent_row[$pkcol]; } $prefilled = $parent_pks; //hprint_r($prefilled); $opts = array('drilldownmatches' => $prefilled, 'name_prefix' => 'gp_onscreen_' . $table_id . '_', 'hpsize' => 12); // KFD 5/29/07, refactoring code to use new widget generation // routines, no more ahInputsComprehensive. //$inputs = ahInputsComprehensive($this->table,'ins',$prefilled,'_uisearch',$opts); //foreach($inputs as $column=>$details){ // $empty_row .= hTD('',$details['html'],''); //} $acols = aColsModeProj($this->table, 'ins', '_uisearch'); $ahcols = aHColsfromACols($acols, $prefilled); $name_prefix = 'gp_onscreen_' . $table_id . '_'; $xh = hDetailFromAHCols($ahcols, $name_prefix, 500, 'tds'); $xh = jsValues($ahcols, $name_prefix, $prefilled, $xh); $empty_row .= $xh; // END OF CHANGES 5/29/07 code refactoring //hprint_r(htmlentities($empty_row)); // Add a save link hidden('gp_child_onscreen', ''); $name_id = 'onscreen_save'; $iname = 'name="' . $name_id . '" ' . 'id="' . $name_id . '"'; $value = '<a tabindex="' . hpTabIndexNext(500) . '" href="' . "javascript:SetAction('gp_skey',{$parent_skey},'gp_child_onscreen','{$table_id}')" . '">Save</a>'; $empty_row .= hTD('', $value, ''); // Add a <tr></tr> $empty_row = '<tr>' . $empty_row . '</tr>'; // Attatch the empty row $hContent .= $empty_row; $hNew = hLinkPostFromArray('', $this->table['description'], array('gp_dd_page' => $this->table_id)); //$hDsc="<span class=\"x2menubar_text\">" // .$this->table['description'] // .'</span>'; ob_start(); ?> <br> <br> <div class="x2menubar" style="text-align: left"> <?php echo $hNew; ?> </div> <div class="andro_space2"></div> <fieldset> <?php echo hTRFromArray('dhead', $cols); ?> <?php echo $hContent; ?> <tr> <td colspan=99 class='dhead'> </td> </tr> </fieldset> <?php return ob_get_clean(); }
function index_hidden_ajxFETCH() { $returns = array(); // First fetch the values $table_id = gp('ajxtable'); $table_dd = dd_Tableref($table_id); $colname = gp('ajxcol'); $colvalue = gp('ajxval'); $lcontrols = gp('ajxcontrols'); $lcolumns = gp('ajxcolumns'); $acontrols = explode(',', $lcontrols); $acolumns = explode(',', $lcolumns); // Since this is an ajax call, malformed requests exit with // no error or explanation if (count($acontrols) != count($acolumns)) { exit; } if (count($acontrols) == '') { exit; } if ($colvalue == '') { exit; } // Split column names and values and build a where clause // If any funny business, exit with no explanation $acols = explode(',', $colname); $avals = explode(',', $colvalue); $awhere = array(); if (count($acols) != count($avals)) { exit; } foreach ($acols as $x => $acol) { $awhere[] = str_replace("'", "''", $acol) . ' = ' . SQLFC($avals[$x]); } // Build and execute some SQL $sq = "SELECT " . str_replace("'", "''", $lcolumns) . " FROM " . str_replace("'", "''", $table_id) . " WHERE " . implode(' AND ', $awhere); $row = SQL_OneRow($sq); // Any unusable results return with no error or complaint if (!is_array($row)) { return false; } if (count($row) == 0) { return false; } //ob_start(); //hprint_r($row); //$returns[]="echo|".ob_get_clean(); //$returns[]='echo|'.$sq; // Build and return the controls foreach ($acontrols as $x => $acontrol) { //$returns[]='echo|'.$acontrol; //$returns[]='echo|'.$acolumns[$x]; $cn = $acolumns[$x]; if ($table_dd['flat'][$cn]['type_id'] == 'date') { $row[$cn] = hFormat('date', $row[$cn]); } if (is_null($row[$cn])) { $row[$cn] = ''; } else { $row[$cn] = trim($row[$cn]); } $returns[] = '_value|' . $acontrol . '|' . trim($row[$acolumns[$x]]); } echo implode('|-|', $returns); }