예제 #1
0
 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] . "&nbsp;:&nbsp;";
     autocompletionTextField($this, "name", array('value' => '', 'size' => 33));
     echo "&nbsp;&nbsp;&nbsp;" . $LANG['joblist'][6] . "&nbsp;:&nbsp;";
     autocompletionTextField($this, "description", array('value' => '', 'size' => 33));
     echo "&nbsp;&nbsp;&nbsp;" . $LANG['rulesengine'][9] . "&nbsp;:&nbsp;";
     $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] . "&nbsp;:&nbsp;";
     Dropdown::show('Profile');
     echo "<span class='small_space'>" . $LANG['profiles'][28] . "</span>&nbsp;:&nbsp;";
     Dropdown::showYesNo("is_recursive", 0);
     echo "</td></tr>\n";
     echo "</table></form>";
 }
예제 #2
0
 /**
  * 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] . "&nbsp;:</td>";
     echo "<td>";
     autocompletionTextField($this, "name");
     echo "</td>";
     echo "<td rowspan='7' class='middle right'>" . $LANG['common'][25] . "&nbsp;: </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] . "&nbsp;:</td>";
     echo "<td>";
     autocompletionTextField($this, "firstname");
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['help'][35] . "&nbsp;: </td>";
     echo "<td>";
     autocompletionTextField($this, "phone");
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['help'][35] . " 2&nbsp;:</td>";
     echo "<td>";
     autocompletionTextField($this, "phone2");
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['common'][42] . "&nbsp;:</td>";
     echo "<td>";
     autocompletionTextField($this, "mobile");
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['financial'][30] . "&nbsp;:</td>";
     echo "<td>";
     autocompletionTextField($this, "fax");
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['setup'][14] . "&nbsp;:</td>";
     echo "<td>";
     autocompletionTextField($this, "email");
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['common'][17] . "&nbsp;:</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&amp;id={$ID}'>" . $LANG['common'][46] . "</a>";
     }
     echo "</td></tr>";
     $this->showFormButtons($options);
     $this->addDivForTabs();
     return true;
 }
 /**
  * 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] . "&nbsp;:</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] . "&nbsp;:</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] . "&nbsp;:</td>";
     echo "<td>";
     autocompletionTextField($this, "name");
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'><td>" . $LANG['setup'][5] . "&nbsp;:</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] . "&nbsp;:</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;
 }
 /**
  * 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] . ")&nbsp;:</td><td>";
     autocompletionTextField($this, "name");
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'><td>" . $LANG['common'][60] . "&nbsp;:</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] . "&nbsp;:</td><td>";
     autocompletionTextField($this, "login");
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'><td>" . $LANG['login'][7] . "&nbsp;:</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] . "&nbsp;:</td><td>";
     self::showMaxFilesize('filesize_max', $this->fields["filesize_max"]);
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'><td>" . $LANG['common'][25] . "&nbsp;:</td>";
     echo "<td><textarea cols='45' rows='5' name='comment' >" . $this->fields["comment"] . "</textarea>";
     if ($ID > 0) {
         echo "<br>" . $LANG['common'][26] . "&nbsp;: " . convDateTime($this->fields["date_mod"]);
     }
     echo "</td></tr>";
     $this->showFormButtons($options);
     $this->addDivForTabs();
     return true;
 }
 /**
  * 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] . "&nbsp;:</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] . "&nbsp;:</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] . "&nbsp;:</td>";
     echo "<td>";
     autocompletionTextField($this, "name");
     echo "</td>";
     echo "<td>" . $LANG['common'][19] . "&nbsp;:</td>";
     echo "<td>";
     autocompletionTextField($this, "serial");
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['software'][1] . "&nbsp;:</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] . "&nbsp;:</td>";
     echo "<td>";
     autocompletionTextField($this, "otherserial");
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['software'][2] . "&nbsp;:</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] . "&nbsp;:</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] . "&nbsp;:</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] . "&nbsp;:</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] . "&nbsp;: </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
0
 /**
  * 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] . "&nbsp;: </td>";
     echo "<td>";
     autocompletionTextField($this, "name");
     echo "</td>";
     echo "<td rowspan='{$rowspan}' class='middle right'>" . $LANG['common'][25] . "&nbsp;: </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] . "&nbsp;:</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] . "&nbsp;: </td>";
     echo "<td>";
     showDateFormItem("begin_date", $this->fields["begin_date"]);
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['search'][9] . "&nbsp;: </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] . "&nbsp;: </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
0
 /**
  *
  * 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] . "&nbsp;: " . $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] . "&nbsp;: ";
             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 "&nbsp;(" . 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] . "&nbsp;:&nbsp;";
                 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
                     } else {
                         if ($this instanceof CommonDBChild) {
                             echo Dropdown::getYesNo($this->isRecursive());
                             $comment = $LANG['common'][91];
                         } else {
                             if (!$this->canUnrecurs()) {
                                 echo Dropdown::getYesNo($this->fields["is_recursive"]);
                                 $comment = $LANG['common'][84];
                             } else {
                                 Dropdown::showYesNo("is_recursive", $this->fields["is_recursive"]);
                                 $comment = $LANG['common'][85];
                             }
                         }
                     }
                     echo "&nbsp;";
                     showToolTip($comment);
                 } else {
                     echo Dropdown::getYesNo($this->fields["is_recursive"]);
                 }
             } else {
                 echo "<input type='hidden' name='is_recursive' value='0'>";
             }
         } else {
             echo "&nbsp;";
         }
     }
     echo "</th></tr>\n";
 }
예제 #8
0
 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] . "&nbsp;:&nbsp;</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] . "&nbsp;:&nbsp;</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 "&nbsp;" . $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 "&nbsp;" . $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
0
 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}&nbsp;:</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] . "&nbsp;:</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] . "&nbsp;:</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] . "&nbsp;:</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] . "&nbsp;:&nbsp;";
         Dropdown::showInteger('from_logical_number', 0, 0, 100);
         echo "&nbsp;" . $LANG['networking'][48] . "&nbsp;:&nbsp;";
         Dropdown::showInteger('to_logical_number', 0, 0, 100);
         echo "</td></tr>\n";
     }
     echo "<tr class='tab_bg_1'><td>" . $LANG['common'][16] . "&nbsp;:</td>\n";
     echo "<td>";
     autocompletionTextField($this, "name");
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'><td>" . $LANG['common'][65] . "&nbsp;:</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] . "&nbsp;:</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] . "&nbsp;:</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";
             }
             echo "</select></td></tr>\n";
             echo "<tr class='tab_bg_2'>";
             echo "<td colspan='2' class='center'>" . $LANG['networking'][57];
             echo "</td></tr>\n";
         }
     }
     echo "<tr class='tab_bg_1'><td>" . $LANG['networking'][15] . "&nbsp;:</td>\n<td>";
     autocompletionTextField($this, "mac");
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'><td>" . $LANG['networking'][60] . "&nbsp;:</td>\n<td>";
     autocompletionTextField($this, "netmask");
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'><td>" . $LANG['networking'][59] . "&nbsp;:</td>\n<td>";
     autocompletionTextField($this, "gateway");
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'><td>" . $LANG['networking'][61] . "&nbsp;:</td>\n<td>";
     autocompletionTextField($this, "subnet");
     echo "</td></tr>\n";
     if (!$options['several']) {
         echo "<tr class='tab_bg_1'><td>" . $LANG['networking'][51] . "&nbsp;:</td>\n";
         echo "<td>";
         Netpoint::dropdownNetpoint("netpoints_id", $this->fields["netpoints_id"], $item->fields['locations_id'], 1, $item->getEntityID(), $this->fields["itemtype"]);
         echo "</td></tr>\n";
     }
     $this->showFormButtons($options);
     $this->addDivForTabs();
 }
예제 #10
0
 /**
  * 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'>&nbsp;</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] . "&nbsp;: ";
         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] . "&nbsp;: ";
         echo "<input type='text' maxlength='100' size='10' name='_before'>&nbsp;";
         Dropdown::showInteger('_from', 0, 0, 400);
         echo "&nbsp;-->&nbsp;";
         Dropdown::showInteger('_to', 0, 0, 400);
         echo "&nbsp;<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";
 }
 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
0
 /**
  * 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] . "&nbsp;: ";
         $date = convDateTime($_SESSION["glpi_currenttime"]);
     } else {
         if (isset($options['withtemplate']) && $options['withtemplate'] == 1) {
             $template = "newtemplate";
             $datestring = $LANG['computers'][14] . "&nbsp;: ";
             $date = convDateTime($_SESSION["glpi_currenttime"]);
         } else {
             $datestring = $LANG['common'][26] . "&nbsp;: ";
             $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] . "&nbsp;:</td>";
     echo "<td>";
     autocompletionTextField($this, "name");
     echo "</td>";
     echo "<td>" . $LANG['common'][5] . " / " . $LANG['software'][6] . "&nbsp;:</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] . "&nbsp;:</td><td>";
     Dropdown::show('Location', array('value' => $this->fields["locations_id"], 'entity' => $this->fields["entities_id"]));
     echo "</td>";
     echo "<td>" . $LANG['common'][36] . "&nbsp;:</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] . "&nbsp;:</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] . "&nbsp;:</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] . "&nbsp;:</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] . "&nbsp;:</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] . "&nbsp;: </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 . "&nbsp;" . $date;
     if (!$template && !empty($this->fields['template_name'])) {
         echo "<span class='small_space'>";
         echo "(" . $LANG['common'][13] . "&nbsp;: " . $this->fields['template_name'] . ")</span>";
     }
     echo "</td></tr>\n";
     // UPDATE
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['software'][29] . "&nbsp;:</td><td colspan='3'>";
     Dropdown::showYesNo("is_update", $this->fields['is_update']);
     echo "&nbsp;" . $LANG['pager'][2] . "&nbsp;";
     Dropdown::show('Software', array('value' => $this->fields["softwares_id"]));
     echo "</td></tr>\n";
     $this->showFormButtons($options);
     $this->addDivForTabs();
     return true;
 }
예제 #13
0
 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] . "&nbsp;:&nbsp;";
     autocompletionTextField($this, "name", array('value' => '', 'size' => 33));
     echo "&nbsp;&nbsp;&nbsp;" . $LANG['joblist'][6] . "&nbsp;:&nbsp;";
     autocompletionTextField($this, "description", array('value' => '', 'size' => 33));
     echo "&nbsp;&nbsp;&nbsp;" . $LANG['rulesengine'][9] . "&nbsp;:&nbsp;";
     $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
0
 /**
  * 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] . "&nbsp;:";
     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&nbsp;:";
     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] . "&nbsp;:</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&nbsp;:";
     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&nbsp;:";
     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] . "&nbsp;:</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&nbsp;:";
     echo "</td>";
     echo "<td>";
     $input = array();
     $input[''] = '------';
     $input['byssh'] = 'byssh';
     $input['nrpe'] = 'nrpe';
     $input['nsca'] = 'nsca';
     if ($this->fields['is_template'] == '1') {
         echo $input[$this->fields['remotesystem']];
     } else {
         Dropdown::showFromArray("remotesystem", $input, array('value' => $this->fields['remotesystem']));
     }
     echo "</td>";
     // * is_argument
     echo "<td>";
     echo "Use arguments (Only for NRPE)&nbsp;:";
     echo "</td>";
     echo "<td>";
     if ($this->fields['is_template'] == '1') {
         echo Dropdown::getYesNo($this->fields['is_arguments']);
     } else {
         Dropdown::showYesNo("is_arguments", $this->fields['is_arguments']);
     }
     echo "</td>";
     echo "</tr>";
     echo "<tr>";
     // alias command
     echo "<td>";
     echo "Alias command if required (Only for NRPE)&nbsp;:";
     echo "</td>";
     echo "<td>";
     if ($this->fields['is_template'] == '1') {
         echo "<input type='text' name='alias_commandservice' value='" . $this->fields['alias_command'] . "' />";
     } else {
         echo "<input type='text' name='alias_command' value='" . $this->fields['alias_command'] . "' />";
     }
     echo "</td>";
     echo "<td>";
     echo "Command link (used for graphs generation)&nbsp;:";
     echo "</td>";
     echo "<td>";
     if ($this->fields['is_template'] == '1') {
         $pMonitoringCommand->getFromDB($this->fields['aliasperfdata_commands_id']);
         echo $pMonitoringCommand->getLink(1);
     } else {
         $pMonitoringCommand->getFromDB($this->fields['aliasperfdata_commands_id']);
         Dropdown::show("PluginMonitoringCommand", array('name' => 'aliasperfdata_commands_id', 'value' => $this->fields['aliasperfdata_commands_id']));
     }
     echo "</td>";
     echo "</tr>";
     // * Manage arguments
     $array = array();
     $a_displayarg = array();
     if (isset($pMonitoringCommand->fields['command_line'])) {
         preg_match_all("/\\\$(ARG\\d+)\\\$/", $pMonitoringCommand->fields['command_line'], $array);
         $a_arguments = importArrayFromDB($this->fields['arguments']);
         foreach ($array[0] as $arg) {
             if (strstr($arg, "ARG")) {
                 $arg = str_replace('$', '', $arg);
                 if (!isset($a_arguments[$arg])) {
                     $a_arguments[$arg] = '';
                 }
                 $a_displayarg[$arg] = $a_arguments[$arg];
             }
         }
     }
     if (count($a_displayarg) > 0) {
         $a_argtext = importArrayFromDB($pMonitoringCommand->fields['arguments']);
         echo "<tr>";
         echo "<th colspan='4'>Arguments&nbsp;</th>";
         echo "</tr>";
         foreach ($a_displayarg as $key => $value) {
             echo "<tr>";
             echo "<th>" . $key . "</th>";
             echo "<td colspan='2'>";
             if (isset($a_argtext[$key])) {
                 echo nl2br($a_argtext[$key]) . "&nbsp;:";
             } else {
                 echo "Argument&nbsp;:";
             }
             echo "</td>";
             echo "<td>";
             echo "<input type='text' name='arg[" . $key . "]' value='" . $value . "'/><br/>";
             echo "</td>";
             echo "</tr>";
         }
     }
     $this->showFormButtons($options);
     return true;
 }
예제 #15
0
 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] . "&nbsp;:&nbsp;</td></tr>";
         echo "<tr class='tab_bg_1'>";
         echo "<td>" . $LANG['setup'][260] . "&nbsp;:&nbsp;</td>";
         echo "<td>";
         autocompletionTextField($this, "ldap_field");
         echo "</td></tr>";
         echo "<tr class='tab_bg_1'>";
         echo "<td>" . $LANG['setup'][601] . "&nbsp;:&nbsp;</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] . "&nbsp;:&nbsp;</td>";
         echo "</tr>";
         echo "<tr class='tab_bg_1'>";
         echo "<td>" . $LANG['setup'][261] . "&nbsp;:&nbsp;</td>";
         echo "<td>";
         autocompletionTextField($this, "ldap_group_dn");
         echo "</td></tr>";
     }
     $options = array('colspan' => 1, 'candel' => false);
     $this->showFormButtons($options);
     echo "</table></div></form>";
 }
예제 #16
0
 /**
  * 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 ? "*" : "") . "&nbsp;:</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] . "&nbsp;:</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] . "&nbsp;: </td>";
     echo "<td>";
     Dropdown::show('Location', array('value' => $this->fields["locations_id"], 'entity' => $this->fields["entities_id"]));
     echo "</td>";
     echo "<td>" . $LANG['common'][17] . "&nbsp;: </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] . "&nbsp;: </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] . "&nbsp;: </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] . "&nbsp;: </td>";
     echo "<td >";
     autocompletionTextField($this, 'contact_num');
     echo "</td>";
     echo "<td>" . $LANG['common'][22] . "&nbsp;: </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] . "&nbsp;:</td>";
     echo "<td>";
     autocompletionTextField($this, 'contact');
     echo "</td>";
     echo "<td>" . $LANG['common'][19] . "&nbsp;:</td>";
     echo "<td >";
     autocompletionTextField($this, 'serial');
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['common'][34] . "&nbsp;: </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 ? "*" : "") . "&nbsp;:</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] . "&nbsp;:</td>";
     echo "<td>";
     Dropdown::show('Group', array('value' => $this->fields["groups_id"], 'entity' => $this->fields["entities_id"]));
     echo "</td>";
     echo "<td>" . $LANG['setup'][88] . "&nbsp;:</td>";
     echo "<td>";
     Dropdown::show('Network', array('value' => $this->fields["networks_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['setup'][89] . "&nbsp;:</td>";
     echo "<td >";
     Dropdown::show('Domain', array('value' => $this->fields["domains_id"]));
     echo "</td>";
     echo "<td rowspan='8'>" . $LANG['common'][25] . "&nbsp;:</td>";
     echo "<td rowspan='8' class='middle'>";
     echo "<textarea cols='45' rows='11' name='comment' >" . $this->fields["comment"] . "</textarea>";
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['computers'][9] . "&nbsp;:</td>";
     echo "<td>";
     Dropdown::show('OperatingSystem', array('value' => $this->fields["operatingsystems_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['computers'][53] . "&nbsp;:</td>";
     echo "<td >";
     Dropdown::show('OperatingSystemServicePack', array('value' => $this->fields["operatingsystemservicepacks_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['computers'][52] . "&nbsp;:</td>";
     echo "<td >";
     Dropdown::show('OperatingSystemVersion', array('value' => $this->fields["operatingsystemversions_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['computers'][11] . "&nbsp;:</td>";
     echo "<td >";
     autocompletionTextField($this, 'os_licenseid');
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['computers'][10] . "&nbsp;:</td>";
     echo "<td >";
     autocompletionTextField($this, 'os_license_number');
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['computers'][58] . "&nbsp;:</td>";
     echo "<td >";
     autocompletionTextField($this, 'uuid');
     echo "</td></tr>\n";
     // Get OCS Datas :
     $dataocs = array();
     if (!empty($ID) && $this->fields["is_ocs_import"] && haveRight("view_ocsng", "r")) {
         $query = "SELECT *\n                   FROM `glpi_ocslinks`\n                   WHERE `computers_id` = '{$ID}'";
         $result = $DB->query($query);
         if ($DB->numrows($result) == 1) {
             $dataocs = $DB->fetch_array($result);
         }
     }
     echo "<tr class='tab_bg_1'>";
     echo "<td colspan='2' class='center'>" . $datestring . $date;
     if (!$template && !empty($this->fields['template_name'])) {
         echo "<span class='small_space'>(" . $LANG['common'][13] . "&nbsp;: " . $this->fields['template_name'] . ")</span>";
     }
     if (!empty($ID) && $this->fields["is_ocs_import"] && haveRight("view_ocsng", "r") && count($dataocs)) {
         echo "<br>";
         echo $LANG['ocsng'][14] . "&nbsp;: " . convDateTime($dataocs["last_ocs_update"]);
         echo "<br>";
         echo $LANG['ocsng'][13] . "&nbsp;: " . convDateTime($dataocs["last_update"]);
         echo "<br>";
         if (haveRight("ocsng", "r")) {
             echo $LANG['common'][52] . " <a href='" . $CFG_GLPI["root_doc"] . "/front/ocsserver.form.php?id=" . OcsServer::getByMachineID($ID) . "'>" . OcsServer::getServerNameByID($ID) . "</a>";
             $query = "SELECT `ocs_agent_version`, `ocsid`\n                      FROM `glpi_ocslinks`\n                      WHERE `computers_id` = '{$ID}'";
             $result_agent_version = $DB->query($query);
             $data_version = $DB->fetch_array($result_agent_version);
             $ocs_config = OcsServer::getConfig(OcsServer::getByMachineID($ID));
             //If have write right on OCS and ocsreports url is not empty in OCS config
             if (haveRight("ocsng", "w") && $ocs_config["ocs_url"] != '') {
                 echo ", " . OcsServer::getComputerLinkToOcsConsole(OcsServer::getByMachineID($ID), $data_version["ocsid"], $LANG['ocsng'][57]);
             }
             if ($data_version["ocs_agent_version"] != NULL) {
                 echo " , " . $LANG['ocsng'][49] . "&nbsp;: " . $data_version["ocs_agent_version"];
             }
         } else {
             echo $LANG['common'][52] . " " . OcsServer::getServerNameByID($ID);
         }
     }
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     if (!empty($ID) && $this->fields["is_ocs_import"] && haveRight("view_ocsng", "r") && haveRight("sync_ocsng", "w") && count($dataocs)) {
         echo "<td >" . $LANG['ocsng'][6] . " " . $LANG['Menu'][33] . "&nbsp;:</td>";
         echo "<td >";
         Dropdown::showYesNo("_auto_update_ocs", $dataocs["use_auto_update"]);
         echo "</td>";
     } else {
         echo "<td colspan=2></td>";
     }
     echo "<td>" . $LANG['computers'][51] . "&nbsp;:</td>";
     echo "<td >";
     Dropdown::show('AutoUpdateSystem', array('value' => $this->fields["autoupdatesystems_id"]));
     echo "</td></tr>";
     $this->showFormButtons($options);
     $this->addDivForTabs();
     return true;
 }
예제 #17
0
 function showForm($items_id, $options = array())
 {
     global $DB, $CFG_GLPI, $LANG;
     if ($items_id == '0') {
         $this->getEmpty();
     } else {
         $this->getFromDB($items_id);
     }
     $this->showTabs($options);
     $options['formoptions'] = " enctype='multipart/form-data'";
     $this->showFormHeader($options);
     echo "<tr>";
     echo "<td>";
     echo $LANG['common'][16] . "&nbsp;:";
     echo "</td>";
     echo "<td>";
     $objectName = autoName($this->fields["name"], "name", 1, $this->getType());
     autocompletionTextField($this, 'name', array('value' => $objectName));
     echo "</td>";
     echo "<td>" . $LANG['plugin_monitoring']['weathermap'][3] . "&nbsp;:</td>";
     echo "<td>";
     Dropdown::showInteger("width", $this->fields['width'], 100, 3000, 20);
     echo "</td>";
     echo "</tr>";
     echo "<tr>";
     echo "<td>";
     echo $LANG['plugin_monitoring']['weathermap'][5] . "&nbsp;:";
     echo "</td>";
     echo "<td>";
     if ($this->fields['background'] == '') {
         echo "<input type='file' size='25' value='' name='background'/>";
     } else {
         echo $this->fields['background'];
         echo "&nbsp;";
         echo "<input type='image' name='deletepic' value='deletepic' class='submit' src='" . $CFG_GLPI["root_doc"] . "/pics/delete.png' >";
     }
     echo "</td>";
     echo "<td>" . $LANG['plugin_monitoring']['weathermap'][4] . "&nbsp;:</td>";
     echo "<td>";
     Dropdown::showInteger("height", $this->fields['height'], 100, 3000, 20);
     echo "</td>";
     echo "</tr>";
     $this->showFormButtons($options);
     $this->addDivForTabs();
     return true;
 }
예제 #18
0
 /**
  * Show Infocom form for an item (not a standard showForm)
  *
  * @param $item CommonDBTM object
  * @param $withtemplate integer: template or basic item
  **/
 static function showForItem(CommonDBTM $item, $withtemplate = '')
 {
     global $CFG_GLPI, $LANG;
     // Show Infocom or blank form
     if (!haveRight("infocom", "r")) {
         return false;
     }
     if (!$item) {
         echo "<div class='spaced'>" . $LANG['financial'][85] . "</div>";
     } else {
         $date_tax = $CFG_GLPI["date_tax"];
         $dev_ID = $item->getField('id');
         $ic = new self();
         $option = "";
         if ($withtemplate == 2) {
             $option = " readonly ";
         }
         if (!strpos($_SERVER['PHP_SELF'], "infocoms-show") && in_array($item->getType(), array('CartridgeItem', 'ConsumableItem', 'Software'))) {
             echo "<div class='firstbloc center'>" . $LANG['financial'][84] . "</div>";
         }
         if (!$ic->getFromDBforDevice($item->getType(), $dev_ID)) {
             $input = array('itemtype' => $item->getType(), 'items_id' => $dev_ID, 'entities_id' => $item->getEntityID());
             if ($ic->can(-1, "w", $input) && $withtemplate != 2) {
                 echo "<div class='spaced b'>";
                 echo "<table class='tab_cadre_fixe'><tr class='tab_bg_1'><th>";
                 echo $item->getTypeName() . " - " . $item->getName() . "</th></tr>";
                 echo "<tr class='tab_bg_1'><td class='center'>";
                 echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/infocom.form.php?itemtype=" . $item->getType() . "&amp;items_id={$dev_ID}&amp;add=add'>" . $LANG['financial'][68];
                 echo "</a></td></tr></table></div>";
             }
         } else {
             // getFromDBforDevice
             $canedit = $ic->can($ic->fields['id'], "w") && $withtemplate != 2;
             if ($canedit) {
                 echo "<form name='form_ic' method='post' action='" . $CFG_GLPI["root_doc"] . "/front/infocom.form.php'>";
             }
             echo "<div class='spaced'>";
             echo "<table class='tab_cadre" . (!strpos($_SERVER['PHP_SELF'], "infocoms-show") ? "_fixe" : "") . "'>";
             echo "<tr><th colspan='4'>" . $LANG['financial'][3] . "</th></tr>";
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . $LANG['financial'][26] . "&nbsp;:</td>";
             echo "<td>";
             if ($withtemplate == 2) {
                 echo Dropdown::getDropdownName("glpi_suppliers", $ic->fields["suppliers_id"]);
             } else {
                 Dropdown::show('Supplier', array('value' => $ic->fields["suppliers_id"], 'entity' => $item->getEntityID()));
             }
             echo "</td>";
             if (haveRight("budget", "r")) {
                 echo "<td>" . $LANG['financial'][87] . "&nbsp;:</td><td >";
                 Dropdown::show('Budget', array('value' => $ic->fields["budgets_id"], 'entity' => $item->getEntityID(), 'comments' => 1));
             } else {
                 echo "<td colspan='2'>";
             }
             echo "</td></tr>";
             // Can edit calendar ?
             $editcalendar = $withtemplate != 2;
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . $LANG['financial'][18] . "&nbsp;:</td>";
             echo "<td >";
             autocompletionTextField($ic, "order_number", array('option' => $option));
             echo "</td>";
             echo "<td>" . $LANG['financial'][28] . "&nbsp;:</td><td>";
             showDateFormItem("order_date", $ic->fields["order_date"], true, $editcalendar);
             echo "</td></tr>";
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . $LANG['financial'][20] . "*&nbsp;:</td>";
             echo "<td>";
             $objectName = autoName($ic->fields["immo_number"], "immo_number", $withtemplate == 2, 'Infocom', $item->getEntityID());
             autocompletionTextField($ic, "immo_number", array('value' => $objectName, 'option' => $option));
             echo "</td>";
             echo "<td>" . $LANG['financial'][14] . "&nbsp;:</td><td>";
             showDateFormItem("buy_date", $ic->fields["buy_date"], true, $editcalendar);
             echo "</td></tr>";
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . $LANG['financial'][82] . "&nbsp;:</td>";
             echo "<td>";
             autocompletionTextField($ic, "bill", array('option' => $option));
             echo "</td>";
             echo "<td>" . $LANG['financial'][27] . "&nbsp;:</td><td>";
             showDateFormItem("delivery_date", $ic->fields["delivery_date"], true, $editcalendar);
             echo "</td></tr>";
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . $LANG['financial'][19] . "&nbsp;:</td><td>";
             autocompletionTextField($ic, "delivery_number", array('option' => $option));
             echo "</td>";
             echo "<td>" . $LANG['financial'][76] . "&nbsp;:</td><td>";
             showDateFormItem("use_date", $ic->fields["use_date"], true, $editcalendar);
             echo "</td></tr>";
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . $LANG['financial'][21] . "&nbsp;:</td>";
             echo "<td><input type='text' name='value' {$option} value='" . formatNumber($ic->fields["value"], true) . "' size='14'></td>";
             echo "</td>";
             echo "<td>" . $LANG['financial'][114] . "&nbsp;:</td><td>";
             showDateFormItem("inventory_date", $ic->fields["inventory_date"], true, $editcalendar);
             echo "</td></tr>";
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . $LANG['financial'][78] . "&nbsp;:</td>";
             echo "<td><input type='text' {$option} name='warranty_value' value='" . formatNumber($ic->fields["warranty_value"], true) . "' size='14'></td>";
             echo "<td rowspan='5'>" . $LANG['common'][25] . "&nbsp;:</td>";
             echo "<td rowspan='5' class='middle'>";
             echo "<textarea cols='45' rows='9' name='comment' >" . $ic->fields["comment"];
             echo "</textarea></td></tr>\n";
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . $LANG['financial'][81] . "&nbsp;:</td><td>";
             echo formatNumber(self::Amort($ic->fields["sink_type"], $ic->fields["value"], $ic->fields["sink_time"], $ic->fields["sink_coeff"], $ic->fields["warranty_date"], $ic->fields["use_date"], $date_tax, "n"));
             echo "</td></tr>";
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . $LANG['financial'][22] . "&nbsp;:</td><td >";
             if ($withtemplate == 2) {
                 echo self::getAmortTypeName($ic->fields["sink_type"]);
             } else {
                 self::dropdownAmortType("sink_type", $ic->fields["sink_type"]);
             }
             echo "</td></tr>";
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . $LANG['financial'][23] . "&nbsp;:</td><td>";
             if ($withtemplate == 2) {
                 echo $ic->fields["sink_time"];
             } else {
                 Dropdown::showInteger("sink_time", $ic->fields["sink_time"], 0, 15);
             }
             echo "</td></tr>";
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . $LANG['financial'][77] . "&nbsp;:</td>";
             echo "<td>";
             autocompletionTextField($ic, "sink_coeff", array('size' => 14, 'option' => $option));
             echo "</td></tr>";
             echo "<tr class='tab_bg_1'>";
             if (!in_array($item->getType(), array('Cartridge', 'CartridgeItem', 'Consumable', 'ConsumableItem', 'Software', 'SoftwareLicense'))) {
                 echo "<td>" . $LANG['financial'][89] . "&nbsp;:</td><td>";
                 echo self::showTco($item->getField('ticket_tco'), $ic->fields["value"]);
             } else {
                 echo "<td colspan='2'>";
             }
             echo "</td>";
             if (!in_array($item->getType(), array('Cartridge', 'CartridgeItem', 'Consumable', 'ConsumableItem', 'Software', 'SoftwareLicense'))) {
                 echo "<td>" . $LANG['financial'][90] . "&nbsp;:</td><td>";
                 echo self::showTco($item->getField('ticket_tco'), $ic->fields["value"], $ic->fields["warranty_date"]);
             } else {
                 echo "<td colspan='2'>";
             }
             echo "</td></tr>";
             echo "<tr><th colspan='4'>" . $LANG['financial'][7] . "</th></tr>";
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . $LANG['financial'][29] . "&nbsp;:</td><td>";
             showDateFormItem("warranty_date", $ic->fields["warranty_date"], true, $editcalendar);
             echo "</td>";
             echo "<td>" . $LANG['financial'][15] . "&nbsp;:</td><td>";
             if ($withtemplate == 2) {
                 // -1 = life
                 if ($ic->fields["warranty_duration"] == -1) {
                     echo $LANG['financial'][2];
                 } else {
                     echo $ic->fields["warranty_duration"];
                 }
             } else {
                 Dropdown::showInteger("warranty_duration", $ic->fields["warranty_duration"], 0, 120, 1, array(-1 => $LANG['financial'][2]));
             }
             if ($ic->fields["warranty_duration"] >= 0) {
                 echo " " . $LANG['financial'][57];
             }
             echo "<span class='small_space'>" . $LANG['financial'][88] . "</span>&nbsp;";
             echo getWarrantyExpir($ic->fields["warranty_date"], $ic->fields["warranty_duration"]);
             echo "</td></tr>";
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . $LANG['financial'][16] . "&nbsp;:</td>";
             echo "<td >";
             autocompletionTextField($ic, "warranty_info", array('option' => $option));
             echo "</td>";
             if ($CFG_GLPI['use_mailing']) {
                 echo "<td>" . $LANG['setup'][247] . "&nbsp;:</td>";
                 echo "<td>";
                 echo self::dropdownAlert("alert", $ic->fields["alert"]);
                 Alert::displayLastAlert('Infocom', $ic->fields['id']);
                 echo "</td>";
             } else {
                 echo "</td><td colspan='2'>";
             }
             echo "</td></tr>";
             if ($canedit) {
                 echo "<tr>";
                 echo "<td class='tab_bg_2 center' colspan='2'>";
                 echo "<input type='hidden' name='id' value='" . $ic->fields['id'] . "'>";
                 echo "<input type='submit' name='update' value=\"" . $LANG['buttons'][7] . "\"\n                      class='submit'>";
                 echo "</td>";
                 echo "<td class='tab_bg_2 center' colspan='2'>";
                 echo "<input type='submit' name='delete' value=\"" . $LANG['buttons'][6] . "\"\n                      class='submit'>";
                 echo "</td></tr>";
                 echo "</table></div></form>";
             } else {
                 echo "</table></div>";
             }
         }
     }
 }
