Beispiel #1
0
function plugin_init_addressing()
{
    global $PLUGIN_HOOKS;
    $PLUGIN_HOOKS['csrf_compliant']['addressing'] = true;
    $PLUGIN_HOOKS['change_profile']['addressing'] = array('PluginAddressingProfile', 'changeProfile');
    $PLUGIN_HOOKS['pre_item_purge']['addressing'] = array('Profile' => array('PluginAddressingProfile', 'purgeProfiles'));
    Plugin::registerClass('PluginAddressingProfile', array('addtabon' => array('Profile')));
    if (Session::getLoginUserID()) {
        if (plugin_addressing_haveRight("addressing", "r")) {
            $PLUGIN_HOOKS['menu_entry']['addressing'] = 'front/addressing.php';
            $PLUGIN_HOOKS['submenu_entry']['addressing']['search'] = 'front/addressing.php';
        }
        if (plugin_addressing_haveRight("addressing", "w")) {
            $PLUGIN_HOOKS['submenu_entry']['addressing']['add'] = 'front/addressing.form.php?new=1';
            $PLUGIN_HOOKS['use_massive_action']['addressing'] = 1;
        }
        // Config page
        if (Session::haveRight("config", "w")) {
            $PLUGIN_HOOKS['submenu_entry']['addressing']['config'] = 'front/config.form.php';
            $PLUGIN_HOOKS['config_page']['addressing'] = 'front/config.form.php';
        }
        // Add specific files to add to the header : javascript or css
        //$PLUGIN_HOOKS['add_javascript']['example']="example.js";
        $PLUGIN_HOOKS['add_css']['addressing'] = "addressing.css";
        $PLUGIN_HOOKS['add_javascript']['addressing'] = 'addressing.js';
        $PLUGIN_HOOKS['post_init']['addressing'] = array('PluginAddressingPing_Equipment', 'postinit');
    }
}
 function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
 {
     global $CFG_GLPI;
     $ping = plugin_addressing_haveRight("use_ping_in_equipment", '1');
     if ($ping && in_array($item->getType(), $CFG_GLPI["networkport_types"])) {
         if ($item->getField('id')) {
             return array('1' => __('IP ping', 'addressing'));
         }
     }
     return '';
 }
 static function canView()
 {
     return plugin_addressing_haveRight('addressing', 'r');
 }
Beispiel #4
0
function plugin_addressing_getAddSearchOptions($itemtype)
{
    $sopt = array();
    if ($itemtype == 'Profile') {
        if (plugin_addressing_haveRight("addressing", "r")) {
            // Use a plugin type reservation to avoid conflict
            $sopt[5000]['table'] = 'glpi_plugin_addressing_profiles';
            $sopt[5000]['field'] = 'addressing';
            $sopt[5000]['name'] = PluginAddressingAddressing::getTypeName(2);
            //$sopt[5000]['datatype']='bool';
        }
    }
    return $sopt;
}