本文整理汇总了PHP中autocompletionTextField函数的典型用法代码示例。如果您正苦于以下问题:PHP autocompletionTextField函数的具体用法?PHP autocompletionTextField怎么用?PHP autocompletionTextField使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了autocompletionTextField函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showNewRuleForm
function showNewRuleForm($ID)
{
global $LANG;
echo "<form method='post' action='" . getItemTypeFormURL('Entity') . "'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th colspan='2'>" . $LANG['rulesengine'][19] . "</th></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['common'][16] . " : ";
autocompletionTextField($this, "name", array('value' => '', 'size' => 33));
echo " " . $LANG['joblist'][6] . " : ";
autocompletionTextField($this, "description", array('value' => '', 'size' => 33));
echo " " . $LANG['rulesengine'][9] . " : ";
$this->dropdownRulesMatch("match", "AND");
echo "</td><td rowspan='2' class='tab_bg_2 center middle'>";
echo "<input type=hidden name='sub_type' value='" . get_class($this) . "'>";
echo "<input type=hidden name='entities_id' value='-1'>";
echo "<input type=hidden name='affectentity' value='{$ID}'>";
echo "<input type=hidden name='_method' value='addRule'>";
echo "<input type='submit' name='execute' value=\"" . $LANG['buttons'][8] . "\" class='submit'>";
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td class='center'>" . $LANG['profiles'][22] . " : ";
Dropdown::show('Profile');
echo "<span class='small_space'>" . $LANG['profiles'][28] . "</span> : ";
Dropdown::showYesNo("is_recursive", 0);
echo "</td></tr>\n";
echo "</table></form>";
}
示例2: showForm
/**
* Print the contact 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 Nothing (display)
**/
function showForm($ID, $options = array())
{
global $CFG_GLPI, $LANG;
if (!haveRight("contact_enterprise", "r")) {
return false;
}
if ($ID > 0) {
$this->check($ID, 'r');
} else {
// Create item
$this->check(-1, 'w');
}
$this->showTabs($options);
$this->showFormHeader($options);
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['common'][48] . " :</td>";
echo "<td>";
autocompletionTextField($this, "name");
echo "</td>";
echo "<td rowspan='7' class='middle right'>" . $LANG['common'][25] . " : </td>";
echo "<td class='center middle' rowspan='7'>";
echo "<textarea cols='45' rows='9' name='comment' >" . $this->fields["comment"] . "</textarea>";
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['common'][43] . " :</td>";
echo "<td>";
autocompletionTextField($this, "firstname");
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['help'][35] . " : </td>";
echo "<td>";
autocompletionTextField($this, "phone");
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['help'][35] . " 2 :</td>";
echo "<td>";
autocompletionTextField($this, "phone2");
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['common'][42] . " :</td>";
echo "<td>";
autocompletionTextField($this, "mobile");
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['financial'][30] . " :</td>";
echo "<td>";
autocompletionTextField($this, "fax");
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['setup'][14] . " :</td>";
echo "<td>";
autocompletionTextField($this, "email");
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['common'][17] . " :</td>";
echo "<td>";
Dropdown::show('ContactType', array('value' => $this->fields["contacttypes_id"]));
echo "</td>";
echo "<td></td><td class='center'>";
if ($ID > 0) {
echo "<a target=''_blank' href='" . $CFG_GLPI["root_doc"] . "/front/contact.form.php?getvcard=1&id={$ID}'>" . $LANG['common'][46] . "</a>";
}
echo "</td></tr>";
$this->showFormButtons($options);
$this->addDivForTabs();
return true;
}
示例3: showForm
/**
* Print the Software / version form
*
* @param $ID Integer : Id of the version or the template to print
* @param $options array
* - 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, $LANG;
$softwares_id = -1;
if (isset($options['softwares_id'])) {
$softwares_id = $options['softwares_id'];
}
if (!haveRight("software", "r")) {
return false;
}
if ($ID > 0) {
$this->check($ID, 'r');
} else {
$soft = new Software();
$soft->getFromDB($softwares_id);
// Create item
$input = array('entities_id' => $soft->getEntityID(), 'is_recursive' => $soft->isRecursive());
$this->check(-1, 'w', $input);
}
$this->showTabs($options);
$this->showFormHeader($options);
echo "<tr class='tab_bg_1'><td>" . $LANG['help'][31] . " :</td>";
echo "<td>";
if ($ID > 0) {
$softwares_id = $this->fields["softwares_id"];
} else {
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>";
echo "</td>";
echo "<td rowspan='4' class='middle'>" . $LANG['common'][25] . " :</td>";
echo "<td class='center middle' rowspan='4'>";
echo "<textarea cols='45' rows='3' name='comment' >" . $this->fields["comment"];
echo "</textarea></td></tr>\n";
echo "<tr class='tab_bg_1'><td>" . $LANG['common'][16] . " :</td>";
echo "<td>";
autocompletionTextField($this, "name");
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'><td>" . $LANG['setup'][5] . " :</td><td>";
Dropdown::show('OperatingSystem', array('value' => $this->fields["operatingsystems_id"]));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'><td>" . $LANG['state'][0] . " :</td><td>";
Dropdown::show('State', array('value' => $this->fields["states_id"]));
echo "</td></tr>\n";
// Only count softwareversions_id_buy (don't care of softwareversions_id_use if no installation)
if (SoftwareLicense::countForVersion($ID) > 0 || Computer_SoftwareVersion::countForVersion($ID) > 0) {
$options['candel'] = false;
}
$this->showFormButtons($options);
$this->addDivForTabs();
return true;
}
示例4: showForm
/**
* Print the mailgate form
*
* @param $ID Integer : Id of the item to print
* @param $options array
* - target filename : where to go when done.
*
* @return boolean item found
**/
function showForm($ID, $options = array())
{
global $CFG_GLPI, $LANG;
if (!haveRight("config", "r")) {
return false;
}
if ($ID > 0) {
$this->check($ID, 'r');
} else {
// Create item
$this->check(-1, 'w');
}
$options['colspan'] = 1;
$this->showTabs($options);
$this->showFormHeader($options);
if (!function_exists('mb_list_encodings') || !function_exists('mb_convert_encoding')) {
echo "<tr class='tab_bg_1'><td colspan='2'>" . $LANG['mailgate'][4] . "</td></tr>";
}
echo "<tr class='tab_bg_1'><td>" . $LANG['common'][16] . " (" . $LANG['mailing'][111] . ") :</td><td>";
autocompletionTextField($this, "name");
echo "</td></tr>";
echo "<tr class='tab_bg_1'><td>" . $LANG['common'][60] . " :</td><td>";
Dropdown::showYesNo("is_active", $this->fields["is_active"]);
echo "</td></tr>";
showMailServerConfig($this->fields["host"]);
echo "<tr class='tab_bg_1'><td>" . $LANG['login'][6] . " :</td><td>";
autocompletionTextField($this, "login");
echo "</td></tr>";
echo "<tr class='tab_bg_1'><td>" . $LANG['login'][7] . " :</td>";
echo "<td><input type='password' name='passwd' value='' size='20' autocomplete='off'></td>";
echo "</tr>";
echo "<tr class='tab_bg_1'>";
echo "<td width='200px'> " . $LANG['mailgate'][7] . " :</td><td>";
self::showMaxFilesize('filesize_max', $this->fields["filesize_max"]);
echo "</td></tr>";
echo "<tr class='tab_bg_1'><td>" . $LANG['common'][25] . " :</td>";
echo "<td><textarea cols='45' rows='5' name='comment' >" . $this->fields["comment"] . "</textarea>";
if ($ID > 0) {
echo "<br>" . $LANG['common'][26] . " : " . convDateTime($this->fields["date_mod"]);
}
echo "</td></tr>";
$this->showFormButtons($options);
$this->addDivForTabs();
return true;
}
示例5: showForm
/**
* Print the Software / license form
*
* @param $ID Integer : Id of the version or the template to print
* @param $options array
* - 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, $LANG;
$softwares_id = -1;
if (isset($options['softwares_id'])) {
$softwares_id = $options['softwares_id'];
}
if (!haveRight("software", "w")) {
return false;
}
if ($ID > 0) {
$this->check($ID, 'r');
} else {
// Create item
$this->check(-1, 'w');
$this->fields['softwares_id'] = $softwares_id;
$this->fields['number'] = 1;
}
$this->showTabs($options);
$this->showFormHeader($options);
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['help'][31] . " :</td>";
echo "<td>";
if ($ID > 0) {
$softwares_id = $this->fields["softwares_id"];
} else {
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>";
echo "</td>";
echo "<td>" . $LANG['common'][17] . " :</td>";
echo "<td>";
Dropdown::show('SoftwareLicenseType', array('value' => $this->fields["softwarelicensetypes_id"]));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['common'][16] . " :</td>";
echo "<td>";
autocompletionTextField($this, "name");
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['software'][1] . " :</td>";
echo "<td>";
SoftwareVersion::dropdown(array('name' => "softwareversions_id_buy", 'softwares_id' => $this->fields["softwares_id"], 'value' => $this->fields["softwareversions_id_buy"]));
echo "</td>";
echo "<td>" . $LANG['common'][20] . " :</td>";
echo "<td>";
autocompletionTextField($this, "otherserial");
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['software'][2] . " :</td>";
echo "<td>";
SoftwareVersion::dropdown(array('name' => "softwareversions_id_use", 'softwares_id' => $this->fields["softwares_id"], 'value' => $this->fields["softwareversions_id_use"]));
echo "</td>";
echo "<td rowspan='" . ($ID > 0 ? '4' : '3') . "' class='middle'>" . $LANG['common'][25] . " :</td>";
echo "<td class='center middle' rowspan='" . ($ID > 0 ? '4' : '3') . "'>";
echo "<textarea cols='45' rows='5' name='comment' >" . $this->fields["comment"] . "</textarea>";
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['tracking'][29] . " :</td>";
echo "<td>";
Dropdown::showInteger("number", $this->fields["number"], 1, 1000, 1, array(-1 => $LANG['software'][4]));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['software'][32] . " :</td>";
echo "<td>";
showDateFormItem('expire', $this->fields["expire"]);
Alert::displayLastAlert('SoftwareLicense', $ID);
echo "</td></tr>\n";
if ($ID > 0) {
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['common'][26] . " : </td>";
echo "<td>" . ($this->fields["date_mod"] ? convDateTime($this->fields["date_mod"]) : $LANG['setup'][307]);
echo "</td></tr>";
}
$this->showFormButtons($options);
$this->addDivForTabs();
return true;
}
示例6: showForm
/**
* Print the contact form
*
* @param $ID integer ID of the item
* @param $options array
* - target for the Form
* - withtemplate : template or basic item
*
*@return Nothing (display)
**/
function showForm($ID, $options = array())
{
global $LANG;
if (!haveRight("budget", "r")) {
return false;
}
$use_cache = true;
$rowspan = 4;
if ($ID > 0) {
$rowspan++;
$this->check($ID, 'r');
} else {
// Create item
$this->check(-1, 'w');
}
$this->showTabs($options);
$this->showFormHeader($options);
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['common'][16] . " : </td>";
echo "<td>";
autocompletionTextField($this, "name");
echo "</td>";
echo "<td rowspan='{$rowspan}' class='middle right'>" . $LANG['common'][25] . " : </td>";
echo "<td class='center middle' rowspan='{$rowspan}'><textarea cols='45' rows='4'\n name='comment' >" . $this->fields["comment"] . "</textarea></td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['financial'][21] . " :</td>";
echo "<td><input type='text' name='value' size='14'\n value='" . formatNumber($this->fields["value"], true) . "'></td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['search'][8] . " : </td>";
echo "<td>";
showDateFormItem("begin_date", $this->fields["begin_date"]);
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['search'][9] . " : </td>";
echo "<td>";
showDateFormItem("end_date", $this->fields["end_date"]);
echo "</td></tr>";
if ($ID > 0) {
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['common'][26] . " : </td>";
echo "<td>";
echo $this->fields["date_mod"] ? convDateTime($this->fields["date_mod"]) : $LANG['setup'][307];
echo "</td></tr>";
}
$this->showFormButtons($options);
$this->addDivForTabs();
return true;
}
示例7: showFormHeader
/**
*
* Display a 2 columns Header 1 for ID, 1 for recursivity menu
* Open the form is user can edit
*
* @param $options array
* - target for the Form
* - withtemplate : 1 for newtemplate, 2 for newobject from template
* - colspan for each column (default 2)
* - formoptions string (javascript p.e.)
* - canedit boolean edit mode of form ?
*
**/
function showFormHeader($options = array())
{
global $LANG, $CFG_GLPI;
$ID = $this->fields['id'];
$params['target'] = $this->getFormURL();
$params['colspan'] = 2;
$params['withtemplate'] = '';
$params['formoptions'] = '';
$params['canedit'] = true;
if (is_array($options) && count($options)) {
foreach ($options as $key => $val) {
$params[$key] = $val;
}
}
// Template case : clean entities data
if ($params['withtemplate'] == 2 && $this->isEntityAssign()) {
$this->fields['entities_id'] = $_SESSION['glpiactive_entity'];
if ($this->maybeRecursive()) {
$this->fields["is_recursive"] = 0;
}
}
if ($this->can($ID, 'w')) {
echo "<form name='form' method='post' action='" . $params['target'] . "' " . $params['formoptions'] . ">";
//Should add an hidden entities_id field ?
//If the table has an entities_id field
if ($this->isField("entities_id")) {
//The object type can be assigned to an entity
if ($this->isEntityAssign()) {
// TODO CommonDBChild must not use current entity, but parent entity
if (isset($params['entities_id'])) {
$entity = $this->fields['entities_id'] = $params['entities_id'];
} else {
if ($this->isNewID($ID) || $params['withtemplate'] == 2) {
//It's a new object to be added
$entity = $_SESSION['glpiactive_entity'];
} else {
//It's an existing object to be displayed
$entity = $this->fields['entities_id'];
}
}
echo "<input type='hidden' name='entities_id' value='{$entity}'>";
// For Rules except ruleticket and slalevel
} else {
if ($this->getType() != 'User') {
echo "<input type='hidden' name='entities_id' value='0'>";
}
}
}
// No link on popup window
if (isset($_GET['popup']) && $_GET['popup']) {
echo "<input type='hidden' name='_no_message_link' value='1'>";
}
}
echo "<div class='spaced' id='tabsbody'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th colspan='" . $params['colspan'] . "'>";
if (!empty($params['withtemplate']) && $params['withtemplate'] == 2 && !$this->isNewID($ID)) {
echo "<input type='hidden' name='template_name' value='" . $this->fields["template_name"] . "'>";
echo $LANG['buttons'][8] . " - " . $LANG['common'][13] . " : " . $this->fields["template_name"];
} else {
if (!empty($params['withtemplate']) && $params['withtemplate'] == 1) {
echo "<input type='hidden' name='is_template' value='1'>\n";
echo $LANG['common'][6] . " : ";
autocompletionTextField($this, "template_name", array('size' => 25));
} else {
if ($this->isNewID($ID)) {
echo $this->getTypeName() . " - " . $LANG['common'][87];
} else {
echo $this->getTypeName() . " - " . $LANG['common'][2] . " {$ID}";
}
}
}
if (isset($this->fields["entities_id"]) && isMultiEntitiesMode() && $this->isEntityAssign()) {
echo " (" . Dropdown::getDropdownName("glpi_entities", $this->fields["entities_id"]) . ")";
}
echo "</th><th colspan='" . $params['colspan'] . "'>";
if (get_class($this) == 'Entity') {
// is recursive but cannot be change
} else {
if ($this->maybeRecursive()) {
if (isMultiEntitiesMode()) {
echo $LANG['entity'][9] . " : ";
if ($params['canedit']) {
if (!$this->can($ID, 'recursive')) {
echo Dropdown::getYesNo($this->fields["is_recursive"]);
$comment = $LANG['common'][86];
// CommonDBChild : entity data is get or copy from parent
//.........这里部分代码省略.........
示例8: showNotificationOptions
static function showNotificationOptions(Entity $entity)
{
global $LANG;
$ID = $entity->getField('id');
if (!$entity->can($ID, 'r') || !haveRight('notification', 'r')) {
return false;
}
// Notification right applied
$canedit = haveRight('notification', 'w') && haveAccessToEntity($ID);
// Get data
$entitynotification = new EntityData();
if (!$entitynotification->getFromDB($ID)) {
$entitynotification->getEmpty();
}
echo "<div class='spaced'>";
if ($canedit) {
echo "<form method='post' name=form action='" . getItemTypeFormURL(__CLASS__) . "'>";
}
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th colspan='4'>" . $LANG['setup'][240] . "</th></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['setup'][203] . " : </td>";
echo "<td>";
autocompletionTextField($entitynotification, "admin_email");
echo "</td>";
echo "<td>" . $LANG['setup'][208] . "</td><td>";
autocompletionTextField($entitynotification, "admin_email_name");
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['setup'][207] . " : </td>";
echo "<td>";
autocompletionTextField($entitynotification, "admin_reply");
echo "</td>";
echo "<td>" . $LANG['setup'][209] . "</td><td>";
autocompletionTextField($entitynotification, "admin_reply_name");
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td class='middle right'>" . $LANG['setup'][204] . "</td>";
echo "<td colspan='3'>";
echo "<textarea cols='60' rows='5' name='mailing_signature'>" . $entitynotification->fields["mailing_signature"] . "</textarea>";
echo "</td></tr>";
echo "<tr><th colspan='4'>" . $LANG['setup'][242] . "</th></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['setup'][245] . " - " . $LANG['setup'][244] . "</td><td>";
$default_value = $entitynotification->fields['cartridges_alert_repeat'];
Alert::dropdown(array('name' => 'cartridges_alert_repeat', 'value' => $default_value, 'inherit_global' => 1));
echo "</td>";
echo "<td>" . $LANG['setup'][245] . " - " . $LANG['setup'][243] . "</td><td>";
$default_value = $entitynotification->fields['consumables_alert_repeat'];
Alert::dropdown(array('name' => 'consumables_alert_repeat', 'value' => $default_value, 'inherit_global' => 1));
echo "</td></tr>";
echo "<tr class='tab_bg_1'><td>" . $LANG['setup'][264] . "</td><td>";
$default_value = $entitynotification->fields['use_licenses_alert'];
Alert::dropdownYesNo(array('name' => "use_licenses_alert", 'value' => $default_value, 'inherit_global' => 1));
echo "</td>";
echo "<td>" . $LANG['setup'][246] . "</td><td>";
$default_value = $entitynotification->fields['use_contracts_alert'];
Alert::dropdownYesNo(array('name' => "use_contracts_alert", 'value' => $default_value, 'inherit_global' => 1));
echo "</td></tr>";
echo "<tr class='tab_bg_1'><td>" . $LANG['setup'][247] . "</td><td>";
$default_value = $entitynotification->fields['use_infocoms_alert'];
Alert::dropdownYesNo(array('name' => "use_infocoms_alert", 'value' => $default_value, 'inherit_global' => 1));
echo "</td>";
echo "<td>" . $LANG['setup'][707] . "</td><td>";
Alert::dropdownIntegerNever('use_reservations_alert', $entitynotification->fields['use_reservations_alert'], array('max' => 99, 'inherit_global' => 1));
echo " " . $LANG['job'][21] . "</td></tr>";
echo "</td></tr>";
echo "<tr class='tab_bg_1'><td >" . $LANG['setup'][708] . "</td><td>";
Alert::dropdownIntegerNever('notclosed_delay', $entitynotification->fields["notclosed_delay"], array('max' => 99, 'inherit_global' => 1));
echo " " . $LANG['stats'][31] . "</td>";
echo "<td colspan='2'></td></tr>";
if ($canedit) {
echo "<tr>";
echo "<td class='tab_bg_2 center' colspan='4'>";
echo "<input type='hidden' name='entities_id' value='{$ID}'>";
if ($entitynotification->fields["id"]) {
echo "<input type='hidden' name='id' value='" . $entitynotification->fields["id"] . "'>";
echo "<input type='submit' name='update' value=\"" . $LANG['buttons'][7] . "\"\n class='submit'>";
} else {
echo "<input type='submit' name='add' value=\"" . $LANG['buttons'][7] . "\" class='submit'>";
}
echo "</td></tr>";
echo "</table></form>";
} else {
echo "</table>";
}
echo "</div>";
}
示例9: showForm
function showForm($ID, $options = array())
{
global $CFG_GLPI, $LANG;
if (!isset($options['several'])) {
$options['several'] = false;
}
if (!haveRight("networking", "r")) {
return false;
}
if ($ID > 0) {
$this->check($ID, 'r');
} else {
$input = array('itemtype' => $options["itemtype"], 'items_id' => $options["items_id"]);
// Create item
$this->check(-1, 'w', $input);
}
$type = $this->fields['itemtype'];
$link = NOT_AVAILABLE;
if (class_exists($this->fields['itemtype'])) {
$item = new $this->fields['itemtype']();
$type = $item->getTypeName();
if ($item->getFromDB($this->fields["items_id"])) {
$link = $item->getLink();
} else {
return false;
}
} else {
// item is mandatory (for entity)
return false;
}
// Ajout des infos deja remplies
if (isset($_POST) && !empty($_POST)) {
foreach ($netport->fields as $key => $val) {
if ($key != 'id' && isset($_POST[$key])) {
$netport->fields[$key] = $_POST[$key];
}
}
}
$this->showTabs($ID);
$options['entities_id'] = $item->getField('entities_id');
$this->showFormHeader($options);
$show_computer_mac = false;
if ((!empty($this->fields['itemtype']) || !$options['several']) && $this->fields['itemtype'] == 'Computer') {
$show_computer_mac = true;
}
echo "<tr class='tab_bg_1'><td>{$type} :</td>\n<td>";
if (!($ID > 0)) {
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 $link . "</td>\n";
$colspan = 9;
if ($show_computer_mac) {
$colspan += 2;
}
if (!$options['several']) {
$colspan++;
}
echo "<td rowspan='{$colspan}'>" . $LANG['common'][25] . " :</td>";
echo "<td rowspan='{$colspan}' class='middle'>";
echo "<textarea cols='45' rows='11' name='comment' >" . $this->fields["comment"] . "</textarea>";
echo "</td></tr>\n";
if (!$options['several']) {
echo "<tr class='tab_bg_1'><td>" . $LANG['networking'][21] . " :</td>\n";
echo "<td>";
autocompletionTextField($this, "logical_number", array('size' => 5));
echo "</td></tr>\n";
} else {
echo "<tr class='tab_bg_1'><td>" . $LANG['networking'][21] . " :</td>\n";
echo "<td>";
echo "<input type='hidden' name='several' value='yes'>";
echo "<input type='hidden' name='logical_number' value=''>\n";
echo $LANG['networking'][47] . " : ";
Dropdown::showInteger('from_logical_number', 0, 0, 100);
echo " " . $LANG['networking'][48] . " : ";
Dropdown::showInteger('to_logical_number', 0, 0, 100);
echo "</td></tr>\n";
}
echo "<tr class='tab_bg_1'><td>" . $LANG['common'][16] . " :</td>\n";
echo "<td>";
autocompletionTextField($this, "name");
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'><td>" . $LANG['common'][65] . " :</td>\n<td>";
Dropdown::show('NetworkInterface', array('value' => $this->fields["networkinterfaces_id"]));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'><td>" . $LANG['networking'][14] . " :</td>\n<td>";
autocompletionTextField($this, "ip");
echo "</td></tr>\n";
// Show device MAC adresses
if ($show_computer_mac) {
$comp = new Computer();
$comp->getFromDB($this->fields['items_id']);
$macs = Computer_Device::getMacAddr($comp);
if (count($macs) > 0) {
echo "<tr class='tab_bg_1'><td>" . $LANG['networking'][15] . " :</td>\n<td>";
echo "<select name='pre_mac'>\n";
echo "<option value=''>" . DROPDOWN_EMPTY_VALUE . "</option>\n";
foreach ($macs as $key => $val) {
echo "<option value='" . $val . "' >{$val}</option>\n";
}
//.........这里部分代码省略.........
示例10: showNetpoints
/**
* Print the HTML array of the Netpoint associated to a Location
*
*@param $ID of the Location
*
*@return Nothing (display)
**/
function showNetpoints($ID)
{
global $DB, $CFG_GLPI, $LANG;
$netpoint = new Netpoint();
$this->check($ID, 'r');
$canedit = $this->can($ID, 'w');
if (isset($_REQUEST["start"])) {
$start = $_REQUEST["start"];
} else {
$start = 0;
}
$number = countElementsInTable('glpi_netpoints', "`locations_id`='{$ID}'");
echo "<br><div class='center'>";
if ($number < 1) {
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th colspan>" . $LANG['networking'][51] . " - " . $LANG['search'][15] . "</th></tr>";
echo "</table>\n";
} else {
printAjaxPager($this->getTreeLink() . " - " . $LANG['networking'][51], $start, $number);
if ($canedit) {
echo "<form method='post' name='massiveaction_form' id='massiveaction_form' action='" . $CFG_GLPI["root_doc"] . "/front/massiveaction.php'>";
}
echo "<table class='tab_cadre_fixe'><tr>";
if ($canedit) {
echo "<th width='10'> </th>";
}
echo "<th>" . $LANG['common'][16] . "</th>";
// Name
echo "<th>" . $LANG['common'][25] . "</th>";
// Comment
echo "</tr>\n";
$crit = array('locations_id' => $ID, 'ORDER' => 'name', 'START' => $start, 'LIMIT' => $_SESSION['glpilist_limit']);
initNavigateListItems('Netpoint', $this->getTypeName() . "= " . $this->fields['name']);
foreach ($DB->request('glpi_netpoints', $crit) as $data) {
addToNavigateListItems('Netpoint', $data["id"]);
echo "<tr class='tab_bg_1'>";
if ($canedit) {
echo "<td><input type='checkbox' name='item[" . $data["id"] . "]' value='1'></td>";
}
echo "<td><a href='" . $netpoint->getFormURL();
echo '?id=' . $data['id'] . "'>" . $data['name'] . "</a></td>";
echo "<td>" . $data['comment'] . "</td>";
echo "</tr>\n";
}
echo "</table>\n";
if ($canedit) {
openArrowMassive("massiveaction_form", true);
echo "<input type='hidden' name='itemtype' value='Netpoint'>";
echo "<input type='hidden' name='action' value='delete'>";
closeArrowMassive('massiveaction', $LANG['buttons'][6]);
echo "</form>\n";
}
}
if ($canedit) {
// Minimal form for quick input.
echo "<form action='" . $netpoint->getFormURL() . "' method='post'>";
echo "<br><table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_2 center'><td class='b'>" . $LANG['common'][87] . "</td>";
echo "<td>" . $LANG['common'][16] . " : ";
autocompletionTextField($this, "name", array('value' => ''));
echo "<input type='hidden' name='entities_id' value='" . $_SESSION['glpiactive_entity'] . "'>";
echo "<input type='hidden' name='locations_id' value='{$ID}'></td>";
echo "<td><input type='submit' name='add' value=\"" . $LANG['buttons'][8] . "\" class='submit'>";
echo "</td></tr>\n";
echo "</table></form>\n";
// Minimal form for massive input.
echo "<form action='" . $netpoint->getFormURL() . "' method='post'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_2 center'><td class='b'>" . $LANG['common'][87] . "</td>";
echo "<td>" . $LANG['common'][16] . " : ";
echo "<input type='text' maxlength='100' size='10' name='_before'> ";
Dropdown::showInteger('_from', 0, 0, 400);
echo " --> ";
Dropdown::showInteger('_to', 0, 0, 400);
echo " <input type='text' maxlength='100' size='10' name='_after'><br>";
echo "<input type='hidden' name='entities_id' value='" . $_SESSION['glpiactive_entity'] . "'>";
echo "<input type='hidden' name='locations_id' value='{$ID}'></td>";
echo "<input type='hidden' name='_method' value='addMulti'></td>";
echo "<td><input type='submit' name='execute' value=\"" . $LANG['buttons'][8] . "\"\n class='submit'>";
echo "</td></tr>\n";
echo "</table></form>\n";
}
echo "</div>\n";
}
示例11: selectValues
function selectValues($field = '')
{
global $DB, $CFG_GLPI;
if ($field == '') {
$field = $this->fields['field'];
}
echo "<span id='span_values' name='span_values'>";
if ($this->fields['itemtype'] != '') {
$item = new $this->fields['itemtype']();
$searchOption = $item->getSearchOptionByField('field', $field);
if (isset($searchOption['linkfield'])) {
$linkfield = $searchOption['linkfield'];
} else {
$linkfield = $searchOption['field'];
}
if ($linkfield == $this->fields['field']) {
$value = $this->fields['value'];
} else {
$value = '';
}
//If field is a foreign key on another table or not
$table = getTableNameForForeignKeyField($linkfield);
if ($table == '') {
if (isset($searchOption['datatype'])) {
$datatype = $searchOption['datatype'];
} else {
$datatype = 'text';
}
switch ($datatype) {
case 'text':
case 'string':
default:
autocompletionTextField($this, 'value', array('value' => $value));
break;
case 'bool':
Dropdown::showYesNo('value', $value);
break;
}
} else {
$itemtype = getItemTypeForTable($table);
Dropdown::show($itemtype, array('name' => 'value', 'value' => $value));
}
}
echo "</span>";
}
示例12: showForm
/**
* Print the Software 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;
// Show Software or blank form
if (!haveRight("software", "r")) {
return false;
}
if ($ID > 0) {
$this->check($ID, 'r');
} else {
// Create item
$this->check(-1, 'w');
}
$canedit = $this->can($ID, '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] . " :</td>";
echo "<td>";
autocompletionTextField($this, "name");
echo "</td>";
echo "<td>" . $LANG['common'][5] . " / " . $LANG['software'][6] . " :</td><td>";
Dropdown::show('Manufacturer', array('value' => $this->fields["manufacturers_id"]));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['common'][15] . " :</td><td>";
Dropdown::show('Location', array('value' => $this->fields["locations_id"], 'entity' => $this->fields["entities_id"]));
echo "</td>";
echo "<td>" . $LANG['common'][36] . " :</td><td>";
Dropdown::show('SoftwareCategory', array('value' => $this->fields["softwarecategories_id"]));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['common'][10] . " :</td><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['software'][46] . " :</td><td>";
Dropdown::showYesNo('is_helpdesk_visible', $this->fields['is_helpdesk_visible']);
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><td colspan='2'>";
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['common'][35] . " :</td><td>";
Dropdown::show('Group', array('value' => $this->fields["groups_id"], 'entity' => $this->fields["entities_id"]));
echo "</td>";
echo "<td rowspan='3' class='middle'>" . $LANG['common'][25] . " : </td>";
echo "<td class='center middle' rowspan='3'>";
echo "<textarea cols='45' rows='5' name='comment' >" . $this->fields["comment"] . "</textarea>";
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td colspan='2' class='center' height='30'>" . $datestring . " " . $date;
if (!$template && !empty($this->fields['template_name'])) {
echo "<span class='small_space'>";
echo "(" . $LANG['common'][13] . " : " . $this->fields['template_name'] . ")</span>";
}
echo "</td></tr>\n";
// UPDATE
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['software'][29] . " :</td><td colspan='3'>";
Dropdown::showYesNo("is_update", $this->fields['is_update']);
echo " " . $LANG['pager'][2] . " ";
Dropdown::show('Software', array('value' => $this->fields["softwares_id"]));
echo "</td></tr>\n";
$this->showFormButtons($options);
$this->addDivForTabs();
return true;
}
示例13: showNewRuleForm
function showNewRuleForm($ID)
{
global $LANG;
echo "<form method='post' action='" . getItemTypeFormURL('Entity') . "'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th colspan='2'>" . $this->getTitle() . "</th></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['common'][16] . " : ";
autocompletionTextField($this, "name", array('value' => '', 'size' => 33));
echo " " . $LANG['joblist'][6] . " : ";
autocompletionTextField($this, "description", array('value' => '', 'size' => 33));
echo " " . $LANG['rulesengine'][9] . " : ";
$this->dropdownRulesMatch("match", self::AND_MATCHING);
echo "</td><td class='tab_bg_2 center'>";
echo "<input type=hidden name='sub_type' value='" . get_class($this) . "'>";
echo "<input type=hidden name='entities_id' value='-1'>";
echo "<input type=hidden name='affectentity' value='{$ID}'>";
echo "<input type=hidden name='_method' value='addRule'>";
echo "<input type='submit' name='execute' value=\"" . $LANG['buttons'][8] . "\" class='submit'>";
echo "</td></tr>\n";
echo "</table></form>";
}
示例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())
{
global $LANG;
$pMonitoringCommand = new PluginMonitoringCommand();
if ($items_id == '0') {
$this->getEmpty();
} else {
$this->getFromDB($items_id);
}
$this->showFormHeader($options);
echo "<tr>";
echo "<td>";
echo $LANG['common'][6] . " :";
echo "</td>";
echo "<td>";
echo "<input type='hidden' name='is_template' value='1' />";
$objectName = autoName($this->fields["name"], "name", 1, $this->getType());
autocompletionTextField($this, 'name', array('value' => $objectName));
echo "</td>";
// * commande
echo "<td>";
echo "Commande :";
echo "</td>";
echo "<td align='center'>";
if ($this->fields['is_template'] == '1') {
$pMonitoringCommand->getFromDB($this->fields['plugin_monitoring_commands_id']);
echo $pMonitoringCommand->getLink(1);
} else {
$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>";
echo "</tr>";
echo "<tr>";
// * checks
echo "<td>" . $LANG['plugin_monitoring']['check'][0] . " :</td>";
echo "<td align='center'>";
if ($this->fields['is_template'] == '1') {
$pMonitoringCheck = new PluginMonitoringCheck();
$pMonitoringCheck->getFromDB($this->fields['plugin_monitoring_checks_id']);
echo $pMonitoringCheck->getLink(1);
} else {
Dropdown::show("PluginMonitoringCheck", array('name' => 'plugin_monitoring_checks_id', 'value' => $this->fields['plugin_monitoring_checks_id']));
}
echo "</td>";
// * active check
echo "<td>";
echo "Active checks enable :";
echo "</td>";
echo "<td align='center'>";
if ($this->fields['is_template'] == '1') {
echo Dropdown::getYesNo($this->fields['active_checks_enabled']);
} else {
Dropdown::showYesNo("active_checks_enabled", $this->fields['active_checks_enabled']);
}
echo "</td>";
echo "</tr>";
echo "<tr>";
// * passive check
echo "<td>";
echo "Passive checks enable :";
echo "</td>";
echo "<td align='center'>";
if ($this->fields['is_template'] == '1') {
echo Dropdown::getYesNo($this->fields['passive_checks_enabled']);
} else {
Dropdown::showYesNo("passive_checks_enabled", $this->fields['passive_checks_enabled']);
}
echo "</td>";
// * calendar
echo "<td>" . $LANG['plugin_monitoring']['host'][9] . " :</td>";
echo "<td align='center'>";
if ($this->fields['is_template'] == '1') {
$calendar = new Calendar();
$calendar->getFromDB($this->fields['calendars_id']);
echo $calendar->getLink(1);
} else {
dropdown::show("Calendar", array('name' => 'calendars_id', 'value' => $this->fields['calendars_id']));
}
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<th colspan='4'>Remote check</th>";
echo "</tr>";
echo "<tr>";
// * remotesystem
echo "<td>";
echo "Utility used for remote check :";
echo "</td>";
echo "<td>";
$input = array();
//.........这里部分代码省略.........
示例15: showLDAPForm
function showLDAPForm($target, $ID)
{
global $LANG;
if (!haveRight("group", "r")) {
return false;
}
if ($ID > 0) {
$this->check($ID, 'r');
} else {
// Create item
$this->check(-1, 'w');
}
echo "<form name='groupldap_form' id='groupldap_form' method='post' action='{$target}'>";
echo "<div class='spaced'><table class='tab_cadre_fixe'>";
if (haveRight("config", "r") && AuthLdap::useAuthLdap()) {
echo "<tr class='tab_bg_1'>";
echo "<td colspan='2' class='center'>" . $LANG['setup'][256] . " : </td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['setup'][260] . " : </td>";
echo "<td>";
autocompletionTextField($this, "ldap_field");
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['setup'][601] . " : </td>";
echo "<td>";
autocompletionTextField($this, "ldap_value");
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td colspan='2' class='center'>" . $LANG['setup'][257] . " : </td>";
echo "</tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['setup'][261] . " : </td>";
echo "<td>";
autocompletionTextField($this, "ldap_group_dn");
echo "</td></tr>";
}
$options = array('colspan' => 1, 'candel' => false);
$this->showFormButtons($options);
echo "</table></div></form>";
}