Completed
Branch develop (a3881e)
by
unknown
25:02
created
htdocs/webportal/class/html.formcardwebportal.class.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
  * \brief      File of class with all html predefined components for WebPortal
26 26
  */
27 27
 
28
-require_once DOL_DOCUMENT_ROOT . '/webportal/class/html.formwebportal.class.php';
28
+require_once DOL_DOCUMENT_ROOT.'/webportal/class/html.formwebportal.class.php';
29 29
 
30 30
 /**
31 31
  *    Class to manage generation of HTML components
@@ -146,15 +146,15 @@  discard block
 block discarded – undo
146 146
 		global $hookmanager, $langs;
147 147
 
148 148
 		$elementEnUpper = strtoupper($elementEn);
149
-		$objectclass = 'WebPortal' . ucfirst($elementEn);
149
+		$objectclass = 'WebPortal'.ucfirst($elementEn);
150 150
 
151
-		$elementCardAccess = getDolGlobalString('WEBPORTAL_' . $elementEnUpper . '_CARD_ACCESS', 'hidden');
151
+		$elementCardAccess = getDolGlobalString('WEBPORTAL_'.$elementEnUpper.'_CARD_ACCESS', 'hidden');
152 152
 		if ($elementCardAccess == 'hidden' || $id <= 0) {
153 153
 			accessforbidden();
154 154
 		}
155 155
 
156 156
 		// load module libraries
157
-		dol_include_once('/webportal/class/webportal' . $elementEn . '.class.php');
157
+		dol_include_once('/webportal/class/webportal'.$elementEn.'.class.php');
158 158
 
159 159
 		// Load translation files required by the page
160 160
 		$langs->loadLangs(array('website', 'other'));
@@ -165,14 +165,14 @@  discard block
 block discarded – undo
165 165
 		$action = GETPOST('action', 'aZ09');
166 166
 		$confirm = GETPOST('confirm', 'alpha');
167 167
 		$cancel = GETPOST('cancel', 'aZ09');
168
-		$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'webportal' . $elementEn . 'card'; // To manage different context of search
169
-		$backtopage = GETPOST('backtopage', 'alpha');                    // if not set, a default page will be used
170
-		$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');    // if not set, $backtopage will be used
168
+		$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'webportal'.$elementEn.'card'; // To manage different context of search
169
+		$backtopage = GETPOST('backtopage', 'alpha'); // if not set, a default page will be used
170
+		$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); // if not set, $backtopage will be used
171 171
 
172 172
 		// Initialize a technical objects
173 173
 		$object = new $objectclass($this->db);
174 174
 		//$extrafields = new ExtraFields($db);
175
-		$hookmanager->initHooks(array('webportal' . $elementEn . 'card', 'globalcard')); // Note that conf->hooks_modules contains array
175
+		$hookmanager->initHooks(array('webportal'.$elementEn.'card', 'globalcard')); // Note that conf->hooks_modules contains array
176 176
 
177 177
 		// Fetch optionals attributes and labels
178 178
 		//$extrafields->fetch_name_optionals_label($object->table_element);
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 		}
184 184
 
185 185
 		// Load object
186
-		include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be 'include', not 'include_once'.
186
+		include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be 'include', not 'include_once'.
187 187
 
188 188
 		// Security check (enable the most restrictive one)
189 189
 		if (!isModEnabled('webportal')) {
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 		$this->permissiontodelete = $permissiontodelete;
207 207
 		$this->permissionnote = $permissionnote;
208 208
 		$this->permissiondellink = $permissiondellink;
209
-		$this->titleKey = $objectclass . 'CardTitle';
209
+		$this->titleKey = $objectclass.'CardTitle';
210 210
 		$this->ref = $ref;
211 211
 	}
212 212
 
@@ -239,17 +239,17 @@  discard block
 block discarded – undo
239 239
 
240 240
 		if (empty($backtopage) || ($cancel && empty($id))) {
241 241
 			if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
242
-				$backtopage = $context->getControllerUrl($elementEn . 'card');
242
+				$backtopage = $context->getControllerUrl($elementEn.'card');
243 243
 			}
244 244
 		}
245 245
 
246 246
 		// Action to cancel record
247 247
 		if ($cancel) {
248 248
 			if (!empty($backtopageforcancel)) {
249
-				header("Location: " . $backtopageforcancel);
249
+				header("Location: ".$backtopageforcancel);
250 250
 				exit;
251 251
 			} elseif (!empty($backtopage)) {
252
-				header("Location: " . $backtopage);
252
+				header("Location: ".$backtopage);
253 253
 				exit;
254 254
 			}
255 255
 			$action = '';
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 			foreach ($object->fields as $key => $val) {
261 261
 				// Check if field was submitted to be edited
262 262
 				if ($object->fields[$key]['type'] == 'duration') {
263
-					if (!GETPOSTISSET($key . 'hour') || !GETPOSTISSET($key . 'min')) {
263
+					if (!GETPOSTISSET($key.'hour') || !GETPOSTISSET($key.'min')) {
264 264
 						continue; // The field was not submitted to be saved
265 265
 					}
266 266
 				} elseif ($object->fields[$key]['type'] == 'boolean') {
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
 						$dateDay = (int) $dateArr[0];
312 312
 					}
313 313
 					// extract time HH:ii:ss for hours, minutes and seconds
314
-					$postTime = GETPOST($key . '_time', 'alphanohtml');
314
+					$postTime = GETPOST($key.'_time', 'alphanohtml');
315 315
 					$timeArr = explode(':', $postTime);
316 316
 					$timeHours = 12;
317 317
 					$timeMinutes = 0;
@@ -329,8 +329,8 @@  discard block
 block discarded – undo
329 329
 					}
330 330
 					$value = dol_mktime($timeHours, $timeMinutes, $timeSeconds, $dateMonth, $dateDay, $dateYear);
331 331
 				} elseif ($object->fields[$key]['type'] == 'duration') {
332
-					if (GETPOSTINT($key . 'hour') != '' || GETPOSTINT($key . 'min') != '') {
333
-						$value = 60 * 60 * GETPOSTINT($key . 'hour') + 60 * GETPOSTINT($key . 'min');
332
+					if (GETPOSTINT($key.'hour') != '' || GETPOSTINT($key.'min') != '') {
333
+						$value = 60 * 60 * GETPOSTINT($key.'hour') + 60 * GETPOSTINT($key.'min');
334 334
 					} else {
335 335
 						$value = '';
336 336
 					}
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
 					$urltogo = $backtopage ? str_replace('__ID__', $result, $backtopage) : $backurlforlist;
400 400
 					$urltogo = preg_replace('/--IDFORBACKTOPAGE--/', (string) $object->id, $urltogo); // New method to autoselect project after a New on another form object creation
401 401
 					if ($urltogo && empty($noback)) {
402
-						header("Location: " . $urltogo);
402
+						header("Location: ".$urltogo);
403 403
 						exit;
404 404
 					}
405 405
 				} else {
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
 		// main information - begin
467 467
 		$html .= '<div class="header-card-main-information inline-block valignmiddle">';
468 468
 		// ref
469
-		$html .= '<div><strong>' . $langs->trans("Ref").' : '.dol_escape_htmltag($object->ref) . '</strong></div>';
469
+		$html .= '<div><strong>'.$langs->trans("Ref").' : '.dol_escape_htmltag($object->ref).'</strong></div>';
470 470
 		// full name
471 471
 		$fullname = '';
472 472
 		if (method_exists($object, 'getFullName')) {
@@ -478,11 +478,11 @@  discard block
 block discarded – undo
478 478
 			/** @var Adherent $object */
