[GRASS-SVN] r31851 - grass-web/trunk
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Jun 26 04:07:53 EDT 2008
Author: neteler
Date: 2008-06-26 04:07:51 -0400 (Thu, 26 Jun 2008)
New Revision: 31851
Added:
grass-web/trunk/grassmodules.php
Modified:
grass-web/trunk/main.inc
Log:
added module of the day, thanks to Francesco Pirotti
Added: grass-web/trunk/grassmodules.php
===================================================================
--- grass-web/trunk/grassmodules.php (rev 0)
+++ grass-web/trunk/grassmodules.php 2008-06-26 08:07:51 UTC (rev 31851)
@@ -0,0 +1,50 @@
+<?php
+ # Written 2008 by francesco <francesco.pirotti AT unipd it>
+
+ function getmodule(){
+ # The index directory where all modules man pages are
+ $fullindex_directory="grass64/manuals/html64_user";
+ # The index page with complete list of modules
+ $fullindex= $fullindex_directory . '/full_index.html' ;
+ # Type of choice of module: 'random' is different module each time page is loaded while 'day' is daily module.
+ $type='random';
+ //$type='day';
+
+ ob_start();
+ include($fullindex);
+ $buffer= ob_get_contents();
+ ob_end_clean();
+ $a=explode("\n", $buffer);
+
+ $cc=0;
+ if($type=='random'){
+ $ra=rand(0,1000);
+ while(substr($a[$ra], 0, 27)!="<tr><td valign=top><small><a href="){
+ $ra=rand(0,1000);
+ $cc++;
+ if($cc>20){
+ $a[$ra]='<tr><td valign=top><small><a href="r.average.html">r.average</a></small></td> <td><small>Finds the average of values in a cover map within areas assigned the same category value in a user-specified base map.</small></td></tr>';
+ break;
+ }
+ }
+ }
+
+ else if($type=='day'){
+ $ra=date("z")+75;
+ while(substr($a[$ra], 0, 27)!="<tr><td valign=top><small><a href="){
+ $ra=date("z")+$cc;
+ $cc++;
+ if($cc>20){
+ $a[$ra]='<tr><td valign=top><small><a href="r.average.html">r.average</a></small></td> <td><small>Finds the average of values in a cover map within areas assigned the same category value in a user-specified base map.</small></td></tr>';
+ break;
+ }
+ }
+ }
+ else
+ $a[$ra]="Error in module";
+ return "<table>" . str_replace("href=\"", "href=\"$fullindex_directory/", $a[$ra]) . "</table>";
+}
+
+
+echo getmodule();
+?>
Modified: grass-web/trunk/main.inc
===================================================================
--- grass-web/trunk/main.inc 2008-06-26 08:05:02 UTC (rev 31850)
+++ grass-web/trunk/main.inc 2008-06-26 08:07:51 UTC (rev 31851)
@@ -36,6 +36,7 @@
settings around the world, as well as by many governmental agencies
and environmental consulting companies. GRASS is official project of
the <a href="http://www.osgeo.org/">Open Source Geospatial Foundation</a>.
+<p>
<SCRIPT LANGUAGE="JavaScript" type="text/javascript">
<!--
@@ -51,6 +52,20 @@
-->
</SCRIPT>
+<center>
+<table border=1 width="50%">
+<tr>
+<td>
+<p><small><i>Module of the day:</i>
+<?php
+include("grassmodules.php");
+?>
+</small>
+</td>
+</tr>
+</table>
+</center>
+
<!-- MAIN: NEWS SECTION -->
<?php
More information about the grass-commit
mailing list