Completed
Branch develop (6cdb7c)
by
unknown
19:03
created
htdocs/hrm/skill_tab.php 1 patch
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -29,15 +29,15 @@  discard block
 block discarded – undo
29 29
 // Load Dolibarr environment
30 30
 require '../main.inc.php';
31 31
 
32
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php';
33
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php';
34
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
35
-require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php';
36
-require_once DOL_DOCUMENT_ROOT . '/hrm/class/job.class.php';
37
-require_once DOL_DOCUMENT_ROOT . '/hrm/class/skill.class.php';
38
-require_once DOL_DOCUMENT_ROOT . '/hrm/class/skillrank.class.php';
39
-require_once DOL_DOCUMENT_ROOT . '/hrm/lib/hrm_skill.lib.php';
40
-require_once DOL_DOCUMENT_ROOT .'/hrm/class/evaluation.class.php';
32
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
33
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
34
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
35
+require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
36
+require_once DOL_DOCUMENT_ROOT.'/hrm/class/job.class.php';
37
+require_once DOL_DOCUMENT_ROOT.'/hrm/class/skill.class.php';
38
+require_once DOL_DOCUMENT_ROOT.'/hrm/class/skillrank.class.php';
39
+require_once DOL_DOCUMENT_ROOT.'/hrm/lib/hrm_skill.lib.php';
40
+require_once DOL_DOCUMENT_ROOT.'/hrm/class/evaluation.class.php';
41 41
 require_once DOL_DOCUMENT_ROOT.'/hrm/lib/hrm_evaluation.lib.php';
42 42
 
43 43
 // Load translation files required by the page
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 $hookmanager->initHooks(array('skilltab', 'globalcard')); // Note that conf->hooks_modules contains array
79 79
 
80 80
 // Load object
81
-include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
81
+include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
82 82
 if (method_exists($object, 'loadPersonalConf')) {
83 83
 	$object->loadPersonalConf();
84 84
 }
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 			if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
120 120
 				$backtopage = $backurlforlist;
121 121
 			} else {
122
-				$backtopage = DOL_URL_ROOT.'/hrm/skill_list.php?id=' . ($id > 0 ? $id : '__ID__');
122
+				$backtopage = DOL_URL_ROOT.'/hrm/skill_list.php?id='.($id > 0 ? $id : '__ID__');
123 123
 			}
124 124
 		}
