Beispiel #1
0
This file is part of Resources.

Resources is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

Resources 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 Resources. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
include '../../../inc/includes.php';
Html::header(PluginResourcesResource::getTypeName(2), '', "plugins", "resources", "employment");
$employment = new PluginResourcesEmployment();
if ($employment->canView() || Session::haveRight("config", "w")) {
    Search::manageGetValues("PluginResourcesEmployment");
    if (isset($_GET["plugin_resources_resources_id"]) && !empty($_GET["plugin_resources_resources_id"])) {
        $_GET["field"] = array(0 => "13");
        $_GET["contains"] = array(0 => $_GET["plugin_resources_resources_id"]);
    }
    Search::showGenericSearch("PluginResourcesEmployment", $_GET);
    Search::showList("PluginResourcesEmployment", $_GET);
} else {
    Html::displayRightError();
}
Html::footer();
 showTitle($output_type, $num, __('Administrative number'), 'registration_number', true);
 showTitle($output_type, $num, PluginResourcesProfession::getTypeName(1), 'profession', true);
 showTitle($output_type, $num, __('Arrival date', 'resources'), 'date_begin', true);
 showTitle($output_type, $num, __('Departure date', 'resources'), 'date_end', true);
 showTitle($output_type, $num, PluginResourcesProfession::getTypeName(1) . " - " . __('Begin date'), 'begin_date', true);
 showTitle($output_type, $num, PluginResourcesProfession::getTypeName(1) . " - " . __('End date'), 'end_date', true);
 echo Search::showEndLine($output_type);
 if ($limit) {
     $dataAll = array_slice($dataAll, $start, $limit);
 }
 foreach ($dataAll as $key => $data) {
     $num = 1;
     echo Search::showNewLine($output_type);
     echo Search::showItem($output_type, Dropdown::getDropdownName('glpi_entities', $data['entity']), $num, $key);
     if ($data['typeName'] == 'Resource') {
         $type = PluginResourcesResource::getTypeName(0);
         $link = Toolbox::getItemTypeFormURL("PluginResourcesResource");
     } else {
         if ($data['typeName'] == 'Employment') {
             $type = PluginResourcesEmployment::getTypeName(0);
             $link = Toolbox::getItemTypeFormURL("PluginResourcesEmployment");
         }
     }
     echo Search::showItem($output_type, $type, $num, $key);
     $name = "<a href='" . $link . "?id=" . $data["ID"] . "' target='_blank'>";
     if ($data["name"] == NULL) {
         $name .= "(" . $data["ID"] . ")";
     } else {
         $name .= $data["name"];
     }
     $name .= "</a>";
Beispiel #3
0
    Html::back();
} else {
    if (isset($_POST["update"])) {
        $budget->check($_POST["id"], 'w');
        $budget->update($_POST);
        Html::back();
    } else {
        if (isset($_POST["delete"])) {
            $budget->check($_POST["id"], 'w');
            $budget->delete($_POST);
            $budget->redirectToList();
        } else {
            if (isset($_POST["purge"])) {
                $budget->check($_POST['id'], 'w');
                $budget->delete($_POST, 1);
                $budget->redirectToList();
            } else {
                if (isset($_POST["restore"])) {
                    $budget->check($_POST["id"], 'w');
                    $budget->restore($_POST);
                    $budget->redirectToList();
                } else {
                    $budget->checkGlobal("r");
                    Html::header(PluginResourcesResource::getTypeName(2), '', "plugins", "resources", "budget");
                    $budget->showForm($_GET["id"]);
                    Html::footer();
                }
            }
        }
    }
}
} else {
    if (isset($_POST["delete"])) {
        $checklistconfig->check($_POST['id'], 'w');
        $checklistconfig->delete($_POST);
        $checklistconfig->redirectToList();
    } else {
        if (isset($_POST["restore"])) {
            $checklistconfig->check($_POST['id'], 'w');
            $checklistconfig->restore($_POST);
            $checklistconfig->redirectToList();
        } else {
            if (isset($_POST["purge"])) {
                $checklistconfig->check($_POST['id'], 'w');
                $checklistconfig->delete($_POST, 1);
                $checklistconfig->redirectToList();
            } else {
                if (isset($_POST["update"])) {
                    $checklistconfig->check($_POST['id'], 'w');
                    $checklistconfig->update($_POST);
                    Html::back();
                } else {
                    $checklistconfig->checkGlobal("r");
                    Html::header(PluginResourcesResource::getTypeName(2), '', "plugins", "resources", "checklist");
                    $options = array();
                    $checklistconfig->showForm($_GET["id"], $options);
                    Html::footer();
                }
            }
        }
    }
}
 function showForm($ID, $options = array())
 {
     global $CFG_GLPI;
     $this->initForm($ID, $options);
     echo "<div align='center'>";
     echo "<form method='post' action=\"" . $CFG_GLPI["root_doc"] . "/plugins/resources/front/resourceresting.form.php\">";
     echo "<table class='plugin_resources_wizard' style='margin-top:1px;'>";
     echo "<tr>";
     echo "<td class='plugin_resources_wizard_left_area' valign='top'>";
     echo "<div class='plugin_resources_presentation_logo'>";
     echo "<img src='../pics/newresting.png' alt='newresting' /></div>";
     echo "</td>";
     echo "<td class='plugin_resources_wizard_right_area' style='width:500px' valign='top'>";
     $title = __('Declare a non contract period', 'resources');
     if ($ID > 0) {
         $title = __('Detail of non contract period', 'resources');
     }
     echo "<div class='plugin_resources_wizard_title'>";
     echo $title;
     echo "</div>";
     echo "<table>";
     echo "<tr class='plugin_resources_wizard_explain'>";
     echo "<td>" . PluginResourcesResource::getTypeName(1) . "</td>";
     echo "<td class='left'>";
     PluginResourcesResource::dropdown(array('name' => 'plugin_resources_resources_id', 'value' => $this->fields["plugin_resources_resources_id"], 'entity' => $_SESSION['glpiactiveentities']));
     echo "</td></tr>";
     echo "<tr class='plugin_resources_wizard_explain'><td>";
     echo __('Begin date') . "</td>";
     echo "<td class='left'>";
     Html::showDateFormItem("date_begin", $this->fields["date_begin"], true, true);
     echo "</td></tr>";
     echo "<tr class='plugin_resources_wizard_explain'><td>";
     echo __('End date') . "</td>";
     echo "<td class='left'>";
     Html::showDateFormItem("date_end", $this->fields["date_end"], true, true);
     echo "</td></tr>";
     echo "<tr class='plugin_resources_wizard_explain'><td>";
     echo __('Agency concerned', 'resources') . "</td>";
     echo "<td class='left'>";
     Dropdown::show('Location', array('value' => $this->fields["locations_id"]));
     echo "</td></tr>";
     echo "<tr class='plugin_resources_wizard_explain'><td>";
     echo __('At home', 'resources') . "</td>";
     echo "<td class='left'>";
     Dropdown::showYesNo('at_home', $this->fields['at_home']);
     echo "</td>";
     echo "</tr>";
     echo "<tr class='plugin_resources_wizard_explain'><td colspan='2'>";
     echo __('Comments') . "</td></tr>";
     echo "<tr class='plugin_resources_wizard_explain'><td colspan='2'>";
     echo "<textarea cols='70' rows='4' name='comment' >" . $this->fields["comment"] . "</textarea>";
     echo "</td></tr>";
     echo "</table>";
     echo "</div></td>";
     echo "</tr>";
     echo "<tr><td class='plugin_resources_wizard_button' colspan='2'>";
     echo "<div class='preview'>";
     echo "<a href=\"./resourceresting.form.php\">";
     _e('Declare a non contract period', 'resources');
     echo "</a>";
     echo "&nbsp;/&nbsp;<a href=\"./resourceresting.php\">";
     _e('List of non contract periods', 'resources');
     echo "</a>";
     echo "</div>";
     echo "<div class='next'>";
     if ($ID > 0) {
         echo "<input type='hidden' name='id' value='" . $ID . "' />";
         echo "<input type='hidden' name='plugin_resources_resources_id' value='" . $this->fields["plugin_resources_resources_id"] . "' />";
         echo "<input type='submit' name='updaterestingresources' value=\"" . _sx('button', 'Update') . "\" class='submit' />";
         echo "&nbsp;&nbsp;<input type='submit' name='deleterestingresources' value=\"" . _sx('button', 'Delete permanently') . "\" class='submit' />";
     } else {
         echo "<input type='submit' name='addrestingresources' value='" . _sx('button', 'Add') . "' class='submit' />";
     }
     echo "</div>";
     echo "</td></tr></table>";
     Html::closeForm();
     echo "</div>";
 }
 /**
  * Show items links to a resource
  *
  * @since version 0.84
  *
  * @param $resource PluginResourcesResource object
  *
  * @return nothing (HTML display)
  **/
 public static function showForResource(PluginResourcesResource $resource, $withtemplate = '')
 {
     global $DB, $CFG_GLPI;
     $instID = $resource->fields['id'];
     if (!$resource->can($instID, 'r')) {
         return false;
     }
     $rand = mt_rand();
     $canedit = $resource->can($instID, 'w');
     if (empty($withtemplate)) {
         $withtemplate = 0;
     }
     $types = PluginResourcesResource::getTypes();
     $plugin = new Plugin();
     if ($plugin->isActivated("badges")) {
         $types[] = 'PluginBadgesBadge';
     }
     $query = "SELECT DISTINCT `itemtype` \n          FROM `glpi_plugin_resources_resources_items` \n          WHERE `plugin_resources_resources_id` = '{$instID}' \n          ORDER BY `itemtype` \n          LIMIT " . count($types);
     $result = $DB->query($query);
     $number = $DB->numrows($result);
     if (Session::isMultiEntitiesMode()) {
         $colsup = 1;
     } else {
         $colsup = 0;
     }
     if ($canedit && $withtemplate < 2 && $number < 1) {
         echo "<div class='firstbloc'>";
         echo "<form method='post' name='resource_form{$rand}' id='resource_form{$rand}'\n         action='" . Toolbox::getItemTypeFormURL("PluginResourcesResource") . "'>";
         echo "<table class='tab_cadre_fixe'>";
         echo "<tr class='tab_bg_2'><th colspan='" . ($canedit ? 5 + $colsup : 4 + $colsup) . "'>" . __('Add a user') . "</th></tr>";
         echo "<tr class='tab_bg_1'><td colspan='" . (3 + $colsup) . "' class='center'>";
         echo "<input type='hidden' name='plugin_resources_resources_id' value='{$instID}'>";
         echo "<input type='hidden' name='itemtype' value='User'>";
         //Dropdown::showAllItems("items_id",0,0,($resource->fields['is_recursive']?-1:$resource->fields['entities_id']),$types);
         User::dropdown(array('name' => 'items_id', 'entity' => $resource->fields["entities_id"], 'right' => 'all', 'ldap_import' => true));
         echo "</td>";
         echo "<td colspan='2' class='tab_bg_2'>";
         echo "<input type='submit' name='additem' value=\"" . _sx('button', 'Add') . "\" class='submit'>";
         echo "</td></tr>";
         echo "</table>";
         Html::closeForm();
         echo "</div>";
     }
     echo "<div class='spaced'>";
     if ($canedit && $number && $withtemplate < 2) {
         Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
         $massiveactionparams = array();
         Html::showMassiveActions(__CLASS__, $massiveactionparams);
     }
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr>";
     if ($canedit && $number && $withtemplate < 2) {
         echo "<th width='10'>" . Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand) . "</th>";
     }
     echo "<th>" . __('Type') . "</th>";
     echo "<th>" . __('Name') . "</th>";
     if (Session::isMultiEntitiesMode()) {
         echo "<th>" . __('Entity') . "</th>";
     }
     echo "<th>" . __('Serial Number') . "</th>";
     echo "<th>" . __('Inventory number') . "</th>";
     echo "</tr>";
     for ($i = 0; $i < $number; $i++) {
         $itemType = $DB->result($result, $i, "itemtype");
         if (!($item = getItemForItemtype($itemType))) {
             continue;
         }
         if ($item->canView()) {
             $column = "name";
             $itemTable = getTableForItemType($itemType);
             $query = "SELECT `" . $itemTable . "`.*,\n                             `glpi_plugin_resources_resources_items`.`id` AS items_id,\n                             `glpi_plugin_resources_resources_items`.`comment` AS comment,\n                             `glpi_entities`.`id` AS entity " . " FROM `glpi_plugin_resources_resources_items`, `" . $itemTable . "` LEFT JOIN `glpi_entities` ON (`glpi_entities`.`id` = `" . $itemTable . "`.`entities_id`) " . " WHERE `" . $itemTable . "`.`id` = `glpi_plugin_resources_resources_items`.`items_id`\n                AND `glpi_plugin_resources_resources_items`.`itemtype` = '{$itemType}'\n                AND `glpi_plugin_resources_resources_items`.`plugin_resources_resources_id` = '{$instID}' ";
             if ($itemType != 'User') {
                 $query .= getEntitiesRestrictRequest(" AND ", $itemTable, '', '', $item->maybeRecursive());
             }
             if ($item->maybeTemplate()) {
                 $query .= " AND `" . $itemTable . "`.`is_template` = '0'";
             }
             $query .= " ORDER BY `glpi_entities`.`completename`, `" . $itemTable . "`.`{$column}`";
             if ($result_linked = $DB->query($query)) {
                 if ($DB->numrows($result_linked)) {
                     Session::initNavigateListItems($itemType, PluginResourcesResource::getTypeName(2) . " = " . $resource->fields['name']);
                     while ($data = $DB->fetch_assoc($result_linked)) {
                         $item->getFromDB($data["id"]);
                         Session::addToNavigateListItems($itemType, $data["id"]);
                         $ID = "";
                         if ($itemType == 'User') {
                             $format = formatUserName($data["id"], $data["name"], $data["realname"], $data["firstname"], 1);
                         } else {
                             $format = $data["name"];
                         }
                         if ($_SESSION["glpiis_ids_visible"] || empty($data["name"])) {
                             $ID = " (" . $data["id"] . ")";
                         }
                         $link = Toolbox::getItemTypeFormURL($itemType);
                         $name = "<a href=\"" . $link . "?id=" . $data["id"] . "\">" . $format;
                         if ($itemType != 'User') {
                             $name .= "&nbsp;" . $ID;
                         }
                         $name .= "</a>";
                         echo "<tr class='tab_bg_1'>";
                         $items_id = $data["items_id"];
                         if ($canedit && $withtemplate < 2) {
                             echo "<td width='10'>";
                             Html::showMassiveActionCheckBox(__CLASS__, $data["items_id"]);
                             /*TODO resolve IT or drop IT ?
                               echo "<img src='".$CFG_GLPI["root_doc"]."/pics/expand.gif' onclick=\"plugin_resources_show_item('comment$items_id$rand',this,'".$CFG_GLPI["root_doc"]."/pics/collapse.gif');\">";*/
                             echo "</td>";
                         }
                         echo "<td class='center'>" . $item::getTypeName(1) . "</td>";
                         echo "<td class='center' " . (isset($data['is_deleted']) && $data['is_deleted'] ? "class='tab_bg_2_2'" : "") . ">" . $name . "</td>";
                         if (Session::isMultiEntitiesMode()) {
                             if ($itemType != 'User') {
                                 echo "<td class='center'>" . Dropdown::getDropdownName("glpi_entities", $data['entity']) . "</td>";
                             } else {
                                 echo "<td class='center'>-</td>";
                             }
                         }
                         echo "<td class='center'>" . (isset($data["serial"]) ? "" . $data["serial"] . "" : "-") . "</td>";
                         echo "<td class='center'>" . (isset($data["otherserial"]) ? "" . $data["otherserial"] . "" : "-") . "</td>";
                         echo "</tr>";
                         /*TODO resolve IT or drop IT ?
                           echo "<tr class='tab_bg_1'>";
                           
                           $class = "class='plugin_resources_show'";
                           
                           if (!isset($data["comment"]) || empty($data["comment"])) {
                              $data["comment"]='';
                              $class = "class='plugin_resources_hide'";
                           }
                           echo "<td colspan='6' id='comment$items_id$rand' $class >";
                           
                           echo "<form method='post' name='updatecomment$items_id$rand' id='updatecomment$items_id$rand' action='".Toolbox::getItemTypeFormURL("PluginResourcesResource")."'>";
                           echo "<table><tr><td>";
                           _e('Comments');
                           echo "<br><textarea cols='150' rows='5' name='comment$items_id' >";
                           echo $data["comment"];
                           echo "</textarea><br><br>";
                           echo "<input type='hidden' name='items_id' value='".$data["items_id"]."'>";
                           if($canedit && $withtemplate<2) {
                              if (!isset($data["comment"]) || empty($data["comment"])) {
                                 
                                 echo "<input type='submit' name='updatecomment[".$items_id."]' value=\""._sx('button','Add')."\" class='submit'>";
                              } else {
                                 echo "<input type='submit' name='updatecomment[".$items_id."]' value=\""._sx('button','Update')."\" class='submit'>";
                              }			
                           }
                           echo "</td>";
                           echo "</tr>";
                           echo "</table>";
                           Html::closeForm();
                           
                           echo "</td>";
                           echo "</tr>";*/
                     }
                 }
             }
         }
     }
     echo "</table>";
     if ($canedit && $number && $withtemplate < 2) {
         $paramsma['ontop'] = false;
         Html::showMassiveActions(__CLASS__, $paramsma);
         Html::closeForm();
     }
     echo "</div>";
 }
 static function showReports($ID, $withtemplate = '')
 {
     global $DB, $CFG_GLPI;
     $rand = mt_rand();
     $resource = new PluginResourcesResource();
     $resource->getFromDB($ID);
     $canedit = $resource->can($ID, 'w');
     Session::initNavigateListItems("PluginResourcesReportConfig", PluginResourcesResource::getTypeName(1) . " = " . $resource->fields["name"]);
     $query = "SELECT `glpi_plugin_resources_reportconfigs`.`id`,\n               `glpi_plugin_resources_reportconfigs`.`plugin_resources_resources_id`,\n                `glpi_plugin_resources_reportconfigs`.`information`, \n                `glpi_plugin_resources_reportconfigs`.`comment`\n                 FROM `glpi_plugin_resources_reportconfigs` ";
     $query .= " LEFT JOIN `glpi_plugin_resources_resources` ON (`glpi_plugin_resources_resources`.`id` = `glpi_plugin_resources_reportconfigs`.`plugin_resources_resources_id`)";
     $query .= " WHERE `glpi_plugin_resources_reportconfigs`.`plugin_resources_resources_id` = '{$ID}'";
     $result = $DB->query($query);
     $number = $DB->numrows($result);
     $i = 0;
     $row_num = 1;
     if ($number != "0") {
         if ($withtemplate < 2) {
             echo "<form method='post' name='form_reports{$rand}' id='form_reports{$rand}' action=\"./reportconfig.form.php\">";
         }
         echo "<div align='center'><table class='tab_cadre_fixe'>";
         echo "<tr><th colspan='5'>" . self::getTypeName(1) . "</th></tr>";
         $sel = "";
         if (isset($_GET["select"]) && $_GET["select"] == "all") {
             $sel = "checked";
         }
         echo "<tr>";
         if (plugin_resources_haveRight('resources', 'w') && $canedit && $withtemplate < 2) {
             echo "<th>&nbsp;</th>";
         }
         echo "<th>" . __('Comments') . "</th>";
         echo "<th>" . __('Information', 'Informations', 2) . "</th>";
         if ($withtemplate < 2) {
             echo "<th>&nbsp;</th>";
         }
         echo "</tr>";
         while ($data = $DB->fetch_array($result)) {
             Session::addToNavigateListItems("PluginResourcesReportConfig", $data['id']);
             $i++;
             $row_num++;
             echo "<tr class='tab_bg_1 center'>";
             if (plugin_resources_haveRight('resources', 'w') && $canedit && $withtemplate < 2) {
                 echo "<td width='10'>";
                 echo "<input type='checkbox' name='check[" . $data["id"] . "]'";
                 if (isset($_POST['check']) && $_POST['check'] == 'all') {
                     echo " checked ";
                 }
                 echo ">";
                 echo "</td>";
             }
             echo "<td class='left'>" . nl2br($data["comment"]) . "</td>";
             echo "<td class='left'>" . nl2br($data["information"]) . "</td>";
             if ($withtemplate < 2) {
                 echo "<td class='center'>";
                 echo "<a href='" . $CFG_GLPI["root_doc"] . "/plugins/resources/front/reportconfig.form.php?id=" . $data["id"] . "&amp;plugin_resources_resources_id=" . $data["plugin_resources_resources_id"] . "'>";
                 _e('Update');
                 if ($_SESSION["glpiis_ids_visible"]) {
                     echo " (" . $data["id"] . ")";
                 }
                 echo "</a></td>";
             }
             echo "</tr>";
         }
         echo "</table></div>";
         if ($number && $canedit && $withtemplate < 2) {
             if (plugin_resources_haveRight('resources', 'w')) {
                 Html::openArrowMassives("form_reports{$rand}", true);
                 Html::closeArrowMassives(array('delete_report' => _sx('button', 'Delete permanently')));
             }
         }
         if ($withtemplate < 2) {
             Html::closeForm();
         }
     }
 }
 function getDatasForTemplate($event, $options = array())
 {
     global $CFG_GLPI, $DB;
     if ($event == 'AlertExpiredTasks') {
         $this->datas['##resource.entity##'] = Dropdown::getDropdownName('glpi_entities', $options['entities_id']);
         $this->datas['##lang.resource.entity##'] = __('Entity');
         $this->datas['##resource.action##'] = __('List of not finished tasks', 'resources');
         $this->datas['##lang.task.name##'] = __('Name');
         $this->datas['##lang.task.type##'] = __('Type');
         $this->datas['##lang.task.users##'] = __('Technician');
         $this->datas['##lang.task.groups##'] = __('Group');
         $this->datas['##lang.task.datebegin##'] = __('Begin date');
         $this->datas['##lang.task.dateend##'] = __('End date');
         $this->datas['##lang.task.planned##'] = __('Used for planning', 'resources');
         $this->datas['##lang.task.realtime##'] = __('Effective duration', 'resources');
         $this->datas['##lang.task.finished##'] = __('Carried out task', 'resources');
         $this->datas['##lang.task.comment##'] = __('Comments');
         $this->datas['##lang.task.resource##'] = PluginResourcesResource::getTypeName(1);
         foreach ($options['tasks'] as $id => $task) {
             $tmp = array();
             $tmp['##task.name##'] = $task['name'];
             $tmp['##task.type##'] = Dropdown::getDropdownName('glpi_plugin_resources_tasktypes', $task['plugin_resources_tasktypes_id']);
             $tmp['##task.users##'] = Html::clean(getUserName($task['users_id']));
             $tmp['##task.groups##'] = Dropdown::getDropdownName('glpi_groups', $task['groups_id']);
             $restrict = " `plugin_resources_tasks_id` = '" . $task['id'] . "' ";
             $plans = getAllDatasFromTable("glpi_plugin_resources_taskplannings", $restrict);
             if (!empty($plans)) {
                 foreach ($plans as $plan) {
                     $tmp['##task.datebegin##'] = Html::convDateTime($plan["begin"]);
                     $tmp['##task.dateend##'] = Html::convDateTime($plan["end"]);
                 }
             } else {
                 $tmp['##task.datebegin##'] = '';
                 $tmp['##task.dateend##'] = '';
             }
             $tmp['##task.planned##'] = '';
             $tmp['##task.finished##'] = Dropdown::getYesNo($task['is_finished']);
             $tmp['##task.realtime##'] = Ticket::getActionTime($task["actiontime"]);
             $comment = stripslashes(str_replace(array('\\r\\n', '\\n', '\\r'), "<br/>", $task['comment']));
             $tmp['##task.comment##'] = Html::clean($comment);
             $tmp['##task.resource##'] = Dropdown::getDropdownName('glpi_plugin_resources_resources', $task['plugin_resources_resources_id']);
             $this->datas['tasks'][] = $tmp;
         }
     } else {
         if ($event == 'AlertLeavingResources') {
             $this->datas['##resource.entity##'] = Dropdown::getDropdownName('glpi_entities', $options['entities_id']);
             $this->datas['##lang.resource.entity##'] = __('Entity');
             $this->datas['##resource.action##'] = __('These resources have normally left the company', 'resources');
             $this->datas['##lang.resource.id##'] = "ID";
             $this->datas['##lang.resource.name##'] = __('Name');
             $this->datas['##lang.resource.firstname##'] = __('First name');
             $this->datas['##lang.resource.type##'] = PluginResourcesContractType::getTypeName(1);
             $this->datas['##lang.resource.users##'] = __('Resource manager', 'resources');
             $this->datas['##lang.resource.usersrecipient##'] = __('Requester');
             $this->datas['##lang.resource.datedeclaration##'] = __('Request date');
             $this->datas['##lang.resource.datebegin##'] = __('Arrival date', 'resources');
             $this->datas['##lang.resource.dateend##'] = __('Departure date', 'resources');
             $this->datas['##lang.resource.department##'] = PluginResourcesDepartment::getTypeName(1);
             $this->datas['##lang.resource.status##'] = PluginResourcesResourceState::getTypeName(1);
             $this->datas['##lang.resource.location##'] = __('Location');
             $this->datas['##lang.resource.comment##'] = __('Description');
             $this->datas['##lang.resource.usersleaving##'] = __('Informant of leaving', 'resources');
             $this->datas['##lang.resource.leaving##'] = __('Declared as leaving', 'resources');
             $this->datas['##lang.resource.leavingreason##'] = PluginResourcesLeavingReason::getTypeName(1);
             $this->datas['##lang.resource.helpdesk##'] = __('Associable to a ticket');
             $this->datas['##lang.resource.url##'] = __('URL');
             foreach ($options['resources'] as $id => $resource) {
                 $tmp = array();
                 $tmp['##resource.name##'] = $resource['name'];
                 $tmp['##resource.firstname##'] = $resource['firstname'];
                 $tmp['##resource.type##'] = Dropdown::getDropdownName('glpi_plugin_resources_contracttypes', $resource['plugin_resources_contracttypes_id']);
                 $tmp['##resource.users##'] = Html::clean(getUserName($resource['users_id']));
                 $tmp['##resource.usersrecipient##'] = Html::clean(getUserName($resource['users_id_recipient']));
                 $tmp['##resource.datedeclaration##'] = Html::convDateTime($resource['date_declaration']);
                 $tmp['##resource.datebegin##'] = Html::convDateTime($resource['date_begin']);
                 $tmp['##resource.dateend##'] = Html::convDateTime($resource['date_end']);
                 $tmp['##resource.department##'] = Dropdown::getDropdownName('glpi_plugin_resources_departments', $resource['plugin_resources_departments_id']);
                 $tmp['##resource.status##'] = Dropdown::getDropdownName('glpi_plugin_resources_resourcestates', $resource['plugin_resources_resourcestates_id']);
                 $tmp['##resource.location##'] = Dropdown::getDropdownName('glpi_locations', $resource['locations_id']);
                 $comment = stripslashes(str_replace(array('\\r\\n', '\\n', '\\r'), "<br/>", $resource['comment']));
                 $tmp['##resource.comment##'] = Html::clean($comment);
                 $tmp['##resource.usersleaving##'] = Html::clean(getUserName($resource['users_id_recipient_leaving']));
                 $tmp['##resource.leaving##'] = Dropdown::getYesNo($resource['is_leaving']);
                 $tmp['##resource.leavingreason##'] = Dropdown::getDropdownName('glpi_plugin_resources_leavingreasons', $resource['plugin_resources_leavingreasons_id']);
                 $tmp['##resource.helpdesk##'] = Dropdown::getYesNo($resource['is_helpdesk_visible']);
                 $tmp['##resource.url##'] = urldecode($CFG_GLPI["url_base"] . "/index.php?redirect=plugin_resources_" . $resource['id']);
                 $this->datas['resources'][] = $tmp;
             }
         } else {
             if ($event == 'AlertArrivalChecklists' || $event == 'AlertLeavingChecklists') {
                 $this->datas['##checklist.entity##'] = Dropdown::getDropdownName('glpi_entities', $options['entities_id']);
                 $this->datas['##lang.checklist.entity##'] = __('Entity');
                 if ($event == 'AlertArrivalChecklists') {
                     $checklist_type = PluginResourcesChecklist::RESOURCES_CHECKLIST_IN;
                     $this->datas['##checklist.action##'] = __('Actions to do on these new resources', 'resources');
                     $this->datas['##lang.checklist.title##'] = __('New resource - checklist needs to verificated', 'resources');
                 } else {
                     $checklist_type = PluginResourcesChecklist::RESOURCES_CHECKLIST_OUT;
                     $this->datas['##checklist.action##'] = __('Actions to do on these leaving resources', 'resources');
                     $this->datas['##lang.checklist.title##'] = __('Leaving resource - checklist needs to verificated', 'resources');
                 }
                 $this->datas['##lang.checklist.title2##'] = __('Checklist needs to verificated', 'resources');
                 $this->datas['##lang.checklist.id##'] = "ID";
                 $this->datas['##lang.checklist.name##'] = __('Name');
                 $this->datas['##lang.checklist.firstname##'] = __('First name');
                 $this->datas['##lang.checklist.type##'] = PluginResourcesContractType::getTypeName(1);
                 $this->datas['##lang.checklist.users##'] = __('Resource manager', 'resources');
                 $this->datas['##lang.checklist.usersrecipient##'] = __('Requester');
                 $this->datas['##lang.checklist.datedeclaration##'] = __('Request date');
                 $this->datas['##lang.checklist.datebegin##'] = __('Arrival date', 'resources');
                 $this->datas['##lang.checklist.dateend##'] = __('Departure date', 'resources');
                 $this->datas['##lang.checklist.department##'] = PluginResourcesDepartment::getTypeName(1);
                 $this->datas['##lang.checklist.status##'] = PluginResourcesResourceState::getTypeName(1);
                 $this->datas['##lang.checklist.location##'] = __('Location');
                 $this->datas['##lang.checklist.comment##'] = __('Description');
                 $this->datas['##lang.checklist.usersleaving##'] = __('Informant of leaving', 'resources');
                 $this->datas['##lang.checklist.leaving##'] = __('Declared as leaving', 'resources');
                 //         $this->datas['##lang.checklist.leavingreason##'] = PluginResourcesLeavingReason::getTypeName(1);
                 $this->datas['##lang.checklist.helpdesk##'] = __('Associable to a ticket');
                 $this->datas['##lang.checklist.url##'] = "URL";
                 foreach ($options['checklists'] as $id => $checklist) {
                     $tmp = array();
                     $tmp['##checklist.id##'] = $checklist['plugin_resources_resources_id'];
                     $tmp['##checklist.name##'] = $checklist['resource_name'];
                     $tmp['##checklist.firstname##'] = $checklist['resource_firstname'];
                     $tmp['##checklist.type##'] = Dropdown::getDropdownName('glpi_plugin_resources_contracttypes', $checklist['plugin_resources_contracttypes_id']);
                     $tmp['##checklist.users##'] = Html::clean(getUserName($checklist['users_id']));
                     $tmp['##checklist.usersrecipient##'] = Html::clean(getUserName($checklist['users_id_recipient']));
                     $tmp['##checklist.datedeclaration##'] = Html::convDateTime($checklist['date_declaration']);
                     $tmp['##checklist.datebegin##'] = Html::convDateTime($checklist['date_begin']);
                     $tmp['##checklist.dateend##'] = Html::convDateTime($checklist['date_end']);
                     $tmp['##checklist.department##'] = Dropdown::getDropdownName('glpi_plugin_resources_departments', $checklist['plugin_resources_departments_id']);
                     $tmp['##checklist.status##'] = Dropdown::getDropdownName('glpi_plugin_resources_resourcestates', $checklist['plugin_resources_resourcestates_id']);
                     $tmp['##checklist.location##'] = Dropdown::getDropdownName('glpi_locations', $checklist['locations_id']);
                     $comment = stripslashes(str_replace(array('\\r\\n', '\\n', '\\r'), "<br/>", $checklist['comment']));
                     $tmp['##checklist.comment##'] = Html::clean($comment);
                     $tmp['##checklist.usersleaving##'] = Html::clean(getUserName($checklist['users_id_recipient_leaving']));
                     $tmp['##checklist.leaving##'] = Dropdown::getYesNo($checklist['is_leaving']);
                     //            $tmp['##checklist.leavingreason##'] = Dropdown::getDropdownName('glpi_plugin_resources_leavingreasons',
                     //                                                   $checklist['plugin_resources_leavingreasons_id']);
                     $tmp['##checklist.helpdesk##'] = Dropdown::getYesNo($checklist['is_helpdesk_visible']);
                     $tmp['##checklist.url##'] = urldecode($CFG_GLPI["url_base"] . "/index.php?redirect=plugin_resources_" . $checklist['plugin_resources_resources_id']);
                     $query = PluginResourcesChecklist::queryListChecklists($checklist['plugin_resources_resources_id'], $checklist_type);
                     $tmp['##tasklist.name##'] = '';
                     foreach ($DB->request($query) as $data) {
                         $tmp['##tasklist.name##'] .= $data["name"];
                         if ($_SESSION["glpiis_ids_visible"] == 1) {
                             $tmp['##tasklist.name##'] .= " (" . $data["id"] . ")";
                         }
                         $tmp['##tasklist.name##'] .= "\n";
                     }
                     $this->datas['checklists'][] = $tmp;
                 }
             } else {
                 if ($event == 'LeavingResource') {
                     $this->datas['##resource.entity##'] = Dropdown::getDropdownName('glpi_entities', $this->obj->getField('entities_id'));
                     $this->datas['##lang.resource.entity##'] = __('Entity');
                     $this->datas['##lang.resource.title##'] = __('A resource has been declared leaving', 'resources');
                     $this->datas['##lang.resource.title2##'] = __('Please check the leaving checklist of the resource', 'resources');
                     $this->datas['##lang.resource.id##'] = "ID";
                     $this->datas['##resource.id##'] = $this->obj->getField("id");
                     $this->datas['##lang.resource.name##'] = __('Name');
                     $this->datas['##resource.name##'] = $this->obj->getField("name");
                     $this->datas['##lang.resource.firstname##'] = __('First name');
                     $this->datas['##resource.firstname##'] = $this->obj->getField("firstname");
                     $this->datas['##lang.resource.type##'] = PluginResourcesContractType::getTypeName(1);
                     $this->datas['##resource.type##'] = Dropdown::getDropdownName('glpi_plugin_resources_contracttypes', $this->obj->getField('plugin_resources_contracttypes_id'));
                     $this->datas['##lang.resource.situation##'] = PluginResourcesResourceSituation::getTypeName(1);
                     $this->datas['##resource.situation##'] = Dropdown::getDropdownName('glpi_plugin_resources_resourcesituations', $this->obj->getField('plugin_resources_resourcesituations_id'));
                     $this->datas['##lang.resource.contractnature##'] = PluginResourcesContractNature::getTypeName(1);
                     $this->datas['##resource.contractnature##'] = Dropdown::getDropdownName('glpi_plugin_resources_contractnatures', $this->obj->getField('plugin_resources_contractnatures_id'));
                     $this->datas['##lang.resource.quota##'] = __('Quota', 'resources');
                     $this->datas['##resource.quota##'] = $this->obj->getField('quota');
                     $this->datas['##lang.resource.department##'] = PluginResourcesDepartment::getTypeName(1);
                     $this->datas['##resource.department##'] = Dropdown::getDropdownName('glpi_plugin_resources_departments', $this->obj->getField('plugin_resources_departments_id'));
                     $this->datas['##lang.resource.rank##'] = PluginResourcesRank::getTypeName(1);
                     $this->datas['##resource.rank##'] = Dropdown::getDropdownName('glpi_plugin_resources_ranks', $this->obj->getField('plugin_resources_ranks_id'));
                     $this->datas['##lang.resource.speciality##'] = PluginResourcesResourceSpeciality::getTypeName(1);
                     $this->datas['##resource.speciality##'] = Dropdown::getDropdownName('glpi_plugin_resources_resourcespecialities', $this->obj->getField('plugin_resources_resourcespecialities_id'));
                     $this->datas['##lang.resource.status##'] = PluginResourcesResourceState::getTypeName(1);
                     $this->datas['##resource.status##'] = Dropdown::getDropdownName('glpi_plugin_resources_resourcestates', $this->obj->getField('plugin_resources_resourcestates_id'));
                     $this->datas['##lang.resource.users##'] = __('Resource manager', 'resources');
                     $this->datas['##resource.users##'] = Html::clean(getUserName($this->obj->getField("users_id")));
                     $this->datas['##lang.resource.usersrecipient##'] = __('Requester');
                     $this->datas['##resource.usersrecipient##'] = Html::clean(getUserName($this->obj->getField("users_id_recipient")));
                     $this->datas['##lang.resource.datedeclaration##'] = __('Request date');
                     $this->datas['##resource.datedeclaration##'] = Html::convDate($this->obj->getField('date_declaration'));
                     $this->datas['##lang.resource.datebegin##'] = __('Arrival date', 'resources');
                     $this->datas['##resource.datebegin##'] = Html::convDate($this->obj->getField('date_begin'));
                     $this->datas['##lang.resource.dateend##'] = __('Departure date', 'resources');
                     $this->datas['##resource.dateend##'] = Html::convDate($this->obj->getField('date_end'));
                     $this->datas['##lang.resource.location##'] = __('Location');
                     $this->datas['##resource.location##'] = Dropdown::getDropdownName('glpi_locations', $this->obj->getField('locations_id'));
                     $this->datas['##lang.resource.helpdesk##'] = __('Associable to a ticket');
                     $this->datas['##resource.helpdesk##'] = Dropdown::getYesNo($this->obj->getField('is_helpdesk_visible'));
                     $this->datas['##lang.resource.leaving##'] = __('Declared as leaving', 'resources');
                     $this->datas['##resource.leaving##'] = Dropdown::getYesNo($this->obj->getField('is_leaving'));
                     $this->datas['##lang.resource.leavingreason##'] = PluginResourcesLeavingReason::getTypeName(1);
                     $this->datas['##resource.leavingreason##'] = Dropdown::getDropdownName('glpi_plugin_resources_leavingreasons', $this->obj->getField('plugin_resources_leavingreasons_id'));
                     $this->datas['##lang.resource.usersleaving##'] = __('Informant of leaving', 'resources');
                     $this->datas['##resource.usersleaving##'] = Html::clean(getUserName($this->obj->getField('users_id_recipient_leaving')));
                     $this->datas['##lang.resource.comment##'] = __('Description');
                     $comment = stripslashes(str_replace(array('\\r\\n', '\\n', '\\r'), "<br/>", $this->obj->getField("comment")));
                     $this->datas['##resource.comment##'] = Html::clean($comment);
                     $this->datas['##lang.resource.url##'] = "URL";
                     $this->datas['##resource.url##'] = urldecode($CFG_GLPI["url_base"] . "/index.php?redirect=plugin_resources_" . $this->obj->getField("id"));
                     $this->datas['##lang.resource.badge##'] = " ";
                     if (isset($this->target_object->input['checkbadge'])) {
                         if (!empty($this->target_object->input['checkbadge'])) {
                             $this->datas['##lang.resource.badge##'] = __('Thanks to recover his badges', 'resources');
                         } else {
                             $this->datas['##lang.resource.badge##'] = " ";
                         }
                     }
                 } else {
                     $events = $this->getAllEvents();
                     $this->datas['##lang.resource.title##'] = $events[$event];
                     $this->datas['##resource.action_user##'] = getUserName(Session::getLoginUserID());
                     $this->datas['##lang.resource.entity##'] = __('Entity');
                     $this->datas['##resource.entity##'] = Dropdown::getDropdownName('glpi_entities', $this->obj->getField('entities_id'));
                     $this->datas['##resource.id##'] = $this->obj->getField("id");
                     $this->datas['##lang.resource.name##'] = __('Name');
                     $this->datas['##resource.name##'] = $this->obj->getField("name");
                     $this->datas['##lang.resource.firstname##'] = __('First name');
                     $this->datas['##resource.firstname##'] = $this->obj->getField("firstname");
                     $this->datas['##lang.resource.type##'] = PluginResourcesContractType::getTypeName(1);
                     $this->datas['##resource.type##'] = Dropdown::getDropdownName('glpi_plugin_resources_contracttypes', $this->obj->getField('plugin_resources_contracttypes_id'));
                     $this->datas['##lang.resource.situation##'] = PluginResourcesResourceSituation::getTypeName(1);
                     $this->datas['##resource.situation##'] = Dropdown::getDropdownName('glpi_plugin_resources_resourcesituations', $this->obj->getField('plugin_resources_resourcesituations_id'));
                     $this->datas['##lang.resource.contractnature##'] = PluginResourcesContractNature::getTypeName(1);
                     $this->datas['##resource.contractnature##'] = Dropdown::getDropdownName('glpi_plugin_resources_contractnatures', $this->obj->getField('plugin_resources_contractnatures_id'));
                     $this->datas['##lang.resource.quota##'] = __('Quota', 'resources');
                     $this->datas['##resource.quota##'] = $this->obj->getField('quota');
                     $this->datas['##lang.resource.users##'] = __('Resource manager', 'resources');
                     $this->datas['##resource.users##'] = Html::clean(getUserName($this->obj->getField("users_id")));
                     $this->datas['##lang.resource.usersrecipient##'] = __('Requester');
                     $this->datas['##resource.usersrecipient##'] = Html::clean(getUserName($this->obj->getField("users_id_recipient")));
                     $this->datas['##lang.resource.datedeclaration##'] = __('Request date');
                     $this->datas['##resource.datedeclaration##'] = Html::convDate($this->obj->getField('date_declaration'));
                     $this->datas['##lang.resource.datebegin##'] = __('Arrival date', 'resources');
                     $this->datas['##resource.datebegin##'] = Html::convDate($this->obj->getField('date_begin'));
                     $this->datas['##lang.resource.dateend##'] = __('Departure date', 'resources');
                     $this->datas['##resource.dateend##'] = Html::convDate($this->obj->getField('date_end'));
                     $this->datas['##lang.resource.department##'] = PluginResourcesDepartment::getTypeName(1);
                     $this->datas['##resource.department##'] = Dropdown::getDropdownName('glpi_plugin_resources_departments', $this->obj->getField('plugin_resources_departments_id'));
                     $this->datas['##lang.resource.rank##'] = PluginResourcesRank::getTypeName(1);
                     $this->datas['##resource.rank##'] = Dropdown::getDropdownName('glpi_plugin_resources_ranks', $this->obj->getField('plugin_resources_ranks_id'));
                     $this->datas['##lang.resource.speciality##'] = PluginResourcesResourceSpeciality::getTypeName(1);
                     $this->datas['##resource.speciality##'] = Dropdown::getDropdownName('glpi_plugin_resources_resourcespecialities', $this->obj->getField('plugin_resources_resourcespecialities_id'));
                     $this->datas['##lang.resource.status##'] = PluginResourcesResourceState::getTypeName(1);
                     $this->datas['##resource.status##'] = Dropdown::getDropdownName('glpi_plugin_resources_resourcestates', $this->obj->getField('plugin_resources_resourcestates_id'));
                     $this->datas['##lang.resource.location##'] = __('Location');
                     $this->datas['##resource.location##'] = Dropdown::getDropdownName('glpi_locations', $this->obj->getField('locations_id'));
                     $this->datas['##lang.resource.comment##'] = __('Description');
                     $comment = stripslashes(str_replace(array('\\r\\n', '\\n', '\\r'), "<br/>", $this->obj->getField("comment")));
                     $this->datas['##resource.comment##'] = Html::clean($comment);
                     $this->datas['##lang.resource.usersleaving##'] = __('Informant of leaving', 'resources');
                     $this->datas['##resource.usersleaving##'] = Html::clean(getUserName($this->obj->getField("users_id_recipient_leaving")));
                     $this->datas['##lang.resource.leaving##'] = __('Declared as leaving', 'resources');
                     $this->datas['##resource.leaving##'] = Dropdown::getYesNo($this->obj->getField('is_leaving'));
                     $this->datas['##lang.resource.leavingreason##'] = PluginResourcesLeavingReason::getTypeName(1);
                     $this->datas['##resource.leavingreason##'] = Dropdown::getDropdownName('glpi_plugin_resources_leavingreasons', $this->obj->getField('plugin_resources_leavingreasons_id'));
                     $this->datas['##lang.resource.helpdesk##'] = __('Associable to a ticket');
                     $this->datas['##resource.helpdesk##'] = Dropdown::getYesNo($this->obj->getField('is_helpdesk_visible'));
                     $this->datas['##lang.resource.url##'] = "URL";
                     $this->datas['##resource.url##'] = urldecode($CFG_GLPI["url_base"] . "/index.php?redirect=plugin_resources_" . $this->obj->getField("id"));
                     if ($event == 'report') {
                         $this->datas['##lang.resource.creationtitle##'] = __('Creation report of the human resource', 'resources');
                         $this->datas['##resource.login##'] = "";
                         $this->datas['##resource.email##'] = "";
                         $restrict = "`itemtype` = 'User' \n                        AND `plugin_resources_resources_id` = '" . $this->obj->getField("id") . "'";
                         $items = getAllDatasFromTable("glpi_plugin_resources_resources_items", $restrict);
                         if (!empty($items)) {
                             foreach ($items as $item) {
                                 $user = new User();
                                 $user->getFromDB($item["items_id"]);
                                 $this->datas['##resource.login##'] = $user->fields["name"];
                                 $this->datas['##resource.email##'] = $user->getDefaultEmail();
                             }
                         }
                         $this->datas['##lang.resource.login##'] = __('Login');
                         $this->datas['##lang.resource.creation##'] = __('Informations of the created user', 'resources');
                         $this->datas['##lang.resource.datecreation##'] = __('Creation Date');
                         $this->datas['##resource.datecreation##'] = Html::convDate(date("Y-m-d"));
                         $this->datas['##lang.resource.email##'] = __('Email');
                         $this->datas['##lang.resource.informationtitle##'] = __('Additional informations', 'resources');
                         $PluginResourcesReportConfig = new PluginResourcesReportConfig();
                         $PluginResourcesReportConfig->getFromDB($options['reports_id']);
                         $this->datas['##lang.resource.informations##'] = __('Information', 'Informations', 2);
                         $information = stripslashes(str_replace(array('\\r\\n', '\\n', '\\r'), "<br>", $PluginResourcesReportConfig->fields['information']));
                         $this->datas['##resource.informations##'] = Html::clean(nl2br($information));
                         $this->datas['##lang.resource.commentaires##'] = __('Comments');
                         $commentaire = stripslashes(str_replace(array('\\r\\n', '\\n', '\\r'), "<br>", $PluginResourcesReportConfig->fields['comment']));
                         $this->datas['##resource.commentaires##'] = Html::clean(nl2br($commentaire));
                     }
                     if ($event == 'newresting' || $event == 'updateresting' || $event == 'deleteresting') {
                         $this->datas['##lang.resource.restingtitle##'] = __('Non contract period management', 'resources');
                         $this->datas['##lang.resource.resting##'] = __('Detail of non contract period', 'resources');
                         $this->datas['##lang.resource.datecreation##'] = __('Creation date');
                         $this->datas['##resource.datecreation##'] = Html::convDate(date("Y-m-d"));
                         $PluginResourcesResourceResting = new PluginResourcesResourceResting();
                         $PluginResourcesResourceResting->getFromDB($options['resting_id']);
                         $this->datas['##lang.resource.location##'] = __('Agency concerned');
                         $this->datas['##resource.location##'] = Dropdown::getDropdownName('glpi_locations', $PluginResourcesResourceResting->fields['locations_id']);
                         $this->datas['##lang.resource.home##'] = __('At home');
                         $this->datas['##resource.home##'] = Dropdown::getYesNo($PluginResourcesResourceResting->fields['at_home']);
                         $this->datas['##lang.resource.datebegin##'] = __('Begin date');
                         $this->datas['##resource.datebegin##'] = Html::convDate($PluginResourcesResourceResting->fields['date_begin']);
                         $this->datas['##lang.resource.dateend##'] = __('End date');
                         $this->datas['##resource.dateend##'] = Html::convDate($PluginResourcesResourceResting->fields['date_end']);
                         $this->datas['##lang.resource.informationtitle##'] = __('Additional informations', 'resources');
                         $this->datas['##lang.resource.commentaires##'] = __('Comments');
                         $commentaire = stripslashes(str_replace(array('\\r\\n', '\\n', '\\r'), "<br>", $PluginResourcesResourceResting->fields['comment']));
                         $this->datas['##resource.commentaires##'] = Html::clean(nl2br($commentaire));
                         $this->datas['##lang.resource.openby##'] = __('Reported by', 'resources');
                         $this->datas['##resource.openby##'] = Html::clean(getUserName(Session::getLoginUserID()));
                         if (isset($options['oldvalues']) && !empty($options['oldvalues'])) {
                             $this->target_object->oldvalues = $options['oldvalues'];
                         }
                     }
                     if ($event == 'newholiday' || $event == 'updateholiday' || $event == 'deleteholiday') {
                         $this->datas['##lang.resource.holidaytitle##'] = __('Forced holiday management', 'resources');
                         $this->datas['##lang.resource.holiday##'] = __('Detail of the forced holiday', 'resources');
                         $this->datas['##lang.resource.datecreation##'] = __('Creation date');
                         $this->datas['##resource.datecreation##'] = Html::convDate(date("Y-m-d"));
                         $PluginResourcesResourceHoliday = new PluginResourcesResourceHoliday();
                         $PluginResourcesResourceHoliday->getFromDB($options['holiday_id']);
                         $this->datas['##lang.resource.datebegin##'] = __('Begin date');
                         $this->datas['##resource.datebegin##'] = Html::convDate($PluginResourcesResourceHoliday->fields['date_begin']);
                         $this->datas['##lang.resource.dateend##'] = __('End date');
                         $this->datas['##resource.dateend##'] = Html::convDate($PluginResourcesResourceHoliday->fields['date_end']);
                         $this->datas['##lang.resource.informationtitle##'] = __('Additional informations', 'resources');
                         $this->datas['##lang.resource.commentaires##'] = __('Comments');
                         $commentaire = stripslashes(str_replace(array('\\r\\n', '\\n', '\\r'), "<br>", $PluginResourcesResourceHoliday->fields['comment']));
                         $this->datas['##resource.commentaires##'] = Html::clean(nl2br($commentaire));
                         $this->datas['##lang.resource.openby##'] = __('Reported by', 'resources');
                         $this->datas['##resource.openby##'] = Html::clean(getUserName(Session::getLoginUserID()));
                         if (isset($options['oldvalues']) && !empty($options['oldvalues'])) {
                             $this->target_object->oldvalues = $options['oldvalues'];
                         }
                     }
                     //old values infos
                     if (isset($this->target_object->oldvalues) && !empty($this->target_object->oldvalues) && ($event == 'update' || $event == 'updateresting' || $event == 'updateholiday')) {
                         $this->datas['##lang.update.title##'] = __('Modified fields', 'resources');
                         $tmp = array();
                         if (isset($this->target_object->oldvalues['name'])) {
                             if (empty($this->target_object->oldvalues['name'])) {
                                 $tmp['##update.name##'] = "---";
                             } else {
                                 $tmp['##update.name##'] = $this->target_object->oldvalues['name'];
                             }
                         }
                         if (isset($this->target_object->oldvalues['firstname'])) {
                             if (empty($this->target_object->oldvalues['firstname'])) {
                                 $tmp['##update.firstname##'] = "---";
                             } else {
                                 $tmp['##update.firstname##'] = $this->target_object->oldvalues['firstname'];
                             }
                         }
                         if (isset($this->target_object->oldvalues['plugin_resources_contracttypes_id'])) {
                             if (empty($this->target_object->oldvalues['plugin_resources_contracttypes_id'])) {
                                 $tmp['##update.type##'] = "---";
                             } else {
                                 $tmp['##update.type##'] = Dropdown::getDropdownName('glpi_plugin_resources_contracttypes', $this->target_object->oldvalues['plugin_resources_contracttypes_id']);
                             }
                         }
                         if (isset($this->target_object->oldvalues['users_id'])) {
                             if (empty($this->target_object->oldvalues['users_id'])) {
                                 $tmp['##update.users##'] = "---";
                             } else {
                                 $tmp['##update.users##'] = Html::clean(getUserName($this->target_object->oldvalues['users_id']));
                             }
                         }
                         if (isset($this->target_object->oldvalues['users_id_recipient'])) {
                             if (empty($this->target_object->oldvalues['users_id_recipient'])) {
                                 $tmp['##update.usersrecipient##'] = "---";
                             } else {
                                 $tmp['##update.usersrecipient##'] = Html::clean(getUserName($this->target_object->oldvalues['users_id_recipient']));
                             }
                         }
                         if (isset($this->target_object->oldvalues['date_declaration'])) {
                             if (empty($this->target_object->oldvalues['date_declaration'])) {
                                 $tmp['##update.datedeclaration##'] = "---";
                             } else {
                                 $tmp['##update.datedeclaration##'] = Html::convDate($this->target_object->oldvalues['date_declaration']);
                             }
                         }
                         if (isset($this->target_object->oldvalues['date_begin'])) {
                             if (empty($this->target_object->oldvalues['date_begin'])) {
                                 $tmp['##update.datebegin##'] = "---";
                             } else {
                                 $tmp['##update.datebegin##'] = Html::convDate($this->target_object->oldvalues['date_begin']);
                             }
                         }
                         if (isset($this->target_object->oldvalues['date_end'])) {
                             if (empty($this->target_object->oldvalues['date_end'])) {
                                 $tmp['##update.dateend##'] = "---";
                             } else {
                                 $tmp['##update.dateend##'] = Html::convDate($this->target_object->oldvalues['date_end']);
                             }
                         }
                         if (isset($this->target_object->oldvalues['quota'])) {
                             if (empty($this->target_object->oldvalues['quota'])) {
                                 $tmp['##update.quota##'] = "---";
                             } else {
                                 $tmp['##update.quota##'] = $this->target_object->oldvalues['quota'];
                             }
                         }
                         if (isset($this->target_object->oldvalues['plugin_resources_departments_id'])) {
                             if (empty($this->target_object->oldvalues['plugin_resources_departments_id'])) {
                                 $tmp['##update.department##'] = "---";
                             } else {
                                 $tmp['##update.department##'] = Dropdown::getDropdownName('glpi_plugin_resources_departments', $this->target_object->oldvalues['plugin_resources_departments_id']);
                             }
                         }
                         if (isset($this->target_object->oldvalues['plugin_resources_resourcestates_id'])) {
                             if (empty($this->target_object->oldvalues['plugin_resources_resourcestates_id'])) {
                                 $tmp['##update.status##'] = "---";
                             } else {
                                 $tmp['##update.status##'] = Dropdown::getDropdownName('glpi_plugin_resources_resourcestates', $this->target_object->oldvalues['plugin_resources_resourcestates_id']);
                             }
                         }
                         if (isset($this->target_object->oldvalues['plugin_resources_resourcesituations_id'])) {
                             if (empty($this->target_object->oldvalues['plugin_resources_resourcesituations_id'])) {
                                 $tmp['##update.situation##'] = "---";
                             } else {
                                 $tmp['##update.situation##'] = Dropdown::getDropdownName('glpi_plugin_resources_resourcesituations', $this->target_object->oldvalues['plugin_resources_resourcesituations_id']);
                             }
                         }
                         if (isset($this->target_object->oldvalues['plugin_resources_contractnatures_id'])) {
                             if (empty($this->target_object->oldvalues['plugin_resources_contractnatures_id'])) {
                                 $tmp['##update.contractnature##'] = "---";
                             } else {
                                 $tmp['##update.contractnature##'] = Dropdown::getDropdownName('glpi_plugin_resources_contractnatures', $this->target_object->oldvalues['plugin_resources_contractnatures_id']);
                             }
                         }
                         if (isset($this->target_object->oldvalues['plugin_resources_ranks_id'])) {
                             if (empty($this->target_object->oldvalues['plugin_resources_ranks_id'])) {
                                 $tmp['##update.rank##'] = "---";
                             } else {
                                 $tmp['##update.rank##'] = Dropdown::getDropdownName('glpi_plugin_resources_ranks', $this->target_object->oldvalues['plugin_resources_ranks_id']);
                             }
                         }
                         if (isset($this->target_object->oldvalues['plugin_resources_resourcespecialities_id'])) {
                             if (empty($this->target_object->oldvalues['plugin_resources_resourcespecialities_id'])) {
                                 $tmp['##update.speciality##'] = "---";
                             } else {
                                 $tmp['##update.speciality##'] = Dropdown::getDropdownName('glpi_plugin_resources_resourcespecialities', $this->target_object->oldvalues['plugin_resources_resourcespecialities_id']);
                             }
                         }
                         if (isset($this->target_object->oldvalues['locations_id'])) {
                             if (empty($this->target_object->oldvalues['locations_id'])) {
                                 $tmp['##update.location##'] = "---";
                             } else {
                                 $tmp['##update.location##'] = Dropdown::getDropdownName('glpi_locations', $this->target_object->oldvalues['locations_id']);
                             }
                         }
                         if (isset($this->target_object->oldvalues['comment'])) {
                             if (empty($this->target_object->oldvalues['comment'])) {
                                 $tmp['##update.comment##'] = "---";
                             } else {
                                 $comment = stripslashes(str_replace(array('\\r\\n', '\\n', '\\r'), "<br/>", $this->target_object->oldvalues['comment']));
                                 $tmp['##update.comment##'] = Html::clean($comment);
                             }
                         }
                         if (isset($this->target_object->oldvalues['users_id_recipient_leaving'])) {
                             if (empty($this->target_object->oldvalues['users_id_recipient_leaving'])) {
                                 $tmp['##update.usersleaving##'] = "---";
                             } else {
                                 $tmp['##update.usersleaving##'] = Html::clean(getUserName($this->target_object->oldvalues['users_id_recipient_leaving']));
                             }
                         }
                         if (isset($this->target_object->oldvalues['is_leaving'])) {
                             if (empty($this->target_object->oldvalues['is_leaving'])) {
                                 $tmp['##update.leaving##'] = "---";
                             } else {
                                 $tmp['##update.leaving##'] = Dropdown::getYesNo($this->target_object->oldvalues['is_leaving']);
                             }
                         }
                         if (isset($this->target_object->oldvalues['plugin_resources_leavingreasons_id'])) {
                             if (empty($this->target_object->oldvalues['plugin_resources_leavingreasons_id'])) {
                                 $tmp['##update.leavingreason##'] = "---";
                             } else {
                                 $tmp['##update.leavingreason##'] = Dropdown::getDropdownName('glpi_plugin_resources_leavingreasons', $this->target_object->oldvalues['plugin_resources_leavingreasons_id']);
                             }
                         }
                         if (isset($this->target_object->oldvalues['is_helpdesk_visible'])) {
                             if (empty($this->target_object->oldvalues['is_helpdesk_visible'])) {
                                 $tmp['##update.helpdesk##'] = "---";
                             } else {
                                 $tmp['##update.helpdesk##'] = Dropdown::getYesNo($this->target_object->oldvalues['is_helpdesk_visible']);
                             }
                         }
                         if (isset($this->target_object->oldvalues['at_home'])) {
                             if (empty($this->target_object->oldvalues['at_home'])) {
                                 $tmp['##update.home##'] = "---";
                             } else {
                                 $tmp['##update.home##'] = Dropdown::getYesNo($this->target_object->oldvalues['at_home']);
                             }
                         }
                         $this->datas['updates'][] = $tmp;
                     }
                     //task infos
                     $restrict = "`plugin_resources_resources_id`='" . $this->obj->getField('id') . "' AND `is_deleted` = 0";
                     if (isset($options['tasks_id']) && $options['tasks_id']) {
                         $restrict .= " AND `glpi_plugin_resources_tasks`.`id` = '" . $options['tasks_id'] . "'";
                     }
                     $restrict .= " ORDER BY `name` DESC";
                     $tasks = getAllDatasFromTable('glpi_plugin_resources_tasks', $restrict);
                     $this->datas['##lang.task.title##'] = __('Associated tasks', 'resources');
                     $this->datas['##lang.task.name##'] = __('Name');
                     $this->datas['##lang.task.type##'] = __('Type');
                     $this->datas['##lang.task.users##'] = __('Technician');
                     $this->datas['##lang.task.groups##'] = __('Group');
                     $this->datas['##lang.task.datebegin##'] = __('Begin date');
                     $this->datas['##lang.task.dateend##'] = __('End date');
                     $this->datas['##lang.task.planned##'] = __('Used for planning', 'resources');
                     $this->datas['##lang.task.realtime##'] = __('Effective duration', 'resources');
                     $this->datas['##lang.task.finished##'] = __('Carried out task', 'resources');
                     $this->datas['##lang.task.comment##'] = __('Description');
                     foreach ($tasks as $task) {
                         $tmp = array();
                         $tmp['##task.name##'] = $task['name'];
                         $tmp['##task.type##'] = Dropdown::getDropdownName('glpi_plugin_resources_tasktypes', $task['plugin_resources_tasktypes_id']);
                         $tmp['##task.users##'] = Html::clean(getUserName($task['users_id']));
                         $tmp['##task.groups##'] = Dropdown::getDropdownName('glpi_groups', $task['groups_id']);
                         $restrict = " `plugin_resources_tasks_id` = '" . $task['id'] . "' ";
                         $plans = getAllDatasFromTable("glpi_plugin_resources_taskplannings", $restrict);
                         if (!empty($plans)) {
                             foreach ($plans as $plan) {
                                 $tmp['##task.datebegin##'] = Html::convDateTime($plan["begin"]);
                                 $tmp['##task.dateend##'] = Html::convDateTime($plan["end"]);
                             }
                         } else {
                             $tmp['##task.datebegin##'] = '';
                             $tmp['##task.dateend##'] = '';
                         }
                         $tmp['##task.planned##'] = '';
                         $tmp['##task.finished##'] = Dropdown::getYesNo($task['is_finished']);
                         $tmp['##task.realtime##'] = Ticket::getActionTime($task["actiontime"]);
                         $comment = stripslashes(str_replace(array('\\r\\n', '\\n', '\\r'), "<br/>", $task['comment']));
                         $tmp['##task.comment##'] = Html::clean($comment);
                         $this->datas['tasks'][] = $tmp;
                     }
                 }
             }
         }
     }
 }
 /**
  * Display a Planning Item
  *
  * @param $parm Array of the item to display
  * @return Nothing (display function)
  **/
 static function displayPlanningItem(array $val, $who, $type = "", $complete = 0)
 {
     global $CFG_GLPI;
     $rand = mt_rand();
     echo "<a href='" . $CFG_GLPI["root_doc"] . "/plugins/resources/front/task.form.php?id=" . $val["id"] . "'";
     echo " onmouseout=\"cleanhide('content_task_" . $val["id"] . $rand . "')\" \n               onmouseover=\"cleandisplay('content_task_" . $val["id"] . $rand . "')\"";
     echo ">";
     switch ($type) {
         case "in":
             //TRANS: %1$s is the start time of a planned item, %2$s is the end
             $beginend = sprintf(__('From %1$s to %2$s :'), date("H:i", strtotime($val["begin"])), date("H:i", strtotime($val["end"])));
             printf(__('%1$s %2$s'), $beginend, Html::resume_text($val["name"], 80));
             break;
         case "begin":
             $start = sprintf(__('Start at %s'), date("H:i", strtotime($val["begin"])));
             printf(__('%1$s: %2$s'), $start, Html::resume_text($val["name"], 80));
             break;
         case "end":
             $end = sprintf(__('End at %s'), date("H:i", strtotime($val["end"])));
             printf(__('%1$s: %2$s'), $end, Html::resume_text($val["name"], 80));
             break;
     }
     if ($val["users_id"] && $who == 0) {
         echo " - " . __('User') . " " . getUserName($val["users_id"]);
     }
     echo "</a><br>";
     echo PluginResourcesResource::getTypeName(1) . " : <a href='" . $CFG_GLPI["root_doc"] . "/plugins/resources/front/resource.form.php?id=" . $val["plugin_resources_resources_id"] . "'";
     echo ">" . $val["resource"] . "</a>";
     echo "<div class='over_link' id='content_task_" . $val["id"] . $rand . "'>";
     if ($val["end"]) {
         echo "<strong>" . __('End date') . "</strong> : " . Html::convdatetime($val["end"]) . "<br>";
     }
     if ($val["type"]) {
         echo "<strong>" . PluginResourcesTaskType::getTypeName(1) . "</strong> : " . $val["type"] . "<br>";
     }
     if ($val["content"]) {
         echo "<strong>" . __('Description') . "</strong> : " . $val["content"];
     }
     echo "</div>";
 }
 function getTitle()
 {
     return PluginResourcesResource::getTypeName(2) . " " . PluginResourcesChecklist::getTypeName(1);
 }
