本文整理汇总了PHP中Ajax::updateItemOnEvent方法的典型用法代码示例。如果您正苦于以下问题:PHP Ajax::updateItemOnEvent方法的具体用法?PHP Ajax::updateItemOnEvent怎么用?PHP Ajax::updateItemOnEvent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ajax
的用法示例。
在下文中一共展示了Ajax::updateItemOnEvent方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getListSection
static function getListSection($formID)
{
global $LANG, $CFG_GLPI;
$section = new self();
$listSection = $section->find("plugin_formcreator_forms_id = '{$formID}' ORDER BY position");
if (!empty($listSection)) {
echo '<div class="center">';
echo '<table class="tab_cadrehov" border="0" >';
echo '<th width="20">';
echo 'ID';
echo '</th>';
echo '<th>';
echo $LANG['plugin_formcreator']["section"][3];
echo '</th>';
echo '<th>';
echo $LANG['plugin_formcreator']["target"][2];
echo '</th>';
echo '<th>';
echo $LANG['plugin_formcreator']["question"][11];
echo '</th>';
foreach ($listSection as $section_id => $values) {
echo '<tr>';
echo '<td class="center">';
echo $section_id;
echo '</td>';
echo '<td>';
echo '<a id="section' . $section_id . '">' . $values['name'] . '</a>';
echo '</td>';
echo '<td>';
echo PluginFormcreatorTarget::getTargetName($values['plugin_formcreator_targets_id']);
echo '</td>';
echo '<td class="center">';
echo $values['position'];
echo '</td>';
echo '</tr>';
}
echo '</table>';
echo '</div>';
foreach ($listSection as $section_id => $values) {
Ajax::updateItemOnEvent('section' . $section_id, 'editSection', $CFG_GLPI["root_doc"] . '/plugins/formcreator/ajax/vieweditobject.php', array('id' => $section_id, 'type' => __CLASS__), array('click'));
}
echo '<br /><div id="editSection"></div>';
}
}
示例2: displayDropdownType
static function displayDropdownType($config, $request_data, $rand, $mode)
{
global $CFG_GLPI;
/*
* Build dropdown options
*/
$dropdown_options['rand'] = $rand;
if ($mode === 'edit') {
$dropdown_options['value'] = $config['type'];
$dropdown_options['readonly'] = true;
}
/*
* Build actions types list
*/
$file_types = self::getTypes();
array_unshift($file_types, "---");
/*
* Display dropdown html
*/
$style = "";
if (isset($datas['edit'])) {
$style = "style='display:none'";
}
echo "<table class='package_item' {$style}>";
echo "<tr>";
echo "<th>" . __("Source", 'fusioninventory') . "</th>";
echo "<td>";
Dropdown::showFromArray("deploy_filetype", $file_types, $dropdown_options);
echo "</td>";
echo "</tr></table>";
//ajax update of file value span
if ($mode === 'create') {
$params = array('value' => '__VALUE__', 'rand' => $rand, 'myname' => 'method', 'type' => "file", 'mode' => $mode);
Ajax::updateItemOnEvent("dropdown_deploy_filetype" . $rand, "show_file_value{$rand}", $CFG_GLPI["root_doc"] . "/plugins/fusioninventory/" . "ajax/deploy_displaytypevalue.php", $params, array("change", "load"));
}
}
示例3: getListTitle
static function getListTitle($formID)
{
global $LANG, $CFG_GLPI;
$title = new self();
$listTitle = $title->find();
if (!empty($listTitle)) {
echo '<div class="center">';
echo '<table class="tab_cadrehov" border="0" >';
echo '<th width="20">';
echo 'ID';
echo '</th>';
echo '<th>';
echo $LANG['plugin_formcreator']["title"][2];
echo '</th>';
foreach ($listTitle as $title_id => $values) {
echo '<tr>';
echo '<td class="center">';
echo '<a id="id' . $title_id . '">' . $title_id . '</a>';
echo '</td>';
echo '<td>';
echo '<a id="lang' . $title_id . '">' . $values['language'] . '</a>';
echo '</td>';
echo '</tr>';
}
echo '</table>';
echo '</div>';
foreach ($listTitle as $title_id => $values) {
Ajax::updateItemOnEvent('lang' . $title_id, 'editTitle', $CFG_GLPI["root_doc"] . '/plugins/formcreator/ajax/vieweditobject.php', array('id' => $title_id, 'type' => __CLASS__), array('click'));
}
echo '<br /><div id="editTitle"></div>';
}
}
示例4: showFormHelpdeskObserver
/**
* Display a single oberver selector
*
* * @param $options array options for default values ($options of showActorAddFormOnCreate)
**/
static function showFormHelpdeskObserver($options = array())
{
global $CFG_GLPI;
//default values
$ticket = new Ticket();
$params['_users_id_observer_notif']['use_notification'] = true;
$params['_users_id_observer'] = 0;
$params['entities_id'] = $_SESSION["glpiactive_entity"];
$values['_right'] = "groups";
// overide default value by function parameters
if (is_array($options) && count($options)) {
foreach ($options as $key => $val) {
$params[$key] = $val;
}
}
// add a user selector
$rand_observer = $ticket->showActorAddFormOnCreate(CommonITILActor::OBSERVER, $params);
// add an additionnal observer on user selection
Ajax::updateItemOnSelectEvent("dropdown__users_id_observer[]{$rand_observer}", "observer_{$rand_observer}", $CFG_GLPI["root_doc"] . "/ajax/helpdesk_observer.php", $params);
//remove 'new observer' anchor on user selection
echo Html::scriptBlock("\n \$('#dropdown__users_id_observer__{$rand_observer}').on('change', function(event) {\n \$('#addObserver{$rand_observer}').remove();\n });");
// add "new observer" anchor
echo "<a id='addObserver{$rand_observer}' class='add-observer' onclick='this.remove()'>";
echo Html::image($CFG_GLPI['root_doc'] . "/pics/meta_plus.png", array('alt' => __('Add')));
echo "</a>";
// add an additionnal observer on anchor click
Ajax::updateItemOnEvent("addObserver{$rand_observer}", "observer_{$rand_observer}", $CFG_GLPI["root_doc"] . "/ajax/helpdesk_observer.php", $params, array('click'));
// div for an additionnal observer
echo "<div class='actor_single' id='observer_{$rand_observer}'></div>";
}
示例5: array
$param['values'] = array();
foreach ($groups_users as $data) {
$users[$data['id']] = formatUserName($data['id'], $data['name'], $data['realname'], $data['firstname']);
}
if (isset($_POST['all_users']) && $_POST['all_users']) {
$param['values'] = array_keys($users);
}
$param['multiple'] = true;
$param['display'] = true;
$param['size'] = count($users);
Dropdown::showFromArray("users_id_validate", $users, $param);
// Display all/none buttons to select all or no users in group
if (!empty($_POST['groups_id'])) {
echo "<a id='all_users' class='vsubmit'>" . __('All') . "</a>";
$param_button['validatortype'] = 'group_user';
$param_button['users_id_validate'] = '';
$param_button['all_users'] = 1;
$param_button['groups_id'] = $_POST['groups_id'];
$param_button['right'] = array('validate_request', 'validate_incident');
$param_button['entity'] = $_SESSION["glpiactive_entity"];
Ajax::updateItemOnEvent('all_users', 'show_groups_users', $CFG_GLPI["root_doc"] . "/ajax/dropdownMassiveActionAddValidator.php", $param_button, array('click'));
echo " <a id='no_users' class='vsubmit'>" . __('None') . "</a>";
$param_button['all_users'] = 0;
Ajax::updateItemOnEvent('no_users', 'show_groups_users', $CFG_GLPI["root_doc"] . "/ajax/dropdownMassiveActionAddValidator.php", $param_button, array('click'));
}
echo "<br><br>" . __('Comments') . " ";
echo "<textarea name='comment_submission' cols='50' rows='6'></textarea> ";
echo "<input type='submit' name='add' value=\"" . _sx('button', 'Add') . "\" class='submit'>";
break;
}
}
示例6: array_keys
if (in_array($data['id'], $values)) {
$param['values'][] = $data['id'];
}
}
// Display all users
if (isset($_POST['all_users']) && $_POST['all_users']) {
$param['values'] = array_keys($users);
}
$param['multiple'] = true;
$param['display'] = true;
$param['size'] = count($users);
$users = Toolbox::stripslashes_deep($users);
$rand = Dropdown::showFromArray(!empty($_POST['name']) ? $_POST['name'] : 'users_id_validate', $users, $param);
// Display all/none buttons to select all or no users in group
if (!empty($_POST['groups_id'])) {
echo "<br><br><a id='all_users' class='vsubmit'>" . __('All') . "</a>";
$param_button['validatortype'] = 'list_users';
$param_button['name'] = !empty($_POST['name']) ? $_POST['name'] : '';
$param_button['users_id_validate'] = '';
$param_button['all_users'] = 1;
$param_button['groups_id'] = $_POST['groups_id'];
$param_button['entity'] = $_POST['entity'];
$param_button['right'] = $_POST['right'];
Ajax::updateItemOnEvent('all_users', 'show_list_users', $CFG_GLPI["root_doc"] . "/ajax/dropdownValidator.php", $param_button, array('click'));
echo " <a id='no_users' class='vsubmit'>" . __('None') . "</a>";
$param_button['all_users'] = 0;
Ajax::updateItemOnEvent('no_users', 'show_list_users', $CFG_GLPI["root_doc"] . "/ajax/dropdownValidator.php", $param_button, array('click'));
}
break;
}
}
示例7: showForm
/**
*
*
* @param $items_id integer ID
* @param $options array
*
*@return bool true if form is ok
*
**/
function showForm($items_id, $itemtype, $options = array())
{
global $DB, $CFG_GLPI;
$query = "SELECT * FROM `" . $this->getTable() . "`\n WHERE `items_id`='" . $items_id . "'\n AND `itemtype`='" . $itemtype . "'\n LIMIT 1";
$result = $DB->query($query);
if ($DB->numrows($result) == '0') {
$this->getEmpty();
} else {
$data = $DB->fetch_assoc($result);
$this->getFromDB($data['id']);
}
$this->showFormHeader($options);
echo "<tr class='tab_bg_1'>";
echo "<td width='350'>" . __('Interface and IP to use for checks (only if have many IPs)', 'monitoring') . " :</td>";
echo "<td>";
echo "<input type='hidden' name='itemtype' value='" . $itemtype . "'/>";
echo "<input type='hidden' name='items_id' value='" . $items_id . "'/>";
if ($this->fields['networkports_id'] == '') {
$this->fields['networkports_id'] = 0;
}
$a_networkport = array();
$a_networkport['0'] = Dropdown::EMPTY_VALUE;
$query = "SELECT `glpi_networkports`.* FROM `glpi_networkports`\n LEFT JOIN `glpi_networknames`\n ON `glpi_networknames`.`items_id`=`glpi_networkports`.`id`\n AND `glpi_networknames`.`itemtype`='NetworkPort'\n LEFT JOIN `glpi_ipaddresses`\n ON `glpi_ipaddresses`.`items_id`=`glpi_networknames`.`id`\n AND `glpi_ipaddresses`.`itemtype`='NetworkName'\n WHERE `glpi_networkports`.`items_id`='" . $items_id . "'\n AND `glpi_networkports`.`itemtype`='" . $itemtype . "'\n AND `glpi_ipaddresses`.`name` IS NOT NULL\n AND `glpi_ipaddresses`.`name` != '127.0.0.1'\n AND `glpi_ipaddresses`.`name` != '::1'\n AND `glpi_ipaddresses`.`name` != ''\n ORDER BY `name`";
$result = $DB->query($query);
while ($data = $DB->fetch_array($result)) {
$a_networkport[$data['id']] = $data['name'];
}
$rand = Dropdown::showFromArray("networkports_id", $a_networkport, array('value' => $this->fields['networkports_id']));
echo "</td>";
echo "<td colspan='2'>";
// Specify ip address or 'first ip address'
$params = array('networkports_id' => '__VALUE__', 'rand' => $rand, 'ipaddresses_id' => $this->fields['ipaddresses_id']);
Ajax::updateItemOnEvent("dropdown_networkports_id" . $rand, "ipaddresses", $CFG_GLPI["root_doc"] . "/plugins/monitoring/ajax/dropdownipaddress.php", $params);
echo "<div id='ipaddresses'>";
PluginMonitoringHostaddress::dropdownIP($this->fields['ipaddresses_id'], $this->fields['networkports_id']);
echo "</div>";
echo "</td>";
echo "</tr>";
$this->showFormButtons($options);
return true;
}
示例8: showForm
function showForm($id, $options = array())
{
global $CFG_GLPI;
if ($id != '') {
$this->getFromDB($id);
} else {
$this->getEmpty();
}
$this->showTabs($options);
$this->showFormHeader($options);
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Name') . " :</td>";
echo "<td align='center'>";
Html::autocompletionTextField($this, 'name', array('size' => 40));
echo "</td>";
echo "<td rowspan='2' class='middle right'>" . __('Comments') . " : </td>";
echo "<td class='center middle' rowspan='2'><textarea cols='45'\n rows='4' name='comment' >" . $this->fields["comment"] . "</textarea></td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Mirror server address', 'fusioninventory') . " :</td>";
echo "<td align='center'>";
Html::autocompletionTextField($this, 'url', array('size' => 40));
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Mirror location', 'fusioninventory') . " :</td>";
echo "<td align='center'>";
echo "<script type='text/javascript'>\n";
echo "document.getElementsByName('is_recursive')[0].id = 'is_recursive';\n";
echo "</script>";
$params = array('is_recursive' => '__VALUE__', 'id' => $id);
Ajax::updateItemOnEvent('is_recursive', "displaydropdownlocation", $CFG_GLPI["root_doc"] . "/plugins/fusioninventory/ajax/dropdownlocation.php", $params);
echo "<div id='displaydropdownlocation'>";
// Location option
Location::dropdown(array('value' => $this->fields["locations_id"], 'entity' => $this->fields["entities_id"], 'entity_sons' => $this->isRecursive()));
echo "</div>";
echo "</td></tr>";
$this->showFormButtons($options);
echo "<div id='tabcontent'></div>";
echo "<script type='text/javascript'>loadDefaultTab();\n </script>";
return TRUE;
}
示例9: dropdownvalue
/**
* Display definitions value with preselection of definition type
*
* @param $myname value name of dropdown
* @param $definitiontype value name of the definition type selected
* @param $method value name of the method selected
* @param $deftypeid value dropdown name of definition type
* @param $value value name of the definition (used for edit taskjob)
* @param $entity_restrict restriction of entity if required
*
* @return value rand of the dropdown
*
**/
function dropdownvalue($myname, $definitiontype, $method, $deftypeid, $taskjobs_id, $value = 0, $entity_restrict = '', $title = 0)
{
global $CFG_GLPI;
$a_methods = PluginFusioninventoryStaticmisc::getmethods();
$module = '';
foreach ($a_methods as $datas) {
if ($method == $datas['method']) {
$module = $datas['module'];
}
}
$rand = '';
$class = PluginFusioninventoryStaticmisc::getStaticMiscClass($module);
$iddropdown = '';
if (is_callable(array($class, "task_" . $_POST['name'] . "selection_" . $definitiontype . "_" . $method))) {
$rand = call_user_func(array($class, "task_" . $_POST['name'] . "selection_" . $definitiontype . "_" . $method), $title);
$iddropdown = "dropdown_" . $_POST['name'] . "selectiontoadd";
} else {
$a_data = $this->get_agents($method);
$rand = Dropdown::showFromArray($_POST['name'] . 'selectiontoadd', $a_data);
$iddropdown = "dropdown_" . $_POST['name'] . "selectiontoadd";
}
echo "<br/><center><input type='button' id='add_button_" . $_POST['name'] . $taskjobs_id . "' " . "name='add_button_" . $_POST['name'] . "' value=\"" . __('Add') . "\" class='submit'></center>";
$params = array('items_id' => '__VALUE0__', 'add_button_' . $_POST['name'] . $taskjobs_id => '__VALUE1__', 'itemtype' => $definitiontype, 'rand' => $rand, 'myname' => 'items_id', 'type' => $_POST['name'], 'taskjobs_id' => $taskjobs_id);
Ajax::updateItemOnEvent(array($iddropdown . $rand, "add_button_" . $_POST['name'] . $taskjobs_id), "Additem_{$rand}", $CFG_GLPI["root_doc"] . "/plugins/fusioninventory/ajax/taskjobaddtype.php", $params, array("click"), "-1", "-1", array(__('Add')));
echo "<span id='Additem_{$rand}'></span>";
}
示例10: getNextValueEdit
static function getNextValueEdit($valueId)
{
global $LANG, $CFG_GLPI;
Ajax::updateItemOnEvent('addField' . $valueId, 'nextValue' . $valueId, $CFG_GLPI["root_doc"] . '/plugins/formcreator/ajax/addnewvalue.php', array('id' => $valueId), array('click'));
echo '<div id="nextValue' . $valueId . '">';
echo '<input class="submit" type="button" id="addField' . $valueId . '"
value="' . $LANG['plugin_formcreator']["question"][6] . '">';
echo '</div>';
}
示例11: getListCat
static function getListCat($formID)
{
global $LANG, $CFG_GLPI;
$cat = new self();
$listCat = $cat->find(" 1 ORDER BY position");
if (!empty($listCat)) {
echo '<div class="center">';
echo '<table class="tab_cadrehov" border="0" >';
echo '<th width="20">';
echo 'ID';
echo '</th>';
echo '<th>';
echo $LANG['plugin_formcreator']["cat"][1];
echo '</th>';
echo '<th>';
echo $LANG['plugin_formcreator']["cat"][2];
echo '</th>';
foreach ($listCat as $cat_id => $values) {
echo '<tr>';
echo '<td class="center">';
echo $cat_id;
echo '</td>';
echo '<td>';
echo '<a id="cat' . $cat_id . '">' . $values['name'] . '</a>';
echo '</td>';
echo '<td>';
echo '<center>' . $values['position'] . '</center>';
echo '</td>';
echo '</tr>';
}
echo '</table>';
echo '</div>';
foreach ($listCat as $cat_id => $values) {
Ajax::updateItemOnEvent('cat' . $cat_id, 'editCat', $CFG_GLPI["root_doc"] . '/plugins/formcreator/ajax/vieweditobject.php', array('id' => $cat_id, 'type' => __CLASS__), array('click'));
}
echo '<br /><div id="editCat"></div>';
}
}