예제 #19
0
 /**
  * Print the phone 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("phone", "r")) {
         return false;
     }
     if ($ID > 0) {
         $this->check($ID, 'r');
     } else {
         // Create item
         $this->check(-1, 'w');
     }
     $this->showTabs($options);
     $this->showFormHeader($options);
     if (isset($options['withtemplate']) && $options['withtemplate'] == 2) {
         $template = "newcomp";
         $datestring = $LANG['computers'][14] . "&nbsp;: ";
         $date = convDateTime($_SESSION["glpi_currenttime"]);
     } else {
         if (isset($options['withtemplate']) && $options['withtemplate'] == 1) {
             $template = "newtemplate";
             $datestring = $LANG['computers'][14] . "&nbsp;: ";
             $date = convDateTime($_SESSION["glpi_currenttime"]);
         } else {
             $datestring = $LANG['common'][26] . "&nbsp;: ";
             $date = convDateTime($this->fields["date_mod"]);
             $template = false;
         }
     }
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['common'][16] . ($template ? "*" : "") . "&nbsp;:</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] . "&nbsp;:</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] . "&nbsp;:</td>";
     echo "<td>";
     Dropdown::show('Location', array('value' => $this->fields["locations_id"], 'entity' => $this->fields["entities_id"]));
     echo "</td>";
     echo "<td>" . $LANG['common'][17] . "&nbsp;:</td>";
     echo "<td>";
     Dropdown::show('PhoneType', array('value' => $this->fields["phonetypes_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['common'][10] . "&nbsp;:</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] . "&nbsp;:</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] . "&nbsp;:</td>";
     echo "<td>";
     autocompletionTextField($this, "contact_num");
     echo "</td>";
     echo "<td>" . $LANG['common'][22] . "&nbsp;:</td>";
     echo "<td>";
     Dropdown::show('PhoneModel', array('value' => $this->fields["phonemodels_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['common'][18] . "&nbsp;:</td><td>";
     autocompletionTextField($this, "contact");
     echo "</td>";
     echo "<td>" . $LANG['common'][19] . "&nbsp;:</td>";
     echo "<td>";
     autocompletionTextField($this, "serial");
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['common'][34] . "&nbsp;:</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 ? "*" : "") . "&nbsp;:</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] . "&nbsp;:</td>";
     echo "<td>";
     Dropdown::show('Group', array('value' => $this->fields["groups_id"], 'entity' => $this->fields["entities_id"]));
     echo "</td>";
     echo "<td>" . $LANG['peripherals'][33] . "&nbsp;:</td>";
     echo "<td>";
     Dropdown::showGlobalSwitch($this->fields["id"], array('withtemplate' => $withtemplate, 'value' => $this->fields["is_global"], 'management_restrict' => $CFG_GLPI["phones_management_restrict"], 'target' => $target));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['peripherals'][18] . "&nbsp;:</td>";
     echo "<td>";
     autocompletionTextField($this, "brand");
     echo "</td>";
     echo "<td rowspan='6'>";
     echo $LANG['common'][25] . "&nbsp;:</td>";
     echo "<td rowspan='6'>\n            <textarea cols='45' rows='9' name='comment' >" . $this->fields["comment"] . "</textarea>";
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['phones'][36] . "&nbsp;:</td>";
     echo "<td>";
     Dropdown::show('PhonePowerSupply', array('value' => $this->fields["phonepowersupplies_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['setup'][71] . "&nbsp;:</td>";
     echo "<td>";
     autocompletionTextField($this, "firmware");
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['phones'][40] . "&nbsp;:</td><td>";
     autocompletionTextField($this, "number_line");
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['monitors'][18] . "&nbsp;:</td>";
     echo "<td>";
     // micro?
     echo "\n<table><tr><td>" . $LANG['phones'][38] . "</td>";
     echo "<td>&nbsp;";
     Dropdown::showYesNo("have_headset", $this->fields["have_headset"]);
     echo "</td></tr>";
     // hp?
     echo "<tr><td>" . $LANG['phones'][39] . "</td>";
     echo "<td>&nbsp;";
     Dropdown::showYesNo("have_hp", $this->fields["have_hp"]);
     echo "</td></tr></table>\n";
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td colspan='2' class='center' height='30'>" . $datestring . "&nbsp;" . $date;
     if (!$template && !empty($this->fields['template_name'])) {
         echo "<span class='small_space'>";
         echo "(" . $LANG['common'][13] . "&nbsp;: " . $this->fields['template_name'] . ")</span>";
     }
     echo "</td></tr>\n";
     $this->showFormButtons($options);
     $this->addDivForTabs();
     return true;
 }
예제 #20
0
 /**
  * Print the enterprise form
  *
  * @param $ID Integer : Id of the computer or the template to print
  * @param $options array
  *     - target form target
  *     - withtemplate boolean : template or basic item
  *
  *@return Nothing (display)
  **/
 function showForm($ID, $options = array())
 {
     global $CFG_GLPI, $LANG;
     // Show Supplier or blank form
     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'][16] . "&nbsp;:</td>";
     echo "<td>";
     autocompletionTextField($this, "name");
     echo "</td>";
     echo "<td>" . $LANG['financial'][79] . "&nbsp;:</td>";
     echo "<td>";
     Dropdown::show('SupplierType', array('value' => $this->fields["suppliertypes_id"]));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['help'][35] . "&nbsp;:</td>";
     echo "<td>";
     autocompletionTextField($this, "phonenumber");
     echo "</td>";
     echo "<td rowspan='8' class='middle right'>" . $LANG['common'][25] . "&nbsp;:</td>";
     echo "<td class='center middle' rowspan='8'>";
     echo "<textarea cols='45' rows='13' name='comment' >" . $this->fields["comment"] . "</textarea>";
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['financial'][30] . "&nbsp;:</td>";
     echo "<td>";
     autocompletionTextField($this, "fax");
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['financial'][45] . "&nbsp;:</td>";
     echo "<td>";
     autocompletionTextField($this, "website");
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['setup'][14] . "&nbsp;:</td>";
     echo "<td>";
     autocompletionTextField($this, "email");
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td class='middle'>" . $LANG['financial'][44] . "&nbsp;:</td>";
     echo "<td class='middle'>";
     echo "<textarea cols='37' rows='3' name='address'>" . $this->fields["address"] . "</textarea>";
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['financial'][100] . "&nbsp;:</td>";
     echo "<td>";
     autocompletionTextField($this, "postcode", array('size' => 10));
     echo "&nbsp;&nbsp;" . $LANG['financial'][101] . "&nbsp;:&nbsp;";
     autocompletionTextField($this, "town", array('size' => 23));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['financial'][102] . "&nbsp;:</td>";
     echo "<td>";
     autocompletionTextField($this, "state");
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['financial'][103] . "&nbsp;:</td>";
     echo "<td>";
     autocompletionTextField($this, "country");
     echo "</td></tr>";
     $this->showFormButtons($options);
     $this->addDivForTabs();
     return true;
 }
