Exemple #1
0
https://forge.indepnet.net/projects/positions
-------------------------------------------------------------------------

LICENSE
		
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';
Html::header(PluginPositionsPosition::getTypeName(), '', "tools", "pluginpositionsmenu", "info");
$config = new PluginPositionsInfo();
if ($config->canView() || Session::haveRight("config", UPDATE)) {
    Search::show("PluginPositionsInfo");
} else {
    Html::displayRightError();
}
Html::footer();
Exemple #2
0
(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 (!isset($_GET["id"])) {
    $_GET["id"] = "";
}
$info = new PluginPositionsInfo();
if (isset($_POST["add"])) {
    $info->check(-1, 'w', $_POST);
    $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 {
LICENSE
		
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/>.
--------------------------------------------------------------------------
*/
if (strpos($_SERVER['PHP_SELF'], "dropdownInfoFields.php")) {
    include '../../../inc/includes.php';
    header("Content-Type: text/html; charset=UTF-8");
    Html::header_nocache();
}
$config = new PluginPositionsInfo();
if ($_POST['id'] > 0) {
    $config->getFromDB($_POST['id']);
} else {
    $config->getEmpty();
    $config->fields['itemtype'] = $_POST['itemtype'];
}
PluginPositionsInfo::selectCriterias($config);
 static function showOverlay($localID, $srcimg, $itemclass, $infos)
 {
     global $CFG_GLPI;
     $defaultheight = 50;
     $height = 0;
     $addheight = 0;
     if (!empty($infos)) {
         foreach ($infos as $info) {
             if ($itemclass->getType() == $info['itemtype']) {
                 $fields = explode(',', $info['fields']);
                 $nb = 0;
                 for ($i = 0; $i < count($fields); $i++) {
                     if (!empty($itemclass->fields[$fields[$i]])) {
                         $nb++;
                     }
                 }
                 $height = 30 * $nb;
             }
         }
         $height = $defaultheight + $height;
         if ($itemclass->getType() == 'Phone') {
             $height = $height + 80;
         } else {
             if ($itemclass->getType() == 'PluginResourcesResource') {
                 $resID = $itemclass->fields['id'];
                 $restrict = "`plugin_resources_resources_id` = {$resID} AND `itemtype` = 'User' ";
                 $datas = getAllDatasFromTable('glpi_plugin_resources_resources_items', $restrict);
                 if (!empty($datas)) {
                     foreach ($datas as $data) {
                         if (isset($data['items_id']) && $data['items_id'] > 0) {
                             $userid = $data['items_id'];
                             $entitiesID = $itemclass->fields['entities_id'];
                             $condition = "`users_id` = '{$userid}'\n                                    AND `is_deleted` = '0' \n                                    AND `is_template` = '0' \n                                    AND `entities_id` = '{$entitiesID}'\n                                    AND `contact_num` != 0 ";
                             if (($number = countElementsInTable("glpi_phones", $condition)) > 1) {
                                 $addheight = 30 * $number;
                             }
                             $height = $height + $addheight;
                         }
                     }
                 }
             }
         }
     } else {
         $height = $defaultheight + 30;
     }
     if (Session::haveRight('plugin_positions', UPDATE) && $itemclass->canView()) {
         echo "<a class='config' target='_blank' title=\"" . __('Configuring the display materials', 'positions') . "\"\n                              href='" . $CFG_GLPI["root_doc"] . "/plugins/positions/front/info.php'></a>";
     }
     $width = 450;
     if ($itemclass->getType() != 'PluginResourcesResource' && $itemclass->getType() != 'Location' && $itemclass->getType() != 'Netpoint') {
         $img = "<img src='" . $CFG_GLPI["root_doc"] . "/plugins/positions/pics/nothing.png' width='30' height='30'>";
         if (!preg_match("/nothing.png/", $srcimg)) {
             $path = GLPI_PLUGIN_DOC_DIR . "/positions/pics/" . $srcimg;
             $sizes = getimagesize($path);
             $largeur = $sizes[0];
             $hauteur = $sizes[1];
             $ext = pathinfo($srcimg, PATHINFO_EXTENSION);
             $img = "<object width='" . $largeur . "' height='" . $hauteur . "' data='" . $CFG_GLPI['root_doc'] . "/plugins/positions/front/map.send.php?file=" . $srcimg . "&type=pics' type='image/{$ext}'>\n             <param name='src' value='" . $CFG_GLPI['root_doc'] . "/plugins/positions/front/map.send.php?file=" . $srcimg . "&type=pics'>\n            </object> ";
         }
     } else {
         $plugin = new Plugin();
         if ($plugin->isActivated("resources") && $itemclass->getType() == 'PluginResourcesResource') {
             $img = "<img src='" . $CFG_GLPI["root_doc"] . "/plugins/resources/pics/nobody.png' width='90' height='90'>";
             $res = new PluginResourcesResource();
             if ($res->getFromDB($itemclass->fields["id"])) {
                 if (isset($res->fields["picture"])) {
                     $path = GLPI_PLUGIN_DOC_DIR . "/resources/" . $res->fields["picture"];
                     if (file_exists($path)) {
                         $sizes = getimagesize($path);
                         $largeur = $sizes[0];
                         $hauteur = $sizes[1];
                         $ext = pathinfo($srcimg, PATHINFO_EXTENSION);
                         $img = "<object width='" . $largeur . "' height='" . $hauteur . "' data='" . $CFG_GLPI['root_doc'] . "/plugins/resources/front/picture.send.php?file=" . $res->fields["picture"] . "' type='image/{$ext}'>\n                <param name='src' value='" . $CFG_GLPI['root_doc'] . "/plugins/resources/front/picture.send.php?file=" . $res->fields["picture"] . "'>\n               </object> ";
                     }
                 }
             }
             $width = $width - 75;
         } else {
             $img = '';
         }
     }
     echo "<table><tr><td>";
     echo $img;
     echo "</td><td><div class='details' style='width:480px;'>";
     if (!empty($infos)) {
         foreach ($infos as $info) {
             if ($itemclass->getType() == $info['itemtype']) {
                 PluginPositionsInfo::showFields($info, $itemclass);
             }
         }
     }
     if ($_SESSION['glpiactiveprofile']['interface'] == 'central' || $itemclass->getType() == 'Location') {
         PluginPositionsInfo::getDirectLink($itemclass);
     }
     //end details
     echo "</div>";
     echo "<div class='call' style='width:480px;'>";
     PluginPositionsInfo::getCallValue($itemclass);
     //end call
     echo "</div>";
     echo "</td></tr></table>";
 }
Exemple #5
0
(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 (!isset($_GET["id"])) {
    $_GET["id"] = "";
}
$info = new PluginPositionsInfo();
if (isset($_POST["add"])) {
    $info->check(-1, CREATE, $_POST);
    $newID = $info->add($_POST);
    if ($_SESSION['glpibackcreated']) {
        Html::redirect($info->getFormURL() . "?id=" . $newID);
    } else {
        Html::back();
    }
} else {
    if (isset($_POST["update"])) {
        $info->check($_POST['id'], UPDATE);
        $info->update($_POST);
        Html::back();
    } else {
        if (isset($_POST["delete"])) {
Exemple #6
0
https://forge.indepnet.net/projects/positions
-------------------------------------------------------------------------

LICENSE
		
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';
Html::header(PluginPositionsPosition::getTypeName(), '', "plugins", "positions", "info");
$config = new PluginPositionsInfo();
if ($config->canView() || Session::haveRight("config", "w")) {
    Search::show("PluginPositionsInfo");
} else {
    Html::displayRightError();
}
Html::footer();