Beispiel #1
0
function ColumnValue(&$table, &$row, $mode, $colname)
{
    if (isset($row[$colname])) {
        return $row[$colname];
    }
    if ($mode != 'ins') {
        return '';
    }
    // All the rest is for inserts
    $colinfo =& $table['flat'][$colname];
    if ($colinfo['automation_id'] != 'DEFAULT') {
        return '';
    } else {
        // These are different kinds of default values
        if ($colinfo['auto_formula'] != '%now') {
            $val = $colinfo['auto_formula'];
        } else {
            if ($colinfo['type_id'] == 'date') {
                $val = hDate(time());
            } else {
                $x = time() % 86400;
                $x = intval($x / 60);
                $x -= $x % 15;
                $val = strval($x);
            }
        }
        $row[$colname] = $val;
        return $val;
    }
}
Beispiel #2
0
 function ehBrowse_Data(&$rows)
 {
     // Generate the table header as sortable columns
     echo "\n";
     $cols = asliceValsFromKeys($this->table['flat'], 'description', $this->projections['_uisearch']);
     echo hTableSortable($this->table_id, $cols);
     // Retrieve the rows
     if (count($rows) > 0) {
         vgfSet('HTML_focus', 'browse_row0');
         $hrows = array();
         $j = 0;
         foreach ($rows as $row) {
             $j++;
             $i = 0;
             $newrow = array();
             foreach ($cols as $colname => $coldesc) {
                 if ($i != 0) {
                     switch ($this->table['flat'][$colname]['type_id']) {
                         case 'time':
                             $newrow[] = hTime($row[$colname]);
                             break;
                         case 'dtime':
                             $newrow[] = date('m/d/Y - h:i A', dEnsureTS($row[$colname]));
                             break;
                         case 'date':
                             if (is_null($row[$colname])) {
                                 $newrow[] = '';
                             } else {
                                 $newrow[] = hDate(strtotime($row[$colname]));
                             }
                             //$newrow[]=$row[$colname];
                             break;
                         default:
                             $newrow[] = $row[$colname];
                     }
                 } else {
                     $hName = $j == 1 ? ' id="browse_row0" ' : '';
                     $js = "SetAction('gp_page','" . $this->table_id . "'" . ",'gp_skey','" . $row['skey'] . "')";
                     $value = '<a tabindex=' . $j . $hName . ' ' . 'href="javascript:' . $js . '">' . $row[$colname] . '</a>';
                     $newrow[] = $value;
                     $i = 1;
                 }
             }
             $hrows[] = $newrow;
         }
         echo hTBodyFromRows('dlite', $hrows);
     } else {
         echo "\n<tr><td colspan=99 class='dlite'>" . "<b>There are no records to display</b>" . "</td></tr>\n";
     }
     // Wrap up by closing the table.
     echo "\n<tr><td colspan=99 class='dhead'>&nbsp;</td></tr>";
     echo "\n</table>";
 }