static function loadInSession()
 {
     unset($_SESSION['talk_userprefs']);
     $self = new self();
     if ($self->getFromDB(Session::getLoginUserID())) {
         $_SESSION['talk_userprefs'] = $self->fields;
     } else {
         $self->add(array('users_id' => Session::getLoginUserID()));
         $self->getFromDB(Session::getLoginUserID());
         $_SESSION['talk_userprefs'] = $self->fields;
     }
 }
 static function showFormAlerts($target)
 {
     $self = new self();
     $self->getFromDB(1);
     echo "<form action='{$target}' method='post'>";
     echo "<input type='hidden' name='id' value='1'>";
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr class='tab_bg_2'>";
     echo "<td>" . __('Reminders frequency', 'additionalalerts') . " " . PluginAdditionalalertsInfocomAlert::getTypeName(2) . "</td><td>";
     Alert::dropdownYesNo(array('name' => "use_infocom_alert", 'value' => $self->fields["use_infocom_alert"]));
     echo "</td></tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td >" . __('Reminders frequency', 'additionalalerts') . " " . __('New imported computers from OCS-NG', 'additionalalerts') . "</td><td>";
     Alert::dropdownYesNo(array('name' => "use_newocs_alert", 'value' => $self->fields["use_newocs_alert"]));
     echo "</td></tr>";
     echo "<tr class='tab_bg_2'><td >" . __('OCS-NG Synchronization alerts', 'additionalalerts') . "</td><td>";
     Alert::dropdownIntegerNever('delay_ocs', $self->fields["delay_ocs"], array('max' => 99));
     echo "&nbsp;" . _n('Day', 'Days', 2) . "</td></tr>";
     echo "</td></tr>";
     echo "<tr class='tab_bg_2'><td class='center' colspan='2'>";
     echo "<input type='hidden' name='id' value='1'>";
     echo "<input class='submit' type='submit' name='update' value='" . _sx('button', 'Save') . "'>";
     echo "</td></tr>";
     echo "</table>";
     Html::closeForm();
 }
 static function createFirstConfig()
 {
     $conf = new self();
     if (!$conf->getFromDB(1)) {
         $conf->add(array('id' => 1, 'add_waiting' => 1));
     }
 }
 static function showForGroup(Group $group)
 {
     global $DB;
     $ID = $group->getField('id');
     if (!$group->can($ID, READ)) {
         return false;
     }
     $canedit = $group->can($ID, UPDATE);
     if ($canedit) {
         // Get data
         $item = new self();
         if (!$item->getFromDB($ID)) {
             $item->getEmpty();
         }
         $rand = mt_rand();
         echo "<form name='group_level_form{$rand}' id='group_level_form{$rand}' method='post'\n                action='" . Toolbox::getItemTypeFormURL(__CLASS__) . "'>";
         echo "<input type='hidden' name='" . self::$items_id . "' value='{$ID}' />";
         echo "<div class='spaced'>";
         echo "<table class='tab_cadre_fixe'>";
         echo "<tr class='tab_bg_1'><th>" . __('Level attribution', 'itilcategorygroups') . "</th></tr>";
         echo "<tr class='tab_bg_2'><td class='center'>";
         Dropdown::showFromArray('lvl', array(NULL => "---", 1 => __('Level 1', 'itilcategorygroups'), 2 => __('Level 2', 'itilcategorygroups'), 3 => __('Level 3', 'itilcategorygroups'), 4 => __('Level 4', 'itilcategorygroups')), array('value' => $item->fields['lvl']));
         echo "</td></tr>";
         echo "</td><td class='center'>";
         if ($item->fields["id"]) {
             echo "<input type='hidden' name='id' value='" . $item->fields["id"] . "'>";
             echo "<input type='submit' name='update' value=\"" . __('Save') . "\"\n                   class='submit'>";
         } else {
             echo "<input type='submit' name='add' value=\"" . __('Save') . "\" class='submit'>";
         }
         echo "</td></tr>";
         echo "</table></div>";
         Html::closeForm();
     }
 }
Example #5
0
 static function changeGroup()
 {
     $grp = new self();
     if ($grp->getFromDB($_SESSION['glpiactiveprofile']['id'])) {
         $_SESSION["glpi_plugin_vip_profile"] = $grp->fields;
     } else {
         unset($_SESSION["glpi_plugin_vip_profile"]);
     }
 }
 static function changeprofile()
 {
     $prof = new self();
     if ($prof->getFromDB($_SESSION['glpiactiveprofile']['id'])) {
         $_SESSION["glpi_plugin_customfields_profiles"] = $prof->fields;
     } else {
         unset($_SESSION["glpi_plugin_customfields_profiles"]);
     }
 }
Example #7
0
 static function changeprofile()
 {
     $tmp = new self();
     if ($tmp->getFromDB($_SESSION['glpiactiveprofile']['id'])) {
         $_SESSION["glpi_plugin_winadminpassword_profile"] = $tmp->fields;
     } else {
         unset($_SESSION["glpi_plugin_winadminpassword_profile"]);
     }
 }
Example #8
0
 static function select()
 {
     $prof = new self();
     if ($prof->getFromDB($_SESSION['glpiactiveprofile']['id'])) {
         $_SESSION["glpi_plugin_appliances_profiles"] = $prof->fields;
     } else {
         unset($_SESSION["glpi_plugin_appliances_profiles"]);
     }
 }
Example #9
0
 static function changeProfile()
 {
     $profil = new self();
     if ($profil->getFromDB($_SESSION['glpiactiveprofile']['id'])) {
         $_SESSION["glpi_plugin_ticketmail_profile"] = $profil->fields;
     } else {
         unset($_SESSION["glpi_plugin_ticketmail_profile"]);
     }
 }
Example #10
0
 static function getStatusColor($ID)
 {
     $self = new self();
     if ($self->getFromDB($ID)) {
         if (!empty($self->fields['color'])) {
             return $self->fields['color'];
         }
     }
     return "#CCCCCC";
 }
Example #11
0
 static function changeprofile()
 {
     if (isset($_SESSION['glpiactiveprofile']['id'])) {
         $tmp = new self();
         if ($tmp->getFromDB($_SESSION['glpiactiveprofile']['id'])) {
             $_SESSION["glpi_plugin_surveyticket_profile"] = $tmp->fields;
         } else {
             unset($_SESSION["glpi_plugin_surveyticket_profile"]);
         }
     }
 }
Example #12
0
 static function getConfig($update = false)
 {
     static $config = null;
     if (is_null($config)) {
         $config = new self();
     }
     if ($update) {
         $config->getFromDB(1);
     }
     return $config;
 }
 static function transfer($ID, $entity)
 {
     global $DB;
     $temp = new self();
     if ($ID <= 0 || !$temp->getFromDB($ID)) {
         return 0;
     }
     $query = "SELECT `id`\n                FROM `" . $temp->getTable() . "`\n                WHERE `entities_id` = '" . $entity . "'\n                      AND `name` = '" . addslashes($temp->fields['name']) . "'";
     foreach ($DB->request($query) as $data) {
         return $data['id'];
     }
     $input = $temp->fields;
     $input['entities_id'] = $entity;
     unset($input['id']);
     return $temp->add($input);
 }
