Beispiel #1
0
 function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
 {
     if ($item->getType() == 'Profile') {
         return PluginPositionsPosition::getTypeName();
     }
     return '';
 }
Beispiel #2
0
include '../../../inc/includes.php';
$img = new PluginPositionsImageItem();
if (isset($_POST["add"]) && isset($_POST['type'])) {
    $test = explode(";", $_POST['type']);
    if (isset($test[0]) && isset($test[1]) && !empty($test[1])) {
        $_POST['type'] = $test[1];
        $_POST['itemtype'] = $test[0];
        if ($img->canCreate()) {
            if (!empty($_POST["img"])) {
                $img->addItemImage($_POST);
            } else {
                Session::addMessageAfterRedirect(__('No picture uploaded', 'positions'), false, ERROR);
            }
        }
    }
    Html::back();
} else {
    if (isset($_POST["delete"])) {
        $img->getFromDB($_POST["id"], -1);
        foreach ($_POST["item"] as $key => $val) {
            if ($val == 1) {
                $img->delete(array('id' => $key));
            }
        }
        Html::back();
    } else {
        Html::header(PluginPositionsPosition::getTypeName(), '', "tools", "pluginpositionsmenu", "config");
        $img->showConfigForm();
        Html::footer();
    }
}
Beispiel #3
0
    $newID = $info->add($_POST);
    Html::back();
} else {
    if (isset($_POST["update"])) {
        $info->check($_POST['id'], 'w');
        $info->update($_POST);
        Html::back();
    } else {
        if (isset($_POST["delete"])) {
            $info->check($_POST['id'], 'w');
            $info->delete($_POST);
            $info->redirectToList();
        } else {
            if (isset($_POST["restore"])) {
                $info->check($_POST['id'], 'w');
                $info->restore($_POST);
                $info->redirectToList();
            } else {
                if (isset($_POST["purge"])) {
                    $info->check($_POST['id'], 'w');
                    $info->delete($_POST, 1);
                    $info->redirectToList();
                } else {
                    Html::header(PluginPositionsPosition::getTypeName(), '', "plugins", "positions", "info");
                    $info->showForm($_GET["id"]);
                    Html::footer();
                }
            }
        }
    }
}
Beispiel #4
0
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';
if ($_SESSION['glpiactiveprofile']['interface'] == 'central') {
    //from central
    Html::header(PluginPositionsPosition::getTypeName(), '', "plugins", "positions");
} else {
    //from helpdesk
    Html::helpHeader(PluginPositionsPosition::getTypeName());
}
if (!isset($_POST["locations_id"])) {
    $_POST["locations_id"] = 0;
}
PluginPositionsPosition::showLocationForm($_POST["locations_id"]);
if ($_SESSION['glpiactiveprofile']['interface'] == 'central') {
    Html::footer();
} else {
    Html::helpFooter();
}
Beispiel #5
0
 function showForm($ID, $options = array())
 {
     if (!Session::haveRight("profile", "r")) {
         return false;
     }
     $prof = new Profile();
     if ($ID) {
         $this->getFromDBByProfile($ID);
         $prof->getFromDB($ID);
     }
     $this->showFormHeader($options);
     echo "<tr class='tab_bg_2'>";
     echo "<th colspan='4'>" . sprintf(__('%1$s - %2$s'), __('Rights management', 'positions'), $prof->fields["name"]) . "</th>";
     echo "</tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td>" . PluginPositionsPosition::getTypeName() . ":</td><td>";
     if ($prof->fields['interface'] != 'helpdesk') {
         Profile::dropdownNoneReadWrite("positions", $this->fields["positions"], 1, 1, 1);
     } else {
         Profile::dropdownNoneReadWrite("positions", $this->fields["positions"], 1, 1, 0);
     }
     echo "</td>";
     echo "<td></td>";
     echo "</tr>";
     echo "<input type='hidden' name='id' value=" . $this->fields["id"] . ">";
     $options['candel'] = false;
     $this->showFormButtons($options);
 }
Beispiel #6
0
        $_POST["locations_id"] = $_GET["locations_id"];
    }
    if (!isset($_POST["download"])) {
        $_POST["download"] = $_GET["download"];
    }
    $types = PluginPositionsPosition::getTypes();
    if (!isset($_POST["itemtype"])) {
        $_POST["itemtype"] = $types;
    }
    $locations_id = $_POST["locations_id"];
    $id = $_GET["positions_id"];
    $itemtype = $_POST['itemtype'];
    $menuoff = 1;
    $download = $_POST['download'];
}
$plugin = new Plugin();
if (isset($_GET['from_treeview']) && $plugin->isActivated("treeview")) {
    Html::header(PluginPositionsPosition::getTypeName(), '', "plugins", "positions");
} else {
    Html::popHeader(PluginPositionsPosition::getTypeName(), $_SERVER['PHP_SELF']);
}
if (isset($locations_id) && !empty($locations_id)) {
    $target = $_SERVER['PHP_SELF'] . "?id=" . $id;
    $options = array('id' => $id, 'locations_id' => $locations_id, 'itemtype' => $itemtype, 'target' => $target, 'menuoff' => $menuoff, 'download' => $download);
    PluginPositionsPosition::showMap($options);
} else {
    echo "<div class='center'><br><br>";
    echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/warning.png' alt='warning'><br><br>";
    echo "<span class='b'>" . __('The selected object is not located on a map', 'positions') . "</span></div>";
}
Html::popFooter();