Timer System

groundpro

New Member
This is my timer code which is run by js which is placed within a display plugin element into the Default field, now what I need to do is to be able to check the code when it reaches to 00:00:00 which is hours, minutes and seconds.

<html>
<head>
<script LANGUAGE="JavaScript">


<!--
// Javascript Countdown
// Version 1.01 6/7/07 (1/20/2000)
// by TDavid at http://www.tdscripts.com/
var now = new Date();
var theevent = new Date("Jul 29 2014 22:36:01");
var seconds = (theevent - now) / 1000;
var minutes = seconds / 60;
var hours = minutes / 60;
var days = hours / 24;
ID=window.setTimeout("update();", 1000);

function update()
{
now = new Date();
orgseconds = (theevent - now) / 1000;
seconds = ((theevent - now) / 1000) % 60;
seconds = Math.round(seconds);
orgminutes = seconds / 60;
minutes = ((orgseconds + 30)/ 60) % 60 ;
minutes = Math.round(minutes);
minutes -= 1;


//hours = minutes / 60;
//hours = (((theevent - now) / 1000)+30)/60;
hours = ((((theevent - now) / 1000)+30)/60)/60;

hours = Math.floor(hours);

if(minutes == 60)
{
minutes = "00";
hours +=1;
}

if(minutes == -1)
{
minutes = "59";
hours -=1;
}

//if(seconds < 0)
//alert("timer has ran out!!!");
/*
if(hours >= 24)
hours %= 24;
*/

//days -= 1;
//hours = ((((theevent - now) / 1000)+30)/60)/60;

days = hours / 24;
days = Math.round(days);
//document.form1.days.value = days;
//document.form1.hours.value = hours;
//document.form1.minutes.value = minutes;
//document.form1.seconds.value = seconds;

document.getElementById("timerText").innerHTML = hours + ":" + minutes + ":" + seconds; //Set the element id you need the time put into.

ID=window.setTimeout("update();",1000);
}
// --> </script>
</head>

<body>



<span id="timerText"> </span>

<?php
$text = 'hello world';
?>

<input type ="text" value= " <?php echo $text;?> ">


<?php
// Create connection

//fab_articlelist

$server = 'localhost';
$user = 'latoya_xstudiosx';
$psw = 'qTlfc)Oo%]13';
$database = 'latoya_xxstudiosxx';
$connectionError = 'could not connect';

@mysql_connect($server,$user,$psw) or die($connectionError);
mysql_select_db($database);

echo 'connected';

?>

</body>
</html>


Task1: To do that I need to be able to read the following elements into the code so that I can calculate the time for each row automatically so the codes may have to be edited for that;
1. fab_articlelist___article_date - plugin type is timestamp : GMT time, Format: 'Y-m-d H:i:s', Update on Edit 'No'
2. fab_articlelist___article_due_date - plugin type is time : Basic Settings : h,m,s

Task2: Also when the timer reaches 00:00:00, I need to have the system automatically clear these fields;
1. fab_articlelist___article_body - plugin type is textarea
2. fab_articlelist___user_id - plugin type is user (stores the editors ID for editing privileges
(Screen shots attached)

Task3: Finally, it should also check the element fab_articlelist___Status - plugin type is dropdown if its equal to "Draft" if not then it should be set to it.

So to summarize the code should calculate using both the timestamp and time element, clear the textarea and user ID and then reset the element to Draft from the dropdown element.

Any Ideas?

To Admins: I had opened up another thread which is similar but I wasn't able to post anything after Hugh responded. So this is why I opened another, I leave that up to you.
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top