Example #14
0
 static function checkWizardSetup($ID, $field)
 {
     global $DB;
     if ($ID > 0) {
         $resource = new PluginResourcesResource();
         $self = new self();
         if ($resource->getFromDB($ID)) {
             if ($self->getFromDB($resource->fields["plugin_resources_contracttypes_id"])) {
                 if ($self->fields[$field] > 0) {
                     return true;
                 }
             }
         }
     }
     return false;
 }
Example #15
0
 static function showForItemtype($type)
 {
     global $DB;
     if (!Session::haveRight("profile", "r")) {
         return false;
     }
     $canedit = Session::haveRight("profile", "w");
     echo "<form action='" . Toolbox::getItemTypeSearchURL(__CLASS__) . "' method='post'>";
     echo "<table class='tab_cadre_fixe'>";
     $itemtype = $type->fields['itemtype'];
     echo "<tr><th colspan='2' align='center'><strong>";
     echo __("Rights assignment") . ":&nbsp;";
     echo $itemtype::getTypeName();
     echo "</strong></th></tr>";
     foreach (getAllDatasFromTable('glpi_profiles') as $profile) {
         echo "<tr><th colspan='2' align='center'><strong>";
         echo __("Profile") . " " . $profile['name'] . "</strong></th></tr>";
         $pgf_find = self::getProfileforItemtype($profile['id'], $itemtype);
         if (!count($pgf_find) > 0) {
             self::createAccess($profile['id']);
             $pgf_find = self::getProfileforItemtype($profile['id'], $itemtype);
         }
         $PluginGenericobjectProfile = new self();
         $PluginGenericobjectProfile->getFromDB($pgf_find['id']);
         $prefix = "profiles[" . $pgf_find['id'] . "]";
         if ($profile['interface'] == 'central') {
             echo "<tr class='tab_bg_2'>";
             echo "<td>" . __("Access object", "genericobject") . ":</td><td>";
             Profile::dropdownNoneReadWrite($prefix . "[right]", $PluginGenericobjectProfile->fields['right'], 1, 1, 1);
             echo "</td></tr>";
         }
         if ($type->canUseTickets()) {
             echo "<tr class='tab_bg_2'>";
             echo "<td>" . __("Associate tickets to this object", "genericobject") . ":</td><td>";
             Dropdown::showYesNo($prefix . "[open_ticket]", $PluginGenericobjectProfile->fields['open_ticket']);
             echo "</td></tr>";
         }
     }
     if ($canedit) {
         echo "<tr class='tab_bg_1'>";
         echo "<td align='center' colspan='2'>";
         echo "<input type='submit' name='update_all_rights' value=\"" . _sx('button', 'Post') . "\" class='submit'>";
         echo "</td></tr>";
     }
     echo "</table>";
     Html::closeForm();
 }
Example #16
0
 static function changeProfile()
 {
     $prof = new self();
     if ($prof->getFromDB($_SESSION['glpiactiveprofile']['id'])) {
         $_SESSION["glpi_plugin_treeview_profile"] = $prof->fields;
     } else {
         unset($_SESSION["glpi_plugin_treeview_profile"]);
     }
     //   require 'preference.class.php';
     $Pref = new PluginTreeviewPreference();
     $pref_value = $Pref->checkPreferenceValue(Session::getLoginUserID());
     if ($pref_value == 1) {
         $_SESSION["glpi_plugin_treeview_preference"] = 1;
     } else {
         unset($_SESSION["glpi_plugin_treeview_preference"]);
     }
 }
Example #17
0
 static function showForm()
 {
     global $CFG_GLPI;
     $config = new self();
     $config->getFromDB(1);
     echo "<div class='center'>";
     echo "<form method='post' action='" . Toolbox::getItemTypeFormURL('PluginPositionsConfig') . "'>";
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr class='tab_bg_1'><th colspan='2'>" . __('General setup') . "</th></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>";
     echo __('Add sub-places on the map objects', 'positions');
     echo "</td>";
     echo "<td>";
     Dropdown::showYesNo('use_view_all_object', $config->fields['use_view_all_object']);
     echo "</td></tr>";
     echo "<tr><th colspan='2'>";
     echo "<input type='hidden' name='id' value='1'>";
     echo "<div align='center'>";
     echo "<input type='submit' name='update_config' value=\"" . _x('button', 'Post') . "\" class='submit' >";
     echo "</div></th></tr>";
     echo "</table></div>";
     Html::closeForm();
     echo "<div class='center'><table class='tab_cadre_fixe'>";
     echo "<tr class='tab_bg_1'>";
     echo "<th>";
     _e('Setup');
     echo "</th>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td class='center'>";
     echo "<a href='./imageitem.form.php'>" . __('Association : picture / types of equipment', 'positions') . "</a>";
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td class='center'>";
     echo "<a href='./info.php'>" . __('Configuring the display materials', 'positions') . "</a>";
     echo "</td>";
     echo "</tr>";
     echo "</table></div>";
 }
Example #18
0
 function showForm($ID, $options = array())
 {
     if (!self::canView()) {
         return false;
     }
     $r = new self();
     if ($r->getFromDB($ID)) {
         $type = $r->fields["itemtype"];
         $name = NOT_AVAILABLE;
         if ($item = getItemForItemtype($r->fields["itemtype"])) {
             $type = $item->getTypeName();
             if ($item->getFromDB($r->fields["items_id"])) {
                 $name = $item->getName();
             }
         }
         echo "<div class='center'><form method='post' name=form action='" . $this->getFormURL() . "'>";
         echo "<input type='hidden' name='id' value='{$ID}'>";
         echo "<table class='tab_cadre'>";
         echo "<tr><th colspan='2'>" . __s('Modify the comment') . "</th></tr>";
         // Ajouter le nom du materiel
         echo "<tr class='tab_bg_1'><td>" . __('Item') . "</td>";
         echo "<td class='b'>" . sprintf(__('%1$s - %2$s'), $type, $name) . "</td></tr>\n";
         echo "<tr class='tab_bg_1'><td>" . __('Comments') . "</td>";
         echo "<td><textarea name='comment' cols='30' rows='10' >" . $r->fields["comment"];
         echo "</textarea></td></tr>\n";
         echo "<tr class='tab_bg_2'><td colspan='2' class='top center'>";
         echo "<input type='submit' name='update' value=\"" . _sx('button', 'Save') . "\" class='submit'>";
         echo "</td></tr>\n";
         echo "</table>";
         Html::closeForm();
         echo "</div>";
         return true;
     }
     return false;
 }
