Display a 2 columns Footer for Form buttons
Close the form is user can edit
public showFormButtons ( $options = [] ) | ||
$options | array of possible options: - withtemplate : 1 for newtemplate, 2 for newobject from template - colspan for each column (default 2) - candel : set to false to hide "delete" button - canedit : set to false to hide all buttons - addbuttons : array of buttons to add |
/** * @since version 0.90 * * @see CommonDBTM::showFormButtons() **/ function showFormButtons($options = array()) { global $CFG_GLPI; if (isset($_SESSION["glpiactiveprofile"]) && $_SESSION["glpiactiveprofile"]["interface"] != "central") { return parent::showFormButtons($options); } // for single object like config $ID = 1; if (isset($this->fields['id'])) { $ID = $this->fields['id']; } $params['colspan'] = 2; $params['candel'] = true; $params['canedit'] = true; if (is_array($options) && count($options)) { foreach ($options as $key => $val) { $params[$key] = $val; } } if (!$this->isNewID($ID)) { echo "<input type='hidden' name='id' value='{$ID}'>"; } echo "<tr class='tab_bg_2'>"; echo "<td class='center' colspan='" . $params['colspan'] * 2 . "'>"; if ($this->isNewID($ID)) { echo Ticket::getSplittedSubmitButtonHtml($this->fields['tickets_id'], 'add'); // echo "<input type='hidden' name='id' value='$ID'>"; } else { if ($params['candel'] && !$this->can($ID, DELETE) && !$this->can($ID, PURGE)) { $params['candel'] = false; } if ($params['canedit'] && $this->can($ID, UPDATE)) { echo Ticket::getSplittedSubmitButtonHtml($this->fields['tickets_id'], 'update'); echo "</td></tr><tr class='tab_bg_2'>\n"; } if ($params['candel']) { echo "<td class='right' colspan='" . $params['colspan'] * 2 . "' >\n"; if ($this->can($ID, PURGE)) { echo Html::submit(_x('button', 'Delete permanently'), array('name' => 'purge', 'confirm' => __('Confirm the final deletion?'))); } } if ($this->isField('date_mod')) { echo "<input type='hidden' name='_read_date_mod' value='" . $this->getField('date_mod') . "'>"; } } echo "</td></tr></table></div>"; Html::closeForm(); }