本文整理汇总了PHP中Toolbox::decodeArrayFromInput方法的典型用法代码示例。如果您正苦于以下问题:PHP Toolbox::decodeArrayFromInput方法的具体用法?PHP Toolbox::decodeArrayFromInput怎么用?PHP Toolbox::decodeArrayFromInput使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Toolbox
的用法示例。
在下文中一共展示了Toolbox::decodeArrayFromInput方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showSpecificMassiveActionsParameters
/**
* @since version 0.84
*
* @see CommonDBTM::showSpecificMassiveActionsParameters()
**/
function showSpecificMassiveActionsParameters($input = array())
{
switch ($input['action']) {
case "move_license":
if (isset($input['options'])) {
$input['options'] = Toolbox::decodeArrayFromInput($input['options']);
if (isset($input['options']['move'])) {
SoftwareLicense::dropdown(array('condition' => "`glpi_softwarelicenses`.`softwares_id`\n = '" . $input['options']['move']['softwares_id'] . "'", 'used' => $input['options']['move']['used']));
echo "<br><br><input type='submit' name='massiveaction' value=\"" . _sx('button', 'Move') . "\" class='submit'> ";
return true;
}
}
return false;
default:
return parent::showSpecificMassiveActionsParameters($input);
}
return false;
}
示例2: showForm
//.........这里部分代码省略.........
if ($values["_users_id_requester"]) {
//Get all the user's entities
$all_entities = Profile_User::getUserEntities($values["_users_id_requester"], true, true);
//For each user's entity, check if the technician which creates the ticket have access to it
foreach ($all_entities as $tmp => $ID_entity) {
if (Session::haveAccessToEntity($ID_entity)) {
$this->userentities[] = $ID_entity;
}
}
}
$this->countentitiesforuser = count($this->userentities);
if ($this->countentitiesforuser > 0 && !in_array($this->fields["entities_id"], $this->userentities)) {
// If entity is not in the list of user's entities,
// then use as default value the first value of the user's entites list
$this->fields["entities_id"] = $this->userentities[0];
// Pass to values
$values['entities_id'] = $this->userentities[0];
}
}
if ($values['type'] <= 0) {
$values['type'] = Entity::getUsedConfig('tickettype', $values['entities_id'], '', Ticket::INCIDENT_TYPE);
}
if (!isset($options['template_preview'])) {
$options['template_preview'] = 0;
}
// Load ticket template if available :
if ($ID) {
$tt = $this->getTicketTemplateToUse($options['template_preview'], $this->fields['type'], $this->fields['itilcategories_id'], $this->fields['entities_id']);
} else {
$tt = $this->getTicketTemplateToUse($options['template_preview'], $values['type'], $values['itilcategories_id'], $values['entities_id']);
}
// Predefined fields from template : reset them
if (isset($values['_predefined_fields'])) {
$values['_predefined_fields'] = Toolbox::decodeArrayFromInput($values['_predefined_fields']);
} else {
$values['_predefined_fields'] = array();
}
// Store predefined fields to be able not to take into account on change template
// Only manage predefined values on ticket creation
$predefined_fields = array();
if (!$ID) {
if (isset($tt->predefined) && count($tt->predefined)) {
foreach ($tt->predefined as $predeffield => $predefvalue) {
if (isset($default_values[$predeffield])) {
// Is always default value : not set
// Set if already predefined field
// Set if ticket template change
if (count($values['_predefined_fields']) == 0 && $values[$predeffield] == $default_values[$predeffield] || isset($values['_predefined_fields'][$predeffield]) && $values[$predeffield] == $values['_predefined_fields'][$predeffield] || isset($values['_tickettemplates_id']) && $values['_tickettemplates_id'] != $tt->getID() || $predeffield == 'requesttypes_id' && empty($saved)) {
// Load template data
$values[$predeffield] = $predefvalue;
$this->fields[$predeffield] = $predefvalue;
$predefined_fields[$predeffield] = $predefvalue;
}
}
}
// All predefined override : add option to say predifined exists
if (count($predefined_fields) == 0) {
$predefined_fields['_all_predefined_override'] = 1;
}
} else {
// No template load : reset predefined values
if (count($values['_predefined_fields'])) {
foreach ($values['_predefined_fields'] as $predeffield => $predefvalue) {
if ($values[$predeffield] == $predefvalue) {
$values[$predeffield] = $default_values[$predeffield];
}
示例3: switch
* @brief
*/
include '../inc/includes.php';
Session::checkCentralAccess();
if (isset($_GET["item_type"]) && isset($_GET["display_type"])) {
if ($_GET["display_type"] < 0) {
$_GET["display_type"] = -$_GET["display_type"];
$_GET["export_all"] = 1;
}
switch ($_GET["item_type"]) {
case 'KnowbaseItem':
KnowbaseItem::showList($_GET, $_GET["is_faq"]);
break;
case 'Stat':
if (isset($_GET["item_type_param"])) {
$params = Toolbox::decodeArrayFromInput($_GET["item_type_param"]);
switch ($params["type"]) {
case "comp_champ":
$val = Stat::getItems($_GET["itemtype"], $params["date1"], $params["date2"], $params["dropdown"]);
Stat::showTable($_GET["itemtype"], $params["type"], $params["date1"], $params["date2"], $params["start"], $val, $params["dropdown"]);
break;
case "device":
$val = Stat::getItems($_GET["itemtype"], $params["date1"], $params["date2"], $params["dropdown"]);
Stat::showTable($_GET["itemtype"], $params["type"], $params["date1"], $params["date2"], $params["start"], $val, $params["dropdown"]);
break;
default:
$val2 = isset($params['value2']) ? $params['value2'] : 0;
$val = Stat::getItems($_GET["itemtype"], $params["date1"], $params["date2"], $params["type"], $val2);
Stat::showTable($_GET["itemtype"], $params["type"], $params["date1"], $params["date2"], $params["start"], $val, $val2);
}
} else {
示例4: getHelpdesk
//.........这里部分代码省略.........
$self = new Ticket();
if ($values["_users_id_requester"] == 0) {
$values['_users_id_requester'] = Session::getLoginUserID();
} else {
$values['_right'] = "delegate";
}
$self->showActorAddFormOnCreate(CommonITILActor::REQUESTER, $values);
echo "</div>";
if ($CFG_GLPI['use_check_pref'] && $values['nodelegate']) {
echo "</td><td class='center'>";
User::showPersonalInformation(Session::getLoginUserID());
}
echo "</td></tr>";
echo "</table></div>";
echo "<input type='hidden' name='_users_id_recipient' value='" . Session::getLoginUserID() . "'>";
} else {
// User as requester
$values['_users_id_requester'] = Session::getLoginUserID();
if ($CFG_GLPI['use_check_pref']) {
echo "<div class='center'><table class='tab_cadre_fixe'>";
echo "<tr><th>" . __('Check your personnal information') . "</th></tr>";
echo "<tr class='tab_bg_1'><td class='center'>";
User::showPersonalInformation(Session::getLoginUserID());
echo "</td></tr>";
echo "</table></div>";
}
}
echo "<input type='hidden' name='_from_helpdesk' value='1'>";
echo "<input type='hidden' name='requesttypes_id' value='" . RequestType::getDefault('helpdesk') . "'>";
// Load ticket template if available :
$tt = $ticket->getTicketTemplateToUse($ticket_template, $values['type'], $values['itilcategories_id'], $_SESSION["glpiactive_entity"]);
// Predefined fields from template : reset them
if (isset($values['_predefined_fields'])) {
$values['_predefined_fields'] = Toolbox::decodeArrayFromInput($values['_predefined_fields']);
} else {
$values['_predefined_fields'] = array();
}
// Store predefined fields to be able not to take into account on change template
$predefined_fields = array();
if (isset($tt->predefined) && count($tt->predefined)) {
foreach ($tt->predefined as $predeffield => $predefvalue) {
if (isset($values[$predeffield]) && isset($default_values[$predeffield])) {
// Is always default value : not set
// Set if already predefined field
// Set if ticket template change
if ($values[$predeffield] == $default_values[$predeffield] || isset($values['_predefined_fields'][$predeffield]) && $values[$predeffield] == $values['_predefined_fields'][$predeffield] || isset($values['_tickettemplates_id']) && $values['_tickettemplates_id'] != $tt->getID()) {
$values[$predeffield] = $predefvalue;
$predefined_fields[$predeffield] = $predefvalue;
}
} else {
// Not defined options set as hidden field
echo "<input type='hidden' name='{$predeffield}' value='{$predefvalue}'>";
}
}
} else {
// No template load : reset predefined values
if (count($values['_predefined_fields'])) {
foreach ($values['_predefined_fields'] as $predeffield => $predefvalue) {
if ($values[$predeffield] == $predefvalue) {
$values[$predeffield] = $default_values[$predeffield];
}
}
}
}
if ($CFG_GLPI['urgency_mask'] == 1 << 3 || $tt->isHiddenField('urgency')) {
// Dont show dropdown if only 1 value enabled or field is hidden
示例5: showForm
function showForm($ID, $options = array())
{
global $DB, $CFG_GLPI;
$default_values = self::getDefaultValues();
// Get default values from posted values on reload form
if (!isset($options['template_preview'])) {
if (isset($_POST)) {
$values = Html::cleanPostForTextArea($_POST);
}
}
// Restore saved value or override with page parameter
$saved = $this->restoreInput();
foreach ($default_values as $name => $value) {
if (!isset($values[$name])) {
if (isset($saved[$name])) {
$values[$name] = $saved[$name];
} else {
$values[$name] = $value;
}
}
}
// Default check
if ($ID > 0) {
$this->check($ID, 'r');
} else {
// Create item
$this->check(-1, 'w', $values);
}
if (!$ID) {
$this->userentities = array();
if ($values["_users_id_requester"]) {
//Get all the user's entities
$all_entities = Profile_User::getUserEntities($values["_users_id_requester"], true, true);
//For each user's entity, check if the technician which creates the ticket have access to it
foreach ($all_entities as $tmp => $ID_entity) {
if (Session::haveAccessToEntity($ID_entity)) {
$this->userentities[] = $ID_entity;
}
}
}
$this->countentitiesforuser = count($this->userentities);
if ($this->countentitiesforuser > 0 && !in_array($this->fields["entities_id"], $this->userentities)) {
// If entity is not in the list of user's entities,
// then use as default value the first value of the user's entites list
$this->fields["entities_id"] = $this->userentities[0];
// Pass to values
$values['entities_id'] = $this->userentities[0];
}
}
if ($values['type'] <= 0) {
$values['type'] = Entity::getUsedConfig('tickettype', $values['entities_id'], '', Ticket::INCIDENT_TYPE);
}
if (!isset($options['template_preview'])) {
$options['template_preview'] = 0;
}
// Load ticket template if available :
$tt = $this->getTicketTemplateToUse($options['template_preview'], $values['type'], $values['itilcategories_id'], $values['entities_id']);
// Predefined fields from template : reset them
if (isset($values['_predefined_fields'])) {
$values['_predefined_fields'] = Toolbox::decodeArrayFromInput($values['_predefined_fields']);
} else {
$values['_predefined_fields'] = array();
}
// Store predefined fields to be able not to take into account on change template
// Only manage predefined values on ticket creation
$predefined_fields = array();
if (!$ID) {
if (isset($tt->predefined) && count($tt->predefined)) {
foreach ($tt->predefined as $predeffield => $predefvalue) {
if (isset($default_values[$predeffield])) {
// Is always default value : not set
// Set if already predefined field
// Set if ticket template change
if ($values[$predeffield] == $default_values[$predeffield] || isset($values['_predefined_fields'][$predeffield]) && $values[$predeffield] == $values['_predefined_fields'][$predeffield] || isset($values['_tickettemplates_id']) && $values['_tickettemplates_id'] != $tt->getID()) {
// Load template data
$values[$predeffield] = $predefvalue;
$this->fields[$predeffield] = $predefvalue;
$predefined_fields[$predeffield] = $predefvalue;
}
}
}
} else {
// No template load : reset predefined values
if (count($values['_predefined_fields'])) {
foreach ($values['_predefined_fields'] as $predeffield => $predefvalue) {
if ($values[$predeffield] == $predefvalue) {
$values[$predeffield] = $default_values[$predeffield];
}
}
}
}
}
// Put ticket template on $values for actors
$values['_tickettemplate'] = $tt;
$canupdate = Session::haveRight('update_ticket', '1');
$canpriority = Session::haveRight('update_priority', '1');
$canstatus = $canupdate;
if (in_array($this->fields['status'], $this->getClosedStatusArray())) {
$canupdate = false;
}
//.........这里部分代码省略.........
示例6: header
$AJAX_INCLUDE = 1;
include '../inc/includes.php';
header("Content-Type: text/html; charset=UTF-8");
Html::header_nocache();
}
Session::checkRight("software", "w");
if ($_POST['softwares_id'] > 0) {
if (!isset($_POST['value'])) {
$_POST['value'] = 0;
}
$where = '';
if (isset($_POST['used'])) {
if (is_array($_POST['used'])) {
$used = $_POST['used'];
} else {
$used = Toolbox::decodeArrayFromInput($_POST['used']);
}
if (count($used)) {
$where = " AND `glpi_softwareversions`.`id` NOT IN ('" . implode("','", $used) . "')";
}
}
// Make a select box
$query = "SELECT DISTINCT `glpi_softwareversions`.*,\n `glpi_states`.`name` AS sname\n FROM `glpi_softwareversions`\n LEFT JOIN `glpi_states` ON (`glpi_softwareversions`.`states_id` = `glpi_states`.`id`)\n WHERE `glpi_softwareversions`.`softwares_id` = '" . $_POST['softwares_id'] . "'\n {$where}\n ORDER BY `name`";
$result = $DB->query($query);
$number = $DB->numrows($result);
echo "<select name='" . $_POST['myname'] . "' size='1'>";
echo "<option value='0'>" . Dropdown::EMPTY_VALUE . "</option>";
$today = date("Y-m-d");
if ($number) {
while ($data = $DB->fetch_assoc($result)) {
$ID = $data['id'];
示例7: header
/** @file
* @brief
*/
// Direct access to file
if (strpos($_SERVER['PHP_SELF'], "searchoptionvalue.php")) {
include '../inc/includes.php';
header("Content-Type: text/html; charset=UTF-8");
Html::header_nocache();
}
if (!defined('GLPI_ROOT')) {
die("Can not acces directly to this file");
}
Session::checkLoginUser();
if (isset($_POST['searchtype'])) {
if (!is_array($_POST['searchopt'])) {
$searchopt = Toolbox::decodeArrayFromInput($_POST['searchopt']);
} else {
$searchopt = $_POST['searchopt'];
}
$_POST['value'] = rawurldecode($_POST['value']);
$addmeta = "";
if (isset($_POST['meta']) && $_POST['meta']) {
$addmeta = '2';
}
$inputname = 'contains' . $addmeta . '[' . $_POST['num'] . ']';
$display = false;
$item = getItemForItemtype($_POST['itemtype']);
$options2 = array();
$options2['value'] = $_POST['value'];
// For tree dropdpowns
$options2['permit_select_parent'] = true;
示例8: IN
$where .= " AND `{$table}`.`id` NOT IN ('" . $_POST['value'] . "'";
if (isset($_POST['used'])) {
if (is_array($_POST['used'])) {
$used = $_POST['used'];
} else {
$used = Toolbox::decodeArrayFromInput($_POST['used']);
}
if (count($used)) {
$where .= ",'" . implode("','", $used) . "'";
}
}
if (isset($_POST['toadd'])) {
if (is_array($_POST['toadd'])) {
$toadd = $_POST['toadd'];
} else {
$toadd = Toolbox::decodeArrayFromInput($_POST['toadd']);
}
} else {
$toadd = array();
}
$where .= ") ";
if (isset($_POST['condition']) && $_POST['condition'] != '') {
$where .= " AND " . $_POST['condition'] . " ";
}
if ($item instanceof CommonTreeDropdown) {
if ($_POST['searchText'] != $CFG_GLPI["ajax_wildcard"]) {
$where .= " AND `completename` " . Search::makeTextSearch($_POST['searchText']);
}
$multi = false;
// Manage multiple Entities dropdowns
$add_order = "";
示例9: header
--------------------------------------------------------------------------
*/
// Direct access to file
if (strpos($_SERVER['PHP_SELF'], "dropdownValue.php")) {
include '../../../inc/includes.php';
header("Content-Type: text/html; charset=UTF-8");
Html::header_nocache();
}
Session::checkLoginUser();
// Security
if (!TableExists($_GET['table'])) {
exit;
}
$item = new $_GET['itemtype']();
if (isset($_GET["entity_restrict"]) && !is_numeric($_GET["entity_restrict"]) && !is_array($_GET["entity_restrict"])) {
$_GET["entity_restrict"] = Toolbox::decodeArrayFromInput($_GET["entity_restrict"]);
}
$NBMAX = $CFG_GLPI["dropdown_max"];
$LIMIT = "LIMIT 0,{$NBMAX}";
if ($_GET['searchText'] == $CFG_GLPI["ajax_wildcard"]) {
$LIMIT = "";
}
$where = " WHERE `" . $_GET['table'] . "`.`id` NOT IN ('" . $_GET['value2'] . "'";
$used = array();
if ($_GET["name"] != "type") {
$datas = getAllDatasFromTable("glpi_plugin_positions_positions", "`itemtype` = '" . $_GET['itemtype'] . "'");
} else {
$datas = getAllDatasFromTable("glpi_plugin_positions_imageitems", "`itemtype` = '" . $_GET['itemtype'] . "'");
}
if (!empty($datas)) {
foreach ($datas as $data) {
示例10: array
$_POST['all'] = 0;
}
$used = array();
if (isset($_POST['used'])) {
if (is_array($_POST['used'])) {
$used = $_POST['used'];
} else {
$used = Toolbox::decodeArrayFromInput($_POST['used']);
}
}
if (isset($_POST["entity_restrict"]) && !is_numeric($_POST["entity_restrict"]) && !is_array($_POST["entity_restrict"])) {
$_POST["entity_restrict"] = Toolbox::decodeArrayFromInput($_POST["entity_restrict"]);
}
// for multi rights
if (isset($_POST["right"]) && !is_array($_POST["right"])) {
$temp = Toolbox::decodeArrayFromInput($_POST["right"]);
if (count($temp)) {
$_POST['right'] = $temp;
}
}
$result = User::getSqlSearchResult(false, $_POST['right'], $_POST["entity_restrict"], $_POST['value'], $used, $_POST['searchText']);
$users = array();
if ($DB->numrows($result)) {
while ($data = $DB->fetch_assoc($result)) {
$users[$data["id"]] = formatUserName($data["id"], $data["name"], $data["realname"], $data["firstname"]);
$logins[$data["id"]] = $data["name"];
}
}
if (!function_exists('dpuser_cmp')) {
function dpuser_cmp($a, $b)
{
示例11: array
}
$fieldname = '';
if (empty($search["linkfield"]) || $search['table'] == 'glpi_infocoms') {
$fieldname = $search["field"];
} else {
$fieldname = $search["linkfield"];
}
if (!$plugdisplay) {
$options = array();
$values = array();
// For ticket template or aditional options of massive actions
if (isset($_POST['options']) && strlen($_POST['options'])) {
$options = Toolbox::decodeArrayFromInput($_POST['options']);
}
if (isset($_POST['additionalvalues']) && strlen($_POST['additionalvalues'])) {
$values = Toolbox::decodeArrayFromInput($_POST['additionalvalues']);
}
$values[$search["field"]] = '';
echo $item->getValueToSelect($search, $fieldname, $values, $options);
}
if (!$FIELDNAME_PRINTED) {
echo "<input type='hidden' name='field' value='{$fieldname}'>";
}
echo "</td>";
if ($inline) {
echo "<td><input type='submit' name='massiveaction' class='submit' value='{$submitname}'></td>";
}
echo "</tr></table>";
if (!$inline) {
echo "<br><input type='submit' name='massiveaction' class='submit' value='{$submitname}'>";
}
示例12: header
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
*/
// Direct access to file
if (strpos($_SERVER['PHP_SELF'], "dropdownDelegationUsers.php")) {
$AJAX_INCLUDE = 1;
include '../inc/includes.php';
header("Content-Type: text/html; charset=UTF-8");
Html::header_nocache();
}
if (!defined('GLPI_ROOT')) {
die("Can not acces directly to this file");
}
Session::checkLoginUser();
if ($_POST["nodelegate"] == 1) {
$_POST['_users_id_requester'] = Session::getLoginUserID();
$_POST['_right'] = "id";
} else {
$_POST['_right'] = "delegate";
}
if (isset($_POST['_users_id_requester_notif']) && !empty($_POST['_users_id_requester_notif'])) {
$_POST['_users_id_requester_notif'] = Toolbox::decodeArrayFromInput($_POST['_users_id_requester_notif']);
}
$ticket = new Ticket();
$ticket->showActorAddFormOnCreate(Ticket_User::REQUESTER, $_POST);
示例13: showMassiveActionsParameters
/**
* Display options add action button for massive actions
*
* @since version 0.84
*
* This must not be overloaded in Class
*
* @param $input array of input datas
*
* @return nothing display
**/
function showMassiveActionsParameters($input = array())
{
global $CFG_GLPI;
switch ($input['action']) {
case "add_contract_item":
if ($input['itemtype'] == 'Contract') {
Dropdown::showAllItems("items_id", 0, 0, 1, $CFG_GLPI["contract_types"], false, true, 'item_itemtype');
echo "<br><br><input type='submit' name='massiveaction' class='submit' value='" . _sx('button', 'Add') . "'>";
} else {
Contract::dropdown(array('name' => "contracts_id"));
echo "<br><br><input type='submit' name='massiveaction' class='submit' value='" . _sx('button', 'Add') . "'>";
}
break;
case "remove_contract_item":
if ($input['itemtype'] == 'Contract') {
Dropdown::showAllItems("items_id", 0, 0, 1, $CFG_GLPI["contract_types"], false, true, 'item_itemtype');
echo "<br><br><input type='submit' name='massiveaction' class='submit' value='" . _sx('button', 'Delete permanently') . "'>";
} else {
Contract::dropdown(array('name' => "contracts_id"));
echo "<br><br><input type='submit' name='massiveaction' class='submit' value='" . _sx('button', 'Delete permanently') . "'>";
}
break;
case "add_document":
Document::dropdown(array('name' => 'documents_id'));
echo "<br><br><input type='submit' name='massiveaction' class='submit' value='" . _sx('button', 'Add') . "'>";
break;
case "remove_document":
Document::dropdown(array('name' => 'documents_id'));
echo "<br><br><input type='submit' name='massiveaction' class='submit' value='" . _sx('button', 'Delete permanently') . "'>";
break;
case "update":
// Specific options for update fields
if (isset($input['options'])) {
$input['options'] = Toolbox::decodeArrayFromInput($input['options']);
} else {
$input['options'] = array();
}
$first_group = true;
$newgroup = "";
$items_in_group = 0;
$show_all = true;
$show_infocoms = true;
if (in_array($input["itemtype"], $CFG_GLPI["infocom_types"]) && (!static::canUpdate() || !Infocom::canUpdate())) {
$show_all = false;
$show_infocoms = Infocom::canUpdate();
}
$searchopt = Search::getCleanedOptions($input["itemtype"], 'w');
echo "<select name='id_field' id='massiveaction_field'>";
echo "<option value='0' selected>" . Dropdown::EMPTY_VALUE . "</option>";
foreach ($searchopt as $key => $val) {
if (!is_array($val)) {
if (!empty($newgroup) && $items_in_group > 0) {
echo $newgroup;
$first_group = false;
}
$items_in_group = 0;
$newgroup = "";
if (!$first_group) {
$newgroup .= "</optgroup>";
}
$newgroup .= "<optgroup label=\"{$val}\">";
} else {
// No id and no entities_id massive action and no first item
if ($val["field"] != 'id' && $key != 1 && ($val["linkfield"] != 'entities_id' || isset($val['massiveaction']) && $val['massiveaction'])) {
if (!isset($val['massiveaction']) || $val['massiveaction']) {
if ($show_all) {
$newgroup .= "<option value='{$key}'>" . $val["name"] . "</option>";
$items_in_group++;
} else {
// Do not show infocom items
if ($show_infocoms && Search::isInfocomOption($input["itemtype"], $key) || !$show_infocoms && !Search::isInfocomOption($input["itemtype"], $key)) {
$newgroup .= "<option value='{$key}'>" . $val["name"] . "</option>";
$items_in_group++;
}
}
}
}
}
}
if (!empty($newgroup) && $items_in_group > 0) {
echo $newgroup;
}
if (!$first_group) {
echo "</optgroup>";
}
echo "</select>";
$paramsmassaction = array('id_field' => '__VALUE__', 'itemtype' => $input["itemtype"], 'options' => $input['options']);
foreach ($input as $key => $val) {
if (preg_match("/extra_/", $key, $regs)) {
//.........这里部分代码省略.........
示例14: showSpecificMassiveActionsParameters
/**
* @since version 0.84
*
* @see CommonDBTM::showSpecificMassiveActionsParameters()
**/
function showSpecificMassiveActionsParameters($input = array())
{
switch ($input['action']) {
case "move_version":
if (isset($input['options'])) {
$input['options'] = Toolbox::decodeArrayFromInput($input['options']);
if (isset($input['options']['move'])) {
$options = array('softwares_id' => $input['options']['move']['softwares_id']);
if (isset($input['options']['move']['used'])) {
$options['used'] = $input['options']['move']['used'];
}
SoftwareVersion::dropdown($options);
echo "<br><br><input type='submit' name='massiveaction' value=\"" . _sx('button', 'Move') . "\" class='submit'> ";
return true;
}
}
return false;
default:
return parent::showSpecificMassiveActionsParameters($input);
}
return false;
}
示例15: commonDropdownUpdateItem
/**
* Javascript code for update an item (Javascript code only)
*
* @param $options array of options
* - toupdate : array / Update a specific item on select change on dropdown
* (need value_fieldname, to_update,
* url (@see Ajax::updateItemOnSelectEvent for information)
* and may have moreparams)
**/
static function commonDropdownUpdateItem($options)
{
if (isset($options["update_item"]) && (is_array($options["update_item"]) || strlen($options["update_item"]) > 0)) {
if (!is_array($options["update_item"])) {
$datas = Toolbox::decodeArrayFromInput($options["update_item"]);
} else {
$datas = $options["update_item"];
}
if (is_array($datas) && count($datas)) {
// Put it in array
if (isset($datas['to_update'])) {
$datas = array($datas);
}
foreach ($datas as $data) {
$paramsupdate = array();
if (isset($data['value_fieldname'])) {
$paramsupdate = array($data['value_fieldname'] => '__VALUE__');
}
if (isset($data["moreparams"]) && is_array($data["moreparams"]) && count($data["moreparams"])) {
foreach ($data["moreparams"] as $key => $val) {
$paramsupdate[$key] = $val;
}
}
self::updateItemOnSelectEvent("dropdown_" . $options["myname"] . $options["rand"], $data['to_update'], $data['url'], $paramsupdate);
}
}
}
}