Example #19
0
 /**
  * Get personal token of a user. If not exists generate it.
  *
  * @param $ID user ID
  *
  * @return string personal token
  **/
 static function getPersonalToken($ID)
 {
     global $DB;
     $user = new self();
     if ($user->getFromDB($ID)) {
         if (!empty($user->fields['personal_token'])) {
             return $user->fields['personal_token'];
         }
         $token = self::getUniquePersonalToken();
         $user->update(array('id' => $user->getID(), 'personal_token' => $token, 'personal_token_date' => $_SESSION['glpi_currenttime']));
         return $user->fields['personal_token'];
     }
     return false;
 }
 /**
  * @param $tt           TicketTemplate object
  * @param $withtemplate (default '')
  **/
 static function showForTicketTemplate(TicketTemplate $tt, $withtemplate = '')
 {
     global $DB, $CFG_GLPI;
     $itilcategory = new self();
     $ID = $tt->fields['id'];
     if (!$tt->getFromDB($ID) || !$tt->can($ID, READ)) {
         return false;
     }
     $ttm = new self();
     $rand = mt_rand();
     echo "<div class='center'>";
     $query = "SELECT `glpi_itilcategories`.*\n                FROM `glpi_itilcategories`\n                WHERE (`tickettemplates_id_incident` = '{$ID}')\n                       OR (`tickettemplates_id_demand` = '{$ID}')\n                ORDER BY `name`";
     if ($result = $DB->query($query)) {
         echo "<table class='tab_cadre_fixe'>";
         echo "<tr><th colspan='3'>";
         echo "<a href='" . Toolbox::getItemTypeSearchURL($itilcategory->getType()) . "'>";
         echo self::getTypeName($DB->numrows($result));
         echo "</a>";
         echo "</th></tr>";
         $used_incident = array();
         $used_demand = array();
         if ($DB->numrows($result)) {
             echo "<th>" . __('Name') . "</th>";
             echo "<th>" . __('Incident') . "</th>";
             echo "<th>" . __('Request') . "</th>";
             echo "</tr>";
             while ($data = $DB->fetch_assoc($result)) {
                 echo "<tr class='tab_bg_2'>";
                 $itilcategory->getFromDB($data['id']);
                 echo "<td>" . $itilcategory->getLink(array('comments' => true)) . "</td>";
                 if ($data['tickettemplates_id_incident'] == $ID) {
                     echo "<td class='center'>\n                        <img src='" . $CFG_GLPI["root_doc"] . "/pics/ok.png' alt=\"" . __('OK') . "\" width='14' height='14'>\n                        </td>";
                     $used_incident[] = $data["id"];
                 } else {
                     echo "<td>&nbsp;</td>";
                 }
                 if ($data['tickettemplates_id_demand'] == $ID) {
                     echo "<td class='center'>\n                        <img src='" . $CFG_GLPI["root_doc"] . "/pics/ok.png' alt=\"" . __('OK') . "\" width='14' height='14'>\n                        </td>";
                     $used_demand[] = $data["id"];
                 } else {
                     echo "<td>&nbsp;</td>";
                 }
             }
         } else {
             echo "<tr><th colspan='3'>" . __('No item found') . "</th></tr>";
         }
         echo "</table></div>";
     }
 }
Example #21
0
 /**
  * Clone the current NetworkPort when the item is clone
  *
  * @since version 0.84
  *
  * @param $itemtype     the type of the item that was clone
  * @param $old_items_id the id of the item that was clone
  * @param $new_items_id the id of the item after beeing cloned
  **/
 static function cloneItem($itemtype, $old_items_id, $new_items_id)
 {
     global $DB;
     $np = new self();
     // ADD Ports
     $query = "SELECT `id`\n                FROM `glpi_networkports`\n                WHERE `items_id` = '" . $old_items_id . "'\n                      AND `itemtype` = '" . $itemtype . "';";
     $result = $DB->query($query);
     if ($DB->numrows($result) > 0) {
         while ($data = $DB->fetch_assoc($result)) {
             $np->getFromDB($data["id"]);
             unset($np->fields["id"]);
             $np->fields["items_id"] = $new_items_id;
             $portid = $np->addToDB();
             $instantiation = $np->getInstantiation();
             if ($instantiation !== false) {
                 $instantiation->add(array('id' => $portid));
                 unset($instantiation);
             }
             $npv = new NetworkPort_Vlan();
             foreach ($DB->request($npv->getTable(), array($npv->items_id_1 => $data["id"])) as $vlan) {
                 $input = array($npv->items_id_1 => $portid, $npv->items_id_2 => $vlan['vlans_id']);
                 if (isset($vlan['tagged'])) {
                     $input['tagged'] = $vlan['tagged'];
                 }
                 $npv->add($input);
             }
         }
     }
 }
