@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | |
287 | 287 | // all widget have static id to not change id of others widgets in page |
288 | 288 | |
289 | - $infoMessages = $_SESSION['app_msginfo']; |
|
289 | + $infoMessages = $_SESSION['app_msginfo']; |
|
290 | 290 | foreach ($infoMessages as $infoLine) { |
291 | 291 | $this->App()->Controller()->addMessage($infoLine); |
292 | 292 | } |
@@ -304,6 +304,6 @@ discard block |
||
304 | 304 | * @see app.jquery.js#window.babAddonLibApp.numberFormat |
305 | 305 | */ |
306 | 306 | $this->setMetadata('numberFormatSeparator', mb_substr($str, 1, 1)); |
307 | - $this->setMetadata('numberFormatPrecision', mb_strlen($str) -2); |
|
307 | + $this->setMetadata('numberFormatPrecision', mb_strlen($str) - 2); |
|
308 | 308 | } |
309 | 309 | } |
@@ -30,11 +30,11 @@ |
||
30 | 30 | |
31 | 31 | class app_UnknownActionException extends Exception |
32 | 32 | { |
33 | - public function __construct($action, $code = 0) |
|
34 | - { |
|
35 | - $message = 'Unknown method "' . $action->getController() . '::' . $action->getMethod() . '"'; |
|
36 | - parent::__construct($message, $code); |
|
37 | - } |
|
33 | + public function __construct($action, $code = 0) |
|
34 | + { |
|
35 | + $message = 'Unknown method "' . $action->getController() . '::' . $action->getMethod() . '"'; |
|
36 | + parent::__construct($message, $code); |
|
37 | + } |
|
38 | 38 | } |
39 | 39 | |
40 | 40 |
@@ -21,10 +21,10 @@ discard block |
||
21 | 21 | * @copyright Copyright (c) 2008 by CANTICO ({@link http://www.cantico.fr}) |
22 | 22 | */ |
23 | 23 | |
24 | -require_once $GLOBALS['babInstallPath'] . 'utilit/controller.class.php'; |
|
25 | -require_once $GLOBALS['babInstallPath'] . 'utilit/json.php'; |
|
24 | +require_once $GLOBALS['babInstallPath'].'utilit/controller.class.php'; |
|
25 | +require_once $GLOBALS['babInstallPath'].'utilit/json.php'; |
|
26 | 26 | |
27 | -require_once dirname(__FILE__). '/functions.php'; |
|
27 | +require_once dirname(__FILE__).'/functions.php'; |
|
28 | 28 | |
29 | 29 | $App = app_App(); |
30 | 30 | if ($App) { |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | { |
37 | 37 | public function __construct($action, $code = 0) |
38 | 38 | { |
39 | - $message = 'Unknown method "' . $action->getController() . '::' . $action->getMethod() . '"'; |
|
39 | + $message = 'Unknown method "'.$action->getController().'::'.$action->getMethod().'"'; |
|
40 | 40 | parent::__construct($message, $code); |
41 | 41 | } |
42 | 42 | } |
@@ -201,11 +201,11 @@ discard block |
||
201 | 201 | // we try to select one according to the classname prefix. |
202 | 202 | list($prefix) = explode('_', __CLASS__); |
203 | 203 | $functionalityName = ucwords($prefix); |
204 | - $App = @bab_functionality::get('App/' . $functionalityName); |
|
204 | + $App = @bab_functionality::get('App/'.$functionalityName); |
|
205 | 205 | |
206 | 206 | if (!$App) |
207 | 207 | { |
208 | - throw new app_Exception('Faild to autodetect functionality App/' . $functionalityName.', the getInstance method is deprecated, use $App->ControllerProxy() instead'); |
|
208 | + throw new app_Exception('Faild to autodetect functionality App/'.$functionalityName.', the getInstance method is deprecated, use $App->ControllerProxy() instead'); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | $controller = $App->ControllerProxy($classname, $proxy); |
@@ -224,9 +224,9 @@ discard block |
||
224 | 224 | static function getProxyInstance(Func_App $App, $classname) |
225 | 225 | { |
226 | 226 | $class = new ReflectionClass($classname); |
227 | - $proxyClassname = $class->getShortName() . self::PROXY_CLASS_SUFFIX; |
|
227 | + $proxyClassname = $class->getShortName().self::PROXY_CLASS_SUFFIX; |
|
228 | 228 | if (!class_exists($proxyClassname)) { |
229 | - $classStr = 'class ' . $proxyClassname . ' extends ' . $class->name . ' {' . "\n"; |
|
229 | + $classStr = 'class '.$proxyClassname.' extends '.$class->name.' {'."\n"; |
|
230 | 230 | $methods = $class->getMethods(); |
231 | 231 | |
232 | 232 | $classStr .= ' public function __construct(Func_App $App) { |
@@ -239,24 +239,24 @@ discard block |
||
239 | 239 | } |
240 | 240 | |
241 | 241 | |
242 | - $classStr .= ' public function ' . $method->name . '('; |
|
242 | + $classStr .= ' public function '.$method->name.'('; |
|
243 | 243 | $parameters = $method->getParameters(); |
244 | 244 | $parametersStr = array(); |
245 | 245 | foreach ($parameters as $parameter) { |
246 | 246 | |
247 | 247 | if ($parameter->isDefaultValueAvailable()) { |
248 | - $parametersStr[] = '$' . $parameter->name . ' = ' . var_export($parameter->getDefaultValue(), true); |
|
248 | + $parametersStr[] = '$'.$parameter->name.' = '.var_export($parameter->getDefaultValue(), true); |
|
249 | 249 | } else { |
250 | - $parametersStr[] = '$' . $parameter->name; |
|
250 | + $parametersStr[] = '$'.$parameter->name; |
|
251 | 251 | } |
252 | 252 | } |
253 | 253 | $classStr .= implode(', ', $parametersStr); |
254 | - $classStr .= ') {' . "\n"; |
|
255 | - $classStr .= ' $args = func_get_args();' . "\n"; |
|
256 | - $classStr .= ' return $this->getMethodAction(__FUNCTION__, $args);' . "\n"; |
|
257 | - $classStr .= ' }' . "\n"; |
|
254 | + $classStr .= ') {'."\n"; |
|
255 | + $classStr .= ' $args = func_get_args();'."\n"; |
|
256 | + $classStr .= ' return $this->getMethodAction(__FUNCTION__, $args);'."\n"; |
|
257 | + $classStr .= ' }'."\n"; |
|
258 | 258 | } |
259 | - $classStr .= '}' . "\n"; |
|
259 | + $classStr .= '}'."\n"; |
|
260 | 260 | |
261 | 261 | // We define the proxy class |
262 | 262 | eval($classStr); |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | protected function getObjectName($classname) |
298 | 298 | { |
299 | 299 | list($objectname) = explode('Controller', $classname); |
300 | - if($this->App()->getComponentByName($objectname)){ |
|
300 | + if ($this->App()->getComponentByName($objectname)) { |
|
301 | 301 | return strtolower($objectname); |
302 | 302 | } |
303 | 303 | list(, $objectname) = explode('_Ctrl', $classname); |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | |
320 | 320 | $reflector = new ReflectionClass(get_class($this)); |
321 | 321 | $parent = $reflector->getParentClass(); |
322 | - if($parent){ |
|
322 | + if ($parent) { |
|
323 | 323 | $parentMethod = $parent->getMethod('__construct'); |
324 | 324 | $docComment = $parentMethod->getDocComment(); |
325 | 325 | if (strpos($docComment, '@isComponentController') !== false) { |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | $rc = new ReflectionClass($fullClassName); |
331 | 331 | |
332 | 332 | if (!$rc->hasMethod($methodName)) { |
333 | - throw new bab_InvalidActionException($fullClassName . '::' . $methodName); |
|
333 | + throw new bab_InvalidActionException($fullClassName.'::'.$methodName); |
|
334 | 334 | } |
335 | 335 | $method = new ReflectionMethod($fullClassName, $methodName); |
336 | 336 | |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | |
354 | 354 | $action = new Widget_Action(); |
355 | 355 | |
356 | - $action->setMethod($this->getControllerTg(), $objectName . '.' . $methodName, $actionParams); |
|
356 | + $action->setMethod($this->getControllerTg(), $objectName.'.'.$methodName, $actionParams); |
|
357 | 357 | |
358 | 358 | $docComment = $method->getDocComment(); |
359 | 359 | if (strpos($docComment, '@ajax') !== false) { |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | $action->setParameters($actionParams); |
395 | 395 | |
396 | 396 | |
397 | - list(,,$file) = explode('/', $App->controllerTg); |
|
397 | + list(,, $file) = explode('/', $App->controllerTg); |
|
398 | 398 | |
399 | 399 | $action->setParameter('addon', $App->getAddonName().'.'.$file); |
400 | 400 | $action->setParameter('idx', $idx); |
@@ -420,24 +420,24 @@ discard block |
||
420 | 420 | return false; |
421 | 421 | } |
422 | 422 | |
423 | - list($objectName, ) = explode('.', $method); |
|
423 | + list($objectName,) = explode('.', $method); |
|
424 | 424 | |
425 | 425 | if (!method_exists($this, $objectName)) { |
426 | 426 | /* @var $component app_Component */ |
427 | 427 | $component = $this->app->getComponentByName(ucfirst($objectName)); |
428 | - if($component){ |
|
428 | + if ($component) { |
|
429 | 429 | $this->app->setCurrentComponent($component); |
430 | 430 | $objectController = $component->controller(false); |
431 | 431 | } |
432 | - else{ |
|
432 | + else { |
|
433 | 433 | header('HTTP/1.0 400 Bad Request'); |
434 | 434 | throw new app_UnknownActionException($action); |
435 | 435 | } |
436 | 436 | } |
437 | 437 | |
438 | - if(!isset($component)){ |
|
438 | + if (!isset($component)) { |
|
439 | 439 | $objectController = $this->{$objectName}(false); |
440 | - if ( ! ($objectController instanceof app_Controller)) { |
|
440 | + if (!($objectController instanceof app_Controller)) { |
|
441 | 441 | return false; |
442 | 442 | } |
443 | 443 | } |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | } else { |
452 | 452 | if ($this->isAjaxRequest()) { |
453 | 453 | |
454 | - header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden', true, 403); |
|
454 | + header($_SERVER['SERVER_PROTOCOL'].' 403 Forbidden', true, 403); |
|
455 | 455 | |
456 | 456 | die( |
457 | 457 | bab_json_encode( |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | } catch (app_SaveException $e) { |
473 | 473 | |
474 | 474 | if ($this->isAjaxRequest()) { |
475 | - header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden', true, 403); |
|
475 | + header($_SERVER['SERVER_PROTOCOL'].' 403 Forbidden', true, 403); |
|
476 | 476 | header('Cache-Control: no-cache, must-revalidate'); |
477 | 477 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); |
478 | 478 | header('Content-type: application/json'); |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | if (method_exists($htmlCanvas, 'sendPageTitle')) { |
528 | 528 | $htmlCanvas->sendPageTitle($pageTitle); |
529 | 529 | } else { |
530 | - header('X-Cto-PageTitle: ' . $pageTitle); |
|
530 | + header('X-Cto-PageTitle: '.$pageTitle); |
|
531 | 531 | } |
532 | 532 | } |
533 | 533 | $html = $returnedValue->display($htmlCanvas); |
@@ -586,7 +586,7 @@ discard block |
||
586 | 586 | private function deletedItemPage(Widget_Action $action, app_DeletedRecordException $e) |
587 | 587 | { |
588 | 588 | if ($this->isAjaxRequest()) { |
589 | - header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden', true, 403); |
|
589 | + header($_SERVER['SERVER_PROTOCOL'].' 403 Forbidden', true, 403); |
|
590 | 590 | header('Cache-Control: no-cache, must-revalidate'); |
591 | 591 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); |
592 | 592 | header('Content-type: application/json'); |
@@ -603,7 +603,7 @@ discard block |
||
603 | 603 | ); |
604 | 604 | |
605 | 605 | } |
606 | - header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found', true, 404); |
|
606 | + header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found', true, 404); |
|
607 | 607 | |
608 | 608 | $App = $this->App(); |
609 | 609 | $W = bab_Widgets(); |
@@ -637,7 +637,7 @@ discard block |
||
637 | 637 | private function notFoundPage(Widget_Action $action, app_NotFoundException $e) |
638 | 638 | { |
639 | 639 | if ($this->isAjaxRequest()) { |
640 | - $message = sprintf(app_translate('This %s does not exists'), $e->getObjectTitle() . ' (' . $e->getId() . ')'); |
|
640 | + $message = sprintf(app_translate('This %s does not exists'), $e->getObjectTitle().' ('.$e->getId().')'); |
|
641 | 641 | $json = array( |
642 | 642 | 'messages' => array( |
643 | 643 | array( |
@@ -649,7 +649,7 @@ discard block |
||
649 | 649 | echo bab_json_encode($json); |
650 | 650 | die; |
651 | 651 | } |
652 | - header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found', true, 404); |
|
652 | + header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found', true, 404); |
|
653 | 653 | header('Cache-Control: no-cache, must-revalidate'); |
654 | 654 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); |
655 | 655 | |
@@ -669,14 +669,14 @@ discard block |
||
669 | 669 | |
670 | 670 | private function errorPage(Exception $e) |
671 | 671 | { |
672 | - header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal server error', true, 500); |
|
672 | + header($_SERVER['SERVER_PROTOCOL'].' 500 Internal server error', true, 500); |
|
673 | 673 | |
674 | - require_once $GLOBALS['babInstallPath'] . 'utilit/uiutil.php'; |
|
674 | + require_once $GLOBALS['babInstallPath'].'utilit/uiutil.php'; |
|
675 | 675 | $popup = new babBodyPopup(); |
676 | 676 | $popup->babEcho( |
677 | - '<h1>' . $this->App()->translate('There was a problem when trying to perform this operation') . '</h1>' |
|
678 | - . '<h2 class="error">' . $this->App()->translate('Additional debugging information:') . '</h2>' |
|
679 | - . '<p class="error">' . $e->getMessage() . ' ' . $e->getFile() . ' ' . $e->getLine() . ' ' . $e->getTraceAsString() . '</p>' |
|
677 | + '<h1>'.$this->App()->translate('There was a problem when trying to perform this operation').'</h1>' |
|
678 | + . '<h2 class="error">'.$this->App()->translate('Additional debugging information:').'</h2>' |
|
679 | + . '<p class="error">'.$e->getMessage().' '.$e->getFile().' '.$e->getLine().' '.$e->getTraceAsString().'</p>' |
|
680 | 680 | ); |
681 | 681 | |
682 | 682 | |
@@ -721,7 +721,7 @@ discard block |
||
721 | 721 | */ |
722 | 722 | public function CustomField($proxy = true) |
723 | 723 | { |
724 | - require_once APP_CTRL_PATH . 'customfield.ctrl.php'; |
|
724 | + require_once APP_CTRL_PATH.'customfield.ctrl.php'; |
|
725 | 725 | return $this->App()->ControllerProxy('app_CtrlCustomField', $proxy); |
726 | 726 | } |
727 | 727 | |
@@ -732,7 +732,7 @@ discard block |
||
732 | 732 | */ |
733 | 733 | public function CustomSection($proxy = true) |
734 | 734 | { |
735 | - require_once APP_CTRL_PATH . 'customsection.ctrl.php'; |
|
735 | + require_once APP_CTRL_PATH.'customsection.ctrl.php'; |
|
736 | 736 | return $this->App()->ControllerProxy('app_CtrlCustomSection', $proxy); |
737 | 737 | } |
738 | 738 | } |
@@ -428,8 +428,7 @@ |
||
428 | 428 | if($component){ |
429 | 429 | $this->app->setCurrentComponent($component); |
430 | 430 | $objectController = $component->controller(false); |
431 | - } |
|
432 | - else{ |
|
431 | + } else{ |
|
433 | 432 | header('HTTP/1.0 400 Bad Request'); |
434 | 433 | throw new app_UnknownActionException($action); |
435 | 434 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | if (empty($description)) { |
48 | 48 | $description = $field->getName(); |
49 | 49 | } |
50 | - $fieldLabel = $W->Label($description . ':'); |
|
50 | + $fieldLabel = $W->Label($description.':'); |
|
51 | 51 | |
52 | 52 | if ($field instanceof ORM_DateField) { |
53 | 53 | $widget = $W->DatePicker(); |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | if (empty($description)) { |
104 | 104 | $description = $field->getName(); |
105 | 105 | } |
106 | - $fieldLabel = $W->Label($description . ':'); |
|
106 | + $fieldLabel = $W->Label($description.':'); |
|
107 | 107 | |
108 | 108 | if ($field instanceof ORM_DateField) { |
109 | 109 | $widget = $W->PeriodPicker(); |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | $nbOptions = 0; |
207 | 207 | foreach ($iterator as $record) { |
208 | 208 | if (isset($record->code)) { |
209 | - $optionText = $record->code . ' - ' . $record->$fieldName; |
|
209 | + $optionText = $record->code.' - '.$record->$fieldName; |
|
210 | 210 | } else { |
211 | 211 | $optionText = $record->$fieldName; |
212 | 212 | } |
@@ -33,50 +33,50 @@ discard block |
||
33 | 33 | */ |
34 | 34 | function app_genericSetEditor(ORM_RecordSet $set) |
35 | 35 | { |
36 | - $O = bab_functionality::get('LibOrm'); |
|
37 | - $O->init(); |
|
38 | - $W = bab_Widgets(); |
|
39 | - $layout = $W->VBoxLayout(); |
|
40 | - $layout->setVerticalSpacing(1, 'em'); |
|
41 | - |
|
42 | - |
|
43 | - $fields = $set->getFields(); |
|
44 | - |
|
45 | - foreach ($fields as $field) { |
|
46 | - $description = $field->getDescription(); |
|
47 | - if (empty($description)) { |
|
48 | - $description = $field->getName(); |
|
49 | - } |
|
50 | - $fieldLabel = $W->Label($description . ':'); |
|
51 | - |
|
52 | - if ($field instanceof ORM_DateField) { |
|
53 | - $widget = $W->DatePicker(); |
|
54 | - } else if ($field instanceof ORM_TimeField) { |
|
55 | - $widget = $W->LineEdit()->setMaxSize(5)->setSize(5)->addClass('widget-timepicker'); |
|
56 | - } else if ($field instanceof ORM_StringField) { |
|
57 | - $widget = $W->LineEdit()->setSize(min(array(80, $field->getMaxLength()))); |
|
58 | - } else if ($field instanceof ORM_EnumField) { |
|
59 | - $widget = $W->Select(); |
|
60 | - $widget->addOption('', ''); |
|
61 | - foreach ($field->getValues() as $key => $text) { |
|
62 | - $widget->addOption($key, $text); |
|
63 | - } |
|
64 | - } else if ($field instanceof ORM_IntField) { |
|
65 | - $widget = $W->LineEdit()->setSize(9); |
|
66 | - } else if ($field instanceof ORM_TextField) { |
|
67 | - $widget = $W->TextEdit()->setColumns(80)->setLines(5); |
|
68 | - } else if ($field instanceof ORM_RecordSet) { |
|
69 | - $widget = app_genericSetEditor($field); |
|
70 | - $widget->addClass('sub-form'); |
|
71 | - } else { |
|
72 | - $widget = null; |
|
73 | - } |
|
74 | - if (isset($widget)) { |
|
75 | - $layout->addItem($W->VBoxLayout()->addItem($fieldLabel)->addItem($widget)); |
|
76 | - } |
|
77 | - } |
|
78 | - |
|
79 | - return $layout; |
|
36 | + $O = bab_functionality::get('LibOrm'); |
|
37 | + $O->init(); |
|
38 | + $W = bab_Widgets(); |
|
39 | + $layout = $W->VBoxLayout(); |
|
40 | + $layout->setVerticalSpacing(1, 'em'); |
|
41 | + |
|
42 | + |
|
43 | + $fields = $set->getFields(); |
|
44 | + |
|
45 | + foreach ($fields as $field) { |
|
46 | + $description = $field->getDescription(); |
|
47 | + if (empty($description)) { |
|
48 | + $description = $field->getName(); |
|
49 | + } |
|
50 | + $fieldLabel = $W->Label($description . ':'); |
|
51 | + |
|
52 | + if ($field instanceof ORM_DateField) { |
|
53 | + $widget = $W->DatePicker(); |
|
54 | + } else if ($field instanceof ORM_TimeField) { |
|
55 | + $widget = $W->LineEdit()->setMaxSize(5)->setSize(5)->addClass('widget-timepicker'); |
|
56 | + } else if ($field instanceof ORM_StringField) { |
|
57 | + $widget = $W->LineEdit()->setSize(min(array(80, $field->getMaxLength()))); |
|
58 | + } else if ($field instanceof ORM_EnumField) { |
|
59 | + $widget = $W->Select(); |
|
60 | + $widget->addOption('', ''); |
|
61 | + foreach ($field->getValues() as $key => $text) { |
|
62 | + $widget->addOption($key, $text); |
|
63 | + } |
|
64 | + } else if ($field instanceof ORM_IntField) { |
|
65 | + $widget = $W->LineEdit()->setSize(9); |
|
66 | + } else if ($field instanceof ORM_TextField) { |
|
67 | + $widget = $W->TextEdit()->setColumns(80)->setLines(5); |
|
68 | + } else if ($field instanceof ORM_RecordSet) { |
|
69 | + $widget = app_genericSetEditor($field); |
|
70 | + $widget->addClass('sub-form'); |
|
71 | + } else { |
|
72 | + $widget = null; |
|
73 | + } |
|
74 | + if (isset($widget)) { |
|
75 | + $layout->addItem($W->VBoxLayout()->addItem($fieldLabel)->addItem($widget)); |
|
76 | + } |
|
77 | + } |
|
78 | + |
|
79 | + return $layout; |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | |
@@ -89,50 +89,50 @@ discard block |
||
89 | 89 | */ |
90 | 90 | function app_genericSetFilterForm(ORM_RecordSet $set) |
91 | 91 | { |
92 | - $O = bab_functionality::get('LibOrm'); |
|
93 | - $O->init(); |
|
94 | - $W = bab_Widgets(); |
|
95 | - $layout = $W->FlowLayout(); |
|
96 | - $layout->setVerticalSpacing(1, 'em')->setHorizontalSpacing(1, 'em'); |
|
97 | - |
|
98 | - |
|
99 | - $fields = $set->getFields(); |
|
100 | - |
|
101 | - foreach ($fields as $field) { |
|
102 | - $description = $field->getDescription(); |
|
103 | - if (empty($description)) { |
|
104 | - $description = $field->getName(); |
|
105 | - } |
|
106 | - $fieldLabel = $W->Label($description . ':'); |
|
107 | - |
|
108 | - if ($field instanceof ORM_DateField) { |
|
109 | - $widget = $W->PeriodPicker(); |
|
110 | - } else if ($field instanceof ORM_TimeField) { |
|
111 | - $widget = $W->TimePicker(); |
|
112 | - } else if ($field instanceof ORM_StringField) { |
|
113 | - $widget = $W->LineEdit()->setSize(min(array(15, $field->getMaxLength()))); |
|
114 | - } else if ($field instanceof ORM_EnumField) { |
|
115 | - $widget = $W->Select(); |
|
116 | - $widget->addOption('', ''); |
|
117 | - foreach ($field->getValues() as $key => $text) { |
|
118 | - $widget->addOption($key, $text); |
|
119 | - } |
|
120 | - } else if ($field instanceof ORM_IntField) { |
|
121 | - $widget = $W->LineEdit()->setSize(9); |
|
122 | - } else if ($field instanceof ORM_TextField) { |
|
123 | - $widget = $widget = $W->LineEdit()->setSize(15); |
|
124 | - } else if ($field instanceof ORM_RecordSet) { |
|
125 | - $widget = app_genericSetFilterForm($field); |
|
126 | - $widget->addClass('sub-form'); |
|
127 | - } else { |
|
128 | - $widget = null; |
|
129 | - } |
|
130 | - if (isset($widget)) { |
|
131 | - $layout->addItem($W->VBoxLayout()->addItem($fieldLabel)->addItem($widget)); |
|
132 | - } |
|
133 | - } |
|
134 | - |
|
135 | - return $layout; |
|
92 | + $O = bab_functionality::get('LibOrm'); |
|
93 | + $O->init(); |
|
94 | + $W = bab_Widgets(); |
|
95 | + $layout = $W->FlowLayout(); |
|
96 | + $layout->setVerticalSpacing(1, 'em')->setHorizontalSpacing(1, 'em'); |
|
97 | + |
|
98 | + |
|
99 | + $fields = $set->getFields(); |
|
100 | + |
|
101 | + foreach ($fields as $field) { |
|
102 | + $description = $field->getDescription(); |
|
103 | + if (empty($description)) { |
|
104 | + $description = $field->getName(); |
|
105 | + } |
|
106 | + $fieldLabel = $W->Label($description . ':'); |
|
107 | + |
|
108 | + if ($field instanceof ORM_DateField) { |
|
109 | + $widget = $W->PeriodPicker(); |
|
110 | + } else if ($field instanceof ORM_TimeField) { |
|
111 | + $widget = $W->TimePicker(); |
|
112 | + } else if ($field instanceof ORM_StringField) { |
|
113 | + $widget = $W->LineEdit()->setSize(min(array(15, $field->getMaxLength()))); |
|
114 | + } else if ($field instanceof ORM_EnumField) { |
|
115 | + $widget = $W->Select(); |
|
116 | + $widget->addOption('', ''); |
|
117 | + foreach ($field->getValues() as $key => $text) { |
|
118 | + $widget->addOption($key, $text); |
|
119 | + } |
|
120 | + } else if ($field instanceof ORM_IntField) { |
|
121 | + $widget = $W->LineEdit()->setSize(9); |
|
122 | + } else if ($field instanceof ORM_TextField) { |
|
123 | + $widget = $widget = $W->LineEdit()->setSize(15); |
|
124 | + } else if ($field instanceof ORM_RecordSet) { |
|
125 | + $widget = app_genericSetFilterForm($field); |
|
126 | + $widget->addClass('sub-form'); |
|
127 | + } else { |
|
128 | + $widget = null; |
|
129 | + } |
|
130 | + if (isset($widget)) { |
|
131 | + $layout->addItem($W->VBoxLayout()->addItem($fieldLabel)->addItem($widget)); |
|
132 | + } |
|
133 | + } |
|
134 | + |
|
135 | + return $layout; |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | |
@@ -145,47 +145,47 @@ discard block |
||
145 | 145 | */ |
146 | 146 | function app_LabelledWidget($labelText, Widget_Displayable_Interface $widget) |
147 | 147 | { |
148 | - $W = bab_Widgets(); |
|
149 | - |
|
150 | - $label = $W->Label($labelText); |
|
151 | - if ($widget instanceof Widget_InputWidget) { |
|
152 | - $label->setAssociatedWidget($widget); |
|
153 | - } |
|
154 | - |
|
155 | - if ($widget instanceof Widget_CheckBox) { |
|
156 | - $layout = $W->HBoxItems( |
|
157 | - $widget->setSizePolicy(Widget_SizePolicy::MINIMUM), |
|
158 | - $label |
|
159 | - )->setVerticalAlign('middle')->setHorizontalSpacing(0.5, 'em'); |
|
160 | - } else { |
|
161 | - $layout = $W->VBoxItems( |
|
162 | - $label, |
|
163 | - $widget |
|
164 | - )->setVerticalSpacing(0.5, 'em'); |
|
165 | - } |
|
166 | - |
|
167 | - return $layout; |
|
148 | + $W = bab_Widgets(); |
|
149 | + |
|
150 | + $label = $W->Label($labelText); |
|
151 | + if ($widget instanceof Widget_InputWidget) { |
|
152 | + $label->setAssociatedWidget($widget); |
|
153 | + } |
|
154 | + |
|
155 | + if ($widget instanceof Widget_CheckBox) { |
|
156 | + $layout = $W->HBoxItems( |
|
157 | + $widget->setSizePolicy(Widget_SizePolicy::MINIMUM), |
|
158 | + $label |
|
159 | + )->setVerticalAlign('middle')->setHorizontalSpacing(0.5, 'em'); |
|
160 | + } else { |
|
161 | + $layout = $W->VBoxItems( |
|
162 | + $label, |
|
163 | + $widget |
|
164 | + )->setVerticalSpacing(0.5, 'em'); |
|
165 | + } |
|
166 | + |
|
167 | + return $layout; |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | |
171 | 171 | |
172 | 172 | function app_LabelledCheckbox($labelText, $checkboxName, $options = null) |
173 | 173 | { |
174 | - $W = bab_Widgets(); |
|
174 | + $W = bab_Widgets(); |
|
175 | 175 | |
176 | - $label = $W->Label($labelText)->colon(false); |
|
177 | - $checkbox = $W->Checkbox()->setName($checkboxName); |
|
178 | - $label->setAssociatedWidget($checkbox); |
|
179 | - if (isset($options)) { |
|
180 | - $label->setSizePolicy(Widget_SizePolicy::FIXED)->setCanvasOptions($options); |
|
181 | - } |
|
176 | + $label = $W->Label($labelText)->colon(false); |
|
177 | + $checkbox = $W->Checkbox()->setName($checkboxName); |
|
178 | + $label->setAssociatedWidget($checkbox); |
|
179 | + if (isset($options)) { |
|
180 | + $label->setSizePolicy(Widget_SizePolicy::FIXED)->setCanvasOptions($options); |
|
181 | + } |
|
182 | 182 | |
183 | - $layout = $W->HBoxItems( |
|
184 | - $checkbox->setSizePolicy(Widget_SizePolicy::MINIMUM), |
|
185 | - $label |
|
186 | - )->setVerticalAlign('middle')->setHorizontalSpacing(0.5, 'em'); |
|
183 | + $layout = $W->HBoxItems( |
|
184 | + $checkbox->setSizePolicy(Widget_SizePolicy::MINIMUM), |
|
185 | + $label |
|
186 | + )->setVerticalAlign('middle')->setHorizontalSpacing(0.5, 'em'); |
|
187 | 187 | |
188 | - return $layout; |
|
188 | + return $layout; |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | |
@@ -193,42 +193,42 @@ discard block |
||
193 | 193 | |
194 | 194 | function app_LabelledOrmSelect(ORM_MysqlIterator $iterator, $fieldName, $selectName, $label, $hidden = false, $groupFieldName = null) |
195 | 195 | { |
196 | - $W = bab_Widgets(); |
|
197 | - |
|
198 | - if (isset($groupFieldName)) { |
|
199 | - $groupPathElements = explode('/', $groupFieldName); |
|
200 | - } |
|
201 | - |
|
202 | - $select = $W->Select()->setName($selectName); |
|
203 | - |
|
204 | - $select->addOption('', ''); |
|
205 | - |
|
206 | - $nbOptions = 0; |
|
207 | - foreach ($iterator as $record) { |
|
208 | - if (isset($record->code)) { |
|
209 | - $optionText = $record->code . ' - ' . $record->$fieldName; |
|
210 | - } else { |
|
211 | - $optionText = $record->$fieldName; |
|
212 | - } |
|
213 | - if (isset($groupFieldName)) { |
|
214 | - $group = $record; |
|
215 | - foreach ($groupPathElements as $groupPathElement) { |
|
216 | - $group = $group->$groupPathElement; |
|
217 | - } |
|
218 | - $select->addOption($record->id, $optionText, $group); |
|
219 | - } else { |
|
220 | - $select->addOption($record->id, $optionText); |
|
221 | - } |
|
222 | - $nbOptions++; |
|
223 | - $lastId = $record->id; |
|
224 | - } |
|
225 | - |
|
226 | - if ($nbOptions == 1) { |
|
227 | - $select->setValue($lastId); |
|
228 | - } |
|
229 | - |
|
230 | - |
|
231 | - return app_LabelledWidget($label, $select); |
|
196 | + $W = bab_Widgets(); |
|
197 | + |
|
198 | + if (isset($groupFieldName)) { |
|
199 | + $groupPathElements = explode('/', $groupFieldName); |
|
200 | + } |
|
201 | + |
|
202 | + $select = $W->Select()->setName($selectName); |
|
203 | + |
|
204 | + $select->addOption('', ''); |
|
205 | + |
|
206 | + $nbOptions = 0; |
|
207 | + foreach ($iterator as $record) { |
|
208 | + if (isset($record->code)) { |
|
209 | + $optionText = $record->code . ' - ' . $record->$fieldName; |
|
210 | + } else { |
|
211 | + $optionText = $record->$fieldName; |
|
212 | + } |
|
213 | + if (isset($groupFieldName)) { |
|
214 | + $group = $record; |
|
215 | + foreach ($groupPathElements as $groupPathElement) { |
|
216 | + $group = $group->$groupPathElement; |
|
217 | + } |
|
218 | + $select->addOption($record->id, $optionText, $group); |
|
219 | + } else { |
|
220 | + $select->addOption($record->id, $optionText); |
|
221 | + } |
|
222 | + $nbOptions++; |
|
223 | + $lastId = $record->id; |
|
224 | + } |
|
225 | + |
|
226 | + if ($nbOptions == 1) { |
|
227 | + $select->setValue($lastId); |
|
228 | + } |
|
229 | + |
|
230 | + |
|
231 | + return app_LabelledWidget($label, $select); |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | |
@@ -236,108 +236,108 @@ discard block |
||
236 | 236 | |
237 | 237 | function app_OrmWidget(ORM_Field $field) |
238 | 238 | { |
239 | - $W = bab_Widgets(); |
|
239 | + $W = bab_Widgets(); |
|
240 | 240 | |
241 | 241 | |
242 | - if ($field instanceof ORM_DateField) { |
|
243 | - $widget = $W->DatePicker(); |
|
244 | - } else if ($field instanceof ORM_TimeField) { |
|
245 | - $widget = $W->TimeEdit(); //->setMaxSize(5)->setSize(5)->addClass('widget-timepicker'); |
|
246 | - } else if ($field instanceof ORM_DatetimeField) { |
|
247 | - $widget = $W->DateTimePicker(); //->setMaxSize(5)->setSize(5)->addClass('widget-timepicker'); |
|
248 | - } else if ($field instanceof ORM_EnumField) { |
|
249 | - $widget = $W->Select(); |
|
242 | + if ($field instanceof ORM_DateField) { |
|
243 | + $widget = $W->DatePicker(); |
|
244 | + } else if ($field instanceof ORM_TimeField) { |
|
245 | + $widget = $W->TimeEdit(); //->setMaxSize(5)->setSize(5)->addClass('widget-timepicker'); |
|
246 | + } else if ($field instanceof ORM_DatetimeField) { |
|
247 | + $widget = $W->DateTimePicker(); //->setMaxSize(5)->setSize(5)->addClass('widget-timepicker'); |
|
248 | + } else if ($field instanceof ORM_EnumField) { |
|
249 | + $widget = $W->Select(); |
|
250 | 250 | //// $widget = $W->MultiSelect()->setSingleSelect(); |
251 | - $widget->addOption('', ''); |
|
252 | - $values = $field->getValues(); |
|
253 | - foreach ($values as $key => $value) { |
|
254 | - $widget->addOption($key, $value); |
|
255 | - } |
|
256 | - } else if ($field instanceof ORM_SetField) { |
|
257 | - $widget = $W->MultiSelect()->setSelectedList(2); |
|
258 | - $values = $field->getValues(); |
|
259 | - foreach ($values as $key => $value) { |
|
260 | - $widget->addOption($key, $value); |
|
261 | - } |
|
262 | - } else if ($field instanceof ORM_UserField) { |
|
263 | - $widget = $W->SuggestUser() |
|
264 | - ->setMinChars(0) |
|
265 | - ->setSizePolicy(Func_Icons::ICON_LEFT_16); |
|
266 | - } else if ($field instanceof ORM_CurrencyField) { |
|
267 | - $widget = $W->LineEdit()->setSize(6)->addClass('widget-input-currency'); |
|
268 | - } else if ($field instanceof ORM_BoolField) { |
|
269 | - $widget = $W->CheckBox()->setCheckedValue('1'); |
|
270 | - } else if ($field instanceof ORM_IntField) { |
|
271 | - $widget = $W->LineEdit() |
|
272 | - ->setSize(6)->addClass('widget-input-numeric'); |
|
273 | - } else if ($field instanceof ORM_EmailField) { |
|
274 | - $widget = $W->EmailLineEdit() |
|
275 | - ->setMaxSize($field->getMaxLength()); |
|
276 | - } else if ($field instanceof ORM_FileField) { |
|
277 | - $widget = $W->FilePicker(); |
|
278 | - } else if ($field instanceof ORM_StringField) { |
|
279 | - $widget = $W->LineEdit() |
|
280 | - ->setMaxSize($field->getMaxLength()); |
|
281 | - } else if ($field instanceof ORM_TextField) { |
|
282 | - $widget = $W->TextEdit() |
|
283 | - ->addClass('widget-autoresize'); |
|
284 | - } else if ($field instanceof ORM_PkField) { |
|
285 | - $widget = $W->Hidden(); |
|
286 | - } else if ($field instanceof ORM_FkField) { |
|
287 | - $widget = $W->Select(); |
|
288 | - $fieldName = $field->getName(); |
|
289 | - $parentSet = clone $field->getParentSet(); |
|
290 | - $parentSet->join($fieldName); |
|
291 | - $set = $parentSet->$fieldName; |
|
292 | - $records = $set->select(); |
|
293 | - $records->orderAsc($set->name); |
|
294 | - $pkName = $set->getPrimaryKey(); |
|
295 | - $widget->addOption('', ''); |
|
296 | - foreach ($records as $record) { |
|
297 | - $widget->addOption($record->$pkName, $record->name); |
|
298 | - } |
|
299 | - } else if ($field instanceof ORM_RecordSet) { |
|
300 | - $widget = $W->Select(); |
|
251 | + $widget->addOption('', ''); |
|
252 | + $values = $field->getValues(); |
|
253 | + foreach ($values as $key => $value) { |
|
254 | + $widget->addOption($key, $value); |
|
255 | + } |
|
256 | + } else if ($field instanceof ORM_SetField) { |
|
257 | + $widget = $W->MultiSelect()->setSelectedList(2); |
|
258 | + $values = $field->getValues(); |
|
259 | + foreach ($values as $key => $value) { |
|
260 | + $widget->addOption($key, $value); |
|
261 | + } |
|
262 | + } else if ($field instanceof ORM_UserField) { |
|
263 | + $widget = $W->SuggestUser() |
|
264 | + ->setMinChars(0) |
|
265 | + ->setSizePolicy(Func_Icons::ICON_LEFT_16); |
|
266 | + } else if ($field instanceof ORM_CurrencyField) { |
|
267 | + $widget = $W->LineEdit()->setSize(6)->addClass('widget-input-currency'); |
|
268 | + } else if ($field instanceof ORM_BoolField) { |
|
269 | + $widget = $W->CheckBox()->setCheckedValue('1'); |
|
270 | + } else if ($field instanceof ORM_IntField) { |
|
271 | + $widget = $W->LineEdit() |
|
272 | + ->setSize(6)->addClass('widget-input-numeric'); |
|
273 | + } else if ($field instanceof ORM_EmailField) { |
|
274 | + $widget = $W->EmailLineEdit() |
|
275 | + ->setMaxSize($field->getMaxLength()); |
|
276 | + } else if ($field instanceof ORM_FileField) { |
|
277 | + $widget = $W->FilePicker(); |
|
278 | + } else if ($field instanceof ORM_StringField) { |
|
279 | + $widget = $W->LineEdit() |
|
280 | + ->setMaxSize($field->getMaxLength()); |
|
281 | + } else if ($field instanceof ORM_TextField) { |
|
282 | + $widget = $W->TextEdit() |
|
283 | + ->addClass('widget-autoresize'); |
|
284 | + } else if ($field instanceof ORM_PkField) { |
|
285 | + $widget = $W->Hidden(); |
|
286 | + } else if ($field instanceof ORM_FkField) { |
|
287 | + $widget = $W->Select(); |
|
288 | + $fieldName = $field->getName(); |
|
289 | + $parentSet = clone $field->getParentSet(); |
|
290 | + $parentSet->join($fieldName); |
|
291 | + $set = $parentSet->$fieldName; |
|
292 | + $records = $set->select(); |
|
293 | + $records->orderAsc($set->name); |
|
294 | + $pkName = $set->getPrimaryKey(); |
|
295 | + $widget->addOption('', ''); |
|
296 | + foreach ($records as $record) { |
|
297 | + $widget->addOption($record->$pkName, $record->name); |
|
298 | + } |
|
299 | + } else if ($field instanceof ORM_RecordSet) { |
|
300 | + $widget = $W->Select(); |
|
301 | 301 | //// $widget = $W->MultiSelect()->setSingleSelect(); |
302 | 302 | // $fieldName = $field->getName(); |
303 | 303 | // $parentSet = $field->getParentSet(); |
304 | 304 | // $parentSet->join($fieldName); |
305 | 305 | // $set = $parentSet->$fieldName; |
306 | - $records = $field->select(); |
|
307 | - $records->orderAsc($field->name); |
|
308 | - $pkName = $field->getPrimaryKey(); |
|
309 | - $widget->addOption('', ''); |
|
310 | - foreach ($records as $record) { |
|
311 | - $widget->addOption($record->$pkName, $record->name); |
|
312 | - } |
|
313 | - } else { |
|
314 | - $widget = $W->LineEdit(); |
|
315 | - } |
|
316 | - |
|
317 | - $widget->setName($field->getName()); |
|
318 | - |
|
319 | - return $widget; |
|
306 | + $records = $field->select(); |
|
307 | + $records->orderAsc($field->name); |
|
308 | + $pkName = $field->getPrimaryKey(); |
|
309 | + $widget->addOption('', ''); |
|
310 | + foreach ($records as $record) { |
|
311 | + $widget->addOption($record->$pkName, $record->name); |
|
312 | + } |
|
313 | + } else { |
|
314 | + $widget = $W->LineEdit(); |
|
315 | + } |
|
316 | + |
|
317 | + $widget->setName($field->getName()); |
|
318 | + |
|
319 | + return $widget; |
|
320 | 320 | } |
321 | 321 | |
322 | 322 | |
323 | 323 | |
324 | 324 | function app_LabelledOrmWidget(ORM_Field $field, $label = null, $hidden = false) |
325 | 325 | { |
326 | - $W = bab_Widgets(); |
|
326 | + $W = bab_Widgets(); |
|
327 | 327 | |
328 | - if ($hidden) { |
|
329 | - $widget = $W->Hidden(); |
|
330 | - $widget->setName($field->getName()); |
|
331 | - return $widget; |
|
332 | - } |
|
328 | + if ($hidden) { |
|
329 | + $widget = $W->Hidden(); |
|
330 | + $widget->setName($field->getName()); |
|
331 | + return $widget; |
|
332 | + } |
|
333 | 333 | |
334 | - if (is_null($label)) { |
|
335 | - $label = $field->getDescription(); |
|
336 | - } |
|
334 | + if (is_null($label)) { |
|
335 | + $label = $field->getDescription(); |
|
336 | + } |
|
337 | 337 | |
338 | - $widget = app_OrmWidget($field); |
|
338 | + $widget = app_OrmWidget($field); |
|
339 | 339 | |
340 | - return app_LabelledWidget($label, $widget); |
|
340 | + return app_LabelledWidget($label, $widget); |
|
341 | 341 | } |
342 | 342 | |
343 | 343 | |
@@ -353,16 +353,16 @@ discard block |
||
353 | 353 | */ |
354 | 354 | function app_dateTime(ORM_Field $field, $value) { |
355 | 355 | |
356 | - $W = bab_functionality::get('Widgets'); |
|
357 | - $name = $field->getName(); |
|
358 | - $label = $W->Label($field->getDescription()); |
|
356 | + $W = bab_functionality::get('Widgets'); |
|
357 | + $name = $field->getName(); |
|
358 | + $label = $W->Label($field->getDescription()); |
|
359 | 359 | |
360 | - $frame = app_dateTimeField($name, $label, $value); |
|
360 | + $frame = app_dateTimeField($name, $label, $value); |
|
361 | 361 | |
362 | - return $W->VBoxItems( |
|
363 | - $label, |
|
364 | - $frame |
|
365 | - ); |
|
362 | + return $W->VBoxItems( |
|
363 | + $label, |
|
364 | + $frame |
|
365 | + ); |
|
366 | 366 | |
367 | 367 | } |
368 | 368 | |
@@ -376,24 +376,24 @@ discard block |
||
376 | 376 | */ |
377 | 377 | function app_dateTimeField($fieldName, Widget_Label $label, $value = null) |
378 | 378 | { |
379 | - $W = bab_functionality::get('Widgets'); |
|
379 | + $W = bab_functionality::get('Widgets'); |
|
380 | 380 | |
381 | - $datepart = $W->DatePicker()->setAssociatedLabel($label)->setName('date'); |
|
382 | - $timepart = $W->TimePicker()->setName('time'); |
|
381 | + $datepart = $W->DatePicker()->setAssociatedLabel($label)->setName('date'); |
|
382 | + $timepart = $W->TimePicker()->setName('time'); |
|
383 | 383 | |
384 | - if (isset($value)) { |
|
384 | + if (isset($value)) { |
|
385 | 385 | |
386 | - $value = explode(' ', $value); |
|
386 | + $value = explode(' ', $value); |
|
387 | 387 | |
388 | - $datepart->setValue($value[0]); |
|
389 | - $timepart->setValue($value[1]); |
|
390 | - } |
|
388 | + $datepart->setValue($value[0]); |
|
389 | + $timepart->setValue($value[1]); |
|
390 | + } |
|
391 | 391 | |
392 | - $datetime = $W->Frame(null, $W->HBoxLayout())->setName($fieldName) |
|
393 | - ->addItem($datepart) |
|
394 | - ->addItem($timepart); |
|
392 | + $datetime = $W->Frame(null, $W->HBoxLayout())->setName($fieldName) |
|
393 | + ->addItem($datepart) |
|
394 | + ->addItem($timepart); |
|
395 | 395 | |
396 | - return $datetime; |
|
396 | + return $datetime; |
|
397 | 397 | } |
398 | 398 | |
399 | 399 |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | if (null === $url) { |
113 | 113 | $script = '<script type="text/javascript">'; |
114 | 114 | if (isset($message)) { |
115 | - $script .= 'alert("' . bab_toHtml($message, BAB_HTML_JS) . '");'; |
|
115 | + $script .= 'alert("'.bab_toHtml($message, BAB_HTML_JS).'");'; |
|
116 | 116 | } |
117 | 117 | $script .= 'history.back();'; |
118 | 118 | $script .= '</script>'; |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | $url = $url->url(); |
125 | 125 | } |
126 | 126 | if (!empty($babBody->msgerror)) { |
127 | - $url .= '&msgerror=' . urlencode($babBody->msgerror); |
|
127 | + $url .= '&msgerror='.urlencode($babBody->msgerror); |
|
128 | 128 | } |
129 | 129 | if (isset($message)) { |
130 | 130 | $lines = explode("\n", $message); |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | } |
134 | 134 | } |
135 | 135 | |
136 | - header('Location: ' . $url); |
|
136 | + header('Location: '.$url); |
|
137 | 137 | die; |
138 | 138 | } |
139 | 139 | |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | */ |
166 | 166 | function app_fileUploadError($error) |
167 | 167 | { |
168 | - switch($error) { |
|
168 | + switch ($error) { |
|
169 | 169 | case UPLOAD_ERR_OK: |
170 | 170 | return null; |
171 | 171 |
@@ -318,9 +318,9 @@ discard block |
||
318 | 318 | if (is_array($parameters)) { |
319 | 319 | $params = array(); |
320 | 320 | foreach ($parameters as $key => $value) { |
321 | - $params[] = $key . '=' . $value; |
|
321 | + $params[] = $key.'='.$value; |
|
322 | 322 | } |
323 | - $rawField .= ':' . implode(';', $params); |
|
323 | + $rawField .= ':'.implode(';', $params); |
|
324 | 324 | } |
325 | 325 | array_push($rawFields, $rawField); |
326 | 326 | $this->fields = implode(',', $rawFields); |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | if (empty($rawField)) { |
340 | 340 | continue; |
341 | 341 | } |
342 | - list($fieldName, ) = explode(':', $rawField); |
|
342 | + list($fieldName,) = explode(':', $rawField); |
|
343 | 343 | |
344 | 344 | if ($removedFieldName == $fieldName) { |
345 | 345 | continue; |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | */ |
23 | 23 | |
24 | 24 | |
25 | -require_once APP_CTRL_PATH . '/record.ctrl.php'; |
|
25 | +require_once APP_CTRL_PATH.'/record.ctrl.php'; |
|
26 | 26 | |
27 | 27 | |
28 | 28 | /** |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | foreach ($allViewSections as $viewSection) { |
59 | 59 | $fields = $viewSection->getFields(); |
60 | 60 | foreach ($fields as $field) { |
61 | - $allViewFieldNames[$field['fieldname']] = $viewSection->view . ',' . $viewSection->rank . ',' . $viewSection->id; |
|
61 | + $allViewFieldNames[$field['fieldname']] = $viewSection->view.','.$viewSection->rank.','.$viewSection->id; |
|
62 | 62 | } |
63 | 63 | } |
64 | 64 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | bab_Sort::asort($availableFields, 'description', bab_Sort::CASE_INSENSITIVE); |
82 | 82 | |
83 | 83 | foreach ($availableFields as $field) { |
84 | - $fieldName = $field['name']; |
|
84 | + $fieldName = $field['name']; |
|
85 | 85 | $fieldDescription = $field['description']; |
86 | 86 | |
87 | 87 | $used = isset($allViewFieldNames[$fieldName]); |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | $recordSet = $this->getRecordSet(); |
391 | 391 | $record = $recordSet->request($id); |
392 | 392 | |
393 | - $object = $record->object . 'Set'; |
|
393 | + $object = $record->object.'Set'; |
|
394 | 394 | |
395 | 395 | $objectRecordSet = $App->$object(); |
396 | 396 | |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | $recordSet = $this->getRecordSet(); |
465 | 465 | $record = $recordSet->request($data['id']); |
466 | 466 | |
467 | - $object = $record->object . 'Set'; |
|
467 | + $object = $record->object.'Set'; |
|
468 | 468 | |
469 | 469 | $objectRecordSet = $App->$object(); |
470 | 470 | |
@@ -536,17 +536,17 @@ discard block |
||
536 | 536 | $nbCol = 0; |
537 | 537 | foreach ($customSections as $customSection) { |
538 | 538 | |
539 | - list(, , $nbCol) = explode('-', $customSection->sizePolicy); |
|
539 | + list(,, $nbCol) = explode('-', $customSection->sizePolicy); |
|
540 | 540 | |
541 | 541 | $currentColumn += $nbCol; |
542 | 542 | |
543 | 543 | $sectionSection = $W->Section( |
544 | - $customSection->name . ' (' . $customSection->rank . ')', |
|
545 | - $sectionBox = $W->VBoxItems($W->Hidden()->setName('#' . $customSection->id)) |
|
544 | + $customSection->name.' ('.$customSection->rank.')', |
|
545 | + $sectionBox = $W->VBoxItems($W->Hidden()->setName('#'.$customSection->id)) |
|
546 | 546 | ); |
547 | 547 | $sectionSection->addClass('app-custom-section'); |
548 | 548 | $sectionSection->addClass($customSection->classname); |
549 | - $sectionSection->setSizePolicy($customSection->sizePolicy . ' widget-sameheight'); |
|
549 | + $sectionSection->setSizePolicy($customSection->sizePolicy.' widget-sameheight'); |
|
550 | 550 | |
551 | 551 | $row->addItem($sectionSection); |
552 | 552 | |
@@ -588,7 +588,7 @@ discard block |
||
588 | 588 | $fieldItem = $W->HBoxItems( |
589 | 589 | $W->Label($fieldDescription)->setSizePolicy('maximum')->addClass('icon', Func_Icons::ACTIONS_ZOOM_FIT_HEIGHT), |
590 | 590 | $W->HBoxItems( |
591 | - $W->Hidden()->setName($customSection->id . '.' . $fieldId)->setValue($field['name']), |
|
591 | + $W->Hidden()->setName($customSection->id.'.'.$fieldId)->setValue($field['name']), |
|
592 | 592 | $W->Link('', $customSectionCtrl->editDisplayField($customSection->id, $field['name'])) |
593 | 593 | ->addClass('icon', Func_Icons::ACTIONS_DOCUMENT_EDIT) |
594 | 594 | ->setOpenMode(Widget_Link::OPEN_DIALOG), |
@@ -665,7 +665,7 @@ discard block |
||
665 | 665 | } |
666 | 666 | |
667 | 667 | header('Content-type: application/json'); |
668 | - header('Content-Disposition: attachment; filename="' . $object . '.' . ($view === '' ? 'default' : $view) . '.json"'."\n"); |
|
668 | + header('Content-Disposition: attachment; filename="'.$object.'.'.($view === '' ? 'default' : $view).'.json"'."\n"); |
|
669 | 669 | |
670 | 670 | $json = bab_json_encode($sectionsValues); |
671 | 671 | $json = bab_convertStringFromDatabase($json, bab_charset::UTF_8); |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | public function __construct(Func_App $app, $id = null, Widget_Layout $layout = null) |
116 | 116 | { |
117 | 117 | parent::__construct($app); |
118 | - // We simulate inheritance from Widget_VBoxLayout. |
|
118 | + // We simulate inheritance from Widget_VBoxLayout. |
|
119 | 119 | $W = $this->widgets = bab_Widgets(); |
120 | 120 | |
121 | 121 | $this->buttonsLayout = $this->buttonsLayout(); |
@@ -322,9 +322,9 @@ discard block |
||
322 | 322 | $cancelLabel = isset($this->cancelLabel) ? $this->cancelLabel : $App->translate('Cancel'); |
323 | 323 | $this->addButton( |
324 | 324 | $W->SubmitButton(/*'cancel'*/) |
325 | - ->addClass('widget-close-dialog') |
|
325 | + ->addClass('widget-close-dialog') |
|
326 | 326 | ->setAction($this->cancelAction) |
327 | - ->setLabel($cancelLabel) |
|
327 | + ->setLabel($cancelLabel) |
|
328 | 328 | ); |
329 | 329 | } |
330 | 330 | } |
@@ -1170,21 +1170,21 @@ discard block |
||
1170 | 1170 | |
1171 | 1171 | |
1172 | 1172 | |
1173 | - protected function addCustomFields(app_RecordSet $recordSet) |
|
1174 | - { |
|
1175 | - $customFields = $recordSet->getCustomFields(); |
|
1173 | + protected function addCustomFields(app_RecordSet $recordSet) |
|
1174 | + { |
|
1175 | + $customFields = $recordSet->getCustomFields(); |
|
1176 | 1176 | |
1177 | 1177 | foreach ($customFields as $customField) { |
1178 | 1178 | $fieldname = $customField->fieldname; |
1179 | 1179 | $this->addColumn( |
1180 | 1180 | widget_TableModelViewColumn($recordSet->$fieldname, $customField->name) |
1181 | - ->setSortable(true) |
|
1182 | - ->setExportable(true) |
|
1183 | - ->setSearchable($customField->searchable) |
|
1184 | - ->setVisible($customField->visible) |
|
1181 | + ->setSortable(true) |
|
1182 | + ->setExportable(true) |
|
1183 | + ->setSearchable($customField->searchable) |
|
1184 | + ->setVisible($customField->visible) |
|
1185 | 1185 | ); |
1186 | 1186 | } |
1187 | - } |
|
1187 | + } |
|
1188 | 1188 | |
1189 | 1189 | |
1190 | 1190 | /** |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | bab_Widgets()->includePhpClass('widget_InputWidget'); |
27 | 27 | bab_Widgets()->includePhpClass('widget_TableModelView'); |
28 | 28 | |
29 | -require_once dirname(__FILE__) . '/ui.helpers.php'; |
|
29 | +require_once dirname(__FILE__).'/ui.helpers.php'; |
|
30 | 30 | |
31 | 31 | /** |
32 | 32 | * @return Widget_Form |
@@ -676,7 +676,7 @@ discard block |
||
676 | 676 | continue; |
677 | 677 | } |
678 | 678 | |
679 | - list(, , $nbCol) = explode('-', $customSection->sizePolicy); |
|
679 | + list(,, $nbCol) = explode('-', $customSection->sizePolicy); |
|
680 | 680 | |
681 | 681 | if ($currentColumn + $nbCol > 12) { |
682 | 682 | $this->addItem($row); |
@@ -704,7 +704,7 @@ discard block |
||
704 | 704 | $parameters = $displayField['parameters']; |
705 | 705 | $classname = isset($parameters['classname']) ? $parameters['classname'] : ''; |
706 | 706 | $label = isset($parameters['label']) && $parameters['label'] !== '__' ? $parameters['label'] : ''; |
707 | - $displayFieldMethod = '_' . $displayFieldName; |
|
707 | + $displayFieldMethod = '_'.$displayFieldName; |
|
708 | 708 | |
709 | 709 | if (method_exists($this, $displayFieldMethod)) { |
710 | 710 | $widget = $this->$displayFieldMethod($customSection, $label); |
@@ -762,7 +762,7 @@ discard block |
||
762 | 762 | $parameters = $displayField['parameters']; |
763 | 763 | $classname = isset($parameters['classname']) ? $parameters['classname'] : ''; |
764 | 764 | $label = isset($parameters['label']) && $parameters['label'] !== '__' ? $parameters['label'] : ''; |
765 | - $displayFieldMethod = '_' . $displayFieldName; |
|
765 | + $displayFieldMethod = '_'.$displayFieldName; |
|
766 | 766 | |
767 | 767 | if (method_exists($this, $displayFieldMethod)) { |
768 | 768 | $widget = $this->$displayFieldMethod($customSection, $label); |
@@ -1047,7 +1047,7 @@ discard block |
||
1047 | 1047 | $row = $W->Items()->setSizePolicy('row'); |
1048 | 1048 | foreach ($customSections as $customSection) { |
1049 | 1049 | |
1050 | - list(, , $nbCol) = explode('-', $customSection->sizePolicy); |
|
1050 | + list(,, $nbCol) = explode('-', $customSection->sizePolicy); |
|
1051 | 1051 | |
1052 | 1052 | if ($currentColumn + $nbCol > 12) { |
1053 | 1053 | $this->addItem($row); |
@@ -1074,7 +1074,7 @@ discard block |
||
1074 | 1074 | $parameters = $displayField['parameters']; |
1075 | 1075 | $classname = isset($parameters['classname']) ? $parameters['classname'] : ''; |
1076 | 1076 | $label = isset($parameters['label']) ? $parameters['label'] : ''; |
1077 | - $displayFieldMethod = '_' . $displayFieldName; |
|
1077 | + $displayFieldMethod = '_'.$displayFieldName; |
|
1078 | 1078 | |
1079 | 1079 | if (method_exists($this, $displayFieldMethod)) { |
1080 | 1080 | $value = $this->$displayFieldMethod($customSection, $label); |
@@ -1176,7 +1176,7 @@ discard block |
||
1176 | 1176 | // we try to select one according to the classname prefix. |
1177 | 1177 | list($prefix) = explode('_', get_class($this)); |
1178 | 1178 | $functionalityName = ucwords($prefix); |
1179 | - $this->app = @bab_functionality::get('App/' . $functionalityName); |
|
1179 | + $this->app = @bab_functionality::get('App/'.$functionalityName); |
|
1180 | 1180 | if (!$this->app) { |
1181 | 1181 | $this->app = @bab_functionality::get('App'); |
1182 | 1182 | } |
@@ -1237,7 +1237,7 @@ discard block |
||
1237 | 1237 | $this->setCurrentPage(isset($filter['pageNumber']) ? $filter['pageNumber'] : $pageNumber); |
1238 | 1238 | |
1239 | 1239 | if (isset($name)) { |
1240 | - $this->sortParameterName = $name . '[filter][sort]'; |
|
1240 | + $this->sortParameterName = $name.'[filter][sort]'; |
|
1241 | 1241 | } else { |
1242 | 1242 | $this->sortParameterName = 'filter[sort]'; |
1243 | 1243 | } |
@@ -1342,7 +1342,7 @@ discard block |
||
1342 | 1342 | |
1343 | 1343 | $values = $set->select(); |
1344 | 1344 | foreach ($values as $record) { |
1345 | - $widget->addOption($record->id, (string)$record->name); |
|
1345 | + $widget->addOption($record->id, (string) $record->name); |
|
1346 | 1346 | } |
1347 | 1347 | |
1348 | 1348 | return $widget; |
@@ -1434,11 +1434,11 @@ discard block |
||
1434 | 1434 | |
1435 | 1435 | foreach ($columns as $fieldName => $column) { |
1436 | 1436 | $field = $column->getField(); |
1437 | - if (! $column->isSearchable()) { |
|
1437 | + if (!$column->isSearchable()) { |
|
1438 | 1438 | continue; |
1439 | 1439 | } |
1440 | 1440 | |
1441 | - if (! ($field instanceof ORM_Field)) { |
|
1441 | + if (!($field instanceof ORM_Field)) { |
|
1442 | 1442 | $field = null; |
1443 | 1443 | } |
1444 | 1444 | |
@@ -1453,7 +1453,7 @@ discard block |
||
1453 | 1453 | $input->addClass('widget-100pc'); |
1454 | 1454 | |
1455 | 1455 | $formItem = $this->handleFilterLabel($label, $input); |
1456 | - $formItem->addClass('field_' . $fieldName); |
|
1456 | + $formItem->addClass('field_'.$fieldName); |
|
1457 | 1457 | |
1458 | 1458 | $mainSearch = (method_exists($column, 'isMainSearch') && $column->isMainSearch()); |
1459 | 1459 | |
@@ -1486,7 +1486,7 @@ discard block |
||
1486 | 1486 | } |
1487 | 1487 | |
1488 | 1488 | |
1489 | - if (! $this->submit) { |
|
1489 | + if (!$this->submit) { |
|
1490 | 1490 | $this->submit = $W->SubmitButton(); |
1491 | 1491 | $this->submit->setLabel(widget_translate('Apply filter')); |
1492 | 1492 | } |
@@ -1525,7 +1525,7 @@ discard block |
||
1525 | 1525 | |
1526 | 1526 | |
1527 | 1527 | foreach ($filterNames as $filterName) { |
1528 | - $filter = $W->getUserConfiguration($controller->getModelViewDefaultId() . '/filters/' . $filterName, 'widgets', false); |
|
1528 | + $filter = $W->getUserConfiguration($controller->getModelViewDefaultId().'/filters/'.$filterName, 'widgets', false); |
|
1529 | 1529 | |
1530 | 1530 | // $this->select->addItem( |
1531 | 1531 | // $W->Link( |
@@ -1639,7 +1639,7 @@ discard block |
||
1639 | 1639 | // $this->setCurrentPage(isset($filter['pageNumber']) ? $filter['pageNumber'] : $pageNumber); |
1640 | 1640 | |
1641 | 1641 | if (isset($name)) { |
1642 | - $this->sortParameterName = $name . '[filter][sort]'; |
|
1642 | + $this->sortParameterName = $name.'[filter][sort]'; |
|
1643 | 1643 | } else { |
1644 | 1644 | $this->sortParameterName = 'filter[sort]'; |
1645 | 1645 | } |
@@ -1737,7 +1737,7 @@ discard block |
||
1737 | 1737 | |
1738 | 1738 | $tableview->setCurrentPage(isset($filterValues['pageNumber']) ? $filterValues['pageNumber'] : 0); |
1739 | 1739 | |
1740 | - $tableview->sortParameterName = $name . '[filter][sort]'; |
|
1740 | + $tableview->sortParameterName = $name.'[filter][sort]'; |
|
1741 | 1741 | |
1742 | 1742 | if (isset($filterValues['sort'])) { |
1743 | 1743 | $tableview->setSortField($filterValues['sort']); |
@@ -2038,7 +2038,7 @@ discard block |
||
2038 | 2038 | continue; |
2039 | 2039 | } |
2040 | 2040 | |
2041 | - list(, , $nbCol) = explode('-', $customSection->sizePolicy); |
|
2041 | + list(,, $nbCol) = explode('-', $customSection->sizePolicy); |
|
2042 | 2042 | |
2043 | 2043 | if ($currentColumn + $nbCol > 12) { |
2044 | 2044 | $this->addItem($row); |
@@ -2089,7 +2089,7 @@ discard block |
||
2089 | 2089 | $label = isset($parameters['label']) ? $parameters['label'] : null; |
2090 | 2090 | $sizePolicy = isset($parameters['sizePolicy']) ? $parameters['sizePolicy'] : ''; |
2091 | 2091 | |
2092 | - $displayFieldMethod = '_' . $displayFieldName; |
|
2092 | + $displayFieldMethod = '_'.$displayFieldName; |
|
2093 | 2093 | if (method_exists($this, $displayFieldMethod)) { |
2094 | 2094 | $item = $this->$displayFieldMethod($customSection, $label); |
2095 | 2095 | } else { |
@@ -2120,7 +2120,7 @@ discard block |
||
2120 | 2120 | } |
2121 | 2121 | } |
2122 | 2122 | |
2123 | - if ($currentColumn + $nbCol> 0) { |
|
2123 | + if ($currentColumn + $nbCol > 0) { |
|
2124 | 2124 | $this->addItem($row); |
2125 | 2125 | } |
2126 | 2126 | } |
@@ -2241,7 +2241,7 @@ discard block |
||
2241 | 2241 | |
2242 | 2242 | $displayable = $field->output($value); |
2243 | 2243 | |
2244 | - switch(true) { |
|
2244 | + switch (true) { |
|
2245 | 2245 | case ($field instanceof ORM_TextField): |
2246 | 2246 | $displayable = $W->RichText($displayable)->setRenderingOptions(BAB_HTML_ALL ^ BAB_HTML_P); |
2247 | 2247 | break; |
@@ -94,7 +94,7 @@ |
||
94 | 94 | public function hasNoAccess(app_RecordSet $recordSet, $accessType, $user = null) |
95 | 95 | { |
96 | 96 | $criterion = $this->getAccessCriterion($recordSet, $accessType, $user); |
97 | - if (! $criterion instanceof ORM_FalseCriterion) { |
|
97 | + if (!$criterion instanceof ORM_FalseCriterion) { |
|
98 | 98 | return false; |
99 | 99 | } |
100 | 100 | return true; |
@@ -24,7 +24,7 @@ |
||
24 | 24 | |
25 | 25 | |
26 | 26 | |
27 | -require_once dirname(__FILE__). '/functions.php'; |
|
27 | +require_once dirname(__FILE__).'/functions.php'; |
|
28 | 28 | |
29 | 29 | |
30 | 30 | function LibApp_upgrade($sVersionBase, $sVersionIni) |