Beispiel #11
0
 function showForm($ID, $options = array())
 {
     if (!Session::haveRight("profile", "r")) {
         return false;
     }
     $prof = new Profile();
     if ($ID) {
         $this->getFromDBByProfile($ID);
         $prof->getFromDB($ID);
     }
     $this->showFormHeader($options);
     echo "<tr class='tab_bg_2'>";
     echo "<th colspan='4'>" . sprintf(__('%1$s - %2$s'), __('Rights management', 'resources'), $prof->fields["name"]) . "</th>";
     echo "</tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td>" . PluginResourcesResource::getTypeName(2) . "</td><td>";
     Profile::dropdownNoneReadWrite("resources", $this->fields["resources"], 1, 1, 1);
     echo "</td>";
     echo "<td>" . PluginResourcesTask::getTypeName(2) . "</td><td>";
     if ($prof->fields['interface'] != 'helpdesk') {
         Profile::dropdownNoneReadWrite("task", $this->fields["task"], 1, 1, 1);
     } else {
         _e('No access');
         // No access;
     }
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td>" . PluginResourcesChecklist::getTypeName(2) . "</td><td>";
     if ($prof->fields['interface'] != 'helpdesk') {
         Profile::dropdownNoneReadWrite("checklist", $this->fields["checklist"], 1, 1, 1);
     } else {
         _e('No access');
         // No access;
     }
     echo "</td>";
     echo "<td>" . PluginResourcesEmployee::getTypeName(2) . "</td><td>";
     Profile::dropdownNoneReadWrite("employee", $this->fields["employee"], 1, 1, 1);
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td>" . __('All resources access', 'resources') . "</td><td>";
     Profile::dropdownNoneReadWrite("all", $this->fields["all"], 1, 0, 1);
     echo "</td>";
     echo "<td>" . __('Associable items to a ticket') . " - " . PluginResourcesResource::getTypeName(2) . "</td><td>";
     if ($prof->fields['create_ticket']) {
         Dropdown::showYesNo("open_ticket", $this->fields["open_ticket"]);
     } else {
         echo Dropdown::getYesNo(0);
     }
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<th colspan='4' class='center b'>" . __('Service company management', 'resources') . "</th>";
     echo "</tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td>" . PluginResourcesResourceResting::getTypeName(2) . "</td><td>";
     Profile::dropdownNoneReadWrite("resting", $this->fields["resting"], 1, 0, 1);
     echo "</td>";
     echo "<td>" . PluginResourcesResourceHoliday::getTypeName(2) . "</td><td>";
     Profile::dropdownNoneReadWrite("holiday", $this->fields["holiday"], 1, 0, 1);
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<th colspan='4' class='center b'>" . __('Public service management', 'resources') . "</th>";
     echo "</tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td>" . PluginResourcesEmployment::getTypeName(2) . "</td><td>";
     Profile::dropdownNoneReadWrite("employment", $this->fields["employment"], 1, 1, 1);
     echo "</td>";
     echo "<td>" . PluginResourcesBudget::getTypeName(2) . ":</td><td>";
     Profile::dropdownNoneReadWrite("budget", $this->fields["budget"], 1, 1, 1);
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td>" . __('Dropdown management', 'resources') . "</td><td>";
     Profile::dropdownNoneReadWrite("dropdown_public", $this->fields["dropdown_public"], 1, 1, 1);
     echo "</td><td></td><td></td>";
     echo "</tr>";
     echo "<input type='hidden' name='id' value=" . $this->fields["id"] . ">";
     $options['candel'] = false;
     $this->showFormButtons($options);
 }
