本文整理汇总了PHP中Ajax::UpdateItemOnSelectEvent方法的典型用法代码示例。如果您正苦于以下问题:PHP Ajax::UpdateItemOnSelectEvent方法的具体用法?PHP Ajax::UpdateItemOnSelectEvent怎么用?PHP Ajax::UpdateItemOnSelectEvent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ajax
的用法示例。
在下文中一共展示了Ajax::UpdateItemOnSelectEvent方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showFormHelpdesk
/**
* Print the helpdesk form
*
* @param $ID integer ID of the user who want to display the Helpdesk
* @param $ticket_template boolean ticket template for preview : false if not used for preview
* (false by default)
*
* @return nothing (print the helpdesk)
**/
function showFormHelpdesk($ID, $ticket_template = false)
{
global $DB, $CFG_GLPI;
if (!self::canCreate()) {
return false;
}
if (!$ticket_template && Session::haveRightsOr('ticketvalidation', TicketValidation::getValidateRights())) {
$opt = array();
$opt['reset'] = 'reset';
$opt['criteria'][0]['field'] = 55;
// validation status
$opt['criteria'][0]['searchtype'] = 'equals';
$opt['criteria'][0]['value'] = CommonITILValidation::WAITING;
$opt['criteria'][0]['link'] = 'AND';
$opt['criteria'][1]['field'] = 59;
// validation aprobator
$opt['criteria'][1]['searchtype'] = 'equals';
$opt['criteria'][1]['value'] = Session::getLoginUserID();
$opt['criteria'][1]['link'] = 'AND';
$url_validate = $CFG_GLPI["root_doc"] . "/front/ticket.php?" . Toolbox::append_params($opt, '&');
if (TicketValidation::getNumberToValidate(Session::getLoginUserID()) > 0) {
echo "<a href='{$url_validate}' title=\"" . __s('Ticket waiting for your approval') . "\"\n alt=\"" . __s('Ticket waiting for your approval') . "\">" . __('Tickets awaiting approval') . "</a><br><br>";
}
}
$email = UserEmail::getDefaultForUser($ID);
$default_use_notif = Entity::getUsedConfig('is_notif_enable_default', $_SESSION['glpiactive_entity'], '', 1);
// Set default values...
$default_values = array('_users_id_requester_notif' => array('use_notification' => $email == "" ? 0 : $default_use_notif), 'nodelegate' => 1, '_users_id_requester' => 0, '_users_id_observer' => array(0), '_users_id_observer_notif' => array('use_notification' => $default_use_notif), 'name' => '', 'content' => '', 'itilcategories_id' => 0, 'locations_id' => 0, 'urgency' => 3, 'items_id' => 0, 'entities_id' => $_SESSION['glpiactive_entity'], 'plan' => array(), 'global_validation' => CommonITILValidation::NONE, '_add_validation' => 0, 'type' => Entity::getUsedConfig('tickettype', $_SESSION['glpiactive_entity'], '', Ticket::INCIDENT_TYPE), '_right' => "id", '_filename' => array(), '_tag_filename' => array());
// Get default values from posted values on reload form
if (!$ticket_template) {
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;
}
}
}
// Check category / type validity
if ($values['itilcategories_id']) {
$cat = new ITILCategory();
if ($cat->getFromDB($values['itilcategories_id'])) {
switch ($values['type']) {
case self::INCIDENT_TYPE:
if (!$cat->getField('is_incident')) {
$values['itilcategories_id'] = 0;
}
break;
case self::DEMAND_TYPE:
if (!$cat->getField('is_request')) {
$values['itilcategories_id'] = 0;
}
break;
default:
break;
}
}
}
if (!$ticket_template) {
echo "<form method='post' name='helpdeskform' action='" . $CFG_GLPI["root_doc"] . "/front/tracking.injector.php' enctype='multipart/form-data'>";
}
$delegating = User::getDelegateGroupsForUser($values['entities_id']);
if (count($delegating)) {
echo "<div class='center'><table class='tab_cadre_fixe'>";
echo "<tr><th colspan='2'>" . __('This ticket concerns me') . " ";
$rand = Dropdown::showYesNo("nodelegate", $values['nodelegate']);
$params = array('nodelegate' => '__VALUE__', 'rand' => $rand, 'right' => "delegate", '_users_id_requester' => $values['_users_id_requester'], '_users_id_requester_notif' => $values['_users_id_requester_notif'], 'use_notification' => $values['_users_id_requester_notif']['use_notification'], 'entity_restrict' => $_SESSION["glpiactive_entity"]);
Ajax::UpdateItemOnSelectEvent("dropdown_nodelegate" . $rand, "show_result" . $rand, $CFG_GLPI["root_doc"] . "/ajax/dropdownDelegationUsers.php", $params);
$class = 'right';
if ($CFG_GLPI['use_check_pref'] && $values['nodelegate']) {
echo "</th><th>" . __('Check your personnal information');
$class = 'center';
}
echo "</th></tr>";
echo "<tr class='tab_bg_1'><td colspan='2' class='" . $class . "'>";
echo "<div id='show_result{$rand}'>";
$self = new self();
if ($values["_users_id_requester"] == 0) {
$values['_users_id_requester'] = Session::getLoginUserID();
} else {
$values['_right'] = "delegate";
}
$self->showActorAddFormOnCreate(CommonITILActor::REQUESTER, $values);
echo "</div>";
//.........这里部分代码省略.........
示例2: getHelpdesk
/**
* clone of function Ticket::showFormHelpdesk()
*/
static function getHelpdesk($ID = 0, $ticket_template = false)
{
global $DB, $CFG_GLPI;
// * Added by plugin survey ticket
$ticket = new Ticket();
// * End of adding
if (!Session::haveRight("create_ticket", "1")) {
return false;
}
if (!$ticket_template && (Session::haveRight('validate_incident', 1) || Session::haveRight('validate_request', 1))) {
$opt = array();
$opt['reset'] = 'reset';
$opt['field'][0] = 55;
// validation status
$opt['searchtype'][0] = 'equals';
$opt['contains'][0] = 'waiting';
$opt['link'][0] = 'AND';
$opt['field'][1] = 59;
// validation aprobator
$opt['searchtype'][1] = 'equals';
$opt['contains'][1] = Session::getLoginUserID();
$opt['link'][1] = 'AND';
$url_validate = $CFG_GLPI["root_doc"] . "/front/ticket.php?" . Toolbox::append_params($opt, '&');
if (TicketValidation::getNumberTicketsToValidate(Session::getLoginUserID()) > 0) {
echo "<a href='{$url_validate}' title=\"" . __s('Ticket waiting for your approval') . "\"\n alt=\"" . __s('Ticket waiting for your approval') . "\">" . __('Tickets awaiting approval') . "</a><br><br>";
}
}
$query = "SELECT `realname`, `firstname`, `name`\n FROM `glpi_users`\n WHERE `id` = '{$ID}'";
$result = $DB->query($query);
$email = UserEmail::getDefaultForUser($ID);
// Set default values...
$default_values = array('_users_id_requester_notif' => array('use_notification' => $email == "" ? 0 : 1), 'nodelegate' => 1, '_users_id_requester' => 0, 'name' => '', 'content' => '', 'itilcategories_id' => 0, 'locations_id' => 0, 'urgency' => 3, 'itemtype' => '', 'items_id' => 0, 'entities_id' => $_SESSION['glpiactive_entity'], 'plan' => array(), 'global_validation' => 'none', 'due_date' => 'NULL', 'slas_id' => 0, '_add_validation' => 0, 'type' => Entity::getUsedConfig('tickettype', $_SESSION['glpiactive_entity'], '', Ticket::INCIDENT_TYPE), '_right' => "id");
// Get default values from posted values on reload form
if (!$ticket_template) {
if (isset($_POST)) {
$values = $_POST;
}
}
// Restore saved value or override with page parameter
$saved = $ticket->restoreInput();
foreach ($default_values as $name => $value) {
if (!isset($values[$name])) {
if (isset($saved[$name])) {
$values[$name] = $saved[$name];
} else {
$values[$name] = $value;
}
}
}
if (!$ticket_template) {
echo "<form method='post' name='helpdeskform' action='" . $CFG_GLPI["root_doc"] . "/front/tracking.injector.php' enctype='multipart/form-data'>";
}
$delegating = User::getDelegateGroupsForUser($values['entities_id']);
if (count($delegating)) {
echo "<div class='center'><table class='tab_cadre_fixe'>";
echo "<tr><th colspan='2'>" . __('This ticket concerns me') . " ";
$rand = Dropdown::showYesNo("nodelegate", $values['nodelegate']);
$params = array('nodelegate' => '__VALUE__', 'rand' => $rand, 'right' => "delegate", '_users_id_requester' => $values['_users_id_requester'], '_users_id_requester_notif' => $values['_users_id_requester_notif'], 'use_notification' => $values['_users_id_requester_notif']['use_notification'], 'entity_restrict' => $_SESSION["glpiactive_entity"]);
Ajax::UpdateItemOnSelectEvent("dropdown_nodelegate" . $rand, "show_result" . $rand, $CFG_GLPI["root_doc"] . "/ajax/dropdownDelegationUsers.php", $params);
if ($CFG_GLPI['use_check_pref'] && $values['nodelegate']) {
echo "</th><th>" . __('Check your personnal information');
}
echo "</th></tr>";
echo "<tr class='tab_bg_1'><td colspan='2' class='center'>";
echo "<div id='show_result{$rand}'>";
$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
//.........这里部分代码省略.........
示例3: showAllItems
function showAllItems($myname, $value_type = 0, $value = 0, $entity_restrict = -1)
{
global $CFG_GLPI;
$types = PluginRacksRack::getTypes();
$types[] = 'PluginRacksOther';
$rand = mt_rand();
$options = array();
echo "<table border='0'><tr><td>\n";
echo "<select name='type' id='itemtype{$rand}'>\n";
echo "<option value='0'>" . Dropdown::EMPTY_VALUE . "</option>\n";
foreach ($types as $type) {
$item = new $type();
echo "<option value='" . $type . "Model'>" . $item::getTypeName(2) . "</option>\n";
}
echo "</select>";
$params = array('modeltable' => '__VALUE__', 'value' => $value, 'myname' => $myname, 'entity_restrict' => $entity_restrict);
Ajax::UpdateItemOnSelectEvent("itemtype{$rand}", "show_{$myname}{$rand}", $CFG_GLPI["root_doc"] . "/plugins/racks/ajax/dropdownAllItems.php", $params);
echo "</td><td>\n";
echo "<span id='show_{$myname}{$rand}'> </span>\n";
echo "</td></tr></table>\n";
if ($value > 0) {
echo "<script type='text/javascript' >\n";
echo "document.getElementById('itemtype{$rand}').value='" . $value_type . "';";
echo "</script>\n";
$params["modeltable"] = $value_type;
Ajax::updateItem("show_{$myname}{$rand}", $CFG_GLPI["root_doc"] . "/plugins/racks/ajax/dropdownAllItems.php", $params);
}
return $rand;
}
示例4: dropdownCredentials
/**
* See dropdown credentials
*
* @param type $params
*/
static function dropdownCredentials($params = array())
{
global $CFG_GLPI;
$p = array();
if ($params['id'] == -1) {
$p['value'] = '';
$p['itemtype'] = 0;
$p['id'] = 0;
} else {
$credential = new PluginFusioninventoryCredential();
$credential->getFromDB($params['id']);
if ($credential->getFromDB($params['id'])) {
$p = $credential->fields;
} else {
$p['value'] = '';
$p['itemtype'] = 0;
$p['id'] = 0;
}
}
$types = self::getCredentialsItemTypes();
$types[''] = Dropdown::EMPTY_VALUE;
$rand = Dropdown::showFromArray('plugin_fusioninventory_credentials_id', $types, array('value' => $p['itemtype']));
$params = array('itemtype' => '__VALUE__', 'id' => $p['id']);
$url = $CFG_GLPI["root_doc"] . "/plugins/fusioninventory/ajax/dropdownCredentials.php";
Ajax::UpdateItemOnSelectEvent("dropdown_plugin_fusioninventory_credentials_id{$rand}", "span_credentials", $url, $params);
echo " <span name='span_credentials' id='span_credentials'>";
if ($p['id']) {
self::dropdownCredentialsForItemtype($p);
}
echo "</span>";
}
示例5: while
if ($DB->numrows($result)) {
$prev = -1;
while ($data = $DB->fetch_array($result)) {
$output = $data["name"];
$id = $data['id'];
$addcomment = "";
if ($multi && $data["entities_id"] != $prev) {
if ($prev >= 0) {
echo "</optgroup>";
}
$prev = $data["entities_id"];
echo "<optgroup label=\"" . Dropdown::getDropdownName("glpi_entities", $prev) . "\">";
}
$PluginRacksItemSpecification = new PluginRacksItemSpecification();
if ($PluginRacksItemSpecification->GetfromDB($data['spec'])) {
$output .= " - " . $PluginRacksItemSpecification->fields["size"] . "U";
}
if (isset($data["comment"])) {
$addcomment = " - " . $data["comment"];
}
if (empty($output)) {
$output = "({$id})";
}
echo "<option value=\"" . $_POST["modeltable"] . ";{$id};" . $data['spec'] . "\" title=\"{$output}{$addcomment}\">" . substr($output, 0, $_POST["limit"]) . "</option>";
}
}
echo "</select>";
if (isset($_POST["comment"]) && $_POST["comment"]) {
$paramscomments = array('value' => '__VALUE__', 'table' => $_POST["table"]);
Ajax::UpdateItemOnSelectEvent("dropdown_" . $_POST["myname"] . $_POST["rand"], "comments_" . $_POST["myname"] . $_POST["rand"], $CFG_GLPI["root_doc"] . "/ajax/comments.php", $paramscomments, false);
}
示例6: dropdownActionType
/**
* Display actions type (itemtypes)
*
* @param $myname value name of dropdown
* @param $method value name of the method selected
* @param $value value name of the definition type (used for edit taskjob)
* @param $entity_restrict restriction of entity if required
*
* @return value rand of the dropdown
*
**/
function dropdownActionType($myname, $method, $value = 0, $entity_restrict = '')
{
global $CFG_GLPI;
$a_methods = PluginFusioninventoryStaticmisc::getmethods();
$a_actioninitiontype = array();
$a_actioninitiontype[''] = '------';
$a_actioninitiontype['PluginFusioninventoryAgent'] = PluginFusioninventoryAgent::getTypeName();
foreach ($a_methods as $datas) {
if ($method == $datas['method']) {
$module = ucfirst($datas['module']);
$class = PluginFusioninventoryStaticmisc::getStaticMiscClass($module);
if (is_callable(array($class, "task_actiontype_" . $method))) {
$a_actioninitiontype = call_user_func(array($class, "task_actiontype_" . $method), $a_actioninitiontype);
}
}
}
$rand = Dropdown::showFromArray($myname, $a_actioninitiontype);
$params = array('ActionType' => '__VALUE__', 'entity_restrict' => $entity_restrict, 'rand' => $rand, 'myname' => $myname, 'method' => $method, 'actiontypeid' => 'dropdown_' . $myname . $rand);
Ajax::UpdateItemOnSelectEvent('dropdown_ActionType' . $rand, "show_ActionList", $CFG_GLPI["root_doc"] . "/plugins/fusioninventory/ajax/dropdownactionlist.php", $params);
return $rand;
}