Ejemplo n.º 1
0
 public function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
 {
     if ($item->getType() == 'Profile') {
         return PluginBadgesBadge::getTypeName(2);
     }
     return '';
 }
Ejemplo n.º 2
0
function plugin_init_badges()
{
    global $PLUGIN_HOOKS;
    $PLUGIN_HOOKS['csrf_compliant']['badges'] = true;
    $PLUGIN_HOOKS['change_profile']['badges'] = array('PluginBadgesProfile', 'changeProfile');
    $PLUGIN_HOOKS['assign_to_ticket']['badges'] = true;
    if (Session::getLoginUserID()) {
        Plugin::registerClass('PluginBadgesBadge', array('linkuser_types' => true, 'document_types' => true, 'helpdesk_visible_types' => true, 'ticket_types' => true, 'notificationtemplates_types' => true));
        Plugin::registerClass('PluginBadgesProfile', array('addtabon' => 'Profile'));
        Plugin::registerClass('PluginBadgesConfig', array('addtabon' => 'CronTask'));
        if (class_exists('PluginResourcesResource')) {
            PluginResourcesResource::registerType('PluginBadgesBadge');
        }
        if (isset($_SESSION["glpi_plugin_environment_installed"]) && $_SESSION["glpi_plugin_environment_installed"] == 1) {
            $_SESSION["glpi_plugin_environment_badges"] = 1;
            if (plugin_badges_haveRight("badges", "r")) {
                $PLUGIN_HOOKS['submenu_entry']['environment']['options']['badges']['title'] = PluginBadgesBadge::getTypeName(2);
                $PLUGIN_HOOKS['submenu_entry']['environment']['options']['badges']['page'] = '/plugins/badges/front/badge.php';
                $PLUGIN_HOOKS['submenu_entry']['environment']['options']['badges']['links']['search'] = '/plugins/badges/front/badge.php';
            }
            if (plugin_badges_haveRight("badges", "w")) {
                $PLUGIN_HOOKS['submenu_entry']['environment']['options']['badges']['links']['add'] = '/plugins/badges/front/badge.form.php';
            }
        } else {
            if (plugin_badges_haveRight("badges", "r")) {
                $PLUGIN_HOOKS['menu_entry']['badges'] = 'front/badge.php';
                $PLUGIN_HOOKS['submenu_entry']['badges']['search'] = 'front/badge.php';
            }
            if (plugin_badges_haveRight("badges", "w")) {
                $PLUGIN_HOOKS['submenu_entry']['badges']['add'] = 'front/badge.form.php?new=1';
            }
        }
        if (class_exists('PluginBadgesBadge')) {
            // only if plugin activated
            //Clean Plugin on Profile delete
            $PLUGIN_HOOKS['pre_item_purge']['badges'] = array('Profile
                                             ' => array('PluginBadgesProfile', 'purgeProfiles'));
            $PLUGIN_HOOKS['plugin_datainjection_populate']['badges'] = 'plugin_datainjection_populate_badges';
        }
        // Import from Data_Injection plugin
        $PLUGIN_HOOKS['migratetypes']['badges'] = 'plugin_datainjection_migratetypes_badges';
    }
}
Ejemplo n.º 3
0
This file is part of badges.

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

Badges 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 Badges. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
include '../../../inc/includes.php';
$plugin = new Plugin();
if ($plugin->isActivated("environment")) {
    Html::header(PluginBadgesBadge::getTypeName(2), '', "assets", "pluginenvironmentdisplay", "badges");
} else {
    Html::header(PluginBadgesBadge::getTypeName(2), '', "assets", "pluginbadgesmenu");
}
$badge = new PluginBadgesBadge();
$badge->checkGlobal(READ);
if ($badge->canView()) {
    Search::show("PluginBadgesBadge");
} else {
    Html::displayRightError();
}
Html::footer();
Ejemplo n.º 4
0
function plugin_badges_AssignToTicket($types)
{
    if (Session::haveRight("plugin_badges_open_ticket", "1")) {
        $types['PluginBadgesBadge'] = PluginBadgesBadge::getTypeName(2);
    }
    return $types;
}
Ejemplo n.º 5
0
		
This file is part of badges.

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

Badges 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 Badges. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
include '../../../inc/includes.php';
$plugin = new Plugin();
$badge = new PluginBadgesBadge();
if ($plugin->isActivated("environment")) {
    Html::header(PluginBadgesBadge::getTypeName(), '', "plugins", "environment", "badges");
} else {
    Html::header(PluginBadgesBadge::getTypeName(), '', "plugins", "badges");
}
if ($badge->canView() || Session::haveRight("config", "w")) {
    Search::show("PluginBadgesBadge");
} else {
    Html::displayRightError();
}
Html::footer();
Ejemplo n.º 6
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', 'badges'), $prof->fields["name"]) . "</th>";
     echo "</tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td>" . PluginBadgesBadge::getTypeName(2) . "</td><td>";
     if ($prof->fields['interface'] != 'helpdesk') {
         Profile::dropdownNoneReadWrite("badges", $this->fields["badges"], 1, 1, 1);
     } else {
         _e('No access');
         // No access;
     }
     echo "</td>";
     echo "<td>" . __('Associable items to a ticket') . " - " . PluginBadgesBadge::getTypeName(2) . "</td><td>";
     if ($prof->fields['create_ticket']) {
         Dropdown::showYesNo("open_ticket", $this->fields["open_ticket"]);
     } else {
         echo Dropdown::getYesNo(0);
     }
     echo "</td>";
     echo "</tr>";
     echo "<input type='hidden' name='id' value=" . $this->fields["id"] . ">";
     $options['candel'] = false;
     $this->showFormButtons($options);
 }