Add feeback form/layar API
[bus.git] / busui / common.inc.php
blob:a/busui/common.inc.php -> blob:b/busui/common.inc.php
--- a/busui/common.inc.php
+++ b/busui/common.inc.php
@@ -30,20 +30,26 @@
     return $_SERVER['SERVER_NAME'] == "10.0.1.154" || $_SERVER['SERVER_NAME'] == "localhost" || $_SERVER['SERVER_NAME'] == "127.0.0.1" || !$_SERVER['SERVER_NAME'];
 }
 
+function isMetricsOn()
+{
+    return true;
+}
+
 function debug($msg) {
     if (isDebug()) echo "<!-- $msg -->";
 }
 function isFastDevice() {
+    $fastDevices = Array("Mozilla/5.0 (X11;", "Mozilla/5.0 (Windows;", "Mozilla/5.0 (iP", "Mozilla/5.0 (Linux; U; Android", "Mozilla/4.0 (compatible; MSIE");
+    $slowDevices = Array("J2ME","MIDP","Opera/","Mozilla/2.0 (compatible;","Mozilla/3.0 (compatible;");
     return true;
 }
 
-function include_header($pageTitle, $opendiv = true, $geolocate = false) {
+function include_header($pageTitle, $pageType, $opendiv = true, $geolocate = false) {
     echo '
 <!DOCTYPE html> 
 <html> 
 	<head> 
-	<title>busness time - '.$pageTitle.'</title> 
-	';
+	<title>'.$pageTitle.'</title>';
          if (isDebug()) echo '<link rel="stylesheet"  href="css/jquery-mobile-1.0a3.css" />
          <script type="text/javascript" src="js/jquery-1.5.js"></script>
         <script type="text/javascript" src="js/jquery-mobile-1.0a3.js"></script>';
@@ -104,19 +110,34 @@
 
 </script> ";
  }
-echo '</head> 
-<body> 
+echo '</head>
+<body>
  ';
+     if (isMetricsOn()) {
+    require_once('owa/owa_env.php');
+    require_once(OWA_DIR.'owa_php.php');
+    $owa = new owa_php();
+    $owa->setSiteId('bus.lambdacomplex.org');
+    $owa->setPageTitle($pageTitle);
+    $owa->setPageType($pageType);
+    $owa->trackPageView();
+   $owa->placeHelperPageTags();
+    }
+
 if ($opendiv)  {
     echo '<div data-role="page"> 
- 
+ <script>
+$(document).ready(function ()
+{
+    document.title = "'.$pageTitle.'";
+});
+</script>
 	<div data-role="header"> 
 		<h1>'.$pageTitle.'</h1>
 	</div><!-- /header -->
         <div data-role="content"> ';
 }
 }
-
 function include_footer()
 {
     if ($geolocate && isset($_SESSION['lat'])) {