예제 #1
0
 function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
 {
     $wizard_employee = PluginResourcesContractType::checkWizardSetup($item->getField('id'), "use_employee_wizard");
     if ($item->getType() == 'PluginResourcesResource' && $this->canView() && $wizard_employee) {
         return self::getTypeName(1);
     }
     return '';
 }
예제 #2
0
 function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
 {
     $wizard_need = PluginResourcesContractType::checkWizardSetup($item->getField('id'), "use_need_wizard");
     if ($item->getType() == 'PluginResourcesResource' && $this->canView() && $wizard_need) {
         if ($_SESSION['glpishow_count_on_tabs']) {
             return self::createTabEntry(self::getTypeName(2), self::countForResource($item));
         }
         return self::getTypeName(2);
     }
     return '';
 }
예제 #3
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[34]['table'] = $this->table;
     $tab[34]['field'] = 'realname';
     $tab[34]['name'] = __('Surname');
     $tab[34]['datatype'] = 'string';
     $tab[9]['table'] = $this->table;
     $tab[9]['field'] = 'firstname';
     $tab[9]['name'] = __('First name');
     $tab[9]['datatype'] = 'string';
     $tab[5]['table'] = 'glpi_useremails';
     $tab[5]['field'] = 'email';
     $tab[5]['name'] = _n('Email', 'Emails', 2);
     $tab[5]['datatype'] = 'email';
     $tab[5]['joinparams'] = array('jointype' => 'child');
     $tab[5]['forcegroupby'] = true;
     $tab[5]['massiveaction'] = false;
     $tab += Location::getSearchOptionsToAdd();
     $tab[6]['table'] = $this->table;
     $tab[6]['field'] = 'phone';
     $tab[6]['name'] = __('Phone');
     $tab[6]['datatype'] = 'string';
     $tab[10]['table'] = $this->table;
     $tab[10]['field'] = 'phone2';
     $tab[10]['name'] = __('Phone 2');
     $tab[10]['datatype'] = 'string';
     $tab[11]['table'] = $this->table;
     $tab[11]['field'] = 'mobile';
     $tab[11]['name'] = __('Mobile phone');
     $tab[11]['datatype'] = 'string';
     // FROM employee
     $tab[4313]['table'] = 'glpi_plugin_resources_employers';
     $tab[4313]['field'] = 'completename';
     $tab[4313]['name'] = PluginResourcesEmployer::getTypeName(1);
     $tab[4313]['datatype'] = 'dropdown';
     $tab[4314]['table'] = 'glpi_plugin_resources_clients';
     $tab[4314]['field'] = 'name';
     $tab[4314]['name'] = PluginResourcesClient::getTypeName(1);
     $tab[4314]['datatype'] = 'dropdown';
     // FROM resources
     $tab[4315]['table'] = 'glpi_plugin_resources_contracttypes';
     $tab[4315]['field'] = 'name';
     $tab[4315]['name'] = PluginResourcesContractType::getTypeName(1);
     $tab[4315]['datatype'] = 'dropdown';
     $tab[4316]['table'] = 'glpi_plugin_resources_managers';
     $tab[4316]['field'] = 'name';
     $tab[4316]['name'] = __('Resource manager', 'resources');
     $tab[4316]['searchtype'] = 'contains';
     $tab[4316]['datatype'] = 'dropdown';
     $tab[4317]['table'] = 'glpi_plugin_resources_resources';
     $tab[4317]['field'] = 'date_begin';
     $tab[4317]['name'] = __('Arrival date', 'resources');
     $tab[4317]['datatype'] = 'date';
     $tab[4318]['table'] = 'glpi_plugin_resources_resources';
     $tab[4318]['field'] = 'date_end';
     $tab[4318]['name'] = __('Departure date', 'resources');
     $tab[4318]['datatype'] = 'date';
     $tab[4319]['table'] = 'glpi_plugin_resources_departments';
     $tab[4319]['field'] = 'name';
     $tab[4319]['name'] = PluginResourcesDepartment::getTypeName(1);
     $tab[4319]['datatype'] = 'dropdown';
     $tab[4320]['table'] = 'glpi_plugin_resources_resourcestates';
     $tab[4320]['field'] = 'name';
     $tab[4320]['name'] = PluginResourcesResourceState::getTypeName(1);
     $tab[4320]['datatype'] = 'dropdown';
     return $tab;
 }
