本文整理汇总了PHP中autoName函数的典型用法代码示例。如果您正苦于以下问题:PHP autoName函数的具体用法?PHP autoName怎么用?PHP autoName使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了autoName函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showForm
/**
* Print the printer form
*
* @param $ID integer ID of the item
* @param $options array
* - target filename : where to go when done.
* - withtemplate boolean : template or basic item
*
*@return boolean item found
**/
function showForm($ID, $options = array())
{
global $CFG_GLPI, $LANG;
$target = $this->getFormURL();
$withtemplate = '';
if (isset($options['target'])) {
$target = $options['target'];
}
if (isset($options['withtemplate'])) {
$withtemplate = $options['withtemplate'];
}
if (!haveRight("printer", "r")) {
return false;
}
if ($ID > 0) {
$this->check($ID, 'r');
} else {
// Create item
$this->check(-1, 'w');
}
if (isset($options['withtemplate']) && $options['withtemplate'] == 2) {
$template = "newcomp";
$datestring = $LANG['computers'][14] . " : ";
$date = convDateTime($_SESSION["glpi_currenttime"]);
} else {
if (isset($options['withtemplate']) && $options['withtemplate'] == 1) {
$template = "newtemplate";
$datestring = $LANG['computers'][14] . " : ";
$date = convDateTime($_SESSION["glpi_currenttime"]);
} else {
$datestring = $LANG['common'][26] . " : ";
$date = convDateTime($this->fields["date_mod"]);
$template = false;
}
}
$this->showTabs($options);
$this->showFormHeader($options);
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['common'][16] . ($template ? "*" : "") . " :</td>\n";
echo "<td>";
$objectName = autoName($this->fields["name"], "name", $template === "newcomp", $this->getType(), $this->fields["entities_id"]);
autocompletionTextField($this, 'name', array('value' => $objectName));
echo "</td>\n";
echo "<td>" . $LANG['state'][0] . " :</td>\n";
echo "<td>";
Dropdown::show('State', array('value' => $this->fields["states_id"]));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['common'][15] . " : </td>\n";
echo "<td>";
Dropdown::show('Location', array('value' => $this->fields["locations_id"], 'entity' => $this->fields["entities_id"]));
echo "</td>\n";
echo "<td>" . $LANG['common'][17] . " :</td>\n";
echo "<td>";
Dropdown::show('PrinterType', array('value' => $this->fields["printertypes_id"]));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['common'][10] . " :</td>\n";
echo "<td>";
User::dropdown(array('name' => 'users_id_tech', 'value' => $this->fields["users_id_tech"], 'right' => 'interface', 'entity' => $this->fields["entities_id"]));
echo "</td>\n";
echo "<td>" . $LANG['common'][5] . " :</td>\n";
echo "<td>";
Dropdown::show('Manufacturer', array('value' => $this->fields["manufacturers_id"]));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['common'][21] . " :</td>\n";
echo "<td>";
autocompletionTextField($this, "contact_num");
echo "</td>\n";
echo "<td>" . $LANG['common'][22] . " :</td>\n";
echo "<td>";
Dropdown::show('PrinterModel', array('value' => $this->fields["printermodels_id"]));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['common'][18] . " :</td>\n";
echo "<td>";
autocompletionTextField($this, "contact");
echo "</td>\n";
echo "<td>" . $LANG['common'][19] . " :</td>\n";
echo "<td>";
autocompletionTextField($this, "serial");
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['common'][34] . " :</td>\n";
echo "<td>";
User::dropdown(array('value' => $this->fields["users_id"], 'entity' => $this->fields["entities_id"], 'right' => 'all'));
echo "</td>\n";
echo "<td>" . $LANG['common'][20] . ($template ? "*" : "") . " :</td>\n";
echo "<td>";
//.........这里部分代码省略.........
示例2: showForm
function showForm($ID, $options = array())
{
$PluginRacksConfig = new PluginRacksConfig();
$this->initForm($ID, $options);
$this->showFormHeader($options);
//ligne 1
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Name') . "</td><td>";
$objectName = autoName($this->fields["name"], "name", isset($options['withtemplate']) && $options['withtemplate'] == 2, $this->getType(), $this->fields["entities_id"]);
Html::autocompletionTextField($this, 'name', array('value' => $objectName));
echo "</td>";
echo "<td>" . __('Size') . "</td><td>";
Dropdown::showInteger("rack_size", $this->fields["rack_size"], 1, 100, 1);
echo " " . __('U', 'racks') . "</td>";
echo "</tr>";
//ligne 2
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Manufacturer') . "</td><td>";
Manufacturer::dropdown(array('value' => $this->fields["manufacturers_id"]));
echo "</td>";
echo "<td >" . __('Location') . "</td>";
echo "<td>";
Location::dropdown(array('value' => $this->fields["locations_id"], 'entity' => $this->fields["entities_id"]));
echo "</td>";
echo "</tr>";
echo "<tr class='tab_bg_1'>";
echo "<td >" . __('Technician in charge of the hardware') . "</td>";
echo "<td >";
User::dropdown(array('name' => 'users_id_tech', 'value' => $this->fields["users_id_tech"], 'right' => 'interface', 'entity' => $this->fields["entities_id"]));
echo "</td>";
echo "<td>" . __('Place', 'racks');
echo "</td><td>";
$PluginRacksRoomLocation = new PluginRacksRoomLocation();
$PluginRacksRoomLocation->dropdownRoomLocations("plugin_racks_roomlocations_id", $this->fields["plugin_racks_roomlocations_id"], $this->fields["entities_id"]);
echo "</td>";
echo "</tr>";
//ligne 4
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Group in charge of the hardware') . "</td><td>";
Group::dropdown(array('name' => 'groups_id_tech', 'value' => $this->fields['groups_id_tech'], 'entity' => $this->fields['entities_id'], 'condition' => '`is_assign`'));
echo "</td>";
echo "<td>" . __('Width', 'racks') . "</td><td>";
echo "<input type='text' name='width' \n value=\"" . Html::formatNumber($this->fields["width"], true) . "\" size='10'> ";
$PluginRacksConfig->getUnit("size");
echo "</td>";
echo "</tr>";
//ligne 5
echo "<tr class='tab_bg_1'>";
echo "</td>";
echo "<td>" . __('Serial number') . "</td>";
echo "<td >";
Html::autocompletionTextField($this, 'serial');
echo "</td>";
echo "<td>" . __('Height', 'racks') . "</td><td>";
echo "<input type='text' name='height' \n value=\"" . Html::formatNumber($this->fields["height"], true) . "\" size='10'> ";
$PluginRacksConfig->getUnit("size");
echo "</td>";
echo "</tr>";
//ligne 6
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Inventory number') . "</td>";
echo "<td>";
Html::autocompletionTextField($this, 'otherserial');
echo "</td>";
echo "<td>" . __('Weight', 'racks') . "</td><td>";
echo "<input type='text' name='weight' \n value=\"" . Html::formatNumber($this->fields["weight"], true) . "\" size='10'> ";
$PluginRacksConfig->getUnit("weight");
echo "</td>";
echo "</tr>";
//ligne 7
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Model') . "</td>";
echo "<td>";
Dropdown::show('PluginRacksRackModel', array('name' => "plugin_racks_rackmodels_id", 'value' => $this->fields["plugin_racks_rackmodels_id"]));
echo "</td>";
echo "<td>" . __('Depth', 'racks') . "</td><td>";
echo "<input type='text' name='depth' \n value=\"" . Html::formatNumber($this->fields["depth"], true) . "\" size='10'> ";
$PluginRacksConfig->getUnit("size");
echo "</td>";
echo "</tr>";
//ligne 8
echo "<tr class='tab_bg_1'>";
echo "<td >" . __('Type') . "</td><td>";
Dropdown::show('PluginRacksRackType', array('value' => $this->fields["plugin_racks_racktypes_id"]));
echo "</td>";
echo "<td >" . __('Status') . "</td><td>";
Dropdown::show('PluginRacksRackState', array('value' => $this->fields["plugin_racks_rackstates_id"]));
echo "</td>";
echo "</tr>";
//ligne 9
echo "<tr class='tab_bg_1'>";
echo "<td colspan='2'>";
if ((!isset($options['withtemplate']) || $options['withtemplate'] == 0) && !empty($this->fields['template_name'])) {
echo "<span class='small_space'>";
printf(__('Created from the template %s'), $this->fields['template_name']);
echo "</span>";
} else {
echo " ";
}
echo "</td><td colspan='2'>";
//.........这里部分代码省略.........
示例3: showForm
/**
* Print the Software / license form
*
* @param $ID integer Id of the version or the template to print
* @param $options array of possible options:
* - target form target
* - softwares_id ID of the software for add process
*
* @return true if displayed false if item not found or not right to display
**/
function showForm($ID, $options = array())
{
global $CFG_GLPI;
$softwares_id = -1;
if (isset($options['softwares_id'])) {
$softwares_id = $options['softwares_id'];
}
if ($ID < 0) {
// Create item
$this->fields['softwares_id'] = $softwares_id;
$this->fields['number'] = 1;
$soft = new Software();
if ($soft->getFromDB($softwares_id) && in_array($_SESSION['glpiactive_entity'], getAncestorsOf('glpi_entities', $soft->getEntityID()))) {
$options['entities_id'] = $soft->getEntityID();
}
}
$this->initForm($ID, $options);
$this->showFormHeader($options);
// Restore saved value or override with page parameter
if (!isset($options['template_preview'])) {
if (isset($_REQUEST)) {
$saved = Html::cleanPostForTextArea($_REQUEST);
}
}
foreach ($this->fields as $name => $value) {
if (isset($saved[$name]) && empty($this->fields[$name])) {
$this->fields[$name] = $saved[$name];
}
}
echo "<input type='hidden' name='withtemplate' value='" . $options['withtemplate'] . "'>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . Software::getTypeName(1) . "</td>";
echo "<td>";
if ($ID > 0) {
$softwares_id = $this->fields["softwares_id"];
echo "<input type='hidden' name='softwares_id' value='{$softwares_id}'>";
echo "<a href='software.form.php?id=" . $softwares_id . "'>" . Dropdown::getDropdownName("glpi_softwares", $softwares_id) . "</a>";
} else {
Dropdown::show('Software', array('condition' => "`is_template`='0' AND `is_deleted`='0'", 'entity' => $_SESSION['glpiactive_entity'], 'entity_sons' => $_SESSION['glpiactive_entity_recursive'], 'on_change' => 'this.form.submit()', 'value' => $softwares_id));
}
echo "</td>";
echo "<td colspan='2'>";
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . sprintf(__('%1$s%2$s'), __('Name'), isset($options['withtemplate']) && $options['withtemplate'] ? "*" : "") . "</td>";
echo "<td>";
$objectName = autoName($this->fields["name"], "name", isset($options['withtemplate']) && $options['withtemplate'] == 2, $this->getType(), $this->fields["entities_id"]);
Html::autocompletionTextField($this, 'name', array('value' => $objectName));
echo "</td>";
echo "<td>" . __('Status') . "</td>";
echo "<td>";
State::dropdown(array('value' => $this->fields["states_id"], 'entity' => $this->fields["entities_id"], 'condition' => "`is_visible_softwarelicense`"));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Location') . "</td><td>";
Location::dropdown(array('value' => $this->fields["locations_id"], 'entity' => $this->fields["entities_id"]));
echo "</td>";
echo "<td>" . __('Type') . "</td>";
echo "<td>";
SoftwareLicenseType::dropdown(array('value' => $this->fields["softwarelicensetypes_id"]));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Technician in charge of the hardware') . "</td>";
echo "<td>";
User::dropdown(array('name' => 'users_id_tech', 'value' => $this->fields["users_id_tech"], 'right' => 'own_ticket', 'entity' => $this->fields["entities_id"]));
echo "</td>";
echo "<td>" . __('Publisher') . "</td>";
echo "<td>";
Manufacturer::dropdown(array('value' => $this->fields["manufacturers_id"]));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Group in charge of the hardware') . "</td>";
echo "<td>";
Group::dropdown(array('name' => 'groups_id_tech', 'value' => $this->fields['groups_id_tech'], 'entity' => $this->fields['entities_id'], 'condition' => '`is_assign`'));
echo "</td>";
echo "<td>" . __('Serial number') . "</td>";
echo "<td>";
Html::autocompletionTextField($this, "serial");
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td >" . __('User') . "</td>";
echo "<td >";
User::dropdown(array('value' => $this->fields["users_id"], 'entity' => $this->fields["entities_id"], 'right' => 'all'));
echo "</td>";
echo "<td>" . sprintf(__('%1$s%2$s'), __('Inventory number'), isset($options['withtemplate']) && $options['withtemplate'] ? "*" : "");
echo "</td>";
echo "<td>";
$objectName = autoName($this->fields["otherserial"], "otherserial", isset($options['withtemplate']) && $options['withtemplate'] == 2, $this->getType(), $this->fields["entities_id"]);
Html::autocompletionTextField($this, 'otherserial', array('value' => $objectName));
echo "</td></tr>\n";
//.........这里部分代码省略.........
示例4: showForm
/**
* Print the printer form
*
* @param $ID integer ID of the item
* @param $options array of possible options:
* - target filename : where to go when done.
* - withtemplate boolean : template or basic item
*
*@return boolean item found
**/
function showForm($ID, $options = array())
{
global $CFG_GLPI;
$target = $this->getFormURL();
$withtemplate = $this->initForm($ID, $options);
$this->showFormHeader($options);
echo "<tr class='tab_bg_1'>";
//TRANS: %1$s is a string, %2$s a second one without spaces between them : to change for RTL
echo "<td>" . sprintf(__('%1$s%2$s'), __('Name'), isset($options['withtemplate']) && $options['withtemplate'] ? "*" : "") . "</td>\n";
echo "<td>";
$objectName = autoName($this->fields["name"], "name", isset($options['withtemplate']) && $options['withtemplate'] == 2, $this->getType(), $this->fields["entities_id"]);
Html::autocompletionTextField($this, 'name', array('value' => $objectName));
echo "</td>\n";
echo "<td>" . __('Status') . "</td>\n";
echo "<td>";
State::dropdown(array('value' => $this->fields["states_id"], 'entity' => $this->fields["entities_id"], 'condition' => "`is_visible_printer`"));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Location') . "</td>\n";
echo "<td>";
Location::dropdown(array('value' => $this->fields["locations_id"], 'entity' => $this->fields["entities_id"]));
echo "</td>\n";
echo "<td>" . __('Type') . "</td>\n";
echo "<td>";
PrinterType::dropdown(array('value' => $this->fields["printertypes_id"]));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Technician in charge of the hardware') . "</td>\n";
echo "<td>";
User::dropdown(array('name' => 'users_id_tech', 'value' => $this->fields["users_id_tech"], 'right' => 'own_ticket', 'entity' => $this->fields["entities_id"]));
echo "</td>\n";
echo "<td>" . __('Manufacturer') . "</td>\n";
echo "<td>";
Manufacturer::dropdown(array('value' => $this->fields["manufacturers_id"]));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Group in charge of the hardware') . "</td>";
echo "<td>";
Group::dropdown(array('name' => 'groups_id_tech', 'value' => $this->fields['groups_id_tech'], 'entity' => $this->fields['entities_id'], 'condition' => '`is_assign`'));
echo "</td>";
echo "<td>" . __('Model') . "</td>\n";
echo "<td>";
PrinterModel::dropdown(array('value' => $this->fields["printermodels_id"]));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Alternate username number') . "</td>\n";
echo "<td>";
Html::autocompletionTextField($this, "contact_num");
echo "</td>\n";
echo "<td>" . __('Serial number') . "</td>\n";
echo "<td>";
Html::autocompletionTextField($this, "serial");
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Alternate username') . "</td>\n";
echo "<td>";
Html::autocompletionTextField($this, "contact");
echo "</td>\n";
echo "<td>" . sprintf(__('%1$s%2$s'), __('Inventory number'), isset($options['withtemplate']) && $options['withtemplate'] ? "*" : "") . "</td>\n";
echo "<td>";
$objectName = autoName($this->fields["otherserial"], "otherserial", isset($options['withtemplate']) && $options['withtemplate'] == 2, $this->getType(), $this->fields["entities_id"]);
Html::autocompletionTextField($this, 'otherserial', array('value' => $objectName));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('User') . "</td>\n";
echo "<td>";
User::dropdown(array('value' => $this->fields["users_id"], 'entity' => $this->fields["entities_id"], 'right' => 'all'));
echo "</td>\n";
echo "<td>" . __('Management type') . "</td>";
echo "<td>";
$globalitem = array();
$globalitem['withtemplate'] = $withtemplate;
$globalitem['value'] = $this->fields["is_global"];
$globalitem['target'] = $target;
if ($this->can($ID, UPDATE)) {
$globalitem['management_restrict'] = $CFG_GLPI["printers_management_restrict"];
}
Dropdown::showGlobalSwitch($this->fields["id"], $globalitem);
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Group') . "</td>\n";
echo "<td>";
Group::dropdown(array('value' => $this->fields["groups_id"], 'entity' => $this->fields["entities_id"], 'condition' => '`is_itemgroup`'));
echo "</td>\n";
echo "<td>" . __('Network') . "</td>\n";
echo "<td>";
Network::dropdown(array('value' => $this->fields["networks_id"]));
echo "</td></tr>\n";
// Display auto inventory informations
$rowspan = 6;
//.........这里部分代码省略.........
示例5: showForm
/**
* Print the monitor form
*
* @param $ID integer ID of the item
* @param $options array
* - target filename : where to go when done.
* - withtemplate boolean : template or basic item
*
* @return boolean item found
**/
function showForm($ID, $options = array())
{
global $CFG_GLPI;
$target = $this->getFormURL();
$withtemplate = $this->initForm($ID, $options);
$this->showFormHeader($options);
echo "<tr class='tab_bg_1'>";
//TRANS: %1$s is a string, %2$s a second one without spaces between them : to change for RTL
echo "<td>" . sprintf(__('%1$s%2$s'), __('Name'), isset($options['withtemplate']) && $options['withtemplate'] ? "*" : "");
echo "</td>";
echo "<td>";
$objectName = autoName($this->fields["name"], "name", isset($options['withtemplate']) && $options['withtemplate'] == 2, $this->getType(), $this->fields["entities_id"]);
Html::autocompletionTextField($this, "name", array('value' => $objectName));
echo "</td>";
echo "<td>" . __('Status') . "</td>";
echo "<td>";
State::dropdown(array('value' => $this->fields["states_id"], 'entity' => $this->fields["entities_id"], 'condition' => "`is_visible_monitor`"));
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Location') . "</td>";
echo "<td>";
Location::dropdown(array('value' => $this->fields["locations_id"], 'entity' => $this->fields["entities_id"]));
echo "</td>";
echo "<td>" . __('Type') . "</td>";
echo "<td>";
MonitorType::dropdown(array('value' => $this->fields["monitortypes_id"]));
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Technician in charge of the hardware') . "</td>";
echo "<td>";
User::dropdown(array('name' => 'users_id_tech', 'value' => $this->fields["users_id_tech"], 'right' => 'own_ticket', 'entity' => $this->fields["entities_id"]));
echo "</td>";
echo "<td>" . __('Manufacturer') . "</td>";
echo "<td>";
Manufacturer::dropdown(array('value' => $this->fields["manufacturers_id"]));
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Group in charge of the hardware') . "</td>";
echo "<td>";
Group::dropdown(array('name' => 'groups_id_tech', 'value' => $this->fields['groups_id_tech'], 'entity' => $this->fields['entities_id'], 'condition' => '`is_assign`'));
echo "</td>";
echo "<td>" . __('Model') . "</td>";
echo "<td>";
MonitorModel::dropdown(array('value' => $this->fields["monitormodels_id"]));
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Alternate username number') . "</td>";
echo "<td>";
Html::autocompletionTextField($this, "contact_num");
echo "</td>";
echo "<td>" . __('Serial number') . "</td>";
echo "<td>";
Html::autocompletionTextField($this, "serial");
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Alternate username') . "</td>";
echo "<td>";
Html::autocompletionTextField($this, "contact");
echo "</td>";
echo "<td>" . sprintf(__('%1$s%2$s'), __('Inventory number'), isset($options['withtemplate']) && $options['withtemplate'] ? "*" : "") . "</td>";
echo "<td>";
$objectName = autoName($this->fields["otherserial"], "otherserial", isset($options['withtemplate']) && $options['withtemplate'] == 2, $this->getType(), $this->fields["entities_id"]);
Html::autocompletionTextField($this, "otherserial", array('value' => $objectName));
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('User') . "</td>";
echo "<td>";
User::dropdown(array('value' => $this->fields["users_id"], 'entity' => $this->fields["entities_id"], 'right' => 'all'));
echo "</td>";
echo "<td>" . __('Management type') . "</td>";
echo "<td>";
Dropdown::showGlobalSwitch($this->fields["id"], array('withtemplate' => $withtemplate, 'value' => $this->fields["is_global"], 'management_restrict' => $CFG_GLPI["monitors_management_restrict"], 'target' => $target));
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Group') . "</td>";
echo "<td>";
Group::dropdown(array('value' => $this->fields["groups_id"], 'entity' => $this->fields["entities_id"], 'condition' => '`is_itemgroup`'));
echo "</td>";
echo "<td rowspan='4'>" . __('Comments') . "</td>";
echo "<td rowspan='4'>\n <textarea cols='45' rows='10' name='comment' >" . $this->fields["comment"] . "</textarea>";
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Size') . "</td>";
echo "<td>";
Html::autocompletionTextField($this, "size");
echo "\"</td>";
echo "</tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . 'Flags' . "</td>";
echo "<td><table>";
//.........这里部分代码省略.........
示例6: showForm
function showForm($items_id, $options=array(), $services_id='') {
$pMonitoringCommand = new PluginMonitoringCommand();
$pMonitoringServicedef = new PluginMonitoringServicedef();
if (isset($_GET['withtemplate']) AND ($_GET['withtemplate'] == '1')) {
$options['withtemplate'] = 1;
} else {
$options['withtemplate'] = 0;
}
if ($services_id!='') {
$this->getEmpty();
} else {
$this->getFromDB($items_id);
}
$this->showTabs($options);
$this->showFormHeader($options);
if (!isset($this->fields['plugin_monitoring_servicedefs_id'])
OR empty($this->fields['plugin_monitoring_servicedefs_id'])) {
$pMonitoringServicedef->getEmpty();
} else {
$pMonitoringServicedef->getFromDB($this->fields['plugin_monitoring_servicedefs_id']);
}
$template = false;
echo "<tr>";
echo "<td>";
if ($services_id!='') {
echo "<input type='hidden' name='plugin_monitoring_services_id' value='".$services_id."' />";
}
echo __('Name')." :";
echo "</td>";
echo "<td>";
$objectName = autoName($this->fields["name"], "name", ($template === "newcomp"),
$this->getType());
Html::autocompletionTextField($this, 'name', array('value' => $objectName));
echo "</td>";
echo "<td>";
echo __('Template')." :";
echo "</td>";
echo "<td>";
if ($items_id != '0') {
echo "<input type='hidden' name='update' value='update'>\n";
}
echo "<input type='hidden' name='plugin_monitoring_servicedefs_id_s' value='".$this->fields['plugin_monitoring_servicedefs_id']."'>\n";
if ($pMonitoringServicedef->fields['is_template'] == '0') {
$this->fields['plugin_monitoring_servicedefs_id'] = 0;
}
Dropdown::show("PluginMonitoringServicetemplate", array(
'name' => 'plugin_monitoring_servicetemplates_id',
'value' => $this->fields['plugin_monitoring_servicetemplates_id'],
'auto_submit' => true
));
echo "</td>";
echo "<td>";
if ($this->fields["items_id"] == '') {
} else {
echo "<input type='hidden' name='items_id' value='".$this->fields["items_id"]."'>\n";
echo "<input type='hidden' name='itemtype' value='".$this->fields["itemtype"]."'>\n";
}
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<th colspan='4'> </th>";
echo "</tr>";
echo "<tr>";
// * itemtype link
if ($this->fields['itemtype'] != '') {
$itemtype = $this->fields['itemtype'];
$item = new $itemtype();
$item->getFromDB($this->fields['items_id']);
echo "<td>";
echo __('Item Type')." <i>".$item->getTypeName()."</i>";
echo " :</td>";
echo "<td>";
echo $item->getLink(1);
echo "</td>";
} else {
echo "<td colspan='2' align='center'>";
echo __('No type associated', 'monitoring');
echo "</td>";
}
// * command
echo "<td>";
echo __('Command', 'monitoring')." :";
echo "</td>";
echo "<td align='center'>";
if ($this->fields['plugin_monitoring_servicetemplates_id'] > 0) {
$pMonitoringServicetemplate = new PluginMonitoringServicetemplate();
$pMonitoringServicetemplate->getFromDB($this->fields['plugin_monitoring_servicetemplates_id']);
$pMonitoringCommand->getFromDB($pMonitoringServicetemplate->fields['plugin_monitoring_commands_id']);
echo $pMonitoringCommand->getLink(1);
} else {
$pMonitoringCommand->getFromDB($pMonitoringServicedef->fields['plugin_monitoring_commands_id']);
Dropdown::show("PluginMonitoringCommand", array(
'name' =>'plugin_monitoring_commands_id',
//.........这里部分代码省略.........
示例7: showForm
/**
* Display form for agent configuration
*
* @param $computers_id integer ID of the agent
* @param $options array
*
* @return bool TRUE if form is ok
*
**/
function showForm($ID, $options = array())
{
$this->initForm($ID, $options);
$this->showFormHeader($options);
echo "<tr class='tab_bg_1'>";
//TRANS: %1$s is a string, %2$s a second one without spaces between them : to change for RTL
echo "<td>" . sprintf(__('%1$s%2$s'), __('Name'), isset($options['withtemplate']) && $options['withtemplate'] ? "*" : "") . "</td>";
echo "<td>";
$objectName = autoName($this->fields["name"], "name", isset($options['withtemplate']) && $options['withtemplate'] == 2, $this->getType(), $this->fields["entities_id"]);
Html::autocompletionTextField($this, 'name', array('value' => $objectName));
echo "</td>";
echo "<td>" . __('Comments') . "</td>";
echo "<td class='middle'>";
echo "<textarea cols='45' rows='4' name='comment' >" . $this->fields["comment"];
echo "</textarea></td></tr>\n";
$this->showFormButtons($options);
if ($ID > 0) {
$pf = new PluginFusioninventoryTimeslotEntry();
$pf->formEntry($ID);
}
return true;
}
示例8: showForm
/**
* Print the networking form
*
* @param $ID integer ID of the item
* @param $options array
* - target filename : where to go when done.
* - withtemplate boolean : template or basic item
*
*@return boolean item found
**/
function showForm($ID, $options = array())
{
$this->initForm($ID, $options);
$this->showFormHeader($options);
echo "<tr class='tab_bg_1'>";
//TRANS: %1$s is a string, %2$s a second one without spaces between them : to change for RTL
echo "<td>" . sprintf(__('%1$s%2$s'), __('Name'), isset($options['withtemplate']) && $options['withtemplate'] ? "*" : "") . "</td>";
echo "<td>";
$objectName = autoName($this->fields["name"], "name", isset($options['withtemplate']) && $options['withtemplate'] == 2, $this->getType(), $this->fields["entities_id"]);
Html::autocompletionTextField($this, "name", array('value' => $objectName));
echo "</td>";
echo "<td>" . __('Status') . "</td>";
echo "<td>";
State::dropdown(array('value' => $this->fields["states_id"], 'entity' => $this->fields["entities_id"], 'condition' => "`is_visible_networkequipment`"));
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Location') . "</td>";
echo "<td>";
Location::dropdown(array('value' => $this->fields["locations_id"], 'entity' => $this->fields["entities_id"]));
echo "</td>";
echo "<td>" . __('Type') . "</td>";
echo "<td>";
NetworkEquipmentType::dropdown(array('value' => $this->fields["networkequipmenttypes_id"]));
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Technician in charge of the hardware') . "</td>";
echo "<td>";
User::dropdown(array('name' => 'users_id_tech', 'value' => $this->fields["users_id_tech"], 'right' => 'own_ticket', 'entity' => $this->fields["entities_id"]));
echo "</td>";
echo "<td>" . __('Manufacturer') . "</td>";
echo "<td>";
Manufacturer::dropdown(array('value' => $this->fields["manufacturers_id"]));
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Group in charge of the hardware') . "</td>";
echo "<td>";
Group::dropdown(array('name' => 'groups_id_tech', 'value' => $this->fields['groups_id_tech'], 'entity' => $this->fields['entities_id'], 'condition' => '`is_assign`'));
echo "</td>";
echo "<td>" . __('Model') . "</td>";
echo "<td>";
NetworkEquipmentModel::dropdown(array('value' => $this->fields["networkequipmentmodels_id"]));
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Alternate username number') . "</td>";
echo "<td>";
Html::autocompletionTextField($this, "contact_num");
echo "</td>";
echo "<td>" . __('Serial number') . "</td>";
echo "<td>";
Html::autocompletionTextField($this, "serial");
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Alternate username') . "</td>";
echo "<td>";
Html::autocompletionTextField($this, "contact");
echo "</td>";
echo "<td>" . sprintf(__('%1$s%2$s'), __('Inventory number'), isset($options['withtemplate']) && $options['withtemplate'] ? "*" : "") . "</td>";
echo "<td>";
$objectName = autoName($this->fields["otherserial"], "otherserial", isset($options['withtemplate']) && $options['withtemplate'] == 2, $this->getType(), $this->fields["entities_id"]);
Html::autocompletionTextField($this, "otherserial", array('value' => $objectName));
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('User') . "</td>";
echo "<td>";
User::dropdown(array('value' => $this->fields["users_id"], 'entity' => $this->fields["entities_id"], 'right' => 'all'));
echo "</td>";
echo "<td>" . __('Network') . "</td>";
echo "<td>";
Network::dropdown(array('value' => $this->fields["networks_id"]));
echo "</td></tr>";
$rowspan = 5;
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Group') . "</td>";
echo "<td>";
Group::dropdown(array('value' => $this->fields["groups_id"], 'entity' => $this->fields["entities_id"], 'condition' => '`is_itemgroup`'));
echo "</td>";
echo "<td rowspan='{$rowspan}'>" . __('Comments') . "</td>";
echo "<td rowspan='{$rowspan}'>\n <textarea cols='45' rows='" . ($rowspan + 3) . "' name='comment' >" . $this->fields["comment"];
echo "</textarea></td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Domain') . "</td>";
echo "<td>";
Domain::dropdown(array('value' => $this->fields["domains_id"], 'entity' => $this->fields["entities_id"]));
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td colspan=2>" . __('The MAC address and the IP of the equipment are included in an aggregated network port') . "</td>";
echo "</tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . _n('Firmware', 'Firmwares', 1) . "</td>";
echo "<td>";
//.........这里部分代码省略.........
示例9: showForm
/**
* Display form for agent configuration
*
* @param $items_id integer ID
* @param $options array
*
*@return bool true if form is ok
*
**/
function showForm($items_id, $options = array())
{
global $DB, $CFG_GLPI, $LANG;
if ($items_id == '') {
if (isset($_POST['id'])) {
$a_list = $this->find("`users_id`='" . $_POST['id'] . "'", '', 1);
if (count($a_list)) {
$array = current($a_list);
$items_id = $array['id'];
}
}
}
if ($items_id != '') {
$this->getFromDB($items_id);
} else {
$this->getEmpty();
}
$this->showFormHeader($options);
$this->getFromDB($items_id);
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['common'][16] . " :</td>";
echo "<td align='center'>";
$objectName = autoName($this->fields["name"], "name", false, $this->getType());
autocompletionTextField($this, 'name', array('value' => $objectName));
echo "</td>";
echo "<td>" . $LANG['plugin_monitoring']['contacttemplate'][1] . " :</td>";
echo "<td align='center'>";
Dropdown::showYesNo("is_default", $this->fields['is_default']);
echo "</td>";
echo "</tr>";
echo "<tr class='tab_bg_1'>";
echo "<th colspan='2'>" . $LANG['plugin_monitoring']['contact'][3] . "</th>";
echo "<th colspan='2'>" . $LANG['plugin_monitoring']['contact'][4] . "</th>";
echo "</tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['plugin_monitoring']['contact'][5] . " :</td>";
echo "<td align='center'>";
Dropdown::showYesNo('host_notifications_enabled', $this->fields['host_notifications_enabled']);
echo "</td>";
echo "<td>" . $LANG['plugin_monitoring']['contact'][5] . " :</td>";
echo "<td align='center'>";
Dropdown::showYesNo('service_notifications_enabled', $this->fields['service_notifications_enabled']);
echo "</td>";
echo "</tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['plugin_monitoring']['contact'][19] . " :</td>";
echo "<td align='center'>";
dropdown::show("PluginMonitoringNotificationcommand", array('name' => 'host_notification_commands', 'value' => $this->fields['host_notification_commands']));
echo "</td>";
echo "<td>" . $LANG['plugin_monitoring']['contact'][19] . " :</td>";
echo "<td align='center'>";
dropdown::show("PluginMonitoringNotificationcommand", array('name' => 'service_notification_commands', 'value' => $this->fields['service_notification_commands']));
echo "</td>";
echo "</tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['plugin_monitoring']['contact'][6] . " :</td>";
echo "<td align='center'>";
dropdown::show("Calendar", array('name' => 'host_notification_period', 'value' => $this->fields['host_notification_period']));
echo "</td>";
echo "<td>" . $LANG['plugin_monitoring']['contact'][6] . " :</td>";
echo "<td align='center'>";
dropdown::show("Calendar", array('name' => 'service_notification_period', 'value' => $this->fields['service_notification_period']));
echo "</td>";
echo "</tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['plugin_monitoring']['contact'][7] . " :</td>";
echo "<td align='center'>";
Dropdown::showYesNo('host_notification_options_d', $this->fields['host_notification_options_d']);
echo "</td>";
echo "<td>" . $LANG['plugin_monitoring']['contact'][8] . " :</td>";
echo "<td align='center'>";
Dropdown::showYesNo('service_notification_options_w', $this->fields['service_notification_options_w']);
echo "</td>";
echo "</tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['plugin_monitoring']['contact'][9] . " :</td>";
echo "<td align='center'>";
Dropdown::showYesNo('host_notification_options_u', $this->fields['host_notification_options_u']);
echo "</td>";
echo "<td>" . $LANG['plugin_monitoring']['contact'][10] . " :</td>";
echo "<td align='center'>";
Dropdown::showYesNo('service_notification_options_u', $this->fields['service_notification_options_u']);
echo "</td>";
echo "</tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['plugin_monitoring']['contact'][11] . " :</td>";
echo "<td align='center'>";
Dropdown::showYesNo('host_notification_options_r', $this->fields['host_notification_options_r']);
echo "</td>";
echo "<td>" . $LANG['plugin_monitoring']['contact'][12] . " :</td>";
echo "<td align='center'>";
//.........这里部分代码省略.........
示例10: showForm
/**
* Print the simcard form
*
* @param $ID integer ID of the item
* @param $options array
* - target for the Form
* - withtemplate template or basic simcard
*
*@return Nothing (display)
**/
function showForm($ID, $options = array())
{
global $CFG_GLPI, $DB, $LANG;
if (!$this->canView()) {
return false;
}
$target = $this->getFormURL();
$withtemplate = '';
if (isset($options['target'])) {
$target = $options['target'];
}
if (isset($options['withtemplate'])) {
$withtemplate = $options['withtemplate'];
}
$this->showFormHeader($options);
if (isset($options['itemtype']) && isset($options['items_id'])) {
echo "<tr class='tab_bg_1'>";
echo "<td>" . __s('Associated element') . "</td>";
echo "<td>";
$item = new $options['itemtype']();
$item->getFromDB($options['items_id']);
echo $item->getLink(1);
echo "</td>";
echo "<td colspan='2'></td></tr>\n";
echo "<input type='hidden' name='_itemtype' value='" . $options['itemtype'] . "'>";
echo "<input type='hidden' name='_items_id' value='" . $options['items_id'] . "'>";
}
echo "<tr class='tab_bg_1'>";
echo "<td>" . __s('Name') . (isset($options['withtemplate']) && $options['withtemplate'] ? "*" : "") . "</td>";
echo "<td>";
$objectName = autoName($this->fields["name"], "name", isset($options['withtemplate']) && $options['withtemplate'] == 2, $this->getType(), $this->fields["entities_id"]);
Html::autocompletionTextField($this, 'name', array('value' => $objectName));
echo "</td>";
echo "<td>" . __s('Status') . "</td>";
echo "<td>";
Dropdown::show('State', array('value' => $this->fields["states_id"]));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __s('Location') . "</td>";
echo "<td>";
Dropdown::show('Location', array('value' => $this->fields["locations_id"], 'entity' => $this->fields["entities_id"]));
echo "</td>";
echo "<td>" . __s('Type of SIM card', 'simcard') . "</td>";
echo "<td>";
Dropdown::show('PluginSimcardSimcardType', array('value' => $this->fields["plugin_simcard_simcardtypes_id"]));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __s('Technician in charge of the hardware') . "</td>";
echo "<td>";
User::dropdown(array('name' => 'users_id_tech', 'value' => $this->fields["users_id_tech"], 'right' => 'interface', 'entity' => $this->fields["entities_id"]));
echo "</td>";
echo "<td>" . __s('Size', 'simcard') . "</td>";
echo "<td>";
Dropdown::show('PluginSimcardSimcardSize', array('value' => $this->fields["plugin_simcard_simcardsizes_id"]));
echo "</td></tr>\n";
// TODO : Add group in charge of hardware
echo "<tr class='tab_bg_1'>";
echo "<td>" . __s('Group in charge of the hardware') . "</td>";
echo "<td>";
Group::dropdown(array('name' => 'groups_id_tech', 'value' => $this->fields['groups_id_tech'], 'entity' => $this->fields['entities_id'], 'condition' => '`is_assign`'));
echo "</td>";
echo "<td>" . __s('Voltage', 'simcard') . "</td>";
echo "<td>";
Dropdown::show('PluginSimcardSimcardVoltage', array('value' => $this->fields["plugin_simcard_simcardvoltages_id"]));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __s('Provider', 'simcard') . "</td>";
echo "<td>";
Dropdown::show('PluginSimcardPhoneOperator', array('value' => $this->fields["plugin_simcard_phoneoperators_id"]));
echo "</td>";
echo "<td>" . __s('Associable items to a ticket') . " :</td><td>";
Dropdown::showYesNo('is_helpdesk_visible', $this->fields['is_helpdesk_visible']);
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __s('User') . "</td>";
echo "<td>";
User::dropdown(array('value' => $this->fields["users_id"], 'entity' => $this->fields["entities_id"], 'right' => 'all'));
echo "</td>";
echo "<input type='hidden' name='is_global' value='1'>";
echo "<td>" . __s("Inventory number") . (isset($options['withtemplate']) && $options['withtemplate'] ? "*" : "") . "</td>";
echo "<td>";
$objectName = autoName($this->fields["otherserial"], "otherserial", isset($options['withtemplate']) && $options['withtemplate'] == 2, $this->getType(), $this->fields["entities_id"]);
Html::autocompletionTextField($this, 'otherserial', array('value' => $objectName));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __s('Group') . "</td>";
echo "<td>";
Dropdown::show('Group', array('value' => $this->fields["groups_id"], 'entity' => $this->fields["entities_id"]));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
//.........这里部分代码省略.........
示例11: showForm
/**
* Print the computer form
*
* @param $ID integer ID of the item
* @param $options array
* - target for the Form
* - withtemplate template or basic computer
*
*@return Nothing (display)
*
**/
function showForm($ID, $options = array())
{
global $LANG, $CFG_GLPI, $DB;
if (!haveRight("computer", "r")) {
return false;
}
if ($ID > 0) {
$this->check($ID, 'r');
} else {
// Create item
$this->check(-1, 'w');
}
if (isset($options['withtemplate']) && $options['withtemplate'] == 2) {
$template = "newcomp";
$datestring = $LANG['computers'][14] . " : ";
$date = convDateTime($_SESSION["glpi_currenttime"]);
} else {
if (isset($options['withtemplate']) && $options['withtemplate'] == 1) {
$template = "newtemplate";
$datestring = $LANG['computers'][14] . " : ";
$date = convDateTime($_SESSION["glpi_currenttime"]);
} else {
$datestring = $LANG['common'][26] . ": ";
$date = convDateTime($this->fields["date_mod"]);
$template = false;
}
}
$this->showTabs($options);
$this->showFormHeader($options);
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['common'][16] . ($template ? "*" : "") . " :</td>";
echo "<td>";
$objectName = autoName($this->fields["name"], "name", $template === "newcomp", $this->getType(), $this->fields["entities_id"]);
autocompletionTextField($this, 'name', array('value' => $objectName));
echo "</td>";
echo "<td>" . $LANG['state'][0] . " :</td>";
echo "<td>";
Dropdown::show('State', array('value' => $this->fields["states_id"]));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['common'][15] . " : </td>";
echo "<td>";
Dropdown::show('Location', array('value' => $this->fields["locations_id"], 'entity' => $this->fields["entities_id"]));
echo "</td>";
echo "<td>" . $LANG['common'][17] . " : </td>";
echo "<td>";
Dropdown::show('ComputerType', array('value' => $this->fields["computertypes_id"]));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['common'][10] . " : </td>";
echo "<td>";
User::dropdown(array('name' => 'users_id_tech', 'value' => $this->fields["users_id_tech"], 'right' => 'interface', 'entity' => $this->fields["entities_id"]));
echo "</td>";
echo "<td>" . $LANG['common'][5] . " : </td>";
echo "<td>";
Dropdown::show('Manufacturer', array('value' => $this->fields["manufacturers_id"]));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['common'][21] . " : </td>";
echo "<td >";
autocompletionTextField($this, 'contact_num');
echo "</td>";
echo "<td>" . $LANG['common'][22] . " : </td>";
echo "<td>";
Dropdown::show('ComputerModel', array('value' => $this->fields["computermodels_id"]));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['common'][18] . " :</td>";
echo "<td>";
autocompletionTextField($this, 'contact');
echo "</td>";
echo "<td>" . $LANG['common'][19] . " :</td>";
echo "<td >";
autocompletionTextField($this, 'serial');
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['common'][34] . " : </td>";
echo "<td>";
User::dropdown(array('value' => $this->fields["users_id"], 'entity' => $this->fields["entities_id"], 'right' => 'all'));
echo "</td>";
echo "<td>" . $LANG['common'][20] . ($template ? "*" : "") . " :</td>";
echo "<td>";
$objectName = autoName($this->fields["otherserial"], "otherserial", $template === "newcomp", $this->getType(), $this->fields["entities_id"]);
autocompletionTextField($this, 'otherserial', array('value' => $objectName));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['common'][35] . " :</td>";
echo "<td>";
Dropdown::show('Group', array('value' => $this->fields["groups_id"], 'entity' => $this->fields["entities_id"]));
//.........这里部分代码省略.........
示例12: showForm
/**
* Print the computer form
*
* @param $ID integer ID of the item
* @param $options array
* - target for the Form
* - withtemplate template or basic computer
*
*@return Nothing (display)
**/
function showForm($ID, $options = array())
{
global $CFG_GLPI, $DB;
$this->initForm($ID, $options);
$this->showFormHeader($options);
echo "<tr class='tab_bg_1'>";
//TRANS: %1$s is a string, %2$s a second one without spaces between them : to change for RTL
echo "<td>" . sprintf(__('%1$s%2$s'), __('Name'), isset($options['withtemplate']) && $options['withtemplate'] ? "*" : "") . "</td>";
echo "<td>";
$objectName = autoName($this->fields["name"], "name", isset($options['withtemplate']) && $options['withtemplate'] == 2, $this->getType(), $this->fields["entities_id"]);
Html::autocompletionTextField($this, 'name', array('value' => $objectName));
echo "</td>";
echo "<td>" . __('Status') . "</td>";
echo "<td>";
State::dropdown(array('value' => $this->fields["states_id"], 'entity' => $this->fields["entities_id"], 'condition' => "`is_visible_computer`"));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Location') . "</td>";
echo "<td>";
Location::dropdown(array('value' => $this->fields["locations_id"], 'entity' => $this->fields["entities_id"]));
echo "</td>";
echo "<td>" . __('Type') . "</td>";
echo "<td>";
ComputerType::dropdown(array('value' => $this->fields["computertypes_id"]));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Technician in charge of the hardware') . "</td>";
echo "<td>";
User::dropdown(array('name' => 'users_id_tech', 'value' => $this->fields["users_id_tech"], 'right' => 'own_ticket', 'entity' => $this->fields["entities_id"]));
echo "</td>";
echo "<td>" . __('Manufacturer') . "</td>";
echo "<td>";
Manufacturer::dropdown(array('value' => $this->fields["manufacturers_id"]));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Group in charge of the hardware') . "</td>";
echo "<td>";
Group::dropdown(array('name' => 'groups_id_tech', 'value' => $this->fields['groups_id_tech'], 'entity' => $this->fields['entities_id'], 'condition' => '`is_assign`'));
echo "</td>";
echo "<td>" . __('Model') . "</td>";
echo "<td>";
ComputerModel::dropdown(array('value' => $this->fields["computermodels_id"]));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
//TRANS: Number of the alternate username
echo "<td>" . __('Alternate username number') . "</td>";
echo "<td >";
Html::autocompletionTextField($this, 'contact_num');
echo "</td>";
echo "<td>" . __('Serial number') . "</td>";
echo "<td >";
Html::autocompletionTextField($this, 'serial');
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Alternate username') . "</td>";
echo "<td>";
Html::autocompletionTextField($this, 'contact');
echo "</td>";
echo "<td>" . sprintf(__('%1$s%2$s'), __('Inventory number'), isset($options['withtemplate']) && $options['withtemplate'] ? "*" : "") . "</td>";
echo "<td>";
$objectName = autoName($this->fields["otherserial"], "otherserial", isset($options['withtemplate']) && $options['withtemplate'] == 2, $this->getType(), $this->fields["entities_id"]);
Html::autocompletionTextField($this, 'otherserial', array('value' => $objectName));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('User') . "</td>";
echo "<td>";
User::dropdown(array('value' => $this->fields["users_id"], 'entity' => $this->fields["entities_id"], 'right' => 'all'));
echo "</td>";
echo "<td>" . __('Network') . "</td>";
echo "<td>";
Network::dropdown(array('value' => $this->fields["networks_id"]));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Group') . "</td>";
echo "<td>";
Group::dropdown(array('value' => $this->fields["groups_id"], 'entity' => $this->fields["entities_id"], 'condition' => '`is_itemgroup`'));
echo "</td>";
// Display auto inventory informations
$rowspan = 7;
$inventory_show = false;
if (!empty($ID) && Plugin::haveImport() && $this->fields["is_dynamic"]) {
$inventory_show = true;
$rowspan -= 5;
}
echo "<td rowspan='{$rowspan}'>" . __('Comments') . "</td>";
echo "<td rowspan='{$rowspan}' class='middle'>";
echo "<textarea cols='45' rows='" . ($rowspan + 3) . "' name='comment' >" . $this->fields["comment"];
echo "</textarea></td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Domain') . "</td>";
//.........这里部分代码省略.........
示例13: showForm
function showForm($ID, $options = array())
{
global $CFG_GLPI;
$config = PluginOrderConfig::getConfig();
$user = new User();
if (!self::canView()) {
return false;
}
if ($ID > 0) {
$this->check($ID, 'r');
} else {
// Create item
$this->check(-1, 'w');
$this->getEmpty();
}
if (isset($options['withtemplate']) && $options['withtemplate'] == 2) {
$template = "newcomp";
$datestring = sprintf(__('Created on %s'), Html::convDateTime($_SESSION["glpi_currenttime"]));
} else {
if (isset($options['withtemplate']) && $options['withtemplate'] == 1) {
$template = "newtemplate";
$datestring = sprintf(__('Created on %s'), Html::convDateTime($_SESSION["glpi_currenttime"]));
} else {
$datestring = sprintf(__('Last update on %s'), Html::convDateTime($this->fields["date_mod"]));
$template = false;
}
}
$canedit = $this->canUpdateOrder() && $this->can($ID, 'w') && !$this->isCanceled();
$cancancel = self::canCancel() && $this->can($ID, 'w') && $this->isCanceled();
$options['canedit'] = $canedit;
$options['candel'] = $cancancel;
if ($template) {
$this->fields['order_date'] = NULL;
}
// Displaying OVER BUDGET ALERT
if ($this->fields['budgets_id'] > 0) {
self::displayAlertOverBudget(self::isOverBudget($ID));
}
$this->showTabs($options);
$this->showFormHeader($options);
//Display without inside table
/* title */
echo "<tr class='tab_bg_1'><td>" . __("Order name", "order") . "*: </td>";
echo "<td>";
if ($canedit) {
$objectName = autoName($this->fields["name"], "name", $template === "newcomp", $this->getType(), $this->fields["entities_id"]);
Html::autocompletionTextField($this, "name", array('value' => $objectName));
} else {
echo $this->fields["name"];
}
echo "</td>";
/* date of order */
echo "<td>" . __("Date of order", "order") . ":</td><td>";
if ($canedit) {
if ($this->fields["order_date"] == NULL) {
Html::showDateFormItem("order_date", date("Y-m-d"), true, true);
} else {
Html::showDateFormItem("order_date", $this->fields["order_date"], true, true);
}
} else {
echo Html::convDate($this->fields["order_date"]);
}
echo "</td></tr>";
/* num order */
echo "<tr class='tab_bg_1'><td>" . __("Order number", "order") . "*: </td>";
echo "<td>";
if ($canedit) {
$objectOrder = autoName($this->fields["num_order"], "num_order", $template === "newcomp", $this->getType(), $this->fields["entities_id"]);
Html::autocompletionTextField($this, "num_order", array('value' => $objectOrder));
} else {
echo $this->fields["num_order"];
}
echo "</td>";
/* type order */
echo "<td>" . __("Type") . ": </td><td>";
if ($canedit) {
PluginOrderOrderType::Dropdown(array('name' => "plugin_order_ordertypes_id", 'value' => $this->fields["plugin_order_ordertypes_id"]));
} else {
echo Dropdown::getDropdownName("glpi_plugin_order_ordertypes", $this->fields["plugin_order_ordertypes_id"]);
}
echo "</td></tr>";
/* state */
echo "<tr class='tab_bg_1'><td>" . __("Order status", "order") . ": </td>";
echo "<td>";
if (!$this->getID()) {
$state = $config->getDraftState();
} else {
$state = $this->fields["plugin_order_orderstates_id"];
}
if ($canedit) {
PluginOrderOrderState::Dropdown(array('name' => "plugin_order_orderstates_id", 'value' => $state));
} else {
echo Dropdown::getDropdownName("glpi_plugin_order_orderstates", $this->getState());
}
echo "</td>";
/* budget */
echo "<td>" . __("Budget") . ": </td><td>";
if ($canedit) {
Budget::Dropdown(array('name' => "budgets_id", 'value' => $this->fields["budgets_id"], 'entity' => $this->fields["entities_id"], 'comments' => true));
} else {
//.........这里部分代码省略.........
示例14: showForm
/**
* Display form for service configuration
*
* @param $items_id integer ID
* @param $options array
*
*@return bool true if form is ok
*
**/
function showForm($items_id, $options = array(), $copy = array())
{
global $DB, $CFG_GLPI;
$pMonitoringCommand = new PluginMonitoringCommand();
if (count($copy) > 0) {
foreach ($copy as $key => $value) {
$this->fields[$key] = stripslashes($value);
}
}
$this->initForm($items_id, $options);
if ($this->fields['id'] == 0) {
$this->fields['active_checks_enabled'] = 1;
$this->fields['passive_checks_enabled'] = 1;
}
$this->showFormHeader($options);
if (isset($_SESSION['plugin_monitoring_components'])) {
$this->fields = $_SESSION['plugin_monitoring_components'];
if (!isset($this->fields["id"])) {
$this->fields["id"] = '';
}
if (!isset($this->fields["arguments"])) {
$this->fields["arguments"] = '';
}
unset($_SESSION['plugin_monitoring_components']);
}
echo "<tr>";
echo "<td>";
echo __('Name') . "<font class='red'>*</font> :";
echo "</td>";
echo "<td>";
echo "<input type='hidden' name='is_template' value='1' />";
$objectName = autoName($this->fields["name"], "name", 1, $this->getType());
Html::autocompletionTextField($this, 'name', array('value' => $objectName));
echo "</td>";
// * checks
echo "<td>" . __('Check definition', 'monitoring') . "<font class='red'>*</font> :</td>";
echo "<td>";
Dropdown::show("PluginMonitoringCheck", array('name' => 'plugin_monitoring_checks_id', 'value' => $this->fields['plugin_monitoring_checks_id']));
echo "</td>";
echo "</tr>";
// * Link
echo "<tr>";
echo "<td>";
echo __('Alias (Shinken service_description)', 'monitoring') . " :";
echo "</td>";
echo "<td>";
$objectDescription = autoName($this->fields["description"], "name", 1, $this->getType());
Html::autocompletionTextField($this, 'description', array('value' => $objectDescription));
echo "</td>";
/*
echo "<td>";
// echo "Type of template :";
echo "</td>";
echo "<td>";
// $a_types = array();
// $a_types[''] = Dropdown::EMPTY_VALUE;
// $a_types['partition'] = "Partition";
// $a_types['processor'] = "Processor";
// Dropdown::showFromArray("link", $a_types, array('value'=>$this->fields['link']));
echo "</td>";
*/
// * active check
echo "<td>";
echo __('Active check', 'monitoring') . "<font class='red'>*</font> :";
echo "</td>";
echo "<td>";
Dropdown::showYesNo("active_checks_enabled", $this->fields['active_checks_enabled']);
echo "</td>";
echo "</tr>";
// * command
echo "<tr>";
echo "<td>";
echo __('Command', 'monitoring') . "<font class='red'>*</font> :";
echo "</td>";
echo "<td>";
$pMonitoringCommand->getFromDB($this->fields['plugin_monitoring_commands_id']);
Dropdown::show("PluginMonitoringCommand", array('name' => 'plugin_monitoring_commands_id', 'value' => $this->fields['plugin_monitoring_commands_id']));
echo "</td>";
// * passive check
echo "<td>";
echo __('Passive check', 'monitoring') . "<font class='red'>*</font> :";
echo "</td>";
echo "<td>";
Dropdown::showYesNo("passive_checks_enabled", $this->fields['passive_checks_enabled']);
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td>";
echo __('Template (for graphs generation)', 'monitoring') . " :";
echo "</td>";
echo "<td>";
//.........这里部分代码省略.........
示例15: generateNewItem
public function generateNewItem($params)
{
global $DB;
// Retrieve plugin configuration
$config = new PluginOrderConfig();
$reference = new PluginOrderReference();
foreach ($params["id"] as $tmp => $values) {
//If itemtype cannot be generated, go to the new occurence
if (in_array($values['itemtype'], self::getTypesThanCannotBeGenerared())) {
continue;
}
$entity = $values["entities_id"];
//------------- Template management -----------------------//
//Look for a template in the entity
$templateID = $reference->checkIfTemplateExistsInEntity($values["id"], $values["itemtype"], $entity);
$item = new $values["itemtype"]();
if ($values['itemtype']) {
$order = new PluginOrderOrder();
}
$order->getFromDB($values["plugin_order_orders_id"]);
$reference->getFromDB($params["plugin_order_references_id"]);
if ($templateID) {
$item->getFromDB($templateID);
unset($item->fields["is_template"]);
unset($item->fields["date_mod"]);
$fields = array();
foreach ($item->fields as $key => $value) {
if ($value != '' && (!isset($fields[$key]) || $fields[$key] == '' || $fields[$key] == 0)) {
$input[$key] = $value;
}
}
if ($config->getGeneratedAssetState()) {
$input["states_id"] = $config->getGeneratedAssetState();
}
$input["entities_id"] = $entity;
$input["serial"] = $values["serial"];
if ($item->fields['name']) {
$input["name"] = autoName($item->fields["name"], "name", $templateID, $values["itemtype"], $entity);
} else {
$input["name"] = $values["name"];
}
if ($item->getField('otherserial') != NOT_AVAILABLE) {
if ($item->fields['otherserial']) {
$input["otherserial"] = autoName($item->fields["otherserial"], "otherserial", $templateID, $values["itemtype"], $entity);
} else {
$input["otherserial"] = $values["otherserial"];
}
}
if ($config->canAddLocation()) {
$input['locations_id'] = $order->fields['locations_id'];
}
} elseif ($values["itemtype"] == 'Contract') {
$input["name"] = $values["name"];
$input["entities_id"] = $entity;
$input['contracttypes_id'] = $reference->fields['types_id'];
} else {
if ($config->getGeneratedAssetState()) {
$input["states_id"] = $config->getGeneratedAssetState();
} else {
$input["states_id"] = 0;
}
$input["entities_id"] = $entity;
$input["serial"] = $values["serial"];
$input["otherserial"] = $values["otherserial"];
$input["name"] = $values["name"];
// Get bill data
if ($config->canAddLocation()) {
$input['locations_id'] = $order->fields['locations_id'];
}
$input["manufacturers_id"] = $reference->fields["manufacturers_id"];
$typefield = getForeignKeyFieldForTable(getTableForItemType($values["itemtype"] . "Type"));
$input[$typefield] = $reference->fields["types_id"];
$modelfield = getForeignKeyFieldForTable(getTableForItemType($values["itemtype"] . "Model"));
$input[$modelfield] = $reference->fields["models_id"];
}
$input = Toolbox::addslashes_deep($input);
$newID = $item->add($input);
// Attach new ticket if option is on
if (isset($params['generate_ticket'])) {
$tkt = new TicketTemplate();
if ($tkt->getFromDB($params['generate_ticket']['tickettemplates_id'])) {
$input = array();
$input = Ticket::getDefaultValues($entity);
$ttp = new TicketTemplatePredefinedField();
$predefined = $ttp->getPredefinedFields($params['generate_ticket']['tickettemplates_id'], true);
if (count($predefined)) {
foreach ($predefined as $predeffield => $predefvalue) {
$input[$predeffield] = $predefvalue;
}
}
$input['entities_id'] = $entity;
$input['_users_id_requester'] = empty($order->fields['users_id']) ? Session::getLoginUserID() : $order->fields['users_id'];
$input['items_id'] = $newID;
$input['itemtype'] = $values["itemtype"];
$ticket = new Ticket();
$ticketID = $ticket->add($input);
}
}
//-------------- End template management ---------------------------------//
$result = $this->createLinkWithItem($values["id"], $newID, $values["itemtype"], $values["plugin_order_orders_id"], $entity, $templateID, false, false);
//.........这里部分代码省略.........