Class-specific method used to show the fields to specify the massive action
static public showMassiveActionsSubForm ( MassiveAction $ma ) : false | ||
$ma | MassiveAction | the current massive action object |
return | false | if parameters displayed ? |
/** * @since version 0.85 * * @see CommonDBTM::showMassiveActionsSubForm() **/ static function showMassiveActionsSubForm(MassiveAction $ma) { switch ($ma->getAction()) { case 'import_email': Entity::dropdown(); echo "<br><br>"; echo Html::submit(_x('button', 'Import'), array('name' => 'massiveaction')); return true; } return parent::showMassiveActionsSubForm($ma); }
/** * @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); }
/** * @since version 0.85 * * @see CommonDBTM::showMassiveActionsSubForm() **/ static function showMassiveActionsSubForm(MassiveAction $ma) { global $CFG_GLPI; switch ($ma->getAction()) { case 'move_bookmark': $values = array('after' => __('After'), 'before' => __('Before')); Dropdown::showFromArray('move_type', $values, array('width' => '20%')); $param = array('name' => "bookmarks_id_ref", 'width' => '50%'); $param['condition'] = "(`is_private`='1' AND `users_id`='" . Session::getLoginUserID() . "') "; $param['entity'] = -1; Bookmark::dropdown($param); echo "<br><br>\n"; echo Html::submit(_x('button', 'Move'), array('name' => 'massiveaction')) . "</span>"; return true; } return parent::showMassiveActionsSubForm($ma); }
/** * @since version 0.85 * * @see CommonDBTM::showMassiveActionsSubForm() **/ static function showMassiveActionsSubForm(MassiveAction $ma) { switch ($ma->getAction()) { case 'plugin_certificates_add_item': self::dropdownCertificate(array()); echo " " . Html::submit(_x('button', 'Post'), array('name' => 'massiveaction')); return true; case "install": Dropdown::showAllItems("item_item", 0, 0, -1, self::getTypes(true), false, false, 'typeitem'); echo Html::submit(_x('button', 'Post'), array('name' => 'massiveaction')); return true; break; case "uninstall": Dropdown::showAllItems("item_item", 0, 0, -1, self::getTypes(true), false, false, 'typeitem'); echo Html::submit(_x('button', 'Post'), array('name' => 'massiveaction')); return true; break; case "transfer": Dropdown::show('Entity'); echo Html::submit(_x('button', 'Post'), array('name' => 'massiveaction')); return true; break; } return parent::showMassiveActionsSubForm($ma); }
/** * @since version 0.85 * * @see CommonDBTM::showMassiveActionsSubForm() **/ static function showMassiveActionsSubForm(MassiveAction $ma) { global $CFG_GLPI; switch ($ma->getAction()) { case 'add_task': $itemtype = $ma->getItemtype(true); $tasktype = $itemtype . 'Task'; if ($ttype = getItemForItemtype($tasktype)) { $ttype->showFormMassiveAction(); return true; } return false; case 'add_actor': $types = array(0 => Dropdown::EMPTY_VALUE, CommonITILActor::REQUESTER => __('Requester'), CommonITILActor::OBSERVER => __('Watcher'), CommonITILActor::ASSIGN => __('Assigned to')); $rand = Dropdown::showFromArray('actortype', $types); $paramsmassaction = array('actortype' => '__VALUE__'); Ajax::updateItemOnSelectEvent("dropdown_actortype{$rand}", "show_massiveaction_field", $CFG_GLPI["root_doc"] . "/ajax/dropdownMassiveActionAddActor.php", $paramsmassaction); echo "<span id='show_massiveaction_field'> </span>\n"; return true; case 'update_notif': Dropdown::showYesNo('use_notification'); echo "<br><br>"; echo Html::submit(_x('button', 'Post'), array('name' => 'massiveaction')); return true; return true; } return parent::showMassiveActionsSubForm($ma); }
/** * @since version 0.85 * * @see CommonDBTM::showMassiveActionsSubForm() **/ static function showMassiveActionsSubForm(MassiveAction $ma) { switch ($ma->getAction()) { case 'plugin_ocsinventoryng_force_ocsng_update': echo " " . Html::submit(_x('button', 'Post'), array('name' => 'massiveaction')); return true; case 'plugin_ocsinventoryng_lock_ocsng_field': $fields['all'] = __('All'); $fields += self::getLockableFields(); Dropdown::showFromArray("field", $fields); echo " " . Html::submit(_x('button', 'Post'), array('name' => 'massiveaction')); return true; case 'plugin_ocsinventoryng_unlock_ocsng_field': $fields['all'] = __('All'); $fields += self::getLockableFields(); Dropdown::showFromArray("field", $fields); echo " " . Html::submit(_x('button', 'Post'), array('name' => 'massiveaction')); return true; } return parent::showMassiveActionsSubForm($ma); }
/** * @since version 0.85 * * @see CommonDBTM::showMassiveActionsSubForm() **/ static function showMassiveActionsSubForm(MassiveAction $ma) { $action = $ma->getAction(); $items = $ma->getItems(); $itemtypes_affect = array(); $itemtypes_unaffect = array(); foreach (array_keys($items) as $itemtype) { if (!Toolbox::is_a($itemtype, __CLASS__)) { continue; } $specificities = $itemtype::getConnexityMassiveActionsSpecificities(); if (in_array($action, $specificities['normalized']['affect'])) { $itemtypes_affect[$itemtype] = $specificities; continue; } if (in_array($action, $specificities['normalized']['unaffect'])) { $itemtypes_unaffect[$itemtype] = $specificities; continue; } } if (count($itemtypes_affect) > count($itemtypes_unaffect)) { $normalized_action = 'affect'; $itemtypes = $itemtypes_affect; } else { if (count($itemtypes_affect) < count($itemtypes_unaffect)) { $normalized_action = 'unaffect'; $itemtypes = $itemtypes_unaffect; } else { return parent::showMassiveActionsSubForm($ma); } } switch ($normalized_action) { case 'unaffect': foreach ($itemtypes as $itemtype => $specificities) { if (Toolbox::is_a($itemtype, 'CommonDBRelation')) { $peer_field = "peer[{$itemtype}]"; if (!$itemtype::$mustBeAttached_1 && !$itemtype::$mustBeAttached_2) { // Should never occur ... But we must care ! $values = array(); if (empty($itemtype::$itemtype_1) || preg_match('/^itemtype/', $itemtype::$itemtype_1)) { $values[0] = __('First Item'); } else { $itemtype_1 = $itemtype::$itemtype_1; $values[0] = $itemtype_1::getTypeName(Session::getPluralNumber()); } if (empty($itemtype::$itemtype_2) || preg_match('/^itemtype/', $itemtype::$itemtype_2)) { $values[1] = __('Second Item'); } else { $itemtype_2 = $itemtype::$itemtype_2; $values[1] = $itemtype_2::getTypeName(Session::getPluralNumber()); } echo sprintf(__('Select a peer for %s:'), $itemtype::getTypeName()); Dropdown::showFromArray($peer_field, $values); echo "<br>\n"; } else { if (!$itemtype::$mustBeAttached_1) { echo "<input type='hidden' name='{$peer_field}' value='0'>"; } else { if (!$itemtype::$mustBeAttached_2) { echo "<input type='hidden' name='{$peer_field}' value='1'>"; } } } } } echo "<br><br>" . Html::submit(_x('button', 'Dissociate'), array('name' => 'massiveaction')); return true; case 'affect': $peertypes = array(); foreach ($itemtypes as $itemtype => $specificities) { if (!$specificities['reaffect']) { continue; } if (Toolbox::is_a($itemtype, 'CommonDBRelation')) { if ($specificities['reaffect'] == 1) { $peertype = $itemtype::$itemtype_1; } else { $peertype = $itemtype::$itemtype_2; } } else { $peertype = $itemtype::$itemtype; } if (preg_match('/^itemtype/', $peertype)) { $peertypes = array_merge($peertypes, $specificities['itemtypes']); } else { $peertypes[] = $peertype; } } $peertypes = array_unique($peertypes); if (count($peertypes) == 0) { echo __('Unable to reaffect given elements !'); exit; } $options = array(); if (count($peertypes) == 1) { $options['name'] = 'peers_id'; $type_for_dropdown = $peertypes[0]; if (preg_match('/^itemtype/', $peertype)) { echo Html::hidden('peertype', array('value' => $type_for_dropdown)); } $type_for_dropdown::dropdown($options); } else { $options['itemtype_name'] = 'peertype'; $options['items_id_name'] = 'peers_id'; $options['itemtypes'] = $peertypes; Dropdown::showSelectItemFromItemtypes($options); } echo "<br><br>" . Html::submit(_x('button', 'Associate'), array('name' => 'massiveaction')); return true; } return parent::showMassiveActionsSubForm($ma); }
/** * @since version 0.85 * * @see CommonDBTM::showMassiveActionsSubForm() **/ static function showMassiveActionsSubForm(MassiveAction $ma) { global $CFG_GLPI; switch ($ma->getAction()) { case 'change_authtype': $rand = Auth::dropdown(array('name' => 'authtype')); $paramsmassaction = array('authtype' => '__VALUE__'); Ajax::updateItemOnSelectEvent("dropdown_authtype{$rand}", "show_massiveaction_field", $CFG_GLPI["root_doc"] . "/ajax/dropdownMassiveActionAuthMethods.php", $paramsmassaction); echo "<span id='show_massiveaction_field'><br><br>"; echo Html::submit(_x('button', 'Post'), array('name' => 'massiveaction')) . "</span>"; return true; } return parent::showMassiveActionsSubForm($ma); }
/** * Massive actions display * * @param $input array of input datas * * @return array of results (nbok, nbko, nbnoright counts) * */ static function showMassiveActionsSubForm(MassiveAction $ma) { $itemtype = $ma->getItemtype(false); switch ($itemtype) { case self::getType(): switch ($ma->getAction()) { case "validate": case "refuse": echo "<textarea cols='80' rows='7' name='comment'></textarea><br><br>"; break; } return parent::showMassiveActionsSubForm($ma); } }
/** * @since version 0.85 * * @see CommonDBTM::showMassiveActionsSubForm() **/ static function showMassiveActionsSubForm(MassiveAction $ma) { switch ($ma->getAction()) { case 'plugin_financialreports_add_date_disposal': Html::showDateFormItem("date_disposal", "", true, true); echo " " . Html::submit(_x('button', 'Post'), array('name' => 'massiveaction')); return true; } return parent::showMassiveActionsSubForm($ma); }
/** * @since version 0.85 * * @see CommonDBTM::showMassiveActionsSubForm() **/ static function showMassiveActionsSubForm(MassiveAction $ma) { switch ($ma->getAction()) { case 'DoIt': echo " <input type='hidden' name='toto' value='1'>" . Html::submit(_x('button', 'Post'), array('name' => 'massiveaction')) . " " . __('Write in item history', 'example'); return true; case 'do_nothing': echo " " . Html::submit(_x('button', 'Post'), array('name' => 'massiveaction')) . " " . __('but do nothing :)', 'example'); return true; } return parent::showMassiveActionsSubForm($ma); }
/** * @since version 0.85 * * @see CommonDBTM::showMassiveActionsSubForm() **/ static function showMassiveActionsSubForm(MassiveAction $ma) { switch ($ma->getAction()) { case 'transfert': Dropdown::show('Entity'); echo "<br><br>" . Html::submit(__('Post'), array('name' => 'massiveaction')); return true; } $pfAgentmodule = new PluginFusioninventoryAgentmodule(); $a_modules = $pfAgentmodule->find(); foreach ($a_modules as $data) { if ($ma->getAction() == $data['modulename']) { Dropdown::showYesNo($ma->getAction()); echo "<br><br>" . Html::submit(__('Post'), array('name' => 'massiveaction')); return true; } } return parent::showMassiveActionsSubForm($ma); }
/** * @since version 0.85 * * @see CommonDBTM::showMassiveActionsSubForm() **/ static function showMassiveActionsSubForm(MassiveAction $ma) { global $CFG_GLPI; switch ($ma->getAction()) { case 'add_to_static_group': Dropdown::show('PluginFusioninventoryDeployGroup', array('condition' => "`type`='" . PluginFusioninventoryDeployGroup::STATIC_GROUP . "'")); echo Html::submit(_x('button', 'Post'), array('name' => 'massiveaction')); return true; } return parent::showMassiveActionsSubForm($ma); }
/** * @since version 0.85 * * @see CommonDBTM::showMassiveActionsSubForm() **/ static function showMassiveActionsSubForm(MassiveAction $ma) { switch ($ma->getAction()) { case 'transfert': Dropdown::show('Entity'); echo "<br><br>" . Html::submit(__('Post'), array('name' => 'massiveaction')); return true; } return parent::showMassiveActionsSubForm($ma); }
/** * @since version 0.85 * * @see CommonDBTM::showMassiveActionsSubForm() **/ static function showMassiveActionsSubForm(MassiveAction $ma) { switch ($ma->getAction()) { case 'merge': echo " " . $_SESSION['glpiactive_entity_shortname']; echo "<br><br>" . Html::submit(_x('button', 'Merge'), array('name' => 'massiveaction')); return true; } return parent::showMassiveActionsSubForm($ma); }
static function showMassiveActionsSubForm(MassiveAction $ma) { switch ($ma->getAction()) { case "add_model": echo "<input type=\"text\" name=\"model_name\"> "; echo Html::submit(_sx('button', 'Post'), array('name' => 'massiveaction')); return true; break; } return parent::showMassiveActionsSubForm($ma); }
/** * @since version 0.85 * * @see CommonDBTM::showMassiveActionsSubForm() **/ static function showMassiveActionsSubForm(MassiveAction $ma) { switch ($ma->getAction()) { case "assign_auth": PluginFusioninventoryConfigSecurity::auth_dropdown(); echo "<br><br>"; break; } return parent::showMassiveActionsSubForm($ma); }
/** * @since version 0.85 * * @see CommonDBTM::showMassiveActionsSubForm() * */ static function showMassiveActionsSubForm(MassiveAction $ma) { switch ($ma->getAction()) { case "transfer": Dropdown::show('Entity'); echo Html::submit(_x('button', 'Post'), array('name' => 'massiveaction')); return true; break; } return parent::showMassiveActionsSubForm($ma); }
/** * @since version 0.85 * * @see CommonDBTM::showMassiveActionsSubForm() **/ static function showMassiveActionsSubForm(MassiveAction $ma) { global $CFG_GLPI; switch ($ma->getAction()) { case 'Generate': $formcreator = new self(); $formcreator->showFormMassiveAction($ma); return true; break; case 'Pedido': /* Dropdown::show('PluginFormcreatorForm', array( 'name' => "plugin_formcreator_forms_id", 'entity' => $_SESSION['glpiactive_entity'] )); */ $table = getTableForItemtype('PluginFormcreatorForm'); $sections = array(); $sql = "SELECT `id`, `name`\n\t\t\t\t\t\t\tFROM {$table}\n\t\t\t\t\t\t\tWHERE entities_id = " . $_SESSION['glpiactive_entity'] . "\n\t\t\t\t\t\t\tORDER BY `name`"; $result = $GLOBALS['DB']->query($sql); while ($section = $GLOBALS['DB']->fetch_array($result)) { $sections[$section['id']] = $section['name']; } $sections = array("0" => "----") + $sections; Dropdown::showFromArray('plugin_formcreator_forms_id', $sections, array()); echo Html::submit(_x('button', 'Post'), array('name' => 'massiveaction')); return true; break; } return parent::showMassiveActionsSubForm($ma); }
/** * @since version 0.85 * * @see CommonDBTM::showMassiveActionsSubForm() **/ static function showMassiveActionsSubForm(MassiveAction $ma) { switch ($ma->getAction()) { case 'add_followup': static::showFormMassiveAction(); return true; } return parent::showMassiveActionsSubForm($ma); }
static function showMassiveActionsSubForm(MassiveAction $ma) { switch ($ma->getAction()) { case "install": Dropdown::showItemTypes("item_item", self::getTypes(true)); echo Html::submit(_x('button', 'Post'), array('name' => 'massiveaction')); return true; break; case "uninstall": Dropdown::showItemTypes("item_item", self::getTypes(true)); echo Html::submit(_x('button', 'Post'), array('name' => 'massiveaction')); return true; break; case 'generate': $PluginShellcommandsShellcommand = new PluginShellcommandsShellcommand(); $itemtype = $ma->getItemtype(false); if (in_array($itemtype, PluginShellcommandsShellcommand::getTypes(true))) { $PluginShellcommandsShellcommand->dropdownCommands($itemtype); echo "<br><br>"; } break; } return parent::showMassiveActionsSubForm($ma); }