function Run($aProjname, $aForceUpdate = false) { $this->iProjname = $aProjname; echo "<h3>Scanning files for project '{$aProjname}'</h3>"; // Find full filename of all project files in the project $proj = $this->iDBUtils->GetProject($aProjname); $projidx = $proj['fld_key']; $q = "SELECT * FROM tbl_projfiles WHERE fld_projidx={$projidx}"; $res = $this->iDB->Query($q); $n = $res->NumRows(); $ptimer = new JpgTimer(); while ($n-- > 0) { $r = $res->Fetch(); $fname = $r['fld_name']; $modtime = filemtime($fname); $dbtime = strtotime($r['fld_dbupdtime']); if ($aForceUpdate || $modtime > $dbtime) { echo "Parsing file {$fname}...\n"; flush(); $dbdriver = new DBDriver($aProjname, $fname, $this->iDB); $ptimer->Push(); $dbdriver->Run(); $t = round($ptimer->Pop() / 1000, 2); $q = "UPDATE tbl_projfiles SET fld_dbupdtime=now() WHERE fld_key=" . $r['fld_key']; $this->iDB->Query($q); echo "[{$t} s]<br>\n"; } else { echo "DB is up to date with file: '{$fname}'<br>\n"; } } echo "<p><h3>Done.</h3>"; HTMLGenerator::CloseWinButton(); }
function Graph($aWidth = 300, $aHeight = 200, $aCachedName = "", $aTimeOut = 0, $aInline = true) { global $gJpgBrandTiming; // If timing is used create a new timing object if ($gJpgBrandTiming) { global $tim; $tim = new JpgTimer(); $tim->Push(); } // Automatically generate the image file name based on the name of the script that // generates the graph if ($aCachedName == "auto") { $aCachedName = GenImgName(); } // Should the image be streamed back to the browser or only to the cache? $this->inline = $aInline; $this->img = new RotImage($aWidth, $aHeight); $this->cache = new ImgStreamCache($this->img); $this->cache->SetTimeOut($aTimeOut); $this->title = new Text(); $this->title->ParagraphAlign('center'); $this->title->SetFont(FF_FONT2, FS_BOLD); $this->title->SetMargin(3); $this->title->SetAlign('center'); $this->subtitle = new Text(); $this->subtitle->ParagraphAlign('center'); $this->subtitle->SetMargin(2); $this->subtitle->SetAlign('center'); $this->subsubtitle = new Text(); $this->subsubtitle->ParagraphAlign('center'); $this->subsubtitle->SetMargin(2); $this->subsubtitle->SetAlign('center'); $this->legend = new Legend(); $this->footer = new Footer(); // If the cached version exist just read it directly from the // cache, stream it back to browser and exit if ($aCachedName != "" && READ_CACHE && $aInline) { if ($this->cache->GetAndStream($aCachedName)) { exit; } } $this->cache_name = $aCachedName; $this->SetTickDensity(); // Normal density $this->tabtitle = new GraphTabTitle(); }
<?php // content="text/plain; charset=utf-8" require_once "jpgraph/jpgraph.php"; require_once "jpgraph/jpgraph_line.php"; $ydata = array(11, 3, 8, 12, 5, 1, 9, 13, 5, 7); $ydata2 = array(1, 19, 15, 7, 22, 14, 5, 9, 21, 13); $timer = new JpgTimer(); $timer->Push(); // Create the graph. These two calls are always required $graph = new Graph(300, 200); $graph->SetScale("textlin"); $graph->SetMargin(40, 20, 20, 60); $graph->title->Set("Timing a graph"); $graph->footer->right->Set('Timer (ms): '); $graph->footer->right->SetFont(FF_COURIER, FS_ITALIC); $graph->footer->SetTimer($timer); // Create the linear plot $lineplot = new LinePlot($ydata); $lineplot2 = new LinePlot($ydata2); // Add the plot to the graph $graph->Add($lineplot); $graph->Add($lineplot2); $graph->xaxis->title->Set("X-title"); $graph->yaxis->title->Set("Y-title"); $graph->title->SetFont(FF_FONT1, FS_BOLD); $graph->yaxis->title->SetFont(FF_FONT1, FS_BOLD); $graph->xaxis->title->SetFont(FF_FONT1, FS_BOLD); $lineplot->SetColor("blue"); $lineplot->SetWeight(2); $lineplot2->SetColor("orange");
$i = 1; foreach ($allfiles as $f) { $buf .= "<h4>Theme {$i} (<i>" . $names[$i - 1] . ")</i></h4>\n"; $buf .= sprintf($frm, basename($f)); ++$i; } $fp = fopen(CACHE_DIR . "themes.html", "w"); if (!$fp) { die("Can't create index file."); } fwrite($fp, $buf); fclose($fp); echo "<br>"; } $th = array("earth" => array(22, 424, 10, 34, 40, 45, 49, 62, 63, 74, 77, 119, 120, 134, 136, 141, 168, 180, 209, 218, 346, 395, 89, 430), "pastel" => array(22, 424, 27, 38, 42, 58, 66, 79, 105, 110, 128, 147, 152, 230, 240, 331, 337, 405, 415), "water" => array(22, 424, 8, 10, 14, 24, 56, 213, 237, 268, 326, 335, 370, 387, 388), "sand" => array(22, 424, 19, 34, 50, 65, 72, 82, 131, 168, 209)); echo "<h2>JpGraph color chart</h2>"; echo "Generating color chart images ...<br>\n"; flush(); $timer = new JpgTimer(); $timer->Push(); GenColIndex(); echo "<p>Generating themes..."; GenThemes($th); $t = $timer->Pop() / 1000; $t = sprintf("<p>Work done in: %0.2f seconds.", round($t, 2)); echo "{$t}<p>See <a href=\"" . CACHE_DIR . "colorchart.html\">Colorchart</a>\n"; echo "<br>See <a href=\"" . CACHE_DIR . "themes.html\">Index of themes</a>\n"; ?>
function Stroke($aImg) { $y = $aImg->height - $this->iBottomMargin; $x = $this->iLeftMargin; $this->left->Align('left', 'bottom'); $this->left->Stroke($aImg, $x, $y); $x = ($aImg->width - $this->iLeftMargin - $this->iRightMargin) / 2; $this->center->Align('center', 'bottom'); $this->center->Stroke($aImg, $x, $y); $x = $aImg->width - $this->iRightMargin; $this->right->Align('right', 'bottom'); if ($this->iTimer != null) { $this->right->Set($this->right->t . sprintf('%.3f', $this->iTimer->Pop() / 1000.0) . $this->itimerpoststring); } $this->right->Stroke($aImg, $x, $y); }
function Run($aProject) { $this->iProject = $aProject; $timer = new JpgTimer(); echo "<h3>DB Consistency check for project: <font color=blue>{$aProject}</font></h3><hr>"; $timer->Push(); //echo HTMLGenerator::CloseWinButton(); echo "<i>This will verify the integrity of the keys in the database as well as foreign key references. "; echo "It will also perform various consistency check within the methods and classes.</i>"; echo '<hr>'; echo "<h4>Reading project information ... </h4>\n"; flush(); $this->nm = $this->ReadMethods(); $this->nc = $this->ReadClasses(); echo "Classes: {$this->nc},   Methods: {$this->nm} <br>"; echo "<h4>Checking methods ... </h4>\n"; flush(); $this->ChkMethods(); echo "<h4>Checking classes ... </h4>\n"; flush(); $this->ChkClasses(); $t = round($timer->Pop() / 1000, 2); $t = "{$t}" . 's'; if ($this->iErrCnt > 0) { $color = 'red'; } else { $color = 'blue'; } echo " <p> <font color={$color}><b>Found " . $this->iErrCnt . " errors.</b></font>"; echo '<hr> '; echo "\n<table width=100%><tr><td>Time: {$t} </td><td align=right> <form><input type=button value='Close Windows' onclick='window.close();'></form></td></tr></table>"; }
function Graph($aWidth = 300, $aHeight = 200, $aCachedName = "", $aTimeOut = 0, $aInline = true) { global $gJpgBrandTiming; if ($gJpgBrandTiming) { global $tim; $tim = new JpgTimer(); $tim->Push(); } if (!is_numeric($aWidth) || !is_numeric($aHeight)) { JpGraphError::RaiseL(25008); } if ($aCachedName == "auto") { $aCachedName = GenImgName(); } $this->inline = $aInline; $this->img = new RotImage($aWidth, $aHeight); $this->cache = new ImgStreamCache($this->img); $this->cache->SetTimeOut($aTimeOut); $this->title = new Text(); $this->title->ParagraphAlign('center'); $this->title->SetFont(FF_FONT2, FS_BOLD); $this->title->SetMargin(3); $this->title->SetAlign('center'); $this->subtitle = new Text(); $this->subtitle->ParagraphAlign('center'); $this->subtitle->SetMargin(2); $this->subtitle->SetAlign('center'); $this->subsubtitle = new Text(); $this->subsubtitle->ParagraphAlign('center'); $this->subsubtitle->SetMargin(2); $this->subsubtitle->SetAlign('center'); $this->legend = new Legend(); $this->footer = new Footer(); $aCachedName = str_replace("?", "_", $aCachedName); if ($aCachedName != "" && READ_CACHE && $aInline) { if ($this->cache->GetAndStream($aCachedName)) { exit; } } $this->cache_name = $aCachedName; $this->SetTickDensity(); $this->tabtitle = new GraphTabTitle(); }
function Graph($aWidth=300,$aHeight=200,$aCachedName="",$aTimeOut=0,$aInline=true) { GLOBAL $gJpgBrandTiming; // If timing is used create a new timing object if( $gJpgBrandTiming ) { global $tim; $tim = new JpgTimer(); $tim->Push(); } if( !is_numeric($aWidth) || !is_numeric($aHeight) ) { JpGraphError::Raise('Image width/height argument in Graph::Graph() must be numeric'); } // Automatically generate the image file name based on the name of the script that // generates the graph if( $aCachedName=="auto" ) $aCachedName=GenImgName(); // Should the image be streamed back to the browser or only to the cache? $this->inline=$aInline; $this->img = new RotImage($aWidth,$aHeight); $this->cache = new ImgStreamCache($this->img); $this->cache->SetTimeOut($aTimeOut); $this->title = new Text(); $this->title->ParagraphAlign('center'); $this->title->SetFont(FF_FONT2,FS_BOLD); $this->title->SetMargin(3); $this->title->SetAlign('center'); $this->subtitle = new Text(); $this->subtitle->ParagraphAlign('center'); $this->subtitle->SetMargin(2); $this->subtitle->SetAlign('center'); $this->subsubtitle = new Text(); $this->subsubtitle->ParagraphAlign('center'); $this->subsubtitle->SetMargin(2); $this->subsubtitle->SetAlign('center'); $this->legend = new Legend(); $this->footer = new Footer(); // Window doesn't like '?' in the file name so replace it with an '_' $aCachedName = str_replace("?","_",$aCachedName); // If the cached version exist just read it directly from the // cache, stream it back to browser and exit if( $aCachedName!="" && READ_CACHE && $aInline ) if( $this->cache->GetAndStream($aCachedName) ) { exit(); } $this->cache_name = $aCachedName; $this->SetTickDensity(); // Normal density $this->tabtitle = new GraphTabTitle(); }