예제 #21
0
 function showForm($items_id, $options = array(), $services_id = '')
 {
     global $LANG;
     $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 $LANG['common'][16] . "&nbsp;:";
     echo "</td>";
     echo "<td>";
     $objectName = autoName($this->fields["name"], "name", $template === "newcomp", $this->getType());
     autocompletionTextField($this, 'name', array('value' => $objectName));
     echo "</td>";
     echo "<td>";
     echo $LANG['common'][13] . "&nbsp;:";
     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'>&nbsp;</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 $LANG['state'][6] . " <i>" . $item->getTypeName() . "</i>";
         echo "&nbsp;:</td>";
         echo "<td>";
         echo $item->getLink(1);
         echo "</td>";
     } else {
         echo "<td colspan='2' align='center'>";
         echo "No type associated";
         echo "</td>";
     }
     // * command
     echo "<td>";
     echo $LANG['plugin_monitoring']['service'][5] . "&nbsp;:";
     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', 'value' => $pMonitoringServicedef->fields['plugin_monitoring_commands_id']));
     }
     echo "</td>";
     echo "</tr>";
     echo "<tr>";
     // * checks
     echo "<td>" . $LANG['plugin_monitoring']['check'][0] . "&nbsp;:</td>";
     echo "<td align='center'>";
     if ($this->fields['plugin_monitoring_servicetemplates_id'] > 0) {
         $pMonitoringCheck = new PluginMonitoringCheck();
         $pMonitoringCheck->getFromDB($pMonitoringServicetemplate->fields['plugin_monitoring_checks_id']);
         echo $pMonitoringCheck->getLink(1);
     } else {
         Dropdown::show("PluginMonitoringCheck", array('name' => 'plugin_monitoring_checks_id', 'value' => $pMonitoringServicedef->fields['plugin_monitoring_checks_id']));
     }
     echo "</td>";
     // * active check
     echo "<td>";
     echo $LANG['plugin_monitoring']['service'][6] . "&nbsp;:";
     echo "</td>";
     echo "<td align='center'>";
     if ($this->fields['plugin_monitoring_servicetemplates_id'] > 0) {
         echo Dropdown::getYesNo($pMonitoringServicetemplate->fields['active_checks_enabled']);
     } else {
         Dropdown::showYesNo("active_checks_enabled", $pMonitoringServicedef->fields['active_checks_enabled']);
     }
     echo "</td>";
     echo "</tr>";
     echo "<tr>";
     // * passive check
     echo "<td>";
     echo $LANG['plugin_monitoring']['service'][7] . "&nbsp;:";
     echo "</td>";
     echo "<td align='center'>";
     if ($this->fields['plugin_monitoring_servicetemplates_id'] > 0) {
         echo Dropdown::getYesNo($pMonitoringServicetemplate->fields['passive_checks_enabled']);
     } else {
         Dropdown::showYesNo("passive_checks_enabled", $pMonitoringServicedef->fields['passive_checks_enabled']);
     }
     echo "</td>";
     // * calendar
     echo "<td>" . $LANG['plugin_monitoring']['host'][9] . "&nbsp;:</td>";
     echo "<td align='center'>";
     if ($this->fields['plugin_monitoring_servicetemplates_id'] > 0) {
         $calendar = new Calendar();
         $calendar->getFromDB($pMonitoringServicetemplate->fields['calendars_id']);
         echo $calendar->getLink(1);
     } else {
         dropdown::show("Calendar", array('name' => 'calendars_id', 'value' => $pMonitoringServicedef->fields['calendars_id']));
     }
     echo "</td>";
     echo "</tr>";
     if (!($this->fields['plugin_monitoring_servicetemplates_id'] > 0 and $pMonitoringServicetemplate->fields['remotesystem'] == '')) {
         echo "<tr>";
         echo "<th colspan='4'>" . $LANG['plugin_monitoring']['service'][8] . "</th>";
         echo "</tr>";
         echo "<tr>";
         // * remotesystem
         echo "<td>";
         echo $LANG['plugin_monitoring']['service'][9] . "&nbsp;:";
         echo "</td>";
         echo "<td>";
         $input = array();
         $input[''] = '------';
         $input['byssh'] = 'byssh';
         $input['nrpe'] = 'nrpe';
         $input['nsca'] = 'nsca';
         if ($this->fields['plugin_monitoring_servicetemplates_id'] > 0) {
             echo $input[$pMonitoringServicetemplate->fields['remotesystem']];
         } else {
             Dropdown::showFromArray("remotesystem", $input, array('value' => $pMonitoringServicedef->fields['remotesystem']));
         }
         echo "</td>";
         // * is_argument
         echo "<td>";
         echo $LANG['plugin_monitoring']['service'][10] . "&nbsp;:";
         echo "</td>";
         echo "<td>";
         if ($this->fields['plugin_monitoring_servicetemplates_id'] > 0) {
             echo Dropdown::getYesNo($pMonitoringServicetemplate->fields['is_arguments']);
         } else {
             Dropdown::showYesNo("is_arguments", $pMonitoringServicedef->fields['is_arguments']);
         }
         echo "</td>";
         echo "</tr>";
         echo "<tr>";
         // alias command
         echo "<td>";
         echo $LANG['plugin_monitoring']['service'][11] . "&nbsp;:";
         echo "</td>";
         echo "<td>";
         if ($this->fields['plugin_monitoring_servicetemplates_id'] > 0) {
             echo "<input type='text' name='alias_commandservice' value='" . $this->fields['alias_command'] . "' />";
         } else {
             echo "<input type='text' name='alias_command' value='" . $pMonitoringServicedef->fields['alias_command'] . "' />";
         }
         echo "</td>";
         echo "<td>";
         echo $LANG['plugin_monitoring']['service'][12] . "&nbsp;:GHJKL";
         echo "</td>";
         echo "<td>";
         if ($this->fields['plugin_monitoring_servicetemplates_id'] > 0) {
             $pMonitoringCommand->getEmpty();
             $pMonitoringCommand->getFromDB($pMonitoringServicetemplate->fields['aliasperfdata_commands_id']);
             echo $pMonitoringCommand->getLink(1);
         } else {
             $pMonitoringCommand->getFromDB($pMonitoringServicedef->fields['aliasperfdata_commands_id']);
             Dropdown::show("PluginMonitoringCommand", array('name' => 'aliasperfdata_commands_id', 'value' => $pMonitoringServicedef->fields['aliasperfdata_commands_id']));
         }
         echo "</td>";
         echo "</tr>";
     }
     // * Manage arguments
     $array = array();
     $a_displayarg = array();
     if (isset($pMonitoringCommand->fields['command_line'])) {
         preg_match_all("/\\\$(ARG\\d+)\\\$/", $pMonitoringCommand->fields['command_line'], $array);
         $a_arguments = importArrayFromDB($this->fields['arguments']);
         foreach ($array[0] as $arg) {
             if (strstr($arg, "ARG")) {
                 $arg = str_replace('$', '', $arg);
                 if (!isset($a_arguments[$arg])) {
                     $a_arguments[$arg] = '';
                 }
                 $a_displayarg[$arg] = $a_arguments[$arg];
             }
         }
     }
     if (count($a_displayarg) > 0) {
         $a_argtext = importArrayFromDB($pMonitoringCommand->fields['arguments']);
         echo "<tr>";
         echo "<th colspan='4'>" . $LANG['plugin_monitoring']['service'][13] . "&nbsp;</th>";
         echo "</tr>";
         foreach ($a_displayarg as $key => $value) {
             echo "<tr>";
             echo "<th>" . $key . "</th>";
             echo "<td colspan='2'>";
             if (isset($a_argtext[$key])) {
                 echo nl2br($a_argtext[$key]) . "&nbsp;:";
             } else {
                 echo $LANG['plugin_monitoring']['service'][14] . "&nbsp;:";
             }
             if ($value == '') {
                 $matches = array();
                 preg_match('/(\\[\\w+\\:\\w+\\])/', nl2br($a_argtext[$key]), $matches);
                 if (isset($matches[0])) {
                     $value = $matches[0];
                 }
             }
             echo "</td>";
             echo "<td>";
             echo "<input type='text' name='arg[" . $key . "]' value='" . $value . "'/><br/>";
             echo "</td>";
             echo "</tr>";
         }
     }
     $this->showFormButtons($options);
     return true;
 }
 /**
  * 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] . "&nbsp;:</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] . "&nbsp;:</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] . "&nbsp;:</td>";
     echo "<td align='center'>";
     Dropdown::showYesNo('host_notifications_enabled', $this->fields['host_notifications_enabled']);
     echo "</td>";
     echo "<td>" . $LANG['plugin_monitoring']['contact'][5] . "&nbsp;:</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] . "&nbsp;:</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] . "&nbsp;:</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] . "&nbsp;:</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] . "&nbsp;:</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] . "&nbsp;:</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] . "&nbsp;:</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] . "&nbsp;:</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] . "&nbsp;:</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] . "&nbsp;:</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] . "&nbsp;:</td>";
     echo "<td align='center'>";
     Dropdown::showYesNo('service_notification_options_c', $this->fields['service_notification_options_c']);
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['plugin_monitoring']['contact'][13] . "&nbsp;:</td>";
     echo "<td align='center'>";
     Dropdown::showYesNo('host_notification_options_f', $this->fields['host_notification_options_f']);
     echo "</td>";
     echo "<td>" . $LANG['plugin_monitoring']['contact'][14] . "&nbsp;:</td>";
     echo "<td align='center'>";
     Dropdown::showYesNo('service_notification_options_r', $this->fields['service_notification_options_r']);
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['plugin_monitoring']['contact'][15] . "&nbsp;:</td>";
     echo "<td align='center'>";
     Dropdown::showYesNo('host_notification_options_s', $this->fields['host_notification_options_s']);
     echo "</td>";
     echo "<td>" . $LANG['plugin_monitoring']['contact'][16] . "&nbsp;:</td>";
     echo "<td align='center'>";
     Dropdown::showYesNo('service_notification_options_f', $this->fields['service_notification_options_f']);
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['plugin_monitoring']['contact'][17] . "&nbsp;:</td>";
     echo "<td align='center'>";
     Dropdown::showYesNo('host_notification_options_n', $this->fields['host_notification_options_n']);
     echo "</td>";
     echo "<td>" . $LANG['plugin_monitoring']['contact'][18] . "&nbsp;:</td>";
     echo "<td align='center'>";
     Dropdown::showYesNo('service_notification_options_n', $this->fields['service_notification_options_n']);
     echo "</td>";
     echo "</tr>";
     $this->showFormButtons($options);
     return true;
 }
예제 #23
0
 /**
  * Show the rule
  *
  * @param $ID ID of the rule
  * @param $options options
  *
  * @return nothing
  **/
 function showForm($ID, $options = array())
 {
     global $CFG_GLPI, $LANG;
     if (!$this->isNewID($ID)) {
         $this->check($ID, 'r');
     } else {
         // Create item
         $this->check(-1, 'w');
     }
     $canedit = $this->can($this->right, "w");
     $this->showTabs($options);
     $this->showFormHeader($options);
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['common'][16] . "&nbsp;:</td>";
     echo "<td>";
     autocompletionTextField($this, "name");
     echo "</td>";
     echo "<td>" . $LANG['common'][60] . "&nbsp;:</td>";
     echo "<td>";
     Dropdown::showYesNo("is_active", $this->fields["is_active"]);
     echo "</td></tr>\n";
     $sla = new SLA();
     $sla->getFromDB($this->fields['slas_id']);
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['sla'][1] . "&nbsp;:</td>";
     echo "<td>";
     echo $sla->getLink();
     echo "</td>";
     echo "<td>" . $LANG['sla'][3] . "</td>";
     echo "<td>";
     self::dropdownExecutionTime('execution_time', array('max_time' => $sla->fields['resolution_time'], 'used' => self::getAlreadyUsedExecutionTime($sla->fields['id']), 'value' => $this->fields['execution_time']));
     echo "</td></tr>\n";
     $this->showFormButtons($options);
     $this->addDivForTabs();
 }
 /**
  * Print the HTML array children of a TreeDropdown
  *
  *@param $ID of the dropdown
  *
  *@return Nothing (display)
  **/
 function showChildren($ID)
 {
     global $DB, $CFG_GLPI, $LANG;
     $this->check($ID, 'r');
     $fields = $this->getAdditionalFields();
     $nb = count($fields);
     $entity_assign = $this->isEntityAssign();
     // Minimal form for quick input.
     if ($this->canCreate()) {
         $link = $this->getFormURL();
         echo "<div class='firstbloc'>";
         echo "<form action='" . $link . "' method='post'>";
         echo "<table class='tab_cadre_fixe'>";
         echo "<tr><th colspan='2'>" . $LANG['common'][93] . "</th></tr>";
         echo "<tr class='tab_bg_1'><td>" . $LANG['common'][16] . "&nbsp;: ";
         autocompletionTextField($this, "name", array('value' => ''));
         if ($entity_assign && $this->getForeignKeyField() != 'entities_id') {
             echo "<input type='hidden' name='entities_id' value='" . $_SESSION['glpiactive_entity'] . "'>";
         }
         if ($entity_assign && $this->isRecursive()) {
             echo "<input type='hidden' name='is_recursive' value='1'>";
         }
         echo "<input type='hidden' name='" . $this->getForeignKeyField() . "' value='{$ID}'></td>";
         echo "<td><input type='submit' name='add' value=\"" . $LANG['buttons'][8] . "\" class='submit'>";
         echo "</td></tr>\n";
         echo "</table></form></div>\n";
     }
     echo "<div class='spaced'>";
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr><th colspan='" . ($nb + 3) . "'>" . $LANG['setup'][76] . " " . $this->getTreeLink();
     echo "</th></tr>";
     echo "<tr><th>" . $LANG['common'][16] . "</th>";
     // Name
     if ($entity_assign) {
         echo "<th>" . $LANG['entity'][0] . "</th>";
         // Entity
     }
     foreach ($fields as $field) {
         if ($field['list']) {
             echo "<th>" . $field['label'] . "</th>";
         }
     }
     echo "<th>" . $LANG['common'][25] . "</th>";
     echo "</tr>\n";
     $fk = $this->getForeignKeyField();
     $crit = array($fk => $ID, 'ORDER' => 'name');
     if ($entity_assign) {
         if ($fk == 'entities_id') {
             $crit['id'] = $_SESSION['glpiactiveentities'];
             $crit['id'] += $_SESSION['glpiparententities'];
         } else {
             $crit['entities_id'] = $_SESSION['glpiactiveentities'];
         }
     }
     foreach ($DB->request($this->getTable(), $crit) as $data) {
         echo "<tr class='tab_bg_1'>";
         echo "<td><a href='" . $this->getFormURL();
         echo '?id=' . $data['id'] . "'>" . $data['name'] . "</a></td>";
         if ($entity_assign) {
             echo "<td>" . Dropdown::getDropdownName("glpi_entities", $data["entities_id"]) . "</td>";
         }
         foreach ($fields as $field) {
             if ($field['list']) {
                 echo "<td>";
                 switch ($field['type']) {
                     case 'UserDropdown':
                         echo getUserName($data[$field['name']]);
                         break;
                     case 'bool':
                         echo Dropdown::getYesNo($data[$field['name']]);
                         break;
                     case 'dropdownValue':
                         echo Dropdown::getDropdownName(getTableNameForForeignKeyField($field['name']), $data[$field['name']]);
                         break;
                     default:
                         echo $data[$field['name']];
                 }
                 echo "</td>";
             }
         }
         echo "<td>" . $data['comment'] . "</td>";
         echo "</tr>\n";
     }
     echo "</table></div>\n";
 }