예제 #4
0
 function showSpecificMassiveActionsParameters($input = array())
 {
     $PluginResourcesChecklist = new PluginResourcesChecklist();
     $PluginResourcesContractType = new PluginResourcesContractType();
     switch ($input['action']) {
         case "Generate_Rule":
             $PluginResourcesChecklist->dropdownChecklistType("checklist_type", $_SESSION["glpiactive_entity"]);
             echo " ";
             RuleCriteria::dropdownConditions("PluginResourcesRuleChecklist", array('criterion' => 'plugin_resources_contracttypes_id', 'allow_conditions' => array(Rule::PATTERN_IS, Rule::PATTERN_IS_NOT)));
             echo " ";
             $PluginResourcesContractType->dropdownContractType("plugin_resources_contracttypes_id");
             echo " ";
             echo "<input type=\"submit\" name=\"massiveaction\" class=\"submit\" value='" . _sx('button', 'Post') . "'>";
             return true;
             break;
         case "Transfert":
             Dropdown::show('Entity');
             echo "&nbsp;<input type=\"submit\" name=\"massiveaction\" class=\"submit\" value='" . _sx('button', 'Post') . "'>";
             return true;
             break;
         default:
             return parent::showSpecificMassiveActionsParameters($input);
             break;
     }
     return false;
 }
예제 #5
0
 /** 
  * show for PDF the resources associated with a device
  * 
  * @param $ID of the device
  * @param $itemtype : type of the device
  * 
  */
 static function PdfFromItems($pdf, $item)
 {
     global $DB, $CFG_GLPI;
     $pdf->setColumnsSize(100);
     $pdf->displayTitle('<b>' . __('Associated Human Resource', 'resources') . '</b>');
     $ID = $item->getField('id');
     $itemtype = get_Class($item);
     $canread = $item->can($ID, 'r');
     $canedit = $item->can($ID, 'w');
     $PluginResourcesResource = new PluginResourcesResource();
     $query = "SELECT `glpi_plugin_resources_resources`.* " . " FROM `glpi_plugin_resources_resources_items`,`glpi_plugin_resources_resources` " . " LEFT JOIN `glpi_entities` ON (`glpi_entities`.`id` = `glpi_plugin_resources_resources`.`entities_id`) " . " WHERE `glpi_plugin_resources_resources_items`.`items_id` = '" . $ID . "' \n         AND `glpi_plugin_resources_resources_items`.`itemtype` = '" . $itemtype . "' \n         AND `glpi_plugin_resources_resources_items`.`plugin_resources_resources_id` = `glpi_plugin_resources_resources`.`id` " . getEntitiesRestrictRequest(" AND ", "glpi_plugin_resources_resources", '', '', $PluginResourcesResource->maybeRecursive());
     $result = $DB->query($query);
     $number = $DB->numrows($result);
     if (!$number) {
         $pdf->displayLine(__('No item found'));
     } else {
         if (Session::isMultiEntitiesMode()) {
             $pdf->setColumnsSize(14, 14, 14, 14, 14, 14, 16);
             $pdf->displayTitle('<b><i>' . __('Name'), __('Entity'), __('Location'), PluginResourcesContractType::getTypeName(1), PluginResourcesDepartment::getTypeName(1), __('Arrival date', 'resources'), __('Departure date', 'resources') . '</i></b>');
         } else {
             $pdf->setColumnsSize(17, 17, 17, 17, 17, 17);
             $pdf->displayTitle('<b><i>' . __('Name'), __('Location'), PluginResourcesContractType::getTypeName(1), PluginResourcesDepartment::getTypeName(1), __('Arrival date', 'resources'), __('Departure date', 'resources') . '</i></b>');
         }
         while ($data = $DB->fetch_array($result)) {
             $resourcesID = $data["id"];
             if (Session::isMultiEntitiesMode()) {
                 $pdf->setColumnsSize(14, 14, 14, 14, 14, 14, 16);
                 $pdf->displayLine($data["name"], Html::clean(Dropdown::getDropdownName("glpi_entities", $data['entities_id'])), Html::clean(Dropdown::getDropdownName("glpi_locations", $data["locations_id"])), Html::clean(Dropdown::getDropdownName("glpi_plugin_resources_contracttypes", $data["plugin_resources_contracttypes_id"])), Html::clean(Dropdown::getDropdownName("glpi_plugin_resources_departments", $data["plugin_resources_departments_id"])), Html::convDate($data["date_begin"]), Html::convDate($data["date_end"]));
             } else {
                 $pdf->setColumnsSize(17, 17, 17, 17, 17, 17);
                 $pdf->displayLine($data["name"], Html::clean(Dropdown::getDropdownName("glpi_locations", $data["locations_id"])), Html::clean(Dropdown::getDropdownName("glpi_plugin_resources_contracttypes", $data["plugin_resources_contracttypes_id"])), Html::clean(Dropdown::getDropdownName("glpi_plugin_resources_departments", $data["plugin_resources_departments_id"])), Html::convDate($data["date_begin"]), Html::convDate($data["date_end"]));
             }
         }
     }
 }