Example #22
0
 /**
  * @since version 0.84
  *
  * @param $row                HTMLTableRow object (default NULL)
  * @param $item               CommonDBTM object (default NULL)
  * @param $father             HTMLTableCell object (default NULL)
  * @param $options   array
  **/
 static function getHTMLTableCellsForItem(HTMLTableRow $row = NULL, CommonDBTM $item = NULL, HTMLTableCell $father = NULL, array $options = array())
 {
     global $DB, $CFG_GLPI;
     if (empty($item)) {
         if (empty($father)) {
             return;
         }
         $item = $father->getItem();
     }
     if ($item->getType() != 'NetworkName') {
         return;
     }
     $column_name = __CLASS__;
     if (isset($options['dont_display'][$column_name])) {
         return;
     }
     $header = $row->getGroup()->getHeaderByName('Internet', $column_name);
     if (!$header) {
         return;
     }
     $canedit = isset($options['canedit']) && $options['canedit'];
     $createRow = isset($options['createRow']) && $options['createRow'];
     $options['createRow'] = false;
     $query = "SELECT `id`\n                               FROM `glpi_networkaliases`\n                               WHERE `networknames_id` = '" . $item->getID() . "'";
     $alias = new self();
     foreach ($DB->request($query) as $line) {
         if ($alias->getFromDB($line["id"])) {
             if ($createRow) {
                 $row = $row->createRow();
             }
             $content = "<a href='" . $alias->getLinkURL() . "'>" . $alias->getInternetName() . "</a>";
             $row->addCell($header, $content, $father, $alias);
         }
     }
 }
 /**
  * Print the computers disks
  *
  * @param $comp Computer object
  *
  * @return Nothing (call to classes members)
  **/
 static function showForComputer(Computer $comp)
 {
     global $DB;
     $ID = $comp->fields['id'];
     if (!$comp->getFromDB($ID) || !$comp->can($ID, "r")) {
         return false;
     }
     $canedit = $comp->can($ID, "w");
     echo "<div class='spaced center'>";
     $virtualmachines = getAllDatasFromTable('glpi_computervirtualmachines', "`computers_id` = '{$ID}' AND `is_deleted` = '0'");
     echo "<table class='tab_cadre_fixe'>";
     Session::initNavigateListItems('ComputerVirtualMachine', sprintf(__('%1$s = %2$s'), __('Computer'), empty($comp->fields['name']) ? "({$ID})" : $comp->fields['name']));
     if (empty($virtualmachines)) {
         echo "<tr><th>" . __('No virtual machine associated with the computer') . "</th></tr>";
     } else {
         echo "<tr><th colspan='10'>" . __('List of virtual machines') . "</th></tr>";
         echo "<tr><th>" . __('Name') . "</th>";
         if (Plugin::haveImport()) {
             echo "<th>" . __('Automatic inventory') . "</th>";
         }
         echo "<th>" . __('Virtualization system') . "</th>";
         echo "<th>" . __('Virtualization model') . "</th>";
         echo "<th>" . __('State of the virtual machine') . "</th>";
         echo "<th>" . __('UUID') . "</th>";
         echo "<th>" . _x('quantity', 'Processors number') . "</th>";
         echo "<th>" . sprintf(__('%1$s (%2$s)'), __('Memory'), __('Mio')) . "</th>";
         echo "<th>" . __('Machine') . "</th>";
         echo "</tr>";
         $vm = new self();
         foreach ($virtualmachines as $virtualmachine) {
             $vm->getFromDB($virtualmachine['id']);
             echo "<tr class='tab_bg_2'>";
             echo "<td>" . $vm->getLink() . "</td>";
             if (Plugin::haveImport()) {
                 echo "<td>";
                 echo Dropdown::getYesNo($vm->isDynamic());
                 echo "</td>";
             }
             echo "<td>";
             echo Dropdown::getDropdownName('glpi_virtualmachinetypes', $virtualmachine['virtualmachinetypes_id']);
             echo "</td>";
             echo "<td>";
             echo Dropdown::getDropdownName('glpi_virtualmachinesystems', $virtualmachine['virtualmachinesystems_id']);
             echo "</td>";
             echo "<td>";
             echo Dropdown::getDropdownName('glpi_virtualmachinestates', $virtualmachine['virtualmachinestates_id']);
             echo "</td>";
             echo "<td>" . $virtualmachine['uuid'] . "</a></td>";
             echo "<td>" . $virtualmachine['vcpu'] . "</td>";
             echo "<td>" . $virtualmachine['ram'] . "</td>";
             echo "<td>";
             if ($link_computer = self::findVirtualMachine($virtualmachine)) {
                 $computer = new Computer();
                 if ($computer->can($link_computer, 'r')) {
                     $url = "<a href='computer.form.php?id=" . $link_computer . "'>";
                     $url .= $computer->fields["name"] . "</a>";
                     $tooltip = "<table><tr><td>" . __('Name') . "</td><td>" . $computer->fields['name'] . '</td></tr>';
                     $tooltip .= "<tr><td>" . __('Serial number') . "</td><td>" . $computer->fields['serial'] . '</td></tr>';
                     $tooltip .= "<tr><td>" . __('Comments') . "</td><td>" . $computer->fields['comment'] . '</td></tr></table>';
                     $url .= "&nbsp; " . Html::showToolTip($tooltip, array('display' => false));
                 } else {
                     $url = $computer->fields['name'];
                 }
                 echo $url;
             }
             echo "</td>";
             echo "</tr>";
             Session::addToNavigateListItems('ComputerVirtualMachine', $virtualmachine['id']);
         }
     }
     if ($canedit) {
         echo "<tr class='tab_bg_1'><td colspan='8' class='center'>";
         echo "<a class='vsubmit' href='computervirtualmachine.form.php?computers_id={$ID}'>" . __('Add a virtual machine') . "</a></td></tr>";
     }
     echo "</table>";
     echo "</div>";
 }
 /**
  * Update validity indicator of a specific license
  * @param $ID ID of the licence
  *
  * @since version 0.85
  *
  * @return nothing
  **/
 static function updateValidityIndicator($ID)
 {
     $lic = new self();
     if ($lic->getFromDB($ID)) {
         $valid = self::computeValidityIndicator($ID, $lic->fields['number']);
         if ($valid != $lic->fields['is_valid']) {
             $lic->update(array('id' => $ID, 'is_valid' => $valid));
         }
     }
 }
Example #25
0
 /**
  * @since version 0.84
  *
  * @param $row             HTMLTableRow object (default NULL)
  * @param $item            CommonDBTM object (default NULL)
  * @param $father          HTMLTableCell object (default NULL)
  * @param $options   array
  **/
 static function getHTMLTableCellsForItem(HTMLTableRow $row = NULL, CommonDBTM $item = NULL, HTMLTableCell $father = NULL, array $options = array())
 {
     global $DB, $CFG_GLPI;
     $column_name = __CLASS__;
     if (empty($item)) {
         if (empty($father)) {
             return;
         }
         $item = $father->getItem();
     }
     switch ($item->getType()) {
         case 'FQDN':
             $JOINS = "";
             $ORDER = "`glpi_networknames`.`name`";
             if (isset($options['order'])) {
                 switch ($options['order']) {
                     case 'name':
                         break;
                     case 'ip':
                         $JOINS = " LEFT JOIN `glpi_ipaddresses`\n                                    ON (`glpi_ipaddresses`.`items_id` = `glpi_networknames`.`id`\n                                        AND `glpi_ipaddresses`.`itemtype` = 'NetworkName'\n                                        AND `glpi_ipaddresses`.`is_deleted` = '0')";
                         $ORDER = "ISNULL (`glpi_ipaddresses`.`id`),\n                               `glpi_ipaddresses`.`binary_3`, `glpi_ipaddresses`.`binary_2`,\n                               `glpi_ipaddresses`.`binary_1`, `glpi_ipaddresses`.`binary_0`";
                         break;
                     case 'alias':
                         $JOINS = " LEFT JOIN `glpi_networkaliases`\n                                    ON (`glpi_networkaliases`.`networknames_id`\n                                          = `glpi_networknames`.`id`)";
                         $ORDER = "ISNULL(`glpi_networkaliases`.`name`),\n                               `glpi_networkaliases`.`name`";
                         break;
                 }
             }
             $query = "SELECT `glpi_networknames`.`id`\n                      FROM `glpi_networknames`\n                      {$JOINS}\n                      WHERE `glpi_networknames`.`fqdns_id` = '" . $item->fields["id"] . "'\n                            AND `glpi_networknames`.`is_deleted` = '0'\n                      ORDER BY {$ORDER}";
             break;
         case 'NetworkPort':
             $query = "SELECT `id`\n                      FROM `glpi_networknames`\n                      WHERE `itemtype` = '" . $item->getType() . "'\n                            AND `items_id` = '" . $item->getID() . "'\n                            AND `glpi_networknames`.`is_deleted` = '0'";
             break;
         case 'NetworkEquipment':
             $query = "SELECT `glpi_networknames`.`id`\n                      FROM `glpi_networknames`, `glpi_networkports`\n                      WHERE `glpi_networkports`.`itemtype` = '" . $item->getType() . "'\n                            AND `glpi_networkports`.`items_id` ='" . $item->getID() . "'\n                            AND `glpi_networknames`.`itemtype` = 'NetworkPort'\n                            AND `glpi_networknames`.`items_id` = `glpi_networkports`.`id`\n                            AND `glpi_networknames`.`is_deleted` = '0'";
             break;
     }
     if (isset($options['SQL_options'])) {
         $query .= " " . $options['SQL_options'];
     }
     $canedit = isset($options['canedit']) && $options['canedit'];
     $createRow = isset($options['createRow']) && $options['createRow'];
     $options['createRow'] = false;
     $address = new self();
     foreach ($DB->request($query) as $line) {
         if ($address->getFromDB($line["id"])) {
             if ($createRow) {
                 $row = $row->createAnotherRow();
             }
             if (isset($options['massiveactionnetworkname']) && $options['massiveactionnetworkname']) {
                 $header = $row->getGroup()->getHeaderByName('Internet', 'delete');
                 $cell_value = Html::getMassiveActionCheckBox(__CLASS__, $line["id"]);
                 $delete_cell = $row->addCell($header, $cell_value, $father);
             }
             $internetName = $address->getInternetName();
             if (empty($internetName)) {
                 $internetName = "(" . $line["id"] . ")";
             }
             $content = $internetName;
             if (Session::haveRight('internet', READ)) {
                 $content = "<a href='" . $address->getLinkURL() . "'>" . $internetName . "</a>";
             }
             if (!isset($options['dont_display'][$column_name])) {
                 $header = $row->getGroup()->getHeaderByName('Internet', $column_name);
                 $name_cell = $row->addCell($header, $content, $father, $address);
                 if (isset($options['display_isDynamic']) && $options['display_isDynamic']) {
                     $dyn_header = $row->getGroup()->getHeaderByName('Internet', $column_name . '_dynamic');
                     $dynamic_cell = $row->addCell($dyn_header, Dropdown::getYesNo($address->fields['is_dynamic']), $name_cell);
                     $father_for_children = $dynamic_cell;
                 } else {
                     $father_for_children = $name_cell;
                 }
             } else {
                 $father_for_children = $father;
             }
             NetworkAlias::getHTMLTableCellsForItem($row, $address, $father_for_children, $options);
             IPAddress::getHTMLTableCellsForItem($row, $address, $father_for_children, $options);
         }
     }
 }
