diff --git a/includes/page_head.php b/includes/page_head.php
index dc2eee7..8f2a5f8 100644
--- a/includes/page_head.php
+++ b/includes/page_head.php
@@ -27,9 +27,8 @@
* @package tsmmonitor
*/
-if ($_POST["css"] != "") {
- $_SESSION['stylesheet'] = $_POST["css"];
-}
+if ($_POST["css"] != "") $_SESSION['stylesheet'] = $_POST["css"];
+if ($_POST["tabletype"] != "") $_SESSION["tabletype"] = $_POST["tabletype"];
?>
diff --git a/includes/topnav.php b/includes/topnav.php
index d74c1b4..54df47f 100644
--- a/includes/topnav.php
+++ b/includes/topnav.php
@@ -36,6 +36,20 @@
//if ($tsmmonitor->GETVars['qq'] != "admin" && !$_POST["edit"] == "edit") {
if ($tsmmonitor->GETVars['qq'] != "index" && $tsmmonitor->GETVars['qq'] != "overview" && $tsmmonitor->GETVars['qq'] != "serverlist") {
echo "";
+
+ if ($tsmmonitor->configarray["queryarray"][$tsmmonitor->GETVars['qq']]["timetablefields"] != "") {
+
+ echo "";
+
+}
+
}
if ($tsmmonitor->GETVars['qq'] != "polldstat" && $tsmmonitor->GETVars['qq'] != "serverlist") {
diff --git a/includes/tsmmonitor.php b/includes/tsmmonitor.php
index 7ca926b..3499df2 100644
--- a/includes/tsmmonitor.php
+++ b/includes/tsmmonitor.php
@@ -108,7 +108,8 @@ class TSMMonitor {
if ($this->GETVars['server'] == "") { $this->GETVars['server']=$this->configarray["defaultserver"]; }
if ($this->GETVars['orderdir'] == "") { $this->GETVars['orderdir'] = "asc"; }
- if ($_SESSION['timeshift'] == '' || !strstr($this->GETVars["qq"], 'dynamictimetable')) {
+ //if ($_SESSION['timeshift'] == '' || !strstr($this->GETVars["qq"], 'dynamictimetable')) {
+ if ($_SESSION['timeshift'] == '' || $this->configarray["queryarray"][$this->GETVars['qq']]["timetablefields"] == "") {
$_SESSION['timeshift'] = 0 ;
}
@@ -119,12 +120,13 @@ class TSMMonitor {
$_SESSION["GETVars"] = $this->GETVars;
-
- // BEGIN Timemachine
+ //Cleanup
if ($_SESSION["from"] != $_GET['q']) {
$_SESSION['timemachine'] = "";
+ $_SESSION['tabletype'] = "";
}
+ // BEGIN Timemachine
if ($_POST['dateinput'] != "") $_SESSION['timemachine']['date'] = strtotime($_POST['dateinput']);
if ($_POST['timestamps'] != "") $_SESSION['timemachine']['time'] = $_POST['timestamps'];
@@ -443,6 +445,42 @@ class TSMMonitor {
+ /**
+ * getStylesheetSwitcher - returns HTML Code for Stylesheetswitchdropdownbox ;)
+ *
+ * @return string
+ */
+
+ function getStylesheetSwitcher() {
+
+ $ret = "";
+ $ret .= "
";
+
+ return $ret;
+
+ }
+
+
+
+
/**
* getTableheader - generates and returns headers for query result HTML tables.
@@ -781,7 +819,11 @@ class TSMMonitor {
$wc= " ";
}
- $columnnames = $this->getTableFields("res_".$qtable."_".$server);
+ if ($type == "timetable") {
+ $columnnames = $this->configarray["queryarray"][$this->GETVars['qq']]["timetablefields"];
+ } else {
+ $columnnames = $this->getTableFields("res_".$qtable."_".$server);
+ }
if ($columnnames == "") $bContinue = FALSE;
@@ -837,11 +879,11 @@ class TSMMonitor {
}
else if ($type == "timetable") {
$sqlres = $this->adodb->fetchArrayDB($sql);
- $outp = array();;
+ $outp = array();
foreach ($sqlres as $row) {
$rowarray2 = array();
while(list($keycell, $valcell) = each($row)) {
- if ($keycell == "Start Time" || $keycell == "End Time") {
+ if ($keycell == "Start Time" || $keycell == "Actual Start" || $keycell == "End Time") {
$date = $row[$keycell];
$rowarray2[] = mktime(substr($date,11,2),substr($date,14,2),substr($date,17,2),substr($date,5,2),substr($date,8,2),substr($date,0,4));
} else {
diff --git a/index.php b/index.php
index c2efed7..0244325 100644
--- a/index.php
+++ b/index.php
@@ -76,27 +76,7 @@ include_once "includes/page_head.php";
-->
@@ -108,7 +88,7 @@ include_once "includes/page_head.php";
// main content, right of menu
if (isset($_SESSION["logindata"]["user"]) && isset($_SESSION["logindata"]["pass"]) && $tsmmonitor->GETVars['qq'] != "logout" && $_SESSION["logindata"]["loggedin"]){
if ($tsmmonitor->GETVars['qq'] != "" && $tsmmonitor->GETVars['qq'] != "overview"){
-
+
// show overview page
if ($tsmmonitor->GETVars['qq'] == "index") {
include_once "includes/overview.php" ;
@@ -121,24 +101,6 @@ if (isset($_SESSION["logindata"]["user"]) && isset($_SESSION["logindata"]["pass"
} else if ( $tsmmonitor->GETVars['qq'] == "serverlist" ) {
echo $tsmmonitor->getServerlist();
- // show graphical chart (timetable)
- } else if ( strstr($tsmmonitor->GETVars['qq'], 'timetable')) {
-
- if ($_POST["back"] != "") {
- $_SESSION['timeshift'] += $_SESSION['selectedtimestep'];
- }
- if ($_POST["forward"] != "") {
- $_SESSION['timeshift'] -= $_SESSION['selectedtimestep'];
- }
- if ($_SESSION['timeshift'] < 0) {
- $_SESSION['timeshift'] = 0;
- }
-
- $tablearray = $tsmmonitor->execute('timetable');
- $headerarray = $queryarray[$tsmmonitor->GETVars['qq']]["header"]["column"];
- echo $tsmmonitor->generateTimetable($tablearray, $headerarray[0]);
-
-
// "vertical" table
} else if ( strstr($tsmmonitor->GETVars['qq'], 'vertical')) {
@@ -157,7 +119,6 @@ if (isset($_SESSION["logindata"]["user"]) && isset($_SESSION["logindata"]["pass"
}
echo "".$keycell." | ".$valcell." | ";
}
- //}
}
echo "";
@@ -165,36 +126,52 @@ if (isset($_SESSION["logindata"]["user"]) && isset($_SESSION["logindata"]["pass"
// show normal table layout
} else {
+ if ($_SESSION["tabletype"]!="" && $_SESSION["tabletype"] == "timetable") {
- $whereclause = array();
- //if (!$_POST["Clear"] == "Clear") {
- $whereclause["field"] = $_POST["wcfield"];
- $whereclause["val"] = $_POST["wcval"];
- $whereclause["op"] = $_POST["wcop"];
- //}
- if ($whereclause["field"]!="" && $whereclause["val"]!="") {
- if ($_POST["Clear"] == "Clear") {
- $_SESSION["search"][$tsmmonitor->GETVars['qq']] = "";
- } else {
- if (!isset($_SESSION["search"])){
- $temp = array();
- $temp[$tsmmonitor->GETVars['qq']] = $whereclause;
- $_SESSION["search"] = $temp;
+ if ($_POST["back"] != "") {
+ $_SESSION['timeshift'] += $_SESSION['selectedtimestep'];
+ }
+ if ($_POST["forward"] != "") {
+ $_SESSION['timeshift'] -= $_SESSION['selectedtimestep'];
+ }
+ if ($_SESSION['timeshift'] < 0) {
+ $_SESSION['timeshift'] = 0;
+ }
+
+ $tablearray = $tsmmonitor->execute('timetable');
+ $headerarray = $queryarray[$tsmmonitor->GETVars['qq']]["header"]["column"];
+ echo $tsmmonitor->generateTimetable($tablearray, $headerarray[0]);
+
+
+ } else {
+
+ $whereclause = array();
+ $whereclause["field"] = $_POST["wcfield"];
+ $whereclause["val"] = $_POST["wcval"];
+ $whereclause["op"] = $_POST["wcop"];
+ //}
+ if ($whereclause["field"]!="" && $whereclause["val"]!="") {
+ if ($_POST["Clear"] == "Clear") {
+ $_SESSION["search"][$tsmmonitor->GETVars['qq']] = "";
} else {
- $_SESSION["search"][$tsmmonitor->GETVars['qq']] = $whereclause;
+ if (!isset($_SESSION["search"])){
+ $temp = array();
+ $temp[$tsmmonitor->GETVars['qq']] = $whereclause;
+ $_SESSION["search"] = $temp;
+ } else {
+ $_SESSION["search"][$tsmmonitor->GETVars['qq']] = $whereclause;
+ }
}
}
+ echo "";
+ echo $tsmmonitor->getTableheader();
+ echo $tsmmonitor->execute('table');
+ $nav = $tsmmonitor->showPageNavigation("40");
+ if ($nav!="") {
+ echo "
";
+ }
+ echo "
";
}
- echo "";
- //echo get_tableheader($queryarray[$tsmmonitor->GETVars['qq']]["header"]["column"]);
- echo $tsmmonitor->getTableheader();
- echo $tsmmonitor->execute('table');
- $nav = $tsmmonitor->showPageNavigation("40");
- if ($nav!="") {
- echo "
";
- }
- echo "
";
-
}
}
diff --git a/polld/tmonpolld.php b/polld/tmonpolld.php
index 319a5c3..cc46026 100644
--- a/polld/tmonpolld.php
+++ b/polld/tmonpolld.php
@@ -32,33 +32,8 @@
* @package tsmmonitor
*/
-// ** Default database settings ** //
-/**
-$db_type = 'mysql';
-$db_name = 'tsmmonitor';
-$db_user = 'tsmmonitor';
-$db_password = 'tsmmonitor';
-$db_host = 'localhost';
-$db_port = '3306';
-$db_charset = 'utf8';
-$db_collate = '';
-*/
-// ** Include user configureable definitions ** //
-//include(dirname(__FILE__) . "/../includes/config.php");
-
-// ** Global configuration array ** //
-//$config = array();
-
-// ** Display ALL PHP errors ** //
-//error_reporting(E_ALL);
-
-// ** Include generic code and external libraries ** //
-//include ("../extlib/adodb5/adodb.inc.php");
-//include_once("../includes/adodb.php");
include_once("../includes/global.php");
-// ** Connect to the database ** //
-//$adodb = new ADOdb($db_host, $db_port, $db_user, $db_password, $db_name, $db_type, '' ,FALSE);
$tmonpolld = new PollD($adodb);
$tmonpolld->poll();