Source for file jsquickwalk.php
Documentation is available at jsquickwalk.php
* Create a pair of forward/back javascript links to allow the user to move forward and back through a sequence of date periods
* @author Stuart Prescott
* @copyright Copyright Stuart Prescott
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
/** Load ancillary functions */
require_once 'inc/typeinfo.php';
/** date manipulation routines */
require_once 'inc/date.php';
* Create a pair of forward/back javascript links to allow the user to move forward and back through a sequence of date periods
* unqiue name in the javascript namespace for these functions (prepended to everything)
* name for the "back" link
* name for the "forward" link
* html text-input id's for the two date elements
* dates to use in the sequence
* initial position in sequence
* @param string $namebase added to javascript namespace for uniqueness
* @param string $back label for 'previous' button
* @param string $fwd label for 'next' button
* @param array $keys list of js id tags for the text boxes to alter
* @param array $values list of dates to use in the sequence
* @param integer $counter initial position in sequence
function JSQuickWalk($namebase, $back, $fwd, $keys, $values, $counter) {
* generate the javascript for the +/- links
* @return string javascript embedded in html for necessary functions and data
$t =
'<script type="text/javascript">'.
$eol
$t .=
$this->namebase.
'walkarray = new Array();'.
$eol;
$t .=
$this->namebase.
'walkarray['.
$i.
']= new Array();'.
$eol;
foreach ($this->keys as $k) {
$t .=
$this->namebase.
'walkarray['.
$i.
']["'.
$k.
'"]="'
.
$this->values[$i][$k]->dateString().
'";'.
$eol;
$t .=
'var '.
$c.
'='.
$this->counter.
';'.
$eol;
$t .=
'function '.
$this->namebase.
'walkfwd() {'.
$eol
.
' rightForm = "bumblebeeform";'
//.' alert("FOO"+'.$c.')'.$eol
.
' ('.
$c.
' < '.
(count($this->values)-
1).
' && '.
$c.
'++);'.
$eol;
foreach ($this->keys as $k) {
$t .=
' document.forms[rightForm].'.
$this->namebase.
$k.
'.value='
.
$this->namebase.
'walkarray['.
$c.
']["'.
$k.
'"];'.
$eol;
// .' alert('.$c.'['..'])'.$eol
$t .=
'function '.
$this->namebase.
'walkback() {'.
$eol
.
' rightForm = "bumblebeeform";'
.
' ('.
$c.
' > 0 && '.
$c.
'--);'.
$eol;
foreach ($this->keys as $k) {
$t .=
' document.forms[rightForm].'.
$this->namebase.
$k.
'.value='
.
$this->namebase.
'walkarray['.
$c.
']["'.
$k.
'"];'.
$eol;
* generate the forward link
* @return string html link to fire the forwards event
return '<a href="javascript:'.
$this->namebase.
'walkfwd()">'
* @return string html link to fire the previous event
return '<a href="javascript:'.
$this->namebase.
'walkback()">'
Documentation generated on Tue, 06 Mar 2007 10:01:44 +0000 by phpDocumentor 1.3.0