@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | */ |
23 | 23 | |
24 | 24 | |
25 | -require_once dirname(__FILE__) . '/controller.class.php'; |
|
25 | +require_once dirname(__FILE__).'/controller.class.php'; |
|
26 | 26 | |
27 | 27 | |
28 | 28 | /** |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | public function display() |
35 | 35 | { |
36 | 36 | $App = $this->App(); |
37 | - if(!bab_isUserAdministrator()) { |
|
37 | + if (!bab_isUserAdministrator()) { |
|
38 | 38 | throw new app_AccessException($App->translate('You do not have access to this page')); |
39 | 39 | } |
40 | 40 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | public function configureSSE() |
74 | 74 | { |
75 | 75 | $App = $this->App(); |
76 | - if(!bab_isUserAdministrator()) { |
|
76 | + if (!bab_isUserAdministrator()) { |
|
77 | 77 | throw new app_AccessException($App->translate('You do not have access to this page')); |
78 | 78 | } |
79 | 79 |
@@ -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 | |
@@ -45,11 +45,11 @@ discard block |
||
45 | 45 | protected function getRecordClassName() |
46 | 46 | { |
47 | 47 | $class = $this->getClass(); |
48 | - if(strpos($class, 'Controller') !== false){ |
|
48 | + if (strpos($class, 'Controller') !== false) { |
|
49 | 49 | $App = $this->App(); |
50 | 50 | $componentName = strtoupper(str_replace('Controller', '', $class)); |
51 | 51 | $component = $App->getComponentByName($componentName); |
52 | - if($component){ |
|
52 | + if ($component) { |
|
53 | 53 | list(, $recordClassname) = explode($App->classPrefix, $component->getRecordClassName()); |
54 | 54 | return $recordClassname; |
55 | 55 | } |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | $App = $this->App(); |
72 | 72 | |
73 | 73 | $recordClassname = $this->getRecordClassName(); |
74 | - $recordSetClassname = $recordClassname . 'Set'; |
|
74 | + $recordSetClassname = $recordClassname.'Set'; |
|
75 | 75 | |
76 | 76 | $recordSet = $App->$recordSetClassname(); |
77 | 77 | return $recordSet; |
@@ -123,9 +123,9 @@ discard block |
||
123 | 123 | if ($showLabel) { |
124 | 124 | $text = $actions->getTitle(); |
125 | 125 | } |
126 | - $html = '<li><a class="icon ' . $actions->getIcon() . '" href="' . $actions->url() . '">' . $text . '</a></li>'; |
|
126 | + $html = '<li><a class="icon '.$actions->getIcon().'" href="'.$actions->url().'">'.$text.'</a></li>'; |
|
127 | 127 | } elseif ($actions instanceof Widget_Link) { |
128 | - $html = '<li>' . $actions->display($canvas) . '</li>'; |
|
128 | + $html = '<li>'.$actions->display($canvas).'</li>'; |
|
129 | 129 | } elseif (is_array($actions)) { |
130 | 130 | if (isset($actions['items'])) { |
131 | 131 | $items = $actions['items']; |
@@ -138,10 +138,10 @@ discard block |
||
138 | 138 | if (isset($actions['icon'])) { |
139 | 139 | |
140 | 140 | $html = '<li class="dropdown">' |
141 | - . '<a href="#" class="' . $actions['icon'] . ' icon dropdown-toogle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">' |
|
141 | + . '<a href="#" class="'.$actions['icon'].' icon dropdown-toogle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">' |
|
142 | 142 | . ($actions['icon'] === 'actions-context-menu'/*Func_Icons::ACTIONS_CONTEXT_MENU*/ ? '' : '<span class="caret"></span>') |
143 | 143 | . '</a>' |
144 | - . '<ul class="dropdown-menu dropdown-menu-right ' . Func_Icons::ICON_LEFT_SYMBOLIC . '">' |
|
144 | + . '<ul class="dropdown-menu dropdown-menu-right '.Func_Icons::ICON_LEFT_SYMBOLIC.'">' |
|
145 | 145 | . $html |
146 | 146 | . '</ul>'; |
147 | 147 | } |
@@ -191,10 +191,10 @@ discard block |
||
191 | 191 | 'label' => $App->translate('Statistics') |
192 | 192 | ); |
193 | 193 | |
194 | - foreach ($methods as $index => $method){ |
|
195 | - try{ |
|
194 | + foreach ($methods as $index => $method) { |
|
195 | + try { |
|
196 | 196 | $methodName = $recordClassname.$method['method']; |
197 | - if($Ui->$methodName()){ |
|
197 | + if ($Ui->$methodName()) { |
|
198 | 198 | $types[$index] = array( |
199 | 199 | 'classname' => $methodName, |
200 | 200 | 'icon' => $method['icon'], |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | ); |
203 | 203 | } |
204 | 204 | } |
205 | - catch(Exception $e){ |
|
205 | + catch (Exception $e) { |
|
206 | 206 | unset($types[$index]); |
207 | 207 | continue; |
208 | 208 | } |
@@ -316,12 +316,12 @@ discard block |
||
316 | 316 | $W = bab_Widgets(); |
317 | 317 | |
318 | 318 | $recordClassname = $this->getRecordClassName(); |
319 | - $editorClassname = $recordClassname . 'SectionEditor'; |
|
319 | + $editorClassname = $recordClassname.'SectionEditor'; |
|
320 | 320 | |
321 | 321 | /* @var $editor app_RecordEditor */ |
322 | 322 | $editor = $Ui->$editorClassname($record); |
323 | 323 | if (!isset($itemId)) { |
324 | - $itemId = $this->getClass() . '_' . __FUNCTION__; |
|
324 | + $itemId = $this->getClass().'_'.__FUNCTION__; |
|
325 | 325 | } |
326 | 326 | $editor->setId($itemId); |
327 | 327 | $editor->setController($this); |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | public function getModelViewDefaultId($itemId = null) |
349 | 349 | { |
350 | 350 | if (!isset($itemId)) { |
351 | - $itemId = $this->getClass() . '_modelView'; |
|
351 | + $itemId = $this->getClass().'_modelView'; |
|
352 | 352 | } |
353 | 353 | |
354 | 354 | return $itemId; |
@@ -382,24 +382,24 @@ discard block |
||
382 | 382 | |
383 | 383 | switch ($type) { |
384 | 384 | case 'cards': |
385 | - $tableviewClassname = $recordClassname . 'CardsView'; |
|
385 | + $tableviewClassname = $recordClassname.'CardsView'; |
|
386 | 386 | break; |
387 | 387 | |
388 | 388 | case 'map': |
389 | - $tableviewClassname = $recordClassname . 'MapView'; |
|
389 | + $tableviewClassname = $recordClassname.'MapView'; |
|
390 | 390 | break; |
391 | 391 | |
392 | 392 | case 'calendar': |
393 | - $tableviewClassname = $recordClassname . 'CalendarView'; |
|
393 | + $tableviewClassname = $recordClassname.'CalendarView'; |
|
394 | 394 | break; |
395 | 395 | |
396 | 396 | case 'statistics': |
397 | - $tableviewClassname = $recordClassname . 'StatisticsView'; |
|
397 | + $tableviewClassname = $recordClassname.'StatisticsView'; |
|
398 | 398 | break; |
399 | 399 | |
400 | 400 | case 'table': |
401 | 401 | default: |
402 | - $tableviewClassname = $recordClassname . 'TableView'; |
|
402 | + $tableviewClassname = $recordClassname.'TableView'; |
|
403 | 403 | break; |
404 | 404 | } |
405 | 405 | |
@@ -464,11 +464,11 @@ discard block |
||
464 | 464 | $App = $this->App(); |
465 | 465 | $Ui = $App->Ui(); |
466 | 466 | $recordClassname = $this->getRecordClassName(); |
467 | - $editorClassname = $recordClassname . 'Editor'; |
|
467 | + $editorClassname = $recordClassname.'Editor'; |
|
468 | 468 | $editor = $Ui->$editorClassname(); |
469 | 469 | |
470 | 470 | if (!isset($itemId)) { |
471 | - $itemId = $this->getClass() . '_' . __FUNCTION__; |
|
471 | + $itemId = $this->getClass().'_'.__FUNCTION__; |
|
472 | 472 | } |
473 | 473 | $editor->setId($itemId); |
474 | 474 | $editor->setHiddenValue('tg', $App->controllerTg); |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | $W->Link( |
526 | 526 | '', |
527 | 527 | $proxy->setFilteredViewType($tableView->getId(), $viewTypeId) |
528 | - )->addClass('icon', $viewType['icon'] . ($filteredViewType=== $viewTypeId ? ' active' : '')) |
|
528 | + )->addClass('icon', $viewType['icon'].($filteredViewType === $viewTypeId ? ' active' : '')) |
|
529 | 529 | // ->setSizePolicy('btn btn-xs btn-default ' . ($filteredViewType === $viewTypeId ? 'active' : '')) |
530 | 530 | ->setTitle($viewType['label']) |
531 | 531 | ->setAjaxAction() |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | |
570 | 570 | $filterVisibility = $this->getFilterVisibility($itemId); |
571 | 571 | $filterVisibility = !$filterVisibility; |
572 | - $W->setUserConfiguration($itemId . '/filterVisibility', $filterVisibility); |
|
572 | + $W->setUserConfiguration($itemId.'/filterVisibility', $filterVisibility); |
|
573 | 573 | |
574 | 574 | return true; |
575 | 575 | } |
@@ -582,10 +582,10 @@ discard block |
||
582 | 582 | protected function getFilterVisibility($itemId) |
583 | 583 | { |
584 | 584 | $W = bab_Widgets(); |
585 | - $filterVisibility = $W->getUserConfiguration($itemId . '/filterVisibility'); |
|
585 | + $filterVisibility = $W->getUserConfiguration($itemId.'/filterVisibility'); |
|
586 | 586 | if (!isset($filterVisibility)) { |
587 | 587 | $filterVisibility = false; |
588 | - $W->setUserConfiguration($itemId . '/filterVisibility', $filterVisibility); |
|
588 | + $W->setUserConfiguration($itemId.'/filterVisibility', $filterVisibility); |
|
589 | 589 | } |
590 | 590 | return $filterVisibility; |
591 | 591 | } |
@@ -599,7 +599,7 @@ discard block |
||
599 | 599 | protected function getFilteredViewType($itemId) |
600 | 600 | { |
601 | 601 | $W = bab_Widgets(); |
602 | - $type = $W->getUserConfiguration($itemId . '/viewType'); |
|
602 | + $type = $W->getUserConfiguration($itemId.'/viewType'); |
|
603 | 603 | if (!isset($type)) { |
604 | 604 | $type = 'table'; |
605 | 605 | } |
@@ -615,7 +615,7 @@ discard block |
||
615 | 615 | public function setFilteredViewType($itemId, $type = null) |
616 | 616 | { |
617 | 617 | $W = bab_Widgets(); |
618 | - $W->setUserConfiguration($itemId . '/viewType', $type); |
|
618 | + $W->setUserConfiguration($itemId.'/viewType', $type); |
|
619 | 619 | |
620 | 620 | return true; |
621 | 621 | } |
@@ -700,14 +700,14 @@ discard block |
||
700 | 700 | $tableModelViewId = $data['tableModelViewId']; |
701 | 701 | $sessionOnly = isset($data['inSession']) ? $data['inSession'] : false; |
702 | 702 | |
703 | - if(isset($data['pageLength'])){ |
|
704 | - $W->setUserConfiguration($tableModelViewId . '/pageLength', $data['pageLength'], 'widgets', $sessionOnly); |
|
703 | + if (isset($data['pageLength'])) { |
|
704 | + $W->setUserConfiguration($tableModelViewId.'/pageLength', $data['pageLength'], 'widgets', $sessionOnly); |
|
705 | 705 | } |
706 | - if(isset($data['displaySubTotalRow'])){ |
|
707 | - $W->setUserConfiguration($tableModelViewId . '/displaySubTotalRow', $data['displaySubTotalRow'], 'widgets', $sessionOnly); |
|
706 | + if (isset($data['displaySubTotalRow'])) { |
|
707 | + $W->setUserConfiguration($tableModelViewId.'/displaySubTotalRow', $data['displaySubTotalRow'], 'widgets', $sessionOnly); |
|
708 | 708 | } |
709 | - if(isset($data['columns'])){ |
|
710 | - $W->setUserConfiguration($tableModelViewId . '/columns', $data['columns'], 'widgets', $sessionOnly); |
|
709 | + if (isset($data['columns'])) { |
|
710 | + $W->setUserConfiguration($tableModelViewId.'/columns', $data['columns'], 'widgets', $sessionOnly); |
|
711 | 711 | } |
712 | 712 | |
713 | 713 | $this->addReloadSelector("#{$tableModelViewId}"); |
@@ -810,7 +810,7 @@ discard block |
||
810 | 810 | $columns = $tableview->getVisibleColumns(); |
811 | 811 | $column = isset($columns[$col]) ? $columns[$col] : null; |
812 | 812 | |
813 | - if(!isset($column)){ |
|
813 | + if (!isset($column)) { |
|
814 | 814 | return true; |
815 | 815 | } |
816 | 816 | |
@@ -827,8 +827,8 @@ discard block |
||
827 | 827 | ) |
828 | 828 | ); |
829 | 829 | |
830 | - $filter = $W->getUserConfiguration($key . '/filter', 'widgets', false); |
|
831 | - if(isset($filter[$col])){ |
|
830 | + $filter = $W->getUserConfiguration($key.'/filter', 'widgets', false); |
|
831 | + if (isset($filter[$col])) { |
|
832 | 832 | $widget->setValue($filter[$col]); |
833 | 833 | } |
834 | 834 | |
@@ -844,21 +844,21 @@ discard block |
||
844 | 844 | |
845 | 845 | $key = $data['key']; |
846 | 846 | |
847 | - $filter = $W->getUserConfiguration($key . '/filter', 'widgets', false); |
|
848 | - if(isset($data['moreCriteria']) && $data['moreCriteria']){ |
|
847 | + $filter = $W->getUserConfiguration($key.'/filter', 'widgets', false); |
|
848 | + if (isset($data['moreCriteria']) && $data['moreCriteria']) { |
|
849 | 849 | $filter = array(); |
850 | 850 | } |
851 | - foreach ($data['filter'] as $filterName => $filterValue){ |
|
851 | + foreach ($data['filter'] as $filterName => $filterValue) { |
|
852 | 852 | $filter[$filterName] = $filterValue; |
853 | 853 | } |
854 | - $W->setUserConfiguration($key . '/filter', $filter, 'widgets', false); |
|
854 | + $W->setUserConfiguration($key.'/filter', $filter, 'widgets', false); |
|
855 | 855 | |
856 | 856 | session_start(); |
857 | 857 | $_SESSION['modelViewMoreCriterias'][$key] = array(); |
858 | 858 | unset($_SESSION['modelViewMoreCriterias'][$key]); |
859 | 859 | session_write_close(); |
860 | 860 | |
861 | - $this->addReloadSelector('.depends-' . $key); |
|
861 | + $this->addReloadSelector('.depends-'.$key); |
|
862 | 862 | |
863 | 863 | return true; |
864 | 864 | } |
@@ -905,16 +905,16 @@ discard block |
||
905 | 905 | $columns = $tableview->getVisibleColumns(); |
906 | 906 | $filter = $tableview->getFilterValues(); |
907 | 907 | |
908 | - if(!isset($itemId)){ |
|
908 | + if (!isset($itemId)) { |
|
909 | 909 | $editor->setSaveAction($this->proxy()->saveDisplayListFilter(), $App->translate('Search')); |
910 | 910 | $editor->setCancelAction($this->proxy()->cancel()); |
911 | 911 | |
912 | 912 | $fields = array(); |
913 | - foreach ($filter as $fieldName => $value){ |
|
914 | - if(empty($value)){ |
|
913 | + foreach ($filter as $fieldName => $value) { |
|
914 | + if (empty($value)) { |
|
915 | 915 | continue; |
916 | 916 | } |
917 | - if(!isset($columns[$fieldName])){ |
|
917 | + if (!isset($columns[$fieldName])) { |
|
918 | 918 | continue; |
919 | 919 | } |
920 | 920 | |
@@ -930,7 +930,7 @@ discard block |
||
930 | 930 | $_SESSION['modelViewMoreCriterias'][$key] = $fields; |
931 | 931 | session_write_close(); |
932 | 932 | } |
933 | - else{ |
|
933 | + else { |
|
934 | 934 | $fields = $_SESSION['modelViewMoreCriterias'][$key]; |
935 | 935 | } |
936 | 936 | |
@@ -939,8 +939,8 @@ discard block |
||
939 | 939 | $nbAlreadyAdded = 0; |
940 | 940 | |
941 | 941 | |
942 | - foreach ($fields as $fieldName => $fieldValue){ |
|
943 | - if(!isset($columns[$fieldName])){ |
|
942 | + foreach ($fields as $fieldName => $fieldValue) { |
|
943 | + if (!isset($columns[$fieldName])) { |
|
944 | 944 | continue; |
945 | 945 | } |
946 | 946 | $column = $columns[$fieldName]; |
@@ -951,12 +951,12 @@ discard block |
||
951 | 951 | |
952 | 952 | $field = $column->getField(); |
953 | 953 | |
954 | - if($nbAlreadyAdded >= 2){ |
|
954 | + if ($nbAlreadyAdded >= 2) { |
|
955 | 955 | $nbAlreadyAdded = 0; |
956 | 956 | $alreadyFilteredBox = null; |
957 | 957 | } |
958 | 958 | |
959 | - if(!isset($alreadyFilteredBox)){ |
|
959 | + if (!isset($alreadyFilteredBox)) { |
|
960 | 960 | $editor->addItem( |
961 | 961 | $alreadyFilteredBox = $W->FlexItems()->setSizePolicy('customsection-field-box customsection-fieldsgroup-box') |
962 | 962 | ); |
@@ -976,7 +976,7 @@ discard block |
||
976 | 976 | $this->proxy()->removeMoreCriteriaField($key, $fieldName) |
977 | 977 | )->setAjaxAction() |
978 | 978 | ->addClass('icon', Func_Icons::STATUS_DIALOG_ERROR) |
979 | - ->addAttribute('data-removefor', $fieldName) |
|
979 | + ->addAttribute('data-removefor', $fieldName) |
|
980 | 980 | )->setJustifyContent(Widget_FlexLayout::FLEX_JUSTIFY_CONTENT_SPACE_BETWEEN)->setAlignItems(Widget_FlexLayout::FLEX_ALIGN_CONTENT_CENTER) |
981 | 981 | )->addClass('app-customsection-groupedfield app-displaylist-morecriteria-groupedfield') |
982 | 982 | ); |
@@ -994,19 +994,19 @@ discard block |
||
994 | 994 | |
995 | 995 | $field = $column->getField(); |
996 | 996 | |
997 | - if(isset($alreadyAddedFilters[$fieldName])){ |
|
997 | + if (isset($alreadyAddedFilters[$fieldName])) { |
|
998 | 998 | continue; |
999 | 999 | } |
1000 | 1000 | |
1001 | 1001 | $label = $tableview->getFilterLabelWidget($fieldName, $field); |
1002 | 1002 | $label = trim($label->getText()); |
1003 | - if(empty($label)){ |
|
1003 | + if (empty($label)) { |
|
1004 | 1004 | continue; |
1005 | 1005 | } |
1006 | 1006 | $options[$fieldName] = $label; |
1007 | 1007 | } |
1008 | 1008 | |
1009 | - if(count($options) > 1){ |
|
1009 | + if (count($options) > 1) { |
|
1010 | 1010 | $editor->addItem($W->Html('<hr/>')); |
1011 | 1011 | $editor->addItem( |
1012 | 1012 | $W->FlexItems( |
@@ -1028,7 +1028,7 @@ discard block |
||
1028 | 1028 | { |
1029 | 1029 | session_start(); |
1030 | 1030 | $fields = isset($data['filter']) ? $data['filter'] : array(); |
1031 | - if(isset($data['newField']) && !empty($data['newField'])){ |
|
1031 | + if (isset($data['newField']) && !empty($data['newField'])) { |
|
1032 | 1032 | $newField = $data['newField']; |
1033 | 1033 | unset($data['key']); |
1034 | 1034 | unset($data['moreCriteria']); |
@@ -1042,7 +1042,7 @@ discard block |
||
1042 | 1042 | public function removeMoreCriteriaField($key, $field) |
1043 | 1043 | { |
1044 | 1044 | $fields = $_SESSION['modelViewMoreCriterias'][$key]; |
1045 | - if(isset($fields[$field])){ |
|
1045 | + if (isset($fields[$field])) { |
|
1046 | 1046 | unset($fields[$field]); |
1047 | 1047 | session_start(); |
1048 | 1048 | $_SESSION['modelViewMoreCriterias'][$key] = $fields; |
@@ -1109,17 +1109,17 @@ discard block |
||
1109 | 1109 | |
1110 | 1110 | switch ($format) { |
1111 | 1111 | case 'xlsx': |
1112 | - $tableview->downloadXlsx($filename . '.xlsx'); |
|
1112 | + $tableview->downloadXlsx($filename.'.xlsx'); |
|
1113 | 1113 | break; |
1114 | 1114 | case 'xls': |
1115 | - $tableview->downloadExcel($filename . '.xls'); |
|
1115 | + $tableview->downloadExcel($filename.'.xls'); |
|
1116 | 1116 | break; |
1117 | 1117 | case 'ssv': |
1118 | - $tableview->downloadCsv($filename . '.csv', ';', $inline, 'Windows-1252'); |
|
1118 | + $tableview->downloadCsv($filename.'.csv', ';', $inline, 'Windows-1252'); |
|
1119 | 1119 | break; |
1120 | 1120 | case 'csv': |
1121 | 1121 | default: |
1122 | - $tableview->downloadCsv($filename . '.csv', ',', $inline, bab_charset::getIso()); |
|
1122 | + $tableview->downloadCsv($filename.'.csv', ',', $inline, bab_charset::getIso()); |
|
1123 | 1123 | break; |
1124 | 1124 | } |
1125 | 1125 | } |
@@ -1199,7 +1199,7 @@ discard block |
||
1199 | 1199 | |
1200 | 1200 | $recordClassname = $this->getRecordClassName(); |
1201 | 1201 | |
1202 | - $viewClassname = $recordClassname . 'FullFrame'; |
|
1202 | + $viewClassname = $recordClassname.'FullFrame'; |
|
1203 | 1203 | |
1204 | 1204 | $fullFrame = $Ui->$viewClassname($record); |
1205 | 1205 | $fullFrame->setView($view); |
@@ -1214,7 +1214,7 @@ discard block |
||
1214 | 1214 | if (isset($itemId)) { |
1215 | 1215 | $page->setId($itemId); |
1216 | 1216 | } |
1217 | - $page->addClass('depends-' . $this->getRecordClassName()); |
|
1217 | + $page->addClass('depends-'.$this->getRecordClassName()); |
|
1218 | 1218 | |
1219 | 1219 | $page->addToolbar($mainMenu); |
1220 | 1220 | |
@@ -1362,7 +1362,7 @@ discard block |
||
1362 | 1362 | |
1363 | 1363 | $recordTitle = $record->getRecordTitle(); |
1364 | 1364 | |
1365 | - $message = sprintf($App->translate('%s has been deleted'), $App->translate($recordSet->getDescription()) . ' "' . $recordTitle . '"'); |
|
1365 | + $message = sprintf($App->translate('%s has been deleted'), $App->translate($recordSet->getDescription()).' "'.$recordTitle.'"'); |
|
1366 | 1366 | return $message; |
1367 | 1367 | } |
1368 | 1368 | |
@@ -1460,7 +1460,7 @@ discard block |
||
1460 | 1460 | $this->addToast($message); |
1461 | 1461 | } |
1462 | 1462 | |
1463 | - $this->addReloadSelector('.depends-' . $this->getRecordClassName()); |
|
1463 | + $this->addReloadSelector('.depends-'.$this->getRecordClassName()); |
|
1464 | 1464 | return true; |
1465 | 1465 | } |
1466 | 1466 | |
@@ -1492,7 +1492,7 @@ discard block |
||
1492 | 1492 | $this->addToast($deletedMessage); |
1493 | 1493 | } |
1494 | 1494 | |
1495 | - $this->addReloadSelector('.depends-' . $record->getClassName()); |
|
1495 | + $this->addReloadSelector('.depends-'.$record->getClassName()); |
|
1496 | 1496 | |
1497 | 1497 | return true; |
1498 | 1498 | } |
@@ -1532,7 +1532,7 @@ discard block |
||
1532 | 1532 | |
1533 | 1533 | $recordTitle = $record->getRecordTitle(); |
1534 | 1534 | |
1535 | - $subTitle = $App->translate($recordSet->getDescription()) . ' "' . $recordTitle . '"'; |
|
1535 | + $subTitle = $App->translate($recordSet->getDescription()).' "'.$recordTitle.'"'; |
|
1536 | 1536 | $form->addItem($W->Title($subTitle, 5)); |
1537 | 1537 | |
1538 | 1538 | $form->addItem($W->Title($App->translate('Confirm delete?'), 6)); |
@@ -1591,7 +1591,7 @@ discard block |
||
1591 | 1591 | } |
1592 | 1592 | } |
1593 | 1593 | |
1594 | - $this->addReloadSelector('.depends-' . $record->getClassName()); |
|
1594 | + $this->addReloadSelector('.depends-'.$record->getClassName()); |
|
1595 | 1595 | |
1596 | 1596 | return true; |
1597 | 1597 | } |
@@ -1620,7 +1620,7 @@ discard block |
||
1620 | 1620 | |
1621 | 1621 | $recordTitle = $record->getRecordTitle(); |
1622 | 1622 | |
1623 | - $subTitle = $App->translate($recordSet->getDescription()) . ' "' . $recordTitle . '"'; |
|
1623 | + $subTitle = $App->translate($recordSet->getDescription()).' "'.$recordTitle.'"'; |
|
1624 | 1624 | $form->addItem($W->Title($subTitle, 5)); |
1625 | 1625 | |
1626 | 1626 | $form->addItem($W->Title($App->translate('Confirm delete?'), 6)); |
@@ -1664,7 +1664,7 @@ discard block |
||
1664 | 1664 | $record = null; |
1665 | 1665 | foreach ($records as $record) { |
1666 | 1666 | } |
1667 | - if (! isset($record)) { |
|
1667 | + if (!isset($record)) { |
|
1668 | 1668 | throw new app_AccessException('Sorry, You are not allowed to perform this operation'); |
1669 | 1669 | } |
1670 | 1670 | if (!$record->isRestorable()) { |
@@ -1678,7 +1678,7 @@ discard block |
||
1678 | 1678 | $record->save(); |
1679 | 1679 | $this->addToast($deletedMessage); |
1680 | 1680 | |
1681 | - $this->addReloadSelector('.depends-' . $record->getClassName()); |
|
1681 | + $this->addReloadSelector('.depends-'.$record->getClassName()); |
|
1682 | 1682 | |
1683 | 1683 | return true; |
1684 | 1684 | } |
@@ -1700,7 +1700,7 @@ discard block |
||
1700 | 1700 | $record = null; |
1701 | 1701 | foreach ($records as $record) { |
1702 | 1702 | } |
1703 | - if (! isset($record)) { |
|
1703 | + if (!isset($record)) { |
|
1704 | 1704 | throw new app_AccessException('Sorry, You are not allowed to perform this operation'); |
1705 | 1705 | } |
1706 | 1706 | |
@@ -1713,7 +1713,7 @@ discard block |
||
1713 | 1713 | |
1714 | 1714 | $recordTitle = $record->getRecordTitle(); |
1715 | 1715 | |
1716 | - $subTitle = $App->translate($recordSet->getDescription()) . ' "' . $recordTitle . '"'; |
|
1716 | + $subTitle = $App->translate($recordSet->getDescription()).' "'.$recordTitle.'"'; |
|
1717 | 1717 | $form->addItem($W->Title($subTitle, 5)); |
1718 | 1718 | |
1719 | 1719 | $confirmedAction = $this->proxy()->restore($id); |
@@ -1830,14 +1830,14 @@ discard block |
||
1830 | 1830 | $registry = bab_getRegistryInstance(); |
1831 | 1831 | |
1832 | 1832 | $userId = '0'; |
1833 | - $registry->changeDirectory('/widgets/user/' . $userId . '/' . $id. '/filters'); |
|
1833 | + $registry->changeDirectory('/widgets/user/'.$userId.'/'.$id.'/filters'); |
|
1834 | 1834 | |
1835 | 1835 | while ($filterName = $registry->fetchChildKey()) { |
1836 | 1836 | $filters[] = $filterName; |
1837 | 1837 | } |
1838 | 1838 | |
1839 | 1839 | $userId = bab_getUserId(); |
1840 | - $registry->changeDirectory('/widgets/user/' . $userId . '/' . $id. '/filters'); |
|
1840 | + $registry->changeDirectory('/widgets/user/'.$userId.'/'.$id.'/filters'); |
|
1841 | 1841 | |
1842 | 1842 | while ($filterName = $registry->fetchChildKey()) { |
1843 | 1843 | $filters[] = $filterName; |
@@ -1858,15 +1858,15 @@ discard block |
||
1858 | 1858 | { |
1859 | 1859 | $W = bab_Widgets(); |
1860 | 1860 | $tableview = $this->modelView(null, 'table'); |
1861 | - $W->setUserConfiguration($tableview->getId(). '/currentFilterName', $filterName, 'widgets', false); |
|
1861 | + $W->setUserConfiguration($tableview->getId().'/currentFilterName', $filterName, 'widgets', false); |
|
1862 | 1862 | |
1863 | 1863 | $registry = bab_getRegistryInstance(); |
1864 | 1864 | $userId = '0'; |
1865 | - $registry->changeDirectory('/widgets/user/' . $userId . '/' . $tableview->getId() . '/filters'); |
|
1865 | + $registry->changeDirectory('/widgets/user/'.$userId.'/'.$tableview->getId().'/filters'); |
|
1866 | 1866 | $filterValues = $registry->getValue($filterName); |
1867 | 1867 | |
1868 | 1868 | if (!$filterValues) { |
1869 | - $filterValues = $W->getUserConfiguration($tableview->getId() . '/filters/' . $filterName, 'widgets', false); |
|
1869 | + $filterValues = $W->getUserConfiguration($tableview->getId().'/filters/'.$filterName, 'widgets', false); |
|
1870 | 1870 | } |
1871 | 1871 | |
1872 | 1872 | $tableview = $this->modelView($filterValues, 'table'); |
@@ -1885,7 +1885,7 @@ discard block |
||
1885 | 1885 | { |
1886 | 1886 | $W = bab_Widgets(); |
1887 | 1887 | $id = $this->getModelViewDefaultId(); |
1888 | - $filter = $W->getUserConfiguration($id. '/currentFilterName', 'widgets', false); |
|
1888 | + $filter = $W->getUserConfiguration($id.'/currentFilterName', 'widgets', false); |
|
1889 | 1889 | |
1890 | 1890 | return $filter; |
1891 | 1891 | } |
@@ -1899,7 +1899,7 @@ discard block |
||
1899 | 1899 | { |
1900 | 1900 | if (isset($name)) { |
1901 | 1901 | $W = bab_Widgets(); |
1902 | - $filter = $W->getUserConfiguration($tableview->getId(). '/filters/' . $name, 'widgets', false); |
|
1902 | + $filter = $W->getUserConfiguration($tableview->getId().'/filters/'.$name, 'widgets', false); |
|
1903 | 1903 | $filterValues = $filter['values']; |
1904 | 1904 | } else { |
1905 | 1905 | $filterValues = null; |
@@ -1930,7 +1930,7 @@ discard block |
||
1930 | 1930 | 'values' => $filterValues, |
1931 | 1931 | ); |
1932 | 1932 | |
1933 | - $W->setUserConfiguration($tableview->getId(). '/filters/' . $name, $data, 'widgets', false); |
|
1933 | + $W->setUserConfiguration($tableview->getId().'/filters/'.$name, $data, 'widgets', false); |
|
1934 | 1934 | |
1935 | 1935 | return true; |
1936 | 1936 | } |
@@ -1948,7 +1948,7 @@ discard block |
||
1948 | 1948 | $Ui = $App->Ui(); |
1949 | 1949 | |
1950 | 1950 | $currentFilterName = $this->getCurrentFilterName(); |
1951 | - $filter = $W->getUserConfiguration($this->getModelViewDefaultId() . '/filters/' . $currentFilterName, 'widgets', false); |
|
1951 | + $filter = $W->getUserConfiguration($this->getModelViewDefaultId().'/filters/'.$currentFilterName, 'widgets', false); |
|
1952 | 1952 | |
1953 | 1953 | $page = $Ui->Page(); |
1954 | 1954 | |
@@ -2001,7 +2001,7 @@ discard block |
||
2001 | 2001 | $App = $this->App(); |
2002 | 2002 | $Ui = $App->Ui(); |
2003 | 2003 | |
2004 | - $filter = $W->getUserConfiguration($this->getModelViewDefaultId() . '/filters/' . $name, 'widgets', false); |
|
2004 | + $filter = $W->getUserConfiguration($this->getModelViewDefaultId().'/filters/'.$name, 'widgets', false); |
|
2005 | 2005 | |
2006 | 2006 | $page = $Ui->Page(); |
2007 | 2007 | |
@@ -2053,7 +2053,7 @@ discard block |
||
2053 | 2053 | |
2054 | 2054 | $filterNames = $this->getFilterNames(); |
2055 | 2055 | foreach ($filterNames as $filterName) { |
2056 | - $filter = $W->getUserConfiguration($this->getModelViewDefaultId() . '/filters/' . $filterName, 'widgets', false); |
|
2056 | + $filter = $W->getUserConfiguration($this->getModelViewDefaultId().'/filters/'.$filterName, 'widgets', false); |
|
2057 | 2057 | |
2058 | 2058 | $filterBox = $W->HBoxItems() |
2059 | 2059 | ->setVerticalAlign('middle') |
@@ -2103,7 +2103,7 @@ discard block |
||
2103 | 2103 | $App = $this->App(); |
2104 | 2104 | $Ui = $App->Ui(); |
2105 | 2105 | |
2106 | - $filter = $W->getUserConfiguration($this->getModelViewDefaultId() . '/filters/' . $name, 'widgets', false); |
|
2106 | + $filter = $W->getUserConfiguration($this->getModelViewDefaultId().'/filters/'.$name, 'widgets', false); |
|
2107 | 2107 | |
2108 | 2108 | $page = $Ui->Page(); |
2109 | 2109 | |
@@ -2140,7 +2140,7 @@ discard block |
||
2140 | 2140 | $this->requireDeleteMethod(); |
2141 | 2141 | |
2142 | 2142 | $W = bab_Widgets(); |
2143 | - $W->deleteUserConfiguration($this->getModelViewDefaultId() . '/filters/' . $name, 'widgets', false); |
|
2143 | + $W->deleteUserConfiguration($this->getModelViewDefaultId().'/filters/'.$name, 'widgets', false); |
|
2144 | 2144 | |
2145 | 2145 | return true; |
2146 | 2146 | } |
@@ -2151,7 +2151,7 @@ discard block |
||
2151 | 2151 | $modelView = $this->modelView(); |
2152 | 2152 | $modelView->setHighlightedRows($ids); |
2153 | 2153 | |
2154 | - $this->addReloadSelector('.depends-' . $modelView->getId() . '-HighlightedRecords'); |
|
2154 | + $this->addReloadSelector('.depends-'.$modelView->getId().'-HighlightedRecords'); |
|
2155 | 2155 | |
2156 | 2156 | return true; |
2157 | 2157 | } |
@@ -2161,7 +2161,7 @@ discard block |
||
2161 | 2161 | $modelView = $this->modelView(); |
2162 | 2162 | $modelView->clearHighlightedRows(); |
2163 | 2163 | |
2164 | - $this->addReloadSelector('.depends-' . $modelView->getId() . '-HighlightedRecords'); |
|
2164 | + $this->addReloadSelector('.depends-'.$modelView->getId().'-HighlightedRecords'); |
|
2165 | 2165 | |
2166 | 2166 | return true; |
2167 | 2167 | } |
@@ -2180,35 +2180,35 @@ discard block |
||
2180 | 2180 | $box = $W->VBoxItems(); |
2181 | 2181 | |
2182 | 2182 | $isComponent = false; |
2183 | - if($component = $App->getCurrentComponent()){ |
|
2183 | + if ($component = $App->getCurrentComponent()) { |
|
2184 | 2184 | $Ui = $component->ui(); |
2185 | 2185 | $viewClassname = 'FullFrame'; |
2186 | 2186 | $isComponent = true; |
2187 | 2187 | } |
2188 | - else{ |
|
2188 | + else { |
|
2189 | 2189 | $Ui = $App->Ui(); |
2190 | 2190 | $recordClassname = $this->getRecordClassName(); |
2191 | - $viewClassname = $recordClassname . 'FullFrame'; |
|
2191 | + $viewClassname = $recordClassname.'FullFrame'; |
|
2192 | 2192 | } |
2193 | 2193 | |
2194 | 2194 | if ($records->count() > 0) { |
2195 | 2195 | $box->addItem( |
2196 | 2196 | $W->Link('', $this->proxy()->clearHighlightedRecords()) |
2197 | 2197 | ->setAjaxAction(null, false) |
2198 | - ->addClass('icon', Func_Icons::ACTIONS_ARROW_RIGHT_DOUBLE , "app_closeHighlightButton") |
|
2199 | - ->setSizePolicy(Func_Icons::ICON_LEFT_32 . ' pull-right') |
|
2198 | + ->addClass('icon', Func_Icons::ACTIONS_ARROW_RIGHT_DOUBLE, "app_closeHighlightButton") |
|
2199 | + ->setSizePolicy(Func_Icons::ICON_LEFT_32.' pull-right') |
|
2200 | 2200 | ); |
2201 | 2201 | |
2202 | 2202 | foreach ($records as $record) { |
2203 | 2203 | |
2204 | - if($isComponent){ |
|
2204 | + if ($isComponent) { |
|
2205 | 2205 | $fullFrame = $Ui->$viewClassname($record); |
2206 | - if(method_exists($record, getBlueprint)){ |
|
2206 | + if (method_exists($record, getBlueprint)) { |
|
2207 | 2207 | $view = $record->getBlueprint(); |
2208 | 2208 | } |
2209 | 2209 | $fullFrame->setView($view); |
2210 | 2210 | } |
2211 | - else{ |
|
2211 | + else { |
|
2212 | 2212 | $fullFrame = $Ui->$viewClassname($record->id, $view); |
2213 | 2213 | } |
2214 | 2214 | |
@@ -2217,7 +2217,7 @@ discard block |
||
2217 | 2217 | $box->addClass('box', 'shadow'); |
2218 | 2218 | } |
2219 | 2219 | |
2220 | - $box->addClass('depends-' . $modelView->getId() . '-HighlightedRecords'); |
|
2220 | + $box->addClass('depends-'.$modelView->getId().'-HighlightedRecords'); |
|
2221 | 2221 | $box->setReloadAction($this->proxy()->previewHighlightedRecords($view)); |
2222 | 2222 | return $box; |
2223 | 2223 | } |
@@ -201,8 +201,7 @@ discard block |
||
201 | 201 | 'label' => $method['label'] |
202 | 202 | ); |
203 | 203 | } |
204 | - } |
|
205 | - catch(Exception $e){ |
|
204 | + } catch(Exception $e){ |
|
206 | 205 | unset($types[$index]); |
207 | 206 | continue; |
208 | 207 | } |
@@ -929,8 +928,7 @@ discard block |
||
929 | 928 | session_start(); |
930 | 929 | $_SESSION['modelViewMoreCriterias'][$key] = $fields; |
931 | 930 | session_write_close(); |
932 | - } |
|
933 | - else{ |
|
931 | + } else{ |
|
934 | 932 | $fields = $_SESSION['modelViewMoreCriterias'][$key]; |
935 | 933 | } |
936 | 934 | |
@@ -2184,8 +2182,7 @@ discard block |
||
2184 | 2182 | $Ui = $component->ui(); |
2185 | 2183 | $viewClassname = 'FullFrame'; |
2186 | 2184 | $isComponent = true; |
2187 | - } |
|
2188 | - else{ |
|
2185 | + } else{ |
|
2189 | 2186 | $Ui = $App->Ui(); |
2190 | 2187 | $recordClassname = $this->getRecordClassName(); |
2191 | 2188 | $viewClassname = $recordClassname . 'FullFrame'; |
@@ -2207,8 +2204,7 @@ discard block |
||
2207 | 2204 | $view = $record->getBlueprint(); |
2208 | 2205 | } |
2209 | 2206 | $fullFrame->setView($view); |
2210 | - } |
|
2211 | - else{ |
|
2207 | + } else{ |
|
2212 | 2208 | $fullFrame = $Ui->$viewClassname($record->id, $view); |
2213 | 2209 | } |
2214 | 2210 |
@@ -104,243 +104,243 @@ |
||
104 | 104 | } |
105 | 105 | |
106 | 106 | |
107 | - /** |
|
108 | - * @param string $sourceClass |
|
109 | - */ |
|
110 | - public function joinSource($sourceClass) |
|
111 | - { |
|
112 | - if(!$this->sourceId instanceof $sourceClass){ |
|
113 | - $this->hasOne('sourceId', $sourceClass . 'Set'); |
|
114 | - $this->join('sourceId'); |
|
115 | - } |
|
116 | - } |
|
117 | - |
|
118 | - |
|
119 | - /** |
|
120 | - * @param string $targetClass |
|
121 | - */ |
|
122 | - public function joinTarget($targetClass = null) |
|
123 | - { |
|
124 | - if(!$this->targetId instanceof $targetClass){ |
|
125 | - $this->hasOne('targetId', $targetClass . 'Set'); |
|
126 | - $this->join('targetId'); |
|
127 | - } |
|
128 | - } |
|
107 | + /** |
|
108 | + * @param string $sourceClass |
|
109 | + */ |
|
110 | + public function joinSource($sourceClass) |
|
111 | + { |
|
112 | + if(!$this->sourceId instanceof $sourceClass){ |
|
113 | + $this->hasOne('sourceId', $sourceClass . 'Set'); |
|
114 | + $this->join('sourceId'); |
|
115 | + } |
|
116 | + } |
|
117 | + |
|
118 | + |
|
119 | + /** |
|
120 | + * @param string $targetClass |
|
121 | + */ |
|
122 | + public function joinTarget($targetClass = null) |
|
123 | + { |
|
124 | + if(!$this->targetId instanceof $targetClass){ |
|
125 | + $this->hasOne('targetId', $targetClass . 'Set'); |
|
126 | + $this->join('targetId'); |
|
127 | + } |
|
128 | + } |
|
129 | 129 | |
130 | 130 | |
131 | 131 | /** |
132 | 132 | * @param string $recordClass |
133 | 133 | * @return ORM_IsCriterion |
134 | 134 | */ |
135 | - public function sourceIsA($recordClass) |
|
136 | - { |
|
137 | - return $this->sourceClass->is($recordClass); |
|
138 | - } |
|
139 | - |
|
140 | - |
|
141 | - /** |
|
142 | - * @param app_Record $record |
|
143 | - * @return ORM_Criteria |
|
144 | - */ |
|
145 | - public function sourceIs(app_Record $record) |
|
146 | - { |
|
147 | - return $this->all( |
|
148 | - $this->sourceId->is($record->id), |
|
135 | + public function sourceIsA($recordClass) |
|
136 | + { |
|
137 | + return $this->sourceClass->is($recordClass); |
|
138 | + } |
|
139 | + |
|
140 | + |
|
141 | + /** |
|
142 | + * @param app_Record $record |
|
143 | + * @return ORM_Criteria |
|
144 | + */ |
|
145 | + public function sourceIs(app_Record $record) |
|
146 | + { |
|
147 | + return $this->all( |
|
148 | + $this->sourceId->is($record->id), |
|
149 | 149 | $this->sourceIsA($record->getClassName()) |
150 | - ); |
|
151 | - } |
|
152 | - |
|
153 | - |
|
154 | - /** |
|
155 | - * @param string $recordClass |
|
156 | - * @return ORM_IsCriterion |
|
157 | - */ |
|
158 | - public function targetIsA($recordClass) |
|
159 | - { |
|
160 | - return $this->targetClass->is($recordClass); |
|
161 | - } |
|
162 | - |
|
163 | - |
|
164 | - /** |
|
165 | - * @param app_Record $record |
|
166 | - * @return ORM_Criteria |
|
167 | - */ |
|
168 | - public function targetIs(app_Record $record) |
|
169 | - { |
|
170 | - return $this->all( |
|
171 | - $this->targetId->is($record->id), |
|
172 | - $this->targetIsA($record->getClassName()) |
|
173 | 150 | ); |
174 | - } |
|
175 | - |
|
176 | - |
|
177 | - /** |
|
178 | - * |
|
179 | - * @return ORM_Iterator |
|
180 | - */ |
|
181 | - public function selectForSource(app_Record $object, $targetClass = null, $linkType = null) |
|
182 | - { |
|
183 | - $criteria = $this->sourceIs($object); |
|
184 | - |
|
185 | - if (isset($targetClass)) { |
|
186 | - $this->joinTarget($targetClass); |
|
187 | - $criteria = $criteria->_AND_($this->targetClass->is($targetClass)); |
|
188 | - } |
|
189 | - |
|
190 | - if (isset($linkType)) { |
|
191 | - if (is_array($linkType)) { |
|
192 | - $criteria = $criteria->_AND_($this->type->in($linkType)); |
|
193 | - } else { |
|
194 | - $criteria = $criteria->_AND_($this->type->is($linkType)); |
|
195 | - } |
|
196 | - } |
|
197 | - |
|
198 | - if (is_a($this->targetId, 'app_TraceableRecordSet')) { |
|
199 | - $criteria = $criteria->_AND_($this->targetId->deleted->is(false)); |
|
200 | - } |
|
201 | - |
|
202 | - return $this->select($criteria); |
|
203 | - } |
|
204 | - |
|
205 | - |
|
206 | - /** |
|
207 | - * |
|
208 | - * @return ORM_Iterator |
|
209 | - */ |
|
210 | - public function selectForSources($objects, $targetClass, $linkType = null) |
|
211 | - { |
|
212 | - $sourceClass = null; |
|
213 | - $sourceIds = array(); |
|
214 | - |
|
215 | - foreach ($objects as $obj) { |
|
216 | - if (is_null($sourceClass)) { |
|
217 | - $sourceClass = $obj->getClassName(); |
|
218 | - } |
|
219 | - $sourceIds[] = $obj->id; |
|
220 | - } |
|
221 | - $criteria = $this->sourceId->in($sourceIds) |
|
222 | - ->_AND_($this->sourceClass->is($sourceClass)); |
|
223 | - |
|
224 | - if (isset($targetClass)) { |
|
225 | - $this->joinTarget($targetClass); |
|
226 | - $criteria = $criteria->_AND_($this->targetClass->is($targetClass)); |
|
227 | - } |
|
228 | - |
|
229 | - if (isset($linkType)) { |
|
230 | - if (is_array($linkType)) { |
|
231 | - $criteria = $criteria->_AND_($this->type->in($linkType)); |
|
232 | - } else { |
|
233 | - $criteria = $criteria->_AND_($this->type->is($linkType)); |
|
234 | - } |
|
235 | - } |
|
236 | - return $this->select($criteria); |
|
237 | - } |
|
238 | - |
|
239 | - |
|
240 | - /** |
|
241 | - * |
|
242 | - * @return ORM_Iterator |
|
243 | - */ |
|
244 | - public function selectForTarget(app_Record $object, $sourceClass = null, $linkType = null) |
|
245 | - { |
|
246 | - $criteria = $this->targetIs($object); |
|
247 | - |
|
248 | - if (isset($sourceClass)) { |
|
249 | - $this->joinSource($sourceClass); |
|
250 | - $criteria = $criteria->_AND_($this->sourceClass->is($sourceClass)); |
|
251 | - } |
|
252 | - |
|
253 | - if (isset($linkType)) { |
|
254 | - if (is_array($linkType)) { |
|
255 | - $criteria = $criteria->_AND_($this->type->in($linkType)); |
|
256 | - } else { |
|
257 | - $criteria = $criteria->_AND_($this->type->is($linkType)); |
|
258 | - } |
|
259 | - } |
|
260 | - |
|
261 | - return $this->select($criteria); |
|
262 | - } |
|
263 | - |
|
264 | - |
|
265 | - /** |
|
266 | - * |
|
267 | - * @return ORM_Iterator |
|
268 | - */ |
|
269 | - public function selectForTargets($objects, $sourceClass = null, $linkType = null) |
|
270 | - { |
|
271 | - $targetClass = null; |
|
272 | - $targetIds = array(); |
|
273 | - |
|
274 | - foreach ($objects as $obj) { |
|
275 | - if (is_null($targetClass)) { |
|
276 | - $targetClass = $obj->getClassName(); |
|
277 | - } |
|
278 | - $targetIds[] = $obj->id; |
|
279 | - } |
|
280 | - $criteria = $this->targetId->in($targetIds) |
|
281 | - ->_AND_($this->targetClass->is($targetClass)); |
|
282 | - |
|
283 | - if (isset($sourceClass)) { |
|
284 | - $this->joinSource($sourceClass); |
|
285 | - $criteria = $criteria->_AND_($this->sourceClass->is($sourceClass)); |
|
286 | - } |
|
287 | - |
|
288 | - if (isset($linkType)) { |
|
289 | - if (is_array($linkType)) { |
|
290 | - $criteria = $criteria->_AND_($this->type->in($linkType)); |
|
291 | - } else { |
|
292 | - $criteria = $criteria->_AND_($this->type->is($linkType)); |
|
293 | - } |
|
294 | - } |
|
295 | - |
|
296 | - return $this->select($criteria); |
|
297 | - } |
|
298 | - |
|
299 | - |
|
300 | - |
|
301 | - /** |
|
302 | - * delete all links to an object |
|
303 | - * |
|
304 | - * @param app_Record $object |
|
305 | - * @param string $targetClass if target class is set, links will be deleted only for target classes |
|
306 | - * @param bool $deleteTarget if set to true, the target will be deleted to |
|
307 | - */ |
|
308 | - public function deleteForSource(app_Record $object, $targetClass = null, $deleteTarget = false, $linkType = null) |
|
309 | - { |
|
310 | - $set = clone $this; |
|
311 | - $App = $object->App(); |
|
312 | - |
|
313 | - $criteria = $set->sourceId->is($object->id)->_AND_( |
|
314 | - $set->sourceClass->is($object->getClassName()) |
|
315 | - ); |
|
316 | - |
|
317 | - if (null !== $targetClass) { |
|
318 | - $criteria = $criteria->_AND_( |
|
319 | - $set->targetClass->is($targetClass) |
|
320 | - ); |
|
321 | - } |
|
322 | - if (null !== $linkType) { |
|
323 | - $criteria = $criteria->_AND_( |
|
324 | - $set->type->is($linkType) |
|
325 | - ); |
|
326 | - } |
|
327 | - |
|
328 | - if ($deleteTarget) { |
|
329 | - foreach($set->select($criteria) as $link) { |
|
330 | - |
|
331 | - $className = $link->targetClass.'Set'; |
|
332 | - |
|
333 | - // remove prefix |
|
334 | - |
|
335 | - $className = mb_substr($className, 1 + mb_strpos($className, '_')); |
|
336 | - $targetSet = $App->$className(); |
|
337 | - |
|
338 | - $targetSet->delete($targetSet->id->is($link->targetId)); |
|
339 | - } |
|
340 | - } |
|
341 | - |
|
342 | - return $set->delete($criteria); |
|
343 | - } |
|
151 | + } |
|
152 | + |
|
153 | + |
|
154 | + /** |
|
155 | + * @param string $recordClass |
|
156 | + * @return ORM_IsCriterion |
|
157 | + */ |
|
158 | + public function targetIsA($recordClass) |
|
159 | + { |
|
160 | + return $this->targetClass->is($recordClass); |
|
161 | + } |
|
162 | + |
|
163 | + |
|
164 | + /** |
|
165 | + * @param app_Record $record |
|
166 | + * @return ORM_Criteria |
|
167 | + */ |
|
168 | + public function targetIs(app_Record $record) |
|
169 | + { |
|
170 | + return $this->all( |
|
171 | + $this->targetId->is($record->id), |
|
172 | + $this->targetIsA($record->getClassName()) |
|
173 | + ); |
|
174 | + } |
|
175 | + |
|
176 | + |
|
177 | + /** |
|
178 | + * |
|
179 | + * @return ORM_Iterator |
|
180 | + */ |
|
181 | + public function selectForSource(app_Record $object, $targetClass = null, $linkType = null) |
|
182 | + { |
|
183 | + $criteria = $this->sourceIs($object); |
|
184 | + |
|
185 | + if (isset($targetClass)) { |
|
186 | + $this->joinTarget($targetClass); |
|
187 | + $criteria = $criteria->_AND_($this->targetClass->is($targetClass)); |
|
188 | + } |
|
189 | + |
|
190 | + if (isset($linkType)) { |
|
191 | + if (is_array($linkType)) { |
|
192 | + $criteria = $criteria->_AND_($this->type->in($linkType)); |
|
193 | + } else { |
|
194 | + $criteria = $criteria->_AND_($this->type->is($linkType)); |
|
195 | + } |
|
196 | + } |
|
197 | + |
|
198 | + if (is_a($this->targetId, 'app_TraceableRecordSet')) { |
|
199 | + $criteria = $criteria->_AND_($this->targetId->deleted->is(false)); |
|
200 | + } |
|
201 | + |
|
202 | + return $this->select($criteria); |
|
203 | + } |
|
204 | + |
|
205 | + |
|
206 | + /** |
|
207 | + * |
|
208 | + * @return ORM_Iterator |
|
209 | + */ |
|
210 | + public function selectForSources($objects, $targetClass, $linkType = null) |
|
211 | + { |
|
212 | + $sourceClass = null; |
|
213 | + $sourceIds = array(); |
|
214 | + |
|
215 | + foreach ($objects as $obj) { |
|
216 | + if (is_null($sourceClass)) { |
|
217 | + $sourceClass = $obj->getClassName(); |
|
218 | + } |
|
219 | + $sourceIds[] = $obj->id; |
|
220 | + } |
|
221 | + $criteria = $this->sourceId->in($sourceIds) |
|
222 | + ->_AND_($this->sourceClass->is($sourceClass)); |
|
223 | + |
|
224 | + if (isset($targetClass)) { |
|
225 | + $this->joinTarget($targetClass); |
|
226 | + $criteria = $criteria->_AND_($this->targetClass->is($targetClass)); |
|
227 | + } |
|
228 | + |
|
229 | + if (isset($linkType)) { |
|
230 | + if (is_array($linkType)) { |
|
231 | + $criteria = $criteria->_AND_($this->type->in($linkType)); |
|
232 | + } else { |
|
233 | + $criteria = $criteria->_AND_($this->type->is($linkType)); |
|
234 | + } |
|
235 | + } |
|
236 | + return $this->select($criteria); |
|
237 | + } |
|
238 | + |
|
239 | + |
|
240 | + /** |
|
241 | + * |
|
242 | + * @return ORM_Iterator |
|
243 | + */ |
|
244 | + public function selectForTarget(app_Record $object, $sourceClass = null, $linkType = null) |
|
245 | + { |
|
246 | + $criteria = $this->targetIs($object); |
|
247 | + |
|
248 | + if (isset($sourceClass)) { |
|
249 | + $this->joinSource($sourceClass); |
|
250 | + $criteria = $criteria->_AND_($this->sourceClass->is($sourceClass)); |
|
251 | + } |
|
252 | + |
|
253 | + if (isset($linkType)) { |
|
254 | + if (is_array($linkType)) { |
|
255 | + $criteria = $criteria->_AND_($this->type->in($linkType)); |
|
256 | + } else { |
|
257 | + $criteria = $criteria->_AND_($this->type->is($linkType)); |
|
258 | + } |
|
259 | + } |
|
260 | + |
|
261 | + return $this->select($criteria); |
|
262 | + } |
|
263 | + |
|
264 | + |
|
265 | + /** |
|
266 | + * |
|
267 | + * @return ORM_Iterator |
|
268 | + */ |
|
269 | + public function selectForTargets($objects, $sourceClass = null, $linkType = null) |
|
270 | + { |
|
271 | + $targetClass = null; |
|
272 | + $targetIds = array(); |
|
273 | + |
|
274 | + foreach ($objects as $obj) { |
|
275 | + if (is_null($targetClass)) { |
|
276 | + $targetClass = $obj->getClassName(); |
|
277 | + } |
|
278 | + $targetIds[] = $obj->id; |
|
279 | + } |
|
280 | + $criteria = $this->targetId->in($targetIds) |
|
281 | + ->_AND_($this->targetClass->is($targetClass)); |
|
282 | + |
|
283 | + if (isset($sourceClass)) { |
|
284 | + $this->joinSource($sourceClass); |
|
285 | + $criteria = $criteria->_AND_($this->sourceClass->is($sourceClass)); |
|
286 | + } |
|
287 | + |
|
288 | + if (isset($linkType)) { |
|
289 | + if (is_array($linkType)) { |
|
290 | + $criteria = $criteria->_AND_($this->type->in($linkType)); |
|
291 | + } else { |
|
292 | + $criteria = $criteria->_AND_($this->type->is($linkType)); |
|
293 | + } |
|
294 | + } |
|
295 | + |
|
296 | + return $this->select($criteria); |
|
297 | + } |
|
298 | + |
|
299 | + |
|
300 | + |
|
301 | + /** |
|
302 | + * delete all links to an object |
|
303 | + * |
|
304 | + * @param app_Record $object |
|
305 | + * @param string $targetClass if target class is set, links will be deleted only for target classes |
|
306 | + * @param bool $deleteTarget if set to true, the target will be deleted to |
|
307 | + */ |
|
308 | + public function deleteForSource(app_Record $object, $targetClass = null, $deleteTarget = false, $linkType = null) |
|
309 | + { |
|
310 | + $set = clone $this; |
|
311 | + $App = $object->App(); |
|
312 | + |
|
313 | + $criteria = $set->sourceId->is($object->id)->_AND_( |
|
314 | + $set->sourceClass->is($object->getClassName()) |
|
315 | + ); |
|
316 | + |
|
317 | + if (null !== $targetClass) { |
|
318 | + $criteria = $criteria->_AND_( |
|
319 | + $set->targetClass->is($targetClass) |
|
320 | + ); |
|
321 | + } |
|
322 | + if (null !== $linkType) { |
|
323 | + $criteria = $criteria->_AND_( |
|
324 | + $set->type->is($linkType) |
|
325 | + ); |
|
326 | + } |
|
327 | + |
|
328 | + if ($deleteTarget) { |
|
329 | + foreach($set->select($criteria) as $link) { |
|
330 | + |
|
331 | + $className = $link->targetClass.'Set'; |
|
332 | + |
|
333 | + // remove prefix |
|
334 | + |
|
335 | + $className = mb_substr($className, 1 + mb_strpos($className, '_')); |
|
336 | + $targetSet = $App->$className(); |
|
337 | + |
|
338 | + $targetSet->delete($targetSet->id->is($link->targetId)); |
|
339 | + } |
|
340 | + } |
|
341 | + |
|
342 | + return $set->delete($criteria); |
|
343 | + } |
|
344 | 344 | |
345 | 345 | |
346 | 346 | /** |
@@ -109,8 +109,8 @@ discard block |
||
109 | 109 | */ |
110 | 110 | public function joinSource($sourceClass) |
111 | 111 | { |
112 | - if(!$this->sourceId instanceof $sourceClass){ |
|
113 | - $this->hasOne('sourceId', $sourceClass . 'Set'); |
|
112 | + if (!$this->sourceId instanceof $sourceClass) { |
|
113 | + $this->hasOne('sourceId', $sourceClass.'Set'); |
|
114 | 114 | $this->join('sourceId'); |
115 | 115 | } |
116 | 116 | } |
@@ -121,8 +121,8 @@ discard block |
||
121 | 121 | */ |
122 | 122 | public function joinTarget($targetClass = null) |
123 | 123 | { |
124 | - if(!$this->targetId instanceof $targetClass){ |
|
125 | - $this->hasOne('targetId', $targetClass . 'Set'); |
|
124 | + if (!$this->targetId instanceof $targetClass) { |
|
125 | + $this->hasOne('targetId', $targetClass.'Set'); |
|
126 | 126 | $this->join('targetId'); |
127 | 127 | } |
128 | 128 | } |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | } |
327 | 327 | |
328 | 328 | if ($deleteTarget) { |
329 | - foreach($set->select($criteria) as $link) { |
|
329 | + foreach ($set->select($criteria) as $link) { |
|
330 | 330 | |
331 | 331 | $className = $link->targetClass.'Set'; |
332 | 332 |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | */ |
23 | 23 | |
24 | 24 | |
25 | -require_once APP_CTRL_PATH . '/record.ctrl.php'; |
|
25 | +require_once APP_CTRL_PATH.'/record.ctrl.php'; |
|
26 | 26 | |
27 | 27 | |
28 | 28 | /** |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | $customSection = $customSectionSet->request($customSectionSet->id->is($section)); |
48 | 48 | |
49 | 49 | $object = $customSection->container->object; |
50 | - if(strpos($object, $App->classPrefix) !== false){ |
|
50 | + if (strpos($object, $App->classPrefix) !== false) { |
|
51 | 51 | list(, $object) = explode($App->classPrefix, $object); |
52 | 52 | } |
53 | 53 | $objectCtrl = $App->Controller()->$object(false); |
@@ -62,9 +62,9 @@ discard block |
||
62 | 62 | foreach ($allViewSections as $viewSection) { |
63 | 63 | $fields = $viewSection->getFields(); |
64 | 64 | foreach ($fields as $field) { |
65 | - $allViewFieldNames[$field['fieldname']] = $viewSection->view . ',' . $viewSection->rank . ',' . $viewSection->id; |
|
66 | - foreach ($field['fields'] as $subField){ |
|
67 | - $allViewFieldNames[$subField['fieldname']] = $viewSection->view . ',' . $viewSection->rank . ',' . $viewSection->id; |
|
65 | + $allViewFieldNames[$field['fieldname']] = $viewSection->view.','.$viewSection->rank.','.$viewSection->id; |
|
66 | + foreach ($field['fields'] as $subField) { |
|
67 | + $allViewFieldNames[$subField['fieldname']] = $viewSection->view.','.$viewSection->rank.','.$viewSection->id; |
|
68 | 68 | } |
69 | 69 | } |
70 | 70 | } |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | bab_Sort::asort($availableFields, 'description', bab_Sort::CASE_INSENSITIVE); |
89 | 89 | |
90 | 90 | foreach ($availableFields as $field) { |
91 | - $fieldName = $field['name']; |
|
91 | + $fieldName = $field['name']; |
|
92 | 92 | $fieldDescription = $field['description']; |
93 | 93 | |
94 | 94 | $used = isset($allViewFieldNames[$fieldName]); |
@@ -353,12 +353,12 @@ discard block |
||
353 | 353 | |
354 | 354 | $customSection = $customSectionSet->request($customSectionSet->id->is($section)); |
355 | 355 | $fields = $customSection->getFields(); |
356 | - if(!isset($fields[$fieldGroupName])){ |
|
356 | + if (!isset($fields[$fieldGroupName])) { |
|
357 | 357 | throw new app_Exception($App->translate('This fields group does not seem to exist')); |
358 | 358 | } |
359 | 359 | |
360 | 360 | $object = $customSection->container->object; |
361 | - if(strpos($object, $App->classPrefix) !== false){ |
|
361 | + if (strpos($object, $App->classPrefix) !== false) { |
|
362 | 362 | list(, $object) = explode($App->classPrefix, $object); |
363 | 363 | } |
364 | 364 | |
@@ -374,9 +374,9 @@ discard block |
||
374 | 374 | foreach ($allViewSections as $viewSection) { |
375 | 375 | $fields = $viewSection->getFields(); |
376 | 376 | foreach ($fields as $field) { |
377 | - $allViewFieldNames[$field['fieldname']] = $viewSection->view . ',' . $viewSection->rank . ',' . $viewSection->id; |
|
378 | - foreach ($field['fields'] as $subField){ |
|
379 | - $allViewFieldNames[$subField['fieldname']] = $viewSection->view . ',' . $viewSection->rank . ',' . $viewSection->id; |
|
377 | + $allViewFieldNames[$field['fieldname']] = $viewSection->view.','.$viewSection->rank.','.$viewSection->id; |
|
378 | + foreach ($field['fields'] as $subField) { |
|
379 | + $allViewFieldNames[$subField['fieldname']] = $viewSection->view.','.$viewSection->rank.','.$viewSection->id; |
|
380 | 380 | } |
381 | 381 | } |
382 | 382 | } |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | bab_Sort::asort($availableFields, 'description', bab_Sort::CASE_INSENSITIVE); |
403 | 403 | |
404 | 404 | foreach ($availableFields as $field) { |
405 | - $fieldName = $field['name']; |
|
405 | + $fieldName = $field['name']; |
|
406 | 406 | $fieldDescription = $field['description']; |
407 | 407 | |
408 | 408 | $used = isset($allViewFieldNames[$fieldName]); |
@@ -560,7 +560,7 @@ discard block |
||
560 | 560 | |
561 | 561 | $options = array(); |
562 | 562 | $rank = 1; |
563 | - foreach($containers as $container){ |
|
563 | + foreach ($containers as $container) { |
|
564 | 564 | $options[$container->id] = sprintf('%d (%s)', $rank, $container->name); |
565 | 565 | $rank++; |
566 | 566 | } |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | )->orderDesc($customSectionSet->rank); |
571 | 571 | |
572 | 572 | $nbSections = 0; |
573 | - foreach ($containerSections as $containerSection){ |
|
573 | + foreach ($containerSections as $containerSection) { |
|
574 | 574 | $nbSections = $containerSection->rank + 1; |
575 | 575 | break; |
576 | 576 | } |
@@ -694,10 +694,10 @@ discard block |
||
694 | 694 | $record = $recordSet->request($id); |
695 | 695 | |
696 | 696 | $object = $record->object; |
697 | - if(empty($object)){ |
|
697 | + if (empty($object)) { |
|
698 | 698 | $object = $record->container()->object; |
699 | 699 | } |
700 | - if(strpos($object, $App->classPrefix) !== false){ |
|
700 | + if (strpos($object, $App->classPrefix) !== false) { |
|
701 | 701 | $object = str_replace($App->classPrefix, '', $object); |
702 | 702 | } |
703 | 703 | $object .= 'Set'; |
@@ -721,16 +721,16 @@ discard block |
||
721 | 721 | foreach ($operation as $condition => $value) { |
722 | 722 | $data['condition']['default'] = $condition; |
723 | 723 | $data['condition']['bool'] = $condition; |
724 | - if(is_array($value)){ |
|
725 | - foreach ($value as $key => $subValue){ |
|
726 | - foreach ($manySets as $manyFieldName => $manyRelation){ |
|
727 | - if($key.'Set' == $manyRelation->getForeignSetClassName()){ |
|
728 | - foreach ($subValue as $subFieldName => $subConditions){ |
|
729 | - if($subFieldName === '_foreignField'){ |
|
724 | + if (is_array($value)) { |
|
725 | + foreach ($value as $key => $subValue) { |
|
726 | + foreach ($manySets as $manyFieldName => $manyRelation) { |
|
727 | + if ($key.'Set' == $manyRelation->getForeignSetClassName()) { |
|
728 | + foreach ($subValue as $subFieldName => $subConditions) { |
|
729 | + if ($subFieldName === '_foreignField') { |
|
730 | 730 | continue; |
731 | 731 | } |
732 | 732 | $data['field'] = "{$manyFieldName}/{$subFieldName}"; |
733 | - foreach ($subConditions as $subCondition => $subConditionValue){ |
|
733 | + foreach ($subConditions as $subCondition => $subConditionValue) { |
|
734 | 734 | $data['condition']['default'] = $subCondition; |
735 | 735 | $data['condition']['bool'] = $subCondition; |
736 | 736 | $value = $subConditionValue; |
@@ -739,14 +739,14 @@ discard block |
||
739 | 739 | break; |
740 | 740 | } |
741 | 741 | } |
742 | - foreach ($oneSets as $oneFieldName => $oneRelation){ |
|
743 | - if($key.'Set' == $oneRelation->getForeignSetClassName()){ |
|
744 | - foreach ($subValue as $subFieldName => $subConditions){ |
|
745 | - if($subFieldName === '_foreignField'){ |
|
742 | + foreach ($oneSets as $oneFieldName => $oneRelation) { |
|
743 | + if ($key.'Set' == $oneRelation->getForeignSetClassName()) { |
|
744 | + foreach ($subValue as $subFieldName => $subConditions) { |
|
745 | + if ($subFieldName === '_foreignField') { |
|
746 | 746 | continue; |
747 | 747 | } |
748 | 748 | $data['field'] = "{$oneFieldName}/{$subFieldName}"; |
749 | - foreach ($subConditions as $subCondition => $subConditionValue){ |
|
749 | + foreach ($subConditions as $subCondition => $subConditionValue) { |
|
750 | 750 | $data['condition']['default'] = $subCondition; |
751 | 751 | $data['condition']['bool'] = $subCondition; |
752 | 752 | $value = $subConditionValue; |
@@ -781,7 +781,7 @@ discard block |
||
781 | 781 | */ |
782 | 782 | public function save($data = null) |
783 | 783 | { |
784 | - if(!isset($data['id']) && isset($data['container']) && $data['container'] != 0 && !isset($data['rank'])){ |
|
784 | + if (!isset($data['id']) && isset($data['container']) && $data['container'] != 0 && !isset($data['rank'])) { |
|
785 | 785 | $set = $this->getRecordSet(); |
786 | 786 | $data['rank'] = $set->select($set->container->is($data['container']))->count(); |
787 | 787 | } |
@@ -822,7 +822,7 @@ discard block |
||
822 | 822 | ); |
823 | 823 | |
824 | 824 | $position++; |
825 | - foreach ($afterSections as $afterSection){ |
|
825 | + foreach ($afterSections as $afterSection) { |
|
826 | 826 | $afterSection->rank = $position; |
827 | 827 | $afterSection->save(); |
828 | 828 | $position++; |
@@ -855,10 +855,10 @@ discard block |
||
855 | 855 | $record = $recordSet->request($data['id']); |
856 | 856 | |
857 | 857 | $object = $record->object; |
858 | - if(empty($object)){ |
|
858 | + if (empty($object)) { |
|
859 | 859 | $object = $record->container()->object; |
860 | 860 | } |
861 | - if(strpos($object, $App->classPrefix) !== false){ |
|
861 | + if (strpos($object, $App->classPrefix) !== false) { |
|
862 | 862 | $object = str_replace($App->classPrefix, '', $object); |
863 | 863 | } |
864 | 864 | $object .= 'Set'; |
@@ -868,14 +868,14 @@ discard block |
||
868 | 868 | $field = $data['field']; |
869 | 869 | $condition = $data['condition']; |
870 | 870 | |
871 | - if(strpos($field, '/') !== false){ |
|
871 | + if (strpos($field, '/') !== false) { |
|
872 | 872 | //The selected field is a hasMany or a hasOne relation |
873 | 873 | list($selectedRelation, $selectedField) = explode('/', $field); |
874 | 874 | $classPrefix = $App->classPrefix; |
875 | 875 | |
876 | 876 | $manyRelations = $objectRecordSet->getHasManyRelations(); |
877 | - foreach($manyRelations as $manyRelation){ |
|
878 | - if($selectedRelation != $manyRelation->getOwnerSetFieldName()){ |
|
877 | + foreach ($manyRelations as $manyRelation) { |
|
878 | + if ($selectedRelation != $manyRelation->getOwnerSetFieldName()) { |
|
879 | 879 | continue; |
880 | 880 | } |
881 | 881 | $foreignSetName = str_replace($classPrefix, '', $manyRelation->getForeignSetClassName()); |
@@ -883,7 +883,7 @@ discard block |
||
883 | 883 | |
884 | 884 | $visibilityCriteria = ''; |
885 | 885 | |
886 | - if($foreignSet){ |
|
886 | + if ($foreignSet) { |
|
887 | 887 | $selectedManyField = $foreignSet->$selectedField; |
888 | 888 | |
889 | 889 | if ($selectedManyField instanceof ORM_BoolInterface) { |
@@ -903,9 +903,9 @@ discard block |
||
903 | 903 | } |
904 | 904 | |
905 | 905 | $oneRelations = $objectRecordSet->getHasOneRelations(); |
906 | - foreach($oneRelations as $oneRelation){ |
|
906 | + foreach ($oneRelations as $oneRelation) { |
|
907 | 907 | /* @var $oneRelation ORM_OneRelation*/ |
908 | - if($selectedRelation != $oneRelation->getOwnerSetFieldName()){ |
|
908 | + if ($selectedRelation != $oneRelation->getOwnerSetFieldName()) { |
|
909 | 909 | continue; |
910 | 910 | } |
911 | 911 | $foreignSetClassName = $oneRelation->getForeignSetClassName(); |
@@ -914,7 +914,7 @@ discard block |
||
914 | 914 | |
915 | 915 | $visibilityCriteria = ''; |
916 | 916 | |
917 | - if($foreignSet){ |
|
917 | + if ($foreignSet) { |
|
918 | 918 | $selectedOneField = $foreignSet->$selectedField; |
919 | 919 | |
920 | 920 | if ($selectedOneField instanceof ORM_BoolInterface) { |
@@ -929,7 +929,7 @@ discard block |
||
929 | 929 | break; |
930 | 930 | } |
931 | 931 | } |
932 | - else{ |
|
932 | + else { |
|
933 | 933 | |
934 | 934 | $field = $objectRecordSet->$field; |
935 | 935 | |
@@ -941,7 +941,7 @@ discard block |
||
941 | 941 | |
942 | 942 | $visibilityCriteria = ''; |
943 | 943 | |
944 | - if(!empty($condition)){ |
|
944 | + if (!empty($condition)) { |
|
945 | 945 | $criteria = $field->{$condition}($data['value']); |
946 | 946 | $visibilityCriteria = $criteria->toJson(); |
947 | 947 | } |
@@ -976,7 +976,7 @@ discard block |
||
976 | 976 | $customContainer = $customContainerSet->request($container); |
977 | 977 | |
978 | 978 | $object = $customContainer->object; |
979 | - if(strpos($object, $App->classPrefix) !== false){ |
|
979 | + if (strpos($object, $App->classPrefix) !== false) { |
|
980 | 980 | list(, $object) = explode($App->classPrefix, $object); |
981 | 981 | } |
982 | 982 | |
@@ -1007,19 +1007,19 @@ discard block |
||
1007 | 1007 | |
1008 | 1008 | foreach ($customSections as $customSection) { |
1009 | 1009 | |
1010 | - list(, , $nbCol) = explode('-', $customSection->sizePolicy); |
|
1010 | + list(,, $nbCol) = explode('-', $customSection->sizePolicy); |
|
1011 | 1011 | |
1012 | 1012 | $currentColumn += $nbCol; |
1013 | 1013 | |
1014 | 1014 | $sectionSection = $W->Section( |
1015 | - $customSection->name . ' (' . $customSection->rank . ')', |
|
1015 | + $customSection->name.' ('.$customSection->rank.')', |
|
1016 | 1016 | $sectionBox = $W->VBoxItems( |
1017 | - $W->Hidden()->setName('#' . $customSection->id) |
|
1017 | + $W->Hidden()->setName('#'.$customSection->id) |
|
1018 | 1018 | ) |
1019 | 1019 | ); |
1020 | 1020 | $sectionSection->addClass('app-custom-section'); |
1021 | 1021 | $sectionSection->addClass($customSection->classname); |
1022 | - $sectionSection->setSizePolicy($customSection->sizePolicy . ' widget-sameheight'); |
|
1022 | + $sectionSection->setSizePolicy($customSection->sizePolicy.' widget-sameheight'); |
|
1023 | 1023 | |
1024 | 1024 | $row->addItem($sectionSection); |
1025 | 1025 | |
@@ -1049,7 +1049,7 @@ discard block |
||
1049 | 1049 | ->setDialogClass('box red') |
1050 | 1050 | ) |
1051 | 1051 | ); |
1052 | - if(!empty($customSection->visibilityCriteria)){ |
|
1052 | + if (!empty($customSection->visibilityCriteria)) { |
|
1053 | 1053 | $sectionBox->addItem( |
1054 | 1054 | $W->HBoxItems( |
1055 | 1055 | $W->Label($App->translate('This section has a visibility condition')) |
@@ -1057,7 +1057,7 @@ discard block |
||
1057 | 1057 | ); |
1058 | 1058 | } |
1059 | 1059 | $fields = $customSection->getFields(); |
1060 | - if(count($fields) == 0){ |
|
1060 | + if (count($fields) == 0) { |
|
1061 | 1061 | $sectionBox->addItem( |
1062 | 1062 | $W->HBoxItems( |
1063 | 1063 | $W->Label($App->translate('This section does not contain any field')) |
@@ -1071,8 +1071,8 @@ discard block |
||
1071 | 1071 | |
1072 | 1072 | $fieldName = $field['fieldname']; |
1073 | 1073 | |
1074 | - $isFieldsGroup= false; |
|
1075 | - if(strpos($fieldName, '_fieldsGroup') !== false){ |
|
1074 | + $isFieldsGroup = false; |
|
1075 | + if (strpos($fieldName, '_fieldsGroup') !== false) { |
|
1076 | 1076 | $fieldName = '_fieldsGroup'; |
1077 | 1077 | $isFieldsGroup = true; |
1078 | 1078 | } |
@@ -1088,7 +1088,7 @@ discard block |
||
1088 | 1088 | } |
1089 | 1089 | |
1090 | 1090 | $fieldName = $field['name']; |
1091 | - if($isFieldsGroup){ |
|
1091 | + if ($isFieldsGroup) { |
|
1092 | 1092 | $fieldName = $fieldId; |
1093 | 1093 | } |
1094 | 1094 | |
@@ -1100,18 +1100,18 @@ discard block |
||
1100 | 1100 | $fieldGroupBox = $W->FlexItems()->setGrowable(true)->setWrap(Widget_FlexLayout::FLEX_WRAP_WRAP) |
1101 | 1101 | )->setSizePolicy('maximum'), |
1102 | 1102 | $btnBox = $W->HBoxItems( |
1103 | - $W->Hidden()->setName($customSection->id . '.' . $fieldId)->setValue($fieldName) |
|
1103 | + $W->Hidden()->setName($customSection->id.'.'.$fieldId)->setValue($fieldName) |
|
1104 | 1104 | )->addClass('widget-actions') |
1105 | 1105 | )->setSizePolicy('widget-list-element widget-actions-target') |
1106 | 1106 | ->addClass(Func_Icons::ICON_LEFT_16); |
1107 | - if(strpos($field['name'], '_fieldsGroup') !== false){ |
|
1107 | + if (strpos($field['name'], '_fieldsGroup') !== false) { |
|
1108 | 1108 | $btnBox->addItem( |
1109 | 1109 | $W->Link('', $customSectionCtrl->addDisplayFieldToGroup($customSection->id, $fieldName)) |
1110 | 1110 | ->addClass('icon', Func_Icons::ACTIONS_LIST_ADD) |
1111 | 1111 | ->setOpenMode(Widget_Link::OPEN_DIALOG) |
1112 | 1112 | ); |
1113 | 1113 | $groupedFields = $fields[$fieldName]['fields']; |
1114 | - foreach ($groupedFields as $groupedField){ |
|
1114 | + foreach ($groupedFields as $groupedField) { |
|
1115 | 1115 | $groupedFieldDetails = $availableFields[$groupedField['fieldname']]; |
1116 | 1116 | $fieldGroupBox->addItem( |
1117 | 1117 | $flexField = $W->FlowItems( |
@@ -1212,7 +1212,7 @@ discard block |
||
1212 | 1212 | } |
1213 | 1213 | |
1214 | 1214 | header('Content-type: application/json'); |
1215 | - header('Content-Disposition: attachment; filename="' . $container->object . '.' . ($container->view === '' ? 'default' : $container->view) . '.' . $container->name . '.json"'."\n"); |
|
1215 | + header('Content-Disposition: attachment; filename="'.$container->object.'.'.($container->view === '' ? 'default' : $container->view).'.'.$container->name.'.json"'."\n"); |
|
1216 | 1216 | |
1217 | 1217 | $json = bab_json_encode($sectionsValues); |
1218 | 1218 | $json = bab_convertStringFromDatabase($json, bab_charset::UTF_8); |
@@ -1393,15 +1393,15 @@ discard block |
||
1393 | 1393 | $ranks = array(); |
1394 | 1394 | $rank = 0; |
1395 | 1395 | |
1396 | - foreach ($sections as $key => $value){ |
|
1396 | + foreach ($sections as $key => $value) { |
|
1397 | 1397 | //Sections ids start with #, while section fields start with their original section id |
1398 | 1398 | if (substr($key, 0, 1) === '#') { |
1399 | 1399 | $currentSectionId = substr($key, 1); |
1400 | 1400 | $rawSectionData[$currentSectionId] = array(); |
1401 | - if(!isset($oldSectionId)){ |
|
1401 | + if (!isset($oldSectionId)) { |
|
1402 | 1402 | $oldSectionId = $currentSectionId; |
1403 | 1403 | } |
1404 | - if(isset($currentSection) && $oldSectionId != $currentSectionId){ |
|
1404 | + if (isset($currentSection) && $oldSectionId != $currentSectionId) { |
|
1405 | 1405 | $oldSectionId = $currentSectionId; |
1406 | 1406 | } |
1407 | 1407 | $ranks[$currentSectionId] = $rank; |
@@ -1409,39 +1409,39 @@ discard block |
||
1409 | 1409 | $currentSection = $customSectionSet->get($customSectionSet->id->is($currentSectionId)); |
1410 | 1410 | continue; |
1411 | 1411 | } |
1412 | - if(!isset($currentSection)){ |
|
1412 | + if (!isset($currentSection)) { |
|
1413 | 1413 | continue; |
1414 | 1414 | } |
1415 | 1415 | list($fieldSectionId, $fieldName) = explode('.', $key); |
1416 | - if($fieldSectionId == $currentSectionId){ |
|
1416 | + if ($fieldSectionId == $currentSectionId) { |
|
1417 | 1417 | $field = $currentSection->getField($fieldName); |
1418 | - if(strpos($fieldName, '_fieldsGroup') !== false){ |
|
1418 | + if (strpos($fieldName, '_fieldsGroup') !== false) { |
|
1419 | 1419 | $rawSectionData[$currentSectionId][$fieldName]['block'] = $field['block']; |
1420 | 1420 | $rawSectionData[$currentSectionId][$fieldName]['fieldname'] = '_fieldsGroup'; |
1421 | 1421 | $rawSectionData[$currentSectionId][$fieldName]['parameters'] = $field['parameters']; |
1422 | - foreach ($sections[$currentSection->id.'.fieldsGroups'][$fieldName] as $subKey => $subValue){ |
|
1422 | + foreach ($sections[$currentSection->id.'.fieldsGroups'][$fieldName] as $subKey => $subValue) { |
|
1423 | 1423 | $rawSectionData[$currentSectionId][$fieldName]['fields'][$subKey] = $field['fields'][$subKey]; |
1424 | 1424 | } |
1425 | 1425 | } |
1426 | - elseif($fieldName != 'fieldsGroups'){ |
|
1426 | + elseif ($fieldName != 'fieldsGroups') { |
|
1427 | 1427 | $rawSectionData[$currentSectionId][$fieldName] = $field; |
1428 | 1428 | } |
1429 | 1429 | } |
1430 | - else{ |
|
1430 | + else { |
|
1431 | 1431 | $field = null; |
1432 | 1432 | $tmpSection = $customSectionSet->get($customSectionSet->id->is($fieldSectionId)); |
1433 | - if($tmpSection){ |
|
1433 | + if ($tmpSection) { |
|
1434 | 1434 | $field = $tmpSection->getField($fieldName); |
1435 | 1435 | } |
1436 | - if(isset($field)){ |
|
1436 | + if (isset($field)) { |
|
1437 | 1437 | $rawSectionData[$currentSectionId][$fieldName] = $field; |
1438 | 1438 | } |
1439 | 1439 | } |
1440 | 1440 | } |
1441 | 1441 | |
1442 | - foreach ($rawSectionData as $sectionId => $fields){ |
|
1442 | + foreach ($rawSectionData as $sectionId => $fields) { |
|
1443 | 1443 | $section = $customSectionSet->get($customSectionSet->id->is($sectionId)); |
1444 | - if($section){ |
|
1444 | + if ($section) { |
|
1445 | 1445 | $section->fields = json_encode($fields); |
1446 | 1446 | $section->rank = isset($ranks[$sectionId]) ? $ranks[$sectionId] : 0; |
1447 | 1447 | $section->save(); |
@@ -928,8 +928,7 @@ discard block |
||
928 | 928 | } |
929 | 929 | break; |
930 | 930 | } |
931 | - } |
|
932 | - else{ |
|
931 | + } else{ |
|
933 | 932 | |
934 | 933 | $field = $objectRecordSet->$field; |
935 | 934 | |
@@ -1422,12 +1421,10 @@ discard block |
||
1422 | 1421 | foreach ($sections[$currentSection->id.'.fieldsGroups'][$fieldName] as $subKey => $subValue){ |
1423 | 1422 | $rawSectionData[$currentSectionId][$fieldName]['fields'][$subKey] = $field['fields'][$subKey]; |
1424 | 1423 | } |
1425 | - } |
|
1426 | - elseif($fieldName != 'fieldsGroups'){ |
|
1424 | + } elseif($fieldName != 'fieldsGroups'){ |
|
1427 | 1425 | $rawSectionData[$currentSectionId][$fieldName] = $field; |
1428 | 1426 | } |
1429 | - } |
|
1430 | - else{ |
|
1427 | + } else{ |
|
1431 | 1428 | $field = null; |
1432 | 1429 | $tmpSection = $customSectionSet->get($customSectionSet->id->is($fieldSectionId)); |
1433 | 1430 | if($tmpSection){ |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * @copyright Copyright (c) 2019 by CAPWELTON ({@link http://www.capwelton.com}) |
22 | 22 | */ |
23 | 23 | |
24 | -require_once dirname(__FILE__) . '/functions.php'; |
|
24 | +require_once dirname(__FILE__).'/functions.php'; |
|
25 | 25 | |
26 | 26 | bab_Functionality::includefile('PortletBackend'); |
27 | 27 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | |
100 | 100 | public function includeNotifications() |
101 | 101 | { |
102 | - require_once APP_PORTLET_PATH . 'notifications.portlet.php'; |
|
102 | + require_once APP_PORTLET_PATH.'notifications.portlet.php'; |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | public function Notifications() |