summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xHISTORY1
-rwxr-xr-xincludes/inc_timers.php30
-rwxr-xr-xincludes/inc_vdr.php37
-rwxr-xr-xincludes/include.php21
4 files changed, 53 insertions, 36 deletions
diff --git a/HISTORY b/HISTORY
index 173aae6..b0a2569 100755
--- a/HISTORY
+++ b/HISTORY
@@ -11,6 +11,7 @@ in progress:
- segmenter binary path is now configurable ( don't forget to update your config.php )
- cosmetics fixes
- prepared interface for timers & epg
+- support for timers creation and deletion
19.02.2010 - V.0.3.6.1
diff --git a/includes/inc_timers.php b/includes/inc_timers.php
index 6c3aacf..5190494 100755
--- a/includes/inc_timers.php
+++ b/includes/inc_timers.php
@@ -8,29 +8,13 @@ print "</div>\r\n";
print "<div id=\"content\">\r\n";
print " <span class=\"graytitle\">Timers</span>\r\n";
-//contextual alert message
-
-//error new timer
-print " <ul class=\"pageitem\">";
-print " <li class=\"textbox\"><p><font color='red'>Error: the timer was not created</font></p></li>";
-print " </ul>";
-
-//error edit timer
-print " <ul class=\"pageitem\">";
-print " <li class=\"textbox\"><p><font color='red'>Error: the timer was not edited</font></p></li>";
-print " </ul>";
-
-//success new timer
-print " <ul class=\"pageitem\">";
-print " <li class=\"textbox\"><p>The timer was successfully created</p></li>";
-print " </ul>";
-
-//success edit timer
-print " <ul class=\"pageitem\">";
-print " <li class=\"textbox\"><p>The timer was successfully edited</font></p></li>";
-print " </ul>";
-
-//end contextual alert message
+// Status display
+if ($message != "")
+{
+ print " <ul class=\"pageitem\">";
+ print $message;
+ print " </ul>";
+}
print " <ul class=\"pageitem\">";
print " <li class=\"textbox\">";
diff --git a/includes/inc_vdr.php b/includes/inc_vdr.php
index d6eb269..be2f798 100755
--- a/includes/inc_vdr.php
+++ b/includes/inc_vdr.php
@@ -299,7 +299,17 @@ function vdrlisttimers()
$timers = $svdrp->Command("LSTT");
$svdrp->Disconnect();
- foreach($timers as $timer)
+ if (gettype($timers) == "string")
+ {
+ if ($timers == "")
+ return;
+ else
+ $timersarray[] = $timers;
+ }
+ else
+ $timersarray = $timers;
+
+ foreach($timersarray as $timer)
{
// Extract timer #
$timerarray = explode(" ", $timer);
@@ -309,7 +319,13 @@ function vdrlisttimers()
print "<li class=\"menu\">";
print " <a href=\"javascript:sendForm('timer {$timernum}')\">";
- print " <img alt=\"list\" src=\"images/pictos/timers.png\" />";
+
+ if ($type & 0x8)
+ print " <img alt=\"list\" src=\"images/pictos/timerrec.png\" />";
+ else if ($type & 0x1)
+ print " <img alt=\"list\" src=\"images/pictos/timeron.png\" />";
+ else
+ print " <img alt=\"list\" src=\"images/pictos/timeroff.png\" />";
print " <span class=\"name\">{$date}: {$channame}</span><span class=\"arrow\"></span>";
@@ -329,24 +345,29 @@ function vdrdeltimer($timer=0)
$svdrp = new SVDRP($svdrpip, $svdrpport);
$svdrp->Connect();
- $svdrp->Command("DELT " .$timer);
+ $ret = $svdrp->Command("DELT " .$timer);
$svdrp->Disconnect();
+
+ return $ret;
}
-function vdrsettimer($channame, $date, $stime, $etime, $desc)
+function vdrsettimer($prevtimer, $channame, $date, $stime, $etime, $desc)
{
global $svdrpip, $svdrpport;
$channum = vdrgetchannum($channame);
- $timer = "1:" .$channum .":" .$date .":" .$stime .":" .$etime .":99:99:" .$desc;
-
- print $timer;
+ if ($prevtimer == -1)
+ $command = "NEWT 1:" .$channum .":" .$date .":" .$stime .":" .$etime .":99:99:" .$desc;
+ else
+ $command = "MODT " .$prevtimer ." 1:" .$channum .":" .$date .":" .$stime .":" .$etime .":99:99:" .$desc;
$svdrp = new SVDRP($svdrpip, $svdrpport);
$svdrp->Connect();
- $svdrp->Command("NEWT " .$timer);
+ $ret = $svdrp->Command($command);
$svdrp->Disconnect();
+
+ return $ret;
}
?>
diff --git a/includes/include.php b/includes/include.php
index 2dd59e9..6fe31ad 100755
--- a/includes/include.php
+++ b/includes/include.php
@@ -156,17 +156,28 @@ function start_stream($type, $name, $title, $desc, $qname, $qparams, $category,
function delete_timer($timer)
{
- vdrdeltimer($timer);
-
+ $ret = vdrdeltimer($timer);
+
+ $message = " <li class=\"textbox\"><p><font color='black'>{$ret}</font></p></li>";
+
include('includes/inc_timers.php');
}
function set_timer($channame, $date, $stime, $etime, $desc, $prevtimer)
{
+ $ret = vdrsettimer($prevtimer, $channame, $date, $stime, $etime, $desc);
+
+ if ($prevtimer == -1)
+ $settype = "creat";
+ else
+ $settype = "edit";
+
+ $retarray = explode(":", $ret);
- if ($prevtimer != -1)
- vdrdeltimer($prevtimer);
- vdrsettimer($channame, $date, $stime, $etime, $desc);
+ if (!is_numeric(substr($retarray[0], 0, 1)))
+ $message = " <li class=\"textbox\"><p><font color='red'>Error: {$retarray[0]}</font></p></li>";
+ else
+ $message = " <li class=\"textbox\"><p><font color='green'>Timer {$settype}ed successfully </font></p></li>";
include('includes/inc_timers.php');
}