global $GLOBAL_BASE_URL;
echo "<b>Browse</b><br>";
$dss = ds_listDS();
- echo "<pre>";
+ //echo "<pre>";
//print_r($dss);
- echo "</pre>";
+ //echo "</pre>";
foreach ($dss as $dsl) {
$dsname = $dsl["dsname"];
echo "<a href=\"".urlCreate("/ds/browse/$dsname")."\">$dsname</a><br>";
}
$sql .= ")";
- echo "sql: $sql\n";
+ //echo "sql: $sql\n";
$db->query($sql);
}
else $extra = "";
$sql = "select * from \"$tablename\"$extra";
$res = $db->query($sql);
+ if(!$res) return false;
$data = $res->fetchAll();
return $data;
--- /dev/null
+<?php
+
+
+function msg_haveMessages($acked = false)
+{
+ msg_createTable();
+
+ return db_selectData("messages", "msgacked", 0);
+}
+
+function msg_getMessages($acked = false)
+{
+ msg_createTable();
+
+ $data = db_selectData("messages");
+
+ return $data;
+}
+
+function msg_toDate()
+{
+
+}
+
+function msg_addMessage($colour, $message)
+{
+ msg_createTable();
+
+ db_insertData("messages", $colour, time(), "$message", 0);
+}
+
+function msg_deleteMessage($message_id)
+{
+ db_deleteData("messages", "messages_id", "$message_id");
+}
+
+function msg_acknowledge($message_id)
+{
+ db_updateData("messages", "msgacked", "1", "messages_id", "$message_id");
+}
+
+function msg_createTable()
+{
+ db_createTable("messages", "msgcolour", "msgdate", "msgtext", "msgacked");
+}
+?>
\ No newline at end of file
}
echo "</tr></table>";
+ if(function_exists("msg_haveMessages")) if(msg_haveMessages()) {
+ echo "<table>";
+ $msgs = msg_getMessages();
+
+ foreach($msgs as $msg) {
+ $msgtime = msg_toDate($msg["time"]);
+ $msgcol = $msg["colour"];
+ $msgtxt = $msg["text"];
+
+ echo "<tr><td><font color=\"$msgcol\">$msgtime - $msgtxt</font>";
+ }
+ echo "</table>";
+ }
}
function www_leftmenu()
--- /dev/null
+<?php
+require_once("../lib/lib.php");
+
+// check
+echo "checking for messages\n";
+if(msg_haveMessages()) {
+ echo "Have some\n";
+} else {
+ echo "Have none\n";
+}
+
+echo "Create 4 message\n";
+msg_addMessage("blue", "hello there");
+msg_addMessage("blue", "hello there");
+msg_addMessage("blue", "hello there");
+msg_addMessage("blue", "hello there");
+
+echo "checking for messages\n";
+if(msg_haveMessages()) {
+ echo "Have some\n";
+} else {
+ echo "Have none\n";
+}
+
+echo "getting messages\n";
+$msgs = msg_getMessages();
+print_r($msgs);
+
+echo "deleting messages\n";
+foreach($msgs as $msg) {
+ msg_deleteMessage($msg["messages_id"]);
+}
+
+echo "checking for messages\n";
+if(msg_haveMessages()) {
+ echo "Have some\n";
+} else {
+ echo "Have none\n";
+}
+
+?>
\ No newline at end of file