/[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.6 by ravilov, Fri Jul 6 12:01:44 2001 UTC revision 1.13 by ravilov, Mon Sep 17 10:35:27 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 = 0; $i < $numrows; $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 = 0; $i < count( $rows ); $i++ ) {
126                if ( empty( $rows[$i][$params["quickjump"]] ) ) continue;
127                $url = "#".sprintf( "%03d", $i );
128                if ( $i < $startrecord || $i > $endrecord )
129                    $url = makephpself( "pagenum=".intval( $i / $pagelength ) ) . $url;
130                array_push($tmp, '<OPTION VALUE="' . $url . '">' .
131                    HTMLSpecialChars( $rows[$i][$params["quickjump"]] ) . '</OPTION>');
132            }
133            if ( count( $tmp ) > 0 ) {
134                    array_unshift( $tmp, "<OPTION VALUE=\"\">&nbsp;</OPTION>" );
135                    echo "\n<FORM><SMALL><FONT FACE=\"sans-serif\">QuickJump:</FONT> <SELECT STYLE=\"font-size:12px\" ONCHANGE=\"if(this.value)self.location.href=this.value;\">\n" . implode("\n", $tmp) . "</SELECT></FORM></SMALL>";
136            }
137        }
138      echo '<P>';      echo '<P>';
139    
140      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 146  function displayresult( $result, $fields
146      }      }
147      $row = 0;      $row = 0;
148      for( $i = $startrecord; $i <= $endrecord; $i += 1 ) {      for( $i = $startrecord; $i <= $endrecord; $i += 1 ) {
149          $array = dbi_fetch_array( $result, $i );          $array = $rows[$i];
150          echo "<TR BGCOLOR=" . $colour[ $i % 2 ] . ">";          echo "<TR BGCOLOR=" . $colour[ $i % 2 ] . ">";
151          echo '<TD bgcolor="#ffffff">';          echo '<TD bgcolor="#ffffff" VALIGN=top>';
152          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()">';
153          echo '<img src="' . $phormationdir . '/delete.gif" alt="delete record" border="0"></a></TD>';          echo '<img src="' . $phormationdir . '/delete.gif" alt="delete" border="0"></a></TD>';
154          echo '<TD bgcolor="#ffffff"><a href="' . $editlink . 'record_id=' . $array[$key] . '">';          echo '<TD bgcolor="#ffffff" VALIGN=top><a href="' . $editlink . 'record_id=' . $array[$key] . '">';
155          echo '<img src="' . $phormationdir . '/edit.gif" alt="edit record" border="0"></a></TD>';          echo '<img src="' . $phormationdir . '/edit.gif" alt="edit" border="0"></a></TD>';
156          for( $j = 0; ! empty( $names[$j] ); $j += 1 ) {          for( $j = 0; ! empty( $names[$j] ); $j += 1 ) {
157              if ( empty ( $fields[$j] ) ) continue;              if ( empty ( $fields[$j] ) ) continue;
158              echo "<TD>\n";              echo "<TD VALIGN=top>\n";
159                if ($params["quickjump"] && $j == 0) echo '<A NAME="' . sprintf("%03d", $i) . '"></A>';
160              $vals = array();              $vals = array();
161              $flds = split(",", $fields[$j]);              $flds = split(",", $fields[$j]);
162              while (list($k, $v) = each($flds)) {              while (list($k, $v) = each($flds)) {
163                  $x = $array[trim($v)];                  $x = $array[trim($v)];
164                  if (!$x) $x = $array[$j + 1];                  # if (!$x) $x = $array[$j + 1];
165                  array_push($vals, $x);                  array_push($vals, $x);
166              }              }
167              $vals = implode(", ", $vals);              $vals = implode(", ", $vals);
168              echo $vals ? htmlspecialchars($vals) : "&nbsp;";              if ($phescape) $vals = htmlspecialchars($vals);
169              echo "</TD>\n";              if (!empty($params["display_hook"]))
170                    $vals = $params["display_hook"]($fields[$j], $vals);
171                if ($vals == "") $vals = "&nbsp;";
172                echo "$vals</TD>\n";
173          }          }
174          echo "</TR>\n";          echo "</TR>\n";
175      }      }
# Line 158  function table_index( $fields, $names, $ Line 183  function table_index( $fields, $names, $
183    
184      // get params      // get params
185      $title = $params["title"];      $title = $params["title"];
186        $charset = $params["charset"];
187    
188      if( $action == "delete" ) {      if( $action == "delete" ) {
189          // if a record should be deleted          // if a record should be deleted
# Line 174  function table_index( $fields, $names, $ Line 200  function table_index( $fields, $names, $
200      ?>      ?>
201      <HTML>      <HTML>
202      <HEAD>      <HEAD>
203        <? if ($charset): ?><META HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=<? echo $charset ?>"><? endif; ?>
204      <TITLE><? echo $title ?></TITLE>      <TITLE><? echo $title ?></TITLE>
205      </HEAD>      </HEAD>
206      <BODY BGCOLOR="#FFFFFF" LINK="#000090" VLINK="#000090" ALINK="#FF0000" >      <BODY BGCOLOR="#FFFFFF" LINK="#000090" VLINK="#000090" ALINK="#FF0000" >
# Line 189  function table_index( $fields, $names, $ Line 216  function table_index( $fields, $names, $
216          }          }
217      // end -->      // end -->
218      </script>      </script>
219      <h1><? echo $title ?></h1>      <h1><?= $title ?></h1>
220      <?        <?  
221          if( function_exists( html_before_table ) ) {          if( function_exists( html_before_table ) ) {
222              html_before_table();              html_before_table();
# Line 207  function table_index( $fields, $names, $ Line 234  function table_index( $fields, $names, $
234          if( !empty( $params["addmultiplelink"] ) ) {          if( !empty( $params["addmultiplelink"] ) ) {
235              echo ' - <a href="' . $params["addmultiplelink"] . '">Create Several Records</A>';              echo ' - <a href="' . $params["addmultiplelink"] . '">Create Several Records</A>';
236          }          }
237            if (!empty($params["back"])) {
238                echo ' - <a href="'.$params["back"].'">Back to Index</a>';
239            }
240          echo "<P>";          echo "<P>";
241          echo $params["instr"];          echo $params["instr"];
242            

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.13

  ViewVC Help
Powered by ViewVC 1.1.26