-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunction.php
42 lines (40 loc) · 1.77 KB
/
function.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
function button($name, $title, $pin, $value, $direction, $btnClass) {
$html = '';
$html .= '<a class="btn ' . $btnClass . '" ';
$html .= 'href="' . $_SERVER['PHP_SELF'] . '?pin=' . $pin . '&value='. $value . '&direction=' . $direction . '"';
$html .= ' title="' . $title . '"';
$html .= '>';
$html .= $name;
if ($btnClass == 'on') {
$html .= ' <i class="fa fa-circle"></i>';
} else {
$html .= ' <i class="fa fa-circle-o"></i>';
}
$html .= '</a>';
return $html;
}
function dimmer($name, $title, $pin, $value, $direction, $btnClass) {
$rand = rand(0,10000);
$action = $_SERVER['PHP_SELF'];
$html = '';
$html .= '<div class="dimmer">';
$html .= '<form action="' . $action .'">';
$html .= '<div class="input-group">';
//$html .= '<label for="' . $name . '">' . $name .'</label>';
$html .= '<input type="text" class="form-control hidden" id="' . $pin . $rand . '" name="pin" placeholder="Pin" value="' . $pin .'">';
$html .= '<input type="text" class="form-control" id="' . $name . $rand . '" name="value" placeholder="Wert" value="' . $value .'">';
$html .= '<input type="text" class="form-control hidden" id="' . $direction . $rand . '" name="direction" placeholder="Pin" value="' . $direction .'">';
$html .= '<span class="input-group-btn">';
$html .= '<button class="btn ' . $btnClass . '" type="submit">';
//$html .= 'href="' . $_SERVER['PHP_SELF'] . '?pin=' . $pin . '?value='. $value . '?direction=' . $direction . '"';
//$html .= ' title="' . $title . '"';
//$html .= '>';
$html .= $name . ' <span class="loaderIcon"></span>';
$html .= '</button>';
$html .= '</span>';
$html .= '</div>';
$html .= '</form>';
$html .= '</div>';
return $html;
}