Subversion Repositories portal2

Rev

Rev 683 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?php
/*  emg - Energy Monitoring & Graphing
*  Copyright (C) 2006-2012 Romain Lievin
*
*  This program is free software; you can redistribute it and/or modify
*  it under the terms of the GNU General Public License as published by
*  the Free Software Foundation; either version 3 of the License, or
*  (at your option) any later version.
*
*  This program is distributed in the hope that it will be useful,
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*  GNU General Public License for more details.
*
*  You should have received a copy of the GNU General Public License
*  along with this program; if not, write to the Free Software Foundation,
*  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

?>

<?php
/*
* List available variables to monito
*
* Called from: lidt_sensors.php
*
* Input args (GET):
* - device_name
* - sensor_name
*
* Inputs args (POST): none
*
* Output args:
* - device_name
* - sensor_name
* - var_name
*
* Call: form_data_add.php
*
*/

?>

<?php
include_once('auth_check.php');

if(isset($_SESSION['park'])){
        $park = $_SESSION['park'];
}
else
{
        $park = null;
}

if(isset($_GET['device_key'], $_GET['sensor_key'])){
        $park       = $_SESSION['park'];

        $device_key = $_GET['device_key'];
        $device     = $park->getDevice($device_key);
        $device_name= $device->getName();

        $sensor_key = $_GET['sensor_key'];
        $sensor     = $device->getSensor($sensor_key);
        $sensor_name= $sensor->getName();
}
?>

<div id="page_devices">
        <h1>
                <?php echo _('Variables'); ?>
        </h1>

        <fieldset>
                <?php
                echo '<legend>' . _('List') . ' (' . $device_name . ':' . $sensor_name . ')' . '</legend>';
                ?>

                <?php
                if(isset($_GET['device_key'], $_GET['sensor_key'])){
                        $list = "\r\n";
                        $list .= "<ul>\r\n";

                        if($sensor){
                                foreach($sensor as $key => $variable){
                                        $variable_name = $variable->getName();
                                        $variable_key  = $key;

                                        $list .= '  <li>';
                                        $id = link_get_id_from_filename("form_trackers_add.php");
                                        $list .= "<a href=\"index.php?id_page=$id&device_key=$device_key&sensor_key=$sensor_key&variable_key=$variable_key\">" . $variable_name . '</a>' . "\n";
                                        $list .= '</li>';
                                        $list .= "\r\n";
                                }
                        }

                        $list .= "</ul>\n";
                        echo $list;
                }
                ?>

        </fieldset>
        </form>
</div>