本文整理汇总了PHP中Session::haveRightsOr方法的典型用法代码示例。如果您正苦于以下问题:PHP Session::haveRightsOr方法的具体用法?PHP Session::haveRightsOr怎么用?PHP Session::haveRightsOr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Session
的用法示例。
在下文中一共展示了Session::haveRightsOr方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showForm
/**
* Show profile form
*
* @param $items_id integer id of the profile
* @param $target value url of target
*
* @return nothing
**/
function showForm($profiles_id = 0, $openform = TRUE, $closeform = TRUE)
{
echo "<div class='firstbloc'>";
if (($canedit = Session::haveRightsOr(self::$rightname, array(CREATE, UPDATE, PURGE))) && $openform) {
$profile = new Profile();
echo "<form method='post' action='" . $profile->getFormURL() . "'>";
}
$profile = new Profile();
$profile->getFromDB($profiles_id);
if ($profile->getField('interface') == 'central') {
$rights = $this->getAllRights();
$profile->displayRightsChoiceMatrix($rights, array('canedit' => $canedit, 'default_class' => 'tab_bg_2', 'title' => __('General')));
}
echo "<table class='tab_cadre_fixehov'>";
echo "<tr class='tab_bg_1'><th colspan='4'>" . __('Helpdesk') . "</th></tr>\n";
$effective_rights = ProfileRight::getProfileRights($profiles_id, array('plugin_racks_open_ticket'));
echo "<tr class='tab_bg_2'>";
echo "<td width='20%'>" . __('Associable items to a ticket') . "</td>";
echo "<td colspan='5'>";
Html::showCheckbox(array('name' => '_plugin_racks_open_ticket', 'checked' => $effective_rights['plugin_racks_open_ticket']));
echo "</td></tr>\n";
echo "</table>";
if ($canedit && $closeform) {
echo "<div class='center'>";
echo Html::hidden('id', array('value' => $profiles_id));
echo Html::submit(_sx('button', 'Save'), array('name' => 'update'));
echo "</div>\n";
Html::closeForm();
}
echo "</div>";
}
示例2: showForm
/**
* Show profile form
*
* @param $items_id integer id of the profile
* @param $target value url of target
*
* @return nothing
**/
function showForm($profiles_id = 0, $openform = TRUE, $closeform = TRUE)
{
echo "<div class='firstbloc'>";
if (($canedit = Session::haveRightsOr(self::$rightname, array(CREATE, UPDATE, PURGE))) && $openform) {
$profile = new Profile();
echo "<form method='post' action='" . $profile->getFormURL() . "'>";
}
$profile = new Profile();
$profile->getFromDB($profiles_id);
$rights = array(array('itemtype' => 'PluginAddressingAddressing', 'label' => __('Generate reports', 'addressing'), 'field' => 'plugin_addressing'));
$profile->displayRightsChoiceMatrix($rights, array('canedit' => $canedit, 'default_class' => 'tab_bg_2', 'title' => __('General')));
echo "<table class='tab_cadre_fixehov'>";
$effective_rights = ProfileRight::getProfileRights($profiles_id, array('plugin_addressing_use_ping_in_equipment'));
echo "<tr class='tab_bg_2'>";
echo "<td width='20%'>" . __('Use ping on equipment form', 'addressing') . "</td>";
echo "<td colspan='5'>";
Html::showCheckbox(array('name' => '_plugin_addressing_use_ping_in_equipment[1_0]', 'checked' => $effective_rights['plugin_addressing_use_ping_in_equipment']));
echo "</td></tr>\n";
echo "</table>";
if ($canedit && $closeform) {
echo "<div class='center'>";
echo Html::hidden('id', array('value' => $profiles_id));
echo Html::submit(_sx('button', 'Save'), array('name' => 'update'));
echo "</div>\n";
Html::closeForm();
}
echo "</div>";
}
示例3: getAdditionalFields
function getAdditionalFields()
{
$tab = array(array('name' => $this->getForeignKeyField(), 'label' => __('As child of'), 'type' => 'parent', 'list' => false), array('name' => 'users_id', 'label' => __('Technician in charge of the hardware'), 'type' => 'UserDropdown', 'right' => 'own_ticket', 'list' => true), array('name' => 'groups_id', 'label' => __('Group in charge of the hardware'), 'type' => 'dropdownValue', 'condition' => '`is_assign`', 'list' => true), array('name' => 'knowbaseitemcategories_id', 'label' => __('Knowledge base'), 'type' => 'dropdownValue', 'list' => true), array('name' => 'is_helpdeskvisible', 'label' => __('Visible in the simplified interface'), 'type' => 'bool', 'list' => true), array('name' => 'is_incident', 'label' => __('Visible for an incident'), 'type' => 'bool', 'list' => true), array('name' => 'is_request', 'label' => __('Visible for a request'), 'type' => 'bool', 'list' => true), array('name' => 'is_problem', 'label' => __('Visible for a problem'), 'type' => 'bool', 'list' => true), array('name' => 'is_change', 'label' => __('Visible for a change'), 'type' => 'bool', 'list' => true), array('name' => 'tickettemplates_id_demand', 'label' => __('Template for a request'), 'type' => 'dropdownValue', 'list' => true), array('name' => 'tickettemplates_id_incident', 'label' => __('Template for an incident'), 'type' => 'dropdownValue', 'list' => true));
if (!Session::haveRightsOr('problem', array(CREATE, UPDATE, DELETE, Problem::READALL, Problem::READMY))) {
unset($tab[7]);
}
return $tab;
}
示例4: displayTabContentForItem
/**
* Fonction native GLPI
* @param CommonGLPI $item
* @param int $tabnum
* @param int $withtemplate
* @return boolean
*/
static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0)
{
if ($item->getType() == 'Computer' || $item->getType() == 'Monitor') {
if (Session::haveRightsOr('plugin_reforme_reforme', array(CREATE))) {
$reforme = new self();
$ID = $item->getField('id');
$Name = $item->getField('name');
// j'affiche le formulaire
$reforme->showForm($ID, $item->getType());
}
}
}
示例5: canViewItem
/**
* Is the current user have right to show the current task ?
*
* @return boolean
**/
function canViewItem()
{
if (!parent::canReadITILItem()) {
return false;
}
if (Session::haveRightsOr(self::$rightname, array(self::SEEPRIVATE, self::SEEPUBLIC))) {
return true;
}
if (!$this->fields['is_private'] && Session::haveRight(self::$rightname, self::SEEPUBLIC)) {
return true;
}
if ($this->fields["users_id"] === Session::getLoginUserID()) {
return true;
}
return false;
}
示例6: showForProfile
/**
* @param $prof Profile object
**/
static function showForProfile(Profile $prof)
{
global $DB;
$canedit = Session::haveRightsOr(self::$rightname, array(CREATE, UPDATE, PURGE));
if ($canedit) {
echo "<form method='post' action='" . $prof->getFormURL() . "'>";
}
$rights = self::getAllRights();
$prof->displayRightsChoiceMatrix($rights, array('canedit' => $canedit, 'default_class' => 'tab_bg_2', 'title' => __('Rights management by profil', 'reports')));
if ($canedit) {
echo "<div class='center'>";
echo Html::hidden('id', array('value' => $prof->getField('id')));
echo Html::submit(_sx('button', 'Save'), array('name' => 'update'));
echo "</div>\n";
Html::closeForm();
}
echo "</div>";
}
示例7: showForm
/**
* Show profile form
*
* @param $items_id integer id of the profile
* @param $target value url of target
*
* @return nothing
**/
function showForm($profiles_id = 0, $openform = TRUE, $closeform = TRUE)
{
$profile = new Profile();
echo "<div class='firstbloc'>";
if (($canedit = Session::haveRightsOr(self::$rightname, array(CREATE, UPDATE, PURGE))) && $openform) {
echo "<form method='post' action='" . $profile->getFormURL() . "'>";
}
$profile->getFromDB($profiles_id);
$rights = $this->getAllRights();
$profile->displayRightsChoiceMatrix($rights, array('canedit' => $canedit, 'default_class' => 'tab_bg_2', 'title' => __('Reforme', 'reforme')));
if ($canedit && $closeform) {
echo "<div class='center'>";
echo Html::hidden('id', array('value' => $profiles_id));
echo Html::submit(_sx('button', 'Save'), array('name' => 'update'));
echo "</div>\n";
echo Html::closeForm(false);
}
echo "</div>";
}
示例8: canViewItem
/**
* Is the current user have right to show the current task ?
*
* @return boolean
**/
function canViewItem()
{
if (!parent::canReadITILItem()) {
return false;
}
if (Session::haveRightsOr(self::$rightname, array(parent::SEEPRIVATE, parent::SEEPUBLIC))) {
return true;
}
if (!$this->fields['is_private'] && Session::haveRight(self::$rightname, parent::SEEPUBLIC)) {
return true;
}
// see task created or affected to me
if ($this->fields["users_id"] === Session::getLoginUserID() || $this->fields["users_id_tech"] === Session::getLoginUserID()) {
return true;
}
if ($this->fields["groups_id_tech"] && $this->fields["groups_id_tech"] > 0 && isset($_SESSION["glpigroups"]) && in_array($this->fields["groups_id_tech"], $_SESSION["glpigroups"])) {
return true;
}
return false;
}
示例9: plugin_init_timelineticket
function plugin_init_timelineticket()
{
global $PLUGIN_HOOKS;
$PLUGIN_HOOKS['csrf_compliant']['timelineticket'] = true;
$Plugin = new Plugin();
if ($Plugin->isActivated('timelineticket')) {
// check if plugin is active
$PLUGIN_HOOKS['change_profile']['timelineticket'] = array('PluginTimelineticketProfile', 'initProfile');
Plugin::registerClass('PluginTimelineticketProfile', array('addtabon' => 'Profile'));
if (Session::haveRightsOr('plugin_timelineticket_ticket', array(READ, UPDATE))) {
Plugin::registerClass('PluginTimelineticketDisplay', array('addtabon' => array('Ticket')));
}
$PLUGIN_HOOKS['item_purge']['timelineticket'] = array('Ticket' => 'plugin_timelineticket_ticket_purge', 'Group_Ticket' => array('PluginTimelineticketAssignGroup', 'deleteGroupTicket'), 'Ticket_User' => array('PluginTimelineticketAssignUser', 'deleteUserTicket'));
$PLUGIN_HOOKS['item_add']['timelineticket'] = array('Ticket' => 'plugin_timelineticket_ticket_add', 'Group_Ticket' => array('PluginTimelineticketAssignGroup', 'addGroupTicket'), 'Ticket_User' => array('PluginTimelineticketAssignUser', 'addUserTicket'));
$PLUGIN_HOOKS['item_update']['timelineticket'] = array('Ticket' => 'plugin_timelineticket_ticket_update');
if (Session::haveRight("config", UPDATE) || Session::haveRight('plugin_timelineticket_ticket', UPDATE)) {
// Config page
$PLUGIN_HOOKS['config_page']['timelineticket'] = 'front/config.form.php';
}
}
}
示例10: isAvailable
static function isAvailable()
{
global $CFG_GLPI;
// Cache in session
if (isset($_SESSION['glpiplanningreminder_isavailable'])) {
return $_SESSION['glpiplanningreminder_isavailable'];
}
$_SESSION['glpiplanningreminder_isavailable'] = 0;
if ($CFG_GLPI["use_mailing"]) {
$task = new Crontask();
if ($task->getFromDBbyName('PlanningRecall', 'planningrecall')) {
// Only disabled by config
if ($task->isDisabled() != 1) {
if (Session::haveRightsOr("planning", array(Planning::READMY, Planning::READGROUP), Planning::READALL)) {
$_SESSION['glpiplanningreminder_isavailable'] = 1;
}
}
}
}
return $_SESSION['glpiplanningreminder_isavailable'];
}
示例11: canView
static function canView()
{
return Session::haveRightsOr(self::$rightname, array(self::READALL, self::READMY));
}
示例12: showSummary
/**
* Show the current ticketfollowup summary
*
* @param $ticket Ticket object
**/
function showSummary($ticket)
{
global $DB, $CFG_GLPI;
if (!Session::haveRightsOr(self::$rightname, array(self::SEEPUBLIC, self::SEEPRIVATE))) {
return false;
}
$tID = $ticket->fields['id'];
// Display existing Followups
$showprivate = Session::haveRight(self::$rightname, self::SEEPRIVATE);
$caneditall = Session::haveRight(self::$rightname, self::UPDATEALL);
$tmp = array('tickets_id' => $tID);
$canadd = $this->can(-1, CREATE, $tmp);
$showuserlink = 0;
if (User::canView()) {
$showuserlink = 1;
}
$techs = $ticket->getAllUsers(CommonITILActor::ASSIGN);
$reopen_case = false;
if (in_array($ticket->fields["status"], $ticket->getClosedStatusArray()) && $ticket->isAllowedStatus($ticket->fields['status'], Ticket::INCOMING)) {
$reopen_case = true;
}
$tech = Session::haveRight(self::$rightname, self::ADDALLTICKET) || $ticket->isUser(CommonITILActor::ASSIGN, Session::getLoginUserID()) || isset($_SESSION["glpigroups"]) && $ticket->haveAGroup(CommonITILActor::ASSIGN, $_SESSION['glpigroups']);
$RESTRICT = "";
if (!$showprivate) {
$RESTRICT = " AND (`is_private` = '0'\n OR `users_id` ='" . Session::getLoginUserID() . "') ";
}
$query = "SELECT `glpi_ticketfollowups`.*, `glpi_users`.`picture`\n FROM `glpi_ticketfollowups`\n LEFT JOIN `glpi_users` ON (`glpi_ticketfollowups`.`users_id` = `glpi_users`.`id`)\n WHERE `tickets_id` = '{$tID}'\n {$RESTRICT}\n ORDER BY `date` DESC";
$result = $DB->query($query);
$rand = mt_rand();
if ($caneditall || $canadd) {
echo "<div id='viewfollowup" . $tID . "{$rand}'></div>\n";
}
if ($canadd) {
echo "<script type='text/javascript' >\n";
echo "function viewAddFollowup" . $ticket->fields['id'] . "{$rand}() {\n";
$params = array('type' => __CLASS__, 'parenttype' => 'Ticket', 'tickets_id' => $ticket->fields['id'], 'id' => -1);
Ajax::updateItemJsCode("viewfollowup" . $ticket->fields['id'] . "{$rand}", $CFG_GLPI["root_doc"] . "/ajax/viewsubitem.php", $params);
echo Html::jsHide('addbutton' . $ticket->fields['id'] . "{$rand}");
echo "};";
echo "</script>\n";
// Not closed ticket or closed
if (!in_array($ticket->fields["status"], array_merge($ticket->getSolvedStatusArray(), $ticket->getClosedStatusArray())) || $reopen_case) {
if (isset($_GET['_openfollowup']) && $_GET['_openfollowup']) {
echo Html::scriptBlock("viewAddFollowup" . $ticket->fields['id'] . "{$rand}()");
} else {
echo "<div id='addbutton" . $ticket->fields['id'] . "{$rand}' class='center firstbloc'>" . "<a class='vsubmit' href='javascript:viewAddFollowup" . $ticket->fields['id'] . "{$rand}();'>";
if ($reopen_case) {
_e('Reopen the ticket');
} else {
_e('Add a new followup');
}
echo "</a></div>\n";
}
}
}
if ($DB->numrows($result) == 0) {
echo "<table class='tab_cadre_fixe'><tr class='tab_bg_2'>";
echo "<th class='b'>" . __('No followup for this ticket.') . "</th></tr></table>";
} else {
$today = strtotime('today');
$lastmonday = strtotime('last monday');
$lastlastmonday = strtotime('last monday', strtotime('last monday'));
// Case of monday
if ($today - $lastmonday == 7 * DAY_TIMESTAMP) {
$lastlastmonday = $lastmonday;
$lastmonday = $today;
}
$steps = array(0 => array('end' => $today, 'name' => __('Today')), 1 => array('end' => $lastmonday, 'name' => __('This week')), 2 => array('end' => $lastlastmonday, 'name' => __('Last week')), 3 => array('end' => strtotime('midnight first day of'), 'name' => __('This month')), 4 => array('end' => strtotime('midnight first day of last month'), 'name' => __('Last month')), 5 => array('end' => 0, 'name' => __('Before the last month')));
$currentpos = -1;
while ($data = $DB->fetch_assoc($result)) {
$this->getFromDB($data['id']);
$candelete = $this->canPurge() && $this->canPurgeItem();
$canedit = $this->canUpdate() && $this->canUpdateItem();
$time = strtotime($data['date']);
if (!isset($steps[$currentpos]) || $steps[$currentpos]['end'] > $time) {
$currentpos++;
while ($steps[$currentpos]['end'] > $time && isset($steps[$currentpos + 1])) {
$currentpos++;
}
if (isset($steps[$currentpos])) {
echo "<h3>" . $steps[$currentpos]['name'] . "</h3>";
}
}
$id = 'followup' . $data['id'] . $rand;
$color = 'byuser';
if (isset($techs[$data['users_id']])) {
$color = 'bytech';
}
$classtoadd = '';
if ($canedit) {
$classtoadd = " pointer";
}
echo "<div class='boxnote {$color}' id='view{$id}'";
echo ">";
echo "<div class='boxnoteleft'>";
//.........这里部分代码省略.........
示例13: showSolutionForm
/**
* Form to add a solution to an ITIL object
*
* @param $knowbase_id_toload integer load a kb article as solution (0 = no load by default)
* (default 0)
**/
function showSolutionForm($knowbase_id_toload = 0)
{
global $CFG_GLPI;
$this->check($this->getField('id'), READ);
$canedit = $this->canSolve();
$options = array();
if ($knowbase_id_toload > 0) {
$kb = new KnowbaseItem();
if ($kb->getFromDB($knowbase_id_toload)) {
$this->fields['solution'] = $kb->getField('answer');
}
}
// Alert if validation waiting
$validationtype = $this->getType() . 'Validation';
if (method_exists($validationtype, 'alertValidation')) {
$validationtype::alertValidation($this, 'solution');
}
$this->showFormHeader($options);
$show_template = $canedit;
// && $this->getField('solutiontypes_id') == 0
// && empty($this->fields['solution']);
$rand_template = mt_rand();
$rand_text = $rand_type = 0;
if ($canedit) {
$rand_text = mt_rand();
$rand_type = mt_rand();
}
if ($show_template) {
echo "<tr class='tab_bg_2'>";
echo "<td>" . _n('Solution template', 'Solution templates', 1) . "</td><td>";
SolutionTemplate::dropdown(array('value' => 0, 'entity' => $this->getEntityID(), 'rand' => $rand_template, 'toupdate' => array('value_fieldname' => 'value', 'to_update' => 'solution' . $rand_text, 'url' => $CFG_GLPI["root_doc"] . "/ajax/solution.php", 'moreparams' => array('type_id' => 'dropdown_solutiontypes_id' . $rand_type))));
echo "</td><td colspan='2'>";
if (Session::haveRightsOr('knowbase', array(READ, KnowbaseItem::READFAQ))) {
echo "<a class='vsubmit' title=\"" . __s('Search a solution') . "\"\n href='" . $CFG_GLPI['root_doc'] . "/front/knowbaseitem.php?item_itemtype=" . $this->getType() . "&item_items_id=" . $this->getField('id') . "&forcetab=Knowbase\$1'>" . __('Search a solution') . "</a>";
}
echo "</td></tr>";
}
echo "<tr class='tab_bg_2'>";
echo "<td>" . __('Solution type') . "</td><td>";
$current = $this->fields['status'];
// Settings a solution will set status to solved
if ($canedit) {
SolutionType::dropdown(array('value' => $this->getField('solutiontypes_id'), 'rand' => $rand_type, 'entity' => $this->getEntityID()));
} else {
echo Dropdown::getDropdownName('glpi_solutiontypes', $this->getField('solutiontypes_id'));
}
echo "</td><td colspan='2'> </td></tr>";
if ($canedit && Session::haveRight('knowbase', UPDATE)) {
echo "<tr class='tab_bg_2'><td>" . __('Save and add to the knowledge base') . "</td><td>";
Dropdown::showYesNo('_sol_to_kb', false);
echo "</td><td colspan='2'> </td></tr>";
}
echo "<tr class='tab_bg_2'>";
echo "<td>" . __('Description') . "</td><td colspan='3'>";
if ($canedit) {
$rand = mt_rand();
Html::initEditorSystem("solution{$rand}");
echo "<div id='solution{$rand_text}'>";
echo "<textarea id='solution{$rand}' name='solution' rows='12' cols='80' class='form-control'>" . $this->getField('solution') . "</textarea></div>";
} else {
echo Toolbox::unclean_cross_side_scripting_deep($this->getField('solution'));
}
echo "</td></tr>";
$options['candel'] = false;
$options['canedit'] = $canedit;
$this->showFormButtons($options);
}
示例14: array
LICENSE
This file is part of GLPI.
GLPI 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.
GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
/** @file
* @brief
*/
include '../inc/includes.php';
Session::haveRightsOr('device', array(CREATE, UPDATE, PURGE));
Html::header(_n('Component', 'Components', 2), $_SERVER['PHP_SELF'], "config", "commondevice");
echo "<div class='center'>";
$optgroup = Dropdown::getDeviceItemTypes();
Dropdown::showItemTypeMenu(_n('Component', 'Components', 2), $optgroup);
Dropdown::showItemTypeList($optgroup);
echo "</div>";
Html::footer();
示例15: showForm
//.........这里部分代码省略.........
// No item : problem
if (!isset($options['item']) || count($options['item']) == 0) {
return false;
}
echo "<div class='center'><form method='post' name=form action='reservation.form.php'>";
if (!empty($ID)) {
echo "<input type='hidden' name='id' value='{$ID}'>";
}
echo "<table class='tab_cadre' width='700px'>";
echo "<tr><th colspan='2'>" . __('Reserve an item') . "</th></tr>\n";
// Add Hardware name
$r = new ReservationItem();
echo "<tr class='tab_bg_1'><td>" . __('Item') . "</td>";
echo "<td>";
foreach ($options['item'] as $itemID) {
$r->getFromDB($itemID);
$type = $r->fields["itemtype"];
$name = NOT_AVAILABLE;
$item = NULL;
if ($item = getItemForItemtype($r->fields["itemtype"])) {
$type = $item->getTypeName();
if ($item->getFromDB($r->fields["items_id"])) {
$name = $item->getName();
} else {
$item = NULL;
}
}
echo "<span class='b'>" . sprintf(__('%1$s - %2$s'), $type, $name) . "</span><br>";
echo "<input type='hidden' name='items[{$itemID}]' value='{$itemID}'>";
}
echo "</td></tr>\n";
if (!Session::haveRight("reservation", UPDATE) || is_null($item) || !Session::haveAccessToEntity($item->fields["entities_id"])) {
echo "<input type='hidden' name='users_id' value='" . Session::getLoginUserID() . "'>";
} else {
echo "<tr class='tab_bg_2'><td>" . __('By') . "</td>";
echo "<td>";
if (empty($ID)) {
User::dropdown(array('value' => Session::getLoginUserID(), 'entity' => $item->getEntityID(), 'right' => 'all'));
} else {
User::dropdown(array('value' => $resa->fields["users_id"], 'entity' => $item->getEntityID(), 'right' => 'all'));
}
echo "</td></tr>\n";
}
echo "<tr class='tab_bg_2'><td>" . __('Start date') . "</td><td>";
$rand_begin = Html::showDateTimeField("resa[begin]", array('value' => $resa->fields["begin"], 'timestep' => -1, 'maybeempty' => false));
echo "</td></tr>\n";
$default_delay = floor((strtotime($resa->fields["end"]) - strtotime($resa->fields["begin"])) / $CFG_GLPI['time_step'] / MINUTE_TIMESTAMP) * $CFG_GLPI['time_step'] * MINUTE_TIMESTAMP;
echo "<tr class='tab_bg_2'><td>" . __('Duration') . "</td><td>";
$rand = Dropdown::showTimeStamp("resa[_duration]", array('min' => 0, 'max' => 24 * HOUR_TIMESTAMP, 'value' => $default_delay, 'emptylabel' => __('Specify an end date')));
echo "<br><div id='date_end{$rand}'></div>";
$params = array('duration' => '__VALUE__', 'end' => $resa->fields["end"], 'name' => "resa[end]");
Ajax::updateItemOnSelectEvent("dropdown_resa[_duration]{$rand}", "date_end{$rand}", $CFG_GLPI["root_doc"] . "/ajax/planningend.php", $params);
if ($default_delay == 0) {
$params['duration'] = 0;
Ajax::updateItem("date_end{$rand}", $CFG_GLPI["root_doc"] . "/ajax/planningend.php", $params);
}
Alert::displayLastAlert('Reservation', $ID);
echo "</td></tr>\n";
if (empty($ID)) {
echo "<tr class='tab_bg_2'><td>" . __('Rehearsal') . "</td>";
echo "<td>";
$values = array('' => _x('periodicity', 'None'), 'day' => _x('periodicity', 'Daily'), 'week' => _x('periodicity', 'Weekly'), 'month' => _x('periodicity', 'Monthly'));
$rand = Dropdown::showFromArray('periodicity[type]', $values);
$field_id = Html::cleanId("dropdown_periodicity[type]{$rand}");
$params = array('type' => '__VALUE__', 'end' => $resa->fields["end"]);
Ajax::updateItemOnSelectEvent($field_id, "resaperiodcontent{$rand}", $CFG_GLPI["root_doc"] . "/ajax/resaperiod.php", $params);
echo "<br><div id='resaperiodcontent{$rand}'></div>";
echo "</td></tr>\n";
}
echo "<tr class='tab_bg_2'><td>" . __('Comments') . "</td>";
echo "<td><textarea name='comment' rows='8' cols='60'>" . $resa->fields["comment"] . "</textarea>";
echo "</td></tr>\n";
if (empty($ID)) {
echo "<tr class='tab_bg_2'>";
echo "<td colspan='2' class='top center'>";
echo "<input type='submit' name='add' value=\"" . _sx('button', 'Add') . "\" class='submit'>";
echo "</td></tr>\n";
} else {
if ($resa->fields["users_id"] == Session::getLoginUserID() || Session::haveRightsOr(static::$rightname, array(PURGE, UPDATE))) {
echo "<tr class='tab_bg_2'>";
if ($resa->fields["users_id"] == Session::getLoginUserID() || Session::haveRight(static::$rightname, PURGE)) {
echo "<td class='top center'>";
echo "<input type='submit' name='purge' value=\"" . _sx('button', 'Delete permanently') . "\"\n class='submit'>";
if ($resa->fields["group"] > 0) {
echo "<br><input type='checkbox' name='_delete_group'> " . __s('Delete all rehearsals');
}
echo "</td>";
}
if ($resa->fields["users_id"] == Session::getLoginUserID() || Session::haveRight(static::$rightname, UPDATE)) {
echo "<td class='top center'>";
echo "<input type='submit' name='update' value=\"" . _sx('button', 'Save') . "\"\n class='submit'>";
echo "</td>";
}
echo "</tr>\n";
}
}
echo "</table>";
Html::closeForm();
echo "</div>\n";
}