@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | public function __construct(Func_App $app, $id = null, Widget_Layout $layout = null) |
| 103 | 103 | { |
| 104 | 104 | parent::__construct($app); |
| 105 | - // We simulate inheritance from Widget_VBoxLayout. |
|
| 105 | + // We simulate inheritance from Widget_VBoxLayout. |
|
| 106 | 106 | $W = $this->widgets = bab_Widgets(); |
| 107 | 107 | |
| 108 | 108 | |
@@ -307,9 +307,9 @@ discard block |
||
| 307 | 307 | $cancelLabel = isset($this->cancelLabel) ? $this->cancelLabel : $App->translate('Cancel'); |
| 308 | 308 | $this->addButton( |
| 309 | 309 | $W->SubmitButton(/*'cancel'*/) |
| 310 | - ->addClass('widget-close-dialog') |
|
| 310 | + ->addClass('widget-close-dialog') |
|
| 311 | 311 | ->setAction($this->cancelAction) |
| 312 | - ->setLabel($cancelLabel) |
|
| 312 | + ->setLabel($cancelLabel) |
|
| 313 | 313 | ); |
| 314 | 314 | } |
| 315 | 315 | |
@@ -1148,21 +1148,21 @@ discard block |
||
| 1148 | 1148 | |
| 1149 | 1149 | |
| 1150 | 1150 | |
| 1151 | - protected function addCustomFields(app_RecordSet $recordSet) |
|
| 1152 | - { |
|
| 1153 | - $customFields = $recordSet->getCustomFields(); |
|
| 1151 | + protected function addCustomFields(app_RecordSet $recordSet) |
|
| 1152 | + { |
|
| 1153 | + $customFields = $recordSet->getCustomFields(); |
|
| 1154 | 1154 | |
| 1155 | 1155 | foreach ($customFields as $customField) { |
| 1156 | 1156 | $fieldname = $customField->fieldname; |
| 1157 | 1157 | $this->addColumn( |
| 1158 | 1158 | widget_TableModelViewColumn($recordSet->$fieldname, $customField->name) |
| 1159 | - ->setSortable(true) |
|
| 1160 | - ->setExportable(true) |
|
| 1161 | - ->setSearchable($customField->searchable) |
|
| 1162 | - ->setVisible($customField->visible) |
|
| 1159 | + ->setSortable(true) |
|
| 1160 | + ->setExportable(true) |
|
| 1161 | + ->setSearchable($customField->searchable) |
|
| 1162 | + ->setVisible($customField->visible) |
|
| 1163 | 1163 | ); |
| 1164 | 1164 | } |
| 1165 | - } |
|
| 1165 | + } |
|
| 1166 | 1166 | |
| 1167 | 1167 | |
| 1168 | 1168 | /** |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | bab_Widgets()->includePhpClass('widget_InputWidget'); |
| 27 | 27 | bab_Widgets()->includePhpClass('widget_TableModelView'); |
| 28 | 28 | |
| 29 | -require_once dirname(__FILE__) . '/ui.helpers.php'; |
|
| 29 | +require_once dirname(__FILE__).'/ui.helpers.php'; |
|
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | 32 | * @return Widget_Form |
@@ -680,7 +680,7 @@ discard block |
||
| 680 | 680 | continue; |
| 681 | 681 | } |
| 682 | 682 | |
| 683 | - list(, , $nbCol) = explode('-', $customSection->sizePolicy); |
|
| 683 | + list(,, $nbCol) = explode('-', $customSection->sizePolicy); |
|
| 684 | 684 | |
| 685 | 685 | if ($currentColumn + $nbCol > 12) { |
| 686 | 686 | $this->addItem($row); |
@@ -708,7 +708,7 @@ discard block |
||
| 708 | 708 | $parameters = $displayField['parameters']; |
| 709 | 709 | $classname = isset($parameters['classname']) ? $parameters['classname'] : ''; |
| 710 | 710 | $label = isset($parameters['label']) && $parameters['label'] !== '__' ? $parameters['label'] : ''; |
| 711 | - $displayFieldMethod = '_' . $displayFieldName; |
|
| 711 | + $displayFieldMethod = '_'.$displayFieldName; |
|
| 712 | 712 | |
| 713 | 713 | if (method_exists($this, $displayFieldMethod)) { |
| 714 | 714 | $widget = $this->$displayFieldMethod($customSection); |
@@ -766,7 +766,7 @@ discard block |
||
| 766 | 766 | $parameters = $displayField['parameters']; |
| 767 | 767 | $classname = isset($parameters['classname']) ? $parameters['classname'] : ''; |
| 768 | 768 | $label = isset($parameters['label']) && $parameters['label'] !== '__' ? $parameters['label'] : ''; |
| 769 | - $displayFieldMethod = '_' . $displayFieldName; |
|
| 769 | + $displayFieldMethod = '_'.$displayFieldName; |
|
| 770 | 770 | |
| 771 | 771 | if (method_exists($this, $displayFieldMethod)) { |
| 772 | 772 | $widget = $this->$displayFieldMethod($customSection); |
@@ -1036,7 +1036,7 @@ discard block |
||
| 1036 | 1036 | $row = $W->Items()->setSizePolicy('row'); |
| 1037 | 1037 | foreach ($customSections as $customSection) { |
| 1038 | 1038 | |
| 1039 | - list(, , $nbCol) = explode('-', $customSection->sizePolicy); |
|
| 1039 | + list(,, $nbCol) = explode('-', $customSection->sizePolicy); |
|
| 1040 | 1040 | |
| 1041 | 1041 | if ($currentColumn + $nbCol > 12) { |
| 1042 | 1042 | $this->addItem($row); |
@@ -1063,7 +1063,7 @@ discard block |
||
| 1063 | 1063 | $parameters = $displayField['parameters']; |
| 1064 | 1064 | $classname = isset($parameters['classname']) ? $parameters['classname'] : ''; |
| 1065 | 1065 | $label = isset($parameters['label']) ? $parameters['label'] : ''; |
| 1066 | - $displayFieldMethod = '_' . $displayFieldName; |
|
| 1066 | + $displayFieldMethod = '_'.$displayFieldName; |
|
| 1067 | 1067 | |
| 1068 | 1068 | if (method_exists($this, $displayFieldMethod)) { |
| 1069 | 1069 | $value = $this->$displayFieldMethod($customSection); |
@@ -1154,7 +1154,7 @@ discard block |
||
| 1154 | 1154 | // we try to select one according to the classname prefix. |
| 1155 | 1155 | list($prefix) = explode('_', get_class($this)); |
| 1156 | 1156 | $functionalityName = ucwords($prefix); |
| 1157 | - $this->app = @bab_functionality::get('App/' . $functionalityName); |
|
| 1157 | + $this->app = @bab_functionality::get('App/'.$functionalityName); |
|
| 1158 | 1158 | if (!$this->app) { |
| 1159 | 1159 | $this->app = @bab_functionality::get('App'); |
| 1160 | 1160 | } |
@@ -1215,7 +1215,7 @@ discard block |
||
| 1215 | 1215 | $this->setCurrentPage(isset($filter['pageNumber']) ? $filter['pageNumber'] : $pageNumber); |
| 1216 | 1216 | |
| 1217 | 1217 | if (isset($name)) { |
| 1218 | - $this->sortParameterName = $name . '[filter][sort]'; |
|
| 1218 | + $this->sortParameterName = $name.'[filter][sort]'; |
|
| 1219 | 1219 | } else { |
| 1220 | 1220 | $this->sortParameterName = 'filter[sort]'; |
| 1221 | 1221 | } |
@@ -1366,11 +1366,11 @@ discard block |
||
| 1366 | 1366 | |
| 1367 | 1367 | foreach ($columns as $fieldName => $column) { |
| 1368 | 1368 | $field = $column->getField(); |
| 1369 | - if (! $column->isSearchable()) { |
|
| 1369 | + if (!$column->isSearchable()) { |
|
| 1370 | 1370 | continue; |
| 1371 | 1371 | } |
| 1372 | 1372 | |
| 1373 | - if (! ($field instanceof ORM_Field)) { |
|
| 1373 | + if (!($field instanceof ORM_Field)) { |
|
| 1374 | 1374 | $field = null; |
| 1375 | 1375 | } |
| 1376 | 1376 | |
@@ -1387,7 +1387,7 @@ discard block |
||
| 1387 | 1387 | |
| 1388 | 1388 | $formItem = $this->handleFilterLabel($label, $input); |
| 1389 | 1389 | $formItem->setSizePolicy('col-lg-2 col-md-3 col-sm-6 col-xs-12'); |
| 1390 | - $formItem->addClass('field_' . $fieldName); |
|
| 1390 | + $formItem->addClass('field_'.$fieldName); |
|
| 1391 | 1391 | |
| 1392 | 1392 | $mainSearch = (method_exists($column, 'isMainSearch') && $column->isMainSearch()); |
| 1393 | 1393 | |
@@ -1400,7 +1400,7 @@ discard block |
||
| 1400 | 1400 | } |
| 1401 | 1401 | |
| 1402 | 1402 | |
| 1403 | - if (! $this->submit) { |
|
| 1403 | + if (!$this->submit) { |
|
| 1404 | 1404 | $this->submit = $W->SubmitButton(); |
| 1405 | 1405 | $this->submit->setLabel(widget_translate('Filter')); |
| 1406 | 1406 | } |
@@ -1473,7 +1473,7 @@ discard block |
||
| 1473 | 1473 | // $this->setCurrentPage(isset($filter['pageNumber']) ? $filter['pageNumber'] : $pageNumber); |
| 1474 | 1474 | |
| 1475 | 1475 | if (isset($name)) { |
| 1476 | - $this->sortParameterName = $name . '[filter][sort]'; |
|
| 1476 | + $this->sortParameterName = $name.'[filter][sort]'; |
|
| 1477 | 1477 | } else { |
| 1478 | 1478 | $this->sortParameterName = 'filter[sort]'; |
| 1479 | 1479 | } |
@@ -1538,7 +1538,7 @@ discard block |
||
| 1538 | 1538 | |
| 1539 | 1539 | $tableview->setCurrentPage(isset($filterValues['pageNumber']) ? $filterValues['pageNumber'] : 0); |
| 1540 | 1540 | |
| 1541 | - $tableview->sortParameterName = $name . '[filter][sort]'; |
|
| 1541 | + $tableview->sortParameterName = $name.'[filter][sort]'; |
|
| 1542 | 1542 | |
| 1543 | 1543 | if (isset($filterValues['sort'])) { |
| 1544 | 1544 | $tableview->setSortField($filterValues['sort']); |
@@ -1837,7 +1837,7 @@ discard block |
||
| 1837 | 1837 | continue; |
| 1838 | 1838 | } |
| 1839 | 1839 | |
| 1840 | - list(, , $nbCol) = explode('-', $customSection->sizePolicy); |
|
| 1840 | + list(,, $nbCol) = explode('-', $customSection->sizePolicy); |
|
| 1841 | 1841 | |
| 1842 | 1842 | if ($currentColumn + $nbCol > 12) { |
| 1843 | 1843 | $this->addItem($row); |
@@ -1879,7 +1879,7 @@ discard block |
||
| 1879 | 1879 | $classname = isset($parameters['classname']) ? $parameters['classname'] : ''; |
| 1880 | 1880 | $label = isset($parameters['label']) ? $parameters['label'] : null; |
| 1881 | 1881 | |
| 1882 | - $displayFieldMethod = '_' . $displayFieldName; |
|
| 1882 | + $displayFieldMethod = '_'.$displayFieldName; |
|
| 1883 | 1883 | if (method_exists($this, $displayFieldMethod)) { |
| 1884 | 1884 | $item = $this->$displayFieldMethod($customSection, $label); |
| 1885 | 1885 | } else { |
@@ -1908,7 +1908,7 @@ discard block |
||
| 1908 | 1908 | } |
| 1909 | 1909 | } |
| 1910 | 1910 | |
| 1911 | - if ($currentColumn + $nbCol> 0) { |
|
| 1911 | + if ($currentColumn + $nbCol > 0) { |
|
| 1912 | 1912 | $this->addItem($row); |
| 1913 | 1913 | } |
| 1914 | 1914 | } |
@@ -2022,7 +2022,7 @@ discard block |
||
| 2022 | 2022 | |
| 2023 | 2023 | $displayable = $field->output($value); |
| 2024 | 2024 | |
| 2025 | - switch(true) { |
|
| 2025 | + switch (true) { |
|
| 2026 | 2026 | case ($field instanceof ORM_TextField): |
| 2027 | 2027 | $displayable = $W->RichText($displayable)->setRenderingOptions(BAB_HTML_ALL ^ BAB_HTML_P); |
| 2028 | 2028 | break; |
@@ -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, |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | foreach ($allViewSections as $viewSection) { |
| 245 | 245 | $fields = $viewSection->getFields(); |
| 246 | 246 | foreach ($fields as $field) { |
| 247 | - $allViewFieldNames[$field['fieldname']] = $viewSection->view . ',' . $viewSection->rank . ',' . $viewSection->id; |
|
| 247 | + $allViewFieldNames[$field['fieldname']] = $viewSection->view.','.$viewSection->rank.','.$viewSection->id; |
|
| 248 | 248 | } |
| 249 | 249 | } |
| 250 | 250 | |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | bab_Sort::asort($availableFields, 'description', bab_Sort::CASE_INSENSITIVE); |
| 269 | 269 | |
| 270 | 270 | foreach ($availableFields as $field) { |
| 271 | - $fieldName = $field['name']; |
|
| 271 | + $fieldName = $field['name']; |
|
| 272 | 272 | $fieldDescription = $field['description']; |
| 273 | 273 | |
| 274 | 274 | $used = isset($allViewFieldNames[$fieldName]); |
@@ -465,7 +465,7 @@ discard block |
||
| 465 | 465 | $nbCol = 0; |
| 466 | 466 | foreach ($customSections as $customSection) { |
| 467 | 467 | |
| 468 | - list(, , $nbCol) = explode('-', $customSection->sizePolicy); |
|
| 468 | + list(,, $nbCol) = explode('-', $customSection->sizePolicy); |
|
| 469 | 469 | |
| 470 | 470 | // if ($currentColumn + $nbCol > 12) { |
| 471 | 471 | // $sectionsSection->addItem($row); |
@@ -476,8 +476,8 @@ discard block |
||
| 476 | 476 | $currentColumn += $nbCol; |
| 477 | 477 | |
| 478 | 478 | $sectionSection = $W->Section( |
| 479 | - $customSection->name . ' (' . $customSection->rank . ')', |
|
| 480 | - $sectionBox = $W->VBoxItems($W->Hidden()->setName('#' . $customSection->id)) |
|
| 479 | + $customSection->name.' ('.$customSection->rank.')', |
|
| 480 | + $sectionBox = $W->VBoxItems($W->Hidden()->setName('#'.$customSection->id)) |
|
| 481 | 481 | // ->addClass('widget-dockable-content') |
| 482 | 482 | ); |
| 483 | 483 | $sectionSection->addClass('crm-custom-section'); |
@@ -522,16 +522,16 @@ discard block |
||
| 522 | 522 | } |
| 523 | 523 | |
| 524 | 524 | $fieldItem = $W->FlowItems( |
| 525 | - $W->Label($fieldDescription)->setSizePolicy(Func_Icons::ICON_LEFT_16 . ' widget-80pc' ), |
|
| 525 | + $W->Label($fieldDescription)->setSizePolicy(Func_Icons::ICON_LEFT_16.' widget-80pc'), |
|
| 526 | 526 | $W->FlowItems( |
| 527 | - $W->Hidden()->setName($customSection->id . '.' . $fieldId)->setValue($field['name']), |
|
| 527 | + $W->Hidden()->setName($customSection->id.'.'.$fieldId)->setValue($field['name']), |
|
| 528 | 528 | $W->Link('', $this->proxy()->editDisplayField($customSection->id, $field['name'])) |
| 529 | 529 | ->addClass('icon', Func_Icons::ACTIONS_DOCUMENT_EDIT) |
| 530 | 530 | ->setOpenMode(Widget_Link::OPEN_DIALOG), |
| 531 | 531 | $W->Link('', $this->proxy()->removeDisplayField($customSection->id, $field['name'])) |
| 532 | 532 | ->addClass('icon', Func_Icons::ACTIONS_LIST_REMOVE) |
| 533 | 533 | ->setAjaxAction() |
| 534 | - )->setSizePolicy(Func_Icons::ICON_LEFT_16 . ' widget-20pc widget-align-right widget-actions' ) |
|
| 534 | + )->setSizePolicy(Func_Icons::ICON_LEFT_16.' widget-20pc widget-align-right widget-actions') |
|
| 535 | 535 | )->setSizePolicy('widget-list-element widget-actions-target'); |
| 536 | 536 | |
| 537 | 537 | $sectionBox->addItem($fieldItem); |
@@ -603,7 +603,7 @@ discard block |
||
| 603 | 603 | } |
| 604 | 604 | |
| 605 | 605 | header('Content-type: application/json'); |
| 606 | - header('Content-Disposition: attachment; filename="' . $objectName . '.' . ($view === '' ? 'default' : $view) . '.json"'."\n"); |
|
| 606 | + header('Content-Disposition: attachment; filename="'.$objectName.'.'.($view === '' ? 'default' : $view).'.json"'."\n"); |
|
| 607 | 607 | |
| 608 | 608 | $json = bab_json_encode($sectionsValues); |
| 609 | 609 | $json = bab_convertStringFromDatabase($json, bab_charset::UTF_8); |
@@ -854,11 +854,11 @@ discard block |
||
| 854 | 854 | $recordSet = $this->getEditRecordSet(); |
| 855 | 855 | |
| 856 | 856 | $recordClassname = $this->getRecordClassName(); |
| 857 | - $editorClassname = $recordClassname . 'SectionEditor'; |
|
| 857 | + $editorClassname = $recordClassname.'SectionEditor'; |
|
| 858 | 858 | /* @var $editor app_RecordEditor */ |
| 859 | 859 | $editor = $Ui->$editorClassname(); |
| 860 | 860 | if (!isset($itemId)) { |
| 861 | - $itemId = $this->getClass() . '_' . __FUNCTION__; |
|
| 861 | + $itemId = $this->getClass().'_'.__FUNCTION__; |
|
| 862 | 862 | } |
| 863 | 863 | $editor->setId($itemId); |
| 864 | 864 | $editor->setHiddenValue('tg', $App->controllerTg); |
@@ -901,7 +901,7 @@ discard block |
||
| 901 | 901 | public function getModelViewDefaultId($itemId = null) |
| 902 | 902 | { |
| 903 | 903 | if (!isset($itemId)) { |
| 904 | - $itemId = $this->getClass() . '.modelView'; |
|
| 904 | + $itemId = $this->getClass().'.modelView'; |
|
| 905 | 905 | } |
| 906 | 906 | |
| 907 | 907 | return $itemId; |
@@ -935,20 +935,20 @@ discard block |
||
| 935 | 935 | |
| 936 | 936 | switch ($type) { |
| 937 | 937 | case 'cards': |
| 938 | - $tableviewClassname = $recordClassname . 'CardsView'; |
|
| 938 | + $tableviewClassname = $recordClassname.'CardsView'; |
|
| 939 | 939 | break; |
| 940 | 940 | |
| 941 | 941 | case 'map': |
| 942 | - $tableviewClassname = $recordClassname . 'MapView'; |
|
| 942 | + $tableviewClassname = $recordClassname.'MapView'; |
|
| 943 | 943 | break; |
| 944 | 944 | |
| 945 | 945 | case 'calendar': |
| 946 | - $tableviewClassname = $recordClassname . 'CalendarView'; |
|
| 946 | + $tableviewClassname = $recordClassname.'CalendarView'; |
|
| 947 | 947 | break; |
| 948 | 948 | |
| 949 | 949 | case 'table': |
| 950 | 950 | default: |
| 951 | - $tableviewClassname = $recordClassname . 'TableView'; |
|
| 951 | + $tableviewClassname = $recordClassname.'TableView'; |
|
| 952 | 952 | break; |
| 953 | 953 | } |
| 954 | 954 | |
@@ -1014,10 +1014,10 @@ discard block |
||
| 1014 | 1014 | $Ui = $App->Ui(); |
| 1015 | 1015 | |
| 1016 | 1016 | $recordClassname = $this->getRecordClassName(); |
| 1017 | - $editorClassname = $recordClassname . 'Editor'; |
|
| 1017 | + $editorClassname = $recordClassname.'Editor'; |
|
| 1018 | 1018 | $editor = $Ui->$editorClassname(); |
| 1019 | 1019 | if (!isset($itemId)) { |
| 1020 | - $itemId = $this->getClass() . '_' . __FUNCTION__; |
|
| 1020 | + $itemId = $this->getClass().'_'.__FUNCTION__; |
|
| 1021 | 1021 | } |
| 1022 | 1022 | $editor->setId($itemId); |
| 1023 | 1023 | $editor->setHiddenValue('tg', $App->controllerTg); |
@@ -1062,7 +1062,7 @@ discard block |
||
| 1062 | 1062 | $W->Link( |
| 1063 | 1063 | '', |
| 1064 | 1064 | $proxy->setFilteredViewType($tableView->getId(), $viewTypeId) |
| 1065 | - )->addClass('icon', $viewType['icon'] . ($filteredViewType=== $viewTypeId ? ' active' : '')) |
|
| 1065 | + )->addClass('icon', $viewType['icon'].($filteredViewType === $viewTypeId ? ' active' : '')) |
|
| 1066 | 1066 | // ->setSizePolicy('btn btn-xs btn-default ' . ($filteredViewType === $viewTypeId ? 'active' : '')) |
| 1067 | 1067 | ->setTitle($viewType['label']) |
| 1068 | 1068 | ->setAjaxAction() |
@@ -1106,7 +1106,7 @@ discard block |
||
| 1106 | 1106 | |
| 1107 | 1107 | $filterVisibility = $this->getFilterVisibility($itemId); |
| 1108 | 1108 | $filterVisibility = !$filterVisibility; |
| 1109 | - $W->setUserConfiguration($itemId . '/filterVisibility', $filterVisibility); |
|
| 1109 | + $W->setUserConfiguration($itemId.'/filterVisibility', $filterVisibility); |
|
| 1110 | 1110 | |
| 1111 | 1111 | return true; |
| 1112 | 1112 | } |
@@ -1119,10 +1119,10 @@ discard block |
||
| 1119 | 1119 | protected function getFilterVisibility($itemId) |
| 1120 | 1120 | { |
| 1121 | 1121 | $W = bab_Widgets(); |
| 1122 | - $filterVisibility = $W->getUserConfiguration($itemId . '/filterVisibility'); |
|
| 1122 | + $filterVisibility = $W->getUserConfiguration($itemId.'/filterVisibility'); |
|
| 1123 | 1123 | if (!isset($filterVisibility)) { |
| 1124 | 1124 | $filterVisibility = false; |
| 1125 | - $W->setUserConfiguration($itemId . '/filterVisibility', $filterVisibility); |
|
| 1125 | + $W->setUserConfiguration($itemId.'/filterVisibility', $filterVisibility); |
|
| 1126 | 1126 | } |
| 1127 | 1127 | return $filterVisibility; |
| 1128 | 1128 | } |
@@ -1136,7 +1136,7 @@ discard block |
||
| 1136 | 1136 | protected function getFilteredViewType($itemId) |
| 1137 | 1137 | { |
| 1138 | 1138 | $W = bab_Widgets(); |
| 1139 | - $type = $W->getUserConfiguration($itemId . '/viewType'); |
|
| 1139 | + $type = $W->getUserConfiguration($itemId.'/viewType'); |
|
| 1140 | 1140 | if (!isset($type)) { |
| 1141 | 1141 | $type = 'table'; |
| 1142 | 1142 | } |
@@ -1152,7 +1152,7 @@ discard block |
||
| 1152 | 1152 | public function setFilteredViewType($itemId, $type = null) |
| 1153 | 1153 | { |
| 1154 | 1154 | $W = bab_Widgets(); |
| 1155 | - $W->setUserConfiguration($itemId . '/viewType', $type); |
|
| 1155 | + $W->setUserConfiguration($itemId.'/viewType', $type); |
|
| 1156 | 1156 | |
| 1157 | 1157 | return true; |
| 1158 | 1158 | } |
@@ -1294,17 +1294,17 @@ discard block |
||
| 1294 | 1294 | |
| 1295 | 1295 | switch ($format) { |
| 1296 | 1296 | case 'xlsx': |
| 1297 | - $tableview->downloadXlsx($filename . '.xlsx'); |
|
| 1297 | + $tableview->downloadXlsx($filename.'.xlsx'); |
|
| 1298 | 1298 | break; |
| 1299 | 1299 | case 'xls': |
| 1300 | - $tableview->downloadExcel($filename . '.xls'); |
|
| 1300 | + $tableview->downloadExcel($filename.'.xls'); |
|
| 1301 | 1301 | break; |
| 1302 | 1302 | case 'ssv': |
| 1303 | - $tableview->downloadCsv($filename . '.csv', ';', $inline, 'Windows-1252'); |
|
| 1303 | + $tableview->downloadCsv($filename.'.csv', ';', $inline, 'Windows-1252'); |
|
| 1304 | 1304 | break; |
| 1305 | 1305 | case 'csv': |
| 1306 | 1306 | default: |
| 1307 | - $tableview->downloadCsv($filename . '.csv', ',', $inline, bab_charset::getIso()); |
|
| 1307 | + $tableview->downloadCsv($filename.'.csv', ',', $inline, bab_charset::getIso()); |
|
| 1308 | 1308 | break; |
| 1309 | 1309 | } |
| 1310 | 1310 | } |
@@ -1333,7 +1333,7 @@ discard block |
||
| 1333 | 1333 | $Ui = $App->Ui(); |
| 1334 | 1334 | |
| 1335 | 1335 | $recordClassname = $this->getRecordClassName(); |
| 1336 | - $fullFrameClassname = $recordClassname . 'FullFrame'; |
|
| 1336 | + $fullFrameClassname = $recordClassname.'FullFrame'; |
|
| 1337 | 1337 | $fullFrame = $Ui->$fullFrameClassname($record, $view); |
| 1338 | 1338 | |
| 1339 | 1339 | |
@@ -1496,7 +1496,7 @@ discard block |
||
| 1496 | 1496 | |
| 1497 | 1497 | $recordTitle = $record->getRecordTitle(); |
| 1498 | 1498 | |
| 1499 | - $message = sprintf($App->translate('%s has been deleted'), $App->translate($recordSet->getDescription()) . ' "' . $recordTitle . '"'); |
|
| 1499 | + $message = sprintf($App->translate('%s has been deleted'), $App->translate($recordSet->getDescription()).' "'.$recordTitle.'"'); |
|
| 1500 | 1500 | return $message; |
| 1501 | 1501 | } |
| 1502 | 1502 | |
@@ -1623,7 +1623,7 @@ discard block |
||
| 1623 | 1623 | $this->addMessage($deletedMessage); |
| 1624 | 1624 | } |
| 1625 | 1625 | |
| 1626 | - $this->addReloadSelector('.depends-' . strtolower($record->getClassName())); |
|
| 1626 | + $this->addReloadSelector('.depends-'.strtolower($record->getClassName())); |
|
| 1627 | 1627 | |
| 1628 | 1628 | return true; |
| 1629 | 1629 | } |
@@ -1654,7 +1654,7 @@ discard block |
||
| 1654 | 1654 | |
| 1655 | 1655 | $recordTitle = $record->getRecordTitle(); |
| 1656 | 1656 | |
| 1657 | - $subTitle = $App->translate($recordSet->getDescription()) . ' "' . $recordTitle . '"'; |
|
| 1657 | + $subTitle = $App->translate($recordSet->getDescription()).' "'.$recordTitle.'"'; |
|
| 1658 | 1658 | $form->addItem($W->Title($subTitle, 5)); |
| 1659 | 1659 | |
| 1660 | 1660 | $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 | |
@@ -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 | |
@@ -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 | /** |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | $box = $W->VBoxItems(); |
| 75 | 75 | |
| 76 | 76 | foreach ($availableFields as $field) {
|
| 77 | - $fieldName = $field['name']; |
|
| 77 | + $fieldName = $field['name']; |
|
| 78 | 78 | $fieldDescription = $field['description']; |
| 79 | 79 | if (substr($fieldName, 0, 1) !== '_') {
|
| 80 | 80 | $fieldDescription = $App->translate($fieldDescription); |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | $recordSet = $this->getRecordSet(); |
| 281 | 281 | $record = $recordSet->request($id); |
| 282 | 282 | |
| 283 | - $object = $record->object . 'Set'; |
|
| 283 | + $object = $record->object.'Set'; |
|
| 284 | 284 | |
| 285 | 285 | $objectRecordSet = $App->$object(); |
| 286 | 286 | |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | $recordSet = $this->getRecordSet(); |
| 355 | 355 | $record = $recordSet->request($data['id']); |
| 356 | 356 | |
| 357 | - $object = $record->object . 'Set'; |
|
| 357 | + $object = $record->object.'Set'; |
|
| 358 | 358 | |
| 359 | 359 | $objectRecordSet = $App->$object(); |
| 360 | 360 | |