[ Index ]
 

Code source de eGroupWare 1.2.106-2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/projectmanager/inc/jpgraph-1.5.2/src/Examples/ -> testsuit_jpgraph.php (source)

   1  <?php
   2  // ==========================================================================
   3  // File:    TESTSUIT_JPGRAPH.PHP
   4  // Created:    2001-02-24
   5  // Ver:        $Id: testsuit_jpgraph.php 18250 2005-05-07 14:13:43Z ralfbecker $
   6  //
   7  // Description: Generate a page with all individual test graphs suitable
   8  //        for visual inspection. Note: This script must be run from
   9  //        the same directory as where all the individual test graphs
  10  //        are.
  11  //        NOTE: Apache/PHP must have write permission to this directory
  12  //        otherwise the source file can't be created.
  13  //
  14  // Notes:    This script can be called with a parameter type=1 or type=2
  15  //         which controls whether the images should be in situ on the page (2)
  16  //        or just as a link (1). If not specified defaults to (1).
  17  //
  18  // License:    This code is released under GPL 2.0
  19  // Copyright (C) 2001 Johan Persson  
  20  // ==========================================================================
  21  
  22  // Default to 1 if not explicitly specified
  23  $type = !empty($HTTP_GET_VARS['type']) ? $HTTP_GET_VARS['type'] : 1;
  24  
  25  function GetArrayOfTestGraphs($dp) {
  26      if( !chdir($dp) )
  27      die("Can't change to directory: $dir");    
  28      $d = dir($dp);
  29      while($entry=$d->read()) {
  30      if( !strstr($entry,".phps") &&  strstr($entry,".php") && strstr($entry,"x") && !strstr($entry,"show"))
  31          $a[] = $entry;
  32      }
  33      $d->Close();
  34      if( empty($a) ) 
  35         die("JpGraph Tetsuit Error: Apache/PHP does not have enough permission to read".
  36          "the testfiles in directory: $dp");
  37      return $a;
  38  }
  39  
  40  $tf=GetArrayOfTestGraphs(getcwd());
  41  sort($tf);
  42  
  43  echo "<h2>Visual test suit for JpGraph</h2><p>";
  44  echo "Number of tests: ".count($tf)."<p>";
  45  echo "<ol>";
  46  
  47  for($i=0; $i<count($tf); ++$i) {
  48      
  49      $exname = substr($tf[$i], 0, strrpos($tf[$i], '.'));
  50          
  51      switch( $type ) {
  52      case 1:
  53          echo '<li><a href="show-example.php?target='.urlencode($tf[$i]).'">'.$exname.'</a>';
  54          if( isset($showdate) ) echo '['.date("Y-m-d H:i",filemtime($tf[$i])).']';
  55          echo "\n";
  56          break;
  57      case 2:
  58          echo '<li><a href="show-example.php?target='.urlencode($tf[$i]).'">
  59                      <img src="'.$tf[$i].'" border=0 align=top></a>
  60                      <br><strong>Filename:</strong> <i>'.$exname.'</i><br>&nbsp;';
  61          if( isset($showdate) )
  62          echo ' ['.date('Y-m-d H:i',filemtime($tf[$i])).']';
  63          echo "\n";
  64          break;    
  65      }        
  66  }
  67  echo "</ol>";
  68  echo "<p>Test suit done.";
  69  
  70  /* EOF */
  71  ?>


Généré le : Sun Feb 25 17:20:01 2007 par Balluche grâce à PHPXref 0.7