예제 #25
0
 function showForm($ID, $options = array())
 {
     global $LANG, $CFG_GLPI;
     if (!haveRight("notification", "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'><td>" . $LANG['common'][16] . "&nbsp;:</td>";
     echo "<td>";
     autocompletionTextField($this, "name");
     echo "</td>";
     echo "<td rowspan='6' class='middle right'>" . $LANG['common'][25] . "&nbsp;:</td>";
     echo "<td class='center middle' rowspan='6'><textarea cols='45' rows='9' name='comment' >" . $this->fields["comment"] . "</textarea></td></tr>";
     echo "<tr class='tab_bg_1'><td>" . $LANG['common'][60] . "&nbsp;:</td>";
     echo "<td>";
     Dropdown::showYesNo('is_active', $this->fields['is_active']);
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'><td>" . $LANG['common'][17] . "&nbsp;:</td>";
     echo "<td>";
     if (haveRight('config', 'w') && $this->getEntityID() == 0) {
         $rand = Dropdown::dropdownTypes("itemtype", $this->fields['itemtype'], $CFG_GLPI["notificationtemplates_types"]);
     } else {
         $rand = Dropdown::dropdownTypes("itemtype", $this->fields['itemtype'], array_diff($CFG_GLPI["notificationtemplates_types"], array('Crontask', 'DBConnection')));
     }
     $params = array('itemtype' => '__VALUE__');
     ajaxUpdateItemOnSelectEvent("dropdown_itemtype{$rand}", "show_events", $CFG_GLPI["root_doc"] . "/ajax/dropdownNotificationEvent.php", $params);
     ajaxUpdateItemOnSelectEvent("dropdown_itemtype{$rand}", "show_templates", $CFG_GLPI["root_doc"] . "/ajax/dropdownNotificationTemplate.php", $params);
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'><td>" . $LANG['mailing'][120] . "&nbsp;:</td>";
     echo "<td>";
     self::dropdownMode($this->fields['mode']);
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'><td>" . $LANG['mailing'][119] . "&nbsp;:</td>";
     echo "<td><span id='show_events'>";
     NotificationEvent::dropdownEvents($this->fields['itemtype'], $this->fields['event']);
     echo "</span></td></tr>";
     echo "<tr class='tab_bg_1'><td>" . $LANG['mailing'][113] . "&nbsp;:</td>";
     echo "<td><span id='show_templates'>";
     NotificationTemplate::dropdownTemplates('notificationtemplates_id', $this->fields['itemtype'], $this->fields['notificationtemplates_id']);
     echo "</span></td></tr>";
     $this->showFormButtons($options);
     $this->addDivForTabs();
     return true;
 }
예제 #26
0
 /**
  * Print the document 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("document", "r")) {
         return false;
     }
     if ($ID > 0) {
         $this->check($ID, 'r');
     } else {
         // Create item
         $this->check(-1, 'w');
     }
     $this->showTabs($options);
     $options['formoptions'] = " enctype='multipart/form-data'";
     $this->showFormHeader($options);
     if ($ID > 0) {
         echo "<tr><th colspan='2'>";
         if ($this->fields["users_id"] > 0) {
             echo $LANG['document'][42] . " " . getUserName($this->fields["users_id"], 1);
         } else {
             echo "&nbsp;";
         }
         echo "</th>";
         echo "<th colspan='2'>" . $LANG['common'][26] . "&nbsp;: " . convDateTime($this->fields["date_mod"]) . "</th>";
         echo "</tr>\n";
     }
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['common'][16] . "&nbsp;:</td>";
     echo "<td>";
     autocompletionTextField($this, "name");
     echo "</td>";
     echo "<td rowspan='6' class='middle right'>" . $LANG['common'][25] . "&nbsp;: </td>";
     echo "<td class='center middle' rowspan='6'>";
     echo "<textarea cols='45' rows='8' name='comment' >" . $this->fields["comment"] . "</textarea>";
     echo "</td></tr>";
     if ($ID > 0) {
         echo "<tr class='tab_bg_1'>";
         echo "<td>" . $LANG['document'][22] . "&nbsp;:</td>";
         echo "<td>" . $this->getDownloadLink('', 45);
         echo "<input type='hidden' name='current_filepath' value='" . $this->fields["filepath"] . "'>";
         echo "<input type='hidden' name='current_filename' value='" . $this->fields["filename"] . "'>";
         echo "</td></tr>";
     }
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['document'][2] . " (" . self::getMaxUploadSize() . ")&nbsp;:</td>";
     echo "<td><input type='file' name='filename' value='" . $this->fields["filename"] . "' size='39'>";
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['document'][36] . "&nbsp;:</td>";
     echo "<td>";
     $this->showUploadedFilesDropdown("upload_file");
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['document'][33] . "&nbsp;:</td>";
     echo "<td>";
     autocompletionTextField($this, "link");
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['document'][3] . "&nbsp;:</td>";
     echo "<td>";
     Dropdown::show('DocumentCategory', array('value' => $this->fields["documentcategories_id"]));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['document'][4] . "&nbsp;:</td>";
     echo "<td>";
     autocompletionTextField($this, "mime");
     if ($ID > 0) {
         echo "</td><td>" . $LANG['document'][1] . "&nbsp;:</td>";
         echo "<td>" . $this->fields["sha1sum"];
     }
     echo "</td></tr>";
     $this->showFormButtons($options);
     $this->addDivForTabs();
     return true;
 }
 /**
  * Print the version form
  *
  * @param $ID integer ID of the item
  * @param $options array
  *     - target for the Form
  *     - computers_id ID of the computer 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;
     $computers_id = -1;
     if (isset($options['computers_id'])) {
         $computers_id = $options['computers_id'];
     }
     if (!haveRight("computer", "w")) {
         return false;
     }
     $comp = new Computer();
     if ($ID > 0) {
         $this->check($ID, 'r');
         $comp->getFromDB($this->fields['computers_id']);
     } else {
         $comp->getFromDB($computers_id);
         // Create item
         $input = array('entities_id' => $comp->getEntityID());
         $this->check(-1, 'w', $input);
     }
     $this->showTabs($options);
     $this->showFormHeader($options);
     if ($ID > 0) {
         $computers_id = $this->fields["computers_id"];
     } else {
         echo "<input type='hidden' name='computers_id' value='{$computers_id}'>";
     }
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['help'][25] . "&nbsp;:</td>";
     echo "<td colspan='3'>" . $comp->getLink() . "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['common'][16] . "&nbsp;:</td>";
     echo "<td>";
     autocompletionTextField($this, "name");
     echo "</td><td>" . $LANG['computers'][62] . "&nbsp;:</td>";
     echo "<td>";
     Dropdown::show('VirtualMachineType', array('value' => $this->fields['virtualmachinetypes_id']));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['computers'][60] . "&nbsp;:</td>";
     echo "<td>";
     Dropdown::show('VirtualMachineSystem', array('value' => $this->fields['virtualmachinesystems_id']));
     echo "</td><td>" . $LANG['computers'][63] . "&nbsp;:</td>";
     echo "<td>";
     Dropdown::show('VirtualMachineState', array('value' => $this->fields['virtualmachinestates_id']));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['computers'][58] . "&nbsp;:</td>";
     echo "<td>";
     autocompletionTextField($this, "uuid");
     echo "</td>";
     echo "<td>" . $LANG['computers'][61] . "&nbsp;:</td>";
     echo "<td>";
     autocompletionTextField($this, "vcpu");
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['computers'][24] . "&nbsp;:</td>";
     echo "<td>";
     autocompletionTextField($this, "ram");
     echo "</td>";
     echo "<td>" . $LANG['computers'][64] . "&nbsp;:</td>";
     echo "<td>";
     if ($link_computer = self::findVirtualMachine($this->fields)) {
         $computer = new Computer();
         if ($computer->can($link_computer, 'r')) {
             $url = "<a href='computer.form.php?id=" . $link_computer . "'>";
             $url .= $computer->fields["name"] . "</a>";
             $tooltip = $LANG['common'][16] . "&nbsp;: " . $computer->fields['name'];
             $tooltip .= "<br>" . $LANG['common'][19] . "&nbsp;: ";
             $tooltip .= "<br>" . $computer->fields['serial'];
             $tooltip .= "<br>" . $computer->fields['comment'];
             $url .= "&nbsp; " . showToolTip($tooltip, array('display' => false));
         } else {
             $url = $this->fields['name'];
         }
         echo $url;
     }
     echo "</td>";
     echo "</tr>";
     $this->showFormButtons($options);
     $this->addDivForTabs();
     return true;
 }
 /**
  * Print the cartridge type form
  *
  * @param $ID integer ID of the item
  * @param $options array
  *     - target for the Form
  *     - withtemplate : 1 for newtemplate, 2 for newobject from template
  *
  * @return Nothing (display)
  *
  **/
 function showForm($ID, $options = array())
 {
     global $LANG;
     // Show CartridgeItem or blank form
     if (!haveRight("cartridge", "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'][16] . "&nbsp;: </td>";
     echo "<td>";
     autocompletionTextField($this, "name");
     echo "</td>";
     echo "<td rowspan='7' class='middle right'>" . $LANG['common'][25] . "&nbsp;: </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['consumables'][2] . "&nbsp;: </td>";
     echo "<td>";
     autocompletionTextField($this, "ref");
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['common'][17] . "&nbsp;: </td>";
     echo "<td>";
     Dropdown::show('CartridgeItemType', array('value' => $this->fields["cartridgeitemtypes_id"]));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['common'][5] . "&nbsp;: </td>";
     echo "<td>";
     Dropdown::show('Manufacturer', array('value' => $this->fields["manufacturers_id"]));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['common'][10] . "&nbsp;: </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></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['consumables'][36] . "&nbsp;: </td>";
     echo "<td>";
     Dropdown::show('Location', array('value' => $this->fields["locations_id"], 'entity' => $this->fields["entities_id"]));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['consumables'][38] . "&nbsp;: </td>";
     echo "<td>";
     Dropdown::showInteger('alarm_threshold', $this->fields["alarm_threshold"], -1, 100);
     Alert::displayLastAlert('CartridgeItem', $ID);
     echo "</td></tr>";
     $this->showFormButtons($options);
     $this->addDivForTabs();
     return true;
 }
예제 #29
0
 /**
  * Print the transfer form
  *
  * @param $ID Integer : Id of the contact to print
  * @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;
     if (!haveRight("transfer", "r")) {
         return false;
     }
     $edit_form = true;
     if (!strpos($_SERVER['PHP_SELF'], "transfer.form.php")) {
         $edit_form = false;
     }
     if ($ID > 0) {
         $this->check($ID, 'r');
     } else {
         // Create item
         $this->check(-1, 'w');
     }
     $params = array();
     if (!haveRight("transfer", "w")) {
         $params['readonly'] = true;
     }
     if ($edit_form) {
         $this->showTabs($options);
         $this->showFormHeader($options);
     } else {
         echo "<form method='post' name=form action='" . $options['target'] . "'>";
         echo "<div class='center' id='tabsbody' >";
         echo "<table class='tab_cadre_fixe'>";
         echo "<tr><td class='tab_bg_2 top' colspan='4'>";
         echo "<div class='center'>";
         Dropdown::show('Entity', array('name' => 'to_entity'));
         echo "&nbsp;<input type='submit' name='transfer' value=\"" . $LANG['buttons'][48] . "\"\n                      class='submit'></div>";
         echo "</td></tr>";
     }
     if ($edit_form) {
         echo "<tr class='tab_bg_1'>";
         echo "<td>" . $LANG['common'][16] . "&nbsp;:</td><td>";
         autocompletionTextField($this, "name");
         echo "</td>";
         echo "<td rowspan='3' class='middle right'>" . $LANG['common'][25] . "&nbsp;: </td>";
         echo "<td class='center middle' rowspan='3'>\n               <textarea cols='45' rows='3' name='comment' >" . $this->fields["comment"] . "</textarea>";
         echo "</td></tr>";
         echo "<tr class='tab_bg_1'>";
         echo "<td>" . $LANG['common'][26] . "&nbsp;: </td>";
         echo "<td>" . ($this->fields["date_mod"] ? convDateTime($this->fields["date_mod"]) : $LANG['setup'][307]);
         echo "</td></tr>";
     }
     $keep = array(0 => $LANG['buttons'][6], 1 => $LANG['buttons'][49]);
     $clean = array(0 => $LANG['buttons'][49], 1 => $LANG['buttons'][6], 2 => $LANG['buttons'][22]);
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['common'][66] . " -> " . $LANG['title'][38] . "&nbsp;:</td><td>";
     $params['value'] = $this->fields['keep_history'];
     Dropdown::showFromArray('keep_history', $keep, $params);
     echo "</td>";
     if (!$edit_form) {
         echo "<td colspan='2'>&nbsp;</td>";
     }
     echo "</tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td colspan='4' class='center b'>" . $LANG['Menu'][38] . "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['common'][66] . " -> " . $LANG['networking'][6] . "&nbsp;:</td><td>";
     $options = array(0 => $LANG['buttons'][6], 1 => $LANG['buttons'][49] . " - " . $LANG['buttons'][10], 2 => $LANG['buttons'][49] . " - " . $LANG['buttons'][9]);
     $params['value'] = $this->fields['keep_networklink'];
     Dropdown::showFromArray('keep_networklink', $options, $params);
     echo "</td>";
     echo "<td>" . $LANG['common'][66] . " -> " . $LANG['title'][28] . "&nbsp;:</td><td>";
     $options = array(0 => $LANG['buttons'][6], 1 => $LANG['buttons'][49] . " - " . $LANG['buttons'][10], 2 => $LANG['buttons'][49] . " - " . $LANG['buttons'][48]);
     $params['value'] = $this->fields['keep_ticket'];
     Dropdown::showFromArray('keep_ticket', $options, $params);
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG["Menu"][0] . " -> " . $LANG["Menu"][4] . "&nbsp;:</td><td>";
     $params['value'] = $this->fields['keep_software'];
     Dropdown::showFromArray('keep_software', $keep, $params);
     echo "</td>";
     echo "<td>" . $LANG["Menu"][4] . " (" . $LANG['transfer'][3] . ")&nbsp;:</td><td>";
     $params['value'] = $this->fields['clean_software'];
     Dropdown::showFromArray('clean_software', $clean, $params);
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['common'][66] . " -> " . $LANG['Menu'][17] . "&nbsp;:</td><td>";
     $params['value'] = $this->fields['keep_reservation'];
     Dropdown::showFromArray('keep_reservation', $keep, $params);
     echo "</td>";
     echo "<td>" . $LANG["Menu"][0] . " -> " . $LANG['title'][30] . "&nbsp;:</td><td>";
     $params['value'] = $this->fields['keep_device'];
     Dropdown::showFromArray('keep_device', $keep, $params);
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG["Menu"][2] . " -> " . $LANG["Menu"][21] . " / " . $LANG['cartridges'][12] . "&nbsp;:" . "</td><td>";
     $params['value'] = $this->fields['keep_cartridgeitem'];
     Dropdown::showFromArray('keep_cartridgeitem', $keep, $params);
     echo "</td>";
     echo "<td>" . $LANG['cartridges'][12] . " (" . $LANG['transfer'][3] . ")&nbsp;:</td><td>";
     $params['value'] = $this->fields['clean_cartridgeitem'];
     Dropdown::showFromArray('clean_cartridgeitem', $clean, $params);
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['cartridges'][12] . " -> " . $LANG["Menu"][21] . "&nbsp;:</td><td>";
     $params['value'] = $this->fields['keep_cartridge'];
     Dropdown::showFromArray('keep_cartridge', $keep, $params);
     echo "</td>";
     echo "<td>" . $LANG['common'][66] . " -> " . $LANG['financial'][3] . "&nbsp;:</td><td>";
     $params['value'] = $this->fields['keep_infocom'];
     Dropdown::showFromArray('keep_infocom', $keep, $params);
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['setup'][92] . " -> " . $LANG["Menu"][32] . "&nbsp;:</td><td>";
     $params['value'] = $this->fields['keep_consumable'];
     Dropdown::showFromArray('keep_consumable', $keep, $params);
     echo "</td>";
     echo "<td>" . $LANG["Menu"][0] . " -> " . $LANG['computers'][8] . "&nbsp;:</td><td>";
     $params['value'] = $this->fields['keep_disk'];
     Dropdown::showFromArray('keep_disk', $keep, $params);
     echo "</td></tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td colspan='4' class='center b'>" . $LANG['connect'][0] . "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG["Menu"][3] . "&nbsp;:</td><td>";
     $params['value'] = $this->fields['keep_dc_monitor'];
     Dropdown::showFromArray('keep_dc_monitor', $keep, $params);
     echo "</td>";
     echo "<td>" . $LANG["Menu"][3] . " (" . $LANG['transfer'][3] . ")&nbsp;:</td><td>";
     $params['value'] = $this->fields['clean_dc_monitor'];
     Dropdown::showFromArray('clean_dc_monitor', $clean, $params);
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG["Menu"][2] . "&nbsp;:</td><td>";
     $params['value'] = $this->fields['keep_dc_printer'];
     Dropdown::showFromArray('keep_dc_printer', $keep, $params);
     echo "</td>";
     echo "<td>" . $LANG["Menu"][2] . " (" . $LANG['transfer'][3] . ")&nbsp;:</td><td>";
     $params['value'] = $this->fields['clean_dc_printer'];
     Dropdown::showFromArray('clean_dc_printer', $clean, $params);
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG["Menu"][16] . "&nbsp;:</td><td>";
     $params['value'] = $this->fields['keep_dc_peripheral'];
     Dropdown::showFromArray('keep_dc_peripheral', $keep, $params);
     echo "</td>";
     echo "<td>" . $LANG["Menu"][16] . " (" . $LANG['transfer'][3] . ")&nbsp;:</td><td>";
     $params['value'] = $this->fields['clean_dc_peripheral'];
     Dropdown::showFromArray('clean_dc_peripheral', $clean, $params);
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG["Menu"][34] . "&nbsp;:</td><td>";
     $params['value'] = $this->fields['keep_dc_phone'];
     Dropdown::showFromArray('keep_dc_phone', $keep, $params);
     echo "</td>";
     echo "<td>" . $LANG["Menu"][34] . " (" . $LANG['transfer'][3] . ")&nbsp;:</td><td>";
     $params['value'] = $this->fields['clean_dc_phone'];
     Dropdown::showFromArray('clean_dc_phone', $clean, $params);
     echo "</td></tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td colspan='4' class='center b'>" . $LANG["Menu"][26] . "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['common'][66] . " -> " . $LANG["Menu"][23] . "&nbsp;:</td><td>";
     $params['value'] = $this->fields['keep_supplier'];
     Dropdown::showFromArray('keep_supplier', $keep, $params);
     echo "</td>";
     echo "<td>" . $LANG["Menu"][23] . " (" . $LANG['transfer'][3] . ")&nbsp;:</td><td>";
     $params['value'] = $this->fields['clean_supplier'];
     Dropdown::showFromArray('clean_supplier', $clean, $params);
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG["Menu"][23] . " -> " . $LANG["Menu"][22] . "&nbsp;:</td><td>";
     $params['value'] = $this->fields['keep_contact'];
     Dropdown::showFromArray('keep_contact', $keep, $params);
     echo "</td>";
     echo "<td>" . $LANG["Menu"][22] . " (" . $LANG['transfer'][3] . ")&nbsp;:</td><td>";
     $params['value'] = $this->fields['clean_contact'];
     Dropdown::showFromArray('clean_contact', $clean, $params);
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['common'][66] . " -> " . $LANG["Menu"][27] . "&nbsp;:</td><td>";
     $params['value'] = $this->fields['keep_document'];
     Dropdown::showFromArray('keep_document', $keep, $params);
     echo "</td>";
     echo "<td>" . $LANG["Menu"][27] . " (" . $LANG['transfer'][3] . ")&nbsp;:</td><td>";
     $params['value'] = $this->fields['clean_document'];
     Dropdown::showFromArray('clean_document', $clean, $params);
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['common'][66] . " -> " . $LANG["Menu"][25] . "&nbsp;:</td><td>";
     $params['value'] = $this->fields['keep_contract'];
     Dropdown::showFromArray('keep_contract', $keep, $params);
     echo "</td>";
     echo "<td>" . $LANG["Menu"][25] . " (" . $LANG['transfer'][3] . ")&nbsp;:</td><td>";
     $params['value'] = $this->fields['clean_contract'];
     Dropdown::showFromArray('clean_contract', $clean, $params);
     echo "</td></tr>";
     if (haveRight("transfer", "w")) {
         if ($edit_form) {
             $this->showFormButtons($options);
             $this->addDivForTabs();
         } else {
             echo "</table></div></form>";
         }
     }
 }
예제 #30
0
 /**
  * Print the sla 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 device or blank form
     if (!haveRight("sla", "r")) {
         return false;
     }
     if ($ID > 0) {
         $this->check($ID, 'r');
         $rowspan = 4;
     } else {
         // Create item
         $this->check(-1, 'w');
         $rowspan = 3;
     }
     $this->showTabs($options);
     $this->showFormHeader($options);
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['common'][16] . "&nbsp;:</td>";
     echo "<td>";
     autocompletionTextField($this, "name", array('value' => $this->fields["name"]));
     echo "<td rowspan='" . $rowspan . "'>" . $LANG['common'][25] . "&nbsp;:</td>";
     echo "<td rowspan='" . $rowspan . "'>\n            <textarea cols='45' rows='8' name='comment' >" . $this->fields["comment"] . "</textarea>";
     echo "</td></tr>";
     if ($ID > 0) {
         echo "<tr class='tab_bg_1'>";
         echo "<td>" . $LANG['common'][26] . "&nbsp;: </td>";
         echo "<td>" . ($this->fields["date_mod"] ? convDateTime($this->fields["date_mod"]) : $LANG['setup'][307]);
         echo "</td></tr>";
     }
     echo "<tr class='tab_bg_1'><td>" . $LANG['buttons'][15] . "&nbsp;:</td>";
     echo "<td>";
     Dropdown::show('Calendar', array('value' => $this->fields["calendars_id"], 'emptylabel' => $LANG['sla'][10]));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'><td>" . $LANG['sla'][2] . "&nbsp;:</td>";
     echo "<td>";
     $possible_values = array();
     for ($i = 1; $i < 24; $i++) {
         $possible_values[$i * HOUR_TIMESTAMP] = $i . " " . $LANG['job'][21];
     }
     for ($i = 1; $i < 30; $i++) {
         $possible_values[$i * DAY_TIMESTAMP] = $i . " " . $LANG['stats'][31];
     }
     Dropdown::showFromArray('resolution_time', $possible_values, array('value' => $this->fields["resolution_time"]));
     echo "</td></tr>";
     $this->showFormButtons($options);
     $this->addDivForTabs();
     return true;
 }