Source for file RunningClock.class.php
Documentation is available at RunningClock.class.php
* Including language specific messages.
include( CLASSPATH. "core/lang_spec_values/". LANG. ".inc.php" );
echo "<h3>You have to define the constant LANG!</h3>\r\n";
echo "Example for german: define( 'LANG', 'de' );\r\n";
echo "<h3>You have to define the constant CLASSPATH!</h3>\n";
echo "Example: define( 'CLASSPATH', '../path/to/classes/' );\n";
* Including the layer-class for the clock.
require_once( CLASSPATH. "html/HTMLLayer.class.php" );
* Including the javascript-class.
require_once( CLASSPATH. "html/JavaScript.class.php" );
* A class to generate a clock that refreshes every Second.
* @author Daniel Plücken <daniel@debakel.net>
* @license http://www.gnu.org/copyleft/lesser.html
* GNU Lesser General Public License
* @copyright Copyright (c) 2004 Daniel Pluecken <daniel@debakel.net>
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General
* Public License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
* @author Daniel Plücken <daniel@debakel.net>
* @param $name The value of the name- and id-attribute of this layer.
" function getformattedMonth( month )\r\n"
. " var monthArr = new Array(\r\n"
. " return monthArr[month];\r\n"
" function getFormattedDate( dateobj )\r\n"
. " return '' + leadingZeros( dateobj.getDate(), 2 )\r\n"
. " + '. ' + unescape( getformattedMonth( "
. "dateobj.getMonth() ) )\r\n"
. " + ' ' + dateobj.getFullYear()\r\n"
. " + ' - ' + leadingZeros( dateobj.getHours(), 2 )\r\n"
. " + ':' + leadingZeros( dateobj.getMinutes(), 2 )\r\n"
. " + ':' + leadingZeros( dateobj.getSeconds(), 2 )\r\n"
" function showDate( container )\r\n"
. " var now = new Date();\r\n\r\n"
. " document.getElementById( container )\r\n"
. " .firstChild.nodeValue = '' + getFormattedDate( now );\r\n"
. " showDate( '". $this -> name. "' );\r\n"
. " window.setInterval( \"showDate( '"
. $this -> name. "' );\", 1000 );\r\n\r\n"
* Returns a generated string based on the attributes of this HTML-Object.
* @author Daniel Plücken <daniel@debakel.net>
{ return parent::get(). "\r\n". $this->js->get(); }
} // END of class RunningClock
|