Fix off by one error causing the scrollbar to show up.
[kdepim.git] / ktimetracker / ktimetracker.php
blob25c554633932318ff2bc18610bd0e7dfcb254963
1 <!-- WebKTimeTracker
2 WebKTimeTracker is a php web application that allows you to track how much time you spent on various tasks.
3 When you start a new task, you start a timer for it. At the end of the day, you can see how much time
4 you spent on various task.
5 WebKTimeTracker uses ktimetracker as its engine, the php site starts ktimetracker on the server and
6 communicates with it via dbus or via command options.
8 TODO: what happens if apache cannot start a gui ?
9 FIXME: where are my dbus bindings ?
10 TODO: you cannot use/create subtasks
11 FIXME: adding two tasks with the same name leads to unpredictable behavior
12 -->
13 <html>
14 <head>
15 <title>This is WebKTimeTracker</title>
16 <head>
17 <body>
18 <h1>WebKTimeTracker 0.01</h1>
19 <?php
20 $task=escapeshellcmd($_GET['task']);
21 $taskname=escapeshellcmd($_GET['taskname']);
22 if ($task)
24 exec("qdbus org.kde.ktimetracker /KTimeTracker addTask ".$task);
26 if ($taskname)
28 exec("qdbus org.kde.ktimetracker /KTimeTracker taskIdsFromName ".$taskname,$output,$errorput);
29 if ($_GET['action'] == "start") exec("qdbus org.kde.ktimetracker /KTimeTracker startTimerFor ".$output[0]);
30 if ($_GET['action'] == "stop") exec("qdbus org.kde.ktimetracker /KTimeTracker stopTimerFor ".$output[0]);
31 if ($_GET['action'] == "delete") exec("qdbus org.kde.ktimetracker /KTimeTracker deleteTask ".$output[0]);
33 $errorlevel=1;
34 while ($errorlevel!=0)
36 sleep (1);
37 exec("/home/kde-devel/kde/bin/ktimetracker --konsolemode --version",$output2,$errorlevel);
39 echo "Your ktimetracker is version $output2[0]<br />";
41 <form action="index.php">
42 New Task:
43 <input name="task" type="text" size="30" maxlength="30">
44 <input type="submit" value="submit">
45 </form>
46 <table>
47 <?php
48 exec("/home/kde-devel/kde/bin/ktimetracker --konsolemode --listtasknames ",$tasknames,$errorlevel);
49 for ($i=0; $i<sizeof($tasknames); $i++)
51 $output3=""; $output4="";
52 exec("/home/kde-devel/kde/bin/ktimetracker --konsolemode --taskidsfromname ".$tasknames[$i],$output3);
53 exec("/home/kde-devel/kde/bin/ktimetracker --konsolemode --totalminutesfortaskid ".$output3[0],$output4);
54 echo "<tr bgcolor=#FFEEEE><td>".$tasknames[$i]."</td><td>$output4[0]</td><td>";
55 echo "<form action=\"index.php\">";
56 echo "<input name=\"taskname\" type=\"hidden\" value=\"$tasknames[$i]\">";
57 echo "<input name=\"action\" type=\"hidden\" value=\"start\">";
58 echo "<input type=\"submit\" value=\"Start\">";
59 echo "</form></td><td>";
60 echo "<form action=\"index.php\">";
61 echo "<input name=\"taskname\" type=\"hidden\" value=\"$tasknames[$i]\">";
62 echo "<input name=\"action\" type=\"hidden\" value=\"stop\">";
63 echo "<input type=\"submit\" value=\"Stop\">";
64 echo "</form></td><td>";
65 echo "<form action=\"index.php\">";
66 echo "<input name=\"taskname\" type=\"hidden\" value=\"$tasknames[$i]\">";
67 echo "<input name=\"action\" type=\"hidden\" value=\"delete\">";
68 echo "<input type=\"submit\" value=\"Delete\">";
69 echo "</form>";
70 echo "</td></tr>";
73 </table>
74 </body>
75 </html>