Beispiel #12
0
 function showOnCentral($is_leaving)
 {
     global $DB, $CFG_GLPI;
     if ($this->canView()) {
         if (Session::isMultiEntitiesMode()) {
             $colsup = 1;
         } else {
             $colsup = 0;
         }
         if ($is_leaving) {
             $query = self::queryChecklists(true, 1);
         } else {
             $query = self::queryChecklists(true);
         }
         $result = $DB->query($query);
         $number = $DB->numrows($result);
         if ($number > 0) {
             echo "<div align='center'><table class='tab_cadre' width='100%'>";
             if ($is_leaving) {
                 $title = __('Leaving resource - checklist needs to verificated', 'resources');
             } else {
                 $title = __('New resource - checklist needs to verificated', 'resources');
             }
             echo "<tr><th colspan='" . (5 + $colsup) . "'>" . $title . " </th></tr>";
             echo "<tr><th>" . PluginResourcesResource::getTypeName(1) . "</th>";
             if ($is_leaving) {
                 echo "<th>" . __('Departure date', 'resources') . "</th>";
             } else {
                 echo "<th>" . __('Arrival date', 'resources') . "</th>";
             }
             if (Session::isMultiEntitiesMode()) {
                 echo "<th>" . __('Entity') . "</th>";
             }
             echo "<th>" . __('Location') . "</th>";
             echo "<th>" . PluginResourcesContractType::getTypeName(1) . "</th>";
             echo "<th>" . __('Checklist needs to verificated', 'resources') . "</th></tr>";
             while ($data = $DB->fetch_array($result)) {
                 echo "<tr class='tab_bg_1'>";
                 echo "<td class='center'>";
                 echo "<a href='" . $CFG_GLPI["root_doc"] . "/plugins/resources/front/resource.form.php?id=" . $data["plugin_resources_resources_id"] . "'>";
                 echo $data["resource_name"] . " " . $data["resource_firstname"];
                 if ($_SESSION["glpiis_ids_visible"]) {
                     echo " (" . $data["plugin_resources_resources_id"] . ")";
                 }
                 echo "</a></td>";
                 echo "<td class='center'>";
                 if ($is_leaving) {
                     if ($data["date_end"] <= date('Y-m-d') && !empty($data["date_end"])) {
                         echo "<div class='deleted'>" . Html::convDate($data["date_end"]) . "</div>";
                     } else {
                         echo "<div class='plugin_resources_date_day_color'>";
                         echo Html::convDate($data["date_end"]);
                         echo "</div>";
                     }
                 } else {
                     if ($data["date_begin"] <= date('Y-m-d') && !empty($data["date_begin"])) {
                         echo "<div class='deleted'>" . Html::convDate($data["date_begin"]) . "</div>";
                     } else {
                         echo "<div class='plugin_resources_date_day_color'>";
                         echo Html::convDate($data["date_begin"]);
                         echo "</div>";
                     }
                 }
                 echo "</td>";
                 if (Session::isMultiEntitiesMode()) {
                     echo "<td class='center'>";
                     echo Dropdown::getDropdownName("glpi_entities", $data['entities_id']);
                     echo "</td>";
                 }
                 echo "<td class='center'>";
                 echo Dropdown::getDropdownName("glpi_locations", $data['locations_id']);
                 echo "</td>";
                 echo "<td class='center'>";
                 echo Dropdown::getDropdownName("glpi_plugin_resources_contracttypes", $data['plugin_resources_contracttypes_id']);
                 echo "</td>";
                 echo "<td width='40%'>";
                 if ($is_leaving) {
                     $query_checklists = self::queryListChecklists($data["plugin_resources_resources_id"], self::RESOURCES_CHECKLIST_OUT);
                 } else {
                     $query_checklists = self::queryListChecklists($data["plugin_resources_resources_id"], self::RESOURCES_CHECKLIST_IN);
                 }
                 $result_checklists = $DB->query($query_checklists);
                 echo "<table class='tab_cadre' width='100%'>";
                 while ($data_checklists = $DB->fetch_array($result_checklists)) {
                     echo "<tr class='tab_bg_1'><td>";
                     if ($data_checklists["tag"]) {
                         echo "<span class='plugin_resources_date_over_color'>";
                     }
                     echo $data_checklists["name"];
                     if ($_SESSION["glpiis_ids_visible"]) {
                         echo " (" . $data_checklists["id"] . ")";
                     }
                     if ($data_checklists["tag"]) {
                         echo "</span>";
                     }
                     echo "</td>";
                     echo "</tr>";
                 }
                 echo "</table>";
                 echo "</td></tr>";
             }
             echo "</table></div>";
         }
     }
 }
 function getTitle()
 {
     return PluginResourcesResource::getTypeName(2) . " " . __('Required Fields', 'resources');
 }