예제 #6
0
     $wizard_picture = PluginResourcesContractType::checkWizardSetup($_POST["plugin_resources_resources_id"], "use_picture_wizard");
     if ($wizard_need) {
         $choice->wizardFourForm($_POST["plugin_resources_resources_id"]);
     } elseif ($wizard_picture) {
         $values = array();
         $values['target'] = Toolbox::getItemTypeFormURL('PluginResourcesWizard');
         $resource->wizardFiveForm($_POST["plugin_resources_resources_id"], $values);
     } else {
         $resource->fields['plugin_resources_resources_id'] = $_POST['plugin_resources_resources_id'];
         $resource->fields['resources_step'] = 'third_step';
         Plugin::doHook('item_show', $resource);
         $resource->redirectToList();
     }
 } else {
     if (isset($_POST["four_step"])) {
         $wizard_picture = PluginResourcesContractType::checkWizardSetup($_POST["plugin_resources_resources_id"], "use_picture_wizard");
         if ($wizard_picture) {
             $values = array();
             $values['target'] = Toolbox::getItemTypeFormURL('PluginResourcesWizard');
             $resource->wizardFiveForm($_POST["plugin_resources_resources_id"], $values);
         } else {
             $resource->fields['plugin_resources_resources_id'] = $_POST['plugin_resources_resources_id'];
             $resource->fields['resources_step'] = 'four_step';
             Plugin::doHook('item_show', $resource);
             $resource->redirectToList();
         }
     } else {
         if (isset($_POST["updateneedcomment"])) {
             if ($resource->canCreate()) {
                 foreach ($_POST["updateneedcomment"] as $key => $val) {
                     $varcomment = "commentneed" . $key;
예제 #7
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;
 }
예제 #8
0
 /**
  * Return a value associated with a pattern associated to a criteria to display it
  *
  * @param $ID the given criteria
  * @param $condition condition used
  * @param $pattern the pattern
  **/
 function getCriteriaDisplayPattern($ID, $condition, $pattern)
 {
     if ($condition == Rule::PATTERN_IS || $condition == Rule::PATTERN_IS_NOT) {
         $crit = $this->getCriteria($ID);
         if (isset($crit['type'])) {
             switch ($crit['type']) {
                 case "dropdownChecklistType":
                     $PluginResourcesChecklist = new PluginResourcesChecklist();
                     return $PluginResourcesChecklist->getChecklistType($pattern);
                 case "dropdownContractType":
                     $PluginResourcesContractType = new PluginResourcesContractType();
                     return $PluginResourcesContractType->getContractTypeName($pattern);
             }
         }
     }
     return $pattern;
 }
예제 #9
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>";
         }
     }
 }
예제 #10
0
 /**
  * Show for PDF an resources
  *
  * @param $pdf object for the output
  * @param $ID of the resources
  */
 function show_PDF($pdf)
 {
     $pdf->setColumnsSize(50, 50);
     $col1 = '<b>' . __('ID') . ' ' . $this->fields['id'] . '</b>';
     if (isset($this->fields["date_declaration"])) {
         $users_id_recipient = new User();
         $users_id_recipient->getFromDB($this->fields["users_id_recipient"]);
         $col2 = __('Request date') . ' : ' . Html::convDateTime($this->fields["date_declaration"]) . ' ' . __('Requester') . ' ' . $users_id_recipient->getName();
     } else {
         $col2 = '';
     }
     $pdf->displayTitle($col1, $col2);
     $pdf->displayLine('<b><i>' . __('Name') . ' :</i></b> ' . $this->fields['name'], '<b><i>' . __('First name') . ' :</i></b> ' . $this->fields['firstname']);
     $pdf->displayLine('<b><i>' . __('Location') . ' :</i></b> ' . Html::clean(Dropdown::getDropdownName('glpi_locations', $this->fields['locations_id'])), '<b><i>' . PluginResourcesContractType::getTypeName(1) . ' :</i></b> ' . Html::clean(Dropdown::getDropdownName('glpi_plugin_resources_contracttypes', $this->fields['plugin_resources_contracttypes_id'])));
     $pdf->displayLine('<b><i>' . __('Resource manager', 'resources') . ' :</i></b> ' . Html::clean(getusername($this->fields["users_id"])), '<b><i>' . PluginResourcesDepartment::getTypeName(1) . ' :</i></b> ' . Html::clean(Dropdown::getDropdownName('glpi_plugin_resources_departments', $this->fields["plugin_resources_departments_id"])));
     $pdf->displayLine('<b><i>' . __('Arrival date', 'resources') . ' :</i></b> ' . Html::convDate($this->fields["date_begin"]), '<b><i>' . __('Departure date', 'resources') . ' :</i></b> ' . Html::convDate($this->fields["date_end"]));
     $pdf->setColumnsSize(100);
     $pdf->displayText('<b><i>' . __('Description') . ' :</i></b>', $this->fields['comment']);
     $pdf->displaySpace();
 }
 function getTags()
 {
     $tags = array('resource.id' => 'ID', 'resource.name' => __('Name'), 'resource.firstname' => __('First name'), 'resource.type' => PluginResourcesContractType::getTypeName(1), 'resource.quota' => __('Quota', 'resources'), 'resource.situation' => PluginResourcesResourceSituation::getTypeName(1), 'resource.contractnature' => PluginResourcesContractNature::getTypeName(1), 'resource.rank' => PluginResourcesRank::getTypeName(1), 'resource.speciality' => PluginResourcesResourceSpeciality::getTypeName(1), 'resource.users' => __('Resource manager', 'resources'), 'resource.usersrecipient' => __('Requester'), 'resource.datedeclaration' => __('Request date'), 'resource.datebegin' => __('Arrival date', 'resources'), 'resource.dateend' => __('Departure date', 'resources'), 'resource.department' => PluginResourcesDepartment::getTypeName(1), 'resource.location' => __('Location'), 'resource.comment' => __('Description'), 'resource.usersleaving' => __('Informant of leaving', 'resources'), 'resource.leaving' => __('Declared as leaving', 'resources'), 'resource.leavingreason' => PluginResourcesLeavingReason::getTypeName(1), 'resource.helpdesk' => __('Associable to a ticket'), 'resource.action_user' => __('Last updater'), 'update.name' => __('Name'), 'update.firstname' => __('First name'), 'update.type' => PluginResourcesContractType::getTypeName(1), 'update.quota' => __('Quota', 'resources'), 'update.situation' => PluginResourcesResourceSituation::getTypeName(1), 'update.contractnature' => PluginResourcesContractNature::getTypeName(1), 'update.rank' => PluginResourcesRank::getTypeName(1), 'update.speciality' => PluginResourcesResourceSpeciality::getTypeName(1), 'update.users' => __('Resource manager', 'resources'), 'update.usersrecipient' => __('Requester'), 'update.datedeclaration' => __('Request date'), 'update.datebegin' => __('Arrival date', 'resources'), 'update.dateend' => __('Departure date', 'resources'), 'update.department' => PluginResourcesDepartment::getTypeName(1), 'update.status' => PluginResourcesResourceState::getTypeName(1), 'update.location' => __('Location'), 'update.comment' => __('Description'), 'update.usersleaving' => __('Informant of leaving', 'resources'), 'update.leaving' => __('Declared as leaving', 'resources'), 'update.leavingreason' => PluginResourcesLeavingReason::getTypeName(1), 'update.helpdesk' => __('Associable to a ticket'), 'task.name' => __('Name'), 'task.type' => __('Type'), 'task.users' => __('Technician'), 'task.groups' => __('Group'), 'task.datebegin' => __('Begin date'), 'task.dateend' => __('End date'), 'task.planned' => __('Used for planning', 'resources'), 'task.realtime' => __('Effective duration', 'resources'), 'task.finished' => __('Carried out task', 'resources'), 'task.comment' => __('Description'));
     foreach ($tags as $tag => $label) {
         $this->addTagToList(array('tag' => $tag, 'label' => $label, 'value' => true));
     }
     $this->addTagToList(array('tag' => 'resource', 'label' => __('At creation, update, removal of a resource', 'resources'), 'value' => false, 'foreach' => true, 'events' => array('new', 'update', 'delete', 'report', 'newresting', 'updateresting', 'deleteresting', 'newholiday', 'updateholiday', 'deleteholiday')));
     $this->addTagToList(array('tag' => 'updates', 'label' => __('Modified fields', 'resources'), 'value' => false, 'foreach' => true, 'events' => array('update', 'updateresting', 'updateholiday')));
     $this->addTagToList(array('tag' => 'tasks', 'label' => __('At creation, update, removal of a task', 'resources'), 'value' => false, 'foreach' => true, 'events' => array('newtask', 'updatetask', 'deletetask')));
     asort($this->tag_descriptions);
 }
예제 #12
0
파일: hook.php 프로젝트: geldarr/hack-space
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;
}