Subversion Repositories portal2

Rev

Rev 695 | 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
include_once('auth_check.php');
?>

<?php

/* We will need JavaScript to get control values and store them thru session mechanism so
to avoid resetting of fields when adding/removing groups
*/

$form_token = md5(uniqid('auth', true));
$_SESSION['form_token'] = $form_token;
?>

<div id="page_form_export_data">
        <h1>
                <?php echo _('Export data'); ?>
        </h1>

        <?php
        $id = link_get_id_from_filename("form_data_submit.php");
        echo "<form action=\"index.php?id_page=$id\" method=\"post\">";
        ?>

        <p>
                <?php echo _('Use this page to download a copy of the local/remote database in SQLite v3 format.'); ?>
                <br/>
                <br/>
               
                <?php echo _('Database can be browsed/modified/exported with the'); ?>
                <a href="https://code.google.com/p/sqlite-manager/">
                        SQLite Manager
                </a>
                <?php echo _('extension for Firefox.'); ?>
                <br/>
                <br/>
                <?php echo _('Please note that download may take some time...'); ?>
        </p>
       
        <fieldset>

                <label for="form_device_key">
                        <?php echo _('Device'); ?>:
                </label>
                <?php
                include_once('ymd.php');

                // Create device list form
                if(isset($_SESSION['park']))
                {
                        $select = "\r\n";
                        $select .= "<select name=\"form_device_key\" id=\"form_device_key\">";

                        $park = $_SESSION['park'];
                        if($park)
                        {
                                if(!isset($form_device_key))
                                {
                                        $device_keys     = $park->getDevicesKeys();
                                        $form_device_key = $device_keys[0];
                                }

                                foreach($park as $key => $device)
                                {
                                        $device_name = $device->getName();

                                        if($key == $form_device_key)
                                        {
                                                $select .= "<option value=\"$key\" selected=\"selected\"> $device_name </option>";
                                        }
                                        else
                                        {
                                                $select .= "<option value=\"$key\"> $device_name </option>";
                                        }
                                }
                        }

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

                <hr/>

                <div class="buttons">
                        <input type="hidden" name="form_data" value="download" />
                        <input type="hidden" name="form_token" value="<?php echo $form_token; ?>" />
                        <input type="submit" value=<?php echo _('Download'); ?> id="data_submit_save" name="form_submit" alt="download" />
                </div>

        </fieldset>
        </form>

        <br/>

        <?php
        if(isset($_SESSION['message']))
        echo $_SESSION['message'];
        ?>

</div>