/** * html string = <b>hTDsFromArray</b>($class,$array) * * Returns one or more TD elements row, with each element of the Row array * becoming an HTML TD element. Each TD is assigned the CSS class name * of CSS_Class unless the first parameter is an empty string. * * INPUTS * string $class CSS Class * array $array * RETURN * string Generated HTML */ function hTDSFromArray($class, $array) { $retval = ''; foreach ($array as $value) { $retval .= hTD($class, $value); } return $retval; }
function ehTBodyFromRows(&$rows, $columns = array(), $options = array()) { // For alternating dark/lite $flag_alt = false; if (isset($options['alternate'])) { $flag_alt = true; } $cssRow = 'dlite'; // Error check the parameters if (!is_array($rows)) { ErrorAdd("ehTBodyFromRows: 1st parm must be array of rows"); } if (!is_array($columns)) { ErrorAdd("ehTBodyFromRows: 2nd parm must be array of columns"); } // Create columns if it was not provided. if (count($columns) == 0) { $colspre = array_keys($rows[0]); foreach ($colspre as $colname) { if (!is_numeric($colname)) { if ($colname != 'skey') { $columns[$colname] = array(); } } } } // Now flesh out various defaults, set hidden vars foreach ($columns as $colname => $colopts) { if (isset($colopts['cpage']) && !isset($colopts['ccol'])) { $columns[$colname]['ccol'] = 'skey'; } if (isset($columns[$colname]['ccol'])) { hidden('gp_' . $columns[$colname]['ccol'], ''); } } // Run through the rows and output them $makehidden = ''; foreach ($rows as $row) { echo "<tr>"; foreach ($columns as $colname => $colopts) { $value = $row[$colname]; if (isset($colopts['cpage'])) { $pg = $colopts['cpage']; $ccol = $colopts['ccol']; $cval = $row[$ccol]; $js = "SetAction('gp_page','{$pg}','gp_{$ccol}','{$cval}')"; $value = '<a href="javascript:' . $js . '">' . $value . '</a>'; } echo hTD($cssRow, $value); if ($flag_alt) { $cssRow = $cssRow == 'dlite' ? 'ddark' : 'dlite'; } } echo "</tr>"; } }
function hBoxesFromAhComprehensive($ahc, $mode = 'upd') { $HFirst = ''; ob_start(); $count = 0; foreach ($ahc as $colname => $colinfo) { $count++; $extra = $colinfo['input'] == 'textarea' ? 'style="vertical-align:top; padding-top:2px"' : ''; if ($colinfo['writeable'] && $HFirst == '') { $HFirst = $colinfo['parms']['name']; } if (!isset($this->table['flat'][$colname])) { echo "Reference non-existent column: " . $colname; exit; } $desc = $this->table['flat'][$colname]['description']; $hr = $colinfo['hright'] == '' ? '' : ' ' . $colinfo['hright']; echo "\n<tr>"; echo "\n" . hTD('inp-caption', $desc, 'id="inp-caption" ' . $extra); echo "\n" . hTD('inp-input', $colinfo['html'] . $hr); if ($count == 1 && $mode == 'search') { ?> <td rowspan="99" style="border: 1px solid #606060; width: 33%; padding: 0px 8px; background-color: #E0FFE0"> <h3>Lookup Mode</h3> Fill in as many boxes as you like. Hit ENTER or ALT-L to execute the lookup. <br/><br/> Put a "%" sign anywhere to act as a wildcard. <br/><br/> Use ">" for greater than, as in ">Jones" or ">5/1/07" or ">200". The "<" works the same way. <br/><br/> Use a dash for ranges as in "100-200" or "5/1/07-6/31/07". <br/><br/> Use a comma for lists of exact values, as in "5/1/07,3/31/06" or "Jones,Smith" <br/><br/> You can also do combinations, such as "<2,6,7-10,>15" <br/><br/> All searches are case-insensitive. </td> <?php } echo "\n</tr>"; } vgfSet('HTML_focus', $HFirst); return ob_get_clean(); }