479 479
 			if ($object->morphy == 'mor' && !empty($object->company)) {
480 480
 				$html .= dol_htmlentities((string) $object->company);
481
-				$html .= (!empty($fullname) && $object->company != $fullname) ? ' (' . dol_htmlentities($fullname) . $addgendertxt . ')' : '';
481
+				$html .= (!empty($fullname) && $object->company != $fullname) ? ' ('.dol_htmlentities($fullname).$addgendertxt.')' : '';
482 482
 			} else {
483
-				$html .= dol_htmlentities($fullname) . $addgendertxt;
483
+				$html .= dol_htmlentities($fullname).$addgendertxt;
484 484
 				if (empty($object->socid)) {
485
-					$html .= (!empty($object->company) && $object->company != $fullname) ? ' (' . dol_htmlentities((string) $object->company) . ')' : '';
485
+					$html .= (!empty($object->company) && $object->company != $fullname) ? ' ('.dol_htmlentities((string) $object->company).')' : '';
486 486
 				}
487 487
 			}
488 488
 		} else {
@@ -572,23 +572,23 @@  discard block
 block discarded – undo
572 572
 
573 573
 			$value = $object->$key;
574 574
 
575
-			$html .= '<div class="grid field_' . $key . '">';
575
+			$html .= '<div class="grid field_'.$key.'">';
576 576
 
577
-			$html .= '<div class="' . (empty($val['tdcss']) ? '' : $val['tdcss']) . ' fieldname_' . $key;
577
+			$html .= '<div class="'.(empty($val['tdcss']) ? '' : $val['tdcss']).' fieldname_'.$key;
578 578
 			$html .= '">';
579 579
 			$labeltoshow = '';
580
-			$labeltoshow .= '<strong>' . $langs->trans($val['label']) . '</strong>';
580
+			$labeltoshow .= '<strong>'.$langs->trans($val['label']).'</strong>';
581 581
 			$html .= $labeltoshow;
582 582
 			$html .= '</div>';
583 583
 
584
-			$html .= '<div class="valuefield fieldname_' . $key;
584
+			$html .= '<div class="valuefield fieldname_'.$key;
585 585
 			if (!empty($val['cssview'])) {
586
-				$html .= ' ' . $val['cssview'];
586
+				$html .= ' '.$val['cssview'];
587 587
 			}
588 588
 			$html .= '">';
589 589
 			if ($key == 'lang') {
590 590
 				$langs->load('languages');
591
-				$labellang = ($value ? $langs->trans('Language_' . $value) : '');
591
+				$labellang = ($value ? $langs->trans('Language_'.$value) : '');
592 592
 				//$html .= picto_from_langcode($value, 'class="paddingrightonly saturatemedium opacitylow"');
593 593
 				$html .= $labellang;
594 594
 			} else {
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
 				continue; // We don't want this field
649 649
 			}
650 650
 
651
-			$html .= '<div class="grid field_' . $key . '">';
651
+			$html .= '<div class="grid field_'.$key.'">';
652 652
 			$html .= '<div class="titlefieldcreate';
653 653
 			if (isset($val['notnull']) && $val['notnull'] > 0) {
654 654
 				$html .= ' required';
@@ -680,15 +680,15 @@  discard block
 block discarded – undo
680 680
 				$value = GETPOSTISSET($key) ? GETPOST($key, $check) : $object->$key;
681 681
 			} elseif (in_array($val['type'], array('date', 'datetime'))) {
682 682
 				$isPostDate = GETPOSTISSET($key);
683
-				$isPostTime = GETPOSTISSET($key . '_time');
683
+				$isPostTime = GETPOSTISSET($key.'_time');
684 684
 				if ($isPostDate) {
685 685
 					$postDate = GETPOST($key, 'alphanohtml');
686 686
 					if ($isPostTime) {
687
-						$postTime = GETPOST($key . '_time', 'alphanohtml') . ':00';
687
+						$postTime = GETPOST($key.'_time', 'alphanohtml').':00';
688 688
 					} else {
689 689
 						$postTime = '00:00:00';
690 690
 					}
691
-					$valueDateTimeStr = $postDate . ' ' . $postTime;
691
+					$valueDateTimeStr = $postDate.' '.$postTime;
692 692
 				} else {
693 693
 					// format date timestamp to YYYY-MM-DD HH:ii:ss
694 694
 					$valueDateTimeStr = dol_print_date($object->$key, '%Y-%m-%d %H:%M:%S');
@@ -761,19 +761,19 @@  discard block
 block discarded – undo
761 761
 			$html .= '<article>';
762 762
 			//$html .= load_fiche_titre($title, '', 'object_'.$object->picto);
763 763
 			$html .= '<header>';
764
-			$html .= '<h2>' . $title . '</h2>';
764
+			$html .= '<h2>'.$title.'</h2>';
765 765
 			$html .= '</header>';
766 766
 
767 767
 			$url_file = $context->getControllerUrl($context->controller, '', false);
768
-			$html .= '<form method="POST" action="' . $url_file . '">';
768
+			$html .= '<form method="POST" action="'.$url_file.'">';
769 769
 			$html .= $context->getFormToken();
770 770
 			$html .= '<input type="hidden" name="action" value="update">';
771
-			$html .= '<input type="hidden" name="id" value="' . $object->id . '">';
771
+			$html .= '<input type="hidden" name="id" value="'.$object->id.'">';
772 772
 			if ($backtopage) {
773
-				$html .= '<input type="hidden" name="backtopage" value="' . $backtopage . '">';
773
+				$html .= '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
774 774
 			}
775 775
 			if ($backtopageforcancel) {
776
-				$html .= '<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel . '">';
776
+				$html .= '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
777 777
 			}
778 778
 
779 779
 			//$html .= '<table>'."\n";
@@ -787,8 +787,8 @@  discard block
 block discarded – undo
787 787
 
788 788
 			// Save and Cancel buttons
789 789
 			$html .= '<div class="grid">';
790
-			$html .= '<div><input type="submit" name="save" role="button" value="' . dol_escape_htmltag($langs->trans('Save')) . '" /></div>';
791
-			$html .= '<div><input type="submit" name="cancel" role="button" value="' . dol_escape_htmltag($langs->trans('Cancel')) . '" /></div>';
790
+			$html .= '<div><input type="submit" name="save" role="button" value="'.dol_escape_htmltag($langs->trans('Save')).'" /></div>';
791
+			$html .= '<div><input type="submit" name="cancel" role="button" value="'.dol_escape_htmltag($langs->trans('Cancel')).'" /></div>';
792 792
 			$html .= '</div>';
793 793
 
794 794
 			$html .= '</form>';
@@ -829,7 +829,7 @@  discard block
 block discarded – undo
829 829
 
830 830
 			// Buttons for actions
831 831
 			if ($action != 'presend' && $action != 'editline') {
832
-				$html .= '<div>' . "\n";
832
+				$html .= '<div>'."\n";
833 833
 				$parameters = array();
834 834
 				$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
835 835
 				if ($reshook < 0) {
@@ -839,10 +839,10 @@  discard block
 block discarded – undo
839 839
 				if (empty($reshook)) {
840 840
 					if ($permissiontoadd) {
841 841
 						$url_file = $context->getControllerUrl($context->controller, '', false);
842
-						$html .= '<a href="' . $url_file . '&id=' . $object->id . '&action=edit" role="button">' . $langs->trans('Modify') . '</a>';
842
+						$html .= '<a href="'.$url_file.'&id='.$object->id.'&action=edit" role="button">'.$langs->trans('Modify').'</a>';
843 843
 					}
844 844
 				}
845
-				$html .= '</div>' . "\n";
845
+				$html .= '</div>'."\n";
846 846
 			}
847 847
 		}
848 848
 
Please login to merge, or discard this patch.