Skip to content

Commit 499af50

Browse files
authored
Add files via upload
1 parent 7cd751c commit 499af50

File tree

5 files changed

+186
-9
lines changed

5 files changed

+186
-9
lines changed

class/element_iot.inc.php

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,12 @@ class element_iot {
1818

1919

2020

21-
public function __construct($api_key, $domain = NULL) {
21+
public function __construct($api_key, $domain = NULL, $proxy = NULL) {
2222
$this->api_key = $api_key;
23-
2423
$this->api_path = (isset($domain)) ? $domain : $this->api_path;
24+
$this->proxy = (isset($proxy)) ? $proxy : $this->proxy;
2525
}//__construct($api_key, $domain = NULL)
26-
27-
28-
26+
2927

3028

3129
/* Getter / Setter */
@@ -38,8 +36,16 @@ public function get_api_key() {
3836
//Return last 8 Symbols of the API-KEY -> for security reasons
3937
}//public function getAPI()
4038

39+
public function set_domain($domain) {
40+
$this->domain = $domain;
41+
}//public function set_domain($domain)
42+
43+
public function get_domain() {
44+
return $this->domain;
45+
}//public function get_domain()
46+
4147

42-
public function get($tp = [], $configuration = []) {
48+
public function get($tp = "devices", $configuration = []) {
4349
$gu = $this->generateURL($tp, $configuration);
4450
if ($gu !== true )
4551
return $gu;

css/style.css

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
/*IMPORTS*/
2+
@font-face {
3+
font-family: Skranji;
4+
src: url(../../includes/style/fonts/Skranji-Regular.ttf);
5+
font-weight: bold;
6+
}
7+
8+
9+
10+
/*Allgemeine Einstellungen*/
11+
* {
12+
font-family: Verdana;
13+
}
14+
15+
/*Der Info-Button... oder so.*/
16+
div.infobutton {
17+
widht: 40vw;
18+
height: 40vw;
19+
display: block;
20+
align-items: center;
21+
position: relative;
22+
margin: 0 auto;
23+
background: no-repeat center;
24+
}
25+
26+
div#auf {
27+
background-image: url("../img/auf.svg");
28+
}
29+
div#zu {
30+
background-image: url("../img/zu.svg");
31+
}
32+
33+
body {
34+
background-color: #fefefe; background: linear-gradient(269deg, #52cced, #49ceb3); background-size: 400% 400%; /*BG Animations*/ -webkit-animation: bganimate 30s ease infinite; -moz-animation: bganimate 30s ease infinite; -o-animation: bganimate 30s ease infinite; animation: bganimate 30s ease infinite;
35+
}
36+
h1 {
37+
color: #285596;
38+
text-align: center;
39+
40+
color: #fff;
41+
text-shadow: 0px 1px 0px #888, 0px 2px 0px #777, 0px 3px 0px #666, 0px 4px 0px #555, 0px 5px 0px #444, 0px 6px 0px #333, 0px 7px 0px #222, 0px 8px 7px #001135;
42+
font: 2.5em 'Skranji';
43+
}
44+
details {
45+
background-color: rgba(0,150,250,0.2);
46+
padding: 10px;
47+
border: none;
48+
}
49+
summary {
50+
border: none;
51+
}
52+
a {
53+
text-decoration: none;
54+
background-color: #2CAFB0;
55+
color: white;
56+
margin: 10px auto 10px;
57+
padding: 10px;
58+
border-radius: 15px;
59+
}
60+
/*Form Design*/
61+
input, select {
62+
display: inline-block;
63+
border: 1px solid #ccc;
64+
border-radius: 4px;
65+
box-sizing: border-box;
66+
}
67+
select {
68+
min-width: 65px;
69+
}
70+
input[type=text].imptext {
71+
padding: 12px 20px;
72+
margin: 8px 0;
73+
}
74+
input[type=number] {
75+
border: 1px solid #ccc;
76+
border-radius: 4px;
77+
box-sizing: border-box;
78+
}
79+
input[type=submit], #redirect {
80+
width: 100%;
81+
background-color: #2CAFB0;
82+
color: white;
83+
padding: 14px 20px;
84+
margin: 8px 0;
85+
border-radius: 4px;
86+
cursor: pointer;
87+
}
88+
input[type=password]:not(#password):not(.valid):not(.error) {
89+
background-color: #444444;
90+
color: white;
91+
padding: 14px 20px;
92+
margin: 8px 0;
93+
cursor: pointer;
94+
background-image: url('../../img/password/normal.png');
95+
background-position: 5px 7px;
96+
background-repeat: no-repeat;
97+
padding-left: 40px;
98+
}
99+
100+
101+
/*Check Password validation*/
102+
input[type=password].valid {
103+
background-color: #444444;
104+
color: white;
105+
padding: 14px 20px;
106+
margin: 8px 0;
107+
cursor: pointer;
108+
background-image: url("../../img/password/safe.png");
109+
background-position: 5px 7px;
110+
background-repeat: no-repeat;
111+
padding-left: 40px;
112+
}
113+
114+
input[type=password].valid {
115+
background-color: #444444;
116+
color: white;
117+
padding: 14px 20px;
118+
margin: 8px 0;
119+
cursor: pointer;
120+
background-image: url("../../img/password/safe.png");
121+
background-position: 5px 7px;
122+
background-repeat: no-repeat;
123+
padding-left: 40px;
124+
}
125+
input[type=submit]:hover, #redirect:hover, a:hover {
126+
background-color: #0C8F90;
127+
}
128+
129+
130+
/*ANIMATIONs*/@-webkit-keyframes bganimate { 0%{background-position:0% 19%} 50%{background-position:100% 82%} 100%{background-position:0% 19%}}@-moz-keyframes bganimate { 0%{background-position:0% 19%} 50%{background-position:100% 82%} 100%{background-position:0% 19%}}@-o-keyframes bganimate { 0%{background-position:0% 19%} 50%{background-position:100% 82%} 100%{background-position:0% 19%}}@keyframes bganimate { 0%{background-position:0% 19%} 50%{background-position:100% 82%} 100%{background-position:0% 19%}}
131+
132+
133+
@-webkit-keyframes normalbg {
134+
0%{background-position:0% 13%}
135+
50%{background-position:100% 88%}
136+
100%{background-position:0% 13%}
137+
}
138+
@-moz-keyframes normalbg {
139+
0%{background-position:0% 13%}
140+
50%{background-position:100% 88%}
141+
100%{background-position:0% 13%}
142+
}
143+
@keyframes normalbg {
144+
0%{background-position:0% 13%}
145+
50%{background-position:100% 88%}
146+
100%{background-position:0% 13%}
147+
}

