Last commit for v1/php/sample.php: 17ee68cff3d814bae3fcf7dc55beaf3e49909889

All code licences changed to LGPL v3.0

Hamid [2012-07-05 10:38:10]
All code licences changed to LGPL v3.0

	// Prayer Times Calculator, Sample Usage
	// By: Hamid Zarrabi-Zadeh
	// Inputs : $method, $year, $latitude, $longitude, $timeZone


	if (!isset($method) || !isset($year) )
		list($method, $year, $latitude, $longitude, $timeZone) = array(0, 2007, 43, -80, -5);
	<title>Prayer Timetable</title>
	pre {font-family: courier, serif, size: 10pt; margin: 0px 8px;}


<h1> Prayer Timetable </h1>
<form name="form" method="post" action="<?php echo $PHP_SELF ?>">
<div style="padding:10px; background-color: #F8F7F4; border: 1px dashed #EAE9CD;">

	Latitude: <input type="text" value="<?php echo $latitude ?>" name="latitude" size="4">
	Longitude: <input type="text" value="<?php echo $longitude ?>" name="longitude" size="4">
	Time Zone: <input type="text" value="<?php echo $timeZone ?>" name="timeZone" size="2">
	Year: <input type="text" value="<?php echo $year ?>" name="year" size="4"> <br>
	<select id="method" name="method" size="1" onchange="document.form.submit()">
		<option value="0">Shia Ithna-Ashari</option>
		<option value="1">University of Islamic Sciences, Karachi</option>
		<option value="2">Islamic Society of North America (ISNA)</option>
		<option value="3">Muslim World League (MWL)</option>
		<option value="4">Umm al-Qura, Makkah</option>
		<option value="5">Egyptian General Authority of Survey</option>
		<option value="7">Institute of Geophysics, University of Tehran</option>
	<input type="submit" value="Make Timetable">


 Date   Fajr   Sunrise  Dhuhr    Asr   Sunset  Maghrib  Isha

	$prayTime = new PrayTime($method);

	$date = strtotime($year. '-1-1');
	$endDate = strtotime(($year+ 1). '-1-1');

	while ($date < $endDate)
		$times = $prayTime->getPrayerTimes($date, $latitude, $longitude, $timeZone);
		$day = date('M d', $date);
		print $day. "\t". implode("\t", $times). "\n";
		$date += 24* 60* 60;  // next day


<script type="text/javascript">

	var method = <?php echo $method ?>;
	document.getElementById('method').selectedIndex = Math.min(method, 6);