getSimpleForm() static public method

create a minimal form for simple action
static public getSimpleForm ( $action, $btname, $btlabel, array $fields = [], $btimage = '', $btoption = '', $confirm = '' )
$action String URL to call on submit
$btname String button name (maybe if name <> value)
$btlabel String button label
$fields array Array field name => field value
$btimage String button image uri (optional) (default '')
$btoption String optional button option (default '')
$confirm String optional confirm message (default '')
Example #1
0
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 Search engine from cron tasks
*/
include '../inc/includes.php';
Session::checkRight("config", "w");
Html::header(Crontask::getTypeName(2), $_SERVER['PHP_SELF'], 'config', 'crontask');
$crontask = new CronTask();
if ($crontask->getNeedToRun(CronTask::MODE_INTERNAL)) {
    $name = sprintf(__('%1$s %2$s'), $crontask->fields['name'], Html::getSimpleForm($crontask->getFormURL(), array('execute' => $crontask->fields['name']), __('Execute')));
    Html::displayTitle($CFG_GLPI['root_doc'] . '/pics/warning.png', __('Next run'), sprintf(__('Next task to run: %s'), $name));
} else {
    Html::displayTitle($CFG_GLPI['root_doc'] . '/pics/ok.png', __('No action pending'), __('No action pending'));
}
Search::show('CronTask');
Html::footer();
Example #2
0
 /**
  * Display linked tickets to a ticket
  *
  * @param $ID ID of the ticket id
  *
  * @return nothing display
  **/
 static function displayLinkedTicketsTo($ID)
 {
     global $DB, $CFG_GLPI;
     $tickets = self::getLinkedTicketsTo($ID);
     $canupdate = Session::haveRight('ticket', UPDATE);
     $ticket = new Ticket();
     if (is_array($tickets) && count($tickets)) {
         foreach ($tickets as $linkID => $data) {
             if ($ticket->getFromDB($data['tickets_id'])) {
                 $icons = "<img src='" . Ticket::getStatusIconURL($ticket->fields["status"]) . "' alt=\"" . Ticket::getStatus($ticket->fields["status"]) . "\"\n                             title=\"" . Ticket::getStatus($ticket->fields["status"]) . "\">";
                 if ($canupdate) {
                     $icons .= '&nbsp;' . Html::getSimpleForm(static::getFormURL(), 'purge', _x('button', 'Delete permanently'), array('id' => $linkID, 'tickets_id' => $ID), $CFG_GLPI["root_doc"] . "/pics/delete.png");
                 }
                 $text = sprintf(__('%1$s %2$s'), self::getLinkName($data['link']), $ticket->getLink(array('forceid' => true)));
                 printf(__('%1$s %2$s'), $text, $icons);
             }
             echo '<br>';
         }
     }
 }