当前位置: 首页>>代码示例>>PHP>>正文


PHP Ajax::Dropdown方法代码示例

本文整理汇总了PHP中Ajax::Dropdown方法的典型用法代码示例。如果您正苦于以下问题:PHP Ajax::Dropdown方法的具体用法?PHP Ajax::Dropdown怎么用?PHP Ajax::Dropdown使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Ajax的用法示例。


在下文中一共展示了Ajax::Dropdown方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: dropdownReferencesByEnterprise

 /**
  * Permet l'affichage dynamique d'une liste d�roulante imbriquee
  *
  * @static
  * @param array ($itemtype,$options)
  */
 public static function dropdownReferencesByEnterprise($itemtype, $options = array())
 {
     global $DB, $CFG_GLPI;
     $item = getItemForItemtype($itemtype);
     if ($itemtype && !($item = getItemForItemtype($itemtype))) {
         return false;
     }
     $table = $item->getTable();
     $params['comments'] = true;
     $params['condition'] = '';
     $params['entity'] = -1;
     $params['name'] = "reference";
     $params['value'] = 0;
     $params['entity_sons'] = false;
     $params['rand'] = mt_rand();
     $params['used'] = array();
     $params['table'] = $table;
     $params['emptylabel'] = Dropdown::EMPTY_VALUE;
     //specific
     $params['action'] = "";
     $params['itemtype'] = "";
     $params['span'] = "";
     $params['orders_id'] = 0;
     $params['suppliers_id'] = 0;
     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_autocompletion"]) {
         $nb = 0;
         $query = "SELECT COUNT(*) AS cpt\n                   FROM `{$table}` as t\n                   LEFT JOIN `glpi_plugin_order_references_suppliers` as s\n                      ON (`t`.`id` = `s`.`plugin_order_references_id`)\n                   WHERE `s`.`suppliers_id` = '{$params['suppliers_id']}'\n                   AND `t`.`itemtype` = '{$params['itemtype']}'";
         if ($item->isEntityAssign()) {
             if (!($params['entity'] < 0)) {
                 $query .= getEntitiesRestrictRequest("AND", 't', '', $params['entity'], true);
             } else {
                 $query .= getEntitiesRestrictRequest("AND", 't', '', '', true);
             }
         }
         $result = $DB->query($query);
         if ($DB->numrows($result) == 1) {
             $nb = $DB->result($result, 0, "cpt");
         }
         $nb -= count($params['used']);
         if ($nb > $CFG_GLPI["ajax_limit_count"]) {
             $use_ajax = true;
         }
     }
     $param = array('searchText' => '__VALUE__', 'value' => $params['value'], 'itemtype' => $params['itemtype'], 'myname' => $params['name'], 'limit' => $limit_length, 'comment' => $params['comments'], 'rand' => $params['rand'], 'entity_restrict' => $params['entity'], 'used' => $params['used'], 'condition' => $params['condition'], 'table' => $params['table'], 'action' => $params['action'], 'span' => $params['span'], 'orders_id' => $params['orders_id'], 'suppliers_id' => $params['suppliers_id']);
     $default = "<select name='" . $params['name'] . "' id='dropdown_" . $params['name'] . $params['rand'] . "'>";
     $default .= "<option value='" . $params['value'] . "'>{$name}</option></select>";
     Ajax::Dropdown($use_ajax, "/plugins/order/ajax/dropdownValue.php", $param, $default, $params['rand']);
     // Display comment
     if ($params['comments']) {
         $options_tooltip = array('contentid' => "comment_" . $param['myname'] . $params['rand']);
         if ($params['value'] && $item->getFromDB($params['value'])) {
             $options_tooltip['link'] = $item->getLinkURL();
             $options_tooltip['linktarget'] = '_blank';
         }
//.........这里部分代码省略.........
开发者ID:pluginsGLPI,项目名称:order,代码行数:101,代码来源:reference.class.php

示例2: Copyright

 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with GLPI; along with Order. If not, see <http://www.gnu.org/licenses/>.
 --------------------------------------------------------------------------
 @package   order
 @author    the order plugin team
 @copyright Copyright (c) 2010-2011 Order plugin team
 @license   GPLv2+
            http://www.gnu.org/licenses/gpl.txt
 @link      https://forge.indepnet.net/projects/order
 @link      http://www.glpi-project.org/
 @since     2009
 ---------------------------------------------------------------------- */
if (strpos($_SERVER['PHP_SELF'], "dropdownSupplier.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["suppliers_id"])) {
    $rand = $_POST['rand'];
    $use_ajax = false;
    if ($CFG_GLPI["use_ajax"] && countElementsInTable('glpi_suppliers', "`glpi_suppliers`.`id` = '" . $_POST["suppliers_id"] . "' " . getEntitiesRestrictRequest("AND", "glpi_suppliers", "", $_POST["entity_restrict"], true)) > $CFG_GLPI["ajax_limit_count"]) {
        $use_ajax = true;
    }
    $paramssuppliers_id = array('searchText' => '__VALUE__', 'suppliers_id' => $_POST["suppliers_id"], 'entity_restrict' => $_POST["entity_restrict"], 'rand' => $_POST['rand'], 'myname' => $_POST['myname']);
    $default = "<select name='" . $_POST["myname"] . "'><option value='0'>" . Dropdown::EMPTY_VALUE . "</option></select>";
    Ajax::Dropdown($use_ajax, "/plugins/order/ajax/dropdownContact.php", $paramssuppliers_id, $default, $rand);
}
开发者ID:geldarr,项目名称:hack-space,代码行数:31,代码来源:dropdownSupplier.php

示例3: header

the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

Domains 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 Domains. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
if (strpos($_SERVER['PHP_SELF'], "dropdownTypeDomains.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_domains_domaintypes_id"])) {
    $rand = $_POST['rand'];
    $use_ajax = false;
    $restrict = "glpi_plugin_domains_domains.plugin_domains_domaintypes_id='" . $_POST["plugin_domains_domaintypes_id"] . "' " . getEntitiesRestrictRequest("AND", "glpi_plugin_domains_domains", "", $_POST["entity_restrict"], true);
    if ($CFG_GLPI["use_ajax"] && countElementsInTable('glpi_plugin_domains_domains', $restrict) > $CFG_GLPI["ajax_limit_count"]) {
        $use_ajax = true;
    }
    $params = array('searchText' => '__VALUE__', 'plugin_domains_domaintypes_id' => $_POST["plugin_domains_domaintypes_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/domains/ajax/dropdownDomains.php", $params, $default, $rand);
}
开发者ID:geldarr,项目名称:hack-space,代码行数:31,代码来源:dropdownTypeDomains.php

示例4: header

You should have received a copy of the GNU General Public License
along with Racks. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
include '../../../inc/includes.php';
header("Content-Type: text/html; charset=UTF-8");
Html::header_nocache();
Plugin::load('racks', true);
// Make a select box
if (isset($_POST["modeltable"])) {
    // Link to user for search only > normal users
    $link = "dropdownValue.php";
    $rand = mt_rand();
    $itemtype = substr($_POST['modeltable'], 0, -5);
    $modelfield = getForeignKeyFieldForTable(getTableForItemType($_POST['modeltable']));
    $table = getTableForItemType($itemtype);
    $use_ajax = false;
    if ($CFG_GLPI["use_ajax"] && countElementsInTable($table) > $CFG_GLPI["ajax_limit_count"]) {
        $use_ajax = true;
    }
    $params = array('searchText' => '__VALUE__', 'modeltable' => $_POST["modeltable"], 'modelfield' => $modelfield, 'itemtype' => $itemtype, '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/racks/ajax/{$link}", $params, $default, $rand);
}
开发者ID:geldarr,项目名称:hack-space,代码行数:30,代码来源:dropdownAllItems.php


注:本文中的Ajax::Dropdown方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。