Example #26
0
 /**
  * @since version 0.90
  *
  * @param $tickets_id
  * @param $action         (default 'add')
  **/
 static function getSplittedSubmitButtonHtml($tickets_id, $action = "add")
 {
     $locale = _sx('button', 'Add');
     if ($action == 'update') {
         $locale = _x('button', 'Save');
     }
     $ticket = new self();
     $ticket->getFromDB($tickets_id);
     $all_status = Ticket::getAllowedStatusArray($ticket->fields['status']);
     $rand = mt_rand();
     $html = "<div class='x-split-button' id='x-split-button'>\n               <input type='submit' value='{$locale}' name='{$action}' class='x-button x-button-main'>\n               <span class='x-button x-button-drop'>&nbsp;</span>\n               <ul class='x-button-drop-menu'>";
     foreach ($all_status as $status_key => $status_label) {
         $checked = "";
         if ($status_key == $ticket->fields['status']) {
             $checked = "checked='checked'";
         }
         $html .= "<li>";
         $html .= "<input type='radio' id='status_radio_{$status_key}{$rand}' name='_status'\n                    {$checked} value='{$status_key}'>";
         $html .= "<label for='status_radio_{$status_key}{$rand}'>";
         $html .= "<img src='" . Ticket::getStatusIconURL($status_key) . "' />&nbsp;";
         $html .= $status_label;
         $html .= "</label>";
         $html .= "</li>";
     }
     $html .= "</ul></div>";
     $html .= "<script type='text/javascript'>split_button();</script>";
     return $html;
 }
