getType() == 'Profile') {
return __('Live Helper Chat');
}
}
return '';
}
function getRights($interface = 'central') {
$values = [
self::READMY => 'Visualizar',
self::CHANGENAME => 'Alterar Nome',
];
return $values;
}
/**
*
* @param Profile $profile
*/
function showForm($profile) {
$canedit = Session::haveRightsOr(Profile::$rightname, [CREATE, UPDATE, PURGE]);
echo "
";
if ($canedit) {
echo "
";
}
static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0) {
if ($item->getType() == 'Profile') {
$config = new self();
$config->showForm($item);
}
return true;
}
static function install() {
$profile_widget = 'plugin_livehelperchat_widget';
$profile_chat = 'plugin_livehelperchat_chat';
$profileRight = new ProfileRight();
$profiles = $profileRight->find("`name` = 'livehelperchat'", '', '');
//Se existir permissões antigas, renomea-las
if (!empty($profiles)) {
foreach ($profiles as $profile) {
$profile['name'] = $profile_widget;
$profileRight->update($profile);
}
}
/**
* Widget
*/
$profileWidget = $profileRight->find("`name` = '$profile_widget'", '', 1);
//Caso não existir, criar novos profiles
if (empty($profileWidget)) {
ProfileRight::addProfileRights([$profile_widget]);
ProfileRight::updateProfileRightAsOtherRight($profile_widget, PluginLivehelperchatProfile::READMY, '');
ProfileRight::updateProfileRightAsOtherRight($profile_widget, PluginLivehelperchatProfile::CHANGENAME, '');
}
/**
* Chat Ticket
*/
$profileChat = $profileRight->find("`name` = '$profile_chat'", '', 1);
//Caso não existir, criar novos profiles
if (empty($profileChat)) {
ProfileRight::addProfileRights([$profile_chat]);
ProfileRight::updateProfileRightAsOtherRight($profile_chat, READ, '');
}
}
static function uninstall() {
ProfileRight::deleteProfileRights(['plugin_livehelperchat_widget']);
}
}