Beispiel #14
0
 function showCentral($who)
 {
     global $DB, $CFG_GLPI;
     echo "<table class='tab_cadre_central'><tr><td>";
     if ($this->canView()) {
         $who = Session::getLoginUserID();
         if (Session::isMultiEntitiesMode()) {
             $colsup = 1;
         } else {
             $colsup = 0;
         }
         $ASSIGN = "";
         if ($who > 0) {
             $ASSIGN = " AND ((`" . $this->getTable() . "`.`users_id` = '{$who}')";
         }
         //if ($who_group>0) {
         $ASSIGN .= " OR (`" . $this->getTable() . "`.`groups_id` IN (SELECT `groups_id` \n                                                      FROM `glpi_groups_users` \n                                                      WHERE `users_id` = '{$who}') )";
         //}
         $query = "SELECT `" . $this->getTable() . "`.`id` AS plugin_resources_tasks_id, `" . $this->getTable() . "`.`name` AS name_task, `" . $this->getTable() . "`.`plugin_resources_tasktypes_id` AS plugin_resources_tasktypes_id,`" . $this->getTable() . "`.`is_deleted` AS is_deleted, ";
         $query .= "`" . $this->getTable() . "`.`users_id` AS users_id_task, `glpi_plugin_resources_resources`.`id` as id, `glpi_plugin_resources_resources`.`name` AS name, `glpi_plugin_resources_resources`.`firstname` AS firstname, `glpi_plugin_resources_resources`.`entities_id`, `glpi_plugin_resources_resources`.`users_id` as users_id ";
         $query .= " FROM `" . $this->getTable() . "`,`glpi_plugin_resources_resources` ";
         $query .= " WHERE `glpi_plugin_resources_resources`.`is_template` = '0' \n                  AND `glpi_plugin_resources_resources`.`is_deleted` = '0' \n                  AND `" . $this->getTable() . "`.`is_deleted` = '0' \n                  AND `" . $this->getTable() . "`.`is_finished` = '0' \n                  AND `" . $this->getTable() . "`.`plugin_resources_resources_id` = `glpi_plugin_resources_resources`.`id` \n                  {$ASSIGN} ) ";
         // Add Restrict to current entities
         $PluginResourcesResource = new PluginResourcesResource();
         $itemtable = "glpi_plugin_resources_resources";
         if ($PluginResourcesResource->isEntityAssign()) {
             $LINK = " AND ";
             $query .= getEntitiesRestrictRequest($LINK, $itemtable);
         }
         $query .= " ORDER BY `glpi_plugin_resources_resources`.`name` DESC LIMIT 10;";
         $result = $DB->query($query);
         $number = $DB->numrows($result);
         if ($number > 0) {
             echo "<div align='center'><table class='tab_cadre' width='100%'>";
             echo "<tr><th colspan='" . (7 + $colsup) . "'>" . PluginResourcesResource::getTypeName(2) . ": " . __('Tasks in progress', 'resources') . " <a href='" . $CFG_GLPI["root_doc"] . "/plugins/resources/front/task.php?contains%5B0%5D=0&field%5B0%5D=9&sort=1&is_deleted=0&start=0'>" . __('All') . "</a></th></tr>";
             echo "<tr><th>" . __('Name') . "</th>";
             if (Session::isMultiEntitiesMode()) {
                 echo "<th>" . __('Entity') . "</th>";
             }
             echo "<th>" . PluginResourcesTaskType::getTypeName(2) . "</th>";
             echo "<th>" . __('Planning') . "</th>";
             echo "<th>" . PluginResourcesResource::getTypeName(1) . "</th>";
             echo "<th>" . __('Resource manager', 'resources') . "</th>";
             echo "<th>" . __('User') . "</th>";
             echo "</tr>";
             while ($data = $DB->fetch_array($result)) {
                 echo "<tr class='tab_bg_1" . ($data["is_deleted"] == '1' ? "_2" : "") . "'>";
                 echo "<td class='center'><a href='" . $CFG_GLPI["root_doc"] . "/plugins/resources/front/task.form.php?id=" . $data["plugin_resources_tasks_id"] . "'>" . $data["name_task"];
                 if ($_SESSION["glpiis_ids_visible"]) {
                     echo " (" . $data["plugin_resources_tasks_id"] . ")";
                 }
                 echo "</a></td>";
                 if (Session::isMultiEntitiesMode()) {
                     echo "<td class='center'>" . Dropdown::getDropdownName("glpi_entities", $data['entities_id']) . "</td>";
                 }
                 echo "<td class='center'>" . Dropdown::getDropdownName("glpi_plugin_resources_tasktypes", $data["plugin_resources_tasktypes_id"]) . "</td>";
                 echo "<td align='center'>";
                 $restrict = " `plugin_resources_tasks_id` = '" . $data['plugin_resources_tasks_id'] . "' ";
                 $plans = getAllDatasFromTable("glpi_plugin_resources_taskplannings", $restrict);
                 if (!empty($plans)) {
                     foreach ($plans as $plan) {
                         echo Html::convDateTime($plan["begin"]) . "&nbsp;->&nbsp;" . Html::convDateTime($plan["end"]);
                     }
                 } else {
                     _e('None');
                 }
                 echo "</td>";
                 echo "<td class='center'><a href='" . $CFG_GLPI["root_doc"] . "/plugins/resources/front/resource.form.php?id=" . $data["id"] . "'>" . $data["name"] . " " . $data["firstname"];
                 if ($_SESSION["glpiis_ids_visible"]) {
                     echo " (" . $data["id"] . ")";
                 }
                 echo "</a></td>";
                 echo "<td class='center'>" . getUserName($data["users_id"]) . "</td>";
                 echo "<td class='center'>" . getUserName($data["users_id_task"]) . "</td>";
                 echo "</tr>";
             }
             echo "</table></div><br>";
         }
     }
     $PluginResourcesChecklist = new PluginResourcesChecklist();
     $PluginResourcesChecklist->showOnCentral(false);
     echo "<br>";
     $PluginResourcesChecklist->showOnCentral(true);
     echo "</td></tr></table>";
 }