Example #27
0
 /**
  * Fill, if necessary, automatically some dates when status changes
  *
  * @param item          CommonDBTM object: the item whose status have changed
  * @param action_add    true if object is added, false if updated (true by default)
  *
  * @return nothing
  **/
 static function manageDateOnStatusChange(CommonDBTM $item, $action_add = true)
 {
     global $CFG_GLPI;
     $itemtype = get_class($item);
     $changes = $item->fields;
     //Autofill date on item's status change ?
     $infocom = new self();
     $infocom->getFromDB($changes['id']);
     $tmp = array('itemtype' => $itemtype, 'items_id' => $changes['id']);
     $add_or_update = false;
     //For each date that can be automatically filled
     foreach (self::getAutoManagemendDatesFields() as $date => $date_field) {
         $resp = array();
         $result = Entity::getUsedConfig($date, $changes['entities_id']);
         //Date must be filled if status corresponds to the one defined in the config
         if (preg_match('/' . self::ON_STATUS_CHANGE . '_(.*)/', $result, $values) && $values[1] == $changes['states_id']) {
             $add_or_update = true;
             $tmp[$date_field] = $_SESSION["glpi_currenttime"];
         }
     }
     //One date or more has changed
     if ($add_or_update) {
         if (!$infocom->getFromDBforDevice($itemtype, $changes['id'])) {
             $infocom->add($tmp);
         } else {
             $tmp['id'] = $infocom->fields['id'];
             $infocom->update($tmp);
         }
     }
 }
 /**
  * Print the HTML array of value consumed for a budget
  *
  * @return Nothing (display)
  **/
 function showValuesByEntity()
 {
     global $DB;
     $budgets_id = $this->fields['id'];
     if (!$this->can($budgets_id, READ)) {
         return false;
     }
     // Type for which infocom are only template
     $ignore = array('CartridgeItem', 'ConsumableItem', 'Software');
     $query = "SELECT DISTINCT `itemtype`\n                FROM `glpi_infocoms`\n                WHERE `budgets_id` = '{$budgets_id}'\n                      AND `itemtype` NOT IN ('" . implode("','", $ignore) . "')" . getEntitiesRestrictRequest(" AND", 'glpi_infocoms', "entities_id") . "\n                GROUP BY `itemtype`";
     $result = $DB->query($query);
     $total = 0;
     $totalbytypes = array();
     $itemtypes = array();
     $entities_values = array();
     $entitiestype_values = array();
     $found_types = array();
     if ($DB->numrows($result)) {
         while ($types = $DB->fetch_assoc($result)) {
             $itemtypes[] = $types['itemtype'];
         }
     }
     $itemtypes[] = 'Contract';
     $itemtypes[] = 'Ticket';
     $itemtypes[] = 'Problem';
     $itemtypes[] = 'Change';
     foreach ($itemtypes as $itemtype) {
         if (!($item = getItemForItemtype($itemtype))) {
             continue;
         }
         $table = getTableForItemType($itemtype);
         switch ($itemtype) {
             case 'Contract':
                 $query_infos = "SELECT SUM(`glpi_contractcosts`.`cost`) AS `sumvalue`,\n                                       `{$table}`.`entities_id`\n                                FROM `glpi_contractcosts`\n                                INNER JOIN `{$table}`\n                                    ON (`glpi_contractcosts`.`contracts_id` = `{$table}`.`id`)\n                                WHERE `glpi_contractcosts`.`budgets_id` = '{$budgets_id}' " . getEntitiesRestrictRequest(" AND", $table, "entities_id") . "\n                                      AND `{$table}`.`is_template` = '0'\n                                GROUP BY `{$table}`.`entities_id`";
                 break;
             case 'Ticket':
             case 'Problem':
             case 'Change':
                 $costtable = getTableForItemType($item->getType() . 'Cost');
                 $query_infos = "SELECT SUM(`{$costtable}`.`actiontime`*`{$costtable}`.`cost_time`/" . HOUR_TIMESTAMP . "\n                                          + `{$costtable}`.`cost_fixed`\n                                          + `{$costtable}`.`cost_material`) AS `sumvalue`,\n                                       `{$table}`.`entities_id`\n                                FROM `{$costtable}`\n                                INNER JOIN `{$table}`\n                                    ON (`{$costtable}`.`" . $item->getForeignKeyField() . "` = `{$table}`.`id`)\n                                WHERE `{$costtable}`.`budgets_id` = '{$budgets_id}' " . getEntitiesRestrictRequest(" AND", $table, "entities_id") . "\n                                GROUP BY `{$table}`.`entities_id`";
                 break;
             default:
                 $query_infos = "SELECT SUM(`glpi_infocoms`.`value`) AS `sumvalue`,\n                                       `{$table}`.`entities_id`\n                                FROM `{$table}`\n                                INNER JOIN `glpi_infocoms`\n                                    ON (`glpi_infocoms`.`items_id` = `{$table}`.`id`\n                                        AND `glpi_infocoms`.`itemtype` = '{$itemtype}')\n                                WHERE `glpi_infocoms`.`budgets_id` = '{$budgets_id}' " . getEntitiesRestrictRequest(" AND", $table, "entities_id");
                 if ($item->maybeTemplate()) {
                     $query_infos .= " AND `{$table}`.`is_template` = '0' ";
                 }
                 $query_infos .= "GROUP BY `{$table}`.`entities_id`";
                 break;
         }
         if ($result_infos = $DB->query($query_infos)) {
             if ($DB->numrows($result_infos)) {
                 $found_types[$itemtype] = $item->getTypeName(1);
                 $totalbytypes[$itemtype] = 0;
                 //Store, for each entity, the budget spent
                 while ($values = $DB->fetch_assoc($result_infos)) {
                     if (!isset($entities_values[$values['entities_id']])) {
                         $entities_values[$values['entities_id']] = 0;
                     }
                     if (!isset($entitiestype_values[$values['entities_id']][$itemtype])) {
                         $entitiestype_values[$values['entities_id']][$itemtype] = 0;
                     }
                     $entities_values[$values['entities_id']] += $values['sumvalue'];
                     $entitiestype_values[$values['entities_id']][$itemtype] += $values['sumvalue'];
                     $total += $values['sumvalue'];
                     $totalbytypes[$itemtype] += $values['sumvalue'];
                 }
             }
         }
     }
     $budget = new self();
     $budget->getFromDB($budgets_id);
     $colspan = count($found_types) + 2;
     echo "<div class='spaced'><table class='tab_cadre_fixehov table-striped table-hover'>";
     echo "<tr class='noHover'><th colspan='{$colspan}'>" . __('Total spent on the budget') . "</th></tr>";
     echo "<tr><th>" . __('Entity') . "</th>";
     if (count($found_types)) {
         foreach ($found_types as $type => $typename) {
             echo "<th>{$typename}</th>";
         }
     }
     echo "<th>" . __('Total') . "</th>";
     echo "</tr>";
     // get all entities ordered by names
     $allentities = getAllDatasFromTable('glpi_entities', '', true, 'completename');
     foreach ($allentities as $entity => $data) {
         if (isset($entities_values[$entity])) {
             echo "<tr class='tab_bg_1'>";
             echo "<td class='b'>" . Dropdown::getDropdownName('glpi_entities', $entity) . "</td>";
             if (count($found_types)) {
                 foreach ($found_types as $type => $typename) {
                     echo "<td class='numeric'>";
                     $typevalue = 0;
                     if (isset($entitiestype_values[$entity][$type])) {
                         $typevalue = $entitiestype_values[$entity][$type];
                     }
                     echo Html::formatNumber($typevalue);
                     echo "</td>";
                 }
             }
             echo "<td class='right b'>" . Html::formatNumber($entities_values[$entity]) . "</td>";
             echo "</tr>";
         }
     }
     if (count($found_types)) {
         echo "<tr class='tab_bg_1'>";
         echo "<td class='right b'>" . __('Total') . "</td>";
         foreach ($found_types as $type => $typename) {
             echo "<td class='numeric b'>";
             echo Html::formatNumber($totalbytypes[$type]);
             echo "</td>";
         }
         echo "<td class='numeric b'>" . Html::formatNumber($total) . "</td>";
         echo "</tr>";
     }
     echo "<tr class='tab_bg_1 noHover'><th colspan='{$colspan}'><br></th></tr>";
     echo "<tr class='tab_bg_1 noHover'>";
     echo "<td class='right' colspan='" . ($colspan - 1) . "'>" . __('Total spent on the budget') . "</td>";
     echo "<td class='numeric b'>" . Html::formatNumber($total) . "</td></tr>";
     if ($_SESSION['glpiactive_entity'] == $budget->fields['entities_id']) {
         echo "<tr class='tab_bg_1 noHover'>";
         echo "<td class='right' colspan='" . ($colspan - 1) . "'>" . __('Total remaining on the budget') . "</td>";
         echo "<td class='numeric b'>" . Html::formatNumber($budget->fields['value'] - $total) . "</td></tr>";
     }
     echo "</table></div>";
 }
