Robert Marshall 9 yıl önce
ebeveyn
işleme
e276f8da7b

+ 16 - 0
Controller/Navigation/TemperatureNav.php

@@ -0,0 +1,16 @@
+<?php
+class TemperatureNav implements INavigationController{
+	private $_uri;
+	
+	public function __construct() {
+		$this->_uri=new URI("Temperature Logs","/temperature","/images/status.svg");
+	}
+	
+	public function GetItems() {
+		
+	}
+
+	public function GetURI() {
+		return $this->_uri;
+	}
+}

+ 17 - 0
Controller/Temperature.php

@@ -0,0 +1,17 @@
+<?php
+
+class Temperature extends Controller {
+
+	public function Index() {
+		return new View("Temperature/index.view");
+	}
+
+	public function TakeReading() {
+		$result=file_get_contents("http://has.robware.uk/gettemperature");
+		$reading=new TemperatureReading();
+		$reading->Reading=$result;
+		$reading->Save();
+		return null;
+	}
+
+}

+ 6 - 0
DB Scripts/9/create_temperature_log.sql

@@ -0,0 +1,6 @@
+CREATE TABLE `temperature_log` (
+  `temperature_id` int(11) NOT NULL AUTO_INCREMENT,
+  `reading` float NOT NULL,
+  `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+  PRIMARY KEY (`temperature_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;

+ 2 - 0
DB Scripts/9/insert_permissions_data.sql

@@ -0,0 +1,2 @@
+INSERT INTO permissions (permission_value, permission_default_grant) VALUES ('temperature/index', 1);
+INSERT INTO permissions (permission_value, permission_default_grant) VALUES ('temperature/takereading', 1);

+ 5 - 0
Database/ITemperatureReadingRepository.php

@@ -0,0 +1,5 @@
+<?php
+interface ITemperatureReadingRepository {
+	public function GetAll();
+	public function GetRange(DateTime $from, DateTime $to);
+}

+ 17 - 0
Database/TemperatureReadingRepository.php

@@ -0,0 +1,17 @@
+<?php
+
+class TemperatureReadingRepository extends BaseRepository implements ITemperatureReadingRepository {
+
+	public function __construct() {
+		parent::__construct();
+	}
+
+	public function GetAll() {
+		
+	}
+
+	public function GetRange(DateTime $from, DateTime $to) {
+		
+	}
+
+}

+ 6 - 0
Model/TemperatureReading.php

@@ -0,0 +1,6 @@
+<?php
+class TemperatureReading extends DBObject {
+	public function __construct($id=0) {
+		parent::__construct("temperature_log", "temperature_id", $id);
+	}
+}

+ 8 - 0
View/Temperature/index.view

@@ -0,0 +1,8 @@
+@Init{
+	//$this->RegisterJSFile("services/statusService.js");
+	//$this->RegisterJSFile("controllers/status.js");
+}@
+@Title{Temperature Logs}@
+@Body{
+
+}@

+ 1 - 1
settings.ini

@@ -11,7 +11,7 @@ database=robware-test
 
 [navigation]
 mode=include
-pages=HomeNav,BlogNav,ProjectsNav,GalleryNav,DesktopNav,WeightNav,StatusNav,MemberNav
+pages=HomeNav,BlogNav,ProjectsNav,GalleryNav,DesktopNav,WeightNav,StatusNav,TemperatureNav,MemberNav
 
 [blog]
 posts_per_page=10