Html::closeArrowMassives PHP Méthode

closeArrowMassives() static public méthode

show arrow for massives actions : closing
static public closeArrowMassives ( $actions, $confirm = [] )
$actions array of action : $name -> $label
$confirm array of confirmation string (optional) \deprecated since 0.84
    static function closeArrowMassives($actions, $confirm = array())
    {
        if (count($actions)) {
            foreach ($actions as $name => $label) {
                if (!empty($name)) {
                    echo "<input type='submit' name='{$name}' ";
                    if (is_array($confirm) && isset($confirm[$name])) {
                        echo self::addConfirmationOnAction($confirm[$name]);
                    }
                    echo "value=\"" . addslashes($label) . "\" class='submit'>&nbsp;";
                }
            }
        }
        echo "</td></tr>";
        echo "</table>";
    }

Usage Example

 function showForm()
 {
     global $DB;
     $query = "SELECT * FROM\n               `" . $this->getTable() . "`\n               ORDER BY `states_id` ASC";
     if ($result = $DB->query($query)) {
         $number = $DB->numrows($result);
         if ($number != 0) {
             echo "<form method='post' name='massiveaction_form' id='massiveaction_form' action='" . $this->getFormURL() . "'>";
             echo "<div align='center'>";
             echo "<table class='tab_cadre_fixe' cellpadding='5'>";
             echo "<tr>";
             echo "<th>" . __('Status') . "</th><th></th>";
             echo "</tr>";
             while ($ligne = $DB->fetch_array($result)) {
                 $ID = $ligne["id"];
                 echo "<tr class='tab_bg_1'>";
                 echo "<td width='10'>";
                 echo "<input type='checkbox' name='item[{$ID}]'";
                 if (isset($_POST['check']) && $_POST['check'] == 'all') {
                     echo " checked ";
                 }
                 echo ">";
                 echo "</td>";
                 echo "<td>" . Dropdown::getDropdownName("glpi_states", $ligne["states_id"]) . "</td>";
                 echo "</tr>";
             }
             echo "</table></div>";
             Html::openArrowMassives("massiveaction_form", true);
             Html::closeArrowMassives(array('delete_state' => _sx('button', 'Delete permanently')));
             Html::closeForm();
             echo "<div align='center'><form method='post' action='" . $this->getFormURL() . "'>";
             echo "<table class='tab_cadre_fixe' cellpadding='5'><tr ><th colspan='2'>";
             echo __('Disposal status', 'financialreports') . " : </th></tr>";
             echo "<tr class='tab_bg_1'><td>";
             Dropdown::show('State', array('name' => "states_id", 'value' => $ligne["states_id"]));
             echo "</td>";
             echo "<td>";
             echo "<div align='center'>";
             echo "<input type='submit' name='add_state' value='" . _sx('button', 'Post') . "' class='submit' >";
             echo "</div></td></tr>";
             echo "</table>";
             Html::closeForm();
             echo "</div>";
         } else {
             echo "<div align='center'><form method='post' action='" . $this->getFormURL() . "'>";
             echo "<table class='tab_cadre' cellpadding='5'><tr ><th colspan='2'>";
             echo __('Disposal status', 'financialreports') . " : </th></tr>";
             echo "<tr class='tab_bg_1'><td>";
             Dropdown::show('State', array('name' => "states_id"));
             echo "</td>";
             echo "<td>";
             echo "<div align='center'>";
             echo "<input type='submit' name='add_state' value='" . _sx('button', 'Post') . "' class='submit' >";
             echo "</div></td></tr>";
             echo "</table>";
             Html::closeForm();
             echo "</div>";
         }
     }
 }
All Usage Examples Of Html::closeArrowMassives
Html