/[corp_html]/back/phormation/displaytable.php
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /back/phormation/displaytable.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.10 by ravilov, Thu Jul 19 12:42:47 2001 UTC revision 1.11 by ravilov, Thu Sep 6 12:27:43 2001 UTC
# Line 24  Line 24 
24   *  Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.   *  Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
25   */   */
26    
27    if (!isset($phescape)) $phescape = true;
28    
29  include_once( "$phormationdir/dbi.php" );  include_once( "$phormationdir/dbi.php" );
30    
31  // these variables will be preserved, as long as makephself is used to  // these variables will be preserved, as long as makephself is used to
# Line 102  function displayresult( $result, $fields Line 104  function displayresult( $result, $fields
104      $startrecord = $pagelength * $pagenum;      $startrecord = $pagelength * $pagenum;
105      $endrecord = min( $pagelength * ( $pagenum + 1 ) - 1, $numrows - 1 );      $endrecord = min( $pagelength * ( $pagenum + 1 ) - 1, $numrows - 1 );
106      $numpages = ceil( $numrows / $pagelength );      $numpages = ceil( $numrows / $pagelength );
107    
108        $rows = array();
109        for ($i = $startrecord; $i <= $endrecord; $i++) $rows[$i] = dbi_fetch_array($result, $i);
110    
111      if( $pagenum > 0 ) {      if( $pagenum > 0 ) {
112          echo '<a href="' . makephpself( "pagenum=" . ($pagenum - 1) ) .  '">Previous Page</A> - ';          echo '<a href="' . makephpself( "pagenum=" . ($pagenum - 1) ) .  '">Previous Page</A> - ';
113      } else {      } else {
# Line 114  function displayresult( $result, $fields Line 120  function displayresult( $result, $fields
120      } else {      } else {
121          echo ' - Next Page';          echo ' - Next Page';
122      }      }
123        if ($params["quickjump"]) {
124            $tmp = array();
125            for( $i = $startrecord; $i <= $endrecord; $i += 1 ) {
126                if (empty($rows[$i][$params["quickjump"]])) continue;
127                array_push($tmp, '<OPTION VALUE="#' . sprintf("%03d", $i) . '">' .
128                    HTMLSpecialChars($rows[$i][$params["quickjump"]]) . '</OPTION>');
129            }
130            if (count($tmp) > 0) {
131                    array_unshift($tmp, "<OPTION VALUE=\"\">&nbsp;</OPTION>");
132                    echo "\n<FORM><SMALL><FONT FACE=\"sans-serif\">QuickJump:</FONT> <SELECT STYLE=\"font-size:12px\" ONCHANGE=\"if(this.value)location.href=this.value;\">" . implode("", $tmp) . "</SELECT></FORM></SMALL>";
133            }
134        }
135      echo '<P>';      echo '<P>';
136    
137      echo '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=3 BGCOLOR="' . $tableheadercol .'" FGCOLOR="#FFFFFF">';      echo '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=3 BGCOLOR="' . $tableheadercol .'" FGCOLOR="#FFFFFF">';
# Line 125  function displayresult( $result, $fields Line 143  function displayresult( $result, $fields
143      }      }
144      $row = 0;      $row = 0;
145      for( $i = $startrecord; $i <= $endrecord; $i += 1 ) {      for( $i = $startrecord; $i <= $endrecord; $i += 1 ) {
146          $array = dbi_fetch_array( $result, $i );          $array = $rows[$i];
147          echo "<TR BGCOLOR=" . $colour[ $i % 2 ] . ">";          echo "<TR BGCOLOR=" . $colour[ $i % 2 ] . ">";
148          echo '<TD bgcolor="#ffffff">';          echo '<TD bgcolor="#ffffff" VALIGN=top>';
149          echo '<a href="' . makephpself( "action=delete&record_id=" . $array[$key] ) . '" onClick="return confirmdelete()">';          echo '<a href="' . makephpself( "action=delete&record_id=" . $array[$key] ) . '" onClick="return confirmdelete()">';
150          echo '<img src="' . $phormationdir . '/delete.gif" alt="delete record" border="0"></a></TD>';          echo '<img src="' . $phormationdir . '/delete.gif" alt="delete record" border="0"></a></TD>';
151          echo '<TD bgcolor="#ffffff"><a href="' . $editlink . 'record_id=' . $array[$key] . '">';          echo '<TD bgcolor="#ffffff" VALIGN=top><a href="' . $editlink . 'record_id=' . $array[$key] . '">';
152          echo '<img src="' . $phormationdir . '/edit.gif" alt="edit record" border="0"></a></TD>';          echo '<img src="' . $phormationdir . '/edit.gif" alt="edit record" border="0"></a></TD>';
153          for( $j = 0; ! empty( $names[$j] ); $j += 1 ) {          for( $j = 0; ! empty( $names[$j] ); $j += 1 ) {
154              if ( empty ( $fields[$j] ) ) continue;              if ( empty ( $fields[$j] ) ) continue;
155              echo "<TD>\n";              echo "<TD VALIGN=top>\n";
156                if ($params["quickjump"] && $j == 0) echo '<A NAME="' . sprintf("%03d", $i) . '"></A>';
157              $vals = array();              $vals = array();
158              $flds = split(",", $fields[$j]);              $flds = split(",", $fields[$j]);
159              while (list($k, $v) = each($flds)) {              while (list($k, $v) = each($flds)) {
160                  $x = $array[trim($v)];                  $x = $array[trim($v)];
161                  if (!$x) $x = $array[$j + 1];                  # if (!$x) $x = $array[$j + 1];
162                  array_push($vals, $x);                  array_push($vals, $x);
163              }              }
164              $vals = implode(", ", $vals);              $vals = implode(", ", $vals);
165              $vals = htmlspecialchars($vals);              if ($phescape) $vals = htmlspecialchars($vals);
166              if (!empty($params["display_hook"]))              if (!empty($params["display_hook"]))
167                  $vals = $params["display_hook"]($fields[$j], $vals);                  $vals = $params["display_hook"]($fields[$j], $vals);
168              if (!$vals) $vals = "&nbsp;";              if (!$vals) $vals = "&nbsp;";
# Line 161  function table_index( $fields, $names, $ Line 180  function table_index( $fields, $names, $
180    
181      // get params      // get params
182      $title = $params["title"];      $title = $params["title"];
183        $charset = $params["charset"];
184    
185      if( $action == "delete" ) {      if( $action == "delete" ) {
186          // if a record should be deleted          // if a record should be deleted
# Line 177  function table_index( $fields, $names, $ Line 197  function table_index( $fields, $names, $
197      ?>      ?>
198      <HTML>      <HTML>
199      <HEAD>      <HEAD>
200        <? if ($charset): ?><META HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=<? echo $charset ?>"><? endif; ?>
201      <TITLE><? echo $title ?></TITLE>      <TITLE><? echo $title ?></TITLE>
202      </HEAD>      </HEAD>
203      <BODY BGCOLOR="#FFFFFF" LINK="#000090" VLINK="#000090" ALINK="#FF0000" >      <BODY BGCOLOR="#FFFFFF" LINK="#000090" VLINK="#000090" ALINK="#FF0000" >

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

  ViewVC Help
Powered by ViewVC 1.1.26