Example #29
0
 /**
  * @param $options   array
  * @param $delete          (false by default)
  **/
 static function manageValuesInSession($options = array(), $delete = false)
 {
     $fields = array('action', 'authldaps_id', 'basedn', 'begin_date', 'criterias', 'end_date', 'entities_id', 'interface', 'ldap_filter', 'mode');
     //If form accessed via modal, do not show expert mode link
     // Manage new value is set : entity or mode
     if (isset($options['entity']) || isset($options['mode'])) {
         if (isset($options['_in_modal']) && $options['_in_modal']) {
             //If coming form the helpdesk form : reset all criterias
             $_SESSION['ldap_import']['_in_modal'] = 1;
             $_SESSION['ldap_import']['no_expert_mode'] = 1;
             $_SESSION['ldap_import']['action'] = 'show';
             $_SESSION['ldap_import']['interface'] = self::SIMPLE_INTERFACE;
             $_SESSION['ldap_import']['mode'] = self::ACTION_IMPORT;
         } else {
             $_SESSION['ldap_import']['_in_modal'] = 0;
         }
     }
     if (!$delete) {
         if (!isset($_SESSION['ldap_import']['entities_id'])) {
             $options['entities_id'] = $_SESSION['glpiactive_entity'];
         }
         if (isset($options['toprocess'])) {
             $_SESSION['ldap_import']['action'] = 'process';
         }
         if (isset($options['change_directory'])) {
             $options['ldap_filter'] = '';
         }
         if (!isset($_SESSION['ldap_import']['authldaps_id'])) {
             $_SESSION['ldap_import']['authldaps_id'] = NOT_AVAILABLE;
         }
         if (!Config::canUpdate() && !Entity::canUpdate() || !isset($_SESSION['ldap_import']['interface']) && !isset($options['interface'])) {
             $options['interface'] = self::SIMPLE_INTERFACE;
         }
         foreach ($fields as $field) {
             if (isset($options[$field])) {
                 $_SESSION['ldap_import'][$field] = $options[$field];
             }
         }
         if (isset($_SESSION['ldap_import']['begin_date']) && $_SESSION['ldap_import']['begin_date'] == 'NULL') {
             $_SESSION['ldap_import']['begin_date'] = '';
         }
         if (isset($_SESSION['ldap_import']['end_date']) && $_SESSION['ldap_import']['end_date'] == 'NULL') {
             $_SESSION['ldap_import']['end_date'] = '';
         }
         if (!isset($_SESSION['ldap_import']['criterias'])) {
             $_SESSION['ldap_import']['criterias'] = array();
         }
         $authldap = new self();
         //Filter computation
         if ($_SESSION['ldap_import']['interface'] == self::SIMPLE_INTERFACE) {
             $entity = new Entity();
             if ($entity->getFromDB($_SESSION['ldap_import']['entities_id']) && $entity->getField('authldaps_id') > 0) {
                 $authldap->getFromDB($_SESSION['ldap_import']['authldaps_id']);
                 $_SESSION['ldap_import']['authldaps_id'] = $entity->getField('authldaps_id');
                 $_SESSION['ldap_import']['basedn'] = $entity->getField('ldap_dn');
                 // No dn specified in entity : use standard one
                 if (empty($_SESSION['ldap_import']['basedn'])) {
                     $_SESSION['ldap_import']['basedn'] = $authldap->getField('basedn');
                 }
                 if ($entity->getField('entity_ldapfilter') != NOT_AVAILABLE) {
                     $_SESSION['ldap_import']['entity_filter'] = $entity->getField('entity_ldapfilter');
                 }
             } else {
                 $_SESSION['ldap_import']['authldaps_id'] = self::getDefault();
                 if ($_SESSION['ldap_import']['authldaps_id'] > 0) {
                     $authldap->getFromDB($_SESSION['ldap_import']['authldaps_id']);
                     $_SESSION['ldap_import']['basedn'] = $authldap->getField('basedn');
                 }
             }
             if ($_SESSION['ldap_import']['authldaps_id'] > 0) {
                 $_SESSION['ldap_import']['ldap_filter'] = self::buildLdapFilter($authldap);
             }
         } else {
             if ($_SESSION['ldap_import']['authldaps_id'] == NOT_AVAILABLE || !$_SESSION['ldap_import']['authldaps_id']) {
                 $_SESSION['ldap_import']['authldaps_id'] = self::getDefault();
                 if ($_SESSION['ldap_import']['authldaps_id'] > 0) {
                     $authldap->getFromDB($_SESSION['ldap_import']['authldaps_id']);
                     $_SESSION['ldap_import']['basedn'] = $authldap->getField('basedn');
                 }
             }
             if (!isset($_SESSION['ldap_import']['ldap_filter']) || $_SESSION['ldap_import']['ldap_filter'] == '') {
                 $authldap->getFromDB($_SESSION['ldap_import']['authldaps_id']);
                 $_SESSION['ldap_import']['basedn'] = $authldap->getField('basedn');
                 $_SESSION['ldap_import']['ldap_filter'] = self::buildLdapFilter($authldap);
             }
         }
         //Unset all values in session
     } else {
         unset($_SESSION['ldap_import']);
     }
 }
