-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsap_controller.php
More file actions
38 lines (31 loc) · 1014 Bytes
/
sap_controller.php
File metadata and controls
38 lines (31 loc) · 1014 Bytes
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
<?php
/*
All Emoncms code is released under the GNU Affero General Public License.
See COPYRIGHT.txt and LICENSE.txt.
---------------------------------------------------------------------
Emoncms - open source energy visualisation
Part of the OpenEnergyMonitor project:
http://openenergymonitor.org
*/
// no direct access
defined('EMONCMS_EXEC') or die('Restricted access');
function sap_controller()
{
global $mysqli, $session, $route;
require "Modules/sap/sap_model.php";
$sap = new Sap($mysqli);
if ($route->action == 'save' && $session['write'])
{
$data = post('data');
$sap->save($session['userid'],1,$data);
$result = true;
}
elseif ($session['write'])
{
if (!$route->action) $route->action = 1;
$data = $sap->get($session['userid'], 1);
$result = view("Modules/sap/sap_view.php",array('data'=>$data, 'page'=>$route->action));
}
return array('content'=>$result, 'fullwidth'=>true);
}
?>