function processPost() { // If they are doing a dupe check, convert it into a // search if (gp('gp_action') == 'dupecheck') { gpSet('gpx_mode', 'search'); } // 5/10/06 Added this call. See routine for details. //KenDebug('Entered process post'); $row = aFromGP('x2t_'); if (count($row) > 0) { //KenDebug('Going into textboxes'); processPost_TextBoxes($row); } // this is database inserts/updates, gets its own subroutine // Unless AddControl() was used to build controls, gpControls will // be blank and this is not called. // // AS OF 5/10/06, these are not regularly used in x_table2 // if (gp('gpControls', '') != '') { $data = processPost_Database(); vgfSet('array_post', $data); } // Database deletions, form: gp_delskey_<table>=<skey_value> // // AS OF 5/29/07, revived for Ajax_x3 initiative // AS OF 5/10/06, these are not regularly used in x_table2 // $dels = aFromGP("gp_delskey_"); foreach ($dels as $table_id => $skey) { if (intval($skey) > 0) { $view_id = DDTable_IDResolve($table_id); $sq = "DELETE FROM {$view_id} where skey={$skey}"; SQL($sq); processPost_TableSearchResultsClear($table_id); } } // Look for gp_ob controls, change order-by. Only make // a change if you find a value, no action on blanks $obs = aFromGP("gp_ob_"); foreach ($obs as $table_id => $obnew) { $table = DD_TableRef($table_id); $obold = ConGet("table", $table_id, "orderby"); $obascold = ConGet("table", $table_id, "orderasc"); if ($obnew != '') { if ($obold != $obnew) { // for new column, always go ascending ConSet("table", $table_id, "orderasc", "ASC"); } else { // if repeating the same column, flip ascending/descending $obascnew = $obascold == "ASC" ? "DESC" : "ASC"; ConSet("table", $table_id, "orderasc", $obascnew); } ConSet("table", $table_id, "orderby", $obnew); processPost_TableSearchResultsClear($table_id); } } // Now look for page-turners, where they are advancing to // a new page on a search results display $obs = aFromGP("gp_spage_"); foreach ($obs as $table_id => $pagecommand) { list($spage, $srows, $srppg, $maxpage) = arrPageInfo($table_id); switch ($pagecommand) { case '': $newpage = 0; case '0': $newpage = 1; break; case '1': $newpage = $spage <= 1 ? 1 : $spage - 1; break; case '2': $newpage = $spage >= $maxpage ? $maxpage : $spage + 1; break; case '3': $newpage = $maxpage; break; } if ($newpage != 0) { ConSet('table', $table_id, 'spage', $newpage); } } // Check to see if an onscreen child table row was saved if (gp('gp_child_onscreen', '') != '') { $parent_skey = gp('gp_skey'); $table = gp('gp_child_onscreen'); $cols = aFromGP('gp_onscreen_' . $table . '_'); $table_dd = dd_tableRef($table); SQLX_Insert($table_dd, $cols); gpSet('gp_skey', $parent_skey); } }
function hBrowse_NavBar() { // Get vital stats, work out what the max page is $table_id = $this->table['table_id']; $var = 'gp_spage_' . $table_id; hidden($var, ''); list($spage, $srows, $rppage, $maxpage) = arrPageInfo($table_id); if ($srows == 0) { return ''; } // Work out the "Page x of y" text $hcenter = 'Page ' . ($srows == 0 ? '0' : $spage) . " of {$maxpage}"; // Work out if the First/Prev links are enabled $lprev = $spage == 1 ? false : true; $lnext = $spage == $maxpage ? false : true; //if(!($lprev || $lnext)) return ''; // Two different bits of HTML based on which path if ($this->button_images) { $hprev = hLinkImage('first', 'First', $var, 0, $lprev) . " " . hLinkImage('previous', 'Prev', $var, 1, $lprev); $hnext = hLinkImage('next', 'Next', $var, 2, $lnext) . " " . hLinkImage('last', 'Last', $var, 3, $lnext); return "\n" . hTable(100) . "<tr>" . "\n<td align=left width=39%>{$hprev}</td>" . "\n<td align=center width=22%>{$hcenter}</td>" . "\n<td align=right width=39%>{$hnext}</td>" . "\n</tr></table>"; } else { $hprev = $this->hTextButton('«', $var, 0, $lprev, 'First') . $this->hTextButton('<', $var, 1, $lprev, 'Previous'); $hnext = $this->hTextButton('>', $var, 2, $lnext, 'Next') . $this->hTextButton('»', $var, 3, $lnext, 'Last'); if (vgfget('buttons_in_commands')) { vgfSet('html_navbar', $hprev . '<span style="width:100px;font-size:10px;margin-left:5px;margin-right:5px;vertical-align:middle;">' . $hcenter . '</span>' . $hnext); return ''; } else { return "\n<div class=\"btn-group\" style=\"padding-bottom:10px;\">\n" . $hprev . $hnext . "\n</div>"; } } // Return the assembled HTML fragment }