Example #30
0
 /**
  * Display a line for a ticket
  *
  * @param $id                 Integer  ID of the ticket
  * @param $followups          Boolean  show followup columns
  * @param $output_type        Integer  type of output (default Search::HTML_OUTPUT)
  * @param $row_num            Integer  row number (default 0)
  * @param $id_for_massaction  Integer  default 0 means no massive action (default 0)
  *
  */
 static function showShort($id, $followups, $output_type = Search::HTML_OUTPUT, $row_num = 0, $id_for_massaction = 0)
 {
     global $CFG_GLPI;
     $rand = mt_rand();
     /// TODO to be cleaned. Get datas and clean display links
     // Prints a job in short form
     // Should be called in a <table>-segment
     // Print links or not in case of user view
     // Make new job object and fill it from database, if success, print it
     $job = new self();
     $candelete = Session::haveRight("delete_ticket", "1");
     $canupdate = Session::haveRight("update_ticket", "1");
     $showprivate = Session::haveRight("show_full_ticket", "1");
     $align = "class='center";
     $align_desc = "class='left";
     if ($followups) {
         $align .= " top'";
         $align_desc .= " top'";
     } else {
         $align .= "'";
         $align_desc .= "'";
     }
     if ($job->getFromDB($id)) {
         $item_num = 1;
         $bgcolor = $_SESSION["glpipriority_" . $job->fields["priority"]];
         echo Search::showNewLine($output_type, $row_num % 2);
         $check_col = '';
         if (($candelete || $canupdate) && $output_type == Search::HTML_OUTPUT && $id_for_massaction) {
             $check_col = Html::getMassiveActionCheckBox(__CLASS__, $id_for_massaction);
         }
         echo Search::showItem($output_type, $check_col, $item_num, $row_num, $align);
         // First column
         $first_col = sprintf(__('%1$s: %2$s'), __('ID'), $job->fields["id"]);
         if ($output_type == Search::HTML_OUTPUT) {
             $first_col .= "<br><img src='" . self::getStatusIconURL($job->fields["status"]) . "'\n                                alt=\"" . self::getStatus($job->fields["status"]) . "\" title=\"" . self::getStatus($job->fields["status"]) . "\">";
         } else {
             $first_col = sprintf(__('%1$s - %2$s'), $first_col, self::getStatus($job->fields["status"]));
         }
         echo Search::showItem($output_type, $first_col, $item_num, $row_num, $align);
         // Second column
         if ($job->fields['status'] == self::CLOSED) {
             $second_col = sprintf(__('Closed on %s'), ($output_type == Search::HTML_OUTPUT ? '<br>' : '') . Html::convDateTime($job->fields['closedate']));
         } else {
             if ($job->fields['status'] == self::SOLVED) {
                 $second_col = sprintf(__('Solved on %s'), ($output_type == Search::HTML_OUTPUT ? '<br>' : '') . Html::convDateTime($job->fields['solvedate']));
             } else {
                 if ($job->fields['begin_waiting_date']) {
                     $second_col = sprintf(__('Put on hold on %s'), ($output_type == Search::HTML_OUTPUT ? '<br>' : '') . Html::convDateTime($job->fields['begin_waiting_date']));
                 } else {
                     if ($job->fields['due_date']) {
                         $second_col = sprintf(__('%1$s: %2$s'), __('Due date'), ($output_type == Search::HTML_OUTPUT ? '<br>' : '') . Html::convDateTime($job->fields['due_date']));
                     } else {
                         $second_col = sprintf(__('Opened on %s'), ($output_type == Search::HTML_OUTPUT ? '<br>' : '') . Html::convDateTime($job->fields['date']));
                     }
                 }
             }
         }
         echo Search::showItem($output_type, $second_col, $item_num, $row_num, $align . " width=130");
         // Second BIS column
         $second_col = Html::convDateTime($job->fields["date_mod"]);
         echo Search::showItem($output_type, $second_col, $item_num, $row_num, $align . " width=90");
         // Second TER column
         if (count($_SESSION["glpiactiveentities"]) > 1) {
             $second_col = Dropdown::getDropdownName('glpi_entities', $job->fields['entities_id']);
             echo Search::showItem($output_type, $second_col, $item_num, $row_num, $align . " width=100");
         }
         // Third Column
         echo Search::showItem($output_type, "<span class='b'>" . parent::getPriorityName($job->fields["priority"]) . "</span>", $item_num, $row_num, "{$align} bgcolor='{$bgcolor}'");
         // Fourth Column
         $fourth_col = "";
         if (isset($job->users[CommonITILActor::REQUESTER]) && count($job->users[CommonITILActor::REQUESTER])) {
             foreach ($job->users[CommonITILActor::REQUESTER] as $d) {
                 $userdata = getUserName($d["users_id"], 2);
                 $fourth_col .= sprintf(__('%1$s %2$s'), "<span class='b'>" . $userdata['name'] . "</span>", Html::showToolTip($userdata["comment"], array('link' => $userdata["link"], 'display' => false)));
                 $fourth_col .= "<br>";
             }
         }
         if (isset($job->groups[CommonITILActor::REQUESTER]) && count($job->groups[CommonITILActor::REQUESTER])) {
             foreach ($job->groups[CommonITILActor::REQUESTER] as $d) {
                 $fourth_col .= Dropdown::getDropdownName("glpi_groups", $d["groups_id"]);
                 $fourth_col .= "<br>";
             }
         }
         echo Search::showItem($output_type, $fourth_col, $item_num, $row_num, $align);
         // Fifth column
         $fifth_col = "";
         if (isset($job->users[CommonITILActor::ASSIGN]) && count($job->users[CommonITILActor::ASSIGN])) {
             foreach ($job->users[CommonITILActor::ASSIGN] as $d) {
                 $userdata = getUserName($d["users_id"], 2);
                 $fifth_col .= sprintf(__('%1$s %2$s'), "<span class='b'>" . $userdata['name'] . "</span>", Html::showToolTip($userdata["comment"], array('link' => $userdata["link"], 'display' => false)));
                 $fifth_col .= "<br>";
             }
         }
         if (isset($job->groups[CommonITILActor::ASSIGN]) && count($job->groups[CommonITILActor::ASSIGN])) {
             foreach ($job->groups[CommonITILActor::ASSIGN] as $d) {
                 $fifth_col .= Dropdown::getDropdownName("glpi_groups", $d["groups_id"]);
                 $fifth_col .= "<br>";
             }
         }
         if (isset($job->suppliers[CommonITILActor::ASSIGN]) && count($job->suppliers[CommonITILActor::ASSIGN])) {
             foreach ($job->suppliers[CommonITILActor::ASSIGN] as $d) {
                 $fifth_col .= Dropdown::getDropdownName("glpi_suppliers", $d["suppliers_id"]);
                 $fifth_col .= "<br>";
             }
         }
         echo Search::showItem($output_type, $fifth_col, $item_num, $row_num, $align);
         // Sixth Colum
         $sixth_col = "";
         $is_deleted = false;
         if (!empty($job->fields["itemtype"]) && $job->fields["items_id"] > 0) {
             if ($item = getItemForItemtype($job->fields["itemtype"])) {
                 if ($item->getFromDB($job->fields["items_id"])) {
                     $is_deleted = $item->isDeleted();
                     $sixth_col .= $item->getTypeName();
                     $sixth_col .= "<br><span class='b'>";
                     if ($item->canView()) {
                         $sixth_col .= $item->getLink(array('linkoption' => $output_type == Search::HTML_OUTPUT));
                     } else {
                         $sixth_col .= $item->getNameID();
                     }
                     $sixth_col .= "</span>";
                 }
             }
         } else {
             if (empty($job->fields["itemtype"])) {
                 $sixth_col = __('General');
             }
         }
         echo Search::showItem($output_type, $sixth_col, $item_num, $row_num, $is_deleted ? " class='center deleted' " : $align);
         // Seventh column
         echo Search::showItem($output_type, "<span class='b'>" . Dropdown::getDropdownName('glpi_itilcategories', $job->fields["itilcategories_id"]) . "</span>", $item_num, $row_num, $align);
         // Eigth column
         $eigth_column = "<span class='b'>" . $job->fields["name"] . "</span>&nbsp;";
         // Add link
         if ($job->canViewItem()) {
             $eigth_column = "<a id='ticket" . $job->fields["id"] . "{$rand}' href=\"" . $CFG_GLPI["root_doc"] . "/front/ticket.form.php?id=" . $job->fields["id"] . "\">{$eigth_column}</a>";
             if ($followups && $output_type == Search::HTML_OUTPUT) {
                 $eigth_column .= TicketFollowup::showShortForTicket($job->fields["id"]);
             } else {
                 $eigth_column = sprintf(__('%1$s (%2$s)'), $eigth_column, sprintf(__('%1$s - %2$s'), $job->numberOfFollowups($showprivate), $job->numberOfTasks($showprivate)));
             }
         }
         if ($output_type == Search::HTML_OUTPUT) {
             $eigth_column = sprintf(__('%1$s %2$s'), $eigth_column, Html::showToolTip($job->fields['content'], array('display' => false, 'applyto' => "ticket" . $job->fields["id"] . $rand)));
         }
         echo Search::showItem($output_type, $eigth_column, $item_num, $row_num, $align_desc . "width='300'");
         // Finish Line
         echo Search::showEndLine($output_type);
     } else {
         echo "<tr class='tab_bg_2'>";
         echo "<td colspan='6' ><i>" . __('No ticket in progress.') . "</i></td></tr>";
     }
 }