本文整理汇总了PHP中Ajax::dropdown方法的典型用法代码示例。如果您正苦于以下问题:PHP Ajax::dropdown方法的具体用法?PHP Ajax::dropdown怎么用?PHP Ajax::dropdown使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ajax
的用法示例。
在下文中一共展示了Ajax::dropdown方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: header
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Certificates 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 Certificates. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
if (strpos($_SERVER['PHP_SELF'], "dropdownTypeCertificates.php")) {
$AJAX_INCLUDE = 1;
include '../../../inc/includes.php';
header("Content-Type: text/html; charset=UTF-8");
Html::header_nocache();
}
Session::checkCentralAccess();
// Make a select box
if (isset($_POST["plugin_certificates_certificatetypes_id"])) {
$rand = $_POST['rand'];
$use_ajax = false;
$restrict = "glpi_plugin_certificates_certificates.plugin_certificates_certificatetypes_id='" . $_POST["plugin_certificates_certificatetypes_id"] . "' " . getEntitiesRestrictRequest("AND", "glpi_plugin_certificates_certificates", "", $_POST["entity_restrict"], true);
if ($CFG_GLPI["use_ajax"] && countElementsInTable('glpi_plugin_certificates_certificates', $restrict) > $CFG_GLPI["ajax_limit_count"]) {
$use_ajax = true;
}
$params = array('searchText' => '__VALUE__', 'plugin_certificates_certificatetypes_id' => $_POST["plugin_certificates_certificatetypes_id"], 'entity_restrict' => $_POST["entity_restrict"], 'rand' => $_POST['rand'], 'myname' => $_POST['myname'], 'used' => $_POST['used']);
$default = "<select name='" . $_POST["myname"] . "'><option value='0'>" . Dropdown::EMPTY_VALUE . "</option></select>";
Ajax::dropdown($use_ajax, "/plugins/certificates/ajax/dropdownCertificates.php", $params, $default, $rand);
}
示例2: dropdownNetpoint
/**
* Print out an HTML "<select>" for a dropdown with preselected value
*
* @param $myname the name of the HTML select
* @param $value the preselected value we want (default 0)
* @param $locations_id default location ID for search (default -1)
* @param $display_comment display the comment near the dropdown (default 1)
* @param $entity_restrict Restrict to a defined entity(default -1)
* @param $devtype (default '')
*
* @return nothing (display the select box)
**/
static function dropdownNetpoint($myname, $value = 0, $locations_id = -1, $display_comment = 1, $entity_restrict = -1, $devtype = '')
{
global $CFG_GLPI;
$rand = mt_rand();
$name = Dropdown::EMPTY_VALUE;
$comment = "";
$limit_length = $_SESSION["glpidropdown_chars_limit"];
if (empty($value)) {
$value = 0;
}
if ($value > 0) {
$tmpname = Dropdown::getDropdownName("glpi_netpoints", $value, 1);
if ($tmpname["name"] != " ") {
$name = $tmpname["name"];
$comment = $tmpname["comment"];
$limit_length = max(Toolbox::strlen($name), $_SESSION["glpidropdown_chars_limit"]);
}
}
$use_ajax = false;
if ($CFG_GLPI["use_ajax"]) {
if ($locations_id < 0 || $devtype == 'NetworkEquipment') {
$nb = countElementsInTableForEntity("glpi_netpoints", $entity_restrict);
} else {
if ($locations_id > 0) {
$nb = countElementsInTable("glpi_netpoints", "locations_id={$locations_id} ");
} else {
$nb = countElementsInTable("glpi_netpoints", "locations_id=0 " . getEntitiesRestrictRequest(" AND ", "glpi_netpoints", '', $entity_restrict));
}
}
if ($nb > $CFG_GLPI["ajax_limit_count"]) {
$use_ajax = true;
}
}
$params = array('searchText' => '__VALUE__', 'value' => $value, 'locations_id' => $locations_id, 'myname' => $myname, 'limit' => $limit_length, 'comment' => $display_comment, 'rand' => $rand, 'entity_restrict' => $entity_restrict, 'devtype' => $devtype);
$default = "<select name='{$myname}'><option value='{$value}'>{$name}</option></select>";
Ajax::dropdown($use_ajax, "/ajax/dropdownNetpoint.php", $params, $default, $rand);
// Display comment
if ($display_comment) {
Html::showToolTip($comment);
$item = new self();
if ($item->canCreate()) {
echo "<img alt='' title=\"" . __s('Add') . "\" src='" . $CFG_GLPI["root_doc"] . "/pics/add_dropdown.png' style='cursor:pointer; margin-left:2px;' " . "onClick=\"var w = window.open('" . $item->getFormURL() . "?popup=1&rand={$rand}' ,'glpipopup', 'height=400, " . "width=1000, top=100, left=100, scrollbars=yes' );w.focus();\">";
}
}
return $rand;
}
示例3: header
Webapplications 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.
Webapplications 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 Webapplications. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
if (strpos($_SERVER['PHP_SELF'], "dropdownTypeWebApplications.php")) {
include '../../../inc/includes.php';
header("Content-Type: text/html; charset=UTF-8");
Html::header_nocache();
}
Session::checkCentralAccess();
// Make a select box with type selecting
if (isset($_POST["plugin_webapplications_webapplicationtypes_id"])) {
$rand = $_POST['rand'];
$use_ajax = false;
if ($CFG_GLPI["use_ajax"] && countElementsInTable('glpi_plugin_webapplications_webapplications', "glpi_plugin_webapplications_webapplications.plugin_webapplications_webapplicationtypes_id='" . $_POST["plugin_webapplications_webapplicationtypes_id"] . "' " . getEntitiesRestrictRequest("AND", "glpi_plugin_webapplications_webapplications", "", $_POST["entity_restrict"], true)) > $CFG_GLPI["ajax_limit_count"]) {
$use_ajax = true;
}
$params = array('searchText' => '__VALUE__', 'plugin_webapplications_webapplicationtypes_id' => $_POST["plugin_webapplications_webapplicationtypes_id"], 'entity_restrict' => $_POST["entity_restrict"], 'rand' => $_POST['rand'], 'myname' => $_POST['myname'], 'used' => $_POST['used']);
$default = "<select name='" . $_POST["myname"] . "'><option value='0'>" . Dropdown::EMPTY_VALUE . "</option></select>";
Ajax::dropdown($use_ajax, "/plugins/webapplications/ajax/dropdownWebApplications.php", $params, $default, $rand);
}
示例4: getItemForItemtype
$link = "dropdownCommandValue.php";
// Link to user for search only > normal users
$use_ajax = false;
if (isset($_POST["countItem"])) {
// Display an search input if too items in select
$item = getItemForItemtype($_POST['idtable']);
$item->getFromDB($_POST['itemID']);
$tabValue = explode('-', $_POST['value']);
if (sizeof($tabValue) == 2) {
if (stristr($tabValue[0], 'mac') || stristr($tabValue[0], 'ip')) {
if ($CFG_GLPI["use_ajax"] && PluginShellcommandsShellcommand_Item::countForItem($item, array('type' => $tabValue[0], 'itemId' => $tabValue[1])) > $CFG_GLPI["ajax_limit_count"]) {
$use_ajax = true;
}
echo '</br>' . __('Network port') . ' ';
}
}
}
$rand = mt_rand();
$paramsallitems = array('searchText' => '__VALUE__', 'itemtype' => $_POST["itemtype"], 'itemID' => $_POST["itemID"], 'value' => $_POST["value"], 'rand' => $rand, 'myname' => $_POST["myname"], 'displaywith' => array('otherserial', 'serial'), 'display_emptychoice' => false);
if (isset($_POST['idtable'])) {
$paramsallitems['idtable'] = $_POST['idtable'];
}
if (isset($_POST['entity_restrict'])) {
$paramsallitems['entity_restrict'] = $_POST['entity_restrict'];
}
if (isset($_POST['condition'])) {
$paramsallitems['condition'] = stripslashes($_POST['condition']);
}
$default = "<select name='" . $_POST["myname"] . "'><option value='0'>" . Dropdown::EMPTY_VALUE . "</option></select>";
Ajax::dropdown($use_ajax, "/plugins/shellcommands/ajax/{$link}", $paramsallitems, $default, $rand);
}
示例5: dropdown
/**
* Dropdown rules for a defined sub_type of rule
*
* @param $options array of possible options:
* - name : string / name of the select (default is depending itemtype)
* - sub_type : integer / sub_type of rule
**/
static function dropdown($options = array())
{
global $DB, $CFG_GLPI;
$p['sub_type'] = '';
$p['name'] = 'rules_id';
$p['entity_restrict'] = '';
if (is_array($options) && count($options)) {
foreach ($options as $key => $val) {
$p[$key] = $val;
}
}
if ($p['sub_type'] == '') {
return false;
}
$rand = mt_rand();
$limit_length = $_SESSION["glpidropdown_chars_limit"];
$use_ajax = false;
if ($CFG_GLPI["use_ajax"]) {
$nb = countElementsInTable("glpi_rules", "`sub_type`='" . $p['sub_type'] . "'");
if ($nb > $CFG_GLPI["ajax_limit_count"]) {
$use_ajax = true;
}
}
$params = array('searchText' => '__VALUE__', 'myname' => $p['name'], 'limit' => $limit_length, 'rand' => $rand, 'type' => $p['sub_type'], 'entity_restrict' => $p['entity_restrict']);
$default = "<select name='" . $p['name'] . "' id='dropdown_" . $p['name'] . $rand . "'>";
$default .= "<option value='0'>" . Dropdown::EMPTY_VALUE . "</option></select>";
Ajax::dropdown($use_ajax, "/ajax/dropdownRules.php", $params, $default, $rand);
return $rand;
}
示例6: showGenericDropdown
/**
* Permet l'affichage dynamique d'une liste déroulante imbriquee
*
* @static
* @param array ($itemtype,$myname,$value,$entity_restrict,$action,$span)
*/
static function showGenericDropdown($itemtype, $options = array())
{
global $DB, $CFG_GLPI;
$item = getItemForItemtype($itemtype);
if ($itemtype && !($item = getItemForItemtype($itemtype))) {
return false;
}
$table = $item->getTable();
/*$options["table"] = $table;
$options["rand"] = $rand;
$params['name'] = $item->getForeignKeyField();
$params['value'] = ($itemtype=='Entity' ? $_SESSION['glpiactive_entity'] : '');
$params['entity'] = -1;
$params['entity_sons'] = false;
$params['toupdate'] = '';
$params['used'] = array();
$params['toadd'] = array();
$params['on_change'] = '';
$params['condition'] = '';
$params['rand'] = mt_rand();
$params['displaywith'] = array();
//Parameters about choice 0
//Empty choice's label
$params['emptylabel'] = self::EMPTY_VALUE;*/
$params['comments'] = true;
$params['condition'] = '';
$params['entity'] = -1;
$params['entity_sons'] = false;
$params['rand'] = mt_rand();
$params['used'] = array();
$params['table'] = $table;
$params['emptylabel'] = Dropdown::EMPTY_VALUE;
//Display emptychoice ?
$params['display_emptychoice'] = true;
//In case of Entity dropdown, display root entity ?
$params['display_rootentity'] = false;
//specific
$params['action'] = "";
$params['span'] = "";
$params['sort'] = false;
if (is_array($options) && count($options)) {
foreach ($options as $key => $val) {
$params[$key] = $val;
}
}
$name = $params['emptylabel'];
$comment = "";
$limit_length = $_SESSION["glpidropdown_chars_limit"];
if (strlen($params['value']) == 0 || !is_numeric($params['value'])) {
$params['value'] = 0;
}
if ($params['value'] > 0) {
$tmpname = Dropdown::getDropdownName($table, $params['value'], 1);
if ($tmpname["name"] != " ") {
$name = $tmpname["name"];
$comment = $tmpname["comment"];
if (Toolbox::strlen($name) > $_SESSION["glpidropdown_chars_limit"]) {
if ($item instanceof CommonTreeDropdown) {
$pos = strrpos($name, ">");
$limit_length = max(Toolbox::strlen($name) - $pos, $_SESSION["glpidropdown_chars_limit"]);
if (Toolbox::strlen($name) > $limit_length) {
$name = "…" . Toolbox::substr($name, -$limit_length);
}
} else {
$limit_length = Toolbox::strlen($name);
}
} else {
$limit_length = $_SESSION["glpidropdown_chars_limit"];
}
}
}
// Manage entity_sons
if (!($params['entity'] < 0) && $params['entity_sons']) {
if (is_array($params['entity'])) {
echo "entity_sons options is not available with array of entity";
} else {
$params['entity'] = getSonsOf('glpi_entities', $params['entity']);
}
}
$use_ajax = false;
if ($CFG_GLPI["use_ajax"]) {
$nb = 0;
if ($item->isEntityAssign()) {
if (!($params['entity'] < 0)) {
$nb = countElementsInTableForEntity($table, $params['entity'], $params['condition']);
} else {
$nb = countElementsInTableForMyEntities($table, $params['condition']);
}
} else {
$nb = countElementsInTable($table, $params['condition']);
}
$nb -= count($params['used']);
//.........这里部分代码省略.........
示例7: header
include "../../../inc/includes.php";
header("Content-Type: text/html; charset=UTF-8");
Html::header_nocache();
// Make a select box
if (isset($_POST["typetable"])) {
$test = explode(";", $_POST['typetable']);
$itemtype = $test[0];
$table = $test[1];
// Link to user for search only > normal users
$rand = mt_rand();
$use_ajax = false;
if ($CFG_GLPI["use_ajax"] && countElementsInTable($table) > $CFG_GLPI["ajax_limit_count"]) {
$use_ajax = true;
}
$params = array('searchText' => '__VALUE__', 'itemtype' => $itemtype, 'table' => $table, 'rand' => $rand, 'myname' => $_POST["myname"]);
if (isset($_POST['value'])) {
$params['value'] = $_POST['value'];
}
if (isset($_POST['entity_restrict'])) {
$params['entity_restrict'] = $_POST['entity_restrict'];
}
$default = "<select name='" . $_POST["myname"] . "'><option value='0'>" . Dropdown::EMPTY_VALUE . "</option></select>";
Ajax::dropdown($use_ajax, "/plugins/archires/ajax/dropdownValue.php", $params, $default, $rand);
if (isset($_POST['value']) && $_POST['value'] > 0) {
$params['searchText'] = $CFG_GLPI["ajax_wildcard"];
echo "<script type='text/javascript' >\n";
echo "document.getElementById('search_{$rand}').value='" . $CFG_GLPI["ajax_wildcard"] . "';";
echo "</script>\n";
Ajax::pdateItem("results_{$rand}", $CFG_GLPI["root_doc"] . "/plugins/archires/ajax/dropdownValue.php", $params);
}
}
示例8: header
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/>.
--------------------------------------------------------------------------
*/
/** @file
* @since version 0.84
* @brief
*/
include '../inc/includes.php';
header("Content-Type: text/html; charset=UTF-8");
Html::header_nocache();
Session::checkRight("networking", "w");
// Make a select box
if (class_exists($_POST["itemtype"])) {
$table = getTableForItemType($_POST["itemtype"]);
$rand = mt_rand();
$use_ajax = true;
$paramsconnectpdt = array('searchText' => '__VALUE__', 'itemtype' => $_POST['itemtype'], 'rand' => $rand, 'myname' => "items", 'entity_restrict' => $_POST["entity_restrict"], 'condition' => "(`id` in (SELECT `items_id`" . "FROM `glpi_networkports`" . "WHERE `itemtype` = '" . $_POST["itemtype"] . "'" . "AND `instantiation_type`" . "= '" . $_POST['instantiation_type'] . "'))", 'update_item' => array('value_fieldname' => 'item', 'to_update' => "results_item_{$rand}", 'url' => $CFG_GLPI["root_doc"] . "/ajax/dropdownConnectNetworkPort.php", 'moreparams' => array('networkports_id' => $_POST['networkports_id'], 'itemtype' => $_POST['itemtype'], 'myname' => $_POST['myname'], 'instantiation_type' => $_POST['instantiation_type'])));
$default = "<select name='NetworkPortConnect_item'>" . "<option value='0'>" . Dropdown::EMPTY_VALUE . "</option>" . "</select>\n";
Ajax::dropdown($use_ajax, "/ajax/dropdownValue.php", $paramsconnectpdt, $default, $rand);
echo "<span id='results_item_{$rand}'>";
echo "</span>\n";
}
示例9: header
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Databases 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 Databases. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
if (strpos($_SERVER['PHP_SELF'], "dropdownTypeDatabases.php")) {
$AJAX_INCLUDE = 1;
include '../../../inc/includes.php';
header("Content-Type: text/html; charset=UTF-8");
Html::header_nocache();
}
Session::checkCentralAccess();
// Make a select box
if (isset($_POST["plugin_databases_databasetypes_id"])) {
$rand = $_POST['rand'];
$use_ajax = false;
$restrict = "glpi_plugin_databases_databases.plugin_databases_databasetypes_id='" . $_POST["plugin_databases_databasetypes_id"] . "' " . getEntitiesRestrictRequest("AND", "glpi_plugin_databases_databases", "", $_POST["entity_restrict"], true);
if ($CFG_GLPI["use_ajax"] && countElementsInTable('glpi_plugin_databases_databases', $restrict) > $CFG_GLPI["ajax_limit_count"]) {
$use_ajax = true;
}
$params = array('searchText' => '__VALUE__', 'plugin_databases_databasetypes_id' => $_POST["plugin_databases_databasetypes_id"], 'entity_restrict' => $_POST["entity_restrict"], 'rand' => $_POST['rand'], 'myname' => $_POST['myname'], 'used' => $_POST['used']);
$default = "<select name='" . $_POST["myname"] . "'><option value='0'>" . Dropdown::EMPTY_VALUE . "</option></select>";
Ajax::dropdown($use_ajax, "/plugins/databases/ajax/dropdownDatabases.php", $params, $default, $rand);
}
示例10: dropdownConnect
/**
* Make a select box for connections
*
* @param $itemtype type to connect
* @param $fromtype from where the connection is
* @param $myname select name
* @param $entity_restrict Restrict to a defined entity (default = -1)
* @param $onlyglobal display only global devices (used for templates) (default 0)
* @param $used array Already used items ID: not to display in dropdown
*
* @return nothing (print out an HTML select box)
*/
static function dropdownConnect($itemtype, $fromtype, $myname, $entity_restrict = -1, $onlyglobal = 0, $used = array())
{
global $CFG_GLPI;
$rand = mt_rand();
$use_ajax = false;
if ($CFG_GLPI["use_ajax"]) {
$nb = 0;
if ($entity_restrict >= 0) {
$nb = countElementsInTableForEntity(getTableForItemType($itemtype), $entity_restrict);
} else {
$nb = countElementsInTableForMyEntities(getTableForItemType($itemtype));
}
if ($nb > $CFG_GLPI["ajax_limit_count"]) {
$use_ajax = true;
}
}
$params = array('searchText' => '__VALUE__', 'fromtype' => $fromtype, 'itemtype' => $itemtype, 'myname' => $myname, 'onlyglobal' => $onlyglobal, 'entity_restrict' => $entity_restrict, 'used' => $used);
$default = "<select name='{$myname}'><option value='0'>" . Dropdown::EMPTY_VALUE . "</option>\n </select>\n";
Ajax::dropdown($use_ajax, "/ajax/dropdownConnect.php", $params, $default, $rand);
return $rand;
}
示例11: dropdown
/**
* Make a select box for software to install
*
* @param $options array of possible options:
* - name : string / name of the select (default is softwareversions_id)
* - softwares_id : integer / ID of the software
* - value : integer / value of the selected version
* - used : array / already used items
*
* @return nothing (print out an HTML select box)
**/
static function dropdown($options = array())
{
global $CFG_GLPI;
//$softwares_id,$value=0
$p['softwares_id'] = 0;
$p['value'] = 0;
$p['name'] = 'softwareversions_id';
$p['used'] = array();
if (is_array($options) && count($options)) {
foreach ($options as $key => $val) {
$p[$key] = $val;
}
}
$rand = mt_rand();
$params = array('softwares_id' => $p['softwares_id'], 'myname' => $p['name'], 'value' => $p['value'], 'used' => $p['used']);
$default = "<select name='" . $p['name'] . "'><option value='0'>" . Dropdown::EMPTY_VALUE . "</option>\n </select>";
Ajax::dropdown(false, "/ajax/dropdownInstallVersion.php", $params, $default, $rand);
return $rand;
}
示例12: plugin_monitoring_searchOptionsValues
function plugin_monitoring_searchOptionsValues($item)
{
global $CFG_GLPI;
if ($item['searchoption']['table'] == 'glpi_plugin_monitoring_services' and $item['searchoption']['field'] == 'state') {
$input = array();
$input['CRITICAL'] = 'CRITICAL';
$input['DOWN'] = 'DOWN';
$input['DOWNTIME'] = 'DOWNTIME';
$input['FLAPPING'] = 'FLAPPING';
$input['OK'] = 'OK';
$input['RECOVERY'] = 'RECOVERY';
$input['UNKNOWN'] = 'UNKNOWN';
$input['UNREACHABLE'] = 'UNREACHABLE';
$input['UP'] = 'UP';
$input['WARNING'] = 'WARNING';
Dropdown::showFromArray($item['name'], $input, array('value' => $item['value']));
return true;
} else {
if ($item['searchoption']['table'] == 'glpi_plugin_monitoring_services' and $item['searchoption']['field'] == 'state_type') {
$input = array();
$input['HARD'] = 'HARD';
$input['SOFT'] = 'SOFT';
Dropdown::showFromArray($item['name'], $input, array('value' => $item['value']));
return true;
} else {
if ($item['searchoption']['table'] == 'glpi_plugin_monitoring_services' and ($item['searchoption']['field'] == 'Computer' or $item['searchoption']['field'] == 'Printer' or $item['searchoption']['field'] == 'NetworkEquipment')) {
$itemtype = $item['searchoption']['field'];
$use_ajax = false;
if ($CFG_GLPI["use_ajax"]) {
$nb = countElementsInTable("glpi_plugin_monitoring_componentscatalogs_hosts", "`itemtype`='Computer'");
if ($nb > $CFG_GLPI["ajax_limit_count"]) {
$use_ajax = true;
}
}
$params = array();
$params['itemtype'] = $itemtype;
$params['searchText'] = '';
$params['myname'] = $item['name'];
$params['rand'] = '';
$params['value'] = $item['value'];
$default = "<select name='" . $item['name'] . "' id='dropdown_" . $item['name'] . "0'>";
if (isset($item['value']) and !empty($item['value'])) {
$itemm = new $itemtype();
$itemm->getFromDB($item['value']);
$default .= "<option value='" . $item['value'] . "'>" . $itemm->getName() . "</option></select>";
}
Ajax::dropdown($use_ajax, "/plugins/monitoring/ajax/dropdownDevices.php", $params, $default);
return true;
}
}
}
}
示例13: header
appliances 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.
appliances 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 appliances. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
if (strpos($_SERVER['PHP_SELF'], "dropdownTypeAppliances.php")) {
include "../../../inc/includes.php";
header("Content-Type: text/html; charset=UTF-8");
Html::header_nocache();
}
Session::checkCentralAccess();
// Make a select box
if (isset($_POST["type_appliances"])) {
$rand = $_POST['rand'];
$use_ajax = false;
if ($CFG_GLPI["use_ajax"] && countElementsInTable('glpi_plugin_appliances_appliances', "plugin_appliances_appliancetypes_id ='" . $_POST["type_appliances"] . "' " . getEntitiesRestrictRequest(" AND", "glpi_plugin_appliances_appliances", "", $_POST["entity_restrict"], true)) > $CFG_GLPI["ajax_limit_count"]) {
$use_ajax = true;
}
$params = array('searchText' => ' __VALUE__', 'type_appliances' => $_POST["type_appliances"], 'entity_restrict' => $_POST["entity_restrict"], 'rand' => $_POST['rand'], 'myname' => $_POST['myname'], 'used' => $_POST['used']);
$default = "<select name='" . $_POST["myname"] . "'>\n <option value='0'>" . Dropdown::EMPTY_VALUE . "</option></select>";
Ajax::dropdown($use_ajax, "/plugins/appliances/ajax/dropdownappliances.php", $params, $default, $rand);
}
示例14: header
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.
accounts 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 accounts. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
if (strpos($_SERVER['PHP_SELF'], "dropdownTypeAccounts.php")) {
include '../../../inc/includes.php';
header("Content-Type: text/html; charset=UTF-8");
Html::header_nocache();
}
Session::checkCentralAccess();
// Make a select box
if (isset($_POST["plugin_accounts_accounttypes_id"])) {
$rand = $_POST['rand'];
$use_ajax = false;
$restrict = "plugin_accounts_accounttypes_id='" . $_POST["plugin_accounts_accounttypes_id"] . "'\n " . getEntitiesRestrictRequest("AND", "glpi_plugin_accounts_accounts", "", $_POST["entity_restrict"], true);
if ($CFG_GLPI["use_ajax"] && countElementsInTable('glpi_plugin_accounts_accounts', $restrict) > $CFG_GLPI["ajax_limit_count"]) {
$use_ajax = true;
}
$params = array('searchText' => '__VALUE__', 'plugin_accounts_accounttypes_id' => $_POST["plugin_accounts_accounttypes_id"], 'entity_restrict' => $_POST["entity_restrict"], 'rand' => $_POST['rand'], 'myname' => $_POST['myname'], 'used' => $_POST['used']);
$default = "<select name='" . $_POST["myname"] . "'><option value='0'>" . Dropdown::EMPTY_VALUE . "</option></select>";
Ajax::dropdown($use_ajax, "/plugins/accounts/ajax/dropdownAccounts.php", $params, $default, $rand);
}
示例15: dropdownLicenseToInstall
/**
* Make a select box for license software to associate
*
* @param $myname select name
* @param $entity_restrict restrict to a defined entity
* @param $massiveaction is it a massiveaction select ? (default 0)
*
* @return nothing (print out an HTML select box)
**/
static function dropdownLicenseToInstall($myname, $entity_restrict, $massiveaction = 0)
{
global $CFG_GLPI;
$rand = mt_rand();
$use_ajax = false;
if ($CFG_GLPI["use_ajax"]) {
if (countElementsInTableForEntity("glpi_softwarelicenses", $entity_restrict) > $CFG_GLPI["ajax_limit_count"]) {
$use_ajax = true;
}
}
$params = array('searchText' => '__VALUE__', 'myname' => $myname, 'entity_restrict' => $entity_restrict);
$default = "<select name='{$myname}'><option value='0'>" . Dropdown::EMPTY_VALUE . " </option>\n </select>";
Ajax::dropdown($use_ajax, "/ajax/dropdownSelectSoftwareLicense.php", $params, $default, $rand);
return $rand;
}