From Humanitarian-FOSS Project Development Site
Output
Documentation
Source Code
<?php
/* $Id: home.inc,v 1.0 2007/01/31 */
/**
*
* Class List
* @package Hello_World_Module
* @copyright Copyright {@link http://www.opensource.lk Lanka Software Foundation} 2006
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License (LGPL)
* @author Jonathan Damon <jonathan.damon@trincoll.edu>
*
*/
/**
* Retrieve information from the tables.
* The query joins the 3 tables and selects only the fields I need.
* After execute the information is stored in $result.
* Then I break out of php and set up the table header.
*/
global $global;
$db=$global['db'];
$q = "select members.name, email, members.school, state, role, teams.name from members, teams, schools where members.team = teams.number and members.school = schools.name";
$result=$db->Execute($q);
?>
<div id="home">
<h2><?=_("Class List")?></h2>
<table width="100%">
<thead>
<td><?=_("Member")?></td>
<td><?=_("Email")?></td>
<td><?=_("School")?></td>
<td><?=_("State")?></td>
<td><?=_("Role")?></td>
<td><?=_("Team Name")?></td>
</thead>
<tbody>
<?php
/**
* Now I loop through result and pull out my fields.
* Each time through, I break out of php, put the data in the table,
* and enter php to advance $result at the end of the loop.
* The end tags close the table.
*/
while(!$result==NULL && !$result->EOF){
?>
<tr>
<td><?php echo $result->fields[0]?></td>
<td><?php echo $result->fields[1]?></td>
<td><?php echo $result->fields[2]?></td>
<td><?php echo $result->fields[3]?></td>
<td><?php echo $result->fields[4]?></td>
<td><?php echo $result->fields[5]?></td>
</tr>
<?php
$result->MoveNext();
}
?>
</tbody>
</table>
</div>
<br />