img/auf.svg

Lines changed: 9 additions & 0 deletions
Loading

img/zu.svg

Lines changed: 11 additions & 0 deletions
Loading

index.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,22 @@
55
$element_iot = new element_iot("1d08cbb43a64c62e7358be4404e2d578", "ssl://iot.stadtwerke-karlsruhe.de");//__construct($api_key, $domain)
66

77

8-
$data = $element_iot->get(["devices", "interfaces"]);//Konfigriert darauf, die letzten 5 Messwerte zu holen
8+
$data = $element_iot->get(["devices", "readings"], ["limit" => 1,"id" => "f5261911-7f7b-4870-a5f5-7f4c7e9ff5e5"]);//Konfigriert darauf, die letzten 5 Messwerte zu holen
99

1010
?>
1111
<!DOCTYPE html>
1212
<html>
1313
<head>
1414
<meta charset="utf-8">
1515
<link href="css/style.css" rel="stylesheet" type="text/css">
16+
<?php if ($data["body"][0]["data"]["position"] == "zu") {echo '<meta http-equiv="refresh" content="3">';}?>
1617
</head>
1718
<body>
1819
<h1>ELEMENT IoT in PHP</h1>
19-
<p>Return:</p>
20-
<p><?php echo var_dump($data);?></p>
20+
<div class="infobutton" id="<?php echo $data["body"][0]["data"]["position"];?>">
21+
<!--Das oben gibt auf oder zu zurück.
22+
Über CSS wird auf dieses DIV ein BG gesetzt
23+
-->
24+
</div>
2125
</body>
2226
</html>

0 commit comments

Comments
 (0)