Ejemplo n.º 1
0
 /**
  * @see CommonDBTM::showSpecificMassiveActionsParameters()
  **/
 function showSpecificMassiveActionsParameters($input = array())
 {
     switch ($input['action']) {
         case "move_rule":
             echo "<select name='move_type'>";
             echo "<option value='after' selected>" . __('After') . "</option>";
             echo "<option value='before'>" . __('Before') . "</option>";
             echo "</select>&nbsp;";
             if (isset($input['entity_restrict'])) {
                 $condition = $input['entity_restrict'];
             } else {
                 $condition = "";
             }
             Rule::dropdown(array('sub_type' => $input['itemtype'], 'name' => "ranking", 'entity_restrict' => $condition));
             echo "<br><br><input type='submit' name='massiveaction' class='submit' value='" . _sx('button', 'Move') . "'>\n";
             return true;
         default:
             return parent::showSpecificMassiveActionsParameters($input);
     }
     return false;
 }
Ejemplo n.º 2
0
 /**
  * @since version 0.85
  *
  * @see CommonDBTM::showMassiveActionsSubForm()
  **/
 static function showMassiveActionsSubForm(MassiveAction $ma)
 {
     switch ($ma->getAction()) {
         case 'duplicate':
             $entity_assign = False;
             foreach ($ma->getitems() as $itemtype => $ids) {
                 if ($item = getItemForItemtype($itemtype)) {
                     if ($item->isEntityAssign()) {
                         $entity_assign = true;
                         break;
                     }
                 }
             }
             if ($entity_assign) {
                 Entity::dropdown();
             }
             echo "<br><br>" . Html::submit(_x('button', 'Duplicate'), array('name' => 'massiveaction'));
             return true;
         case 'move_rule':
             $input = $ma->getInput();
             $values = array('after' => __('After'), 'before' => __('Before'));
             Dropdown::showFromArray('move_type', $values, array('width' => '20%'));
             if (isset($input['entity'])) {
                 $entity = $input['entity'];
             } else {
                 $entity = "";
             }
             if (isset($input['condition'])) {
                 $condition = $input['condition'];
             } else {
                 $condition = 0;
             }
             echo Html::hidden('rule_class_name', array('value' => $input['rule_class_name']));
             Rule::dropdown(array('sub_type' => $input['rule_class_name'], 'name' => "ranking", 'condition' => $condition, 'entity' => $entity, 'width' => '50%'));
             echo "<br><br><input type='submit' name='massiveaction' class='submit' value='" . _sx('button', 'Move') . "'>\n";
             return true;
     }
     return parent::showMassiveActionsSubForm($ma);
 }
     break;
 case 'merge':
     echo "&nbsp;" . $_SESSION['glpiactive_entity_shortname'];
     echo "&nbsp;<input type='submit' name='massiveaction' class='submit' value='" . $LANG['buttons'][2] . "'>\n";
     break;
 case "move_rule":
     echo "<select name='move_type'>";
     echo "<option value='after' selected>" . $LANG['buttons'][47] . "</option>";
     echo "<option value='before'>" . $LANG['buttons'][46] . "</option>";
     echo "</select>&nbsp;";
     if (isset($_POST['entity_restrict'])) {
         $condition = $_POST['entity_restrict'];
     } else {
         $condition = "";
     }
     Rule::dropdown(array('sub_type' => $_POST['sub_type'], 'name' => "ranking", 'entity_restrict' => $condition));
     echo "<input type='submit' name='massiveaction' class='submit' value='" . $LANG['buttons'][2] . "'>\n";
     break;
 case "add_followup":
     TicketFollowup::showFormMassiveAction();
     break;
 case "add_task":
     TicketTask::showFormMassiveAction();
     break;
 case "add_actor":
     $types = array(0 => DROPDOWN_EMPTY_VALUE, Ticket::REQUESTER => $LANG['job'][4], Ticket::OBSERVER => $LANG['common'][104], Ticket::ASSIGN => $LANG['job'][5]);
     $rand = Dropdown::showFromArray('actortype', $types);
     $paramsmassaction = array('actortype' => '__VALUE__');
     ajaxUpdateItemOnSelectEvent("dropdown_actortype{$rand}", "show_massiveaction_field", $CFG_GLPI["root_doc"] . "/ajax/dropdownMassiveActionAddActor.php", $paramsmassaction);
     echo "<span id='show_massiveaction_field'>&nbsp;</span>\n";
     break;