dolibarr  20.0.0-alpha
skill_tab.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2021 grégory Blémand <contact@atm-consulting.fr>
3  * Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
4  * Copyright (C) 2021 Greg Rastklan <greg.rastklan@atm-consulting.fr>
5  * Copyright (C) 2021 Jean-Pascal BOUDET <jean-pascal.boudet@atm-consulting.fr>
6  * Copyright (C) 2021 Grégory BLEMAND <gregory.blemand@atm-consulting.fr>
7  * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program. If not, see <https://www.gnu.org/licenses/>.
21  */
22 
30 // Load Dolibarr environment
31 require '../main.inc.php';
32 
33 require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php';
34 require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php';
35 require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
36 require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php';
37 require_once DOL_DOCUMENT_ROOT . '/hrm/class/job.class.php';
38 require_once DOL_DOCUMENT_ROOT . '/hrm/class/skill.class.php';
39 require_once DOL_DOCUMENT_ROOT . '/hrm/class/skillrank.class.php';
40 require_once DOL_DOCUMENT_ROOT . '/hrm/lib/hrm_skill.lib.php';
41 require_once DOL_DOCUMENT_ROOT .'/hrm/class/evaluation.class.php';
42 require_once DOL_DOCUMENT_ROOT.'/hrm/lib/hrm_evaluation.lib.php';
43 
44 // Load translation files required by the page
45 $langs->loadLangs(array('hrm', 'other'));
46 
47 // Get Parameters
48 $action = GETPOST('action', 'aZ09');
49 $confirm = GETPOST('confirm', 'alpha');
50 $cancel = GETPOST('cancel', 'aZ09');
51 $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'skillcard'; // To manage different context of search
52 $backtopage = GETPOST('backtopage', 'alpha');
53 $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
54 
55 $id = GETPOSTINT('id');
56 $TSkillsToAdd = GETPOST('fk_skill', 'array');
57 $objecttype = GETPOST('objecttype', 'alpha');
58 $TNote = GETPOST('TNote', 'array');
59 $lineid = GETPOSTINT('lineid');
60 
61 if (empty($objecttype)) {
62  $objecttype = 'job';
63 }
64 
65 $TAuthorizedObjects = array('job', 'user');
66 $skill = new SkillRank($db);
67 
68 // Initialize technical objects
69 if (in_array($objecttype, $TAuthorizedObjects)) {
70  if ($objecttype == 'job') {
71  $object = new Job($db);
72  } elseif ($objecttype == "user") {
73  $object = new User($db);
74  }
75 } else {
76  accessforbidden('ErrorBadObjectType');
77 }
78 
79 $hookmanager->initHooks(array('skilltab', 'globalcard')); // Note that conf->hooks_modules contains array
80 
81 // Load object
82 include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
83 if (method_exists($object, 'loadPersonalConf')) {
84  $object->loadPersonalConf();
85 }
86 
87 // Permissions
88 $permissiontoread = $user->hasRight('hrm', 'all', 'read');
89 $permissiontoadd = $user->hasRight('hrm', 'all', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
90 
91 // Security check (enable the most restrictive one)
92 if ($user->socid > 0) {
94 }
95 if (!isModEnabled('hrm')) {
97 }
98 if (!$permissiontoread) {
100 }
101 
102 
103 /*
104  * Actions
105  */
106 
107 $parameters = array();
108 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
109 if ($reshook < 0) {
110  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
111 }
112 
113 if (empty($reshook)) {
114  $error = 0;
115 
116  $backurlforlist = DOL_URL_ROOT.'/hrm/skill_list.php';
117 
118  if (empty($backtopage) || ($cancel && empty($id))) {
119  if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
120  if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
121  $backtopage = $backurlforlist;
122  } else {
123  $backtopage = DOL_URL_ROOT.'/hrm/skill_list.php?id=' . ($id > 0 ? $id : '__ID__');
124  }
125  }
126  }
127 
128  // update national_registration_number
129  if ($action == 'setnational_registration_number') {
130  $object->national_registration_number = (string) GETPOST('national_registration_number', 'alphanohtml');
131  $result = $object->update($user);
132  if ($result < 0) {
133  setEventMessages($object->error, $object->errors, 'errors');
134  }
135  }
136 
137  if ($action == 'addSkill') {
138  $error = 0;
139 
140  if (empty($TSkillsToAdd)) {
141  setEventMessage('ErrNoSkillSelected', 'errors');
142  $error++;
143  }
144  if (!$error) {
145  foreach ($TSkillsToAdd as $k => $v) {
146  $skillAdded = new SkillRank($db);
147  $skillAdded->fk_skill = $v;
148  $skillAdded->fk_object = $id;
149  $skillAdded->objecttype = $objecttype;
150  $ret = $skillAdded->create($user);
151  if ($ret < 0) {
152  setEventMessages($skillAdded->error, null, 'errors');
153  }
154  //else unset($TSkillsToAdd);
155  }
156  if ($ret > 0) {
157  setEventMessages($langs->trans("SaveAddSkill"), null);
158  }
159  }
160  } elseif ($action == 'saveSkill') {
161  if (!empty($TNote)) {
162  foreach ($TNote as $skillId => $rank) {
163  $TSkills = $skill->fetchAll('ASC', 't.rowid', 0, 0, '(fk_object:=:'.((int) $id).") AND (objecttype:=:'".$db->escape($objecttype)."') AND (fk_skill:=:".((int) $skillId).')');
164  if (is_array($TSkills) && !empty($TSkills)) {
165  foreach ($TSkills as $tmpObj) {
166  $tmpObj->rankorder = $rank;
167  $tmpObj->update($user);
168  }
169  }
170  }
171  setEventMessages($langs->trans("SaveLevelSkill"), null);
172  header("Location: " . DOL_URL_ROOT.'/hrm/skill_tab.php?id=' . $id. '&objecttype=job');
173  exit;
174  }
175  } elseif ($action == 'confirm_deleteskill' && $confirm == 'yes') {
176  $skillToDelete = new SkillRank($db);
177  $ret = $skillToDelete->fetch($lineid);
178  setEventMessages($langs->trans("DeleteSkill"), null);
179  if ($ret > 0) {
180  $skillToDelete->delete($user);
181  }
182  }
183 }
184 
185 /*
186  * View
187  */
188 
189 $form = new Form($db);
190 $formfile = new FormFile($db);
191 $formproject = new FormProjets($db);
192 
193 $title = $langs->trans("RequiredSkills");
194 $help_url = '';
195 llxHeader('', $title, $help_url);
196 
197 // Part to show record
198 if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) {
199  $res = $object->fetch_optionals();
200 
201  // view configuration
202  if ($objecttype == 'job') {
203  require_once DOL_DOCUMENT_ROOT . '/hrm/lib/hrm_job.lib.php';
204  $head = jobPrepareHead($object);
205  $listLink = dol_buildpath('/hrm/job_list.php', 1);
206  } elseif ($objecttype == "user") {
207  require_once DOL_DOCUMENT_ROOT . "/core/lib/usergroups.lib.php";
208  $object->getRights();
209  $head = user_prepare_head($object);
210  $listLink = dol_buildpath('/user/list.php', 1);
211  }
212 
213  print dol_get_fiche_head($head, 'skill_tab', $langs->trans("Workstation"), -1, $object->picto);
214 
215  $formconfirm = '';
216 
217  // Confirmation to delete
218  /*if ($action == 'delete') {
219  $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteSkill'), $langs->trans('ConfirmDeleteObject'), 'confirm_delete', '', 0, 1);
220  }*/
221  // Confirmation to delete line
222  if ($action == 'ask_deleteskill') {
223  $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id . '&objecttype=' . $objecttype . '&lineid=' . $lineid, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteskill', '', 0, 1);
224  }
225  // Clone confirmation
226  /*if ($action == 'clone') {
227  // Create an array for form
228  $formquestion = array();
229  $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneAsk', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
230  }*/
231 
232  // Call Hook formConfirm
233  $parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid);
234  $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
235  if (empty($reshook)) {
236  $formconfirm .= $hookmanager->resPrint;
237  } elseif ($reshook > 0) {
238  $formconfirm = $hookmanager->resPrint;
239  }
240 
241  // Print form confirm
242  print $formconfirm;
243 
244 
245  // Object card
246  // ------------------------------------------------------------
247  if ($objecttype == 'job') {
248  $linkback = '<a href="' . dol_buildpath('/hrm/job_list.php', 1) . '?restore_lastsearch_values=1' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
249 
250  $morehtmlref = '<div class="refid">';
251  $morehtmlref .= $object->label;
252  $morehtmlref .= '</div>';
253 
254  dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'rowid', $morehtmlref);
255  } else {
256  $linkback = '<a href="' . $listLink . '?restore_lastsearch_values=1' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
257 
258  $morehtmlref = '<a href="'.DOL_URL_ROOT.'/user/vcard.php?id='.$object->id.'&output=file&file='.urlencode(dol_sanitizeFileName($object->getFullName($langs).'.vcf')).'" class="refid" rel="noopener">';
259  $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"');
260  $morehtmlref .= '</a>';
261 
262  $urltovirtualcard = '/user/virtualcard.php?id='.((int) $object->id);
263  $morehtmlref .= dolButtonToOpenUrlInDialogPopup('publicvirtualcard', $langs->trans("PublicVirtualCardUrl").' - '.$object->getFullName($langs), img_picto($langs->trans("PublicVirtualCardUrl"), 'card', 'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard, '', 'nohover');
264 
265  dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'rowid', $morehtmlref, '&objecttype='.$objecttype);
266  }
267 
268  // Get all available skills
269  $static_skill = new Skill($db);
270  $TAllSkills = $static_skill->fetchAll();
271 
272  // Array format for multiselectarray function
273  $TAllSkillsFormatted = array();
274  if (!empty($TAllSkills)) {
275  foreach ($TAllSkills as $k => $v) {
276  $TAllSkillsFormatted[$k] = $v->label;
277  }
278  }
279 
280  // table of skillRank linked to current object
281  //$TSkillsJob = $skill->fetchAll('ASC', 't.rowid', 0, 0);
282  $sql_skill = "SELECT sr.fk_object, sr.rowid, s.label,s.skill_type, sr.rankorder, sr.fk_skill";
283  $sql_skill .= " FROM ".MAIN_DB_PREFIX."hrm_skillrank AS sr";
284  $sql_skill .= " JOIN ".MAIN_DB_PREFIX."hrm_skill AS s ON sr.fk_skill = s.rowid";
285  $sql_skill .= " AND sr.fk_object = ".((int) $id);
286  $result = $db->query($sql_skill);
287  $numSkills = $db->num_rows($result);
288  $TSkillsJob = array();
289  for ($i = 0; $i < $numSkills; $i++) {
290  $objSkillRank = $db->fetch_object($result);
291  $TSkillsJob[] = $objSkillRank;
292  }
293 
294  $TAlreadyUsedSkill = array();
295  if (is_array($TSkillsJob) && !empty($TSkillsJob)) {
296  foreach ($TSkillsJob as $skillElement) {
297  $TAlreadyUsedSkill[$skillElement->fk_skill] = $skillElement->fk_skill;
298  }
299  }
300 
301  print '<div class="fichecenter">';
302  print '<div class="fichehalfleft">';
303 
304  print '<div class="underbanner clearboth"></div>';
305  print '<table class="border centpercent tableforfield">'."\n";
306 
307  if ($objecttype == 'job') {
308  // Common attributes
309  //$keyforbreak='fieldkeytoswitchonsecondcolumn'; // We change column just before this field
310  //unset($object->fields['fk_project']); // Hide field already shown in banner
311  //unset($object->fields['fk_soc']); // Hide field already shown in banner
312  $object->fields['label']['visible'] = 0; // Already in banner
313  include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php';
314 
315  // Other attributes. Fields from hook formObjectOptions and Extrafields.
316  include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
317  } else {
318  // Login
319  print '<tr><td class="titlefield">'.$langs->trans("Login").'</td>';
320  if (!empty($object->ldap_sid) && $object->statut == 0) {
321  print '<td class="error">';
322  print $langs->trans("LoginAccountDisableInDolibarr");
323  print '</td>';
324  } else {
325  print '<td>';
326  $addadmin = '';
327  if (property_exists($object, 'admin')) {
328  if (isModEnabled('multicompany') && !empty($object->admin) && empty($object->entity)) {
329  $addadmin .= img_picto($langs->trans("SuperAdministratorDesc"), "redstar", 'class="paddingleft"');
330  } elseif (!empty($object->admin)) {
331  $addadmin .= img_picto($langs->trans("AdministratorDesc"), "star", 'class="paddingleft"');
332  }
333  }
334  print showValueWithClipboardCPButton(!empty($object->login) ? $object->login : '').$addadmin;
335  print '</td>';
336  }
337  print '</tr>'."\n";
338 
339  $object->fields['label']['visible'] = 0; // Already in banner
340  $object->fields['firstname']['visible'] = 0; // Already in banner
341  $object->fields['lastname']['visible'] = 0; // Already in banner
342  //include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php';
343 
344  // Ref employee
345  print '<tr><td class="titlefield">'.$langs->trans("RefEmployee").'</td>';
346  print '<td class="error">';
347  print showValueWithClipboardCPButton(!empty($object->ref_employee) ? $object->ref_employee : '');
348  print '</td>';
349  print '</tr>'."\n";
350 
351  // National Registration Number
352  print '<tr><td class="titlefield">'.$langs->trans("NationalRegistrationNumber").' <a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&objecttype=user&action=editnational_registration_number&token='.newToken().'">'.img_picto($langs->trans("Edit"), 'edit').'</a></td>';
353  print '<td>';
354  if ($action == 'editnational_registration_number') {
355  $ret = '<form method="post" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&objecttype=user">';
356  $ret .= '<input type="hidden" name="action" value="setnational_registration_number">';
357  $ret .= '<input type="hidden" name="token" value="'.newToken().'">';
358  $ret .= '<input type="hidden" name="id" value="'.$object->id.'">';
359  $ret .= '<input type="text" name="national_registration_number" value="'.$object->national_registration_number.'">';
360  $ret .= '<input type="submit" class="button smallpaddingimp" name="modify" value="'.$langs->trans("Modify").'"> ';
361  $ret .= '<input type="submit" class="button smallpaddingimp button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
362  $ret .= '</form>';
363  print $ret;
364  } else {
365  print showValueWithClipboardCPButton(!empty($object->national_registration_number) ? $object->national_registration_number : '');
366  }
367  print '</td>';
368  print '</tr>'."\n";
369  }
370 
371  print '</table>';
372 
373  print '</div>';
374  print '</div>';
375 
376 
377  print '<div class="clearboth"></div><br>';
378 
379  if ($objecttype != 'user' && $permissiontoadd) {
380  // form to add new skills
381  print '<br>';
382  print '<form name="addSkill" method="post" action="' . $_SERVER['PHP_SELF'] . '">';
383  print '<input type="hidden" name="objecttype" value="' . $objecttype . '">';
384  print '<input type="hidden" name="id" value="' . $id . '">';
385  print '<input type="hidden" name="action" value="addSkill">';
386  print '<input type="hidden" name="token" value="'.newToken().'">';
387  print '<div class="div-table-responsive-no-min">';
388  print '<table id="tablelines" class="noborder noshadow" width="100%">';
389  print '<tr><td style="width:90%">' . $langs->trans('AddSkill') . '</td><td style="width:10%"></td></tr>';
390  print '<tr>';
391  print '<td>';
392  print img_picto('', 'shapes', 'class="pictofixedwidth"');
393  print $form->multiselectarray('fk_skill', array_diff_key($TAllSkillsFormatted, $TAlreadyUsedSkill), array(), 0, 0, 'widthcentpercentminusx') . '</td>';
394  print '<td><input class="button reposition" type="submit" value="' . $langs->trans('Add') . '"></td>';
395  print '</tr>';
396  print '</table>';
397  print '</div>';
398  print '</form>';
399  }
400  print '<br>';
401 
402  print '<div class="clearboth"></div>';
403 
404  if ($objecttype != 'user' && $permissiontoadd) {
405  print '<form name="saveSkill" method="post" action="' . $_SERVER['PHP_SELF'] . '">';
406  print '<input type="hidden" name="objecttype" value="' . $objecttype . '">';
407  print '<input type="hidden" name="id" value="' . $id . '">';
408  print '<input type="hidden" name="token" value="'.newToken().'">';
409  print '<input type="hidden" name="action" value="saveSkill">';
410  }
411  if ($objecttype != 'user') {
412  print '<div class="div-table-responsive-no-min">';
413  print '<table id="tablelines" class="noborder centpercent" width="100%">';
414  print '<tr class="liste_titre">';
415  print '<th>'.$langs->trans('SkillType').'</th>';
416  print '<th>'.$langs->trans('Label').'</th>';
417  print '<th>'.$langs->trans('Description').'</th>';
418  print '<th>'.$langs->trans($objecttype === 'job' ? 'RequiredRank' : 'EmployeeRank').'</th>';
419  if ($objecttype === 'job') {
420  print '<th class="linecoledit"></th>';
421  print '<th class="linecoldelete"></th>';
422  }
423  print '</tr>';
424  if (!is_array($TSkillsJob) || empty($TSkillsJob)) {
425  print '<tr><td><span class="opacitymedium">' . $langs->trans("NoRecordFound") . '</span></td></tr>';
426  } else {
427  $sk = new Skill($db);
428  foreach ($TSkillsJob as $skillElement) {
429  $sk->fetch((int) $skillElement->fk_skill);
430  print '<tr>';
431  print '<td>';
432  print Skill::typeCodeToLabel($sk->skill_type);
433  print '</td><td class="linecolfk_skill">';
434  print $sk->getNomUrl(1);
435  print '</td>';
436  print '<td>';
437  print $sk->description;
438  print '</td><td class="linecolrank">';
439  print displayRankInfos($skillElement->rankorder, $skillElement->fk_skill, 'TNote', $objecttype == 'job' && $permissiontoadd ? 'edit' : 'view');
440  print '</td>';
441  if ($objecttype != 'user' && $permissiontoadd) {
442  print '<td class="linecoledit"></td>';
443  print '<td class="linecoldelete">';
444  print '<a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?id=' . $skillElement->fk_object . '&amp;objecttype=' . $objecttype . '&amp;action=ask_deleteskill&amp;lineid=' . $skillElement->id . '">';
445  print img_delete();
446  print '</a>';
447  }
448  print '</td>';
449  print '</tr>';
450  }
451  }
452 
453  print '</table>';
454  if ($objecttype != 'user' && $permissiontoadd) {
455  print '<td><input class="button pull-right" type="submit" value="' . $langs->trans('SaveRank') . '"></td>';
456  }
457  print '</div>';
458  if ($objecttype != 'user' && $permissiontoadd) {
459  print '</form>';
460  }
461  }
462 
463 
464  // liste des evaluation liées
465  if ($objecttype == 'user' && $permissiontoadd) {
466  $evaltmp = new Evaluation($db);
467  $job = new Job($db);
468  $sql = "select e.rowid,e.ref,e.fk_user,e.fk_job,e.date_eval,ed.rankorder,ed.required_rank,ed.fk_skill,s.label";
469  $sql .= " FROM ".MAIN_DB_PREFIX."hrm_evaluation as e";
470  $sql .= ", ".MAIN_DB_PREFIX."hrm_evaluationdet as ed";
471  $sql .= ", ".MAIN_DB_PREFIX."hrm_skill as s";
472  $sql .= " WHERE e.rowid = ed.fk_evaluation";
473  $sql .= " AND s.rowid = ed.fk_skill";
474  $sql .= " AND e.fk_user = ".((int) $id);
475  $sql .= " AND e.status > 0";
476  $resql = $db->query($sql);
477  $num = $db->num_rows($resql);
478 
479  //num of evaluations for each user
480  $sqlEval = "SELECT rowid FROM ".MAIN_DB_PREFIX."hrm_evaluation as e";
481  $sqlEval .= " WHERE e.fk_user = ".((int) $id);
482  $rslt = $db->query($sqlEval);
483  $numEval = $db->num_rows($sqlEval);
484 
485  $page = 0;
486  print_barre_liste($langs->trans("Evaluations"), $page, $_SERVER["PHP_SELF"], '', '', '', '', $numEval, $numEval, $evaltmp->picto, 0);
487 
488  print '<div class="div-table-responsive-no-min">';
489  print '<table id="tablelines" class="noborder centpercent" width="100%">';
490  print '<tr class="liste_titre">';
491  print '<th>'.$langs->trans('Label').'</th>';
492  print '<th>'.$langs->trans('Description').'</th>';
493  print '<th>'.$langs->trans('DateEval').'</th>';
494  print '<th>'.$langs->trans('Status').'</th>';
495  print '<th>'.$langs->trans("Result").' ' .$form->textwithpicto('', GetLegendSkills(), 1) .'</th>';
496  print '</tr>';
497  if (!$resql) {
498  print '<tr><td><span class="opacitymedium">' . $langs->trans("NoRecordFound") . '</span></td></tr>';
499  } else {
500  $i = 0;
501  $sameRef = array();
502  $objects = array();
503  while ($i < $num) {
504  $obj = $db->fetch_object($resql);
505  $obj->result = getRankOrderResults($obj);
506  $objects[$i] = $obj;
507  $i++;
508  }
509  //grouped skills by evaluation
510  $resultArray = getGroupedEval($objects);
511  foreach ($resultArray as $object) {
512  if (is_array($object)) {
513  $evaltmp->fetch($object[0]->rowid);
514  $evaltmp->id = $object[0]->rowid;
515  $evaltmp->ref = $object[0]->ref;
516  $job->fetch($object[0]->fk_job);
517  } else {
518  $evaltmp->ref = $object->ref;
519  $evaltmp->fetch($object->rowid);
520  $evaltmp->id = $object->rowid;
521  $job->fetch($object->fk_job);
522  }
523 
524  print '<tr>';
525  print '<td>';
526  print $evaltmp->getNomUrl(1);
527  print '</td><td class="linecolfk_skill">';
528  print $job->getNomUrl(1);
529  print '</td>';
530  print '<td>';
531  print dol_print_date((!is_array($object) ? $object->date_eval : $object[0]->date_eval), 'day', 'tzserver');
532  print '</td><td>';
533  print $evaltmp->getLibStatut(2);
534  print '</td>';
535  print '<td class="linecolrank tdoverflowmax300">';
536 
537  if (!is_array($object)) {
538  print $object->result;
539  } else {
540  foreach ($object as $skill) {
541  print $skill->result;
542  }
543  }
544  print '</td>';
545  print '</tr>';
546  }
547  }
548  print '</table>';
549  }
550 
551  print dol_get_fiche_end();
552 }
553 
554 llxFooter();
555 $db->close();
if($user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition: card.php:58
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
Definition: agenda.php:118
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:56
llxFooter()
Empty footer.
Definition: wrapper.php:70
Class for Evaluation.
Class to offer components to list and upload files.
Class to manage generation of HTML components Only common components must be here.
Class to manage building of HTML components.
Class for Job.
Definition: job.class.php:38
Class for Skill.
Definition: skill.class.php:37
static typeCodeToLabel($code)
Class for SkillRank.
Class to manage Dolibarr users.
Definition: user.class.php:50
if(isModEnabled('invoice') && $user->hasRight('facture', 'lire')) if((isModEnabled('fournisseur') &&!getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD') && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') && $user->hasRight('don', 'lire')) if(isModEnabled('tax') && $user->hasRight('tax', 'charges', 'lire')) if(isModEnabled('invoice') &&isModEnabled('order') && $user->hasRight("commande", "lire") &&!getDolGlobalString('WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER')) $sql
Social contributions to pay.
Definition: index.php:744
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:143
print *****$script_file(".$version.") pid c cd cd cd description as p label as s rowid
showValueWithClipboardCPButton($valuetocopy, $showonlyonhover=1, $texttoshow='')
Create a button to copy $valuetocopy in the clipboard (for copy and paste feature).
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $disabled='', $morecss='classlink button bordertransp', $jsonopen='', $backtopagejsfields='', $accesskey='')
Return HTML code to output a button to open a dialog popup box.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
setEventMessage($mesgs, $style='mesgs', $noduplicate=0)
Set event message in dol_events session object.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
isModEnabled($module)
Is Dolibarr module enabled.
GetLegendSkills()
getRankOrderResults($obj)
getGroupedEval($objects)
Grouped rows with same ref in array.
jobPrepareHead($object)
Prepare array of tabs for Job.
Definition: hrm_job.lib.php:33
displayRankInfos($selected_rank, $fk_skill, $inputname='TNote', $mode='view')
Used to print ranks of a skill into several case, view or edit pour js necessary to select a rank.
$formconfirm
if ($action == 'delbookkeepingyear') {
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
user_prepare_head(User $object)
Prepare array with list of tabs.