@@ -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 | } |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | public function addReloadSelector($reloadSelector, $withSSE = false, $for = null) |
| 72 | 72 | { |
| 73 | 73 | $this->reloadSelectors[$reloadSelector] = $reloadSelector; |
| 74 | - if($withSSE){ |
|
| 74 | + if ($withSSE) { |
|
| 75 | 75 | $sseRecordSet = $this->getSSERecordSet(); |
| 76 | 76 | $sseRecordSet->newReloadSelector($reloadSelector, $for); |
| 77 | 77 | } |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | |
| 89 | 89 | public function getSSERecordSet() |
| 90 | 90 | { |
| 91 | - if(isset($this->SSERecordSet)){ |
|
| 91 | + if (isset($this->SSERecordSet)) { |
|
| 92 | 92 | return $this->SSERecordSet; |
| 93 | 93 | } |
| 94 | 94 | |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | public function __call($name, $arguments = array()) |
| 130 | 130 | { |
| 131 | 131 | $component = $this->App()->getComponentByName($name); |
| 132 | - if($component){ |
|
| 132 | + if ($component) { |
|
| 133 | 133 | return call_user_func_array(array($component, 'controller'), $arguments); |
| 134 | 134 | } |
| 135 | 135 | throw new \app_Exception(sprintf($this->App()->translate('Unknown action %s'), $name)); |
@@ -219,11 +219,11 @@ discard block |
||
| 219 | 219 | // we try to select one according to the classname prefix. |
| 220 | 220 | list($prefix) = explode('_', __CLASS__); |
| 221 | 221 | $functionalityName = ucwords($prefix); |
| 222 | - $App = @bab_functionality::get('App/' . $functionalityName); |
|
| 222 | + $App = @bab_functionality::get('App/'.$functionalityName); |
|
| 223 | 223 | |
| 224 | 224 | if (!$App) |
| 225 | 225 | { |
| 226 | - throw new app_Exception('Faild to autodetect functionality App/' . $functionalityName.', the getInstance method is deprecated, use $App->ControllerProxy() instead'); |
|
| 226 | + throw new app_Exception('Faild to autodetect functionality App/'.$functionalityName.', the getInstance method is deprecated, use $App->ControllerProxy() instead'); |
|
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | $controller = $App->ControllerProxy($classname, $proxy); |
@@ -242,9 +242,9 @@ discard block |
||
| 242 | 242 | static function getProxyInstance(Func_App $App, $classname) |
| 243 | 243 | { |
| 244 | 244 | $class = new ReflectionClass($classname); |
| 245 | - $proxyClassname = $class->getShortName() . self::PROXY_CLASS_SUFFIX; |
|
| 245 | + $proxyClassname = $class->getShortName().self::PROXY_CLASS_SUFFIX; |
|
| 246 | 246 | if (!class_exists($proxyClassname)) { |
| 247 | - $classStr = 'class ' . $proxyClassname . ' extends ' . $class->name . ' {' . "\n"; |
|
| 247 | + $classStr = 'class '.$proxyClassname.' extends '.$class->name.' {'."\n"; |
|
| 248 | 248 | $methods = $class->getMethods(); |
| 249 | 249 | |
| 250 | 250 | $classStr .= ' public function __construct(Func_App $App) { |
@@ -257,24 +257,24 @@ discard block |
||
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | |
| 260 | - $classStr .= ' public function ' . $method->name . '('; |
|
| 260 | + $classStr .= ' public function '.$method->name.'('; |
|
| 261 | 261 | $parameters = $method->getParameters(); |
| 262 | 262 | $parametersStr = array(); |
| 263 | 263 | foreach ($parameters as $parameter) { |
| 264 | 264 | |
| 265 | 265 | if ($parameter->isDefaultValueAvailable()) { |
| 266 | - $parametersStr[] = '$' . $parameter->name . ' = ' . var_export($parameter->getDefaultValue(), true); |
|
| 266 | + $parametersStr[] = '$'.$parameter->name.' = '.var_export($parameter->getDefaultValue(), true); |
|
| 267 | 267 | } else { |
| 268 | - $parametersStr[] = '$' . $parameter->name; |
|
| 268 | + $parametersStr[] = '$'.$parameter->name; |
|
| 269 | 269 | } |
| 270 | 270 | } |
| 271 | 271 | $classStr .= implode(', ', $parametersStr); |
| 272 | - $classStr .= ') {' . "\n"; |
|
| 273 | - $classStr .= ' $args = func_get_args();' . "\n"; |
|
| 274 | - $classStr .= ' return $this->getMethodAction(__FUNCTION__, $args);' . "\n"; |
|
| 275 | - $classStr .= ' }' . "\n"; |
|
| 272 | + $classStr .= ') {'."\n"; |
|
| 273 | + $classStr .= ' $args = func_get_args();'."\n"; |
|
| 274 | + $classStr .= ' return $this->getMethodAction(__FUNCTION__, $args);'."\n"; |
|
| 275 | + $classStr .= ' }'."\n"; |
|
| 276 | 276 | } |
| 277 | - $classStr .= '}' . "\n"; |
|
| 277 | + $classStr .= '}'."\n"; |
|
| 278 | 278 | |
| 279 | 279 | // We define the proxy class |
| 280 | 280 | eval($classStr); |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | protected function getObjectName($classname) |
| 316 | 316 | { |
| 317 | 317 | list($objectname) = explode('Controller', $classname); |
| 318 | - if($this->App()->getComponentByName($objectname)){ |
|
| 318 | + if ($this->App()->getComponentByName($objectname)) { |
|
| 319 | 319 | return strtolower($objectname); |
| 320 | 320 | } |
| 321 | 321 | list(, $objectname) = explode('_Ctrl', $classname); |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | |
| 338 | 338 | $reflector = new ReflectionClass(get_class($this)); |
| 339 | 339 | $parent = $reflector->getParentClass(); |
| 340 | - if($parent){ |
|
| 340 | + if ($parent) { |
|
| 341 | 341 | $parentMethod = $parent->getMethod('__construct'); |
| 342 | 342 | $docComment = $parentMethod->getDocComment(); |
| 343 | 343 | if (strpos($docComment, '@isComponentController') !== false) { |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | $rc = new ReflectionClass($fullClassName); |
| 349 | 349 | |
| 350 | 350 | if (!$rc->hasMethod($methodName)) { |
| 351 | - throw new bab_InvalidActionException($fullClassName . '::' . $methodName); |
|
| 351 | + throw new bab_InvalidActionException($fullClassName.'::'.$methodName); |
|
| 352 | 352 | } |
| 353 | 353 | $method = new ReflectionMethod($fullClassName, $methodName); |
| 354 | 354 | |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | |
| 372 | 372 | $action = new Widget_Action(); |
| 373 | 373 | |
| 374 | - $action->setMethod($this->getControllerTg(), $objectName . '.' . $methodName, $actionParams); |
|
| 374 | + $action->setMethod($this->getControllerTg(), $objectName.'.'.$methodName, $actionParams); |
|
| 375 | 375 | |
| 376 | 376 | $docComment = $method->getDocComment(); |
| 377 | 377 | if (strpos($docComment, '@ajax') !== false) { |
@@ -412,7 +412,7 @@ discard block |
||
| 412 | 412 | $action->setParameters($actionParams); |
| 413 | 413 | |
| 414 | 414 | |
| 415 | - list(,,$file) = explode('/', $App->controllerTg); |
|
| 415 | + list(,, $file) = explode('/', $App->controllerTg); |
|
| 416 | 416 | |
| 417 | 417 | $action->setParameter('addon', $App->getAddonName().'.'.$file); |
| 418 | 418 | $action->setParameter('idx', $idx); |
@@ -438,24 +438,24 @@ discard block |
||
| 438 | 438 | return false; |
| 439 | 439 | } |
| 440 | 440 | |
| 441 | - list($objectName, ) = explode('.', $method); |
|
| 441 | + list($objectName,) = explode('.', $method); |
|
| 442 | 442 | |
| 443 | 443 | if (!method_exists($this, $objectName)) { |
| 444 | 444 | /* @var $component app_Component */ |
| 445 | 445 | $component = $this->app->getComponentByName($objectName); |
| 446 | - if($component){ |
|
| 446 | + if ($component) { |
|
| 447 | 447 | $this->app->setCurrentComponent($component); |
| 448 | 448 | $objectController = $component->controller(false); |
| 449 | 449 | } |
| 450 | - else{ |
|
| 450 | + else { |
|
| 451 | 451 | header('HTTP/1.0 400 Bad Request'); |
| 452 | 452 | throw new app_UnknownActionException($action); |
| 453 | 453 | } |
| 454 | 454 | } |
| 455 | 455 | |
| 456 | - if(!isset($component)){ |
|
| 456 | + if (!isset($component)) { |
|
| 457 | 457 | $objectController = $this->{$objectName}(false); |
| 458 | - if ( ! ($objectController instanceof app_Controller)) { |
|
| 458 | + if (!($objectController instanceof app_Controller)) { |
|
| 459 | 459 | return false; |
| 460 | 460 | } |
| 461 | 461 | } |
@@ -469,7 +469,7 @@ discard block |
||
| 469 | 469 | } else { |
| 470 | 470 | if ($this->isAjaxRequest()) { |
| 471 | 471 | |
| 472 | - header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden', true, 403); |
|
| 472 | + header($_SERVER['SERVER_PROTOCOL'].' 403 Forbidden', true, 403); |
|
| 473 | 473 | |
| 474 | 474 | die( |
| 475 | 475 | bab_json_encode( |
@@ -487,7 +487,7 @@ discard block |
||
| 487 | 487 | } catch (app_SaveException $e) { |
| 488 | 488 | |
| 489 | 489 | if ($this->isAjaxRequest()) { |
| 490 | - header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden', true, 403); |
|
| 490 | + header($_SERVER['SERVER_PROTOCOL'].' 403 Forbidden', true, 403); |
|
| 491 | 491 | header('Cache-Control: no-cache, must-revalidate'); |
| 492 | 492 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); |
| 493 | 493 | header('Content-type: application/json'); |
@@ -544,7 +544,7 @@ discard block |
||
| 544 | 544 | if (method_exists($htmlCanvas, 'sendPageTitle')) { |
| 545 | 545 | $htmlCanvas->sendPageTitle($pageTitle); |
| 546 | 546 | } else { |
| 547 | - header('X-Cto-PageTitle: ' . $pageTitle); |
|
| 547 | + header('X-Cto-PageTitle: '.$pageTitle); |
|
| 548 | 548 | } |
| 549 | 549 | } |
| 550 | 550 | $html = $returnedValue->display($htmlCanvas); |
@@ -608,7 +608,7 @@ discard block |
||
| 608 | 608 | private function deletedItemPage(Widget_Action $action, app_DeletedRecordException $e) |
| 609 | 609 | { |
| 610 | 610 | if ($this->isAjaxRequest()) { |
| 611 | - header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden', true, 403); |
|
| 611 | + header($_SERVER['SERVER_PROTOCOL'].' 403 Forbidden', true, 403); |
|
| 612 | 612 | header('Cache-Control: no-cache, must-revalidate'); |
| 613 | 613 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); |
| 614 | 614 | header('Content-type: application/json'); |
@@ -625,7 +625,7 @@ discard block |
||
| 625 | 625 | ); |
| 626 | 626 | |
| 627 | 627 | } |
| 628 | - header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found', true, 404); |
|
| 628 | + header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found', true, 404); |
|
| 629 | 629 | |
| 630 | 630 | $App = app_App(); |
| 631 | 631 | $W = bab_Widgets(); |
@@ -665,7 +665,7 @@ discard block |
||
| 665 | 665 | private function notFoundPage(Widget_Action $action, app_NotFoundException $e) |
| 666 | 666 | { |
| 667 | 667 | if ($this->isAjaxRequest()) { |
| 668 | - $message = sprintf(app_translate('This %s does not exists'), $e->getObjectTitle() . ' (' . $e->getId() . ')'); |
|
| 668 | + $message = sprintf(app_translate('This %s does not exists'), $e->getObjectTitle().' ('.$e->getId().')'); |
|
| 669 | 669 | $json = array( |
| 670 | 670 | 'messages' => array( |
| 671 | 671 | array( |
@@ -677,7 +677,7 @@ discard block |
||
| 677 | 677 | echo bab_json_encode($json); |
| 678 | 678 | die; |
| 679 | 679 | } |
| 680 | - header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found', true, 404); |
|
| 680 | + header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found', true, 404); |
|
| 681 | 681 | header('Cache-Control: no-cache, must-revalidate'); |
| 682 | 682 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); |
| 683 | 683 | |
@@ -723,7 +723,7 @@ discard block |
||
| 723 | 723 | echo bab_json_encode($json); |
| 724 | 724 | die; |
| 725 | 725 | } |
| 726 | - header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal server error', true, 500); |
|
| 726 | + header($_SERVER['SERVER_PROTOCOL'].' 500 Internal server error', true, 500); |
|
| 727 | 727 | header('Cache-Control: no-cache, must-revalidate'); |
| 728 | 728 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); |
| 729 | 729 | |
@@ -761,7 +761,7 @@ discard block |
||
| 761 | 761 | $W->Label(sprintf($App->translate('It has been logged with the following error code : %s'), $logCode)) |
| 762 | 762 | ); |
| 763 | 763 | |
| 764 | - if(bab_isUserAdministrator()){ |
|
| 764 | + if (bab_isUserAdministrator()) { |
|
| 765 | 765 | $contentBox->addItem( |
| 766 | 766 | $W->Section( |
| 767 | 767 | 'Stack trace', |
@@ -771,13 +771,13 @@ discard block |
||
| 771 | 771 | )->setFoldable(true, true) |
| 772 | 772 | ); |
| 773 | 773 | $traces = explode("\n", $e->getTraceAsString()); |
| 774 | - foreach ($traces as $trace){ |
|
| 774 | + foreach ($traces as $trace) { |
|
| 775 | 775 | $stackTraceBox->addItem( |
| 776 | 776 | $W->Label($trace) |
| 777 | 777 | ); |
| 778 | 778 | } |
| 779 | 779 | } |
| 780 | - else{ |
|
| 780 | + else { |
|
| 781 | 781 | $section->addItem( |
| 782 | 782 | $W->Label($App->translate('Please contact the administrator')) |
| 783 | 783 | ); |
@@ -801,7 +801,7 @@ discard block |
||
| 801 | 801 | echo bab_json_encode($json); |
| 802 | 802 | die; |
| 803 | 803 | } |
| 804 | - header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal server error', true, 500); |
|
| 804 | + header($_SERVER['SERVER_PROTOCOL'].' 500 Internal server error', true, 500); |
|
| 805 | 805 | header('Cache-Control: no-cache, must-revalidate'); |
| 806 | 806 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); |
| 807 | 807 | |
@@ -839,7 +839,7 @@ discard block |
||
| 839 | 839 | $W->Label(sprintf($App->translate('It has been logged with the following error code : %s'), $logCode)) |
| 840 | 840 | ); |
| 841 | 841 | |
| 842 | - if(bab_isUserAdministrator()){ |
|
| 842 | + if (bab_isUserAdministrator()) { |
|
| 843 | 843 | $contentBox->addItem( |
| 844 | 844 | $W->Section( |
| 845 | 845 | 'Stack trace', |
@@ -849,13 +849,13 @@ discard block |
||
| 849 | 849 | )->setFoldable(true, true) |
| 850 | 850 | ); |
| 851 | 851 | $traces = explode("\n", $e->getTraceAsString()); |
| 852 | - foreach ($traces as $trace){ |
|
| 852 | + foreach ($traces as $trace) { |
|
| 853 | 853 | $stackTraceBox->addItem( |
| 854 | 854 | $W->Label($trace) |
| 855 | 855 | ); |
| 856 | 856 | } |
| 857 | 857 | } |
| 858 | - else{ |
|
| 858 | + else { |
|
| 859 | 859 | $section->addItem( |
| 860 | 860 | $W->Label($App->translate('Please contact the administrator')) |
| 861 | 861 | ); |
@@ -879,7 +879,7 @@ discard block |
||
| 879 | 879 | echo bab_json_encode($json); |
| 880 | 880 | die; |
| 881 | 881 | } |
| 882 | - header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden', true, 403); |
|
| 882 | + header($_SERVER['SERVER_PROTOCOL'].' 403 Forbidden', true, 403); |
|
| 883 | 883 | header('Cache-Control: no-cache, must-revalidate'); |
| 884 | 884 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); |
| 885 | 885 | |
@@ -961,7 +961,7 @@ discard block |
||
| 961 | 961 | 'position' => $position |
| 962 | 962 | ); |
| 963 | 963 | $babBody = bab_getBody(); |
| 964 | - if(!isset($babBody->messages['toasts'])){ |
|
| 964 | + if (!isset($babBody->messages['toasts'])) { |
|
| 965 | 965 | $babBody->messages['toasts'] = array(); |
| 966 | 966 | } |
| 967 | 967 | $babBody->messages['toasts'][] = $toast; |
@@ -980,7 +980,7 @@ discard block |
||
| 980 | 980 | */ |
| 981 | 981 | public function CustomField($proxy = true) |
| 982 | 982 | { |
| 983 | - require_once APP_CTRL_PATH . 'customfield.ctrl.php'; |
|
| 983 | + require_once APP_CTRL_PATH.'customfield.ctrl.php'; |
|
| 984 | 984 | return $this->App()->ControllerProxy('app_CtrlCustomField', $proxy); |
| 985 | 985 | } |
| 986 | 986 | |
@@ -991,7 +991,7 @@ discard block |
||
| 991 | 991 | */ |
| 992 | 992 | public function CustomSection($proxy = true) |
| 993 | 993 | { |
| 994 | - require_once APP_CTRL_PATH . 'customsection.ctrl.php'; |
|
| 994 | + require_once APP_CTRL_PATH.'customsection.ctrl.php'; |
|
| 995 | 995 | return $this->App()->ControllerProxy('app_CtrlCustomSection', $proxy); |
| 996 | 996 | } |
| 997 | 997 | |
@@ -1002,7 +1002,7 @@ discard block |
||
| 1002 | 1002 | */ |
| 1003 | 1003 | public function CustomContainer($proxy = true) |
| 1004 | 1004 | { |
| 1005 | - require_once APP_CTRL_PATH . 'customcontainer.ctrl.php'; |
|
| 1005 | + require_once APP_CTRL_PATH.'customcontainer.ctrl.php'; |
|
| 1006 | 1006 | return $this->App()->ControllerProxy('app_CtrlCustomContainer', $proxy); |
| 1007 | 1007 | } |
| 1008 | 1008 | |
@@ -1012,7 +1012,7 @@ discard block |
||
| 1012 | 1012 | */ |
| 1013 | 1013 | public function Notification($proxy = true) |
| 1014 | 1014 | { |
| 1015 | - require_once APP_CTRL_PATH . 'notification.ctrl.php'; |
|
| 1015 | + require_once APP_CTRL_PATH.'notification.ctrl.php'; |
|
| 1016 | 1016 | return $this->App()->ControllerProxy('app_CtrlNotification', $proxy); |
| 1017 | 1017 | } |
| 1018 | 1018 | |
@@ -1022,7 +1022,7 @@ discard block |
||
| 1022 | 1022 | */ |
| 1023 | 1023 | public function SSE($proxy = true) |
| 1024 | 1024 | { |
| 1025 | - require_once APP_CTRL_PATH . 'sse.ctrl.php'; |
|
| 1025 | + require_once APP_CTRL_PATH.'sse.ctrl.php'; |
|
| 1026 | 1026 | return $this->App()->ControllerProxy('app_CtrlSSE', $proxy); |
| 1027 | 1027 | } |
| 1028 | 1028 | |
@@ -1032,7 +1032,7 @@ discard block |
||
| 1032 | 1032 | */ |
| 1033 | 1033 | public function AddonConfiguration($proxy = true) |
| 1034 | 1034 | { |
| 1035 | - require_once APP_CTRL_PATH . 'addonconfiguration.ctrl.php'; |
|
| 1035 | + require_once APP_CTRL_PATH.'addonconfiguration.ctrl.php'; |
|
| 1036 | 1036 | return $this->App()->ControllerProxy('app_CtrlAddonConfiguration', $proxy); |
| 1037 | 1037 | } |
| 1038 | 1038 | |
@@ -1042,7 +1042,7 @@ discard block |
||
| 1042 | 1042 | */ |
| 1043 | 1043 | public function Configuration($proxy = true) |
| 1044 | 1044 | { |
| 1045 | - require_once APP_CTRL_PATH . 'configuration.ctrl.php'; |
|
| 1045 | + require_once APP_CTRL_PATH.'configuration.ctrl.php'; |
|
| 1046 | 1046 | return $this->App()->ControllerProxy('app_CtrlConfiguration', $proxy); |
| 1047 | 1047 | } |
| 1048 | 1048 | } |
@@ -446,8 +446,7 @@ discard block |
||
| 446 | 446 | if($component){ |
| 447 | 447 | $this->app->setCurrentComponent($component); |
| 448 | 448 | $objectController = $component->controller(false); |
| 449 | - } |
|
| 450 | - else{ |
|
| 449 | + } else{ |
|
| 451 | 450 | header('HTTP/1.0 400 Bad Request'); |
| 452 | 451 | throw new app_UnknownActionException($action); |
| 453 | 452 | } |
@@ -776,8 +775,7 @@ discard block |
||
| 776 | 775 | $W->Label($trace) |
| 777 | 776 | ); |
| 778 | 777 | } |
| 779 | - } |
|
| 780 | - else{ |
|
| 778 | + } else{ |
|
| 781 | 779 | $section->addItem( |
| 782 | 780 | $W->Label($App->translate('Please contact the administrator')) |
| 783 | 781 | ); |
@@ -854,8 +852,7 @@ discard block |
||
| 854 | 852 | $W->Label($trace) |
| 855 | 853 | ); |
| 856 | 854 | } |
| 857 | - } |
|
| 858 | - else{ |
|
| 855 | + } else{ |
|
| 859 | 856 | $section->addItem( |
| 860 | 857 | $W->Label($App->translate('Please contact the administrator')) |
| 861 | 858 | ); |
@@ -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 | |
@@ -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; |
@@ -540,10 +540,10 @@ |
||
| 540 | 540 | /** |
| 541 | 541 | * Match records created by the specified user or the current connected user if none specified. |
| 542 | 542 | * |
| 543 | - * @param int|null $userId |
|
| 544 | - * |
|
| 545 | - * @return ORM_IsCriterion |
|
| 546 | - */ |
|
| 543 | + * @param int|null $userId |
|
| 544 | + * |
|
| 545 | + * @return ORM_IsCriterion |
|
| 546 | + */ |
|
| 547 | 547 | public function isOwn($userId = null) |
| 548 | 548 | { |
| 549 | 549 | if (!isset($userId)) { |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | return parent::delete($criteria); |
| 244 | 244 | } |
| 245 | 245 | |
| 246 | - require_once $GLOBALS['babInstallPath'] . '/utilit/dateTime.php'; |
|
| 246 | + require_once $GLOBALS['babInstallPath'].'/utilit/dateTime.php'; |
|
| 247 | 247 | $now = BAB_DateTime::now()->getIsoDateTime(); |
| 248 | 248 | |
| 249 | 249 | $records = $this->select($criteria); |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | return parent::save($record); |
| 280 | 280 | } |
| 281 | 281 | |
| 282 | - require_once $GLOBALS['babInstallPath'] . '/utilit/dateTime.php'; |
|
| 282 | + require_once $GLOBALS['babInstallPath'].'/utilit/dateTime.php'; |
|
| 283 | 283 | |
| 284 | 284 | $now = BAB_DateTime::now()->getIsoDateTime(); |
| 285 | 285 | |
@@ -309,11 +309,11 @@ discard block |
||
| 309 | 309 | */ |
| 310 | 310 | private function uuid() |
| 311 | 311 | { |
| 312 | - return sprintf( '%04x%04x-%04x-%04x-%04x-%04x%04x%04x', |
|
| 313 | - mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), |
|
| 314 | - mt_rand( 0, 0x0fff ) | 0x4000, |
|
| 315 | - mt_rand( 0, 0x3fff ) | 0x8000, |
|
| 316 | - mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ) ); |
|
| 312 | + return sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x', |
|
| 313 | + mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff), |
|
| 314 | + mt_rand(0, 0x0fff) | 0x4000, |
|
| 315 | + mt_rand(0, 0x3fff) | 0x8000, |
|
| 316 | + mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff)); |
|
| 317 | 317 | } |
| 318 | 318 | |
| 319 | 319 | /** |
@@ -384,10 +384,10 @@ discard block |
||
| 384 | 384 | */ |
| 385 | 385 | class app_TraceableRecord extends app_Record |
| 386 | 386 | { |
| 387 | - const DELETED_STATUS_EXISTING = 0; // Normal status of a record |
|
| 388 | - const DELETED_STATUS_DELETED = 1; // Record is deleted by retrievable by admin |
|
| 389 | - const DELETED_STATUS_IN_TRASH = 2; // Record is deleted by retrievable by authorized users |
|
| 390 | - const DELETED_STATUS_DRAFT = 3; // Status is in draft (not yet created) |
|
| 387 | + const DELETED_STATUS_EXISTING = 0; // Normal status of a record |
|
| 388 | + const DELETED_STATUS_DELETED = 1; // Record is deleted by retrievable by admin |
|
| 389 | + const DELETED_STATUS_IN_TRASH = 2; // Record is deleted by retrievable by authorized users |
|
| 390 | + const DELETED_STATUS_DRAFT = 3; // Status is in draft (not yet created) |
|
| 391 | 391 | |
| 392 | 392 | public static function getDeletedStatuses() |
| 393 | 393 | { |
@@ -30,19 +30,19 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | class app_CustomFieldTableView extends app_TableModelView |
| 32 | 32 | { |
| 33 | - /** |
|
| 34 | - * @param ORM_Record $record |
|
| 35 | - * @param string $fieldPath |
|
| 36 | - * @return Widget_Item |
|
| 37 | - */ |
|
| 38 | - protected function computeCellContent(ORM_Record $record, $fieldPath) |
|
| 39 | - { |
|
| 40 | - $W = bab_Widgets(); |
|
| 41 | - $App = $record->App(); |
|
| 33 | + /** |
|
| 34 | + * @param ORM_Record $record |
|
| 35 | + * @param string $fieldPath |
|
| 36 | + * @return Widget_Item |
|
| 37 | + */ |
|
| 38 | + protected function computeCellContent(ORM_Record $record, $fieldPath) |
|
| 39 | + { |
|
| 40 | + $W = bab_Widgets(); |
|
| 41 | + $App = $record->App(); |
|
| 42 | 42 | |
| 43 | - $editAction = $App->Controller()->CustomField()->edit($record->id); |
|
| 43 | + $editAction = $App->Controller()->CustomField()->edit($record->id); |
|
| 44 | 44 | |
| 45 | - switch ($fieldPath) { |
|
| 45 | + switch ($fieldPath) { |
|
| 46 | 46 | |
| 47 | 47 | case '_actions_': |
| 48 | 48 | $box = $W->FlowItems(); |
@@ -62,19 +62,19 @@ discard block |
||
| 62 | 62 | } |
| 63 | 63 | return $box; |
| 64 | 64 | |
| 65 | - case 'mandatory': |
|
| 66 | - case 'visible_in_shop': |
|
| 67 | - if (self::getRecordFieldValue($record, $fieldPath)) |
|
| 68 | - { |
|
| 69 | - return $W->Label($App->translate('Yes')); |
|
| 70 | - } else { |
|
| 71 | - return $W->Label($App->translate('No')); |
|
| 72 | - } |
|
| 73 | - break; |
|
| 74 | - } |
|
| 65 | + case 'mandatory': |
|
| 66 | + case 'visible_in_shop': |
|
| 67 | + if (self::getRecordFieldValue($record, $fieldPath)) |
|
| 68 | + { |
|
| 69 | + return $W->Label($App->translate('Yes')); |
|
| 70 | + } else { |
|
| 71 | + return $W->Label($App->translate('No')); |
|
| 72 | + } |
|
| 73 | + break; |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | - return parent::computeCellContent($record, $fieldPath); |
|
| 77 | - } |
|
| 76 | + return parent::computeCellContent($record, $fieldPath); |
|
| 77 | + } |
|
| 78 | 78 | |
| 79 | 79 | |
| 80 | 80 | |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | ->addClass('widget-close-dialog') |
| 215 | 215 | ->setLabel($App->translate('Cancel')) |
| 216 | 216 | ); |
| 217 | - } |
|
| 217 | + } |
|
| 218 | 218 | |
| 219 | 219 | |
| 220 | 220 | protected function section() |
@@ -371,27 +371,27 @@ discard block |
||
| 371 | 371 | |
| 372 | 372 | |
| 373 | 373 | |
| 374 | - public function mandatory() |
|
| 375 | - { |
|
| 376 | - $App = $this->App(); |
|
| 377 | - $W = $this->widgets; |
|
| 374 | + public function mandatory() |
|
| 375 | + { |
|
| 376 | + $App = $this->App(); |
|
| 377 | + $W = $this->widgets; |
|
| 378 | 378 | |
| 379 | - return $this->labelledField( |
|
| 380 | - $App->translate('Mandatory field'), |
|
| 381 | - $W->Checkbox(), |
|
| 382 | - __FUNCTION__ |
|
| 383 | - ); |
|
| 384 | - } |
|
| 379 | + return $this->labelledField( |
|
| 380 | + $App->translate('Mandatory field'), |
|
| 381 | + $W->Checkbox(), |
|
| 382 | + __FUNCTION__ |
|
| 383 | + ); |
|
| 384 | + } |
|
| 385 | 385 | |
| 386 | - public function visible_in_shop() |
|
| 387 | - { |
|
| 388 | - $App = $this->App(); |
|
| 389 | - $W = $this->widgets; |
|
| 386 | + public function visible_in_shop() |
|
| 387 | + { |
|
| 388 | + $App = $this->App(); |
|
| 389 | + $W = $this->widgets; |
|
| 390 | 390 | |
| 391 | - return $this->labelledField( |
|
| 392 | - $App->translate('Visible in online shop'), |
|
| 393 | - $W->Checkbox(), |
|
| 394 | - __FUNCTION__ |
|
| 395 | - ); |
|
| 396 | - } |
|
| 391 | + return $this->labelledField( |
|
| 392 | + $App->translate('Visible in online shop'), |
|
| 393 | + $W->Checkbox(), |
|
| 394 | + __FUNCTION__ |
|
| 395 | + ); |
|
| 396 | + } |
|
| 397 | 397 | } |
@@ -86,122 +86,122 @@ |
||
| 86 | 86 | |
| 87 | 87 | |
| 88 | 88 | |
| 89 | - /** |
|
| 90 | - * @return Widget_Page |
|
| 91 | - */ |
|
| 92 | - public function edit($customfield = null) |
|
| 93 | - {
|
|
| 94 | - $W = bab_Widgets(); |
|
| 95 | - $App = $this->App(); |
|
| 96 | - $Ui = $App->Ui(); |
|
| 97 | - $page = $Ui->Page(); |
|
| 89 | + /** |
|
| 90 | + * @return Widget_Page |
|
| 91 | + */ |
|
| 92 | + public function edit($customfield = null) |
|
| 93 | + {
|
|
| 94 | + $W = bab_Widgets(); |
|
| 95 | + $App = $this->App(); |
|
| 96 | + $Ui = $App->Ui(); |
|
| 97 | + $page = $Ui->Page(); |
|
| 98 | 98 | |
| 99 | - $page->addClass('app-page-editor');
|
|
| 100 | - $page->setTitle($App->translate('Edit custom field'));
|
|
| 99 | + $page->addClass('app-page-editor');
|
|
| 100 | + $page->setTitle($App->translate('Edit custom field'));
|
|
| 101 | 101 | |
| 102 | - if (null !== $customfield) {
|
|
| 103 | - $set = $App->CustomFieldSet(); |
|
| 104 | - $customfield = $set->request($customfield); |
|
| 105 | - } |
|
| 102 | + if (null !== $customfield) {
|
|
| 103 | + $set = $App->CustomFieldSet(); |
|
| 104 | + $customfield = $set->request($customfield); |
|
| 105 | + } |
|
| 106 | 106 | |
| 107 | - $form = $Ui->CustomFieldEditor($customfield); |
|
| 107 | + $form = $Ui->CustomFieldEditor($customfield); |
|
| 108 | 108 | |
| 109 | - $page->addItem($form); |
|
| 109 | + $page->addItem($form); |
|
| 110 | 110 | |
| 111 | - if ($customfield instanceof app_CustomField) {
|
|
| 112 | - $actionsFrame = $page->ActionsFrame(); |
|
| 113 | - $page->addContextItem($actionsFrame); |
|
| 111 | + if ($customfield instanceof app_CustomField) {
|
|
| 112 | + $actionsFrame = $page->ActionsFrame(); |
|
| 113 | + $page->addContextItem($actionsFrame); |
|
| 114 | 114 | |
| 115 | - $actionsFrame->addItem($W->Link($W->Icon($App->translate('Delete'), Func_Icons::ACTIONS_EDIT_DELETE), $this->proxy()->delete($customfield->id)));
|
|
| 116 | - } |
|
| 115 | + $actionsFrame->addItem($W->Link($W->Icon($App->translate('Delete'), Func_Icons::ACTIONS_EDIT_DELETE), $this->proxy()->delete($customfield->id)));
|
|
| 116 | + } |
|
| 117 | 117 | |
| 118 | - return $page; |
|
| 119 | - } |
|
| 118 | + return $page; |
|
| 119 | + } |
|
| 120 | 120 | |
| 121 | 121 | |
| 122 | - /** |
|
| 123 | - * @return bool |
|
| 124 | - */ |
|
| 125 | - public function save($customfield = null) |
|
| 126 | - {
|
|
| 127 | - $App = $this->App(); |
|
| 122 | + /** |
|
| 123 | + * @return bool |
|
| 124 | + */ |
|
| 125 | + public function save($customfield = null) |
|
| 126 | + {
|
|
| 127 | + $App = $this->App(); |
|
| 128 | 128 | |
| 129 | - $set = $App->CustomFieldSet(); |
|
| 129 | + $set = $App->CustomFieldSet(); |
|
| 130 | 130 | |
| 131 | - if (empty($customfield['id'])) {
|
|
| 132 | - $record = $set->newRecord(); |
|
| 133 | - } else {
|
|
| 134 | - $record = $set->get($customfield['id']); |
|
| 135 | - } |
|
| 131 | + if (empty($customfield['id'])) {
|
|
| 132 | + $record = $set->newRecord(); |
|
| 133 | + } else {
|
|
| 134 | + $record = $set->get($customfield['id']); |
|
| 135 | + } |
|
| 136 | 136 | |
| 137 | - if ('Enum' === $customfield['fieldtype'] || 'Set' === $customfield['fieldtype']) {
|
|
| 138 | - $enumvalues = array(); |
|
| 139 | - foreach ($customfield['enumvalues'] as $enumkey => $enumvalue) {
|
|
| 140 | - $enumvalues[$enumkey] = $set->enumvalues->input($enumvalue); |
|
| 141 | - } |
|
| 142 | - $record->enumvalues = serialize($enumvalues); |
|
| 143 | - } else {
|
|
| 144 | - $record->enumvalues = ''; |
|
| 145 | - } |
|
| 137 | + if ('Enum' === $customfield['fieldtype'] || 'Set' === $customfield['fieldtype']) {
|
|
| 138 | + $enumvalues = array(); |
|
| 139 | + foreach ($customfield['enumvalues'] as $enumkey => $enumvalue) {
|
|
| 140 | + $enumvalues[$enumkey] = $set->enumvalues->input($enumvalue); |
|
| 141 | + } |
|
| 142 | + $record->enumvalues = serialize($enumvalues); |
|
| 143 | + } else {
|
|
| 144 | + $record->enumvalues = ''; |
|
| 145 | + } |
|
| 146 | 146 | |
| 147 | - unset($customfield['enumvalues']); |
|
| 148 | - $record->setFormInputValues($customfield); |
|
| 147 | + unset($customfield['enumvalues']); |
|
| 148 | + $record->setFormInputValues($customfield); |
|
| 149 | 149 | |
| 150 | - $record->save(); |
|
| 150 | + $record->save(); |
|
| 151 | 151 | |
| 152 | - // refresh target table structure |
|
| 152 | + // refresh target table structure |
|
| 153 | 153 | |
| 154 | - $object = $record->object.'Set'; |
|
| 155 | - $mysqlbackend = new ORM_MySqlBackend($GLOBALS['babDB']); |
|
| 154 | + $object = $record->object.'Set'; |
|
| 155 | + $mysqlbackend = new ORM_MySqlBackend($GLOBALS['babDB']); |
|
| 156 | 156 | |
| 157 | - $recordSet = $App->$object(); |
|
| 158 | - if (method_exists($recordSet, 'useLang')) {
|
|
| 159 | - // This is necessary if the recordSet constructor uses a setLang(). |
|
| 160 | - // We need to revert to multilang fields before synchronizing. |
|
| 161 | - $recordSet->useLang(false); |
|
| 162 | - } |
|
| 157 | + $recordSet = $App->$object(); |
|
| 158 | + if (method_exists($recordSet, 'useLang')) {
|
|
| 159 | + // This is necessary if the recordSet constructor uses a setLang(). |
|
| 160 | + // We need to revert to multilang fields before synchronizing. |
|
| 161 | + $recordSet->useLang(false); |
|
| 162 | + } |
|
| 163 | 163 | |
| 164 | - $sql = $mysqlbackend->setToSql($recordSet); |
|
| 164 | + $sql = $mysqlbackend->setToSql($recordSet); |
|
| 165 | 165 | |
| 166 | - require_once $GLOBALS['babInstallPath'].'utilit/devtools.php'; |
|
| 167 | - $synchronize = new bab_synchronizeSql(); |
|
| 168 | - $synchronize->fromSqlString($sql); |
|
| 166 | + require_once $GLOBALS['babInstallPath'].'utilit/devtools.php'; |
|
| 167 | + $synchronize = new bab_synchronizeSql(); |
|
| 168 | + $synchronize->fromSqlString($sql); |
|
| 169 | 169 | |
| 170 | - return true; |
|
| 171 | - } |
|
| 170 | + return true; |
|
| 171 | + } |
|
| 172 | 172 | |
| 173 | 173 | |
| 174 | 174 | /** |
| 175 | 175 | * {@inheritDoc}
|
| 176 | 176 | * @see app_CtrlRecord::delete() |
| 177 | 177 | */ |
| 178 | - public function delete($customfield) |
|
| 179 | - {
|
|
| 180 | - $App = $this->App(); |
|
| 181 | - |
|
| 182 | - if (!$customfield) {
|
|
| 183 | - throw new app_AccessException($App->translate('Access denied'));
|
|
| 184 | - } |
|
| 185 | - |
|
| 186 | - $set = $App->CustomFieldSet(); |
|
| 187 | - $record = $set->request($customfield); |
|
| 188 | - $object = $record->object.'Set'; |
|
| 189 | - $set->delete($set->id->is($customfield)); |
|
| 190 | - |
|
| 191 | - $recordSet = $App->$object(); |
|
| 192 | - if (method_exists($recordSet, 'useLang')) {
|
|
| 193 | - // This is necessary if the recordSet constructor uses a setLang(). |
|
| 194 | - // We need to revert to multilang fields before synchronizing. |
|
| 195 | - $recordSet->useLang(false); |
|
| 196 | - } |
|
| 197 | - |
|
| 198 | - $mysqlbackend = new ORM_MySqlBackend($GLOBALS['babDB']); |
|
| 199 | - $sql = $mysqlbackend->setToSql($recordSet); |
|
| 200 | - |
|
| 201 | - require_once $GLOBALS['babInstallPath'].'utilit/devtools.php'; |
|
| 202 | - $synchronize = new bab_synchronizeSql(); |
|
| 203 | - $synchronize->fromSqlString($sql); |
|
| 204 | - |
|
| 205 | - return true; |
|
| 206 | - } |
|
| 178 | + public function delete($customfield) |
|
| 179 | + {
|
|
| 180 | + $App = $this->App(); |
|
| 181 | + |
|
| 182 | + if (!$customfield) {
|
|
| 183 | + throw new app_AccessException($App->translate('Access denied'));
|
|
| 184 | + } |
|
| 185 | + |
|
| 186 | + $set = $App->CustomFieldSet(); |
|
| 187 | + $record = $set->request($customfield); |
|
| 188 | + $object = $record->object.'Set'; |
|
| 189 | + $set->delete($set->id->is($customfield)); |
|
| 190 | + |
|
| 191 | + $recordSet = $App->$object(); |
|
| 192 | + if (method_exists($recordSet, 'useLang')) {
|
|
| 193 | + // This is necessary if the recordSet constructor uses a setLang(). |
|
| 194 | + // We need to revert to multilang fields before synchronizing. |
|
| 195 | + $recordSet->useLang(false); |
|
| 196 | + } |
|
| 197 | + |
|
| 198 | + $mysqlbackend = new ORM_MySqlBackend($GLOBALS['babDB']); |
|
| 199 | + $sql = $mysqlbackend->setToSql($recordSet); |
|
| 200 | + |
|
| 201 | + require_once $GLOBALS['babInstallPath'].'utilit/devtools.php'; |
|
| 202 | + $synchronize = new bab_synchronizeSql(); |
|
| 203 | + $synchronize->fromSqlString($sql); |
|
| 204 | + |
|
| 205 | + return true; |
|
| 206 | + } |
|
| 207 | 207 | } |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | * @copyright Copyright (c) 2008 by CANTICO ({@link http://www.cantico.fr})
|
| 22 | 22 | */ |
| 23 | 23 | |
| 24 | -require_once APP_CTRL_PATH . '/record.ctrl.php'; |
|
| 24 | +require_once APP_CTRL_PATH.'/record.ctrl.php'; |
|
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | 27 | * This controller manages actions that can be performed on custom fields |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | $W->Link( |
| 40 | 40 | $App->translate('Add a custom field'),
|
| 41 | 41 | $this->proxy()->edit() |
| 42 | - )->addClass('icon', Func_Icons::ACTIONS_LIST_ADD)
|
|
| 42 | + )->addClass('icon', Func_Icons::ACTIONS_LIST_ADD)
|
|
| 43 | 43 | ->setOpenMode(Widget_Link::OPEN_DIALOG_AND_RELOAD) |
| 44 | 44 | ); |
| 45 | 45 | |
@@ -119,7 +119,7 @@ |
||
| 119 | 119 | throw new app_SaveException($this->App()->translate('The name is mandatory'));
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - return '_' . $name; |
|
| 122 | + return '_'.$name; |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | |