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


PHP Ajax::updateItem方法代码示例

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


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

示例1: showAllItems

 static function showAllItems($myname, $value_type = 0, $value = 0, $entity_restrict = -1, $types, $locations_id = -1, $action = 'showItem')
 {
     global $DB, $CFG_GLPI;
     $rand = mt_rand();
     $plugin = new Plugin();
     echo "<table border='0'><tr><td>\n";
     if ($myname == 'type') {
         $newtypes = array_flip($types);
         unset($newtypes['Location']);
         unset($newtypes['Netpoint']);
         if ($plugin->isActivated("resources")) {
             unset($newtypes['PluginResourcesResource']);
         }
         $types = array_flip($newtypes);
     }
     $rand = Dropdown::showItemTypes($myname, $types, array('emptylabel' => Dropdown::EMPTY_VALUE, 'width' => 150));
     $params = array('type' => '__VALUE__', 'value' => $value, 'myname' => $myname, 'action' => $action, 'entity_restrict' => $entity_restrict, 'locations_id' => $locations_id);
     Ajax::updateItemOnSelectEvent("dropdown_{$myname}{$rand}", "show_{$myname}{$rand}", $CFG_GLPI["root_doc"] . "/plugins/positions/ajax/dropdownAllItems.php", $params);
     echo "</td><td>\n";
     echo "<span id='show_{$myname}{$rand}'>&nbsp;</span>\n";
     echo "</td></tr></table>\n";
     if ($value > 0) {
         echo "<script type='text/javascript' >\n";
         echo "document.getElementById('item_type{$rand}').value='" . $value_type . "';";
         echo "</script>\n";
         $params["typetable"] = $value_type;
         Ajax::updateItem("show_{$myname}{$rand}", $CFG_GLPI["root_doc"] . "/plugins/positions/ajax/dropdownAllItems.php", $params);
     }
     return $rand;
 }
开发者ID:nsautier,项目名称:positions,代码行数:30,代码来源:imageitem.class.php

示例2: tabDropdown

 public function tabDropdown()
 {
     global $CFG_GLPI;
     echo "<br><span id='tabstab'>&nbsp;</span>\n";
     if ($this->fields['id'] > 0) {
         $params = array('itemtype' => $this->fields['itemtype'], 'myname' => 'tabstab', 'value' => $this->fields['tab'], 'id' => $this->fields['id']);
         Ajax::updateItem('tabstab', $CFG_GLPI["root_doc"] . "/plugins/custom/ajax/dropdowntab.php", $params);
     }
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:9,代码来源:defaulttab.class.php

示例3: showAllItems

 static function showAllItems($myname, $value_type = 0, $value = 0, $entity_restrict = -1, $types, $locations_id = -1)
 {
     global $DB, $CFG_GLPI;
     $rand = mt_rand();
     $plugin = new Plugin();
     echo "<table border='0'><tr><td>\n";
     echo "<select name='type' id='item_type{$rand}'>\n";
     echo "<option value='0;0'>" . Dropdown::EMPTY_VALUE . "</option>\n";
     if ($myname == 'type') {
         $newtypes = array_flip($types);
         unset($newtypes['Location']);
         unset($newtypes['Netpoint']);
         if ($plugin->isActivated("resources")) {
             unset($newtypes['PluginResourcesResource']);
         }
         $types = array_flip($newtypes);
     }
     foreach ($types as $type => $label) {
         $item = new $label();
         if ($myname == 'type') {
             $table = getTableForItemType($label . "Type");
         } else {
             $table = getTableForItemType($label);
         }
         echo "<option value='" . $label . ";" . $table . "'>" . $item->getTypeName() . "</option>\n";
     }
     echo "</select>";
     $params = array('typetable' => '__VALUE__', 'value' => $value, 'myname' => $myname, 'entity_restrict' => $entity_restrict, 'locations_id' => $locations_id);
     Ajax::updateItemOnSelectEvent("item_type{$rand}", "show_{$myname}{$rand}", $CFG_GLPI["root_doc"] . "/plugins/positions/ajax/dropdownAllItems.php", $params);
     echo "</td><td>\n";
     echo "<span id='show_{$myname}{$rand}'>&nbsp;</span>\n";
     echo "</td></tr></table>\n";
     if ($value > 0) {
         echo "<script type='text/javascript' >\n";
         echo "document.getElementById('item_type{$rand}').value='" . $value_type . "';";
         echo "</script>\n";
         $params["typetable"] = $value_type;
         Ajax::updateItem("show_{$myname}{$rand}", $CFG_GLPI["root_doc"] . "/plugins/positions/ajax/dropdownAllItems.php", $params);
     }
     return $rand;
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:41,代码来源:imageitem.class.php

示例4: showGenericDateTimeSearch

 /**
  * Show generic date search
  *
  * @param $element         name of the html element
  * @param $value           default value (default '')
  * @param $options   array of possible options:
  *      - with_time display with time selection ? (default false)
  *      - with_future display with future date selection ? (default false)
  *      - with_days display specific days selection TODAY, BEGINMONTH, LASTMONDAY... ? (default true)
  *
  * @return rand value of dropdown
  **/
 static function showGenericDateTimeSearch($element, $value = '', $options = array())
 {
     global $CFG_GLPI;
     $p['with_time'] = false;
     $p['with_future'] = false;
     $p['with_days'] = true;
     $p['with_specific_date'] = true;
     $p['display'] = true;
     if (is_array($options) && count($options)) {
         foreach ($options as $key => $val) {
             $p[$key] = $val;
         }
     }
     $rand = mt_rand();
     $output = '';
     // Validate value
     if ($value != 'NOW' && $value != 'TODAY' && !preg_match("/\\d{4}-\\d{2}-\\d{2}.*/", $value) && !strstr($value, 'HOUR') && !strstr($value, 'DAY') && !strstr($value, 'WEEK') && !strstr($value, 'MONTH') && !strstr($value, 'YEAR')) {
         $value = "";
     }
     if (empty($value)) {
         $value = 'NOW';
     }
     $specific_value = date("Y-m-d H:i:s");
     if (preg_match("/\\d{4}-\\d{2}-\\d{2}.*/", $value)) {
         $specific_value = $value;
         $value = 0;
     }
     $output .= "<table><tr><td>";
     $output .= "<select id='genericdate{$element}{$rand}' name='_select_{$element}'>";
     $dates = Html::getGenericDateTimeSearchItems($options);
     foreach ($dates as $key => $val) {
         $output .= "<option value='{$key}' " . ($value === $key ? 'selected' : '') . ">{$val}</option>";
     }
     $output .= "</select>";
     $output .= "</td><td>";
     $output .= "<div id='displaygenericdate{$element}{$rand}'></div>";
     $params = array('value' => '__VALUE__', 'name' => $element, 'withtime' => $p['with_time'], 'specificvalue' => $specific_value);
     $output .= Ajax::updateItemOnSelectEvent("genericdate{$element}{$rand}", "displaygenericdate{$element}{$rand}", $CFG_GLPI["root_doc"] . "/ajax/genericdate.php", $params, false);
     $params['value'] = $value;
     $output .= Ajax::updateItem("displaygenericdate{$element}{$rand}", $CFG_GLPI["root_doc"] . "/ajax/genericdate.php", $params, '', false);
     $output .= "</td></tr></table>";
     if ($p['display']) {
         echo $output;
         return $rand;
     }
     return $output;
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:59,代码来源:html.class.php

示例5: processInjection

 /**
  * @param $model        PluginDatainjectionModel object
  * @param $entities_id
  **/
 static function processInjection(PluginDatainjectionModel $model, $entities_id)
 {
     global $CFG_GLPI;
     // To prevent problem of execution time during injection
     ini_set("max_execution_time", "0");
     // Disable recording each SQL request in $_SESSION
     $CFG_GLPI["debug_sql"] = 0;
     $nblines = PluginDatainjectionSession::getParam('nblines');
     $clientinjection = new PluginDatainjectionClientInjection();
     //New injection engine
     $engine = new PluginDatainjectionEngine($model, PluginDatainjectionSession::getParam('infos'), $entities_id);
     $backend = $model->getBackend();
     $model->loadSpecificModel();
     //Open CSV file
     $backend->openFile();
     $index = 0;
     //Read CSV file
     $line = $backend->getNextLine();
     //If header is present, then get the second line
     if ($model->getSpecificModel()->isHeaderPresent()) {
         $line = $backend->getNextLine();
     }
     //While CSV file is not EOF
     $prev = '';
     $deb = time();
     while ($line != null) {
         //Inject line
         $injectionline = $index + ($model->getSpecificModel()->isHeaderPresent() ? 2 : 1);
         $clientinjection->results[] = $engine->injectLine($line[0], $injectionline);
         $pos = number_format($index * 100 / $nblines, 1);
         if ($pos != $prev) {
             $prev = $pos;
             $fin = time() - $deb;
             //TODO yllen
             Html::changeProgressBarPosition($index, $nblines, sprintf(__('%1$s (%2$s)'), sprintf(__('Injection of the file... %d%%', 'datainjection'), $pos), Html::timestampToString(time() - $deb, true)));
         }
         $line = $backend->getNextLine();
         $index++;
     }
     //EOF : change progressbar to 100% !
     Html::changeProgressBarPosition(100, 100, sprintf(__('%1$s (%2$s)'), __('Injection finished', 'datainjection'), Html::timestampToString(time() - $deb, true)));
     // Restore
     $CFG_GLPI["debug_sql"] = 1;
     //Close CSV file
     $backend->closeFile();
     //Delete CSV file
     $backend->deleteFile();
     //Change step
     $_SESSION['datainjection']['step'] = self::STEP_RESULT;
     //Display results form
     PluginDatainjectionSession::setParam('results', json_encode($clientinjection->results));
     PluginDatainjectionSession::setParam('error_lines', json_encode($engine->getLinesInError()));
     $p['models_id'] = $model->fields['id'];
     $p['nblines'] = $nblines;
     unset($_SESSION['datainjection']['go']);
     $_SESSION["MESSAGE_AFTER_REDIRECT"] = "";
     $url = $CFG_GLPI["root_doc"] . "/plugins/datainjection/ajax/results.php";
     Ajax::updateItem("span_injection", $url, $p);
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:63,代码来源:clientinjection.class.php

示例6: Copyright

 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; 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
 ---------------------------------------------------------------------- */
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::checkCentralAccess();
$rand = $_POST["rand"];
$paramsaction = array('plugin_order_references_id' => '__VALUE__', 'entity_restrict' => $_POST["entity_restrict"], 'suppliers_id' => $_POST["suppliers_id"], 'itemtype' => $_POST['itemtype']);
$fields = array("quantity", "priceht", "pricediscounted", "taxe", "validate");
foreach ($fields as $field) {
    $paramsaction['update'] = $field;
    Ajax::updateItem("show_{$field}", $CFG_GLPI["root_doc"] . "/plugins/order/ajax/referencedetail.php", $paramsaction, "dropdown_reference{$rand}");
    Ajax::updateItemOnSelectEvent("dropdown_reference{$rand}", "show_{$field}", $CFG_GLPI["root_doc"] . "/plugins/order/ajax/referencedetail.php", $paramsaction);
}
开发者ID:geldarr,项目名称:hack-space,代码行数:31,代码来源:detail.php

示例7: key

Session::checkLoginUser();
if (isset($_POST["sub_type"]) && ($rule = getItemForItemtype($_POST["sub_type"]))) {
    $criterias = $rule->getAllCriteria();
    if (count($criterias)) {
        // First include -> first of the predefined array
        if (!isset($_POST["criteria"])) {
            $_POST["criteria"] = key($criterias);
        }
        if (isset($criterias[$_POST["criteria"]]['allow_condition'])) {
            $allow_condition = $criterias[$_POST["criteria"]]['allow_condition'];
        } else {
            $allow_condition = array();
        }
        $condparam = array('criterion' => $_POST["criteria"], 'allow_conditions' => $allow_condition);
        if (isset($_POST['condition'])) {
            $condparam['value'] = $_POST['condition'];
        }
        echo "<table width='100%'><tr><td width='30%'>";
        $randcrit = RuleCriteria::dropdownConditions($_POST["sub_type"], $condparam);
        echo "</td><td>";
        echo "<span id='condition_span{$randcrit}'>\n";
        echo "</span>\n";
        $paramscriteria = array('condition' => '__VALUE__', 'criteria' => $_POST["criteria"], 'sub_type' => $_POST["sub_type"]);
        Ajax::updateItemOnSelectEvent("dropdown_condition{$randcrit}", "condition_span{$randcrit}", $CFG_GLPI["root_doc"] . "/ajax/rulecriteriavalue.php", $paramscriteria);
        if (isset($_POST['pattern'])) {
            $paramscriteria['value'] = stripslashes($_POST['pattern']);
        }
        Ajax::updateItem("condition_span{$randcrit}", $CFG_GLPI["root_doc"] . "/ajax/rulecriteriavalue.php", $paramscriteria, "dropdown_condition{$randcrit}");
        echo "</td></tr></table>";
    }
}
开发者ID:stweil,项目名称:glpi,代码行数:31,代码来源:rulecriteria.php

示例8: date

} else {
    $end = date("Y-m-d H:i:s", strtotime($begin) + HOUR_TIMESTAMP);
}
echo "<table class='tab_cadre'>";
echo "<tr class='tab_bg_2'><td>" . __('Start date') . "</td><td>";
$rand_begin = Html::showDateTimeField("plan[begin]", array('value' => $begin, 'timestep' => -1, 'maybeempty' => false, 'canedit' => true, 'mindate' => '', 'maxdate' => '', 'mintime' => $CFG_GLPI["planning_begin"], 'maxtime' => $CFG_GLPI["planning_end"]));
echo "</td></tr>\n";
echo "<tr class='tab_bg_2'><td>" . __('Period') . "&nbsp;";
if (isset($_POST["rand_user"])) {
    echo "<span id='user_available" . $_POST["rand_user"] . "'>";
    include_once GLPI_ROOT . '/ajax/planningcheck.php';
    echo "</span>";
}
echo "</td><td>";
$default_delay = floor((strtotime($end) - strtotime($begin)) / 15 / MINUTE_TIMESTAMP) * 15 * MINUTE_TIMESTAMP;
$rand = Dropdown::showTimeStamp("plan[_duration]", array('min' => 0, 'max' => 50 * HOUR_TIMESTAMP, 'value' => $default_delay, 'emptylabel' => __('Specify an end date')));
echo "<br><div id='date_end{$rand}'></div>";
$params = array('duration' => '__VALUE__', 'end' => $end, 'name' => "plan[end]", 'global_begin' => $CFG_GLPI["planning_begin"], 'global_end' => $CFG_GLPI["planning_end"]);
Ajax::updateItemOnSelectEvent("dropdown_plan[_duration]{$rand}", "date_end{$rand}", $CFG_GLPI["root_doc"] . "/ajax/planningend.php", $params);
if ($default_delay == 0) {
    $params['duration'] = 0;
    Ajax::updateItem("date_end{$rand}", $CFG_GLPI["root_doc"] . "/ajax/planningend.php", $params);
}
echo "</td></tr>\n";
if ((!isset($_POST["id"]) || $_POST["id"] == 0) && isset($_POST['itemtype']) && PlanningRecall::isAvailable()) {
    echo "<tr class='tab_bg_2'><td>" . _x('Planning', 'Reminder') . "</td><td>";
    PlanningRecall::dropdown(array('itemtype' => $_POST['itemtype'], 'items_id' => $_POST['items_id']));
    echo "</td></tr>";
}
echo "</table>\n";
Html::ajaxFooter();
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:31,代码来源:planning.php

示例9: showGenericSearch


//.........这里部分代码省略.........
                     $first_group = false;
                 }
                 echo "<optgroup label='{$val}'>";
             } else {
                 if (!isset($val['nosearch']) || $val['nosearch'] == false) {
                     echo "<option title=\"" . Html::cleanInputText($val["name"]) . "\" value='{$key}'";
                     if (is_array($p['field']) && isset($p['field'][$i]) && $key == $p['field'][$i]) {
                         echo "selected";
                         $selected = $key;
                     }
                     echo ">" . Toolbox::substr($val["name"], 0, 28) . "</option>\n";
                 }
             }
         }
         if (!$first_group) {
             echo "</optgroup>\n";
         }
         echo "<option value='all' ";
         if (is_array($p['field']) && isset($p['field'][$i]) && $p['field'][$i] == "all") {
             echo "selected";
         }
         echo ">" . __('All') . "</option>";
         echo "</select>&nbsp;\n";
         echo "</td><td class='left'>";
         echo "<div id='SearchSpan{$itemtype}{$i}'>\n";
         $_POST['itemtype'] = $itemtype;
         $_POST['num'] = $i;
         $_POST['field'] = $selected;
         $_POST['searchtype'] = is_array($p['searchtype']) && isset($p['searchtype'][$i]) ? $p['searchtype'][$i] : "";
         $_POST['value'] = is_array($p['contains']) && isset($p['contains'][$i]) ? stripslashes($p['contains'][$i]) : "";
         include GLPI_ROOT . "/ajax/searchoption.php";
         echo "</div>\n";
         $params = array('field' => '__VALUE__', 'itemtype' => $itemtype, 'num' => $i, 'value' => $_POST["value"], 'searchtype' => $_POST["searchtype"]);
         Ajax::updateItemOnSelectEvent("Search{$itemtype}{$i}", "SearchSpan{$itemtype}{$i}", $CFG_GLPI["root_doc"] . "/ajax/searchoption.php", $params, false);
         echo "</td></tr>\n";
     }
     $metanames = array();
     if (is_array($linked) && count($linked) > 0) {
         for ($i = 0; $i < $_SESSION["glpisearchcount2"][$itemtype]; $i++) {
             echo "<tr><td class='left'>";
             $rand = mt_rand();
             // Display link item (not for the first item)
             echo "<select name='link2[{$i}]'>";
             echo "<option value='AND' ";
             if (is_array($p['link2']) && isset($p['link2'][$i]) && $p['link2'][$i] == "AND") {
                 echo "selected";
             }
             echo ">AND</option>\n";
             echo "<option value='OR' ";
             if (is_array($p['link2']) && isset($p['link2'][$i]) && $p['link2'][$i] == "OR") {
                 echo "selected";
             }
             echo ">OR</option>\n";
             echo "<option value='AND NOT' ";
             if (is_array($p['link2']) && isset($p['link2'][$i]) && $p['link2'][$i] == "AND NOT") {
                 echo "selected";
             }
             echo ">AND NOT</option>\n";
             echo "<option value='OR NOT' ";
             if (is_array($p['link2']) && isset($p['link2'][$i]) && $p['link2'][$i] == "OR NOT") {
                 echo "selected";
             }
             echo ">OR NOT</option>\n";
             echo "</select>&nbsp;";
             // Display select of the linked item type available
             echo "<select name='itemtype2[{$i}]' id='itemtype2_" . $itemtype . "_" . $i . "_{$rand}'>";
开发者ID:geldarr,项目名称:hack-space,代码行数:67,代码来源:directory.class.php

示例10: isset

 case 'group':
     $name = !empty($_POST['name']) ? $_POST['name'] . '[groups_id]' : 'groups_id';
     $value = isset($_POST['users_id_validate']['groups_id']) ? $_POST['users_id_validate']['groups_id'] : $_POST['groups_id'];
     $rand = Group::dropdown(array('name' => $name, 'value' => $value, 'entity' => $_POST["entity"]));
     $param = array('validatortype' => 'list_users');
     $param['name'] = !empty($_POST['name']) ? $_POST['name'] : '';
     $param['users_id_validate'] = isset($_POST['users_id_validate']) ? $_POST['users_id_validate'] : '';
     $param['right'] = $_POST['right'];
     $param['entity'] = $_POST["entity"];
     $param['groups_id'] = '__VALUE__';
     Ajax::updateItemOnSelectEvent("dropdown_{$name}{$rand}", "show_list_users", $CFG_GLPI["root_doc"] . "/ajax/dropdownValidator.php", $param);
     if ($value) {
         $param['validatortype'] = 'list_users';
         $param['groups_id'] = $value;
         unset($param['users_id_validate']['groups_id']);
         Ajax::updateItem('show_list_users', $CFG_GLPI["root_doc"] . "/ajax/dropdownValidator.php", $param);
     }
     echo "<br><span id='show_list_users'>&nbsp;</span>\n";
     break;
 case 'list_users':
     if (isset($_POST['users_id_validate']['groups_id'])) {
         $_POST['users_id_validate'] = array();
     }
     $opt = array('groups_id' => $_POST["groups_id"], 'right' => $_POST['right'], 'entity' => $_POST["entity"]);
     $data_users = TicketValidation::getGroupUserHaveRights($opt);
     $users = array();
     $param['values'] = array();
     $values = array();
     if (isset($_POST['users_id_validate']) && is_array($_POST['users_id_validate'])) {
         $values = $_POST['users_id_validate'];
     }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:31,代码来源:dropdownValidator.php

示例11: showAllItems

 /**
  * Make a select box for all items
  *
  * @param $myname          select name
  * @param $value_type      default value for the device type (default 0)
  * @param $value           default value (default 0)
  * @param $entity_restrict Restrict to a defined entity (default -1)
  * @param $types           Types used (default '')
  * @param $onlyglobal      Restrict to global items (false by default)
  * @param $checkright      Restrict to items with read rights (false by default)
  * @param $itemtypename    name used for itemtype select
  *
  * @return nothing (print out an HTML select box)
  **/
 static function showAllItems($myname, $value_type = 0, $value = 0, $entity_restrict = -1, $types = '', $onlyglobal = false, $checkright = false, $itemtypename = 'itemtype')
 {
     global $CFG_GLPI;
     $options = array();
     $options['checkright'] = $checkright;
     $options['name'] = $itemtypename;
     $rand = self::showItemType($types, $options);
     if ($rand) {
         $params = array('idtable' => '__VALUE__', 'value' => $value, 'myname' => $myname, 'entity_restrict' => $entity_restrict);
         if ($onlyglobal) {
             $params['condition'] = "`is_global` = '1'";
         }
         Ajax::updateItemOnSelectEvent("itemtype{$rand}", "show_{$myname}{$rand}", $CFG_GLPI["root_doc"] . "/ajax/dropdownAllItems.php", $params);
         echo "<br><span id='show_{$myname}{$rand}'>&nbsp;</span>\n";
         if ($value > 0) {
             echo "<script type='text/javascript' >\n";
             echo "window.document.getElementById('itemtype{$rand}').value='" . $value_type . "';";
             echo "</script>\n";
             $params["idtable"] = $value_type;
             Ajax::updateItem("show_{$myname}{$rand}", $CFG_GLPI["root_doc"] . "/ajax/dropdownAllItems.php", $params);
         }
     }
     return $rand;
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:38,代码来源:dropdown.class.php

示例12: showAllItems

 function showAllItems($myname, $value_type = 0, $value = 0, $entity_restrict = -1)
 {
     global $DB, $CFG_GLPI;
     $types = array('Computer', 'NetworkEquipment', 'Peripheral', 'Phone', 'Printer');
     $rand = mt_rand();
     echo "<table border='0'><tr><td>\n";
     echo "<select name='type' id='item_type{$rand}'>\n";
     echo "<option value='0;0'>" . Dropdown::EMPTY_VALUE . "</option>\n";
     foreach ($types as $type => $label) {
         $item = new $label();
         echo "<option value='" . $label . ";" . getTableForItemType($label . "Type") . "'>" . $item->getTypeName() . "</option>\n";
     }
     echo "</select>";
     $params = array('typetable' => '__VALUE__', 'value' => $value, 'myname' => $myname, 'entity_restrict' => $entity_restrict);
     Ajax::updateItemOnSelectEvent("item_type{$rand}", "show_{$myname}{$rand}", $CFG_GLPI["root_doc"] . "/plugins/archires/ajax/dropdownAllItems.php", $params);
     echo "</td><td>\n";
     echo "<span id='show_{$myname}{$rand}'>&nbsp;</span>\n";
     echo "</td></tr></table>\n";
     if ($value > 0) {
         echo "<script type='text/javascript' >\n";
         echo "document.getElementById('item_type{$rand}').value='" . $value_type . "';";
         echo "</script>\n";
         $params["typetable"] = $value_type;
         Ajax::updateItem("show_{$myname}{$rand}", $CFG_GLPI["root_doc"] . "/plugins/archires/ajax/dropdownAllItems.php", $params);
     }
     return $rand;
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:27,代码来源:archires.class.php

示例13: explode

Html::header_nocache();
// Make a select box
if (isset($_POST["typetable"])) {
    $test = explode(";", $_POST['typetable']);
    $itemtype = $test[0];
    $table = $test[1];
    if (!empty($table)) {
        // 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"], 'locations_id' => $_POST["locations_id"]);
        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/positions/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::updateItem("results_{$rand}", $CFG_GLPI["root_doc"] . "/plugins/positions/ajax/dropdownValue.php", $params);
        }
    }
}
开发者ID:geldarr,项目名称:hack-space,代码行数:31,代码来源:dropdownAllItems.php

示例14: dropdownFields

 /**
  * @param $options   array
  **/
 static function dropdownFields($options = array())
 {
     global $CFG_GLPI;
     $used = array();
     $p['itemtype'] = self::NO_VALUE;
     $p['primary_type'] = '';
     $p['mapping_or_info'] = array();
     $p['called_by'] = '';
     $p['need_decode'] = true;
     $p['fields_update'] = true;
     foreach ($options as $key => $value) {
         $p[$key] = $value;
     }
     if ($p['need_decode']) {
         $mapping_or_info = json_decode(Toolbox::stripslashes_deep($options['mapping_or_info']), true);
     } else {
         $mapping_or_info = $options['mapping_or_info'];
     }
     $fields = array();
     $fields[self::NO_VALUE] = __('-------Choose a field-------', 'datainjection');
     //By default field has no default value
     $mapping_value = self::NO_VALUE;
     if ($p['itemtype'] != self::NO_VALUE) {
         //If a value is still present for this mapping
         if ($mapping_or_info['value'] != self::NO_VALUE) {
             $mapping_value = $mapping_or_info['value'];
         }
         $injectionClass = PluginDatainjectionCommonInjectionLib::getInjectionClassInstance($p['itemtype']);
         foreach ($injectionClass->getOptions($p['primary_type']) as $option) {
             //If it's a real option (not a group label) and if field is not blacklisted
             //and if a linkfield is defined (meaning that the field can be updated)
             if (is_array($option) && isset($option['injectable']) && $option['injectable'] == PluginDatainjectionCommonInjectionLib::FIELD_INJECTABLE) {
                 $fields[$option['linkfield']] = $option['name'];
                 if ($mapping_value == self::NO_VALUE && $p['called_by'] == 'PluginDatainjectionMapping' && self::isEqual($option, $mapping_or_info)) {
                     $mapping_value = $option['linkfield'];
                 }
             }
         }
         $used = self::getUsedMappingsOrInfos($p);
     }
     asort($fields);
     $rand = Dropdown::showFromArray("data[" . $mapping_or_info['id'] . "][value]", $fields, array('value' => $mapping_value, 'used' => $used));
     $url = $CFG_GLPI["root_doc"] . "/plugins/datainjection/ajax/dropdownMandatory.php";
     Ajax::updateItem("span_mandatory_" . $mapping_or_info['id'], $url, $p, "dropdown_data[" . $mapping_or_info['id'] . "][value]{$rand}");
     Ajax::updateItemOnSelectEvent("dropdown_data[" . $mapping_or_info['id'] . "][value]{$rand}", "span_mandatory_" . $mapping_or_info['id'], $url, $p);
 }
开发者ID:JULIO8,项目名称:respaldo_glpi,代码行数:49,代码来源:injectiontype.class.php

示例15: showAddEventClassicForm

 /**
  * Former front/planning.php before 9.1.
  * Display a classic form to plan an event (with begin fiel and duration)
  *
  * @since 9.1
  *
  * @param $params (array): array of parameters whou should contain :
  *   - id (integer): id of item who receive the planification
  *   - itemtype (string): itemtype of item who receive the planification
  *   - begin (string) : start date of event
  *   - end (optionnal) (string) : end date of event. Ifg missing, it will computerd from begin+1hour
  *   - rand_user (integer) : users_id to check planning avaibility
  */
 static function showAddEventClassicForm($params = array())
 {
     global $CFG_GLPI;
     if (isset($params["id"]) && $params["id"] > 0) {
         echo "<input type='hidden' name='plan[id]' value='" . $params["id"] . "'>";
     }
     $mintime = $CFG_GLPI["planning_begin"];
     if (isset($params["begin"]) && !empty($params["begin"])) {
         $begin = $params["begin"];
         $begintime = date("H:i:s", strtotime($begin));
         if ($begintime < $mintime) {
             $mintime = $begintime;
         }
     } else {
         $ts = $CFG_GLPI['time_step'] * 60;
         // passage en minutes
         $time = time() + $ts - 60;
         $time = floor($time / $ts) * $ts;
         $begin = date("Y-m-d H:i", $time);
     }
     if (isset($params["end"]) && !empty($params["end"])) {
         $end = $params["end"];
     } else {
         $end = date("Y-m-d H:i:s", strtotime($begin) + HOUR_TIMESTAMP);
     }
     echo "<table class='tab_cadre'>";
     echo "<tr class='tab_bg_2'><td>" . __('Start date') . "</td><td>";
     $rand_begin = Html::showDateTimeField("plan[begin]", array('value' => $begin, 'timestep' => -1, 'maybeempty' => false, 'canedit' => true, 'mindate' => '', 'maxdate' => '', 'mintime' => $mintime, 'maxtime' => $CFG_GLPI["planning_end"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_2'><td>" . __('Period') . "&nbsp;";
     if (isset($params["rand_user"])) {
         echo "<span id='user_available" . $params["rand_user"] . "'>";
         include_once GLPI_ROOT . '/ajax/planningcheck.php';
         echo "</span>";
     }
     echo "</td><td>";
     $default_delay = floor((strtotime($end) - strtotime($begin)) / 15 / MINUTE_TIMESTAMP) * 15 * MINUTE_TIMESTAMP;
     $rand = Dropdown::showTimeStamp("plan[_duration]", array('min' => 0, 'max' => 50 * HOUR_TIMESTAMP, 'value' => $default_delay, 'emptylabel' => __('Specify an end date')));
     echo "<br><div id='date_end{$rand}'></div>";
     $event_options = array('duration' => '__VALUE__', 'end' => $end, 'name' => "plan[end]", 'global_begin' => $CFG_GLPI["planning_begin"], 'global_end' => $CFG_GLPI["planning_end"]);
     Ajax::updateItemOnSelectEvent("dropdown_plan[_duration]{$rand}", "date_end{$rand}", $CFG_GLPI["root_doc"] . "/ajax/planningend.php", $event_options);
     if ($default_delay == 0) {
         $params['duration'] = 0;
         Ajax::updateItem("date_end{$rand}", $CFG_GLPI["root_doc"] . "/ajax/planningend.php", $params);
     }
     echo "</td></tr>\n";
     if ((!isset($params["id"]) || $params["id"] == 0) && isset($params['itemtype']) && PlanningRecall::isAvailable()) {
         echo "<tr class='tab_bg_2'><td>" . _x('Planning', 'Reminder') . "</td><td>";
         PlanningRecall::dropdown(array('itemtype' => $params['itemtype'], 'items_id' => $params['items_id']));
         echo "</td></tr>";
     }
     echo "</table>\n";
 }
开发者ID:korial29,项目名称:glpi,代码行数:66,代码来源:planning.class.php


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