massiveaction.php 2.67 KB
Newer Older
moyooo's avatar
moyooo committed
1
<?php
2 3 4
/**
 * ---------------------------------------------------------------------
 * GLPI - Gestionnaire Libre de Parc Informatique
5
 * Copyright (C) 2015-2018 Teclib' and contributors.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
 *
 * http://glpi-project.org
 *
 * based on GLPI - Gestionnaire Libre de Parc Informatique
 * Copyright (C) 2003-2014 by the INDEPNET Development Team.
 *
 * ---------------------------------------------------------------------
 *
 * 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/>.
 * ---------------------------------------------------------------------
moyooo's avatar
moyooo committed
31 32
 */

Anael Mobilia's avatar
Anael Mobilia committed
33 34 35
/**
 * @since 0.84
 */
moyooo's avatar
moyooo committed
36

37
include ('../inc/includes.php');
moyooo's avatar
moyooo committed
38 39 40 41

header("Content-Type: text/html; charset=UTF-8");
Html::header_nocache();

moyooo's avatar
moyooo committed
42
Session::checkLoginUser();
43

moyooo's avatar
moyooo committed
44 45 46
try {
   $ma = new MassiveAction($_POST, $_GET, 'initial');
} catch (Exception $e) {
47

moyooo's avatar
moyooo committed
48
   echo "<div class='center'><img src='".$CFG_GLPI["root_doc"]."/pics/warning.png' alt='".
yllen's avatar
CS  
yllen committed
49
                              __s('Warning')."'><br><br>";
moyooo's avatar
moyooo committed
50 51 52
   echo "<span class='b'>".$e->getMessage()."</span><br>";
   echo "</div>";
   exit();
moyooo's avatar
moyooo committed
53

moyooo's avatar
moyooo committed
54 55
}

56
echo "<div class='center massiveactions'>";
moyooo's avatar
moyooo committed
57
Html::openMassiveActionsForm();
58
$params = ['action' => '__VALUE__'];
yllen's avatar
CS  
yllen committed
59
$input  = $ma->getInput();
moyooo's avatar
moyooo committed
60 61 62 63 64
foreach ($input as $key => $val) {
   $params[$key] = $val;
}

$actions = $params['actions'];
yllen's avatar
CS  
yllen committed
65

moyooo's avatar
moyooo committed
66 67 68
if (count($actions)) {
   if (isset($params['hidden']) && is_array($params['hidden'])) {
      foreach ($params['hidden'] as $key => $val) {
69
         echo Html::hidden($key, ['value' => $val]);
moyooo's avatar
moyooo committed
70
      }
71
   }
72
   echo __('Action');
moyooo's avatar
moyooo committed
73
   echo "&nbsp;";
yllen's avatar
CS  
yllen committed
74

75
   $actions = ['-1' => Dropdown::EMPTY_VALUE] + $actions;
moyooo's avatar
moyooo committed
76
   $rand    = Dropdown::showFromArray('massiveaction', $actions);
moyooo's avatar
moyooo committed
77

moyooo's avatar
moyooo committed
78
   echo "<br><br>";
moyooo's avatar
moyooo committed
79

moyooo's avatar
moyooo committed
80 81 82 83 84
   Ajax::updateItemOnSelectEvent("dropdown_massiveaction$rand", "show_massiveaction$rand",
                                 $CFG_GLPI["root_doc"]."/ajax/dropdownMassiveAction.php",
                                 $params);

   echo "<span id='show_massiveaction$rand'>&nbsp;</span>\n";
moyooo's avatar
moyooo committed
85
}
moyooo's avatar
moyooo committed
86 87 88 89 90

// Force 'checkbox-zero-on-empty', because some massive actions can use checkboxes
$CFG_GLPI['checkbox-zero-on-empty'] = true;
Html::closeForm();
echo "</div>";