125 125
 	}
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 	} elseif ($action == 'saveSkill') {
156 156
 		if (!empty($TNote)) {
157 157
 			foreach ($TNote as $skillId => $rank) {
158
-				$TSkills = $skill->fetchAll('ASC', 't.rowid', 0, 0, array('customsql' => 'fk_object=' . ((int) $id) . " AND objecttype='" . $db->escape($objecttype) . "' AND fk_skill = " . ((int) $skillId)));
158
+				$TSkills = $skill->fetchAll('ASC', 't.rowid', 0, 0, array('customsql' => 'fk_object='.((int) $id)." AND objecttype='".$db->escape($objecttype)."' AND fk_skill = ".((int) $skillId)));
159 159
 				if (is_array($TSkills) && !empty($TSkills)) {
160 160
 					foreach ($TSkills as $tmpObj) {
161 161
 						$tmpObj->rankorder = $rank;
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 				}
165 165
 			}
166 166
 			setEventMessages($langs->trans("SaveLevelSkill"), null);
167
-			header("Location: " . DOL_URL_ROOT.'/hrm/skill_tab.php?id=' . $id. '&objecttype=job');
167
+			header("Location: ".DOL_URL_ROOT.'/hrm/skill_tab.php?id='.$id.'&objecttype=job');
168 168
 			exit;
169 169
 		}
170 170
 	} elseif ($action == 'confirm_deleteskill' && $confirm == 'yes') {
@@ -195,11 +195,11 @@  discard block
 block discarded – undo
195 195
 
196 196
 	// view configuration
197 197
 	if ($objecttype == 'job') {
198
-		require_once DOL_DOCUMENT_ROOT . '/hrm/lib/hrm_job.lib.php';
198
+		require_once DOL_DOCUMENT_ROOT.'/hrm/lib/hrm_job.lib.php';
199 199
 		$head = jobPrepareHead($object);
200 200
 		$listLink = dol_buildpath('/hrm/job_list.php', 1);
201 201
 	} elseif ($objecttype == "user") {
202
-		require_once DOL_DOCUMENT_ROOT . "/core/lib/usergroups.lib.php";
202
+		require_once DOL_DOCUMENT_ROOT."/core/lib/usergroups.lib.php";
203 203
 		$object->getRights();
204 204
 		$head = user_prepare_head($object);
205 205
 		$listLink = dol_buildpath('/user/list.php', 1);
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 	}*/
216 216
 	// Confirmation to delete line
217 217
 	if ($action == 'ask_deleteskill') {
218
-		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id . '&objecttype=' . $objecttype . '&lineid=' . $lineid, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteskill', '', 0, 1);
218
+		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&objecttype='.$objecttype.'&lineid='.$lineid, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteskill', '', 0, 1);
219 219
 	}
220 220
 	// Clone confirmation
221 221
 	/*if ($action == 'clone') {
@@ -240,15 +240,15 @@  discard block
 block discarded – undo
240 240
 	// Object card
241 241
 	// ------------------------------------------------------------
242 242
 	if ($objecttype == 'job') {
243
-		$linkback = '<a href="' . dol_buildpath('/hrm/job_list.php', 1) . '?restore_lastsearch_values=1' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
243
+		$linkback = '<a href="'.dol_buildpath('/hrm/job_list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
244 244
 
245 245
 		$morehtmlref = '<div class="refid">';
246
-		$morehtmlref.= $object->label;
246
+		$morehtmlref .= $object->label;
247 247
 		$morehtmlref .= '</div>';
248 248
 
249 249
 		dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'rowid', $morehtmlref);
250 250
 	} else {
251
-		$linkback = '<a href="' . $listLink . '?restore_lastsearch_values=1' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
251
+		$linkback = '<a href="'.$listLink.'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
252 252
 
253 253
 		$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">';
254 254
 		$morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"');
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 	$TAllSkills = $static_skill->fetchAll();
266 266
 
267 267
 	// Array format for multiselectarray function
268
-	$TAllSkillsFormatted=array();
268
+	$TAllSkillsFormatted = array();
269 269
 	if (!empty($TAllSkills)) {
270 270
 		foreach ($TAllSkills as $k=>$v) {
271 271
 			$TAllSkillsFormatted[$k] = $v->label;
@@ -275,12 +275,12 @@  discard block
 block discarded – undo
275 275
 	// table of skillRank linked to current object
276 276
 	//$TSkillsJob = $skill->fetchAll('ASC', 't.rowid', 0, 0);
277 277
 	$sql_skill = "SELECT sr.fk_object, sr.rowid, s.label,s.skill_type, sr.rankorder, sr.fk_skill";
278
-	$sql_skill .=" FROM ".MAIN_DB_PREFIX."hrm_skillrank AS sr";
279
-	$sql_skill .=" JOIN ".MAIN_DB_PREFIX."hrm_skill AS s ON sr.fk_skill = s.rowid";
278
+	$sql_skill .= " FROM ".MAIN_DB_PREFIX."hrm_skillrank AS sr";
279
+	$sql_skill .= " JOIN ".MAIN_DB_PREFIX."hrm_skill AS s ON sr.fk_skill = s.rowid";
280 280
 	$sql_skill .= " AND sr.fk_object = ".((int) $id);
281 281
 	$result = $db->query($sql_skill);
282 282
 	$numSkills = $db->num_rows($result);
283
-	for ($i=0; $i < $numSkills; $i++) {
283
+	for ($i = 0; $i < $numSkills; $i++) {
284 284
 		$objSkillRank = $db->fetch_object($result);
285 285
 		$TSkillsJob[] = $objSkillRank;
286 286
 	}
@@ -303,11 +303,11 @@  discard block
 block discarded – undo
303 303
 		//$keyforbreak='fieldkeytoswitchonsecondcolumn';	// We change column just before this field
304 304
 		//unset($object->fields['fk_project']);				// Hide field already shown in banner
305 305
 		//unset($object->fields['fk_soc']);					// Hide field already shown in banner
306
-		$object->fields['label']['visible']=0; // Already in banner
307
-		include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php';
306
+		$object->fields['label']['visible'] = 0; // Already in banner
307
+		include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
308 308
 
309 309
 		// Other attributes. Fields from hook formObjectOptions and Extrafields.
310
-		include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
310
+		include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
311 311
 	} else {
312 312
 		// Login
313 313
 		print '<tr><td class="titlefield">'.$langs->trans("Login").'</td>';
@@ -330,9 +330,9 @@  discard block
 block discarded – undo
330 330
 		}
331 331
 		print '</tr>'."\n";
332 332
 
333
-		$object->fields['label']['visible']=0; // Already in banner
334
-		$object->fields['firstname']['visible']=0; // Already in banner
335
-		$object->fields['lastname']['visible']=0; // Already in banner
333
+		$object->fields['label']['visible'] = 0; // Already in banner
334
+		$object->fields['firstname']['visible'] = 0; // Already in banner
335
+		$object->fields['lastname']['visible'] = 0; // Already in banner
336 336
 		//include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php';
337 337
 
338 338
 		// Ref employee
@@ -373,19 +373,19 @@  discard block
 block discarded – undo
373 373
 	if ($objecttype != 'user' && $permissiontoadd) {
374 374
 		// form to add new skills
375 375
 		print '<br>';
376
-		print '<form name="addSkill" method="post" action="' . $_SERVER['PHP_SELF'] . '">';
377
-		print '<input type="hidden" name="objecttype" value="' . $objecttype . '">';
378
-		print '<input type="hidden" name="id" value="' . $id . '">';
376
+		print '<form name="addSkill" method="post" action="'.$_SERVER['PHP_SELF'].'">';
377
+		print '<input type="hidden" name="objecttype" value="'.$objecttype.'">';
378
+		print '<input type="hidden" name="id" value="'.$id.'">';
379 379
 		print '<input type="hidden" name="action" value="addSkill">';
380 380
 		print '<input type="hidden" name="token" value="'.newToken().'">';
381 381
 		print '<div class="div-table-responsive-no-min">';
382 382
 		print '<table id="tablelines" class="noborder noshadow" width="100%">';
383
-		print '<tr><td style="width:90%">' . $langs->trans('AddSkill') . '</td><td style="width:10%"></td></tr>';
383
+		print '<tr><td style="width:90%">'.$langs->trans('AddSkill').'</td><td style="width:10%"></td></tr>';
384 384
 		print '<tr>';
385 385
 		print '<td>';
386 386
 		print img_picto('', 'shapes', 'class="pictofixedwidth"');
387
-		print $form->multiselectarray('fk_skill', array_diff_key($TAllSkillsFormatted, $TAlreadyUsedSkill), array(), 0, 0, 'widthcentpercentminusx') . '</td>';
388
-		print '<td><input class="button reposition" type="submit" value="' . $langs->trans('Add') . '"></td>';
387
+		print $form->multiselectarray('fk_skill', array_diff_key($TAllSkillsFormatted, $TAlreadyUsedSkill), array(), 0, 0, 'widthcentpercentminusx').'</td>';
388
+		print '<td><input class="button reposition" type="submit" value="'.$langs->trans('Add').'"></td>';
389 389
 		print '</tr>';
390 390
 		print '</table>';
391 391
 		print '</div>';
@@ -396,9 +396,9 @@  discard block
 block discarded – undo
396 396
 	print '<div class="clearboth"></div>';
397 397
 
398 398
 	if ($objecttype != 'user' && $permissiontoadd) {
399
-		print '<form name="saveSkill" method="post" action="' . $_SERVER['PHP_SELF'] . '">';
400
-		print '<input type="hidden" name="objecttype" value="' . $objecttype . '">';
401
-		print '<input type="hidden" name="id" value="' . $id . '">';
399
+		print '<form name="saveSkill" method="post" action="'.$_SERVER['PHP_SELF'].'">';
400
+		print '<input type="hidden" name="objecttype" value="'.$objecttype.'">';
401
+		print '<input type="hidden" name="id" value="'.$id.'">';
402 402
 		print '<input type="hidden" name="token" value="'.newToken().'">';
403 403
 		print '<input type="hidden" name="action" value="saveSkill">';
404 404
 	}
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
 		}
417 417
 		print '</tr>';
418 418
 		if (!is_array($TSkillsJob) || empty($TSkillsJob)) {
419
-			print '<tr><td><span class="opacitymedium">' . $langs->trans("NoRecordFound") . '</span></td></tr>';
419
+			print '<tr><td><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
420 420
 		} else {
421 421
 			$sk = new Skill($db);
422 422
 			foreach ($TSkillsJob as $skillElement) {
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 				if ($objecttype != 'user' && $permissiontoadd) {
436 436
 					print '<td class="linecoledit"></td>';
437 437
 					print '<td class="linecoldelete">';
438
-					print '<a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?id=' . $skillElement->fk_object . '&amp;objecttype=' . $objecttype . '&amp;action=ask_deleteskill&amp;lineid=' . $skillElement->id . '">';
438
+					print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$skillElement->fk_object.'&amp;objecttype='.$objecttype.'&amp;action=ask_deleteskill&amp;lineid='.$skillElement->id.'">';
439 439
 					print img_delete();
440 440
 					print '</a>';
441 441
 				}
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
 		}
446 446
 
447 447
 		print '</table>';
448
-		if ($objecttype != 'user' && $permissiontoadd) print '<td><input class="button pull-right" type="submit" value="' . $langs->trans('SaveRank') . '"></td>';
448
+		if ($objecttype != 'user' && $permissiontoadd) print '<td><input class="button pull-right" type="submit" value="'.$langs->trans('SaveRank').'"></td>';
449 449
 		print '</div>';
450 450
 		if ($objecttype != 'user' && $permissiontoadd) print '</form>';
451 451
 	}
@@ -475,10 +475,10 @@  discard block
 block discarded – undo
475 475
 		print '<th>'.$langs->trans('Description').'</th>';
476 476
 		print '<th>'.$langs->trans('DateEval').'</th>';
477 477
 		print '<th>'.$langs->trans('Status').'</th>';
478
-		print '<th>'.$langs->trans("Result").' ' .$form->textwithpicto('', GetLegendSkills(), 1) .'</th>';
478
+		print '<th>'.$langs->trans("Result").' '.$form->textwithpicto('', GetLegendSkills(), 1).'</th>';
479 479
 		print '</tr>';
480 480
 		if (!$resql) {
481
-			print '<tr><td><span class="opacitymedium">' . $langs->trans("NoRecordFound") . '</span></td></tr>';
481
+			print '<tr><td><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
482 482
 		} else {
483 483
 			$i = 0;
484 484
 			$sameRef = array();
Please login to merge, or discard this patch.