Esempio n. 1
0
This file is part of Positions.

Positions 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 2 of the License, or
(at your option) any later version.

Positions 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 Positions. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
include '../../../inc/includes.php';
header("Content-Type: text/html; charset=UTF-8");
Html::header_nocache();
switch ($_POST['action']) {
    case 'setConfig':
        if (isset($_POST['config']) && !empty($_POST['config'])) {
            $positions = new PluginPositionsPosition();
            $input = json_decode(stripslashes($_POST['config']), true);
            $input['name'] = $input['label'];
            $input['x_coordinates'] = $input['x'];
            $input['y_coordinates'] = $input['y'];
            $positions->update($input);
        }
        break;
}
Esempio n. 2
0
        $pos->add($_POST);
    }
} else {
    if (isset($_POST["additem"])) {
        $pos->check(-1, UPDATE, $_POST);
        $pos->add($_POST);
        Html::back();
    } else {
        if (isset($_POST["update"])) {
            if (isset($_POST["multi"])) {
                $data = explode(",", $_POST["multi"]);
                for ($i = 0; $i < count($data); $i = $i + 3) {
                    if (isset($data[$i + 1]) && isset($data[$i + 2])) {
                        $input = array('id' => $data[$i], 'x_coordinates' => $data[$i + 1], 'y_coordinates' => $data[$i + 2], 'locations_id' => $_POST["locations_id"]);
                        $pos->check($input['id'], UPDATE);
                        $pos->update($input);
                    }
                }
                if (isset($_POST["referrer"]) && $_POST["referrer"] > 0) {
                    Html::back();
                } else {
                    Html::redirect($CFG_GLPI["root_doc"] . "/plugins/positions/front/map.php?locations_id=" . $_POST["locations_id"]);
                }
            } else {
                $pos->check($_POST['id'], UPDATE);
                $pos->update($_POST);
                if (isset($_POST["referrer"]) && $_POST["referrer"] > 0) {
                    Html::back();
                } else {
                    Html::redirect($CFG_GLPI["root_doc"] . "/plugins/positions/front/position.form.php?id=" . $_POST['id']);
                }