Subversion Repositories portal2

Rev

Rev 699 | 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
$form_token = md5(uniqid('auth', true));
$_SESSION['form_token'] = $form_token;

if(isset($_GET['form_group_name']))
{
        $form_group_name = $_GET['form_group_name'];
        unset($_GET['form_group_name']);
}
else
{
        $form_group_name = "";
}

$form_group_rank = 0;
?>

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

        <?php

        $id              = link_get_id_from_filename("form_groups_add_submit.php");
        echo "<form action=\"index.php?id_page=$id&form_group_name=$form_group_name\" method=\"post\">";
        ?>
       
        <fieldset>
                <legend>
                        <?php echo _('Data'); ?>
                </legend>

                <?php
                if(isset($_SESSION['data']))
                {
                        $data = $_SESSION['data'];
                        $data->sortItems('name', false);

                        if($data)
                        {
                                $select = '';
                                foreach($data as $key => $datum)
                                {
                                        $name = $datum->getName();

                                        $select .= "  <input type=\"checkbox\" id=\"$key\"  name=\"$key\" />  $name <br/>\n";
                                }
                                echo $select;
                        }
                }
                ?>

                <hr/>
                <div class="buttons">
                        <input type="hidden" name="form_token" value="<?php echo $form_token; ?>" />
                        <input type="submit" name="form_add" value=<?php echo _('OK');?> id="form_add" alt="add" />
                        <input type="submit" name="form_cancel" value=<?php echo _('Cancel');?> id="form_cancel" alt="cancel" />
                </div>

                </legend>
        </fieldset>
        </form>
       
        <?php
                echo '<p>';
                echo _('Please note that no ckecking is performed on the data type you store in a group. For instance, the application will not raise an error if you group water and electricity items.');
                echo '</p>';
        ?>
       
       
</div>