Beispiel #15
0
 function getSearchOptions()
 {
     $tab = array();
     $tab['common'] = self::getTypeName(2);
     $tab[1]['table'] = $this->table;
     $tab[1]['field'] = 'registration_number';
     $tab[1]['name'] = __('Administrative number');
     $tab[1]['datatype'] = 'string';
     $tab[2]['table'] = $this->table;
     $tab[2]['field'] = 'id';
     $tab[2]['name'] = __('ID');
     $tab[2]['massiveaction'] = false;
     $tab[2]['datatype'] = 'number';
     $tab[2]['nosearch'] = true;
     // FROM resources
     $tab[4350]['table'] = 'glpi_plugin_resources_resources';
     $tab[4350]['field'] = 'name';
     $tab[4350]['name'] = __('Name');
     $tab[4350]['datatype'] = 'itemlink';
     $tab[4350]['itemlink_type'] = 'PluginResourcesResource';
     $tab[4351]['table'] = 'glpi_plugin_resources_resources';
     $tab[4351]['field'] = 'firstname';
     $tab[4351]['name'] = __('First name');
     $tab[4352]['table'] = 'glpi_plugin_resources_resources';
     $tab[4352]['field'] = 'quota';
     $tab[4352]['name'] = __('Quota', 'resources');
     $tab[4352]['datatype'] = 'decimal';
     $tab[4353]['table'] = 'glpi_plugin_resources_resourcesituations';
     $tab[4353]['field'] = 'name';
     $tab[4353]['name'] = PluginResourcesResourceSituation::getTypeName(1);
     $tab[4353]['datatype'] = 'dropdown';
     $tab[4354]['table'] = 'glpi_plugin_resources_contractnatures';
     $tab[4354]['field'] = 'name';
     $tab[4354]['name'] = PluginResourcesContractNature::getTypeName(1);
     $tab[4354]['datatype'] = 'dropdown';
     $tab[4355]['table'] = 'glpi_plugin_resources_contracttypes';
     $tab[4355]['field'] = 'name';
     $tab[4355]['name'] = PluginResourcesContractType::getTypeName(1);
     $tab[4355]['datatype'] = 'dropdown';
     $tab[4356]['table'] = 'glpi_plugin_resources_resourcespecialities';
     $tab[4356]['field'] = 'name';
     $tab[4356]['name'] = PluginResourcesResourceSpeciality::getTypeName(1);
     $tab[4356]['datatype'] = 'dropdown';
     $tab[4357]['table'] = 'glpi_plugin_resources_ranks';
     $tab[4357]['field'] = 'name';
     $tab[4357]['name'] = PluginResourcesRank::getTypeName(1);
     $tab[4357]['datatype'] = 'dropdown';
     $tab[4358]['table'] = 'glpi_plugin_resources_professions';
     $tab[4358]['field'] = 'name';
     $tab[4358]['name'] = PluginResourcesProfession::getTypeName(1);
     $tab[4358]['datatype'] = 'dropdown';
     $tab[4359]['table'] = 'glpi_plugin_resources_professionlines';
     $tab[4359]['field'] = 'name';
     $tab[4359]['name'] = PluginResourcesProfessionLine::getTypeName(1);
     $tab[4359]['datatype'] = 'dropdown';
     $tab[4360]['table'] = 'glpi_plugin_resources_professioncategories';
     $tab[4360]['field'] = 'name';
     $tab[4360]['name'] = PluginResourcesProfessionCategory::getTypeName(1);
     $tab[4360]['datatype'] = 'dropdown';
     $tab[4376]['table'] = 'glpi_plugin_resources_resources';
     $tab[4376]['field'] = 'date_begin';
     $tab[4376]['name'] = __('Arrival date', 'resources');
     $tab[4376]['datatype'] = 'date';
     $tab[4377]['table'] = 'glpi_plugin_resources_resources';
     $tab[4377]['field'] = 'date_end';
     $tab[4377]['name'] = __('Departure date', 'resources');
     $tab[4377]['datatype'] = 'date';
     // FROM employment
     $tab[4361]['table'] = 'glpi_plugin_resources_employments';
     $tab[4361]['field'] = 'name';
     $tab[4361]['name'] = __('Name') . " - " . PluginResourcesEmployment::getTypeName(1);
     $tab[4361]['forcegroupby'] = true;
     $tab[4362]['table'] = 'glpi_plugin_resources_employments';
     $tab[4362]['field'] = 'ratio_employment_budget';
     $tab[4362]['name'] = __('Ratio Employment / Budget', 'resources');
     $tab[4362]['datatype'] = 'decimal';
     $tab[4363]['table'] = 'glpi_plugin_resources_employmentranks';
     $tab[4363]['field'] = 'name';
     $tab[4363]['name'] = PluginResourcesEmployment::getTypeName(1) . " - " . PluginResourcesRank::getTypeName(1);
     $tab[4363]['datatype'] = 'dropdown';
     $tab[4364]['table'] = 'glpi_plugin_resources_employmentprofessions';
     $tab[4364]['field'] = 'name';
     $tab[4364]['name'] = PluginResourcesEmployment::getTypeName(1) . " - " . PluginResourcesProfession::getTypeName(1);
     $tab[4364]['datatype'] = 'dropdown';
     $tab[4365]['table'] = 'glpi_plugin_resources_employmentprofessionlines';
     $tab[4365]['field'] = 'name';
     $tab[4365]['name'] = PluginResourcesEmployment::getTypeName(1) . " - " . PluginResourcesProfessionLine::getTypeName(1);
     $tab[4365]['datatype'] = 'dropdown';
     $tab[4366]['table'] = 'glpi_plugin_resources_employmentprofessioncategories';
     $tab[4366]['field'] = 'name';
     $tab[4366]['name'] = PluginResourcesEmployment::getTypeName(1) . " - " . PluginResourcesProfessionCategory::getTypeName(1);
     $tab[4366]['datatype'] = 'dropdown';
     $tab[4367]['table'] = 'glpi_plugin_resources_employments';
     $tab[4367]['field'] = 'begin_date';
     $tab[4367]['name'] = __('Begin date');
     $tab[4367]['datatype'] = 'date';
     $tab[4368]['table'] = 'glpi_plugin_resources_employments';
     $tab[4368]['field'] = 'end_date';
     $tab[4368]['name'] = __('End date');
     $tab[4368]['datatype'] = 'date';
     $tab[4369]['table'] = 'glpi_plugin_resources_employmentstates';
     $tab[4369]['field'] = 'name';
     $tab[4369]['name'] = PluginResourcesEmploymentState::getTypeName(1);
     $tab[4369]['datatype'] = 'dropdown';
     //From employer
     $tab[4370]['table'] = 'glpi_plugin_resources_employers';
     $tab[4370]['field'] = 'completename';
     $tab[4370]['name'] = PluginResourcesEmployer::getTypeName(1);
     $tab[4370]['datatype'] = 'dropdown';
     $tab[4371]['table'] = 'glpi_locations';
     $tab[4371]['field'] = 'completename';
     $tab[4371]['name'] = __('Employer address', 'resources');
     $tab[4371]['datatype'] = 'dropdown';
     $tab[4372]['table'] = 'glpi_plugin_resources_employmentranks';
     $tab[4372]['field'] = 'id';
     $tab[4372]['name'] = PluginResourcesEmployment::getTypeName(1) . " - " . PluginResourcesRank::getTypeName(1) . " - " . __('ID');
     $tab[4373]['table'] = 'glpi_plugin_resources_employmentprofessions';
     $tab[4373]['field'] = 'id';
     $tab[4373]['name'] = PluginResourcesEmployment::getTypeName(1) . " - " . PluginResourcesProfession::getTypeName(1) . " - " . __('ID');
     $tab[4374]['table'] = 'glpi_plugin_resources_ranks';
     $tab[4374]['field'] = 'id';
     $tab[4374]['name'] = PluginResourcesResource::getTypeName(1) . " - " . PluginResourcesRank::getTypeName(1) . " - " . __('ID');
     $tab[4375]['table'] = 'glpi_plugin_resources_professions';
     $tab[4375]['field'] = 'id';
     $tab[4375]['name'] = PluginResourcesResource::getTypeName(1) . " - " . PluginResourcesProfession::getTypeName(1) . " - " . __('ID');
     return $tab;
 }
