@@ -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 | } |
@@ -1642,7 +1642,7 @@ |
||
| 1642 | 1642 | $W->SubmitButton() |
| 1643 | 1643 | ->setAjaxAction($confirmedAction) |
| 1644 | 1644 | ->setLabel($App->translate('Delete')) |
| 1645 | - ); |
|
| 1645 | + ); |
|
| 1646 | 1646 | $form->addButton($W->SubmitButton()->setLabel($App->translate('Cancel'))->addClass('widget-close-dialog')); |
| 1647 | 1647 | $page->addItem($form); |
| 1648 | 1648 | |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | * @copyright Copyright (c) 2006 by CANTICO ({@link http://www.cantico.fr}) |
| 22 | 22 | */ |
| 23 | 23 | |
| 24 | -require_once dirname(__FILE__) . '/controller.class.php'; |
|
| 24 | +require_once dirname(__FILE__).'/controller.class.php'; |
|
| 25 | 25 | |
| 26 | 26 | |
| 27 | 27 | |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | { |
| 53 | 53 | $App = $this->App(); |
| 54 | 54 | $recordClassname = $this->getRecordClassName(); |
| 55 | - $recordSetClassname = $recordClassname . 'Set'; |
|
| 55 | + $recordSetClassname = $recordClassname.'Set'; |
|
| 56 | 56 | |
| 57 | 57 | $recordSet = $App->$recordSetClassname(); |
| 58 | 58 | return $recordSet; |
@@ -104,9 +104,9 @@ discard block |
||
| 104 | 104 | if ($showLabel) { |
| 105 | 105 | $text = $actions->getTitle(); |
| 106 | 106 | } |
| 107 | - $html = '<li><a class="icon ' . $actions->getIcon() . '" href="' . $actions->url() . '">' . $text . '</a></li>'; |
|
| 107 | + $html = '<li><a class="icon '.$actions->getIcon().'" href="'.$actions->url().'">'.$text.'</a></li>'; |
|
| 108 | 108 | } elseif ($actions instanceof Widget_Link) { |
| 109 | - $html = '<li>' . $actions->display($canvas) . '</li>'; |
|
| 109 | + $html = '<li>'.$actions->display($canvas).'</li>'; |
|
| 110 | 110 | } elseif (is_array($actions)) { |
| 111 | 111 | if (isset($actions['items'])) { |
| 112 | 112 | $items = $actions['items']; |
@@ -119,10 +119,10 @@ discard block |
||
| 119 | 119 | if (isset($actions['icon'])) { |
| 120 | 120 | |
| 121 | 121 | $html = '<li class="dropdown">' |
| 122 | - . '<a href="#" class="' . $actions['icon'] . ' icon dropdown-toogle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">' |
|
| 122 | + . '<a href="#" class="'.$actions['icon'].' icon dropdown-toogle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">' |
|
| 123 | 123 | . ($actions['icon'] === 'actions-context-menu'/*Func_Icons::ACTIONS_CONTEXT_MENU*/ ? '' : '<span class="caret"></span>') |
| 124 | 124 | . '</a>' |
| 125 | - . '<ul class="dropdown-menu dropdown-menu-right ' . Func_Icons::ICON_LEFT_SYMBOLIC . '">' |
|
| 125 | + . '<ul class="dropdown-menu dropdown-menu-right '.Func_Icons::ICON_LEFT_SYMBOLIC.'">' |
|
| 126 | 126 | . $html |
| 127 | 127 | . '</ul>'; |
| 128 | 128 | } |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | |
| 146 | 146 | $recordClassname = $this->getRecordClassName(); |
| 147 | 147 | |
| 148 | - $viewClassname = $recordClassname . 'TableView'; |
|
| 148 | + $viewClassname = $recordClassname.'TableView'; |
|
| 149 | 149 | if (method_exists($Ui, $viewClassname)) { |
| 150 | 150 | $types['table'] = array( |
| 151 | 151 | 'classname' => $viewClassname, |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | ); |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | - $viewClassname = $recordClassname . 'CardsView'; |
|
| 157 | + $viewClassname = $recordClassname.'CardsView'; |
|
| 158 | 158 | if (method_exists($Ui, $viewClassname)) { |
| 159 | 159 | $types['cards'] = array( |
| 160 | 160 | 'classname' => $viewClassname, |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | ); |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - $viewClassname = $recordClassname . 'MapView'; |
|
| 166 | + $viewClassname = $recordClassname.'MapView'; |
|
| 167 | 167 | if (method_exists($Ui, $viewClassname)) { |
| 168 | 168 | $types['map'] = array( |
| 169 | 169 | 'classname' => $viewClassname, |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | ); |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | - $viewClassname = $recordClassname . 'CalendarView'; |
|
| 175 | + $viewClassname = $recordClassname.'CalendarView'; |
|
| 176 | 176 | if (method_exists($Ui, $viewClassname)) { |
| 177 | 177 | $types['calendar'] = array( |
| 178 | 178 | 'classname' => $viewClassname, |
@@ -246,11 +246,11 @@ discard block |
||
| 246 | 246 | $recordSet = $this->getEditRecordSet(); |
| 247 | 247 | |
| 248 | 248 | $recordClassname = $this->getRecordClassName(); |
| 249 | - $editorClassname = $recordClassname . 'SectionEditor'; |
|
| 249 | + $editorClassname = $recordClassname.'SectionEditor'; |
|
| 250 | 250 | /* @var $editor app_RecordEditor */ |
| 251 | 251 | $editor = $Ui->$editorClassname(); |
| 252 | 252 | if (!isset($itemId)) { |
| 253 | - $itemId = $this->getClass() . '_' . __FUNCTION__; |
|
| 253 | + $itemId = $this->getClass().'_'.__FUNCTION__; |
|
| 254 | 254 | } |
| 255 | 255 | $editor->setId($itemId); |
| 256 | 256 | $editor->setHiddenValue('tg', $App->controllerTg); |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | public function getModelViewDefaultId($itemId = null) |
| 294 | 294 | { |
| 295 | 295 | if (!isset($itemId)) { |
| 296 | - $itemId = $this->getClass() . '_modelView'; |
|
| 296 | + $itemId = $this->getClass().'_modelView'; |
|
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | return $itemId; |
@@ -327,20 +327,20 @@ discard block |
||
| 327 | 327 | |
| 328 | 328 | switch ($type) { |
| 329 | 329 | case 'cards': |
| 330 | - $tableviewClassname = $recordClassname . 'CardsView'; |
|
| 330 | + $tableviewClassname = $recordClassname.'CardsView'; |
|
| 331 | 331 | break; |
| 332 | 332 | |
| 333 | 333 | case 'map': |
| 334 | - $tableviewClassname = $recordClassname . 'MapView'; |
|
| 334 | + $tableviewClassname = $recordClassname.'MapView'; |
|
| 335 | 335 | break; |
| 336 | 336 | |
| 337 | 337 | case 'calendar': |
| 338 | - $tableviewClassname = $recordClassname . 'CalendarView'; |
|
| 338 | + $tableviewClassname = $recordClassname.'CalendarView'; |
|
| 339 | 339 | break; |
| 340 | 340 | |
| 341 | 341 | case 'table': |
| 342 | 342 | default: |
| 343 | - $tableviewClassname = $recordClassname . 'TableView'; |
|
| 343 | + $tableviewClassname = $recordClassname.'TableView'; |
|
| 344 | 344 | break; |
| 345 | 345 | } |
| 346 | 346 | |
@@ -406,10 +406,10 @@ discard block |
||
| 406 | 406 | $Ui = $App->Ui(); |
| 407 | 407 | |
| 408 | 408 | $recordClassname = $this->getRecordClassName(); |
| 409 | - $editorClassname = $recordClassname . 'Editor'; |
|
| 409 | + $editorClassname = $recordClassname.'Editor'; |
|
| 410 | 410 | $editor = $Ui->$editorClassname(); |
| 411 | 411 | if (!isset($itemId)) { |
| 412 | - $itemId = $this->getClass() . '_' . __FUNCTION__; |
|
| 412 | + $itemId = $this->getClass().'_'.__FUNCTION__; |
|
| 413 | 413 | } |
| 414 | 414 | $editor->setId($itemId); |
| 415 | 415 | $editor->setHiddenValue('tg', $App->controllerTg); |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | $W->Link( |
| 455 | 455 | '', |
| 456 | 456 | $proxy->setFilteredViewType($tableView->getId(), $viewTypeId) |
| 457 | - )->addClass('icon', $viewType['icon'] . ($filteredViewType=== $viewTypeId ? ' active' : '')) |
|
| 457 | + )->addClass('icon', $viewType['icon'].($filteredViewType === $viewTypeId ? ' active' : '')) |
|
| 458 | 458 | // ->setSizePolicy('btn btn-xs btn-default ' . ($filteredViewType === $viewTypeId ? 'active' : '')) |
| 459 | 459 | ->setTitle($viewType['label']) |
| 460 | 460 | ->setAjaxAction() |
@@ -498,7 +498,7 @@ discard block |
||
| 498 | 498 | |
| 499 | 499 | $filterVisibility = $this->getFilterVisibility($itemId); |
| 500 | 500 | $filterVisibility = !$filterVisibility; |
| 501 | - $W->setUserConfiguration($itemId . '/filterVisibility', $filterVisibility); |
|
| 501 | + $W->setUserConfiguration($itemId.'/filterVisibility', $filterVisibility); |
|
| 502 | 502 | |
| 503 | 503 | return true; |
| 504 | 504 | } |
@@ -511,10 +511,10 @@ discard block |
||
| 511 | 511 | protected function getFilterVisibility($itemId) |
| 512 | 512 | { |
| 513 | 513 | $W = bab_Widgets(); |
| 514 | - $filterVisibility = $W->getUserConfiguration($itemId . '/filterVisibility'); |
|
| 514 | + $filterVisibility = $W->getUserConfiguration($itemId.'/filterVisibility'); |
|
| 515 | 515 | if (!isset($filterVisibility)) { |
| 516 | 516 | $filterVisibility = false; |
| 517 | - $W->setUserConfiguration($itemId . '/filterVisibility', $filterVisibility); |
|
| 517 | + $W->setUserConfiguration($itemId.'/filterVisibility', $filterVisibility); |
|
| 518 | 518 | } |
| 519 | 519 | return $filterVisibility; |
| 520 | 520 | } |
@@ -528,7 +528,7 @@ discard block |
||
| 528 | 528 | protected function getFilteredViewType($itemId) |
| 529 | 529 | { |
| 530 | 530 | $W = bab_Widgets(); |
| 531 | - $type = $W->getUserConfiguration($itemId . '/viewType'); |
|
| 531 | + $type = $W->getUserConfiguration($itemId.'/viewType'); |
|
| 532 | 532 | if (!isset($type)) { |
| 533 | 533 | $type = 'table'; |
| 534 | 534 | } |
@@ -544,7 +544,7 @@ discard block |
||
| 544 | 544 | public function setFilteredViewType($itemId, $type = null) |
| 545 | 545 | { |
| 546 | 546 | $W = bab_Widgets(); |
| 547 | - $W->setUserConfiguration($itemId . '/viewType', $type); |
|
| 547 | + $W->setUserConfiguration($itemId.'/viewType', $type); |
|
| 548 | 548 | |
| 549 | 549 | return true; |
| 550 | 550 | } |
@@ -686,17 +686,17 @@ discard block |
||
| 686 | 686 | |
| 687 | 687 | switch ($format) { |
| 688 | 688 | case 'xlsx': |
| 689 | - $tableview->downloadXlsx($filename . '.xlsx'); |
|
| 689 | + $tableview->downloadXlsx($filename.'.xlsx'); |
|
| 690 | 690 | break; |
| 691 | 691 | case 'xls': |
| 692 | - $tableview->downloadExcel($filename . '.xls'); |
|
| 692 | + $tableview->downloadExcel($filename.'.xls'); |
|
| 693 | 693 | break; |
| 694 | 694 | case 'ssv': |
| 695 | - $tableview->downloadCsv($filename . '.csv', ';', $inline, 'Windows-1252'); |
|
| 695 | + $tableview->downloadCsv($filename.'.csv', ';', $inline, 'Windows-1252'); |
|
| 696 | 696 | break; |
| 697 | 697 | case 'csv': |
| 698 | 698 | default: |
| 699 | - $tableview->downloadCsv($filename . '.csv', ',', $inline, bab_charset::getIso()); |
|
| 699 | + $tableview->downloadCsv($filename.'.csv', ',', $inline, bab_charset::getIso()); |
|
| 700 | 700 | break; |
| 701 | 701 | } |
| 702 | 702 | } |
@@ -725,7 +725,7 @@ discard block |
||
| 725 | 725 | $Ui = $App->Ui(); |
| 726 | 726 | |
| 727 | 727 | $recordClassname = $this->getRecordClassName(); |
| 728 | - $fullFrameClassname = $recordClassname . 'FullFrame'; |
|
| 728 | + $fullFrameClassname = $recordClassname.'FullFrame'; |
|
| 729 | 729 | $fullFrame = $Ui->$fullFrameClassname($record, $view); |
| 730 | 730 | |
| 731 | 731 | |
@@ -888,7 +888,7 @@ discard block |
||
| 888 | 888 | |
| 889 | 889 | $recordTitle = $record->getRecordTitle(); |
| 890 | 890 | |
| 891 | - $message = sprintf($App->translate('%s has been deleted'), $App->translate($recordSet->getDescription()) . ' "' . $recordTitle . '"'); |
|
| 891 | + $message = sprintf($App->translate('%s has been deleted'), $App->translate($recordSet->getDescription()).' "'.$recordTitle.'"'); |
|
| 892 | 892 | return $message; |
| 893 | 893 | } |
| 894 | 894 | |
@@ -987,7 +987,7 @@ discard block |
||
| 987 | 987 | $this->addMessage($message); |
| 988 | 988 | } |
| 989 | 989 | |
| 990 | - $this->addReloadSelector('.depends-' . $this->getRecordClassName()); |
|
| 990 | + $this->addReloadSelector('.depends-'.$this->getRecordClassName()); |
|
| 991 | 991 | return true; |
| 992 | 992 | } |
| 993 | 993 | |
@@ -1019,7 +1019,7 @@ discard block |
||
| 1019 | 1019 | $this->addMessage($deletedMessage); |
| 1020 | 1020 | } |
| 1021 | 1021 | |
| 1022 | - $this->addReloadSelector('.depends-' . strtolower($record->getClassName())); |
|
| 1022 | + $this->addReloadSelector('.depends-'.strtolower($record->getClassName())); |
|
| 1023 | 1023 | |
| 1024 | 1024 | return true; |
| 1025 | 1025 | } |
@@ -1050,7 +1050,7 @@ discard block |
||
| 1050 | 1050 | |
| 1051 | 1051 | $recordTitle = $record->getRecordTitle(); |
| 1052 | 1052 | |
| 1053 | - $subTitle = $App->translate($recordSet->getDescription()) . ' "' . $recordTitle . '"'; |
|
| 1053 | + $subTitle = $App->translate($recordSet->getDescription()).' "'.$recordTitle.'"'; |
|
| 1054 | 1054 | $form->addItem($W->Title($subTitle, 5)); |
| 1055 | 1055 | |
| 1056 | 1056 | $form->addItem($W->Title($App->translate('Confirm delete?'), 6)); |
@@ -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 | $App->includeBase(); |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | { |
| 35 | 35 | public function __construct($action, $code = 0) |
| 36 | 36 | { |
| 37 | - $message = 'Unknown method "' . $action->getController() . '::' . $action->getMethod() . '"'; |
|
| 37 | + $message = 'Unknown method "'.$action->getController().'::'.$action->getMethod().'"'; |
|
| 38 | 38 | parent::__construct($message, $code); |
| 39 | 39 | } |
| 40 | 40 | } |
@@ -183,11 +183,11 @@ discard block |
||
| 183 | 183 | // we try to select one according to the classname prefix. |
| 184 | 184 | list($prefix) = explode('_', __CLASS__); |
| 185 | 185 | $functionalityName = ucwords($prefix); |
| 186 | - $App = @bab_functionality::get('App/' . $functionalityName); |
|
| 186 | + $App = @bab_functionality::get('App/'.$functionalityName); |
|
| 187 | 187 | |
| 188 | 188 | if (!$App) |
| 189 | 189 | { |
| 190 | - throw new app_Exception('Faild to autodetect functionality App/' . $functionalityName.', the getInstance method is deprecated, use $App->ControllerProxy() instead'); |
|
| 190 | + throw new app_Exception('Faild to autodetect functionality App/'.$functionalityName.', the getInstance method is deprecated, use $App->ControllerProxy() instead'); |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | $controller = $App->ControllerProxy($classname, $proxy); |
@@ -206,9 +206,9 @@ discard block |
||
| 206 | 206 | static function getProxyInstance(Func_App $App, $classname) |
| 207 | 207 | { |
| 208 | 208 | $class = new ReflectionClass($classname); |
| 209 | - $proxyClassname = $class->name . self::PROXY_CLASS_SUFFIX; |
|
| 209 | + $proxyClassname = $class->name.self::PROXY_CLASS_SUFFIX; |
|
| 210 | 210 | if (!class_exists($proxyClassname)) { |
| 211 | - $classStr = 'class ' . $proxyClassname . ' extends ' . $class->name . ' {' . "\n"; |
|
| 211 | + $classStr = 'class '.$proxyClassname.' extends '.$class->name.' {'."\n"; |
|
| 212 | 212 | $methods = $class->getMethods(); |
| 213 | 213 | |
| 214 | 214 | $classStr .= ' public function __construct(Func_App $App) { |
@@ -221,24 +221,24 @@ discard block |
||
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | |
| 224 | - $classStr .= ' public function ' . $method->name . '('; |
|
| 224 | + $classStr .= ' public function '.$method->name.'('; |
|
| 225 | 225 | $parameters = $method->getParameters(); |
| 226 | 226 | $parametersStr = array(); |
| 227 | 227 | foreach ($parameters as $parameter) { |
| 228 | 228 | |
| 229 | 229 | if ($parameter->isDefaultValueAvailable()) { |
| 230 | - $parametersStr[] = '$' . $parameter->name . ' = ' . var_export($parameter->getDefaultValue(), true); |
|
| 230 | + $parametersStr[] = '$'.$parameter->name.' = '.var_export($parameter->getDefaultValue(), true); |
|
| 231 | 231 | } else { |
| 232 | - $parametersStr[] = '$' . $parameter->name; |
|
| 232 | + $parametersStr[] = '$'.$parameter->name; |
|
| 233 | 233 | } |
| 234 | 234 | } |
| 235 | 235 | $classStr .= implode(', ', $parametersStr); |
| 236 | - $classStr .= ') {' . "\n"; |
|
| 237 | - $classStr .= ' $args = func_get_args();' . "\n"; |
|
| 238 | - $classStr .= ' return $this->getMethodAction(__FUNCTION__, $args);' . "\n"; |
|
| 239 | - $classStr .= ' }' . "\n"; |
|
| 236 | + $classStr .= ') {'."\n"; |
|
| 237 | + $classStr .= ' $args = func_get_args();'."\n"; |
|
| 238 | + $classStr .= ' return $this->getMethodAction(__FUNCTION__, $args);'."\n"; |
|
| 239 | + $classStr .= ' }'."\n"; |
|
| 240 | 240 | } |
| 241 | - $classStr .= '}' . "\n"; |
|
| 241 | + $classStr .= '}'."\n"; |
|
| 242 | 242 | |
| 243 | 243 | // We define the proxy class |
| 244 | 244 | eval($classStr); |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | $action->setParameters($actionParams); |
| 363 | 363 | |
| 364 | 364 | |
| 365 | - list(,,$file) = explode('/', $App->controllerTg); |
|
| 365 | + list(,, $file) = explode('/', $App->controllerTg); |
|
| 366 | 366 | |
| 367 | 367 | $action->setParameter('addon', $App->getAddonName().'.'.$file); |
| 368 | 368 | $action->setParameter('idx', $idx); |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | return false; |
| 387 | 387 | } |
| 388 | 388 | |
| 389 | - list($objectName, ) = explode('.', $method); |
|
| 389 | + list($objectName,) = explode('.', $method); |
|
| 390 | 390 | |
| 391 | 391 | if (!method_exists($this, $objectName)) { |
| 392 | 392 | header('HTTP/1.0 400 Bad Request'); |
@@ -394,7 +394,7 @@ discard block |
||
| 394 | 394 | } |
| 395 | 395 | |
| 396 | 396 | $objectController = $this->{$objectName}(false); |
| 397 | - if ( ! ($objectController instanceof app_Controller)) { |
|
| 397 | + if (!($objectController instanceof app_Controller)) { |
|
| 398 | 398 | return false; |
| 399 | 399 | } |
| 400 | 400 | |
@@ -408,7 +408,7 @@ discard block |
||
| 408 | 408 | } else { |
| 409 | 409 | if ($this->isAjaxRequest()) { |
| 410 | 410 | |
| 411 | - header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden', true, 403); |
|
| 411 | + header($_SERVER['SERVER_PROTOCOL'].' 403 Forbidden', true, 403); |
|
| 412 | 412 | |
| 413 | 413 | die( |
| 414 | 414 | bab_json_encode( |
@@ -429,7 +429,7 @@ discard block |
||
| 429 | 429 | } catch (app_SaveException $e) { |
| 430 | 430 | |
| 431 | 431 | if ($this->isAjaxRequest()) { |
| 432 | - header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden', true, 403); |
|
| 432 | + header($_SERVER['SERVER_PROTOCOL'].' 403 Forbidden', true, 403); |
|
| 433 | 433 | header('Cache-Control: no-cache, must-revalidate'); |
| 434 | 434 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); |
| 435 | 435 | header('Content-type: application/json'); |
@@ -484,7 +484,7 @@ discard block |
||
| 484 | 484 | if (method_exists($htmlCanvas, 'sendPageTitle')) { |
| 485 | 485 | $htmlCanvas->sendPageTitle($pageTitle); |
| 486 | 486 | } else { |
| 487 | - header('X-Cto-PageTitle: ' . $pageTitle); |
|
| 487 | + header('X-Cto-PageTitle: '.$pageTitle); |
|
| 488 | 488 | } |
| 489 | 489 | } |
| 490 | 490 | $html = $returnedValue->display($htmlCanvas); |
@@ -543,7 +543,7 @@ discard block |
||
| 543 | 543 | private function deletedItemPage(Widget_Action $action, app_DeletedRecordException $e) |
| 544 | 544 | { |
| 545 | 545 | if ($this->isAjaxRequest()) { |
| 546 | - header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden', true, 403); |
|
| 546 | + header($_SERVER['SERVER_PROTOCOL'].' 403 Forbidden', true, 403); |
|
| 547 | 547 | header('Cache-Control: no-cache, must-revalidate'); |
| 548 | 548 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); |
| 549 | 549 | header('Content-type: application/json'); |
@@ -560,7 +560,7 @@ discard block |
||
| 560 | 560 | ); |
| 561 | 561 | |
| 562 | 562 | } |
| 563 | - header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found', true, 404); |
|
| 563 | + header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found', true, 404); |
|
| 564 | 564 | |
| 565 | 565 | $App = $this->App(); |
| 566 | 566 | $W = bab_Widgets(); |
@@ -594,7 +594,7 @@ discard block |
||
| 594 | 594 | private function notFoundPage(Widget_Action $action, app_NotFoundException $e) |
| 595 | 595 | { |
| 596 | 596 | if ($this->isAjaxRequest()) { |
| 597 | - $message = sprintf(app_translate('This %s does not exists'), $e->getObjectTitle() . ' (' . $e->getId() . ')'); |
|
| 597 | + $message = sprintf(app_translate('This %s does not exists'), $e->getObjectTitle().' ('.$e->getId().')'); |
|
| 598 | 598 | $json = array( |
| 599 | 599 | 'messages' => array( |
| 600 | 600 | array( |
@@ -606,7 +606,7 @@ discard block |
||
| 606 | 606 | echo bab_json_encode($json); |
| 607 | 607 | die; |
| 608 | 608 | } |
| 609 | - header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found', true, 404); |
|
| 609 | + header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found', true, 404); |
|
| 610 | 610 | header('Cache-Control: no-cache, must-revalidate'); |
| 611 | 611 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); |
| 612 | 612 | |
@@ -626,14 +626,14 @@ discard block |
||
| 626 | 626 | |
| 627 | 627 | private function errorPage(Exception $e) |
| 628 | 628 | { |
| 629 | - header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal server error', true, 500); |
|
| 629 | + header($_SERVER['SERVER_PROTOCOL'].' 500 Internal server error', true, 500); |
|
| 630 | 630 | |
| 631 | - require_once $GLOBALS['babInstallPath'] . 'utilit/uiutil.php'; |
|
| 631 | + require_once $GLOBALS['babInstallPath'].'utilit/uiutil.php'; |
|
| 632 | 632 | $popup = new babBodyPopup(); |
| 633 | 633 | $popup->babEcho( |
| 634 | - '<h1>' . $this->App()->translate('There was a problem when trying to perform this operation') . '</h1>' |
|
| 635 | - . '<h2 class="error">' . $this->App()->translate('Additional debugging information:') . '</h2>' |
|
| 636 | - . '<p class="error">' . $e->getMessage() . ' ' . $e->getFile() . ' ' . $e->getLine() . ' ' . $e->getTraceAsString() . '</p>' |
|
| 634 | + '<h1>'.$this->App()->translate('There was a problem when trying to perform this operation').'</h1>' |
|
| 635 | + . '<h2 class="error">'.$this->App()->translate('Additional debugging information:').'</h2>' |
|
| 636 | + . '<p class="error">'.$e->getMessage().' '.$e->getFile().' '.$e->getLine().' '.$e->getTraceAsString().'</p>' |
|
| 637 | 637 | ); |
| 638 | 638 | |
| 639 | 639 | |
@@ -678,7 +678,7 @@ discard block |
||
| 678 | 678 | */ |
| 679 | 679 | public function CustomField($proxy = true) |
| 680 | 680 | { |
| 681 | - require_once APP_CTRL_PATH . 'customfield.ctrl.php'; |
|
| 681 | + require_once APP_CTRL_PATH.'customfield.ctrl.php'; |
|
| 682 | 682 | return $this->App()->ControllerProxy('app_CtrlCustomField', $proxy); |
| 683 | 683 | } |
| 684 | 684 | |
@@ -689,7 +689,7 @@ discard block |
||
| 689 | 689 | */ |
| 690 | 690 | public function CustomSection($proxy = true) |
| 691 | 691 | { |
| 692 | - require_once APP_CTRL_PATH . 'customsection.ctrl.php'; |
|
| 692 | + require_once APP_CTRL_PATH.'customsection.ctrl.php'; |
|
| 693 | 693 | return $this->App()->ControllerProxy('app_CtrlCustomSection', $proxy); |
| 694 | 694 | } |
| 695 | 695 | } |
@@ -69,205 +69,205 @@ |
||
| 69 | 69 | |
| 70 | 70 | |
| 71 | 71 | |
| 72 | - /** |
|
| 73 | - * @param string $sourceClass |
|
| 74 | - */ |
|
| 75 | - public function joinSource($sourceClass) |
|
| 76 | - { |
|
| 77 | - if (get_class($this->sourceId) !== $sourceClass . 'Set') { |
|
| 78 | - $this->hasOne('sourceId', $sourceClass . 'Set'); |
|
| 79 | - $this->join('sourceId'); |
|
| 80 | - } |
|
| 81 | - } |
|
| 82 | - |
|
| 83 | - |
|
| 84 | - /** |
|
| 85 | - * @param string $targetClass |
|
| 86 | - */ |
|
| 87 | - public function joinTarget($targetClass = null) |
|
| 88 | - { |
|
| 89 | - if (get_class($this->targetId) !== $targetClass . 'Set') { |
|
| 90 | - $this->hasOne('targetId', $targetClass . 'Set'); |
|
| 91 | - $this->join('targetId'); |
|
| 92 | - } |
|
| 93 | - } |
|
| 94 | - |
|
| 95 | - |
|
| 96 | - |
|
| 97 | - public function sourceIsA($recordClass) |
|
| 98 | - { |
|
| 99 | - return $this->sourceClass->is($recordClass); |
|
| 100 | - } |
|
| 101 | - |
|
| 102 | - /** |
|
| 103 | - * |
|
| 104 | - * @return ORM_Iterator |
|
| 105 | - */ |
|
| 106 | - public function selectForSource(app_Record $object, $targetClass = null, $linkType = null) |
|
| 107 | - { |
|
| 108 | - $criteria = $this->sourceId->is($object->id) |
|
| 72 | + /** |
|
| 73 | + * @param string $sourceClass |
|
| 74 | + */ |
|
| 75 | + public function joinSource($sourceClass) |
|
| 76 | + { |
|
| 77 | + if (get_class($this->sourceId) !== $sourceClass . 'Set') { |
|
| 78 | + $this->hasOne('sourceId', $sourceClass . 'Set'); |
|
| 79 | + $this->join('sourceId'); |
|
| 80 | + } |
|
| 81 | + } |
|
| 82 | + |
|
| 83 | + |
|
| 84 | + /** |
|
| 85 | + * @param string $targetClass |
|
| 86 | + */ |
|
| 87 | + public function joinTarget($targetClass = null) |
|
| 88 | + { |
|
| 89 | + if (get_class($this->targetId) !== $targetClass . 'Set') { |
|
| 90 | + $this->hasOne('targetId', $targetClass . 'Set'); |
|
| 91 | + $this->join('targetId'); |
|
| 92 | + } |
|
| 93 | + } |
|
| 94 | + |
|
| 95 | + |
|
| 96 | + |
|
| 97 | + public function sourceIsA($recordClass) |
|
| 98 | + { |
|
| 99 | + return $this->sourceClass->is($recordClass); |
|
| 100 | + } |
|
| 101 | + |
|
| 102 | + /** |
|
| 103 | + * |
|
| 104 | + * @return ORM_Iterator |
|
| 105 | + */ |
|
| 106 | + public function selectForSource(app_Record $object, $targetClass = null, $linkType = null) |
|
| 107 | + { |
|
| 108 | + $criteria = $this->sourceId->is($object->id) |
|
| 109 | 109 | ->_AND_($this->sourceClass->is(get_class($object))); |
| 110 | 110 | |
| 111 | - if (isset($targetClass)) { |
|
| 112 | - $this->joinTarget($targetClass); |
|
| 113 | - $criteria = $criteria->_AND_($this->targetClass->is($targetClass)); |
|
| 114 | - } |
|
| 115 | - |
|
| 116 | - if (isset($linkType)) { |
|
| 117 | - if (is_array($linkType)) { |
|
| 118 | - $criteria = $criteria->_AND_($this->type->in($linkType)); |
|
| 119 | - } else { |
|
| 120 | - $criteria = $criteria->_AND_($this->type->is($linkType)); |
|
| 121 | - } |
|
| 122 | - } |
|
| 123 | - |
|
| 124 | - if (is_a($this->targetId, 'app_TraceableRecordSet')) { |
|
| 125 | - $criteria = $criteria->_AND_($this->targetId->deleted->is(false)); |
|
| 126 | - } |
|
| 127 | - |
|
| 128 | - return $this->select($criteria); |
|
| 129 | - } |
|
| 130 | - |
|
| 131 | - |
|
| 132 | - /** |
|
| 133 | - * |
|
| 134 | - * @return ORM_Iterator |
|
| 135 | - */ |
|
| 136 | - public function selectForSources($objects, $targetClass, $linkType = null) |
|
| 137 | - { |
|
| 138 | - $sourceClass = null; |
|
| 139 | - $sourceIds = array(); |
|
| 140 | - |
|
| 141 | - foreach ($objects as $obj) { |
|
| 142 | - if (is_null($sourceClass)) { |
|
| 143 | - $sourceClass = get_class($obj); |
|
| 144 | - } |
|
| 145 | - $sourceIds[] = $obj->id; |
|
| 146 | - } |
|
| 147 | - $criteria = $this->sourceId->in($sourceIds) |
|
| 148 | - ->_AND_($this->sourceClass->is($sourceClass)); |
|
| 149 | - |
|
| 150 | - if (isset($targetClass)) { |
|
| 151 | - $this->joinTarget($targetClass); |
|
| 152 | - $criteria = $criteria->_AND_($this->targetClass->is($targetClass)); |
|
| 153 | - } |
|
| 154 | - |
|
| 155 | - if (isset($linkType)) { |
|
| 156 | - if (is_array($linkType)) { |
|
| 157 | - $criteria = $criteria->_AND_($this->type->in($linkType)); |
|
| 158 | - } else { |
|
| 159 | - $criteria = $criteria->_AND_($this->type->is($linkType)); |
|
| 160 | - } |
|
| 161 | - } |
|
| 162 | - return $this->select($criteria); |
|
| 163 | - } |
|
| 164 | - |
|
| 165 | - |
|
| 166 | - /** |
|
| 167 | - * |
|
| 168 | - * @return ORM_Iterator |
|
| 169 | - */ |
|
| 170 | - public function selectForTarget(app_Record $object, $sourceClass = null, $linkType = null) |
|
| 171 | - { |
|
| 172 | - $criteria = $this->targetId->is($object->id) |
|
| 173 | - ->_AND_($this->targetClass->is(get_class($object))); |
|
| 174 | - |
|
| 175 | - if (isset($sourceClass)) { |
|
| 176 | - $this->joinSource($sourceClass); |
|
| 177 | - $criteria = $criteria->_AND_($this->sourceClass->is($sourceClass)); |
|
| 178 | - } |
|
| 179 | - |
|
| 180 | - if (isset($linkType)) { |
|
| 181 | - if (is_array($linkType)) { |
|
| 182 | - $criteria = $criteria->_AND_($this->type->in($linkType)); |
|
| 183 | - } else { |
|
| 184 | - $criteria = $criteria->_AND_($this->type->is($linkType)); |
|
| 185 | - } |
|
| 186 | - } |
|
| 187 | - |
|
| 188 | - return $this->select($criteria); |
|
| 189 | - } |
|
| 190 | - |
|
| 191 | - |
|
| 192 | - /** |
|
| 193 | - * |
|
| 194 | - * @return ORM_Iterator |
|
| 195 | - */ |
|
| 196 | - public function selectForTargets($objects, $sourceClass = null, $linkType = null) |
|
| 197 | - { |
|
| 198 | - $targetClass = null; |
|
| 199 | - $targetIds = array(); |
|
| 200 | - |
|
| 201 | - foreach ($objects as $obj) { |
|
| 202 | - if (is_null($targetClass)) { |
|
| 203 | - $targetClass = get_class($obj); |
|
| 204 | - } |
|
| 205 | - $targetIds[] = $obj->id; |
|
| 206 | - } |
|
| 207 | - $criteria = $this->targetId->in($targetIds) |
|
| 208 | - ->_AND_($this->targetClass->is($targetClass)); |
|
| 209 | - |
|
| 210 | - if (isset($sourceClass)) { |
|
| 211 | - $this->joinSource($sourceClass); |
|
| 212 | - $criteria = $criteria->_AND_($this->sourceClass->is($sourceClass)); |
|
| 213 | - } |
|
| 214 | - |
|
| 215 | - if (isset($linkType)) { |
|
| 216 | - if (is_array($linkType)) { |
|
| 217 | - $criteria = $criteria->_AND_($this->type->in($linkType)); |
|
| 218 | - } else { |
|
| 219 | - $criteria = $criteria->_AND_($this->type->is($linkType)); |
|
| 220 | - } |
|
| 221 | - } |
|
| 222 | - |
|
| 223 | - return $this->select($criteria); |
|
| 224 | - } |
|
| 225 | - |
|
| 226 | - |
|
| 227 | - |
|
| 228 | - /** |
|
| 229 | - * delete all links to an object |
|
| 230 | - * |
|
| 231 | - * @param app_Record $object |
|
| 232 | - * @param string $targetClass if target class is set, links will be deleted only for target classes |
|
| 233 | - * @param bool $deleteTarget if set to true, the target will be deleted to |
|
| 234 | - */ |
|
| 235 | - public function deleteForSource(app_Record $object, $targetClass = null, $deleteTarget = false, $linkType = null) |
|
| 236 | - { |
|
| 237 | - $set = clone $this; |
|
| 238 | - $App = $object->App(); |
|
| 239 | - |
|
| 240 | - $criteria = $set->sourceId->is($object->id)->_AND_( |
|
| 241 | - $set->sourceClass->is(get_class($object)) |
|
| 242 | - ); |
|
| 243 | - |
|
| 244 | - if (null !== $targetClass) { |
|
| 245 | - $criteria = $criteria->_AND_( |
|
| 246 | - $set->targetClass->is($targetClass) |
|
| 247 | - ); |
|
| 248 | - } |
|
| 249 | - if (null !== $linkType) { |
|
| 250 | - $criteria = $criteria->_AND_( |
|
| 251 | - $set->type->is($linkType) |
|
| 252 | - ); |
|
| 253 | - } |
|
| 254 | - |
|
| 255 | - if ($deleteTarget) { |
|
| 256 | - foreach($set->select($criteria) as $link) { |
|
| 257 | - |
|
| 258 | - $className = $link->targetClass.'Set'; |
|
| 259 | - |
|
| 260 | - // remove prefix |
|
| 261 | - |
|
| 262 | - $className = mb_substr($className, 1 + mb_strpos($className, '_')); |
|
| 263 | - $targetSet = $App->$className(); |
|
| 264 | - |
|
| 265 | - $targetSet->delete($targetSet->id->is($link->targetId)); |
|
| 266 | - } |
|
| 267 | - } |
|
| 268 | - |
|
| 269 | - return $set->delete($criteria); |
|
| 270 | - } |
|
| 111 | + if (isset($targetClass)) { |
|
| 112 | + $this->joinTarget($targetClass); |
|
| 113 | + $criteria = $criteria->_AND_($this->targetClass->is($targetClass)); |
|
| 114 | + } |
|
| 115 | + |
|
| 116 | + if (isset($linkType)) { |
|
| 117 | + if (is_array($linkType)) { |
|
| 118 | + $criteria = $criteria->_AND_($this->type->in($linkType)); |
|
| 119 | + } else { |
|
| 120 | + $criteria = $criteria->_AND_($this->type->is($linkType)); |
|
| 121 | + } |
|
| 122 | + } |
|
| 123 | + |
|
| 124 | + if (is_a($this->targetId, 'app_TraceableRecordSet')) { |
|
| 125 | + $criteria = $criteria->_AND_($this->targetId->deleted->is(false)); |
|
| 126 | + } |
|
| 127 | + |
|
| 128 | + return $this->select($criteria); |
|
| 129 | + } |
|
| 130 | + |
|
| 131 | + |
|
| 132 | + /** |
|
| 133 | + * |
|
| 134 | + * @return ORM_Iterator |
|
| 135 | + */ |
|
| 136 | + public function selectForSources($objects, $targetClass, $linkType = null) |
|
| 137 | + { |
|
| 138 | + $sourceClass = null; |
|
| 139 | + $sourceIds = array(); |
|
| 140 | + |
|
| 141 | + foreach ($objects as $obj) { |
|
| 142 | + if (is_null($sourceClass)) { |
|
| 143 | + $sourceClass = get_class($obj); |
|
| 144 | + } |
|
| 145 | + $sourceIds[] = $obj->id; |
|
| 146 | + } |
|
| 147 | + $criteria = $this->sourceId->in($sourceIds) |
|
| 148 | + ->_AND_($this->sourceClass->is($sourceClass)); |
|
| 149 | + |
|
| 150 | + if (isset($targetClass)) { |
|
| 151 | + $this->joinTarget($targetClass); |
|
| 152 | + $criteria = $criteria->_AND_($this->targetClass->is($targetClass)); |
|
| 153 | + } |
|
| 154 | + |
|
| 155 | + if (isset($linkType)) { |
|
| 156 | + if (is_array($linkType)) { |
|
| 157 | + $criteria = $criteria->_AND_($this->type->in($linkType)); |
|
| 158 | + } else { |
|
| 159 | + $criteria = $criteria->_AND_($this->type->is($linkType)); |
|
| 160 | + } |
|
| 161 | + } |
|
| 162 | + return $this->select($criteria); |
|
| 163 | + } |
|
| 164 | + |
|
| 165 | + |
|
| 166 | + /** |
|
| 167 | + * |
|
| 168 | + * @return ORM_Iterator |
|
| 169 | + */ |
|
| 170 | + public function selectForTarget(app_Record $object, $sourceClass = null, $linkType = null) |
|
| 171 | + { |
|
| 172 | + $criteria = $this->targetId->is($object->id) |
|
| 173 | + ->_AND_($this->targetClass->is(get_class($object))); |
|
| 174 | + |
|
| 175 | + if (isset($sourceClass)) { |
|
| 176 | + $this->joinSource($sourceClass); |
|
| 177 | + $criteria = $criteria->_AND_($this->sourceClass->is($sourceClass)); |
|
| 178 | + } |
|
| 179 | + |
|
| 180 | + if (isset($linkType)) { |
|
| 181 | + if (is_array($linkType)) { |
|
| 182 | + $criteria = $criteria->_AND_($this->type->in($linkType)); |
|
| 183 | + } else { |
|
| 184 | + $criteria = $criteria->_AND_($this->type->is($linkType)); |
|
| 185 | + } |
|
| 186 | + } |
|
| 187 | + |
|
| 188 | + return $this->select($criteria); |
|
| 189 | + } |
|
| 190 | + |
|
| 191 | + |
|
| 192 | + /** |
|
| 193 | + * |
|
| 194 | + * @return ORM_Iterator |
|
| 195 | + */ |
|
| 196 | + public function selectForTargets($objects, $sourceClass = null, $linkType = null) |
|
| 197 | + { |
|
| 198 | + $targetClass = null; |
|
| 199 | + $targetIds = array(); |
|
| 200 | + |
|
| 201 | + foreach ($objects as $obj) { |
|
| 202 | + if (is_null($targetClass)) { |
|
| 203 | + $targetClass = get_class($obj); |
|
| 204 | + } |
|
| 205 | + $targetIds[] = $obj->id; |
|
| 206 | + } |
|
| 207 | + $criteria = $this->targetId->in($targetIds) |
|
| 208 | + ->_AND_($this->targetClass->is($targetClass)); |
|
| 209 | + |
|
| 210 | + if (isset($sourceClass)) { |
|
| 211 | + $this->joinSource($sourceClass); |
|
| 212 | + $criteria = $criteria->_AND_($this->sourceClass->is($sourceClass)); |
|
| 213 | + } |
|
| 214 | + |
|
| 215 | + if (isset($linkType)) { |
|
| 216 | + if (is_array($linkType)) { |
|
| 217 | + $criteria = $criteria->_AND_($this->type->in($linkType)); |
|
| 218 | + } else { |
|
| 219 | + $criteria = $criteria->_AND_($this->type->is($linkType)); |
|
| 220 | + } |
|
| 221 | + } |
|
| 222 | + |
|
| 223 | + return $this->select($criteria); |
|
| 224 | + } |
|
| 225 | + |
|
| 226 | + |
|
| 227 | + |
|
| 228 | + /** |
|
| 229 | + * delete all links to an object |
|
| 230 | + * |
|
| 231 | + * @param app_Record $object |
|
| 232 | + * @param string $targetClass if target class is set, links will be deleted only for target classes |
|
| 233 | + * @param bool $deleteTarget if set to true, the target will be deleted to |
|
| 234 | + */ |
|
| 235 | + public function deleteForSource(app_Record $object, $targetClass = null, $deleteTarget = false, $linkType = null) |
|
| 236 | + { |
|
| 237 | + $set = clone $this; |
|
| 238 | + $App = $object->App(); |
|
| 239 | + |
|
| 240 | + $criteria = $set->sourceId->is($object->id)->_AND_( |
|
| 241 | + $set->sourceClass->is(get_class($object)) |
|
| 242 | + ); |
|
| 243 | + |
|
| 244 | + if (null !== $targetClass) { |
|
| 245 | + $criteria = $criteria->_AND_( |
|
| 246 | + $set->targetClass->is($targetClass) |
|
| 247 | + ); |
|
| 248 | + } |
|
| 249 | + if (null !== $linkType) { |
|
| 250 | + $criteria = $criteria->_AND_( |
|
| 251 | + $set->type->is($linkType) |
|
| 252 | + ); |
|
| 253 | + } |
|
| 254 | + |
|
| 255 | + if ($deleteTarget) { |
|
| 256 | + foreach($set->select($criteria) as $link) { |
|
| 257 | + |
|
| 258 | + $className = $link->targetClass.'Set'; |
|
| 259 | + |
|
| 260 | + // remove prefix |
|
| 261 | + |
|
| 262 | + $className = mb_substr($className, 1 + mb_strpos($className, '_')); |
|
| 263 | + $targetSet = $App->$className(); |
|
| 264 | + |
|
| 265 | + $targetSet->delete($targetSet->id->is($link->targetId)); |
|
| 266 | + } |
|
| 267 | + } |
|
| 268 | + |
|
| 269 | + return $set->delete($criteria); |
|
| 270 | + } |
|
| 271 | 271 | |
| 272 | 272 | |
| 273 | 273 | /** |
@@ -74,8 +74,8 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | public function joinSource($sourceClass) |
| 76 | 76 | { |
| 77 | - if (get_class($this->sourceId) !== $sourceClass . 'Set') { |
|
| 78 | - $this->hasOne('sourceId', $sourceClass . 'Set'); |
|
| 77 | + if (get_class($this->sourceId) !== $sourceClass.'Set') { |
|
| 78 | + $this->hasOne('sourceId', $sourceClass.'Set'); |
|
| 79 | 79 | $this->join('sourceId'); |
| 80 | 80 | } |
| 81 | 81 | } |
@@ -86,8 +86,8 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | public function joinTarget($targetClass = null) |
| 88 | 88 | { |
| 89 | - if (get_class($this->targetId) !== $targetClass . 'Set') { |
|
| 90 | - $this->hasOne('targetId', $targetClass . 'Set'); |
|
| 89 | + if (get_class($this->targetId) !== $targetClass.'Set') { |
|
| 90 | + $this->hasOne('targetId', $targetClass.'Set'); |
|
| 91 | 91 | $this->join('targetId'); |
| 92 | 92 | } |
| 93 | 93 | } |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | } |
| 254 | 254 | |
| 255 | 255 | if ($deleteTarget) { |
| 256 | - foreach($set->select($criteria) as $link) { |
|
| 256 | + foreach ($set->select($criteria) as $link) { |
|
| 257 | 257 | |
| 258 | 258 | $className = $link->targetClass.'Set'; |
| 259 | 259 | |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | return parent::delete($criteria); |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | - require_once $GLOBALS['babInstallPath'] . '/utilit/dateTime.php'; |
|
| 242 | + require_once $GLOBALS['babInstallPath'].'/utilit/dateTime.php'; |
|
| 243 | 243 | $now = BAB_DateTime::now()->getIsoDateTime(); |
| 244 | 244 | |
| 245 | 245 | $records = $this->select($criteria); |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | return parent::save($record); |
| 275 | 275 | } |
| 276 | 276 | |
| 277 | - require_once $GLOBALS['babInstallPath'] . '/utilit/dateTime.php'; |
|
| 277 | + require_once $GLOBALS['babInstallPath'].'/utilit/dateTime.php'; |
|
| 278 | 278 | |
| 279 | 279 | $now = BAB_DateTime::now()->getIsoDateTime(); |
| 280 | 280 | |
@@ -304,11 +304,11 @@ discard block |
||
| 304 | 304 | */ |
| 305 | 305 | private function uuid() |
| 306 | 306 | { |
| 307 | - return sprintf( '%04x%04x-%04x-%04x-%04x-%04x%04x%04x', |
|
| 308 | - mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), |
|
| 309 | - mt_rand( 0, 0x0fff ) | 0x4000, |
|
| 310 | - mt_rand( 0, 0x3fff ) | 0x8000, |
|
| 311 | - mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ) ); |
|
| 307 | + return sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x', |
|
| 308 | + mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff), |
|
| 309 | + mt_rand(0, 0x0fff) | 0x4000, |
|
| 310 | + mt_rand(0, 0x3fff) | 0x8000, |
|
| 311 | + mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff)); |
|
| 312 | 312 | } |
| 313 | 313 | |
| 314 | 314 | /** |
@@ -398,7 +398,7 @@ discard block |
||
| 398 | 398 | |
| 399 | 399 | $linkSet->hasOne('sourceId', get_class($this)); |
| 400 | 400 | |
| 401 | - $criteria = $linkSet->targetClass->is(get_class($target)) |
|
| 401 | + $criteria = $linkSet->targetClass->is(get_class($target)) |
|
| 402 | 402 | ->_AND_($linkSet->targetId->is($target->id)) |
| 403 | 403 | ->_AND_($linkSet->sourceClass->is($this->getRecordClassName())); |
| 404 | 404 | if (isset($linkType)) { |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | |
| 429 | 429 | $linkSet->hasOne('targetId', get_class($this)); |
| 430 | 430 | |
| 431 | - $criteria = $linkSet->sourceClass->is(get_class($source)) |
|
| 431 | + $criteria = $linkSet->sourceClass->is(get_class($source)) |
|
| 432 | 432 | ->_AND_($linkSet->sourceId->is($source->id)) |
| 433 | 433 | ->_AND_($linkSet->targetClass->is($this->getRecordClassName())); |
| 434 | 434 | if (isset($linkType)) { |
@@ -472,7 +472,7 @@ discard block |
||
| 472 | 472 | $sourcesCriteria[] = $linkSet->sourceClass->is($sourceClass)->_AND_($linkSet->sourceId->in($sourceIds)); |
| 473 | 473 | } |
| 474 | 474 | |
| 475 | - $criteria = $linkSet->all( |
|
| 475 | + $criteria = $linkSet->all( |
|
| 476 | 476 | $linkSet->targetClass->is($this->getRecordClassName()), |
| 477 | 477 | $linkSet->any($sourcesCriteria) |
| 478 | 478 | ); |
@@ -517,7 +517,7 @@ discard block |
||
| 517 | 517 | $targetsCriteria[] = $linkSet->targetClass->is($targetClass)->_AND_($linkSet->targetId->in($targetIds)); |
| 518 | 518 | } |
| 519 | 519 | |
| 520 | - $criteria = $linkSet->all( |
|
| 520 | + $criteria = $linkSet->all( |
|
| 521 | 521 | $linkSet->sourceClass->is($this->getRecordClassName()), |
| 522 | 522 | $linkSet->any($targetsCriteria) |
| 523 | 523 | ); |
@@ -575,7 +575,7 @@ discard block |
||
| 575 | 575 | { |
| 576 | 576 | $linkSet = $this->App()->LinkSet(); |
| 577 | 577 | |
| 578 | - $criteria = $linkSet->sourceClass->is(get_class($source)) |
|
| 578 | + $criteria = $linkSet->sourceClass->is(get_class($source)) |
|
| 579 | 579 | ->_AND_($linkSet->sourceId->is($source->id)) |
| 580 | 580 | ->_AND_($linkSet->targetClass->is(get_class($this))) |
| 581 | 581 | ->_AND_($linkSet->targetId->is($this->id)); |
@@ -605,7 +605,7 @@ discard block |
||
| 605 | 605 | { |
| 606 | 606 | $linkSet = $this->App()->LinkSet(); |
| 607 | 607 | |
| 608 | - $criteria = $linkSet->targetClass->is(get_class($target)) |
|
| 608 | + $criteria = $linkSet->targetClass->is(get_class($target)) |
|
| 609 | 609 | ->_AND_($linkSet->targetId->is($target->id)) |
| 610 | 610 | ->_AND_($linkSet->sourceClass->is(get_class($this))) |
| 611 | 611 | ->_AND_($linkSet->sourceId->is($this->id)); |
@@ -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 | |
@@ -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,15 +21,15 @@ |
||
| 21 | 21 | * @copyright Copyright (c) 2006 by CANTICO ({@link http://www.cantico.fr}) |
| 22 | 22 | */ |
| 23 | 23 | |
| 24 | -define('APP_PHP_PATH', dirname(__FILE__) . '/'); |
|
| 25 | -define('APP_SET_PATH', dirname(__FILE__) . '/'); |
|
| 26 | -define('APP_UI_PATH', dirname(__FILE__) . '/ui/'); |
|
| 27 | -define('APP_CTRL_PATH', dirname(__FILE__) . '/'); |
|
| 24 | +define('APP_PHP_PATH', dirname(__FILE__).'/'); |
|
| 25 | +define('APP_SET_PATH', dirname(__FILE__).'/'); |
|
| 26 | +define('APP_UI_PATH', dirname(__FILE__).'/ui/'); |
|
| 27 | +define('APP_CTRL_PATH', dirname(__FILE__).'/'); |
|
| 28 | 28 | |
| 29 | -require_once APP_PHP_PATH . 'base.class.php'; |
|
| 30 | -require_once APP_UI_PATH . 'base.ui.php'; |
|
| 29 | +require_once APP_PHP_PATH.'base.class.php'; |
|
| 30 | +require_once APP_UI_PATH.'base.ui.php'; |
|
| 31 | 31 | |
| 32 | -require_once $GLOBALS['babInstallPath'] . 'utilit/dateTime.php'; |
|
| 32 | +require_once $GLOBALS['babInstallPath'].'utilit/dateTime.php'; |
|
| 33 | 33 | |
| 34 | 34 | |
| 35 | 35 | |
@@ -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 | |
@@ -34,13 +34,13 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | public function includeBase() |
| 36 | 36 | { |
| 37 | - require_once APP_UI_PATH . 'base.ui.php'; |
|
| 38 | - require_once APP_UI_PATH . 'ui.helpers.php'; |
|
| 37 | + require_once APP_UI_PATH.'base.ui.php'; |
|
| 38 | + require_once APP_UI_PATH.'ui.helpers.php'; |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | public function includePage() |
| 42 | 42 | { |
| 43 | - require_once APP_UI_PATH . 'page.class.php'; |
|
| 43 | + require_once APP_UI_PATH.'page.class.php'; |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | /** |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | */ |
| 78 | 78 | public function ExportSelectEditor($id, app_TableModelView $tableview, $filter = null) |
| 79 | 79 | { |
| 80 | - require_once dirname(__FILE__) . '/exportselect.ui.php'; |
|
| 80 | + require_once dirname(__FILE__).'/exportselect.ui.php'; |
|
| 81 | 81 | return new app_ExportSelectEditor($this->App(), $id, $tableview, $filter); |
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | \ No newline at end of file |