Example #1
0
function plugin_typology_install()
{
    global $DB;
    include_once GLPI_ROOT . "/plugins/typology/inc/profile.class.php";
    if (!TableExists("glpi_plugin_typology_typologies")) {
        // table sql creation
        $DB->runFile(GLPI_ROOT . "/plugins/typology/sql/empty-1.0.0.sql");
        $query_id = "SELECT `id` FROM `glpi_notificationtemplates` WHERE `itemtype`='PluginTypologyTypology' AND `name` = 'Alert no validated typology'";
        $result = $DB->query($query_id) or die($DB->error());
        $itemtype = $DB->result($result, 0, 'id');
        $query = "INSERT INTO `glpi_notificationtemplatetranslations`\n                                 VALUES(NULL, " . $itemtype . ", '','##typology.action## : ##typology.entity##',\n                        '##FOREACHitems##\n   ##lang.typology.name## : ##typology.name##\n   ##lang.typology.itemtype## : ##typology.itemtype##\n   ##lang.typology.items_id## : ##typology.items_id##\n   ##lang.typology.itemlocation## : ##typology.itemlocation##\n   ##lang.typology.itemuser## : ##typology.itemuser##\n   ##lang.typology.error## : ##typology.error##\n   ##ENDFOREACHitems##',\n   '<table class=\"tab_cadre\" border=\"1\" cellspacing=\"2\" cellpadding=\"3\">\n   <tbody>\n   <tr>\n   <td style=\"text-align: left;\" bgcolor=\"#cccccc\"><span style=\"font-family: Verdana; font-size: 11px; text-align: left;\">##lang.typology.name##</span></td>\n   <td style=\"text-align: left;\" bgcolor=\"#cccccc\"><span style=\"font-family: Verdana; font-size: 11px; text-align: left;\">##lang.typology.itemtype##</span></td>\n   <td style=\"text-align: left;\" bgcolor=\"#cccccc\"><span style=\"font-family: Verdana; font-size: 11px; text-align: left;\">##lang.typology.items_id##</span></td>\n   <td style=\"text-align: left;\" bgcolor=\"#cccccc\"><span style=\"font-family: Verdana; font-size: 11px; text-align: left;\">##lang.typology.itemlocation##</span></td>\n   <td style=\"text-align: left;\" bgcolor=\"#cccccc\"><span style=\"font-family: Verdana; font-size: 11px; text-align: left;\">##lang.typology.itemuser##</span></td>\n   <td style=\"text-align: left;\" bgcolor=\"#cccccc\"><span style=\"font-family: Verdana; font-size: 11px; text-align: left;\">##lang.typology.error##</span></td>\n   </tr>\n   ##FOREACHtypologyitems##\n   <tr>\n   <td><a href=\"##typology.url##\" target=\"_blank\"><span style=\"font-family: Verdana; font-size: 11px; text-align: left;\">##typology.name##</span></a></td>\n   <td><span style=\"font-family: Verdana; font-size: 11px; text-align: left;\">##typology.itemtype##</span></td>\n   <td><a href=\"##typology.itemurl##\" target=\"_blank\"><span style=\"font-family: Verdana; font-size: 11px; text-align: left;\">##typology.items_id##</span></a></td>\n   <td><span style=\"font-family: Verdana; font-size: 11px; text-align: left;\">##typology.itemlocation##</span></td>\n   <td><span style=\"font-family: Verdana; font-size: 11px; text-align: left;\">##typology.itemuser##</span></td>\n   <td><span style=\"font-family: Verdana; font-size: 11px; text-align: left;\">##typology.error##</span></td>\n   </tr>\n   ##ENDFOREACHtypologyitems##\n   </tbody>\n   </table>');";
        $result = $DB->query($query);
        $query = "INSERT INTO `glpi_notifications`\n                                   VALUES (NULL, 'Alert no validated typology', 0, 'PluginTypologyTypology', 'AlertNotValidatedTypology',\n                                          'mail'," . $itemtype . ",\n                                          '', 1, 1, '2010-02-17 22:36:46');";
        $result = $DB->query($query);
    }
    if (TableExists("glpi_plugin_typology_typologycriterias")) {
        $query = "UPDATE `glpi_plugin_typology_typologycriterias`\n                     SET `itemtype`='IPAddress'\n                     WHERE `itemtype`='NetworkPort'";
        $result = $DB->query($query);
        $query = "UPDATE `glpi_plugin_typology_typologycriteriadefinitions`\n                     SET `field`='name;glpi_ipaddresses;itemlink'\n                     WHERE `field` LIKE '%glpi_networkports%'";
        $result = $DB->query($query);
    }
    CronTask::Register('PluginTypologyTypology', 'UpdateTypology', DAY_TIMESTAMP);
    CronTask::Register('PluginTypologyTypology', 'NotValidated', DAY_TIMESTAMP);
    PluginTypologyProfile::createFirstAccess($_SESSION['glpiactiveprofile']['id']);
    return true;
}
Example #2
0
 Typology 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.

 Typology 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 Typology. If not, see <http://www.gnu.org/licenses/>.
 --------------------------------------------------------------------------
*/
include '../../../inc/includes.php';
PluginTypologyProfile::checkRight('typology', 'w');
if (!isset($_GET["id"])) {
    $_GET["id"] = "";
}
$typo = new PluginTypologyTypology();
$typo_item = new PluginTypologyTypology_Item();
if (isset($_POST["add"])) {
    $typo->check(-1, 'w');
    $newID = $typo->add($_POST);
    Html::back();
} else {
    if (isset($_POST["delete"])) {
        $typo->check($_POST["id"], 'w');
        $typo->delete($_POST);
        $typo->redirectToList();
    } else {
Example #3
0
 Copyright (C) 2006-2012 by the Typology Development Team.

 https://forge.indepnet.net/projects/typology
 -------------------------------------------------------------------------

 LICENSE

 This file is part of Typology.

 Typology 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.

 Typology 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 Typology. If not, see <http://www.gnu.org/licenses/>.
 --------------------------------------------------------------------------
*/
include '../../../inc/includes.php';
Session::checkRight("profile", "w");
$prof = new PluginTypologyProfile();
//Save profile
if (isset($_POST['update'])) {
    $prof->update($_POST);
    Html::back();
}