예제 #1
0
 function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
 {
     if ($item->getType() == 'Profile') {
         return PluginWebapplicationsWebapplication::getTypeName(2);
     }
     return '';
 }
 function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
 {
     if (!$withtemplate) {
         if ($item->getType() == 'PluginWebapplicationsWebapplication' && count(PluginWebapplicationsWebapplication::getTypes(false))) {
             if ($_SESSION['glpishow_count_on_tabs']) {
                 return self::createTabEntry(_n('Associated item', 'Associated items', 2), self::countForWebapplication($item));
             }
             return _n('Associated item', 'Associated items', 2);
         } else {
             if (in_array($item->getType(), PluginWebapplicationsWebapplication::getTypes(true)) && Session::haveRight("plugin_webapplications", READ)) {
                 if ($_SESSION['glpishow_count_on_tabs']) {
                     return self::createTabEntry(PluginWebapplicationsWebapplication::getTypeName(2), self::countForItem($item));
                 }
                 return PluginWebapplicationsWebapplication::getTypeName(2);
             }
         }
     }
     return '';
 }
예제 #3
0
                                    $web_item->delete($input);
                                }
                            }
                            Html::back();
                            //unlink webapplications to items of glpi from the items form
                        } else {
                            if (isset($_POST["deletewebapplications"])) {
                                $input = array('id' => $_POST["id"]);
                                $web_item->check($_POST["id"], 'w');
                                $web_item->delete($input);
                                Html::back();
                            } else {
                                $web->checkGlobal("r");
                                //check environment meta-plugin installtion for change header
                                $plugin = new Plugin();
                                if ($plugin->isActivated("environment")) {
                                    Html::header(PluginWebapplicationsWebapplication::getTypeName(2), '', "plugins", "environment", "webapplications");
                                } else {
                                    Html::header(PluginWebapplicationsWebapplication::getTypeName(2), '', "plugins", "webapplications");
                                }
                                //load webapplications form
                                $web->showForm($_GET["id"]);
                                Html::footer();
                            }
                        }
                    }
                }
            }
        }
    }
}
                                    $web_item->delete($input);
                                }
                            }
                            Html::back();
                            //unlink webapplications to items of glpi from the items form
                        } else {
                            if (isset($_POST["deletewebapplications"])) {
                                $input = array('id' => $_POST["id"]);
                                $web_item->check($_POST["id"], UPDATE);
                                $web_item->delete($input);
                                Html::back();
                            } else {
                                $web->checkGlobal(READ);
                                //check environment meta-plugin installtion for change header
                                $plugin = new Plugin();
                                if ($plugin->isActivated("environment")) {
                                    Html::header(PluginWebapplicationsWebapplication::getTypeName(2), '', "assets", "pluginenvironmentdisplay", "webapplications");
                                } else {
                                    Html::header(PluginWebapplicationsWebapplication::getTypeName(2), '', "assets", "pluginwebapplicationsmenu");
                                }
                                //load webapplications form
                                $web->display($_GET);
                                Html::footer();
                            }
                        }
                    }
                }
            }
        }
    }
}
예제 #5
0
function plugin_init_webapplications()
{
    global $PLUGIN_HOOKS, $CFG_GLPI;
    $PLUGIN_HOOKS['csrf_compliant']['webapplications'] = true;
    //load changeprofile function
    $PLUGIN_HOOKS['change_profile']['webapplications'] = array('PluginWebapplicationsProfile', 'changeProfile');
    $PLUGIN_HOOKS['assign_to_ticket']['webapplications'] = true;
    if (class_exists('PluginWebapplicationsWebapplication_Item')) {
        // only if plugin activated
        $PLUGIN_HOOKS['pre_item_purge']['webapplications'] = array('Profile' => array('PluginWebapplicationsProfile', 'purgeProfiles'));
        $PLUGIN_HOOKS['plugin_datainjection_populate']['webapplications'] = 'plugin_datainjection_populate_webapplications';
    }
    // Params : plugin name - string type - number - class - table - form page
    Plugin::registerClass('PluginWebapplicationsWebapplication', array('linkgroup_tech_types' => true, 'linkuser_tech_types' => true, 'document_types' => true, 'contract_types' => true, 'ticket_types' => true, 'helpdesk_visible_types' => true, 'addtabon' => 'Supplier'));
    Plugin::registerClass('PluginWebapplicationsProfile', array('addtabon' => array('Profile')));
    if (class_exists('PluginAccountsAccount')) {
        PluginAccountsAccount::registerType('PluginWebapplicationsWebapplication');
    }
    if (class_exists('PluginCertificatesCertificate')) {
        PluginCertificatesCertificate::registerType('PluginWebapplicationsWebapplication');
    }
    //if glpi is loaded
    if (Session::getLoginUserID()) {
        //if environment plugin is installed
        if (isset($_SESSION["glpi_plugin_environment_installed"]) && $_SESSION["glpi_plugin_environment_installed"] == 1) {
            //init $_SESSION for environment using
            $_SESSION["glpi_plugin_environment_webapplications"] = 1;
            if (plugin_webapplications_haveRight("webapplications", "r")) {
                $PLUGIN_HOOKS['submenu_entry']['environment']['options']['webapplications']['title'] = PluginWebapplicationsWebapplication::getTypeName(2);
                $PLUGIN_HOOKS['submenu_entry']['environment']['options']['webapplications']['page'] = '/plugins/webapplications/front/webapplication.php';
                $PLUGIN_HOOKS['submenu_entry']['environment']['options']['webapplications']['links']['search'] = '/plugins/webapplications/front/webapplication.php';
            }
            if (plugin_webapplications_haveRight("webapplications", "w")) {
                //redirect link to add webapplications
                $PLUGIN_HOOKS['submenu_entry']['environment']['options']['webapplications']['links']['add'] = '/plugins/webapplications/front/webapplication.form.php';
                //use massiveaction in the plugin
                $PLUGIN_HOOKS['use_massive_action']['webapplications'] = 1;
            }
            //if environment plugin isn't installed
        } else {
            // Display a menu entry ?
            if (plugin_webapplications_haveRight("webapplications", "r")) {
                //menu entry
                $PLUGIN_HOOKS['menu_entry']['webapplications'] = 'front/webapplication.php';
                //search link
                $PLUGIN_HOOKS['submenu_entry']['webapplications']['search'] = 'front/webapplication.php';
            }
            if (plugin_webapplications_haveRight("webapplications", "w")) {
                //add link
                $PLUGIN_HOOKS['submenu_entry']['webapplications']['add'] = 'front/webapplication.form.php';
                //use massiveaction in the plugin
                $PLUGIN_HOOKS['use_massive_action']['webapplications'] = 1;
            }
        }
        if (plugin_webapplications_haveRight("webapplications", "r") || Session::haveRight("config", "w")) {
        }
        // Import from Data_Injection plugin
        //      $PLUGIN_HOOKS['migratetypes']['webapplications']
        //                                   = 'plugin_datainjection_migratetypes_webapplications';
        $PLUGIN_HOOKS['plugin_pdf']['PluginWebapplicationsWebapplication'] = 'PluginWebapplicationsWebapplicationPDF';
    }
    // End init, when all types are registered
    $PLUGIN_HOOKS['post_init']['webapplications'] = 'plugin_webapplications_postinit';
}
예제 #6
0
function plugin_webapplications_getAddSearchOptions($itemtype)
{
    $sopt = array();
    if (in_array($itemtype, PluginWebapplicationsWebapplication::getTypes(true))) {
        if (Session::haveRight("plugin_webapplications", READ)) {
            $sopt[1310]['table'] = 'glpi_plugin_webapplications_webapplications';
            $sopt[1310]['field'] = 'name';
            $sopt[1310]['name'] = PluginWebapplicationsWebapplication::getTypeName(2) . " - " . __('Name');
            $sopt[1310]['forcegroupby'] = true;
            $sopt[1310]['datatype'] = 'itemlink';
            $sopt[1310]['massiveaction'] = false;
            $sopt[1310]['itemlink_type'] = 'PluginWebapplicationsWebapplication';
            $sopt[1310]['joinparams'] = array('beforejoin' => array('table' => 'glpi_plugin_webapplications_webapplications_items', 'joinparams' => array('jointype' => 'itemtype_item')));
            $sopt[1311]['table'] = 'glpi_plugin_webapplications_webapplicationtypes';
            $sopt[1311]['field'] = 'name';
            $sopt[1311]['name'] = PluginWebapplicationsWebapplication::getTypeName(2) . " - " . PluginWebapplicationsWebapplicationType::getTypeName(1);
            $sopt[1311]['forcegroupby'] = true;
            $sopt[1311]['datatype'] = 'dropdown';
            $sopt[1311]['massiveaction'] = false;
            $sopt[1311]['joinparams'] = array('beforejoin' => array(array('table' => 'glpi_plugin_webapplications_webapplications', 'joinparams' => $sopt[1310]['joinparams'])));
        }
    }
    return $sopt;
}