예제 #1
0
/**
 * Display group form
**/
function displaySearchForm()
{
    global $_SERVER, $_GET, $CFG_GLPI;
    echo "<form action='" . $_SERVER["PHP_SELF"] . "' method='post'>";
    echo "<table class='tab_cadre' cellpadding='5'>";
    echo "<tr class='tab_bg_1 center'>";
    echo "<td>";
    echo __('Group') . "&nbsp;&nbsp;";
    Group::dropdown(array('name =>' => "group", 'value' => $_GET["group"], 'entity' => $_SESSION["glpiactive_entity"], 'condition' => "is_itemgroup"));
    echo "</td>";
    // Display Reset search
    echo "<td>";
    echo "<a href='" . $CFG_GLPI["root_doc"] . "/plugins/reports/report/equipmentbygroups/equipmentbygroups.php?reset_search=reset_search'>" . "<img title='" . __s('Blank') . "' alt='" . __s('Blank') . "' src='" . $CFG_GLPI["root_doc"] . "/pics/reset.png' class='calendrier'></a>";
    echo "</td>";
    echo "<td>";
    echo "<input type='submit' value='Valider' class='submit' />";
    echo "</td>";
    echo "</tr></table>";
    Html::closeForm();
}
예제 #2
0
 /**
  * Print the peripheral form
  *
  * @param $ID integer ID of the item
  * @param $options array
  *     - target filename : where to go when done.
  *     - withtemplate boolean : template or basic item
  *
  * @return boolean item found
  **/
 function showForm($ID, $options = array())
 {
     global $CFG_GLPI;
     $target = $this->getFormURL();
     $withtemplate = $this->initForm($ID, $options);
     $this->showFormHeader($options);
     echo "<tr class='tab_bg_1'>";
     //TRANS: %1$s is a string, %2$s a second one without spaces between them : to change for RTL
     echo "<td>" . sprintf(__('%1$s%2$s'), __('Name'), isset($options['withtemplate']) && $options['withtemplate'] ? "*" : "");
     echo "</td>";
     echo "<td>";
     $objectName = autoName($this->fields["name"], "name", isset($options['withtemplate']) && $options['withtemplate'] == 2, $this->getType(), $this->fields["entities_id"]);
     Html::autocompletionTextField($this, "name", array('value' => $objectName));
     echo "</td>\n";
     echo "<td>" . __('Status') . "</td>\n";
     echo "<td>";
     State::dropdown(array('value' => $this->fields["states_id"], 'entity' => $this->fields["entities_id"], 'condition' => "`is_visible_peripheral`"));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Location') . "</td>\n";
     echo "<td>";
     Location::dropdown(array('value' => $this->fields["locations_id"], 'entity' => $this->fields["entities_id"]));
     echo "</td>\n";
     echo "<td>" . __('Type') . "</td>\n";
     echo "<td>";
     PeripheralType::dropdown(array('value' => $this->fields["peripheraltypes_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Technician in charge of the hardware') . "</td>\n";
     echo "<td>";
     User::dropdown(array('name' => 'users_id_tech', 'value' => $this->fields["users_id_tech"], 'right' => 'own_ticket', 'entity' => $this->fields["entities_id"]));
     echo "</td>";
     echo "<td>" . __('Manufacturer') . "</td>\n";
     echo "<td>";
     Manufacturer::dropdown(array('value' => $this->fields["manufacturers_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Group in charge of the hardware') . "</td>";
     echo "<td>";
     Group::dropdown(array('name' => 'groups_id_tech', 'value' => $this->fields['groups_id_tech'], 'entity' => $this->fields['entities_id'], 'condition' => '`is_assign`'));
     echo "</td>";
     echo "<td>" . __('Model') . "</td>\n";
     echo "<td>";
     PeripheralModel::dropdown(array('value' => $this->fields["peripheralmodels_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Alternate username number') . "</td>\n";
     echo "<td>";
     Html::autocompletionTextField($this, "contact_num");
     echo "</td>";
     echo "<td>" . __('Serial number') . "</td>\n";
     echo "<td>";
     Html::autocompletionTextField($this, "serial");
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Alternate username') . "</td>\n";
     echo "<td>";
     Html::autocompletionTextField($this, "contact");
     echo "</td>\n";
     echo "<td>" . sprintf(__('%1$s%2$s'), __('Inventory number'), isset($options['withtemplate']) && $options['withtemplate'] ? "*" : "") . "</td>\n";
     echo "<td>";
     $objectName = autoName($this->fields["otherserial"], "otherserial", isset($options['withtemplate']) && $options['withtemplate'] == 2, $this->getType(), $this->fields["entities_id"]);
     Html::autocompletionTextField($this, "otherserial", array('value' => $objectName));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('User') . "</td>\n";
     echo "<td>";
     User::dropdown(array('value' => $this->fields["users_id"], 'entity' => $this->fields["entities_id"], 'right' => 'all'));
     echo "</td>\n";
     echo "<td>" . __('Management type') . "</td>\n";
     echo "<td>";
     Dropdown::showGlobalSwitch($this->fields["id"], array('withtemplate' => $withtemplate, 'value' => $this->fields["is_global"], 'management_restrict' => $CFG_GLPI["peripherals_management_restrict"], 'target' => $target));
     echo "</td></tr>\n";
     // Display auto inventory informations
     $rowspan = 2;
     $inventory_show = false;
     if (!empty($ID) && $this->fields["is_dynamic"]) {
         $inventory_show = true;
         $rowspan -= 1;
     }
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Group') . "</td>\n";
     echo "<td>";
     Group::dropdown(array('value' => $this->fields["groups_id"], 'entity' => $this->fields["entities_id"], 'condition' => '`is_itemgroup`'));
     echo "</td>\n";
     echo "<td rowspan='{$rowspan}'>" . __('Comments') . "</td>\n";
     echo "<td rowspan='{$rowspan}'>\n            <textarea cols='45' rows='" . ($rowspan + 3) . "' name='comment' >" . $this->fields["comment"];
     echo "</textarea></td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Brand') . "</td>\n";
     echo "<td>";
     Html::autocompletionTextField($this, "brand");
     echo "</td></tr>\n";
     if ($inventory_show) {
         echo "<tr class='tab_bg_1'>";
         echo "<td rowspan='1'>" . __('Automatic inventory') . "</td>";
         echo "<td rowspan='1'>";
         Plugin::doHook("autoinventory_information", $this);
         echo "</td>";
         echo "</tr>\n";
     }
     $this->showFormButtons($options);
     return true;
 }
 /**
  * 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;
     $target = $this->getFormURL();
     $withtemplate = $this->initForm($ID, $options);
     $this->showFormHeader($options);
     echo "<tr class='tab_bg_1'>";
     //TRANS: %1$s is a string, %2$s a second one without spaces between them : to change for RTL
     echo "<td>" . sprintf(__('%1$s%2$s'), __('Name'), isset($options['withtemplate']) && $options['withtemplate'] ? "*" : "") . "</td>";
     echo "<td>";
     $objectName = autoName($this->fields["name"], "name", isset($options['withtemplate']) && $options['withtemplate'] == 2, $this->getType(), $this->fields["entities_id"]);
     Html::autocompletionTextField($this, 'name', array('value' => $objectName));
     echo "</td>";
     echo "<td>" . __('Status') . "</td>";
     echo "<td>";
     State::dropdown(array('value' => $this->fields["states_id"], 'entity' => $this->fields["entities_id"], 'condition' => "`is_visible_phone`='1'"));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Location') . "</td>";
     echo "<td>";
     Location::dropdown(array('value' => $this->fields["locations_id"], 'entity' => $this->fields["entities_id"]));
     echo "</td>";
     echo "<td>" . __('Type') . "</td>";
     echo "<td>";
     PhoneType::dropdown(array('value' => $this->fields["phonetypes_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Technician in charge of the hardware') . "</td>";
     echo "<td>";
     User::dropdown(array('name' => 'users_id_tech', 'value' => $this->fields["users_id_tech"], 'right' => 'own_ticket', 'entity' => $this->fields["entities_id"]));
     echo "</td>";
     echo "<td>" . __('Manufacturer') . "</td>";
     echo "<td>";
     Manufacturer::dropdown(array('value' => $this->fields["manufacturers_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Group in charge of the hardware') . "</td>";
     echo "<td>";
     Group::dropdown(array('name' => 'groups_id_tech', 'value' => $this->fields['groups_id_tech'], 'entity' => $this->fields['entities_id'], 'condition' => '`is_assign`'));
     echo "</td>";
     echo "<td>" . __('Model') . "</td>";
     echo "<td>";
     PhoneModel::dropdown(array('value' => $this->fields["phonemodels_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Alternate username number') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "contact_num");
     echo "</td>";
     echo "<td>" . __('Serial number') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "serial");
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Alternate username') . "</td><td>";
     Html::autocompletionTextField($this, "contact");
     echo "</td>";
     echo "<td>" . sprintf(__('%1$s%2$s'), __('Inventory number'), isset($options['withtemplate']) && $options['withtemplate'] ? "*" : "") . "</td>";
     echo "<td>";
     $objectName = autoName($this->fields["otherserial"], "otherserial", isset($options['withtemplate']) && $options['withtemplate'] == 2, $this->getType(), $this->fields["entities_id"]);
     Html::autocompletionTextField($this, 'otherserial', array('value' => $objectName));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('User') . "</td>";
     echo "<td>";
     User::dropdown(array('value' => $this->fields["users_id"], 'entity' => $this->fields["entities_id"], 'right' => 'all'));
     echo "</td>";
     echo "<td>" . __('Management type') . "</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";
     // Display auto inventory informations
     $rowspan = 7;
     $inventory_show = false;
     if (!empty($ID) && $this->fields["is_dynamic"]) {
         $inventory_show = true;
         $rowspan -= 2;
     }
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Group') . "</td>";
     echo "<td>";
     Group::dropdown(array('value' => $this->fields["groups_id"], 'entity' => $this->fields["entities_id"], 'condition' => '`is_itemgroup`'));
     echo "</td>";
     echo "<td rowspan='{$rowspan}'>" . __('Comments') . "</td>";
     echo "<td rowspan='{$rowspan}'>\n            <textarea cols='45' rows='" . ($rowspan + 3) . "' name='comment' class='form-control' >" . $this->fields["comment"];
     echo "</textarea></td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Brand') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "brand");
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Power supply') . "</td>";
     echo "<td>";
     PhonePowerSupply::dropdown(array('value' => $this->fields["phonepowersupplies_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . _n('Firmware', 'Firmwares', 1) . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "firmware");
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . _x('quantity', 'Number of lines') . "</td><td>";
     Html::autocompletionTextField($this, "number_line");
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Flags') . "</td>";
     echo "<td>";
     // micro?
     echo "\n<table><tr><td>" . __('Headset') . "</td>";
     echo "<td>&nbsp;";
     Dropdown::showYesNo("have_headset", $this->fields["have_headset"]);
     echo "</td></tr>";
     // hp?
     echo "<tr><td>" . __('Speaker') . "</td>";
     echo "<td>&nbsp;";
     Dropdown::showYesNo("have_hp", $this->fields["have_hp"]);
     echo "</td></tr></table>\n";
     echo "</td>";
     if ($inventory_show) {
         echo "<td rowspan='2'>" . __('Automatic inventory') . "</td>";
         echo "<td rowspan='2'>";
         Plugin::doHook("autoinventory_information", $this);
         echo "</td>";
     }
     echo "</tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>";
     if ((!isset($options['withtemplate']) || $options['withtemplate'] == 0) && !empty($this->fields['template_name'])) {
         echo "<span class='small_space'>";
         printf(__('Created from the template %s'), $this->fields['template_name']);
         echo "</span>";
     } else {
         echo "&nbsp;";
     }
     echo "</td><td>";
     if (isset($options['withtemplate']) && $options['withtemplate']) {
         //TRANS: %s is the datetime of insertion
         printf(__('Created on %s'), Html::convDateTime($_SESSION["glpi_currenttime"]));
     } else {
         //TRANS: %s is the datetime of insertion
         printf(__('Last update on %s'), Html::convDateTime($this->fields["date_mod"]));
     }
     echo "</td></tr>\n";
     $this->showFormButtons($options);
     return true;
 }
 /**
  * show actor part in ITIL object form
  *
  * @param $ID        integer  ITIL object ID
  * @param $options   array    options for default values ($options of showForm)
  *
  * @return nothing display
  **/
 function showActorsPartForm($ID, array $options)
 {
     global $CFG_GLPI;
     $showuserlink = 0;
     if (User::canView()) {
         $showuserlink = 1;
     }
     $options['_default_use_notification'] = 1;
     if (isset($options['entities_id'])) {
         $options['_default_use_notification'] = Entity::getUsedConfig('is_notif_enable_default', $options['entities_id'], '', 1);
     }
     // check is_hidden fields
     foreach (array('_users_id_requester', '_groups_id_requester', '_users_id_observer', '_groups_id_observer', '_users_id_assign', '_groups_id_assign', '_suppliers_id_assign') as $f) {
         $is_hidden[$f] = false;
         if (isset($options['_tickettemplate']) && $options['_tickettemplate']->isHiddenField($f)) {
             $is_hidden[$f] = true;
         }
     }
     $can_admin = $this->canAdminActors();
     $can_assign = $this->canAssign();
     $can_assigntome = $this->canAssignToMe();
     if (isset($options['_noupdate']) && !$options['_noupdate']) {
         $can_admin = false;
         $can_assign = false;
         $can_assigntome = false;
     }
     // Manage actors : requester and assign
     echo "<table class='tab_cadre_fixe' id='mainformtable5'>";
     echo "<tr class='tab_bg_1'>";
     echo "<th rowspan='2' width='13%'>" . __('Actor') . "</th>";
     echo "<th width='29%'>";
     if (!$is_hidden['_users_id_requester'] || !$is_hidden['_groups_id_requester']) {
         _e('Requester');
     }
     $rand_requester = -1;
     $candeleterequester = false;
     if ($ID && $can_admin && (!$is_hidden['_users_id_requester'] || !$is_hidden['_groups_id_requester'])) {
         $rand_requester = mt_rand();
         echo "&nbsp;&nbsp;";
         echo "<img title=\"" . __s('Add') . "\" alt=\"" . __s('Add') . "\"\n                onClick=\"" . Html::jsShow("itilactor{$rand_requester}") . "\"\n                class='pointer' src='" . $CFG_GLPI["root_doc"] . "/pics/add_dropdown.png'>";
         $candeleterequester = true;
     }
     echo "</th>";
     echo "<th width='29%'>";
     if (!$is_hidden['_users_id_observer'] || !$is_hidden['_groups_id_observer']) {
         _e('Watcher');
     }
     $rand_observer = -1;
     $candeleteobserver = false;
     if ($ID && $can_admin && (!$is_hidden['_users_id_observer'] || !$is_hidden['_groups_id_observer'])) {
         $rand_observer = mt_rand();
         echo "&nbsp;&nbsp;";
         echo "<img title=\"" . __s('Add') . "\" alt=\"" . __s('Add') . "\"\n                onClick=\"" . Html::jsShow("itilactor{$rand_observer}") . "\"\n                class='pointer' src='" . $CFG_GLPI["root_doc"] . "/pics/add_dropdown.png'>";
         $candeleteobserver = true;
     } else {
         if ($ID > 0 && !in_array($this->fields['status'], $this->getClosedStatusArray()) && !$is_hidden['_users_id_observer'] && !$this->isUser(CommonITILActor::OBSERVER, Session::getLoginUserID()) && !$this->isUser(CommonITILActor::REQUESTER, Session::getLoginUserID())) {
             echo "&nbsp;&nbsp;&nbsp;&nbsp;";
             Html::showSimpleForm($this->getFormURL(), 'addme_observer', __('Associate myself'), array($this->getForeignKeyField() => $this->fields['id']), $CFG_GLPI["root_doc"] . "/pics/addme.png");
         }
     }
     echo "</th>";
     echo "<th width='29%'>";
     if (!$is_hidden['_users_id_assign'] || !$is_hidden['_groups_id_assign'] || !$is_hidden['_suppliers_id_assign']) {
         _e('Assigned to');
     }
     $rand_assign = -1;
     $candeleteassign = false;
     if ($ID && ($can_assign || $can_assigntome) && (!$is_hidden['_users_id_assign'] || !$is_hidden['_groups_id_assign'] || !$is_hidden['_suppliers_id_assign']) && $this->isAllowedStatus($this->fields['status'], CommonITILObject::ASSIGNED)) {
         $rand_assign = mt_rand();
         echo "&nbsp;&nbsp;";
         echo "<img title=\"" . __s('Add') . "\" alt=\"" . __s('Add') . "\"\n                onClick=\"" . Html::jsShow("itilactor{$rand_assign}") . "\"\n                class='pointer' src='" . $CFG_GLPI["root_doc"] . "/pics/add_dropdown.png'>";
     }
     if ($ID && $can_assigntome && !in_array($this->fields['status'], $this->getClosedStatusArray()) && !$is_hidden['_users_id_assign'] && !$this->isUser(CommonITILActor::ASSIGN, Session::getLoginUserID()) && $this->isAllowedStatus($this->fields['status'], CommonITILObject::ASSIGNED)) {
         Html::showSimpleForm($this->getFormURL(), 'addme_assign', __('Associate myself'), array($this->getForeignKeyField() => $this->fields['id']), $CFG_GLPI["root_doc"] . "/pics/addme.png");
     }
     if ($ID && $can_assign) {
         $candeleteassign = true;
     }
     echo "</th></tr>";
     echo "<tr class='tab_bg_1 top'>";
     echo "<td>";
     if ($rand_requester >= 0) {
         $this->showActorAddForm(CommonITILActor::REQUESTER, $rand_requester, $this->fields['entities_id'], $is_hidden);
     }
     // Requester
     if (!$ID) {
         $reqdisplay = false;
         if ($can_admin && !$is_hidden['_users_id_requester']) {
             $this->showActorAddFormOnCreate(CommonITILActor::REQUESTER, $options);
             $reqdisplay = true;
         } else {
             $delegating = User::getDelegateGroupsForUser($options['entities_id']);
             if (count($delegating) && !$is_hidden['_users_id_requester']) {
                 //$this->getDefaultActor(CommonITILActor::REQUESTER);
                 $options['_right'] = "delegate";
                 $this->showActorAddFormOnCreate(CommonITILActor::REQUESTER, $options);
                 $reqdisplay = true;
             } else {
                 // predefined value
                 if (isset($options["_users_id_requester"]) && $options["_users_id_requester"]) {
                     echo self::getActorIcon('user', CommonITILActor::REQUESTER) . "&nbsp;";
                     echo Dropdown::getDropdownName("glpi_users", $options["_users_id_requester"]);
                     echo "<input type='hidden' name='_users_id_requester' value=\"" . $options["_users_id_requester"] . "\">";
                     echo '<br>';
                     $reqdisplay = true;
                 }
             }
         }
         //If user have access to more than one entity, then display a combobox : Ticket case
         if ($this->userentity_oncreate && isset($this->countentitiesforuser) && $this->countentitiesforuser > 1) {
             echo "<br>";
             $rand = Entity::dropdown(array('value' => $this->fields["entities_id"], 'entity' => $this->userentities, 'on_change' => 'this.form.submit()'));
         } else {
             echo "<input type='hidden' name='entities_id' value='" . $this->fields["entities_id"] . "'>";
         }
         if ($reqdisplay) {
             echo '<hr>';
         }
     } else {
         if (!$is_hidden['_users_id_requester']) {
             $this->showUsersAssociated(CommonITILActor::REQUESTER, $candeleterequester, $options);
         }
     }
     // Requester Group
     if (!$ID) {
         if ($can_admin && !$is_hidden['_groups_id_requester']) {
             echo self::getActorIcon('group', CommonITILActor::REQUESTER);
             /// For ticket templates : mandatories
             if (isset($options['_tickettemplate'])) {
                 echo $options['_tickettemplate']->getMandatoryMark('_groups_id_requester');
             }
             echo "&nbsp;";
             Group::dropdown(array('name' => '_groups_id_requester', 'value' => $options["_groups_id_requester"], 'entity' => $this->fields["entities_id"], 'condition' => '`is_requester`'));
         } else {
             // predefined value
             if (isset($options["_groups_id_requester"]) && $options["_groups_id_requester"]) {
                 echo self::getActorIcon('group', CommonITILActor::REQUESTER) . "&nbsp;";
                 echo Dropdown::getDropdownName("glpi_groups", $options["_groups_id_requester"]);
                 echo "<input type='hidden' name='_groups_id_requester' value=\"" . $options["_groups_id_requester"] . "\">";
                 echo '<br>';
             }
         }
     } else {
         if (!$is_hidden['_groups_id_requester']) {
             $this->showGroupsAssociated(CommonITILActor::REQUESTER, $candeleterequester, $options);
         }
     }
     echo "</td>";
     echo "<td>";
     if ($rand_observer >= 0) {
         $this->showActorAddForm(CommonITILActor::OBSERVER, $rand_observer, $this->fields['entities_id'], $is_hidden);
     }
     // Observer
     if (!$ID) {
         if ($can_admin && !$is_hidden['_users_id_observer']) {
             $this->showActorAddFormOnCreate(CommonITILActor::OBSERVER, $options);
             echo '<hr>';
         } else {
             // predefined value
             if (isset($options["_users_id_observer"]) && $options["_users_id_observer"]) {
                 echo self::getActorIcon('user', CommonITILActor::OBSERVER) . "&nbsp;";
                 echo Dropdown::getDropdownName("glpi_users", $options["_users_id_observer"]);
                 echo "<input type='hidden' name='_users_id_observer' value=\"" . $options["_users_id_observer"] . "\">";
                 echo '<hr>';
             }
         }
     } else {
         if (!$is_hidden['_users_id_observer']) {
             $this->showUsersAssociated(CommonITILActor::OBSERVER, $candeleteobserver, $options);
         }
     }
     // Observer Group
     if (!$ID) {
         if ($can_admin && !$is_hidden['_groups_id_observer']) {
             echo self::getActorIcon('group', CommonITILActor::OBSERVER);
             /// For ticket templates : mandatories
             if (isset($options['_tickettemplate'])) {
                 echo $options['_tickettemplate']->getMandatoryMark('_groups_id_observer');
             }
             echo "&nbsp;";
             Group::dropdown(array('name' => '_groups_id_observer', 'value' => $options["_groups_id_observer"], 'entity' => $this->fields["entities_id"], 'condition' => '`is_requester`'));
         } else {
             // predefined value
             if (isset($options["_groups_id_observer"]) && $options["_groups_id_observer"]) {
                 echo self::getActorIcon('group', CommonITILActor::OBSERVER) . "&nbsp;";
                 echo Dropdown::getDropdownName("glpi_groups", $options["_groups_id_observer"]);
                 echo "<input type='hidden' name='_groups_id_observer' value=\"" . $options["_groups_id_observer"] . "\">";
                 echo '<br>';
             }
         }
     } else {
         if (!$is_hidden['_groups_id_observer']) {
             $this->showGroupsAssociated(CommonITILActor::OBSERVER, $candeleteobserver, $options);
         }
     }
     echo "</td>";
     echo "<td>";
     if ($rand_assign >= 0) {
         $this->showActorAddForm(CommonITILActor::ASSIGN, $rand_assign, $this->fields['entities_id'], $is_hidden, $this->canAssign(), $this->canAssign());
     }
     // Assign User
     if (!$ID) {
         if ($can_assign && !$is_hidden['_users_id_assign'] && $this->isAllowedStatus($this->fields['status'], CommonITILObject::ASSIGNED)) {
             $this->showActorAddFormOnCreate(CommonITILActor::ASSIGN, $options);
             echo '<hr>';
         } else {
             if ($can_assigntome && !$is_hidden['_users_id_assign'] && $this->isAllowedStatus($this->fields['status'], CommonITILObject::ASSIGNED)) {
                 echo self::getActorIcon('user', CommonITILActor::ASSIGN) . "&nbsp;";
                 User::dropdown(array('name' => '_users_id_assign', 'value' => $options["_users_id_assign"], 'entity' => $this->fields["entities_id"], 'ldap_import' => true));
                 echo '<hr>';
             } else {
                 // predefined value
                 if (isset($options["_users_id_assign"]) && $options["_users_id_assign"] && $this->isAllowedStatus($this->fields['status'], CommonITILObject::ASSIGNED)) {
                     echo self::getActorIcon('user', CommonITILActor::ASSIGN) . "&nbsp;";
                     echo Dropdown::getDropdownName("glpi_users", $options["_users_id_assign"]);
                     echo "<input type='hidden' name='_users_id_assign' value=\"" . $options["_users_id_assign"] . "\">";
                     echo '<hr>';
                 }
             }
         }
     } else {
         if (!$is_hidden['_users_id_assign']) {
             $this->showUsersAssociated(CommonITILActor::ASSIGN, $candeleteassign, $options);
         }
     }
     // Assign Groups
     if (!$ID) {
         if ($can_assign && !$is_hidden['_groups_id_assign'] && $this->isAllowedStatus($this->fields['status'], CommonITILObject::ASSIGNED)) {
             echo self::getActorIcon('group', CommonITILActor::ASSIGN);
             /// For ticket templates : mandatories
             if (isset($options['_tickettemplate'])) {
                 echo $options['_tickettemplate']->getMandatoryMark('_groups_id_assign');
             }
             echo "&nbsp;";
             $rand = mt_rand();
             $params = array('name' => '_groups_id_assign', 'value' => $options["_groups_id_assign"], 'entity' => $this->fields["entities_id"], 'condition' => '`is_assign`', 'rand' => $rand);
             if ($this->getType() == 'Ticket') {
                 $params['toupdate'] = array('value_fieldname' => 'value', 'to_update' => "countgroupassign_{$rand}", 'url' => $CFG_GLPI["root_doc"] . "/ajax/ticketassigninformation.php", 'moreparams' => array('groups_id_assign' => '__VALUE__'));
             }
             Group::dropdown($params);
             echo "<span id='countgroupassign_{$rand}'>";
             echo "</span>";
             echo "<script type='text/javascript'>";
             Ajax::updateItemJsCode("countgroupassign_{$rand}", $CFG_GLPI["root_doc"] . "/ajax/ticketassigninformation.php", array('groups_id_assign' => '__VALUE__'), "dropdown__groups_id_assign{$rand}");
             echo "</script>";
             echo '<hr>';
         } else {
             // predefined value
             if (isset($options["_groups_id_assign"]) && $options["_groups_id_assign"] && $this->isAllowedStatus($this->fields['status'], CommonITILObject::ASSIGNED)) {
                 echo self::getActorIcon('group', CommonITILActor::ASSIGN) . "&nbsp;";
                 echo Dropdown::getDropdownName("glpi_groups", $options["_groups_id_assign"]);
                 echo "<input type='hidden' name='_groups_id_assign' value=\"" . $options["_groups_id_assign"] . "\">";
                 echo '<hr>';
             }
         }
     } else {
         if (!$is_hidden['_groups_id_assign']) {
             $this->showGroupsAssociated(CommonITILActor::ASSIGN, $candeleteassign, $options);
         }
     }
     // Assign Suppliers
     if (!$ID) {
         if ($can_assign && !$is_hidden['_suppliers_id_assign'] && $this->isAllowedStatus($this->fields['status'], CommonITILObject::ASSIGNED)) {
             $this->showSupplierAddFormOnCreate($options);
         } else {
             // predefined value
             if (isset($options["_suppliers_id_assign"]) && $options["_suppliers_id_assign"] && $this->isAllowedStatus($this->fields['status'], CommonITILObject::ASSIGNED)) {
                 echo self::getActorIcon('supplier', CommonITILActor::ASSIGN) . "&nbsp;";
                 echo Dropdown::getDropdownName("glpi_suppliers", $options["_suppliers_id_assign"]);
                 echo "<input type='hidden' name='_suppliers_id_assign' value=\"" . $options["_suppliers_id_assign"] . "\">";
                 echo '<hr>';
             }
         }
     } else {
         if (!$is_hidden['_suppliers_id_assign']) {
             $this->showSuppliersAssociated(CommonITILActor::ASSIGN, $candeleteassign, $options);
         }
     }
     echo "</td>";
     echo "</tr>";
     echo "</table>";
 }
 function showForm($ID, $options = array())
 {
     $PluginRacksConfig = new PluginRacksConfig();
     $this->initForm($ID, $options);
     $this->showFormHeader($options);
     //ligne 1
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Name') . "</td><td>";
     $objectName = autoName($this->fields["name"], "name", isset($options['withtemplate']) && $options['withtemplate'] == 2, $this->getType(), $this->fields["entities_id"]);
     Html::autocompletionTextField($this, 'name', array('value' => $objectName));
     echo "</td>";
     echo "<td>" . __('Size') . "</td><td>";
     Dropdown::showInteger("rack_size", $this->fields["rack_size"], 1, 100, 1);
     echo " " . __('U', 'racks') . "</td>";
     echo "</tr>";
     //ligne 2
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Manufacturer') . "</td><td>";
     Manufacturer::dropdown(array('value' => $this->fields["manufacturers_id"]));
     echo "</td>";
     echo "<td >" . __('Location') . "</td>";
     echo "<td>";
     Location::dropdown(array('value' => $this->fields["locations_id"], 'entity' => $this->fields["entities_id"]));
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td >" . __('Technician in charge of the hardware') . "</td>";
     echo "<td >";
     User::dropdown(array('name' => 'users_id_tech', 'value' => $this->fields["users_id_tech"], 'right' => 'interface', 'entity' => $this->fields["entities_id"]));
     echo "</td>";
     echo "<td>" . __('Place', 'racks');
     echo "</td><td>";
     $PluginRacksRoomLocation = new PluginRacksRoomLocation();
     $PluginRacksRoomLocation->dropdownRoomLocations("plugin_racks_roomlocations_id", $this->fields["plugin_racks_roomlocations_id"], $this->fields["entities_id"]);
     echo "</td>";
     echo "</tr>";
     //ligne 4
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Group in charge of the hardware') . "</td><td>";
     Group::dropdown(array('name' => 'groups_id_tech', 'value' => $this->fields['groups_id_tech'], 'entity' => $this->fields['entities_id'], 'condition' => '`is_assign`'));
     echo "</td>";
     echo "<td>" . __('Width', 'racks') . "</td><td>";
     echo "<input type='text' name='width' \n                              value=\"" . Html::formatNumber($this->fields["width"], true) . "\" size='10'> ";
     $PluginRacksConfig->getUnit("size");
     echo "</td>";
     echo "</tr>";
     //ligne 5
     echo "<tr class='tab_bg_1'>";
     echo "</td>";
     echo "<td>" . __('Serial number') . "</td>";
     echo "<td >";
     Html::autocompletionTextField($this, 'serial');
     echo "</td>";
     echo "<td>" . __('Height', 'racks') . "</td><td>";
     echo "<input type='text' name='height' \n                              value=\"" . Html::formatNumber($this->fields["height"], true) . "\" size='10'> ";
     $PluginRacksConfig->getUnit("size");
     echo "</td>";
     echo "</tr>";
     //ligne 6
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Inventory number') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, 'otherserial');
     echo "</td>";
     echo "<td>" . __('Weight', 'racks') . "</td><td>";
     echo "<input type='text' name='weight' \n                              value=\"" . Html::formatNumber($this->fields["weight"], true) . "\" size='10'> ";
     $PluginRacksConfig->getUnit("weight");
     echo "</td>";
     echo "</tr>";
     //ligne 7
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Model') . "</td>";
     echo "<td>";
     Dropdown::show('PluginRacksRackModel', array('name' => "plugin_racks_rackmodels_id", 'value' => $this->fields["plugin_racks_rackmodels_id"]));
     echo "</td>";
     echo "<td>" . __('Depth', 'racks') . "</td><td>";
     echo "<input type='text' name='depth' \n                              value=\"" . Html::formatNumber($this->fields["depth"], true) . "\" size='10'> ";
     $PluginRacksConfig->getUnit("size");
     echo "</td>";
     echo "</tr>";
     //ligne 8
     echo "<tr class='tab_bg_1'>";
     echo "<td >" . __('Type') . "</td><td>";
     Dropdown::show('PluginRacksRackType', array('value' => $this->fields["plugin_racks_racktypes_id"]));
     echo "</td>";
     echo "<td >" . __('Status') . "</td><td>";
     Dropdown::show('PluginRacksRackState', array('value' => $this->fields["plugin_racks_rackstates_id"]));
     echo "</td>";
     echo "</tr>";
     //ligne 9
     echo "<tr class='tab_bg_1'>";
     echo "<td colspan='2'>";
     if ((!isset($options['withtemplate']) || $options['withtemplate'] == 0) && !empty($this->fields['template_name'])) {
         echo "<span class='small_space'>";
         printf(__('Created from the template %s'), $this->fields['template_name']);
         echo "</span>";
     } else {
         echo "&nbsp;";
     }
     echo "</td><td colspan='2'>";
     if (isset($options['withtemplate']) && $options['withtemplate']) {
         //TRANS: %s is the datetime of insertion
         printf(__('Created on %s'), Html::convDateTime($_SESSION["glpi_currenttime"]));
     } else {
         //TRANS: %s is the datetime of update
         printf(__('Last update on %s'), Html::convDateTime($this->fields["date_mod"]));
     }
     echo "</td></tr>\n";
     $this->showFormButtons($options);
     if (!$this->isNewID($this->getID())) {
         $this->showTotal();
     }
     return true;
 }
예제 #6
0
 /**
  * Show the planning selection form
  *
  * @param $type            planning type : can be day, week, month
  * @param $date            working date
  * @param $usertype        type of planning to view : can be user or group
  * @param $value           ID of the item
  * @param $limititemtype   itemtype only display this itemtype (default '')
  *
  * @return Display form
  **/
 static function showSelectionForm($type, $date, $usertype, $value, $limititemtype = '')
 {
     global $CFG_GLPI;
     switch ($type) {
         case "month":
             $split = explode("-", $date);
             $year_next = $split[0];
             $month_next = $split[1] + 1;
             if ($month_next > 12) {
                 $year_next++;
                 $month_next -= 12;
             }
             $year_prev = $split[0];
             $month_prev = $split[1] - 1;
             if ($month_prev == 0) {
                 $year_prev--;
                 $month_prev += 12;
             }
             $next = $year_next . "-" . sprintf("%02u", $month_next) . "-" . $split[2];
             $prev = $year_prev . "-" . sprintf("%02u", $month_prev) . "-" . $split[2];
             break;
         default:
             $time = strtotime($date);
             $step = 0;
             switch ($type) {
                 case "week":
                     $step = WEEK_TIMESTAMP;
                     break;
                 case "day":
                     $step = DAY_TIMESTAMP;
                     break;
             }
             $next = $time + $step + 10;
             $prev = $time - $step;
             $next = strftime("%Y-%m-%d", $next);
             $prev = strftime("%Y-%m-%d", $prev);
             break;
     }
     $uID = 0;
     $gID = 0;
     switch ($usertype) {
         case 'my':
             $uID = $_SESSION['glpiID'];
             break;
         case 'mygroups':
             if (!Session::haveRight("show_group_planning", "1")) {
                 exit;
             }
             $gID = 'mine';
             break;
         case 'users':
             if (!Session::haveRight("show_all_planning", "1")) {
                 exit;
             }
             $uID = $value;
             break;
         case 'groups':
             if (!Session::haveRight("show_all_planning", "1")) {
                 exit;
             }
             $gID = $value;
             break;
     }
     echo "<div class='center'><form method='get' name='form' action='planning.php'>\n";
     echo "<table class='tab_cadre_fixe'><tr class='tab_bg_1'>";
     echo "<td>";
     echo "<a href=\"" . $CFG_GLPI["root_doc"] . "/front/planning.php?type=" . $type . "&amp;uID=" . $uID . "&amp;date={$prev}&amp;usertype={$usertype}&amp;gID={$gID}&amp;limititemtype={$limititemtype}\">";
     echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/left.png' alt=\"" . __s('Previous') . "\"\n             title=\"" . __s('Previous') . "\"></a>";
     echo "</td>";
     switch ($usertype) {
         case 'users':
             echo "<td>";
             $rand_user = User::dropdown(array('name' => 'uID', 'value' => $value, 'right' => 'interface', 'all' => 1, 'entity' => $_SESSION["glpiactive_entity"]));
             echo "</td>";
             break;
         case 'groups':
             echo "<td>";
             $rand_group = Group::dropdown(array('value' => $value, 'name' => 'gID', 'entity' => $_SESSION["glpiactive_entity"], 'condition' => '`is_usergroup`'));
             echo "</td>";
             break;
     }
     echo "</td>";
     echo "<td>";
     Dropdown::showItemTypes('limititemtype', $CFG_GLPI['planning_types'], array('value' => $limititemtype));
     echo "</td>";
     echo "<td>";
     Html::showDateFormItem("date", $date, false);
     echo '</td><td>';
     echo "<select name='type'>";
     echo "<option value='day' " . ($type == "day" ? " selected " : "") . ">" . __('Day') . "</option>";
     echo "<option value='week' " . ($type == "week" ? " selected " : "") . ">" . __('Week') . "</option>";
     echo "<option value='month' " . ($type == "month" ? " selected " : "") . ">" . __('Month') . "</option>";
     echo "</select></td>\n";
     echo "<td rowspan='2' class='center'>";
     echo "<input type='submit' class='submit' name='submit' value=\"" . _sx('button', 'Show') . "\">";
     echo "</td>\n";
     if ($uID || $gID) {
         echo "<td>";
         echo "<a target='_blank'\n                href=\"" . $CFG_GLPI["root_doc"] . "/front/planning.php?genical=1&amp;uID=" . $uID . "&amp;gID=" . $gID . "&amp;usertype=" . $usertype . "&amp;limititemtype={$limititemtype}" . "&amp;entities_id=" . $_SESSION["glpiactive_entity"] . "&amp;is_recursive=" . $_SESSION["glpiactive_entity_recursive"] . "&amp;token=" . User::getPersonalToken(Session::getLoginUserID(true)) . "\"\n                 title=\"" . __s('Download the planning in Ical format') . "\">" . "<span style='font-size:10px'>" . __('Ical') . "</span></a>";
         echo "<br>";
         $url = parse_url($CFG_GLPI["url_base"]);
         $port = 80;
         if (isset($url['port'])) {
             $port = $url['port'];
         } else {
             if (isset($url['scheme']) && $url["scheme"] == 'https') {
                 $port = 443;
             }
         }
         echo "<a target='_blank' href=\"webcal://" . $url['host'] . ':' . $port . (isset($url['path']) ? $url['path'] : '') . "/front/planning.php?genical=1&amp;uID=" . $uID . "&amp;gID=" . $gID . "&amp;usertype=" . $usertype . "&amp;limititemtype={$limititemtype}" . "&amp;entities_id=" . $_SESSION["glpiactive_entity"] . "&amp;is_recursive=" . $_SESSION["glpiactive_entity_recursive"] . "&amp;token=" . User::getPersonalToken(Session::getLoginUserID(true)) . "\" title=\"" . __s('webcal:// synchronization') . "\">";
         echo "<span style='font-size:10px'>" . __('Webcal') . "</span></a>";
         echo "</td>\n";
     }
     echo "<td>";
     echo "<a href=\"" . $CFG_GLPI["root_doc"] . "/front/planning.php?type=" . $type . "&amp;uID=" . $uID . "&amp;date={$next}&amp;usertype={$usertype}&amp;gID={$gID}&amp;limititemtype={$limititemtype}\">";
     echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/right.png' alt=\"" . __s('Next') . "\"\n             title=\"" . __s('Next') . "\"></a>";
     echo "</td>";
     echo "</tr>";
     echo "</table>";
     Html::closeForm();
     echo "</div>\n";
 }
예제 #7
0
 function showForm($ID, $options = array())
 {
     global $CFG_GLPI;
     if ($ID > 0) {
         $this->check($ID, 'r');
     } else {
         $this->check(-1, 'w');
         $this->getEmpty();
     }
     $canedit = $this->can($ID, 'w');
     $canrecu = $this->can($ID, 'recursive');
     $this->showTabs($options);
     $this->showFormHeader($options);
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Name') . "</td><td>";
     Html::autocompletionTextField($this, "name", array('size' => 34));
     echo "</td><td>" . _n('Status', 'Statuses', 1) . "</td><td>";
     State::dropdown(array('value' => $this->fields["states_id"]));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Location') . "</td><td>";
     if ($canedit) {
         Location::dropdown(array('value' => $this->fields["locations_id"], 'entity' => $this->fields["entities_id"]));
     } else {
         echo Dropdown::getDropdownName("glpi_locations", $this->fields["locations_id"]);
     }
     echo "</td><td>" . __('Type') . "</td><td>";
     Dropdown::show('PluginAppliancesApplianceType', array('value' => $this->fields["plugin_appliances_appliancetypes_id"], 'entity' => $this->fields["entities_id"]));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Technician in charge of the hardware') . "</td><td>";
     if ($canedit) {
         User::dropdown(array('name' => 'users_id_tech', 'value' => $this->fields['users_id_tech'], 'right' => 'own_ticket', 'entity' => $this->fields['entities_id']));
     } else {
         echo getUsername($this->fields['users_id_tech']);
     }
     echo "</td><td>" . __('Environment', 'appliances') . "</td><td>";
     Dropdown::show('PluginAppliancesEnvironment', array('value' => $this->fields["plugin_appliances_environments_id"]));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Group in charge of the hardware') . "</td><td>";
     if ($canedit) {
         Group::dropdown(array('name' => 'groups_id_tech', 'value' => $this->fields['groups_id_tech'], 'entity' => $this->fields['entities_id'], 'condition' => '`is_assign`'));
     } else {
         echo Dropdown::getDropdownName("glpi_groups", $this->fields["groups_id"]);
     }
     echo "</td><td>" . __('Serial number') . "</td><td>";
     Html::autocompletionTextField($this, 'serial');
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('User') . "</td>";
     echo "<td>";
     User::dropdown(array('value' => $this->fields["users_id"], 'entity' => $this->fields["entities_id"], 'right' => 'all'));
     echo "</td><td>" . __('Inventory number') . "</td><td>";
     Html::autocompletionTextField($this, 'otherserial');
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Group') . "</td>";
     echo "<td>";
     Group::dropdown(array('value' => $this->fields["groups_id"], 'entity' => $this->fields["entities_id"], 'condition' => '`is_itemgroup`'));
     echo "</td>";
     echo "<td rowspan='4'>" . __('Comments') . "</td>";
     echo "<td rowspan='4' class='middle'>";
     echo "<textarea cols='45' rows='5' name='comment' >" . $this->fields["comment"] . "</textarea>";
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Associable to a ticket') . "</td><td>";
     Dropdown::showYesNo('is_helpdesk_visible', $this->fields['is_helpdesk_visible']);
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     // dropdown relationtype added
     echo "<td>" . __('Item to link', 'appliances') . "</td><td>";
     if ($canedit && !($ID && countElementsInTable(array("glpi_plugin_appliances_relations", "glpi_plugin_appliances_appliances_items"), "glpi_plugin_appliances_relations.plugin_appliances_appliances_items_id\n                                          = glpi_plugin_appliances_appliances_items.id\n                                        AND glpi_plugin_appliances_appliances_items.plugin_appliances_appliances_id\n                                          = {$ID}"))) {
         PluginAppliancesRelation::dropdownType("relationtype", $this->fields["relationtype"]);
     } else {
         echo PluginAppliancesRelation::getTypeName($this->fields["relationtype"]);
         $rand = mt_rand();
         $comment = __('Flag change forbidden. Linked items found.');
         $image = "/pics/lock.png";
         echo "&nbsp;<img alt='' src='" . $CFG_GLPI["root_doc"] . $image . "' onmouseout=\"cleanhide('comment_relationtypes{$rand}')\" " . " onmouseover=\"cleandisplay('comment_relationtypes{$rand}')\">";
         echo "<span class='over_link' id='comment_relationtypes{$rand}'>{$comment}</span>";
     }
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td colspan='2' class='center'>" . sprintf(__('%1$s: %2$s'), __('Last update'), Html::convDateTime($this->fields["date_mod"]));
     echo "</td></tr>";
     $this->showFormButtons($options);
     echo "<div id='tabcontent'></div>";
     echo "<script type='text/javascript'>loadDefaultTab();</script>";
     return true;
 }
예제 #8
0
             echo '<br>';
             printf(__('%1$s: %2$s'), __('Email'), "<input type='text' size='25' name='_itil_" . $_POST["actortype"] . "[alternative_email]'>");
         }
         echo "</span>";
     }
     break;
 case "group":
     $cond = '`is_requester`';
     if ($_POST["actortype"] == 'assign') {
         $cond = '`is_assign`';
     }
     $param = array('name' => '_itil_' . $_POST["actortype"] . '[groups_id]', 'entity' => $_POST['entity_restrict'], 'condition' => $cond, 'rand' => $rand);
     if ($_POST["itemtype"] == 'Ticket' && $_POST["actortype"] == 'assign') {
         $param['toupdate'] = array('value_fieldname' => 'value', 'to_update' => "countgroupassign_{$rand}", 'url' => $CFG_GLPI["root_doc"] . "/ajax/ticketassigninformation.php", 'moreparams' => array('groups_id_assign' => '__VALUE__'));
     }
     $rand = Group::dropdown($param);
     if ($_POST["itemtype"] == 'Ticket' && $_POST["actortype"] == 'assign') {
         echo "<br><span id='countgroupassign_{$rand}'>";
         echo "</span>";
     }
     break;
 case "supplier":
     $options = array('name' => '_itil_' . $_POST["actortype"] . '[suppliers_id]', 'entity' => $_POST['entity_restrict'], 'rand' => $rand);
     if ($CFG_GLPI["use_mailing"]) {
         $withemail = isset($_POST["allow_email"]) ? $_POST["allow_email"] : false;
         $paramscomment = array('value' => '__VALUE__', 'allow_email' => $withemail, 'field' => '_itil_' . $_POST["actortype"], 'typefield' => "supplier", 'use_notification' => $_POST["use_notif"]);
         // Fix rand value
         $options['rand'] = $rand;
         $options['toupdate'] = array('value_fieldname' => 'value', 'to_update' => "notif_supplier_{$rand}", 'url' => $CFG_GLPI["root_doc"] . "/ajax/uemailUpdate.php", 'moreparams' => $paramscomment);
     }
     if ($_POST["itemtype"] == 'Ticket') {
예제 #9
0
 /**
  * Print the acccount form
  *
  * @param $ID        integer ID of the item
  * @param $options   array
  *     - target for the Form
  *     - withtemplate template or basic computer
  *
  * @return Nothing (display)
  **/
 public function showForm($ID, $options = array())
 {
     if (!$this->canView()) {
         return false;
     }
     $hashclass = new PluginAccountsHash();
     $restrict = getEntitiesRestrictRequest(" ", "glpi_plugin_accounts_hashes", '', '', $hashclass->maybeRecursive());
     if ($ID < 1 && countElementsInTable("glpi_plugin_accounts_hashes", $restrict) == 0) {
         echo "<div class='center'>" . __('There is no encryption key for this entity', 'accounts') . "<br><br>";
         echo "<a href='" . Toolbox::getItemTypeSearchURL('PluginAccountsAccount') . "'>";
         _e('Back');
         echo "</a></div>";
         return false;
     }
     /*
           if ($ID > 0) {
              $this->check($ID, READ);
              if (!Session::haveRight("plugin_accounts_see_all_users", 1)) {
                 $access = 0;
                 if (Session::haveRight("plugin_accounts_my_groups", 1)) {
                    if ($this->fields["groups_id"]) {
                       if (count($_SESSION['glpigroups'])
                                && in_array($this->fields["groups_id"], $_SESSION['glpigroups'])
                       ) {
                          $access = 1;
                       }
                    }
                    if ($this->fields["users_id"]) {
                       if ($this->fields["users_id"] == Session::getLoginUserID())
                          $access = 1;
                    }
                 }
                 if (!Session::haveRight("plugin_accounts_my_groups", 1)
                          && $this->fields["users_id"] == Session::getLoginUserID()
                 )
                    $access = 1;
     
                 if ($access != 1)
                    return false;
              }
           } else {
              // Create item
              $this->check(-1, UPDATE);
              $this->getEmpty();
           }
     */
     $options["formoptions"] = "id = 'account_form'";
     $this->initForm($ID, $options);
     $this->showFormHeader($options);
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Name') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "name");
     echo "</td>";
     echo "<td>" . __('Status') . "</td><td>";
     Dropdown::show('PluginAccountsAccountState', array('value' => $this->fields["plugin_accounts_accountstates_id"]));
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Login') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "login");
     echo "</td>";
     echo "<td>" . __('Type') . "</td><td>";
     Dropdown::show('PluginAccountsAccountType', array('value' => $this->fields["plugin_accounts_accounttypes_id"]));
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     //hash
     $hash = 0;
     $restrict = getEntitiesRestrictRequest(" ", "glpi_plugin_accounts_hashes", '', $this->getEntityID(), $hashclass->maybeRecursive());
     $hashes = getAllDatasFromTable("glpi_plugin_accounts_hashes", $restrict);
     if (!empty($hashes)) {
         foreach ($hashes as $hashe) {
             $hash = $hashe["hash"];
             $hash_id = $hashe["id"];
         }
         $alert = '';
     } else {
         $alert = __('There is no encryption key for this entity', 'accounts');
     }
     $aeskey = new PluginAccountsAesKey();
     //aeskey non enregistre
     if ($hash) {
         if (!$aeskey->getFromDBByHash($hash_id) || !$aeskey->fields["name"]) {
             echo "<td>" . __('Encryption key', 'accounts') . "</div></td><td>";
             echo "<input type='password' autocomplete='off' name='aeskey' id='aeskey'>";
             echo Html::hidden('encrypted_password', array('value' => $this->fields["encrypted_password"], 'id' => 'encrypted_password'));
             echo Html::hidden('good_hash', array('value' => $hash, 'id' => 'good_hash'));
             echo Html::hidden('wrong_key_locale', array('value' => __('Wrong encryption key', 'accounts'), 'id' => 'wrong_key_locale'));
             if (!empty($ID) || $ID > 0) {
                 $url = $this->getFormURL();
                 echo "&nbsp;<input type='button' id='decrypte_link' name='decrypte' value='" . __s('Uncrypt', 'accounts') . "'\n                        class='submit'>";
             }
             echo "</td>";
         } else {
             echo "<td></td><td>";
             echo "</td>";
         }
     } else {
         echo "<td>" . __('Encryption key', 'accounts') . "</div></td><td><div class='red'>";
         echo $alert;
         echo "</div></td>";
     }
     if ($_SESSION['glpiactiveprofile']['interface'] == 'central') {
         echo "<td>" . __('Affected User', 'accounts') . "</td><td>";
         if ($this->canCreate()) {
             User::dropdown(array('value' => $this->fields["users_id"], 'entity' => $this->fields["entities_id"], 'right' => 'all'));
         } else {
             echo getUserName($this->fields["users_id"]);
         }
         echo "</td>";
     } else {
         echo "<td>" . __('Affected User', 'accounts') . "</td><td>";
         echo getUserName($this->fields["users_id"]);
         echo "</td>";
     }
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Password') . "</td>";
     echo "<td>";
     //aeskey enregistre
     if (isset($hash_id) && $aeskey->getFromDBByHash($hash_id) && $aeskey->fields["name"]) {
         echo Html::hidden('good_hash', array('value' => $hash, 'id' => 'good_hash'));
         echo Html::hidden('aeskey', array('value' => $aeskey->fields["name"], 'id' => 'aeskey', 'autocomplete' => 'off'));
         echo Html::hidden('encrypted_password', array('value' => $this->fields["encrypted_password"], 'id' => 'encrypted_password'));
         echo Html::hidden('wrong_key_locale', array('value' => __('Wrong encryption key', 'accounts'), 'id' => 'wrong_key_locale'));
         echo Html::scriptBlock("auto_decrypt();");
     }
     echo "<input type='text' name='hidden_password' id='hidden_password' size='30' >";
     echo "</td>";
     if ($_SESSION['glpiactiveprofile']['interface'] == 'central') {
         echo "<td>" . __('Affected Group', 'accounts') . "</td><td>";
         if (self::canCreate()) {
             Dropdown::show('Group', array('value' => $this->fields["groups_id"], 'condition' => '`is_itemgroup`'));
         } else {
             echo Dropdown::getDropdownName("glpi_groups", $this->fields["groups_id"]);
         }
         echo "</td>";
     } else {
         echo "<td>" . __('Affected Group', 'accounts') . ":\t</td><td>";
         echo Dropdown::getDropdownName("glpi_groups", $this->fields["groups_id"]);
         echo "</td>";
     }
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Creation date') . "</td>";
     echo "<td>";
     Html::showDateFormItem("date_creation", $this->fields["date_creation"], true, true);
     echo "</td>";
     echo "<td>" . __('Technician in charge of the hardware') . "</td>";
     echo "<td>";
     User::dropdown(array('name' => "users_id_tech", 'value' => $this->fields["users_id_tech"], 'entity' => $this->fields["entities_id"], 'right' => 'interface'));
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Expiration date') . "&nbsp;";
     Html::showToolTip(nl2br(__('Empty for infinite', 'accounts')));
     echo "</td>";
     echo "<td>";
     Html::showDateFormItem("date_expiration", $this->fields["date_expiration"], true, true);
     echo "</td>";
     echo "<td>" . __('Group in charge of the hardware') . "</td><td>";
     Group::dropdown(array('name' => 'groups_id_tech', 'value' => $this->fields['groups_id_tech'], 'condition' => '`is_assign`'));
     echo "</td>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Others') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "others");
     echo "</td>";
     echo "<td>" . __('Location') . "</td><td>";
     Location::dropdown(array('value' => $this->fields["locations_id"], 'entity' => $this->fields["entities_id"]));
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td colspan = '4'>";
     echo "<table cellpadding='2' cellspacing='2' border='0'><tr><td>";
     echo __('Comments') . "</td></tr>";
     echo "<tr><td class='center'>";
     echo "<textarea cols='125' rows='3' name='comment'>" . $this->fields["comment"] . "</textarea>";
     echo "</td></tr></table>";
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Associable to a ticket') . "</td><td>";
     Dropdown::showYesNo('is_helpdesk_visible', $this->fields['is_helpdesk_visible']);
     echo "</td>";
     echo "<td colspan='2'>";
     printf(__('Last update on %s'), Html::convDateTime($this->fields["date_mod"]));
     echo "</td>";
     echo "</tr>";
     if (self::canCreate()) {
         if (empty($ID) || $ID < 0) {
             echo "<tr>";
             echo "<td class='tab_bg_2 top' colspan='4'>";
             echo "<div align='center'>";
             echo "<input type='submit' name='add' id='account_add' value='" . _sx('button', 'Add') . "' class='submit'>";
             echo "</div>";
             echo Html::scriptBlock("\$('#account_form').submit(function(event){\n               if (\$('#hidden_password').val() == '' || \$('#aeskey').val() == '') {\n                  alert('" . __('You have not filled the password and encryption key', 'accounts') . "');\n                  return false;\n               };\n               if (!check_hash()) {\n                  alert('" . __('Wrong encryption key', 'accounts') . "');\n                  return false;\n               } else {\n                  encrypt_password();\n               }\n            });");
             echo "</td>";
             echo "</tr>";
         } else {
             echo "<tr>";
             echo "<td class='tab_bg_2'  colspan='4 top'><div align='center'>";
             echo "<input type='hidden' name='id' value=\"{$ID}\">";
             echo "<input type='submit' name='update' id='account_update' value=\"" . _sx('button', 'Save') . "\" class='submit' >";
             echo Html::scriptBlock("\$('#account_form').submit(function(event){\n               if (\$('#hidden_password').val() == '' || \$('#aeskey').val() == '') {\n                  alert('" . __('Password will not be modified', 'accounts') . "');\n               } else if (!check_hash()) {\n                  alert('" . __('Wrong encryption key', 'accounts') . "');\n                  return false;\n               } else {\n                  encrypt_password();\n               }\n            });");
             if ($this->fields["is_deleted"] == '0') {
                 echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type='submit' name='delete' value=\"" . _sx('button', 'Put in dustbin') . "\" class='submit'></div>";
             } else {
                 echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type='submit' name='restore' value=\"" . _sx('button', 'Restore') . "\" class='submit'>";
                 echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type='submit' name='purge' value=\"" . _sx('button', 'Delete permanently') . "\" class='submit'></div>";
             }
             echo "</td>";
             echo "</tr>";
         }
     }
     $options['canedit'] = false;
     $options['candel'] = false;
     $this->showFormButtons($options);
     Html::closeForm();
     return true;
 }
 /**
  * Show the Form edit form the the adminsitrator in the config page
  *
  * @param  Array  $options Optional options
  *
  * @return NULL         Nothing, just display the form
  */
 public function showForm($options = array())
 {
     $rand = mt_rand();
     $obj = new PluginFormcreatorTarget();
     $found = $obj->find("itemtype = '" . __CLASS__ . "' AND items_id = " . (int) $this->getID());
     $target = array_shift($found);
     $form = new PluginFormcreatorForm();
     $form->getFromDB($target['plugin_formcreator_forms_id']);
     echo '<div class="center" style="width: 950px; margin: 0 auto;">';
     echo '<form name="form_target" method="post" action="' . $GLOBALS['CFG_GLPI']['root_doc'] . '/plugins/formcreator/front/targetticket.form.php">';
     // General information : name
     echo '<table class="tab_cadre_fixe">';
     echo '<tr><th colspan="2">' . __('Edit a destination', 'formcreator') . '</th></tr>';
     echo '<tr class="line1">';
     echo '<td width="15%"><strong>' . __('Name') . ' <span style="color:red;">*</span></strong></td>';
     echo '<td width="85%"><input type="text" name="name" style="width:704px;" value="' . $target['name'] . '"></textarea</td>';
     echo '</tr>';
     echo '</table>';
     // Ticket information : title, template...
     echo '<table class="tab_cadre_fixe">';
     echo '<tr><th colspan="4">' . _n('Target ticket', 'Target tickets', 1, 'formcreator') . '</th></tr>';
     echo '<tr class="line1">';
     echo '<td><strong>' . __('Ticket title', 'formcreator') . ' <span style="color:red;">*</span></strong></td>';
     echo '<td colspan="3"><input type="text" name="title" style="width:704px;" value="' . $this->fields['name'] . '"></textarea</td>';
     echo '</tr>';
     echo '<tr class="line0">';
     echo '<td><strong>' . __('Description') . ' <span style="color:red;">*</span></strong></td>';
     echo '<td colspan="3">';
     echo '<textarea name="comment" style="width:700px;" rows="15">' . $this->fields['comment'] . '</textarea>';
     if ($GLOBALS['CFG_GLPI']["use_rich_text"]) {
         Html::initEditorSystem('comment');
     }
     echo '</td>';
     echo '</tr>';
     // Ticket Template
     echo '<tr class="line1">';
     echo '<td width="15%">' . _n('Ticket template', 'Ticket templates', 1) . '</td>';
     echo '<td width="25%">';
     Dropdown::show('TicketTemplate', array('name' => 'tickettemplates_id', 'value' => $this->fields['tickettemplates_id']));
     echo '</td>';
     echo '<td width="15%">' . __('Due date') . '</td>';
     echo '<td width="45%">';
     // -------------------------------------------------------------------------------------------
     // Due date type selection
     // -------------------------------------------------------------------------------------------
     Dropdown::showFromArray('due_date_rule', array('' => Dropdown::EMPTY_VALUE, 'answer' => __('equals to the answer to the question', 'formcreator'), 'ticket' => __('calculated from the ticket creation date', 'formcreator'), 'calcul' => __('calculated from the answer to the question', 'formcreator')), array('value' => $this->fields['due_date_rule'], 'on_change' => 'formcreatorChangeDueDate(this.value)'));
     // for each section ...
     $questions_list = array(Dropdown::EMPTY_VALUE);
     $query = "SELECT s.id, s.name\n                FROM glpi_plugin_formcreator_targets t\n                INNER JOIN glpi_plugin_formcreator_sections s ON s.plugin_formcreator_forms_id = t.plugin_formcreator_forms_id\n                WHERE t.items_id = " . (int) $this->getID() . "\n                ORDER BY s.order";
     $result = $GLOBALS['DB']->query($query);
     while ($section = $GLOBALS['DB']->fetch_array($result)) {
         // select all date and datetime questions
         $query2 = "SELECT q.id, q.name\n                   FROM glpi_plugin_formcreator_questions q\n                   INNER JOIN glpi_plugin_formcreator_sections s ON s.id = q.plugin_formcreator_sections_id\n                   WHERE s.id = {$section['id']}\n                   AND q.fieldtype IN ('date', 'datetime')";
         $result2 = $GLOBALS['DB']->query($query2);
         $section_questions = array();
         while ($question = $GLOBALS['DB']->fetch_array($result2)) {
             $section_questions[$question['id']] = $question['name'];
         }
         if (count($section_questions) > 0) {
             $questions_list[$section['name']] = $section_questions;
         }
     }
     // List questions
     if ($this->fields['due_date_rule'] != 'answer' && $this->fields['due_date_rule'] != 'calcul') {
         echo '<div id="due_date_questions" style="display:none">';
     } else {
         echo '<div id="due_date_questions">';
     }
     Dropdown::showFromArray('due_date_question', $questions_list, array('value' => $this->fields['due_date_question']));
     echo '</div>';
     if ($this->fields['due_date_rule'] != 'ticket' && $this->fields['due_date_rule'] != 'calcul') {
         echo '<div id="due_date_time" style="display:none">';
     } else {
         echo '<div id="due_date_time">';
     }
     Dropdown::showNumber("due_date_value", array('value' => $this->fields['due_date_value'], 'min' => -30, 'max' => 30));
     Dropdown::showFromArray('due_date_period', array('minute' => _n('Minute', 'Minutes', 2), 'hour' => _n('Hour', 'Hours', 2), 'day' => _n('Day', 'Days', 2), 'month' => __('Month')), array('value' => $this->fields['due_date_period']));
     echo '</div>';
     echo '</td>';
     echo '</tr>';
     // -------------------------------------------------------------------------------------------
     // Due date type selection end
     // -------------------------------------------------------------------------------------------
     if ($form->fields['validation_required']) {
         echo '<tr class="line0">';
         echo '<td colspan="4">';
         echo '<input type="hidden" name="validation_followup" value="0" />';
         echo '<input type="checkbox" name="validation_followup" id="validation_followup" value="1" ';
         if (!isset($this->fields['validation_followup']) || $this->fields['validation_followup'] == 1) {
             echo ' checked="checked"';
         }
         echo '/>';
         echo ' <label for="validation_followup">';
         echo __('Add validation message as first ticket followup', 'formcreator');
         echo '</label>';
         echo '</td>';
         echo '</tr>';
     }
     echo '</table>';
     // Buttons
     echo '<table class="tab_cadre_fixe">';
     echo '<tr class="line1">';
     echo '<td colspan="5" class="center">';
     echo '<input type="reset" name="reset" class="submit_button" value="' . __('Cancel', 'formcreator') . '"
            onclick="document.location = \'form.form.php?id=' . $target['plugin_formcreator_forms_id'] . '\'" /> &nbsp; ';
     echo '<input type="hidden" name="id" value="' . $this->getID() . '" />';
     echo '<input type="submit" name="update" class="submit_button" value="' . __('Save') . '" />';
     echo '</td>';
     echo '</tr>';
     echo '</table>';
     Html::closeForm();
     // Get available questions for actors lists
     $questions_user_list = array(Dropdown::EMPTY_VALUE);
     $questions_group_list = array(Dropdown::EMPTY_VALUE);
     $questions_supplier_list = array(Dropdown::EMPTY_VALUE);
     $query = "SELECT s.id, s.name\n                FROM glpi_plugin_formcreator_targets t\n                INNER JOIN glpi_plugin_formcreator_sections s ON s.plugin_formcreator_forms_id = t.plugin_formcreator_forms_id\n                WHERE t.items_id = " . (int) $this->getID() . "\n                ORDER BY s.order";
     $result = $GLOBALS['DB']->query($query);
     while ($section = $GLOBALS['DB']->fetch_array($result)) {
         // select all user, group or supplier questions (GLPI Object)
         $query2 = "SELECT q.id, q.name, q.values\n                   FROM glpi_plugin_formcreator_questions q\n                   INNER JOIN glpi_plugin_formcreator_sections s ON s.id = q.plugin_formcreator_sections_id\n                   WHERE s.id = {$section['id']}\n                   AND q.fieldtype = 'glpiselect'\n                   AND q.values IN ('User', 'Group', 'Supplier')";
         $result2 = $GLOBALS['DB']->query($query2);
         $section_questions_user = array();
         $section_questions_group = array();
         $section_questions_supplier = array();
         while ($question = $GLOBALS['DB']->fetch_array($result2)) {
             switch ($question['values']) {
                 case 'User':
                     $section_questions_user[$question['id']] = $question['name'];
                     break;
                 case 'Group':
                     $section_questions_group[$question['id']] = $question['name'];
                     break;
                 case 'Supplier':
                     $section_questions_supplier[$question['id']] = $question['name'];
                     break;
             }
         }
         $questions_user_list[$section['name']] = $section_questions_user;
         $questions_group_list[$section['name']] = $section_questions_group;
         $questions_supplier_list[$section['name']] = $section_questions_supplier;
     }
     // Get available questions for actors lists
     $actors = array('requester' => array(), 'observer' => array(), 'assigned' => array());
     $query = "SELECT id, actor_role, actor_type, actor_value, use_notification\n                FROM glpi_plugin_formcreator_targettickets_actors\n                WHERE plugin_formcreator_targettickets_id = " . $this->getID();
     $result = $GLOBALS['DB']->query($query);
     while ($actor = $GLOBALS['DB']->fetch_array($result)) {
         $actors[$actor['actor_role']][$actor['id']] = array('actor_type' => $actor['actor_type'], 'actor_value' => $actor['actor_value'], 'use_notification' => $actor['use_notification']);
     }
     $img_user = '******' . __('User') . '" title="' . __('User') . '" width="20" />';
     $img_group = '<img src="../../../pics/groupes.png" alt="' . __('Group') . '" title="' . __('Group') . '" width="20" />';
     $img_supplier = '<img src="../../../pics/supplier.png" alt="' . __('Supplier') . '" title="' . __('Supplier') . '" width="20" />';
     $img_mail = '<img src="../pics/email.png" alt="' . __('Yes') . '" title="' . __('Email followup') . ' ' . __('Yes') . '" />';
     $img_nomail = '<img src="../pics/email-no.png" alt="' . __('No') . '" title="' . __('Email followup') . ' ' . __('No') . '" />';
     echo '<table class="tab_cadre_fixe">';
     echo '<tr><th colspan="3">' . __('Ticket actors', 'formcreator') . '</th></tr>';
     echo '<tr>';
     echo '<th width="33%">';
     echo _n('Requester', 'Requesters', 1) . ' &nbsp;';
     echo '<img title="Ajouter" alt="Ajouter" onclick="displayRequesterForm()" class="pointer"
            id="btn_add_requester" src="../../../pics/add_dropdown.png">';
     echo '<img title="Annuler" alt="Annuler" onclick="hideRequesterForm()" class="pointer"
            id="btn_cancel_requester" src="../../../pics/delete.png" style="display:none">';
     echo '</th>';
     echo '<th width="34%">';
     echo _n('Watcher', 'Watchers', 1) . ' &nbsp;';
     echo '<img title="Ajouter" alt="Ajouter" onclick="displayWatcherForm()" class="pointer"
            id="btn_add_watcher" src="../../../pics/add_dropdown.png">';
     echo '<img title="Annuler" alt="Annuler" onclick="hideWatcherForm()" class="pointer"
            id="btn_cancel_watcher" src="../../../pics/delete.png" style="display:none">';
     echo '</th>';
     echo '<th width="33%">';
     echo __('Assigned to') . ' &nbsp;';
     echo '<img title="Ajouter" alt="Ajouter" onclick="displayAssignedForm()" class="pointer"
            id="btn_add_assigned" src="../../../pics/add_dropdown.png">';
     echo '<img title="Annuler" alt="Annuler" onclick="hideAssignedForm()" class="pointer"
            id="btn_cancel_assigned" src="../../../pics/delete.png" style="display:none">';
     echo '</th>';
     echo '</tr>';
     echo '<tr>';
     // Requester
     echo '<td valign="top">';
     // => Add requester form
     echo '<form name="form_target" id="form_add_requester" method="post" style="display:none" action="' . $GLOBALS['CFG_GLPI']['root_doc'] . '/plugins/formcreator/front/targetticket.form.php">';
     Dropdown::showFromArray('actor_type', array('' => Dropdown::EMPTY_VALUE, 'creator' => __('Form requester', 'formcreator'), 'validator' => __('Form validator', 'formcreator'), 'person' => __('Specific person', 'formcreator'), 'question_person' => __('Person from the question', 'formcreator'), 'group' => __('Specific group', 'formcreator'), 'question_group' => __('Group from the question', 'formcreator')), array('on_change' => 'formcreatorChangeActorRequester(this.value)'));
     echo '<div id="block_requester_user" style="display:none">';
     User::dropdown(array('name' => 'actor_value_person', 'right' => 'all', 'all' => 0));
     echo '</div>';
     echo '<div id="block_requester_group" style="display:none">';
     Group::dropdown(array('name' => 'actor_value_group'));
     echo '</div>';
     echo '<div id="block_requester_question_user" style="display:none">';
     Dropdown::showFromArray('actor_value_question_person', $questions_user_list, array('value' => $this->fields['due_date_question']));
     echo '</div>';
     echo '<div id="block_requester_question_group" style="display:none">';
     Dropdown::showFromArray('actor_value_question_group', $questions_group_list, array('value' => $this->fields['due_date_question']));
     echo '</div>';
     echo '<div>';
     echo __('Email followup');
     Dropdown::showYesNo('use_notification', 1);
     echo '</div>';
     echo '<p align="center">';
     echo '<input type="hidden" name="id" value="' . $this->getID() . '" />';
     echo '<input type="hidden" name="actor_role" value="requester" />';
     echo '<input type="submit" value="' . __('Add') . '" class="submit_button" />';
     echo '</p>';
     echo "<hr>";
     Html::closeForm();
     // => List of saved requesters
     foreach ($actors['requester'] as $id => $values) {
         echo '<div>';
         switch ($values['actor_type']) {
             case 'creator':
                 echo $img_user . ' <b>' . __('Form requester', 'formcreator') . '</b>';
                 break;
             case 'validator':
                 echo $img_user . ' <b>' . __('Form validator', 'formcreator') . '</b>';
                 break;
             case 'person':
                 $user = new User();
                 $user->getFromDB($values['actor_value']);
                 echo $img_user . ' <b>' . __('User') . ' </b> "' . $user->getName() . '"';
                 break;
             case 'question_person':
                 $question = new PluginFormcreatorQuestion();
                 $question->getFromDB($values['actor_value']);
                 echo $img_user . ' <b>' . __('Person from the question', 'formcreator') . '</b> "' . $question->getName() . '"';
                 break;
             case 'group':
                 $group = new Group();
                 $group->getFromDB($values['actor_value']);
                 echo $img_user . ' <b>' . __('Group') . ' </b> "' . $group->getName() . '"';
                 break;
             case 'question_group':
                 $question = new PluginFormcreatorQuestion();
                 $question->getFromDB($values['actor_value']);
                 echo $img_group . ' <b>' . __('Group from the question', 'formcreator') . '</b> "' . $question->getName() . '"';
                 break;
         }
         echo $values['use_notification'] ? ' ' . $img_mail . ' ' : ' ' . $img_nomail . ' ';
         echo self::getDeleteImage($id);
         echo '</div>';
     }
     echo '</td>';
     // Observer
     echo '<td valign="top">';
     // => Add observer form
     echo '<form name="form_target" id="form_add_watcher" method="post" style="display:none" action="' . $GLOBALS['CFG_GLPI']['root_doc'] . '/plugins/formcreator/front/targetticket.form.php">';
     Dropdown::showFromArray('actor_type', array('' => Dropdown::EMPTY_VALUE, 'creator' => __('Form requester', 'formcreator'), 'validator' => __('Form validator', 'formcreator'), 'person' => __('Specific person', 'formcreator'), 'question_person' => __('Person from the question', 'formcreator'), 'group' => __('Specific group', 'formcreator'), 'question_group' => __('Group from the question', 'formcreator')), array('on_change' => 'formcreatorChangeActorWatcher(this.value)'));
     echo '<div id="block_watcher_user" style="display:none">';
     User::dropdown(array('name' => 'actor_value_person', 'right' => 'all', 'all' => 0));
     echo '</div>';
     echo '<div id="block_watcher_group" style="display:none">';
     Group::dropdown(array('name' => 'actor_value_group'));
     echo '</div>';
     echo '<div id="block_watcher_question_user" style="display:none">';
     Dropdown::showFromArray('actor_value_question_person', $questions_user_list, array('value' => $this->fields['due_date_question']));
     echo '</div>';
     echo '<div id="block_watcher_question_group" style="display:none">';
     Dropdown::showFromArray('actor_value_question_group', $questions_group_list, array('value' => $this->fields['due_date_question']));
     echo '</div>';
     echo '<div>';
     echo __('Email followup');
     Dropdown::showYesNo('use_notification', 1);
     echo '</div>';
     echo '<p align="center">';
     echo '<input type="hidden" name="id" value="' . $this->getID() . '" />';
     echo '<input type="hidden" name="actor_role" value="observer" />';
     echo '<input type="submit" value="' . __('Add') . '" class="submit_button" />';
     echo '</p>';
     echo "<hr>";
     Html::closeForm();
     // => List of saved observers
     foreach ($actors['observer'] as $id => $values) {
         echo '<div>';
         switch ($values['actor_type']) {
             case 'creator':
                 echo $img_user . ' <b>' . __('Form requester', 'formcreator') . '</b>';
                 break;
             case 'validator':
                 echo $img_user . ' <b>' . __('Form validator', 'formcreator') . '</b>';
                 break;
             case 'person':
                 $user = new User();
                 $user->getFromDB($values['actor_value']);
                 echo $img_user . ' <b>' . __('User') . ' </b> "' . $user->getName() . '"';
                 break;
             case 'question_person':
                 $question = new PluginFormcreatorQuestion();
                 $question->getFromDB($values['actor_value']);
                 echo $img_user . ' <b>' . __('Person from the question', 'formcreator') . '</b> "' . $question->getName() . '"';
                 break;
             case 'group':
                 $group = new Group();
                 $group->getFromDB($values['actor_value']);
                 echo $img_user . ' <b>' . __('Group') . ' </b> "' . $group->getName() . '"';
                 break;
             case 'question_group':
                 $question = new PluginFormcreatorQuestion();
                 $question->getFromDB($values['actor_value']);
                 echo $img_group . ' <b>' . __('Group from the question', 'formcreator') . '</b> "' . $question->getName() . '"';
                 break;
         }
         echo $values['use_notification'] ? ' ' . $img_mail . ' ' : ' ' . $img_nomail . ' ';
         echo self::getDeleteImage($id);
         echo '</div>';
     }
     echo '</td>';
     // Assigned to
     echo '<td valign="top">';
     // => Add assigned to form
     echo '<form name="form_target" id="form_add_assigned" method="post" style="display:none" action="' . $GLOBALS['CFG_GLPI']['root_doc'] . '/plugins/formcreator/front/targetticket.form.php">';
     Dropdown::showFromArray('actor_type', array('' => Dropdown::EMPTY_VALUE, 'creator' => __('Form requester', 'formcreator'), 'validator' => __('Form validator', 'formcreator'), 'person' => __('Specific person', 'formcreator'), 'question_person' => __('Person from the question', 'formcreator'), 'group' => __('Specific group', 'formcreator'), 'question_group' => __('Group from the question', 'formcreator'), 'supplier' => __('Specific supplier', 'formcreator'), 'question_supplier' => __('Supplier from the question', 'formcreator')), array('on_change' => 'formcreatorChangeActorAssigned(this.value)'));
     echo '<div id="block_assigned_user" style="display:none">';
     User::dropdown(array('name' => 'actor_value_person', 'right' => 'all', 'all' => 0));
     echo '</div>';
     echo '<div id="block_assigned_group" style="display:none">';
     Group::dropdown(array('name' => 'actor_value_group'));
     echo '</div>';
     echo '<div id="block_assigned_supplier" style="display:none">';
     Supplier::dropdown(array('name' => 'actor_value_supplier'));
     echo '</div>';
     echo '<div id="block_assigned_question_user" style="display:none">';
     Dropdown::showFromArray('actor_value_question_person', $questions_user_list, array('value' => $this->fields['due_date_question']));
     echo '</div>';
     echo '<div id="block_assigned_question_group" style="display:none">';
     Dropdown::showFromArray('actor_value_question_group', $questions_group_list, array('value' => $this->fields['due_date_question']));
     echo '</div>';
     echo '<div id="block_assigned_question_supplier" style="display:none">';
     Dropdown::showFromArray('actor_value_question_supplier', $questions_supplier_list, array('value' => $this->fields['due_date_question']));
     echo '</div>';
     echo '<div>';
     echo __('Email followup');
     Dropdown::showYesNo('use_notification', 1);
     echo '</div>';
     echo '<p align="center">';
     echo '<input type="hidden" name="id" value="' . $this->getID() . '" />';
     echo '<input type="hidden" name="actor_role" value="assigned" />';
     echo '<input type="submit" value="' . __('Add') . '" class="submit_button" />';
     echo '</p>';
     echo "<hr>";
     Html::closeForm();
     // => List of saved assigned to
     foreach ($actors['assigned'] as $id => $values) {
         echo '<div>';
         switch ($values['actor_type']) {
             case 'creator':
                 echo $img_user . ' <b>' . __('Form requester', 'formcreator') . '</b>';
                 break;
             case 'validator':
                 echo $img_user . ' <b>' . __('Form validator', 'formcreator') . '</b>';
                 break;
             case 'person':
                 $user = new User();
                 $user->getFromDB($values['actor_value']);
                 echo $img_user . ' <b>' . __('User') . ' </b> "' . $user->getName() . '"';
                 break;
             case 'question_person':
                 $question = new PluginFormcreatorQuestion();
                 $question->getFromDB($values['actor_value']);
                 echo $img_user . ' <b>' . __('Person from the question', 'formcreator') . '</b> "' . $question->getName() . '"';
                 break;
             case 'group':
                 $group = new Group();
                 $group->getFromDB($values['actor_value']);
                 echo $img_user . ' <b>' . __('Group') . ' </b> "' . $group->getName() . '"';
                 break;
             case 'question_group':
                 $question = new PluginFormcreatorQuestion();
                 $question->getFromDB($values['actor_value']);
                 echo $img_group . ' <b>' . __('Group from the question', 'formcreator') . '</b> "' . $question->getName() . '"';
                 break;
             case 'supplier':
                 $group = new Group();
                 $group->getFromDB($values['actor_value']);
                 echo $img_supplier . ' <b>' . __('Supplier') . ' </b> "' . $group->getName() . '"';
                 break;
             case 'question_supplier':
                 $question = new PluginFormcreatorQuestion();
                 $question->getFromDB($values['actor_value']);
                 echo $img_supplier . ' <b>' . __('Supplier from the question', 'formcreator') . '</b> "' . $question->getName() . '"';
                 break;
         }
         echo $values['use_notification'] ? ' ' . $img_mail . ' ' : ' ' . $img_nomail . ' ';
         echo self::getDeleteImage($id);
         echo '</div>';
     }
     echo '</td>';
     echo '</tr>';
     echo '</table>';
     // List of available tags
     echo '<table class="tab_cadre_fixe">';
     echo '<tr><th colspan="5">' . __('List of available tags') . '</th></tr>';
     echo '<tr>';
     echo '<th width="40%" colspan="2">' . _n('Question', 'Questions', 1, 'formcreator') . '</th>';
     echo '<th width="20%">' . __('Title') . '</th>';
     echo '<th width="20%">' . _n('Answer', 'Answers', 1, 'formcreator') . '</th>';
     echo '<th width="20%">' . _n('Section', 'Sections', 1, 'formcreator') . '</th>';
     echo '</tr>';
     echo '<tr class="line0">';
     echo '<td colspan="2"><strong>' . __('Full form', 'formcreator') . '</strong></td>';
     echo '<td align="center"><code>-</code></td>';
     echo '<td align="center"><code><strong>##FULLFORM##</strong></code></td>';
     echo '<td align="center">-</td>';
     echo '</tr>';
     $table_questions = getTableForItemType('PluginFormcreatorQuestion');
     $table_sections = getTableForItemType('PluginFormcreatorSection');
     $query = "SELECT q.`id`, q.`name` AS question, s.`name` AS section\n                FROM {$table_questions} q\n                LEFT JOIN {$table_sections} s ON q.`plugin_formcreator_sections_id` = s.`id`\n                WHERE s.`plugin_formcreator_forms_id` = " . $target['plugin_formcreator_forms_id'] . "\n                ORDER BY s.`order`, q.`order`";
     $result = $GLOBALS['DB']->query($query);
     $i = 0;
     while ($question = $GLOBALS['DB']->fetch_array($result)) {
         $i++;
         echo '<tr class="line' . $i % 2 . '">';
         echo '<td colspan="2">' . $question['question'] . '</td>';
         echo '<td align="center"><code>##question_' . $question['id'] . '##</code></td>';
         echo '<td align="center"><code>##answer_' . $question['id'] . '##</code></td>';
         echo '<td align="center">' . $question['section'] . '</td>';
         echo '</tr>';
     }
     echo '</table>';
     echo '</div>';
 }
예제 #11
0
 /**
  * Display 'Group' part of self::showAddPlanningForm spcified by planning type dropdown.
  * Actually called by ajax/planning.php
  *
  * @since 9.1
  *
  * @return Nothing (display function)
  */
 static function showAddGroupForm($params = array())
 {
     $condition = "is_task = 1";
     // filter groups
     if (!Session::haveRight('planning', self::READALL)) {
         $condition .= " AND id IN(" . implode(',', $_SESSION['glpigroups']) . ")";
     }
     echo __("Group") . " : <br>";
     Group::dropdown(array('entity' => $_SESSION['glpiactive_entity'], 'entity_sons' => $_SESSION['glpiactive_entity_recursive'], 'condition' => $condition));
     echo "<br /><br />";
     echo Html::hidden('action', array('value' => 'send_add_group_form'));
     echo Html::submit(_sx('button', 'Add'));
 }
예제 #12
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 $CFG_GLPI, $DB;
     $this->initForm($ID, $options);
     $this->showFormHeader($options);
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Creation date') . "</td>";
     echo "<td>";
     $date = $this->fields["date"];
     if (!$ID) {
         $date = $_SESSION['glpi_currenttime'];
     }
     Html::showDateTimeField("date", array('value' => $date, 'timestep' => 1, 'maybeempty' => false));
     echo "</td>";
     if ($ID) {
         echo "<td>" . __('Last update') . "</td>";
         echo "<td >" . Html::convDateTime($this->fields["date_mod"]) . "</td>";
     } else {
         echo "<td colspan='2'>&nbsp;</td>";
     }
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Name') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, 'name');
     echo "</td>";
     echo "<td>" . __('Code') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, 'code');
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Priority') . "</td>";
     echo "<td>";
     CommonITILObject::dropdownPriority(array('value' => $this->fields['priority'], 'withmajor' => 1));
     echo "</td>";
     echo "<td>" . __('As child of') . "</td>";
     echo "<td>";
     $this->dropdown(array('entity' => $this->fields['entities_id'], 'value' => $this->fields['projects_id'], 'used' => array($this->fields['id'])));
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . _x('item', 'State') . "</td>";
     echo "<td>";
     ProjectState::dropdown(array('value' => $this->fields["projectstates_id"]));
     echo "</td>";
     echo "<td>" . __('Percent done') . "</td>";
     echo "<td>";
     Dropdown::showNumber("percent_done", array('value' => $this->fields['percent_done'], 'min' => 0, 'max' => 100, 'step' => 5, 'unit' => '%'));
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Type') . "</td>";
     echo "<td>";
     ProjectType::dropdown(array('value' => $this->fields["projecttypes_id"]));
     echo "</td>";
     echo "<td>" . __('Show on global GANTT') . "</td>";
     echo "<td>";
     Dropdown::showYesNo("show_on_global_gantt", $this->fields["show_on_global_gantt"]);
     echo "</td>";
     echo "</tr>";
     echo "<tr><td colspan='4' class='subheader'>" . __('Manager') . "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('User') . "</td>";
     echo "<td>";
     User::dropdown(array('name' => 'users_id', 'value' => $this->fields["users_id"], 'right' => 'see_project', 'entity' => $this->fields["entities_id"]));
     echo "</td>";
     echo "<td>" . __('Group') . "</td>";
     echo "<td>";
     Group::dropdown(array('name' => 'groups_id', 'value' => $this->fields['groups_id'], 'entity' => $this->fields['entities_id'], 'condition' => '`is_manager`'));
     echo "</td></tr>\n";
     echo "<tr><td colspan='4' class='subheader'>" . __('Planning') . "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Planned start date') . "</td>";
     echo "<td>";
     Html::showDateTimeField("plan_start_date", array('value' => $this->fields['plan_start_date']));
     echo "</td>";
     echo "<td>" . __('Real start date') . "</td>";
     echo "<td>";
     Html::showDateTimeField("real_start_date", array('value' => $this->fields['real_start_date']));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Planned end date') . "</td>";
     echo "<td>";
     Html::showDateTimeField("plan_end_date", array('value' => $this->fields['plan_end_date']));
     echo "</td>";
     echo "<td>" . __('Real end date') . "</td>";
     echo "<td>";
     Html::showDateTimeField("real_end_date", array('value' => $this->fields['real_end_date']));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Planned duration');
     echo Html::showTooltip(__('Sum of planned durations of tasks'));
     echo "</td>";
     echo "<td>";
     echo Html::timestampToString(ProjectTask::getTotalPlannedDurationForProject($this->fields['id']), false);
     echo "</td>";
     echo "<td>" . __('Effective duration');
     echo Html::showTooltip(__('Sum of total effective durations of tasks'));
     echo "</td>";
     echo "<td>";
     echo Html::timestampToString(ProjectTask::getTotalEffectiveDurationForProject($this->fields['id']), false);
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Description') . "</td>";
     echo "<td colspan='3'>";
     echo "<textarea id='content' name='content' cols='90' rows='6'>" . $this->fields["content"] . "</textarea>";
     echo "</td>";
     echo "</tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Comments') . "</td>";
     echo "<td colspan='3'>";
     echo "<textarea id='comment' name='comment' cols='90' rows='6'>" . $this->fields["comment"] . "</textarea>";
     echo "</td>";
     echo "</tr>\n";
     $this->showFormButtons($options);
     return true;
 }
예제 #13
0
 /**
  * Print the Software form
  *
  * @param $ID        integer  ID of the item
  * @param $options   array    of possible options:
  *     - target filename : where to go when done.
  *     - withtemplate boolean : template or basic item
  *
  *@return boolean item found
  **/
 function showForm($ID, $options = array())
 {
     $this->initForm($ID, $options);
     $this->showFormHeader($options);
     $canedit = $this->canEdit($ID);
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Name') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "name");
     echo "</td>";
     echo "<td>" . __('Publisher') . "</td><td>";
     Manufacturer::dropdown(array('value' => $this->fields["manufacturers_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Location') . "</td><td>";
     Location::dropdown(array('value' => $this->fields["locations_id"], 'entity' => $this->fields["entities_id"]));
     echo "</td>";
     echo "<td>" . __('Category') . "</td><td>";
     SoftwareCategory::dropdown(array('value' => $this->fields["softwarecategories_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Technician in charge of the hardware') . "</td><td>";
     User::dropdown(array('name' => 'users_id_tech', 'value' => $this->fields["users_id_tech"], 'right' => 'own_ticket', 'entity' => $this->fields["entities_id"]));
     echo "</td>";
     echo "<td>" . __('Associable to a ticket') . "</td><td>";
     Dropdown::showYesNo('is_helpdesk_visible', $this->fields['is_helpdesk_visible']);
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Group in charge of the hardware') . "</td>";
     echo "<td>";
     Group::dropdown(array('name' => 'groups_id_tech', 'value' => $this->fields['groups_id_tech'], 'entity' => $this->fields['entities_id'], 'condition' => '`is_assign`'));
     echo "</td>";
     echo "<td rowspan='4' class='middle'>" . __('Comments') . "</td>";
     echo "<td class='center middle' rowspan='4'>";
     echo "<textarea cols='45' rows='8' name='comment' >" . $this->fields["comment"] . "</textarea>";
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td >" . __('User') . "</td>";
     echo "<td >";
     User::dropdown(array('value' => $this->fields["users_id"], 'entity' => $this->fields["entities_id"], 'right' => 'all'));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Group') . "</td><td>";
     Group::dropdown(array('value' => $this->fields["groups_id"], 'entity' => $this->fields["entities_id"], 'condition' => '`is_itemgroup`'));
     echo "</td></tr>\n";
     // UPDATE
     echo "<tr class='tab_bg_1'>";
     //TRANS: a noun, (ex : this software is an upgrade of..)
     echo "<td>" . __('Upgrade') . "</td><td>";
     Dropdown::showYesNo("is_update", $this->fields['is_update']);
     echo "&nbsp;" . __('from') . "&nbsp;";
     Software::dropdown(array('value' => $this->fields["softwares_id"]));
     echo "</td></tr>\n";
     $this->showFormButtons($options);
     return true;
 }
예제 #14
0
 /**
  * @see CommonDBTM::showSpecificMassiveActionsParameters()
  **/
 function showSpecificMassiveActionsParameters($input = array())
 {
     switch ($input['action']) {
         case "add_user_group":
         case "add_supervisor_group":
         case "add_delegatee_group":
             if ($input['itemtype'] == 'User') {
                 Group::dropdown(array('condition' => '`is_usergroup`'));
                 echo "<br><br><input type='submit' name='massiveaction' class='submit' value='" . _sx('button', 'Add') . "'>";
                 return true;
             }
             if ($input['itemtype'] == 'Group') {
                 User::dropdown(array('right' => "all"));
                 echo "<br><br><input type='submit' name='massiveaction' class='submit' value='" . _sx('button', 'Add') . "'>";
                 return true;
             }
             break;
         default:
             return parent::showSpecificMassiveActionsParameters($input);
     }
     return false;
 }
예제 #15
0
 Uninstall plugin is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with uninstall. If not, see <http://www.gnu.org/licenses/>.
 --------------------------------------------------------------------------
 @package   uninstall
 @author    the uninstall plugin team
 @copyright Copyright (c) 2010-2013 Uninstall plugin team
 @license   GPLv2+
            http://www.gnu.org/licenses/gpl.txt
 @link      https://forge.indepnet.net/projects/uninstall
 @link      http://www.glpi-project.org/
 @since     2009
 ---------------------------------------------------------------------- */
include '../../../inc/includes.php';
header("Content-Type: text/html; charset=UTF-8");
Html::header_nocache();
if (Session::haveRight(PluginUninstallProfile::$rightname, READ)) {
    switch ($_POST["id"]) {
        case 'old':
            echo "<input type='hidden' name='groups_id' value='-1'>";
            echo Dropdown::EMPTY_VALUE;
            break;
        case 'set':
            Group::dropdown(array('value' => $_POST["groups_id"], 'entity' => $_POST["entities_id"], 'entity_sons' => $_POST["entity_sons"], 'emptylabel' => __('None')));
            break;
    }
}
예제 #16
0
    /** form for Task
     *
     * @param $ID        Integer : Id of the task
     * @param $options   array
     *     -  parent Object : the object
     **/
    function showForm($ID, $options = array())
    {
        global $DB, $CFG_GLPI;
        $rand_template = mt_rand();
        $rand_text = mt_rand();
        $rand_type = mt_rand();
        $rand_time = mt_rand();
        if (isset($options['parent']) && !empty($options['parent'])) {
            $item = $options['parent'];
        }
        $fkfield = $item->getForeignKeyField();
        if ($ID > 0) {
            $this->check($ID, READ);
        } else {
            // Create item
            $options[$fkfield] = $item->getField('id');
            $this->check(-1, CREATE, $options);
        }
        $rand = mt_rand();
        $this->showFormHeader($options);
        $canplan = !$item->isStatusExists(CommonITILObject::PLANNED) || $item->isAllowedStatus($item->fields['status'], CommonITILObject::PLANNED);
        $rowspan = 5;
        if ($this->maybePrivate()) {
            $rowspan++;
        }
        if (isset($this->fields["state"])) {
            $rowspan++;
        }
        echo "<tr class='tab_bg_1'>";
        echo "<td rowspan='{$rowspan}' style='width:100px'>" . __('Description') . "</td>";
        echo "<td rowspan='{$rowspan}' style='width:50%' id='content{$rand_text}'>" . "<textarea name='content' style='width: 95%; height: 160px' id='task{$rand_text}'>" . $this->fields["content"] . "</textarea>";
        echo Html::scriptBlock("\$(document).ready(function() { \$('#content{$rand}').autogrow(); });");
        echo "</td>";
        echo "<input type='hidden' name='{$fkfield}' value='" . $this->fields[$fkfield] . "'>";
        echo "</td></tr>\n";
        echo "<tr class='tab_bg_1'>";
        echo "<td style='width:100px'>" . _n('Task template', 'Task templates', 1) . "</td><td>";
        TaskTemplate::dropdown(array('value' => 0, 'entity' => $this->getEntityID(), 'rand' => $rand_template, 'on_change' => 'tasktemplate_update(this.value)'));
        echo "</td>";
        echo "</tr>";
        echo Html::scriptBlock('
         function tasktemplate_update(value) {
            jQuery.ajax({
               url: "' . $CFG_GLPI["root_doc"] . '/ajax/task.php",
               type: "POST",
               data: {
                  tasktemplates_id: value
               }
            }).done(function(datas) {
               datas.taskcategories_id = isNaN(parseInt(datas.taskcategories_id)) ? 0 : parseInt(datas.taskcategories_id);
               datas.actiontime = isNaN(parseInt(datas.actiontime)) ? 0 : parseInt(datas.actiontime);

               $("#task' . $rand_text . '").html(datas.content);
               $("#dropdown_taskcategories_id' . $rand_type . '").select2("val", parseInt(datas.taskcategories_id));
               $("#dropdown_actiontime' . $rand_time . '").select2("val", parseInt(datas.actiontime));
            });
         }
      ');
        if ($ID > 0) {
            echo "<tr class='tab_bg_1'>";
            echo "<td>" . __('Date') . "</td>";
            echo "<td>";
            Html::showDateTimeField("date", array('value' => $this->fields["date"], 'timestep' => 1, 'maybeempty' => false));
            echo "</tr>";
        } else {
            echo "<tr class='tab_bg_1'>";
            echo "<td colspan='2'>&nbsp;";
            echo "</tr>";
        }
        echo "<tr class='tab_bg_1'>";
        echo "<td>" . __('Category') . "</td><td>";
        TaskCategory::dropdown(array('value' => $this->fields["taskcategories_id"], 'rand' => $rand_type, 'entity' => $item->fields["entities_id"], 'condition' => "`is_active` = '1'"));
        echo "</td></tr>\n";
        if (isset($this->fields["state"])) {
            echo "<tr class='tab_bg_1'>";
            echo "<td>" . __('Status') . "</td><td>";
            Planning::dropdownState("state", $this->fields["state"]);
            echo "</td></tr>\n";
        }
        if ($this->maybePrivate()) {
            echo "<tr class='tab_bg_1'>";
            echo "<td>" . __('Private') . "</td>";
            echo "<td>";
            Dropdown::showYesNo('is_private', $this->fields["is_private"]);
            echo "</td>";
            echo "</tr>";
        }
        echo "<tr class='tab_bg_1'>";
        echo "<td>" . __('Duration') . "</td><td>";
        $toadd = array();
        for ($i = 9; $i <= 100; $i++) {
            $toadd[] = $i * HOUR_TIMESTAMP;
        }
        Dropdown::showTimeStamp("actiontime", array('min' => 0, 'max' => 8 * HOUR_TIMESTAMP, 'value' => $this->fields["actiontime"], 'rand' => $rand_time, 'addfirstminutes' => true, 'inhours' => true, 'toadd' => $toadd));
        echo "</td></tr>\n";
        if ($ID <= 0) {
            Document_Item::showSimpleAddForItem($item);
        }
        echo "<tr class='tab_bg_1'>";
        echo "<td>" . __('By') . "</td>";
        echo "<td colspan='2'>";
        echo Html::image($CFG_GLPI['root_doc'] . "/pics/user.png") . "&nbsp;";
        echo _n('User', 'Users', 1);
        $rand_user = mt_rand();
        $params = array('name' => "users_id_tech", 'value' => $ID > -1 ? $this->fields["users_id_tech"] : Session::getLoginUserID(), 'right' => "own_ticket", 'rand' => $rand_user, 'entity' => $item->fields["entities_id"], 'width' => '');
        $params['toupdate'] = array('value_fieldname' => 'users_id', 'to_update' => "user_available{$rand_user}", 'url' => $CFG_GLPI["root_doc"] . "/ajax/planningcheck.php");
        User::dropdown($params);
        echo " <a href='#' onClick=\"" . Html::jsGetElementbyID('planningcheck' . $rand) . ".dialog('open');\">";
        echo "&nbsp;<img src='" . $CFG_GLPI["root_doc"] . "/pics/reservation-3.png'\n             title=\"" . __s('Availability') . "\" alt=\"" . __s('Availability') . "\"\n             class='calendrier'>";
        echo "</a>";
        Ajax::createIframeModalWindow('planningcheck' . $rand, $CFG_GLPI["root_doc"] . "/front/planning.php?checkavailability=checkavailability" . "&itemtype=" . $item->getType() . "&{$fkfield}=" . $item->getID(), array('title' => __('Availability')));
        echo "<br />";
        echo Html::image($CFG_GLPI['root_doc'] . "/pics/group.png") . "&nbsp;";
        echo _n('Group', 'Groups', 1) . "&nbsp;";
        $rand_group = mt_rand();
        $params = array('name' => "groups_id_tech", 'value' => $ID > -1 ? $this->fields["groups_id_tech"] : Dropdown::EMPTY_VALUE, 'condition' => "is_task", 'rand' => $rand_group, 'entity' => $item->fields["entities_id"]);
        $params['toupdate'] = array('value_fieldname' => 'users_id', 'to_update' => "group_available{$rand_group}", 'url' => $CFG_GLPI["root_doc"] . "/ajax/planningcheck.php");
        Group::dropdown($params);
        echo "</td>\n";
        echo "<td>";
        if ($canplan) {
            echo __('Planning');
        }
        if (!empty($this->fields["begin"])) {
            if (Session::haveRight('planning', Planning::READMY)) {
                echo "<script type='text/javascript' >\n";
                echo "function showPlan" . $ID . $rand_text . "() {\n";
                echo Html::jsHide("plan{$rand_text}");
                $params = array('action' => 'add_event_classic_form', 'form' => 'followups', 'users_id' => $this->fields["users_id_tech"], 'groups_id' => $this->fields["groups_id_tech"], 'id' => $this->fields["id"], 'begin' => $this->fields["begin"], 'end' => $this->fields["end"], 'rand_user' => $rand_user, 'rand_group' => $rand_group, 'entity' => $item->fields["entities_id"], 'itemtype' => $this->getType(), 'items_id' => $this->getID());
                Ajax::updateItemJsCode("viewplan{$rand_text}", $CFG_GLPI["root_doc"] . "/ajax/planning.php", $params);
                echo "}";
                echo "</script>\n";
                echo "<div id='plan{$rand_text}' onClick='showPlan" . $ID . $rand_text . "()'>\n";
                echo "<span class='showplan'>";
            }
            if (isset($this->fields["state"])) {
                echo Planning::getState($this->fields["state"]) . "<br>";
            }
            printf(__('From %1$s to %2$s'), Html::convDateTime($this->fields["begin"]), Html::convDateTime($this->fields["end"]));
            if (isset($this->fields["users_id_tech"]) && $this->fields["users_id_tech"] > 0) {
                echo "<br>" . getUserName($this->fields["users_id_tech"]);
            }
            if (isset($this->fields["groups_id_tech"]) && $this->fields["groups_id_tech"] > 0) {
                echo "<br>" . Dropdown::getDropdownName('glpi_groups', $this->fields["groups_id_tech"]);
            }
            if (Session::haveRight('planning', Planning::READMY)) {
                echo "</span>";
                echo "</div>\n";
                echo "<div id='viewplan{$rand_text}'></div>\n";
            }
        } else {
            if ($canplan) {
                echo "<script type='text/javascript' >\n";
                echo "function showPlanUpdate{$rand_text}() {\n";
                echo Html::jsHide("plan{$rand_text}");
                $params = array('action' => 'add_event_classic_form', 'form' => 'followups', 'entity' => $item->fields['entities_id'], 'rand_user' => $rand_user, 'rand_group' => $rand_group, 'itemtype' => $this->getType(), 'items_id' => $this->getID());
                Ajax::updateItemJsCode("viewplan{$rand_text}", $CFG_GLPI["root_doc"] . "/ajax/planning.php", $params);
                echo "};";
                echo "</script>";
                if ($canplan) {
                    echo "<div id='plan{$rand_text}'  onClick='showPlanUpdate{$rand_text}()'>\n";
                    echo "<span class='vsubmit'>" . __('Plan this task') . "</span>";
                    echo "</div>\n";
                    echo "<div id='viewplan{$rand_text}'></div>\n";
                }
            } else {
                _e('None');
            }
        }
        echo "</td></tr>";
        if (!empty($this->fields["begin"]) && PlanningRecall::isAvailable()) {
            echo "<tr class='tab_bg_1'><td>" . _x('Planning', 'Reminder') . "</td><td class='center'>";
            PlanningRecall::dropdown(array('itemtype' => $this->getType(), 'items_id' => $this->getID()));
            echo "</td><td colspan='2'></td></tr>";
        }
        $this->showFormButtons($options);
        return true;
    }
 /**  Show groups of a user
  *
  * @param $user   User object
  **/
 static function showForUser(User $user)
 {
     global $CFG_GLPI;
     $ID = $user->fields['id'];
     if (!Group::canView() || !$user->can($ID, READ)) {
         return false;
     }
     $canedit = $user->can($ID, UPDATE);
     $rand = mt_rand();
     $groups = self::getUserGroups($ID);
     $used = array();
     if (!empty($groups)) {
         foreach ($groups as $data) {
             $used[$data["id"]] = $data["id"];
         }
     }
     if ($canedit) {
         echo "<div class='firstbloc'>";
         echo "<form name='groupuser_form{$rand}' id='groupuser_form{$rand}' method='post'";
         echo " action='" . Toolbox::getItemTypeFormURL('User') . "'>";
         echo "<table class='tab_cadre_fixe'>";
         echo "<tr class='tab_bg_1'><th colspan='6'>" . __('Associate to a group') . "</th></tr>";
         echo "<tr class='tab_bg_2'><td class='center'>";
         echo "<input type='hidden' name='users_id' value='{$ID}'>";
         // All entities "edited user" have access
         $strict_entities = Profile_User::getUserEntities($ID, true);
         // Keep only entities "connected user" have access
         foreach ($strict_entities as $key => $val) {
             if (!Session::haveAccessToEntity($val)) {
                 unset($strict_entities[$key]);
             }
         }
         $nb = countElementsInTableForEntity("glpi_groups", $strict_entities, '`is_usergroup`');
         if ($nb > count($used)) {
             Group::dropdown(array('entity' => $strict_entities, 'used' => $used, 'condition' => '`is_usergroup`'));
             echo "</td><td>" . __('Manager') . "</td><td>";
             Dropdown::showYesNo('is_manager');
             echo "</td><td>" . __('Delegatee') . "</td><td>";
             Dropdown::showYesNo('is_userdelegate');
             echo "</td><td class='tab_bg_2 center'>";
             echo "<input type='submit' name='addgroup' value=\"" . _sx('button', 'Add') . "\"\n                   class='submit'>";
         } else {
             _e('None');
         }
         echo "</td></tr>";
         echo "</table>";
         Html::closeForm();
         echo "</div>";
     }
     echo "<div class='spaced'>";
     if ($canedit && count($used)) {
         $rand = mt_rand();
         Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
         echo "<input type='hidden' name='users_id' value='" . $user->fields['id'] . "'>";
         $massiveactionparams = array('num_displayed' => count($used), 'container' => 'mass' . __CLASS__ . $rand);
         Html::showMassiveActions($massiveactionparams);
     }
     echo "<table class='tab_cadre_fixehov table-striped table-hover'>";
     $header_begin = "<tr>";
     $header_top = '';
     $header_bottom = '';
     $header_end = '';
     if ($canedit && count($used)) {
         $header_begin .= "<th width='10'>";
         $header_top .= Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand);
         $header_bottom .= Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand);
         $header_end .= "</th>";
     }
     $header_end .= "<th>" . Group::getTypeName(1) . "</th>";
     $header_end .= "<th>" . __('Dynamic') . "</th>";
     $header_end .= "<th>" . __('Manager') . "</th>";
     $header_end .= "<th>" . __('Delegatee') . "</th></tr>";
     echo $header_begin . $header_top . $header_end;
     $group = new Group();
     if (!empty($groups)) {
         Session::initNavigateListItems('Group', sprintf(__('%1$s = %2$s'), User::getTypeName(1), $user->getName()));
         foreach ($groups as $data) {
             if (!$group->getFromDB($data["id"])) {
                 continue;
             }
             Session::addToNavigateListItems('Group', $data["id"]);
             echo "<tr class='tab_bg_1'>";
             if ($canedit && count($used)) {
                 echo "<td width='10'>";
                 Html::showMassiveActionCheckBox(__CLASS__, $data["linkID"]);
                 echo "</td>";
             }
             $link = $data["completename"];
             if ($_SESSION["glpiis_ids_visible"]) {
                 $link = sprintf(__('%1$s (%2$s)'), $link, $data["id"]);
             }
             $href = "<a href='" . $CFG_GLPI["root_doc"] . "/front/group.form.php?id=" . $data["id"] . "'>" . $link . "</a>";
             if ($data["is_dynamic"]) {
                 $href = sprintf(__('%1$s (%2$s)'), $href, "<span class='b'>" . __('D') . "</span>");
             }
             echo "<td>" . $group->getLink() . "</td>";
             echo "<td class='center'>";
             if ($data['is_dynamic']) {
                 echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/ok.png' width='14' height='14' alt=\"" . __('Dynamic') . "\">";
             }
             echo "<td class='center'>";
             if ($data['is_manager']) {
                 echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/ok.png' width='14' height='14' alt=\"" . __('Manager') . "\">";
             }
             echo "</td><td class='center'>";
             if ($data['is_userdelegate']) {
                 echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/ok.png' width='14' height='14' alt=\"" . __('Delegatee') . "\">";
             }
             echo "</td></tr>";
         }
         echo $header_begin . $header_bottom . $header_end;
     } else {
         echo "<tr class='tab_bg_1'>";
         echo "<td colspan='5' class='center'>" . __('None') . "</td></tr>";
     }
     echo "</table>";
     if ($canedit && count($used)) {
         $massiveactionparams['ontop'] = false;
         Html::showMassiveActions($massiveactionparams);
         Html::closeForm();
     }
     echo "</div>";
 }
예제 #18
0
 /**
  * Display 'Group' part of self::showAddPlanningForm spcified by planning type dropdown.
  * Actually called by ajax/planning.php
  *
  * @since 9.1
  *
  * @return Nothing (display function)
  */
 static function showAddGroupForm($params = array())
 {
     echo __("Group") . " : <br>";
     Group::dropdown(array('entity' => $_SESSION['glpiactive_entity']));
     echo "<br /><br />";
     echo Html::hidden('action', array('value' => 'send_add_group_form'));
     echo Html::submit(_sx('button', 'Add'));
 }
예제 #19
0
 /**
  * Print the printer form
  *
  * @param $ID        integer ID of the item
  * @param $options   array of possible options:
  *     - target filename : where to go when done.
  *     - withtemplate boolean : template or basic item
  *
  *@return boolean item found
  **/
 function showForm($ID, $options = array())
 {
     global $CFG_GLPI;
     $target = $this->getFormURL();
     $withtemplate = $this->initForm($ID, $options);
     $this->showFormHeader($options);
     echo "<tr class='tab_bg_1'>";
     //TRANS: %1$s is a string, %2$s a second one without spaces between them : to change for RTL
     echo "<td>" . sprintf(__('%1$s%2$s'), __('Name'), isset($options['withtemplate']) && $options['withtemplate'] ? "*" : "") . "</td>\n";
     echo "<td>";
     $objectName = autoName($this->fields["name"], "name", isset($options['withtemplate']) && $options['withtemplate'] == 2, $this->getType(), $this->fields["entities_id"]);
     Html::autocompletionTextField($this, 'name', array('value' => $objectName));
     echo "</td>\n";
     echo "<td>" . __('Status') . "</td>\n";
     echo "<td>";
     State::dropdown(array('value' => $this->fields["states_id"], 'entity' => $this->fields["entities_id"], 'condition' => "`is_visible_printer`"));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Location') . "</td>\n";
     echo "<td>";
     Location::dropdown(array('value' => $this->fields["locations_id"], 'entity' => $this->fields["entities_id"]));
     echo "</td>\n";
     echo "<td>" . __('Type') . "</td>\n";
     echo "<td>";
     PrinterType::dropdown(array('value' => $this->fields["printertypes_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Technician in charge of the hardware') . "</td>\n";
     echo "<td>";
     User::dropdown(array('name' => 'users_id_tech', 'value' => $this->fields["users_id_tech"], 'right' => 'own_ticket', 'entity' => $this->fields["entities_id"]));
     echo "</td>\n";
     echo "<td>" . __('Manufacturer') . "</td>\n";
     echo "<td>";
     Manufacturer::dropdown(array('value' => $this->fields["manufacturers_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Group in charge of the hardware') . "</td>";
     echo "<td>";
     Group::dropdown(array('name' => 'groups_id_tech', 'value' => $this->fields['groups_id_tech'], 'entity' => $this->fields['entities_id'], 'condition' => '`is_assign`'));
     echo "</td>";
     echo "<td>" . __('Model') . "</td>\n";
     echo "<td>";
     PrinterModel::dropdown(array('value' => $this->fields["printermodels_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Alternate username number') . "</td>\n";
     echo "<td>";
     Html::autocompletionTextField($this, "contact_num");
     echo "</td>\n";
     echo "<td>" . __('Serial number') . "</td>\n";
     echo "<td>";
     Html::autocompletionTextField($this, "serial");
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Alternate username') . "</td>\n";
     echo "<td>";
     Html::autocompletionTextField($this, "contact");
     echo "</td>\n";
     echo "<td>" . sprintf(__('%1$s%2$s'), __('Inventory number'), isset($options['withtemplate']) && $options['withtemplate'] ? "*" : "") . "</td>\n";
     echo "<td>";
     $objectName = autoName($this->fields["otherserial"], "otherserial", isset($options['withtemplate']) && $options['withtemplate'] == 2, $this->getType(), $this->fields["entities_id"]);
     Html::autocompletionTextField($this, 'otherserial', array('value' => $objectName));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('User') . "</td>\n";
     echo "<td>";
     User::dropdown(array('value' => $this->fields["users_id"], 'entity' => $this->fields["entities_id"], 'right' => 'all'));
     echo "</td>\n";
     echo "<td>" . __('Management type') . "</td>";
     echo "<td>";
     $globalitem = array();
     $globalitem['withtemplate'] = $withtemplate;
     $globalitem['value'] = $this->fields["is_global"];
     $globalitem['target'] = $target;
     if ($this->can($ID, UPDATE)) {
         $globalitem['management_restrict'] = $CFG_GLPI["printers_management_restrict"];
     }
     Dropdown::showGlobalSwitch($this->fields["id"], $globalitem);
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Group') . "</td>\n";
     echo "<td>";
     Group::dropdown(array('value' => $this->fields["groups_id"], 'entity' => $this->fields["entities_id"], 'condition' => '`is_itemgroup`'));
     echo "</td>\n";
     echo "<td>" . __('Network') . "</td>\n";
     echo "<td>";
     Network::dropdown(array('value' => $this->fields["networks_id"]));
     echo "</td></tr>\n";
     // Display auto inventory informations
     $rowspan = 6;
     $inventory_show = false;
     if (!empty($ID) && $this->fields["is_dynamic"]) {
         $inventory_show = true;
         $rowspan -= 2;
     }
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Domain') . "</td>\n";
     echo "<td>";
     Domain::dropdown(array('value' => $this->fields["domains_id"], 'entity' => $this->fields["entities_id"]));
     echo "</td>";
     echo "<td rowspan='{$rowspan}'>" . __('Comments') . "</td>\n";
     echo "<td rowspan='{$rowspan}'>";
     echo "<textarea cols='45' rows='" . ($rowspan + 3) . "' name='comment' >" . $this->fields["comment"];
     echo "</textarea></td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Memory') . "</td>\n";
     echo "<td>";
     Html::autocompletionTextField($this, "memory_size");
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Initial page counter') . "</td>\n";
     echo "<td>";
     Html::autocompletionTextField($this, "init_pages_counter", array('size' => 10));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Current counter of pages') . "</td>\n";
     echo "<td>";
     Html::autocompletionTextField($this, "last_pages_counter", array('size' => 10));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . _n('Port', 'Ports', Session::getPluralNumber()) . "</td>";
     echo "<td>\n<table>";
     // serial interface
     echo "<tr><td>" . __('Serial') . "</td><td width='80'>";
     Dropdown::showYesNo("have_serial", $this->fields["have_serial"]);
     echo "</td>";
     // parallel interface?
     echo "<td>" . __('Parallel') . "</td><td width='80'>";
     Dropdown::showYesNo("have_parallel", $this->fields["have_parallel"]);
     echo "</td></tr>";
     // USB interface?
     echo "<tr><td>" . __('USB') . "</td><td>";
     Dropdown::showYesNo("have_usb", $this->fields["have_usb"]);
     echo "</td>";
     // ethernet interface?
     echo "<td>" . __('Ethernet') . "</td><td>";
     Dropdown::showYesNo("have_ethernet", $this->fields["have_ethernet"]);
     echo "</td></tr>";
     // wifi ?
     echo "<tr><td>" . __('Wifi') . "</td><td colspan='3'>";
     Dropdown::showYesNo("have_wifi", $this->fields["have_wifi"]);
     echo "</td></tr></table>\n";
     echo "</td>";
     if ($inventory_show) {
         echo "<td rowspan='2'>" . __('Automatic inventory') . "</td>";
         echo "<td rowspan='2'>";
         Plugin::doHook("autoinventory_information", $this);
         echo "</td>";
     }
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>";
     if ((!isset($options['withtemplate']) || $options['withtemplate'] == 0) && !empty($this->fields['template_name'])) {
         echo "<span class='small_space'>";
         printf(__('Created from the template %s'), $this->fields['template_name']);
         echo "</span>";
     } else {
         echo "&nbsp;";
     }
     echo "</td><td>";
     if (isset($options['withtemplate']) && $options['withtemplate']) {
         //TRANS: %s is the datetime of insertion
         printf(__('Created on %s'), Html::convDateTime($_SESSION["glpi_currenttime"]));
     } else {
         //TRANS: %s is the datetime of insertion
         printf(__('Last update on %s'), Html::convDateTime($this->fields["date_mod"]));
     }
     echo "</td></tr>\n";
     $this->showFormButtons($options);
     return true;
 }
 function showForm($ID, $options = array())
 {
     $this->initForm($ID, $options);
     $this->showFormHeader($options);
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Name') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "name");
     echo "</td>";
     echo "<td>" . __('Technician in charge of the hardware') . "</td>";
     echo "<td>";
     User::dropdown(array('name' => "users_id_tech", 'value' => $this->fields["users_id_tech"], 'entity' => $this->fields["entities_id"], 'right' => 'interface'));
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Type') . "</td><td>";
     Dropdown::show('PluginCertificatesCertificateType', array('name' => "plugin_certificates_certificatetypes_id", 'value' => $this->fields["plugin_certificates_certificatetypes_id"], 'entity' => $this->fields["entities_id"]));
     echo "</td>";
     echo "<td>" . __('Group in charge of the hardware') . "</td>";
     echo "<td>";
     Group::dropdown(array('name' => 'groups_id_tech', 'value' => $this->fields['groups_id_tech'], 'entity' => $this->fields['entities_id'], 'condition' => '`is_assign`'));
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Location') . "</td>";
     echo "<td>";
     Location::dropdown(array('value' => $this->fields["locations_id"], 'entity' => $this->fields["entities_id"]));
     echo "</td>";
     echo "<td>" . _n('Manufacturer', 'Manufacturers', 1) . " (" . __('Root CA', 'certificates') . ")</td>";
     echo "<td>";
     Manufacturer::dropdown(array('value' => $this->fields["manufacturers_id"]));
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('DNS name', 'certificates') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "dns_name");
     echo "</td>";
     echo "<td>" . __('Creation date') . "</td>";
     echo "<td>";
     Html::showDateFormItem("date_query", $this->fields["date_query"], true, true);
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('DNS suffix', 'certificates') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "dns_suffix");
     echo "</td>";
     echo "<td>" . __('Expiration date');
     echo "&nbsp;";
     Html::showToolTip(nl2br(__('Empty for infinite', 'certificates')));
     echo "&nbsp;</td>";
     echo "<td>";
     Html::showDateFormItem("date_expiration", $this->fields["date_expiration"], true, true);
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . PluginCertificatesCertificateState::getTypeName(1) . "</td>";
     echo "<td>";
     Dropdown::show('PluginCertificatesCertificateState', array('name' => "plugin_certificates_certificatestates_id", 'value' => $this->fields["plugin_certificates_certificatestates_id"], 'entity' => $this->fields["entities_id"]));
     echo "</td>";
     echo "<td>" . __('Notification email', 'certificates') . "</td>";
     echo "<td>";
     Dropdown::showYesNo('mailing', $this->fields["mailing"]);
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Self-signed', 'certificates') . "</td>";
     echo "<td>";
     Dropdown::showYesNo('auto_sign', $this->fields["auto_sign"]);
     echo "</td>";
     echo "<td>" . __('Associable to a ticket') . "</td><td>";
     Dropdown::showYesNo('is_helpdesk_visible', $this->fields['is_helpdesk_visible']);
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>";
     echo __('Command used', 'certificates') . "</td><td>";
     echo "<textarea cols='35' rows='4' name='command' >";
     echo $this->fields["command"] . "</textarea>";
     echo "</td>";
     echo "<td>";
     echo __('Certificate request (CSR)', 'certificates') . "</td><td>";
     echo "<textarea cols='35' rows='4' name='certificate_request' >";
     echo $this->fields["certificate_request"] . "</textarea>";
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td class='center' colspan='2'>";
     printf(__('Last update on %s'), Html::convDateTime($this->fields["date_mod"]));
     echo "</td>";
     echo "<td>";
     echo self::getTypeName(1) . "</td><td>";
     echo "<textarea cols='35' rows='4' name='certificate_item' >";
     echo $this->fields["certificate_item"] . "</textarea>";
     echo "</td>";
     echo "</tr>";
     $this->showFormButtons($options);
     return true;
 }
예제 #21
0
 /**
  * Print the monitor form
  *
  * @param $ID        integer  ID of the item
  * @param $options   array
  *     - target filename : where to go when done.
  *     - withtemplate boolean : template or basic item
  *
  * @return boolean item found
  **/
 function showForm($ID, $options = array())
 {
     global $CFG_GLPI;
     $target = $this->getFormURL();
     $withtemplate = $this->initForm($ID, $options);
     $this->showFormHeader($options);
     echo "<tr class='tab_bg_1'>";
     //TRANS: %1$s is a string, %2$s a second one without spaces between them : to change for RTL
     echo "<td>" . sprintf(__('%1$s%2$s'), __('Name'), isset($options['withtemplate']) && $options['withtemplate'] ? "*" : "");
     echo "</td>";
     echo "<td>";
     $objectName = autoName($this->fields["name"], "name", isset($options['withtemplate']) && $options['withtemplate'] == 2, $this->getType(), $this->fields["entities_id"]);
     Html::autocompletionTextField($this, "name", array('value' => $objectName));
     echo "</td>";
     echo "<td>" . __('Status') . "</td>";
     echo "<td>";
     State::dropdown(array('value' => $this->fields["states_id"], 'entity' => $this->fields["entities_id"], 'condition' => "`is_visible_monitor`"));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Location') . "</td>";
     echo "<td>";
     Location::dropdown(array('value' => $this->fields["locations_id"], 'entity' => $this->fields["entities_id"]));
     echo "</td>";
     echo "<td>" . __('Type') . "</td>";
     echo "<td>";
     MonitorType::dropdown(array('value' => $this->fields["monitortypes_id"]));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Technician in charge of the hardware') . "</td>";
     echo "<td>";
     User::dropdown(array('name' => 'users_id_tech', 'value' => $this->fields["users_id_tech"], 'right' => 'own_ticket', 'entity' => $this->fields["entities_id"]));
     echo "</td>";
     echo "<td>" . __('Manufacturer') . "</td>";
     echo "<td>";
     Manufacturer::dropdown(array('value' => $this->fields["manufacturers_id"]));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Group in charge of the hardware') . "</td>";
     echo "<td>";
     Group::dropdown(array('name' => 'groups_id_tech', 'value' => $this->fields['groups_id_tech'], 'entity' => $this->fields['entities_id'], 'condition' => '`is_assign`'));
     echo "</td>";
     echo "<td>" . __('Model') . "</td>";
     echo "<td>";
     MonitorModel::dropdown(array('value' => $this->fields["monitormodels_id"]));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Alternate username number') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "contact_num");
     echo "</td>";
     echo "<td>" . __('Serial number') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "serial");
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Alternate username') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "contact");
     echo "</td>";
     echo "<td>" . sprintf(__('%1$s%2$s'), __('Inventory number'), isset($options['withtemplate']) && $options['withtemplate'] ? "*" : "") . "</td>";
     echo "<td>";
     $objectName = autoName($this->fields["otherserial"], "otherserial", isset($options['withtemplate']) && $options['withtemplate'] == 2, $this->getType(), $this->fields["entities_id"]);
     Html::autocompletionTextField($this, "otherserial", array('value' => $objectName));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('User') . "</td>";
     echo "<td>";
     User::dropdown(array('value' => $this->fields["users_id"], 'entity' => $this->fields["entities_id"], 'right' => 'all'));
     echo "</td>";
     echo "<td>" . __('Management type') . "</td>";
     echo "<td>";
     Dropdown::showGlobalSwitch($this->fields["id"], array('withtemplate' => $withtemplate, 'value' => $this->fields["is_global"], 'management_restrict' => $CFG_GLPI["monitors_management_restrict"], 'target' => $target));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Group') . "</td>";
     echo "<td>";
     Group::dropdown(array('value' => $this->fields["groups_id"], 'entity' => $this->fields["entities_id"], 'condition' => '`is_itemgroup`'));
     echo "</td>";
     echo "<td rowspan='4'>" . __('Comments') . "</td>";
     echo "<td rowspan='4'>\n            <textarea cols='45' rows='10' name='comment' >" . $this->fields["comment"] . "</textarea>";
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Size') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "size");
     echo "\"</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . 'Flags' . "</td>";
     echo "<td><table>";
     // micro?
     echo "<tr><td width='20%'>" . __('Microphone') . "</td><td width='30%'>";
     Dropdown::showYesNo("have_micro", $this->fields["have_micro"]);
     // speakers?
     echo "</td><td width='20%'>" . __('Speakers') . "</td><td width='30%'>";
     Dropdown::showYesNo("have_speaker", $this->fields["have_speaker"]);
     echo "</td></tr>";
     // sub-d?
     echo "<tr><td width='20%'>" . __('Sub-D') . "</td><td width='30%'>";
     Dropdown::showYesNo("have_subd", $this->fields["have_subd"]);
     // bnc?
     echo "</td><td width='20%'>" . __('BNC') . "</td><td width='30%'>";
     Dropdown::showYesNo("have_bnc", $this->fields["have_bnc"]);
     echo "</td></tr>";
     // dvi?
     echo "<tr><td>" . __('DVI') . "</td><td>";
     Dropdown::showYesNo("have_dvi", $this->fields["have_dvi"]);
     // pivot ?
     echo "</td><td>" . __('Pivot') . "</td><td>";
     Dropdown::showYesNo("have_pivot", $this->fields["have_pivot"]);
     echo "</td></tr>";
     // hdmi?
     echo "<tr><td>" . __('HDMI') . "</td><td>";
     Dropdown::showYesNo("have_hdmi", $this->fields["have_hdmi"]);
     //Displayport
     echo "</td><td>" . __('DisplayPort') . "</td><td>";
     Dropdown::showYesNo("have_displayport", $this->fields["have_displayport"]);
     echo "</td></tr>";
     echo "</table></td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>";
     if ((!isset($options['withtemplate']) || $options['withtemplate'] == 0) && !empty($this->fields['template_name'])) {
         echo "<span class='small_space'>";
         printf(__('Created from the template %s'), $this->fields['template_name']);
         echo "</span>";
     } else {
         echo "&nbsp;";
     }
     echo "</td><td>";
     if (isset($options['withtemplate']) && $options['withtemplate']) {
         //TRANS: %s is the datetime of insertion
         printf(__('Created on %s'), Html::convDateTime($_SESSION["glpi_currenttime"]));
     } else {
         //TRANS: %s is the datetime of insertion
         printf(__('Last update on %s'), Html::convDateTime($this->fields["date_mod"]));
     }
     echo "</td></tr>\n";
     $this->showFormButtons($options);
     return true;
 }
예제 #22
0
    header("Content-Type: text/html; charset=UTF-8");
    Html::header_nocache();
}
Session::checkLoginUser();
if (isset($_POST['type']) && !empty($_POST['type']) && isset($_POST['right'])) {
    $display = false;
    $rand = mt_rand();
    switch ($_POST['type']) {
        case 'User':
            User::dropdown(array('right' => $_POST['right']));
            $display = true;
            break;
        case 'Group':
            $params = array('rand' => $rand);
            $params['toupdate'] = array('value_fieldname' => 'value', 'to_update' => "subvisibility{$rand}", 'url' => $CFG_GLPI["root_doc"] . "/ajax/subvisibility.php", 'moreparams' => array('items_id' => '__VALUE__', 'type' => $_POST['type']));
            Group::dropdown($params);
            echo "<span id='subvisibility{$rand}'></span>";
            $display = true;
            break;
        case 'Entity':
            Entity::dropdown(array('entity' => $_SESSION['glpiactiveentities'], 'value' => $_SESSION['glpiactive_entity']));
            _e('Child entities');
            echo "&nbsp;";
            Dropdown::showYesNo('is_recursive');
            $display = true;
            break;
        case 'Profile':
            $params = array('rand' => $rand, 'condition' => "`" . $_POST['right'] . "` IN ('r','w')");
            $params['toupdate'] = array('value_fieldname' => 'value', 'to_update' => "subvisibility{$rand}", 'url' => $CFG_GLPI["root_doc"] . "/ajax/subvisibility.php", 'moreparams' => array('items_id' => '__VALUE__', 'type' => $_POST['type']));
            Profile::dropdown($params);
            echo "<span id='subvisibility{$rand}'></span>";
예제 #23
0
 /**
  * Print the Software form
  *
  * @param $ID        integer  ID of the item
  * @param $options   array    of possible options:
  *     - target filename : where to go when done.
  *     - withtemplate boolean : template or basic item
  *
  *@return boolean item found
  **/
 function showForm($ID, $options = array())
 {
     $this->initForm($ID, $options);
     $this->showTabs($options);
     $this->showFormHeader($options);
     $canedit = $this->can($ID, 'w');
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Name') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "name");
     echo "</td>";
     echo "<td>" . __('Publisher') . "</td><td>";
     Manufacturer::dropdown(array('value' => $this->fields["manufacturers_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Location') . "</td><td>";
     Location::dropdown(array('value' => $this->fields["locations_id"], 'entity' => $this->fields["entities_id"]));
     echo "</td>";
     echo "<td>" . __('Category') . "</td><td>";
     SoftwareCategory::dropdown(array('value' => $this->fields["softwarecategories_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Technician in charge of the hardware') . "</td><td>";
     User::dropdown(array('name' => 'users_id_tech', 'value' => $this->fields["users_id_tech"], 'right' => 'own_ticket', 'entity' => $this->fields["entities_id"]));
     echo "</td>";
     echo "<td>" . __('Associable to a ticket') . "</td><td>";
     Dropdown::showYesNo('is_helpdesk_visible', $this->fields['is_helpdesk_visible']);
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Group in charge of the hardware') . "</td>";
     echo "<td>";
     Group::dropdown(array('name' => 'groups_id_tech', 'value' => $this->fields['groups_id_tech'], 'entity' => $this->fields['entities_id'], 'condition' => '`is_assign`'));
     echo "</td>";
     echo "<td rowspan='5' class='middle'>" . __('Comments') . "</td>";
     echo "<td class='center middle' rowspan='5'>";
     echo "<textarea cols='45' rows='8' name='comment' >" . $this->fields["comment"] . "</textarea>";
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td >" . __('User') . "</td>";
     echo "<td >";
     User::dropdown(array('value' => $this->fields["users_id"], 'entity' => $this->fields["entities_id"], 'right' => 'all'));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Group') . "</td><td>";
     Group::dropdown(array('value' => $this->fields["groups_id"], 'entity' => $this->fields["entities_id"], 'condition' => '`is_itemgroup`'));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>";
     if ((!isset($options['withtemplate']) || $options['withtemplate'] == 0) && !empty($this->fields['template_name'])) {
         echo "<span class='small_space'>";
         printf(__('Created from the template %s'), $this->fields['template_name']);
         echo "</span>";
     } else {
         echo "&nbsp;";
     }
     echo "</td><td>";
     if (isset($options['withtemplate']) && $options['withtemplate']) {
         //TRANS: %s is the datetime of insertion
         printf(__('Created on %s'), Html::convDateTime($_SESSION["glpi_currenttime"]));
     } else {
         //TRANS: %s is the datetime of insertion
         printf(__('Last update on %s'), Html::convDateTime($this->fields["date_mod"]));
     }
     echo "</td></tr>\n";
     // UPDATE
     echo "<tr class='tab_bg_1'>";
     //TRANS: a noun, (ex : this software is an upgrade of..)
     echo "<td>" . __('Upgrade') . "</td><td>";
     Dropdown::showYesNo("is_update", $this->fields['is_update']);
     echo "&nbsp;" . __('from') . "&nbsp;";
     Software::dropdown(array('value' => $this->fields["softwares_id"]));
     echo "</td></tr>\n";
     $this->showFormButtons($options);
     $this->addDivForTabs();
     return true;
 }
$AJAX_INCLUDE = 1;
include '../inc/includes.php';
header("Content-Type: text/html; charset=UTF-8");
Html::header_nocache();
if (isset($_POST["validatortype"])) {
    switch ($_POST["validatortype"]) {
        case 'user':
            echo "<input type='hidden' name='groups_id' value=0 />";
            User::dropdown(array('name' => 'users_id_validate', 'entity' => $_SESSION["glpiactive_entity"], 'right' => array('validate_request', 'validate_incident')));
            echo "<br><br>" . __('Comments') . " ";
            echo "<textarea name='comment_submission' cols='50' rows='6'></textarea>&nbsp;";
            echo "<input type='submit' name='add' value=\"" . _sx('button', 'Add') . "\" class='submit'>";
            break;
        case 'group':
            echo "<input type='hidden' name='users_id_validate' value=0 />";
            $rand = Group::dropdown(array('name' => 'groups_id', 'entity' => $_SESSION["glpiactive_entity"]));
            $param = array('validatortype' => 'group_user', 'groups_id' => '__VALUE__', 'right' => array('validate_request', 'validate_incident'));
            Ajax::updateItemOnSelectEvent("dropdown_groups_id{$rand}", "show_groups_users", $CFG_GLPI["root_doc"] . "/ajax/dropdownMassiveActionAddValidator.php", $param);
            echo "<br><span id='show_groups_users'>&nbsp;</span>\n";
            break;
        case 'group_user':
            $opt = array('groups_id' => $_POST["groups_id"], 'right' => $_POST['right'], 'entity' => $_SESSION["glpiactive_entity"]);
            $groups_users = TicketValidation::getGroupUserHaveRights($opt);
            $users = array();
            $param['values'] = array();
            foreach ($groups_users as $data) {
                $users[$data['id']] = formatUserName($data['id'], $data['name'], $data['realname'], $data['firstname']);
            }
            if (isset($_POST['all_users']) && $_POST['all_users']) {
                $param['values'] = array_keys($users);
            }
예제 #25
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 $CFG_GLPI, $DB;
     $this->initForm($ID, $options);
     $this->showFormHeader($options);
     echo "<tr class='tab_bg_1'>";
     //TRANS: %1$s is a string, %2$s a second one without spaces between them : to change for RTL
     echo "<td>" . sprintf(__('%1$s%2$s'), __('Name'), isset($options['withtemplate']) && $options['withtemplate'] ? "*" : "") . "</td>";
     echo "<td>";
     $objectName = autoName($this->fields["name"], "name", isset($options['withtemplate']) && $options['withtemplate'] == 2, $this->getType(), $this->fields["entities_id"]);
     Html::autocompletionTextField($this, 'name', array('value' => $objectName));
     echo "</td>";
     echo "<td>" . __('Status') . "</td>";
     echo "<td>";
     State::dropdown(array('value' => $this->fields["states_id"], 'entity' => $this->fields["entities_id"], 'condition' => "`is_visible_computer`"));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Location') . "</td>";
     echo "<td>";
     Location::dropdown(array('value' => $this->fields["locations_id"], 'entity' => $this->fields["entities_id"]));
     echo "</td>";
     echo "<td>" . __('Type') . "</td>";
     echo "<td>";
     ComputerType::dropdown(array('value' => $this->fields["computertypes_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Technician in charge of the hardware') . "</td>";
     echo "<td>";
     User::dropdown(array('name' => 'users_id_tech', 'value' => $this->fields["users_id_tech"], 'right' => 'own_ticket', 'entity' => $this->fields["entities_id"]));
     echo "</td>";
     echo "<td>" . __('Manufacturer') . "</td>";
     echo "<td>";
     Manufacturer::dropdown(array('value' => $this->fields["manufacturers_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Group in charge of the hardware') . "</td>";
     echo "<td>";
     Group::dropdown(array('name' => 'groups_id_tech', 'value' => $this->fields['groups_id_tech'], 'entity' => $this->fields['entities_id'], 'condition' => '`is_assign`'));
     echo "</td>";
     echo "<td>" . __('Model') . "</td>";
     echo "<td>";
     ComputerModel::dropdown(array('value' => $this->fields["computermodels_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     //TRANS: Number of the alternate username
     echo "<td>" . __('Alternate username number') . "</td>";
     echo "<td >";
     Html::autocompletionTextField($this, 'contact_num');
     echo "</td>";
     echo "<td>" . __('Serial number') . "</td>";
     echo "<td >";
     Html::autocompletionTextField($this, 'serial');
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Alternate username') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, 'contact');
     echo "</td>";
     echo "<td>" . sprintf(__('%1$s%2$s'), __('Inventory number'), isset($options['withtemplate']) && $options['withtemplate'] ? "*" : "") . "</td>";
     echo "<td>";
     $objectName = autoName($this->fields["otherserial"], "otherserial", isset($options['withtemplate']) && $options['withtemplate'] == 2, $this->getType(), $this->fields["entities_id"]);
     Html::autocompletionTextField($this, 'otherserial', array('value' => $objectName));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('User') . "</td>";
     echo "<td>";
     User::dropdown(array('value' => $this->fields["users_id"], 'entity' => $this->fields["entities_id"], 'right' => 'all'));
     echo "</td>";
     echo "<td>" . __('Network') . "</td>";
     echo "<td>";
     Network::dropdown(array('value' => $this->fields["networks_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Group') . "</td>";
     echo "<td>";
     Group::dropdown(array('value' => $this->fields["groups_id"], 'entity' => $this->fields["entities_id"], 'condition' => '`is_itemgroup`'));
     echo "</td>";
     // Display auto inventory informations
     $rowspan = 10;
     $inventory_show = false;
     if (!empty($ID) && Plugin::haveImport() && $this->fields["is_dynamic"]) {
         $inventory_show = true;
         $rowspan -= 4;
     }
     echo "<td rowspan='{$rowspan}'>" . __('Comments') . "</td>";
     echo "<td rowspan='{$rowspan}' class='middle'>";
     echo "<textarea cols='45' rows='" . ($rowspan + 3) . "' name='comment' >" . $this->fields["comment"];
     echo "</textarea></td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Domain') . "</td>";
     echo "<td >";
     Domain::dropdown(array('value' => $this->fields["domains_id"], 'entity' => $this->fields["entities_id"]));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Operating system') . "</td>";
     echo "<td>";
     OperatingSystem::dropdown(array('value' => $this->fields["operatingsystems_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Service pack') . "</td>";
     echo "<td >";
     OperatingSystemServicePack::dropdown(array('value' => $this->fields["operatingsystemservicepacks_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Version of the operating system') . "</td>";
     echo "<td >";
     OperatingSystemVersion::dropdown(array('value' => $this->fields["operatingsystemversions_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Product ID of the operating system') . "</td>";
     echo "<td >";
     Html::autocompletionTextField($this, 'os_licenseid');
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Serial of the operating system') . "</td>";
     echo "<td >";
     Html::autocompletionTextField($this, 'os_license_number');
     echo "</td>";
     if ($inventory_show) {
         echo "<td rowspan='4' colspan='2'>";
         Plugin::doHook("autoinventory_information", $this);
         echo "</td>";
     }
     echo "</tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('UUID') . "</td>";
     echo "<td >";
     Html::autocompletionTextField($this, 'uuid');
     echo "</td>";
     echo "</tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>";
     if ((!isset($options['withtemplate']) || $options['withtemplate'] == 0) && !empty($this->fields['template_name'])) {
         echo "<span class='small_space'>";
         printf(__('Created from the template %s'), $this->fields['template_name']);
         echo "</span>";
     } else {
         echo "&nbsp;";
     }
     echo "</td><td>";
     if (isset($options['withtemplate']) && $options['withtemplate']) {
         //TRANS: %s is the datetime of insertion
         printf(__('Created on %s'), Html::convDateTime($_SESSION["glpi_currenttime"]));
     } else {
         //TRANS: %s is the datetime of update
         printf(__('Last update on %s'), Html::convDateTime($this->fields["date_mod"]));
     }
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Update Source') . "</td>";
     echo "<td >";
     AutoUpdateSystem::dropdown(array('value' => $this->fields["autoupdatesystems_id"]));
     echo "</td></tr>";
     $this->showFormButtons($options);
     return true;
 }
예제 #26
0
 /**
  * @param $options   array
  **/
 function displayActionSelectPattern($options = array())
 {
     $display = false;
     $param['value'] = '';
     if (isset($options['value'])) {
         $param['value'] = $options['value'];
     }
     switch ($options["action_type"]) {
         //If a regex value is used, then always display an autocompletiontextfield
         case "regex_result":
         case "append_regex_result":
             Html::autocompletionTextField($this, "value", $param);
             break;
         case 'fromuser':
         case 'fromitem':
             Dropdown::showYesNo("value", $param['value'], 0);
             $display = true;
             break;
         default:
             $actions = Rule::getActionsByType($options["sub_type"]);
             if (isset($actions[$options["field"]]['type'])) {
                 switch ($actions[$options["field"]]['type']) {
                     case "dropdown":
                         $table = $actions[$options["field"]]['table'];
                         $param['name'] = "value";
                         if (isset($actions[$options["field"]]['condition'])) {
                             $param['condition'] = $actions[$options["field"]]['condition'];
                         }
                         Dropdown::show(getItemTypeForTable($table), $param);
                         $display = true;
                         break;
                     case "dropdown_tickettype":
                         Ticket::dropdownType('value', $param);
                         $display = true;
                         break;
                     case "dropdown_assign":
                         $param['name'] = 'value';
                         $param['right'] = 'own_ticket';
                         User::dropdown($param);
                         $display = true;
                         break;
                     case "dropdown_users":
                         $param['name'] = 'value';
                         $param['right'] = 'all';
                         User::dropdown($param);
                         $display = true;
                         break;
                     case "dropdown_urgency":
                         $param['name'] = 'value';
                         Ticket::dropdownUrgency($param);
                         $display = true;
                         break;
                     case "dropdown_impact":
                         $param['name'] = 'value';
                         Ticket::dropdownImpact($param);
                         $display = true;
                         break;
                     case "dropdown_priority":
                         if ($_POST["action_type"] != 'compute') {
                             $param['name'] = 'value';
                             Ticket::dropdownPriority($param);
                         }
                         $display = true;
                         break;
                     case "dropdown_status":
                         $param['name'] = 'value';
                         Ticket::dropdownStatus($param);
                         $display = true;
                         break;
                     case "yesonly":
                         Dropdown::showYesNo("value", $param['value'], 0);
                         $display = true;
                         break;
                     case "yesno":
                         Dropdown::showYesNo("value", $param['value']);
                         $display = true;
                         break;
                     case "dropdown_management":
                         $param['name'] = 'value';
                         $param['management_restrict'] = 2;
                         $param['withtemplate'] = false;
                         Dropdown::showGlobalSwitch(0, $param);
                         $display = true;
                         break;
                     case "dropdown_users_validate":
                         $used = array();
                         if ($item = getItemForItemtype($options["sub_type"])) {
                             $rule_data = getAllDatasFromTable('glpi_ruleactions', "`action_type` = 'add_validation'\n                                                           AND `field` = 'users_id_validate'\n                                                           AND `" . $item->getRuleIdField() . "`\n                                                            = '" . $options[$item->getRuleIdField()] . "'");
                             foreach ($rule_data as $data) {
                                 $used[] = $data['value'];
                             }
                         }
                         $param['name'] = 'value';
                         $param['right'] = array('validate_incident', 'validate_request');
                         $param['used'] = $used;
                         User::dropdown($param);
                         $display = true;
                         break;
                     case "dropdown_groups_validate":
                         $used = array();
                         if ($item = getItemForItemtype($options["sub_type"])) {
                             $rule_data = getAllDatasFromTable('glpi_ruleactions', "`action_type` = 'add_validation'\n                                                           AND `field` = 'groups_id_validate'\n                                                           AND `" . $item->getRuleIdField() . "`\n                                                            = '" . $options[$item->getRuleIdField()] . "'");
                             foreach ($rule_data as $data) {
                                 $used[] = $data['value'];
                             }
                         }
                         $condition = "(SELECT count(`users_id`)\n                                    FROM `glpi_groups_users`\n                                    WHERE `groups_id` = `glpi_groups`.`id`)";
                         $param['name'] = 'value';
                         $param['condition'] = $condition;
                         $param['right'] = array('validate_incident', 'validate_request');
                         $param['used'] = $used;
                         Group::dropdown($param);
                         $display = true;
                         break;
                     case "dropdown_validation_percent":
                         $ticket = new Ticket();
                         echo $ticket->getValueToSelect('validation_percent', 'value', $param['value']);
                         $display = true;
                         break;
                     default:
                         if ($rule = getItemForItemtype($options["sub_type"])) {
                             $display = $rule->displayAdditionalRuleAction($actions[$options["field"]], $param['value']);
                         }
                         break;
                 }
             }
             if (!$display) {
                 Html::autocompletionTextField($this, "value", $param);
             }
     }
 }
예제 #27
0
 /**
  * Print the Software / license form
  *
  * @param $ID        integer  Id of the version or the template to print
  * @param $options   array    of possible options:
  *     - target form target
  *     - softwares_id ID of the software for add process
  *
  * @return true if displayed  false if item not found or not right to display
  **/
 function showForm($ID, $options = array())
 {
     global $CFG_GLPI;
     $softwares_id = -1;
     if (isset($options['softwares_id'])) {
         $softwares_id = $options['softwares_id'];
     }
     if ($ID < 0) {
         // Create item
         $this->fields['softwares_id'] = $softwares_id;
         $this->fields['number'] = 1;
         $soft = new Software();
         if ($soft->getFromDB($softwares_id) && in_array($_SESSION['glpiactive_entity'], getAncestorsOf('glpi_entities', $soft->getEntityID()))) {
             $options['entities_id'] = $soft->getEntityID();
         }
     }
     $this->initForm($ID, $options);
     $this->showFormHeader($options);
     // Restore saved value or override with page parameter
     if (!isset($options['template_preview'])) {
         if (isset($_REQUEST)) {
             $saved = Html::cleanPostForTextArea($_REQUEST);
         }
     }
     foreach ($this->fields as $name => $value) {
         if (isset($saved[$name]) && empty($this->fields[$name])) {
             $this->fields[$name] = $saved[$name];
         }
     }
     echo "<input type='hidden' name='withtemplate' value='" . $options['withtemplate'] . "'>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . Software::getTypeName(1) . "</td>";
     echo "<td>";
     if ($ID > 0) {
         $softwares_id = $this->fields["softwares_id"];
         echo "<input type='hidden' name='softwares_id' value='{$softwares_id}'>";
         echo "<a href='software.form.php?id=" . $softwares_id . "'>" . Dropdown::getDropdownName("glpi_softwares", $softwares_id) . "</a>";
     } else {
         Dropdown::show('Software', array('condition' => "`is_template`='0' AND `is_deleted`='0'", 'entity' => $_SESSION['glpiactive_entity'], 'entity_sons' => $_SESSION['glpiactive_entity_recursive'], 'on_change' => 'this.form.submit()', 'value' => $softwares_id));
     }
     echo "</td>";
     echo "<td colspan='2'>";
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . sprintf(__('%1$s%2$s'), __('Name'), isset($options['withtemplate']) && $options['withtemplate'] ? "*" : "") . "</td>";
     echo "<td>";
     $objectName = autoName($this->fields["name"], "name", isset($options['withtemplate']) && $options['withtemplate'] == 2, $this->getType(), $this->fields["entities_id"]);
     Html::autocompletionTextField($this, 'name', array('value' => $objectName));
     echo "</td>";
     echo "<td>" . __('Status') . "</td>";
     echo "<td>";
     State::dropdown(array('value' => $this->fields["states_id"], 'entity' => $this->fields["entities_id"], 'condition' => "`is_visible_softwarelicense`"));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Location') . "</td><td>";
     Location::dropdown(array('value' => $this->fields["locations_id"], 'entity' => $this->fields["entities_id"]));
     echo "</td>";
     echo "<td>" . __('Type') . "</td>";
     echo "<td>";
     SoftwareLicenseType::dropdown(array('value' => $this->fields["softwarelicensetypes_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Technician in charge of the hardware') . "</td>";
     echo "<td>";
     User::dropdown(array('name' => 'users_id_tech', 'value' => $this->fields["users_id_tech"], 'right' => 'own_ticket', 'entity' => $this->fields["entities_id"]));
     echo "</td>";
     echo "<td>" . __('Publisher') . "</td>";
     echo "<td>";
     Manufacturer::dropdown(array('value' => $this->fields["manufacturers_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Group in charge of the hardware') . "</td>";
     echo "<td>";
     Group::dropdown(array('name' => 'groups_id_tech', 'value' => $this->fields['groups_id_tech'], 'entity' => $this->fields['entities_id'], 'condition' => '`is_assign`'));
     echo "</td>";
     echo "<td>" . __('Serial number') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "serial");
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td >" . __('User') . "</td>";
     echo "<td >";
     User::dropdown(array('value' => $this->fields["users_id"], 'entity' => $this->fields["entities_id"], 'right' => 'all'));
     echo "</td>";
     echo "<td>" . sprintf(__('%1$s%2$s'), __('Inventory number'), isset($options['withtemplate']) && $options['withtemplate'] ? "*" : "");
     echo "</td>";
     echo "<td>";
     $objectName = autoName($this->fields["otherserial"], "otherserial", isset($options['withtemplate']) && $options['withtemplate'] == 2, $this->getType(), $this->fields["entities_id"]);
     Html::autocompletionTextField($this, 'otherserial', array('value' => $objectName));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Group') . "</td><td>";
     Group::dropdown(array('value' => $this->fields["groups_id"], 'entity' => $this->fields["entities_id"], 'condition' => '`is_itemgroup`'));
     echo "</td>";
     echo "<td rowspan='4' class='middle'>" . __('Comments') . "</td>";
     echo "<td class='center middle' rowspan='4'>";
     echo "<textarea cols='45' rows='4' name='comment' >" . $this->fields["comment"] . "</textarea>";
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Version in use') . "</td>";
     echo "<td>";
     SoftwareVersion::dropdownForOneSoftware(array('name' => "softwareversions_id_use", 'softwares_id' => $this->fields["softwares_id"], 'value' => $this->fields["softwareversions_id_use"]));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Purchase version') . "</td>";
     echo "<td>";
     SoftwareVersion::dropdownForOneSoftware(array('name' => "softwareversions_id_buy", 'softwares_id' => $this->fields["softwares_id"], 'value' => $this->fields["softwareversions_id_buy"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . _x('quantity', 'Number') . "</td>";
     echo "<td>";
     Dropdown::showNumber("number", array('value' => $this->fields["number"], 'min' => 1, 'max' => 10000, 'step' => 1, 'toadd' => array(-1 => __('Unlimited'))));
     if ($ID > 0) {
         echo "&nbsp;";
         if ($this->fields['is_valid']) {
             echo "<span class='green'>" . _x('adjective', 'Valid') . '<span>';
         } else {
             echo "<span class='red'>" . _x('adjective', 'Invalid') . '<span>';
         }
     }
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Expiration') . "</td>";
     echo "<td>";
     Html::showDateField('expire', array('value' => $this->fields["expire"]));
     if ($ID && is_null($this->fields["expire"])) {
         echo "<br>" . __('Never expire') . "&nbsp;";
         Html::showToolTip(__('On search engine, use "Expiration contains NULL" to search licenses with no expiration date'));
     }
     Alert::displayLastAlert('SoftwareLicense', $ID);
     echo "</td><td colspan='2'></td></tr>\n";
     $this->showFormButtons($options);
     return true;
 }
include '../inc/includes.php';
header("Content-Type: text/html; charset=UTF-8");
Html::header_nocache();
if (isset($_POST["validatortype"])) {
    switch ($_POST["validatortype"]) {
        case 'user':
            if (isset($_POST['users_id_validate']['groups_id'])) {
                $_POST['users_id_validate'] = array();
            }
            $value = isset($_POST['users_id_validate'][0]) ? $_POST['users_id_validate'][0] : 0;
            User::dropdown(array('name' => !empty($_POST['name']) ? $_POST['name'] . '[]' : 'users_id_validate[]', 'entity' => $_POST['entity'], 'value' => $value, 'right' => $_POST['right']));
            break;
        case 'group':
            $name = !empty($_POST['name']) ? $_POST['name'] . '[groups_id]' : 'groups_id';
            $value = isset($_POST['users_id_validate']['groups_id']) ? $_POST['users_id_validate']['groups_id'] : $_POST['groups_id'];
            $rand = Group::dropdown(array('name' => $name, 'value' => $value, 'entity' => $_POST["entity"]));
            $param = array('validatortype' => 'list_users');
            $param['name'] = !empty($_POST['name']) ? $_POST['name'] : '';
            $param['users_id_validate'] = isset($_POST['users_id_validate']) ? $_POST['users_id_validate'] : '';
            $param['right'] = $_POST['right'];
            $param['entity'] = $_POST["entity"];
            $param['groups_id'] = '__VALUE__';
            Ajax::updateItemOnSelectEvent("dropdown_{$name}{$rand}", "show_list_users", $CFG_GLPI["root_doc"] . "/ajax/dropdownValidator.php", $param);
            if ($value) {
                $param['validatortype'] = 'list_users';
                $param['groups_id'] = $value;
                unset($param['users_id_validate']['groups_id']);
                Ajax::updateItem('show_list_users', $CFG_GLPI["root_doc"] . "/ajax/dropdownValidator.php", $param);
            }
            echo "<br><span id='show_list_users'>&nbsp;</span>\n";
            break;
예제 #29
0
 /**
  * Print the consumable type 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;
     $this->initForm($ID, $options);
     $this->showTabs($options);
     $this->showFormHeader($options);
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Name') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "name");
     echo "</td>";
     echo "<td>" . __('Type') . "</td>";
     echo "<td>";
     ConsumableItemType::dropdown(array('value' => $this->fields["consumableitemtypes_id"]));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Reference') . "</td>\n";
     echo "<td>";
     Html::autocompletionTextField($this, "ref");
     echo "</td>";
     echo "<td>" . __('Manufacturer') . "</td>";
     echo "<td>";
     Manufacturer::dropdown(array('value' => $this->fields["manufacturers_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Technician in charge of the hardware') . "</td>";
     echo "<td>";
     User::dropdown(array('name' => 'users_id_tech', 'value' => $this->fields["users_id_tech"], 'right' => 'own_ticket', 'entity' => $this->fields["entities_id"]));
     echo "</td>";
     echo "<td rowspan='4' class='middle'>" . __('Comments') . "</td>";
     echo "<td class='middle' rowspan='4'>\n             <textarea cols='45' rows='9' name='comment' >" . $this->fields["comment"] . "</textarea>";
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Group in charge of the hardware') . "</td>";
     echo "<td>";
     Group::dropdown(array('name' => 'groups_id_tech', 'value' => $this->fields['groups_id_tech'], 'entity' => $this->fields['entities_id'], 'condition' => '`is_assign`'));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Stock location') . "</td>";
     echo "<td>";
     Location::dropdown(array('value' => $this->fields["locations_id"], 'entity' => $this->fields["entities_id"]));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Alert threshold') . "</td>";
     echo "<td>";
     Dropdown::showInteger('alarm_threshold', $this->fields["alarm_threshold"], 0, 100, 1, array('-1' => __('Never')));
     Alert::displayLastAlert('ConsumableItem', $ID);
     echo "</td></tr>";
     $this->showFormButtons($options);
     $this->addDivForTabs();
     return true;
 }
예제 #30
0
 function showForm($ID, $options = array())
 {
     $this->initForm($ID, $options);
     $this->showTabs($options);
     $this->showFormHeader($options);
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Name') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "name");
     echo "</td>";
     echo "<td>" . PluginDatabasesDatabaseCategory::getTypeName(1) . "</td>";
     echo "<td>";
     Dropdown::show('PluginDatabasesDatabaseCategory', array('name' => "plugin_databases_databasecategories_id", 'value' => $this->fields["plugin_databases_databasecategories_id"], 'entity' => $this->fields["entities_id"]));
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Location') . "</td>";
     echo "<td>";
     Location::dropdown(array('value' => $this->fields["locations_id"], 'entity' => $this->fields["entities_id"]));
     echo "</td>";
     echo "<td>" . PluginDatabasesServerType::getTypeName(1) . "</td>";
     echo "<td>";
     Dropdown::show('PluginDatabasesServerType', array('name' => "plugin_databases_servertypes_id", 'value' => $this->fields["plugin_databases_servertypes_id"]));
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Technician in charge of the hardware') . "</td><td>";
     User::dropdown(array('name' => "users_id_tech", 'value' => $this->fields["users_id_tech"], 'entity' => $this->fields["entities_id"], 'right' => 'interface'));
     echo "</td>";
     echo "<td>" . PluginDatabasesDatabaseType::getTypeName(1) . "</td>";
     echo "<td>";
     Dropdown::show('PluginDatabasesDatabaseType', array('name' => "plugin_databases_databasetypes_id", 'value' => $this->fields["plugin_databases_databasetypes_id"], 'entity' => $this->fields["entities_id"]));
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Group in charge of the hardware') . "</td><td>";
     Group::dropdown(array('name' => 'groups_id_tech', 'value' => $this->fields['groups_id_tech'], 'entity' => $this->fields['entities_id'], 'condition' => '`is_assign`'));
     echo "</td>";
     echo "<td>" . __('Editor', 'databases') . "</td>";
     echo "<td>";
     Dropdown::show('Manufacturer', array('name' => "manufacturers_id", 'value' => $this->fields["manufacturers_id"], 'entity' => $this->fields["entities_id"]));
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Supplier') . "</td>";
     echo "<td>";
     Dropdown::show('Supplier', array('name' => "suppliers_id", 'value' => $this->fields["suppliers_id"], 'entity' => $this->fields["entities_id"]));
     echo "</td>";
     echo "<td>" . __('Associable to a ticket') . "</td><td>";
     Dropdown::showYesNo('is_helpdesk_visible', $this->fields['is_helpdesk_visible']);
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td class='center' colspan = '4'>";
     printf(__('Last update on %s'), Html::convDateTime($this->fields["date_mod"]));
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td colspan = '4'>";
     echo "<table cellpadding='2' cellspacing='2' border='0'><tr><td>";
     echo __('Comments') . "</td></tr>";
     echo "<tr>";
     echo "<td class='center'>";
     echo "<textarea cols='125' rows='3' name='comment'>" . $this->fields["comment"] . "</textarea>";
     echo "</td></tr></table>";
     echo "</td>";
     echo "</tr>";
     $this->showFormButtons($options);
     $this->addDivForTabs();
     return true;
 }