Beispiel #16
0
Resources 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 Resources. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
include '../../../inc/includes.php';
//central or helpdesk access
if ($_SESSION['glpiactiveprofile']['interface'] == 'central') {
    Html::header(PluginResourcesResource::getTypeName(2), '', "plugins", "resources");
} else {
    Html::helpHeader(PluginResourcesResource::getTypeName(2));
}
$resource = new PluginResourcesResource();
if ($resource->canView() || Session::haveRight("config", "w")) {
    if (plugin_resources_haveRight("all", "w")) {
        //Have right to see all resources
        //Have not right to see all resources
        echo "<div align='center'><script type='text/javascript'>";
        echo "cleanhide('modal_resource_content');";
        echo "var account_window=new Ext.Window({\n            layout:'fit',\n            width:800,\n            height:400,\n            closeAction:'hide',\n            modal: true,\n            autoScroll: true,\n            title: \"" . __('View by contract type', 'resources') . "\",\n            autoLoad: '" . $CFG_GLPI['root_doc'] . "/plugins/resources/ajax/resourcetree.php'\n         });";
        echo "</script>";
        echo "<a onclick='account_window.show();' href='#modal_resource_content' title='" . __('View by contract type', 'resources') . "'>" . __('View by contract type', 'resources') . "</a>";
        echo "</div>";
    }
    Search::show("PluginResourcesResource", $_GET);
} else {
Beispiel #17
0
function plugin_resources_getAddSearchOptions($itemtype)
{
    $sopt = array();
    if ($itemtype == "User") {
        if (plugin_resources_haveRight("resources", "r")) {
            $sopt[4311]['table'] = 'glpi_plugin_resources_contracttypes';
            $sopt[4311]['field'] = 'name';
            $sopt[4311]['name'] = PluginResourcesResource::getTypeName(2) . " - " . PluginResourcesContractType::getTypeName(1);
            $sopt[4313]['table'] = 'glpi_plugin_resources_resources';
            $sopt[4313]['field'] = 'date_begin';
            $sopt[4313]['name'] = PluginResourcesResource::getTypeName(2) . " - " . __('Begin date');
            $sopt[4313]['datatype'] = 'date';
            $sopt[4314]['table'] = 'glpi_plugin_resources_resources';
            $sopt[4314]['field'] = 'date_end';
            $sopt[4314]['name'] = PluginResourcesResource::getTypeName(2) . " - " . __('End date');
            $sopt[4314]['datatype'] = 'date';
            $sopt[4315]['table'] = 'glpi_plugin_resources_departments';
            $sopt[4315]['field'] = 'name';
            $sopt[4315]['name'] = PluginResourcesResource::getTypeName(2) . " - " . PluginResourcesDepartment::getTypeName(1);
            $sopt[4316]['table'] = 'glpi_plugin_resources_resources';
            $sopt[4316]['field'] = 'date_declaration';
            $sopt[4316]['name'] = PluginResourcesResource::getTypeName(2) . " - " . __('Request date');
            $sopt[4316]['datatype'] = 'date';
            $sopt[4316]['massiveaction'] = false;
            $sopt[4317]['table'] = 'glpi_plugin_resources_locations';
            $sopt[4317]['field'] = 'completename';
            $sopt[4317]['name'] = PluginResourcesResource::getTypeName(2) . " - " . __('Location');
            $sopt[4317]['massiveaction'] = false;
            $sopt[4318]['table'] = 'glpi_plugin_resources_resources';
            $sopt[4318]['field'] = 'is_leaving';
            $sopt[4318]['name'] = PluginResourcesResource::getTypeName(2) . " - " . __('Declared as leaving', 'resources');
            $sopt[4318]['datatype'] = 'bool';
            $sopt[4320]['table'] = 'glpi_plugin_resources_employers';
            $sopt[4320]['field'] = 'name';
            $sopt[4320]['name'] = PluginResourcesResource::getTypeName(2) . " - " . __('Employer', 'resources');
            $sopt[4321]['table'] = 'glpi_plugin_resources_clients';
            $sopt[4321]['field'] = 'name';
            $sopt[4321]['name'] = PluginResourcesResource::getTypeName(2) . " - " . __('Affected client', 'resources');
            $sopt[4322]['table'] = 'glpi_plugin_resources_managers';
            $sopt[4322]['field'] = 'name';
            $sopt[4322]['linkfield'] = 'users_id';
            $sopt[4322]['name'] = PluginResourcesResource::getTypeName(2) . " - " . __('Resource manager', 'resources');
            $sopt[4322]['massiveaction'] = false;
            $sopt[4323]['table'] = 'glpi_plugin_resources_recipients';
            $sopt[4323]['field'] = 'name';
            $sopt[4323]['linkfield'] = 'users_id_recipient';
            $sopt[4323]['name'] = PluginResourcesResource::getTypeName(2) . " - " . __('Recipient');
            $sopt[4323]['massiveaction'] = false;
            $sopt[4324]['table'] = 'glpi_plugin_resources_recipients_leaving';
            $sopt[4324]['field'] = 'name';
            $sopt[4324]['linkfield'] = 'users_id_recipient_leaving';
            $sopt[4324]['name'] = PluginResourcesResource::getTypeName(2) . " - " . __('Informant of leaving', 'resources');
            $sopt[4324]['massiveaction'] = false;
        }
    }
    return $sopt;
}