@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | use Capwelton\Widgets\Widgets\Item\WidgetLink; |
27 | 27 | use Capwelton\Widgets\Widgets\Layout\WidgetFlexLayout; |
28 | 28 | use Capwelton\LibApp\Set\AppNotification; |
29 | -require_once APP_CTRL_PATH . '/record.ctrl.php'; |
|
29 | +require_once APP_CTRL_PATH.'/record.ctrl.php'; |
|
30 | 30 | |
31 | 31 | /** |
32 | 32 | * This controller manages actions that can be performed on notifications |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | ->popup($notifBox->getId())); |
57 | 57 | $page->addClass(AppNotification::NOTIFICATION_PORTLET_CLASS); |
58 | 58 | |
59 | - foreach ($notifications as $notification){ |
|
59 | + foreach ($notifications as $notification) { |
|
60 | 60 | $notifBox->addItem($W->Link($notification->title, $this->proxy() |
61 | 61 | ->display($notification->id)) |
62 | 62 | ->setOpenMode(WidgetLink::OPEN_DIALOG)); |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | { |
70 | 70 | $set = $this->getRecordSet(); |
71 | 71 | $record = $set->get($id); |
72 | - if(! $record){ |
|
72 | + if (!$record) { |
|
73 | 73 | return true; |
74 | 74 | } |
75 | 75 | |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | $notifSet = $App->NotificationSet(); |
113 | 113 | |
114 | 114 | $box = $W->FlowItems()->setIconFormat(24, 'center'); |
115 | - if(isset($itemId)){ |
|
115 | + if (isset($itemId)) { |
|
116 | 116 | $box->setId($itemId); |
117 | 117 | } |
118 | 118 | $notifs = $notifSet->selectUserNotifications(); |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | |
124 | 124 | $box->addItem($btnWidget = $W->FlexItems()) |
125 | 125 | ->setIcon(16, 'left'); |
126 | - if($nbNotif > 0){ |
|
126 | + if ($nbNotif > 0) { |
|
127 | 127 | $btnWidget->addItem($W->Label($nbNotif) |
128 | 128 | ->addClass('notificationNumber')); |
129 | 129 | $btnWidget->addClass('notificationDisplayButton'); |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | ->addClass('notificationBoxElements') |
147 | 147 | ->setDirection(WidgetFlexLayout::FLEX_DIRECTION_COL)); |
148 | 148 | |
149 | - foreach ($notifs as $notif){ |
|
149 | + foreach ($notifs as $notif) { |
|
150 | 150 | $notificationBoxElements->addItem($W->Link($el = $W->FlexItems($W->Label($notif->title) |
151 | 151 | ->addClass('notificationElementTitle'), $W->Label(date('d/m/Y H:i', strtotime($notif->createdOn))) |
152 | 152 | ->addClass('notificationElementDate')) |
@@ -154,10 +154,10 @@ discard block |
||
154 | 154 | ->display($notif->id)) |
155 | 155 | ->addClass('notificationBoxElement') |
156 | 156 | ->setOpenMode(WidgetLink::OPEN_DIALOG)); |
157 | - if(! empty($notif->description)){ |
|
157 | + if (!empty($notif->description)) { |
|
158 | 158 | $desc = $notif->description; |
159 | - if(strlen($desc) > 40){ |
|
160 | - $desc = trim(substr($desc, 0, 40)) . '...'; |
|
159 | + if (strlen($desc) > 40) { |
|
160 | + $desc = trim(substr($desc, 0, 40)).'...'; |
|
161 | 161 | } |
162 | 162 | $el->addItem($W->Label($desc) |
163 | 163 | ->addClass('notificationElementDescription'), 1); |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | |
170 | 170 | $box->addItem($notificationBox); |
171 | 171 | } |
172 | - else{ |
|
172 | + else { |
|
173 | 173 | $notifIcon .= 'webapp-bell-o'; |
174 | 174 | } |
175 | 175 | |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | |
212 | 212 | $notifSet = $App->NotificationSet(); |
213 | 213 | $notifs = $notifSet->selectUserNotifications(); |
214 | - foreach ($notifs as $notif){ |
|
214 | + foreach ($notifs as $notif) { |
|
215 | 215 | $notif->markAsSeen(); |
216 | 216 | } |
217 | 217 |
@@ -168,8 +168,7 @@ |
||
168 | 168 | ->addClass('notificationElementShowMore')); |
169 | 169 | |
170 | 170 | $box->addItem($notificationBox); |
171 | - } |
|
172 | - else{ |
|
171 | + } else{ |
|
173 | 172 | $notifIcon .= 'webapp-bell-o'; |
174 | 173 | } |
175 | 174 |
@@ -27,7 +27,7 @@ |
||
27 | 27 | { |
28 | 28 | public function __construct($action, $code = 0) |
29 | 29 | { |
30 | - $message = 'Unknown method "' . $action->getController() . '::' . $action->getMethod() . '"'; |
|
30 | + $message = 'Unknown method "'.$action->getController().'::'.$action->getMethod().'"'; |
|
31 | 31 | parent::__construct($message, $code); |
32 | 32 | } |
33 | 33 | } |
34 | 34 | \ No newline at end of file |
@@ -72,7 +72,7 @@ |
||
72 | 72 | public function getObjectTitle() |
73 | 73 | { |
74 | 74 | $element = app_translate('object'); |
75 | - if($description = $this->getRecordSet()->getDescription()){ |
|
75 | + if ($description = $this->getRecordSet()->getDescription()) { |
|
76 | 76 | $element = mb_strtolower(app_translate($description)); |
77 | 77 | } |
78 | 78 |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public function getDeletedBy() |
55 | 55 | { |
56 | - if(! $this->record->deletedBy){ |
|
56 | + if (!$this->record->deletedBy) { |
|
57 | 57 | return null; |
58 | 58 | } |
59 | 59 | |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | public function getDeletedOn() |
69 | 69 | { |
70 | 70 | $set = $this->getRecordSet(); |
71 | - if(! $set->deletedOn->isValueSet($this->record->deletedOn)){ |
|
71 | + if (!$set->deletedOn->isValueSet($this->record->deletedOn)) { |
|
72 | 72 | return null; |
73 | 73 | } |
74 | 74 |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | |
80 | 80 | $portlet_path = explode('_', get_class($this)); |
81 | 81 | |
82 | - return implode('/', $app_path) . '/' . $portlet_path[count($portlet_path) - 1]; |
|
82 | + return implode('/', $app_path).'/'.$portlet_path[count($portlet_path) - 1]; |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | { |
90 | 90 | $classname = get_class($this); |
91 | 91 | $suffix = mb_substr($classname, mb_strlen('App_PortletDefinition_')); |
92 | - $classname = 'App_PortletUi_' . $suffix; |
|
92 | + $classname = 'App_PortletUi_'.$suffix; |
|
93 | 93 | |
94 | 94 | return new $classname($this->App()); |
95 | 95 | } |
@@ -109,9 +109,9 @@ |
||
109 | 109 | public function isUpdatable() |
110 | 110 | { |
111 | 111 | return $this->all(); |
112 | - if($this->App() |
|
112 | + if ($this->App() |
|
113 | 113 | ->Access() |
114 | - ->administer()){ |
|
114 | + ->administer()) { |
|
115 | 115 | return $this->all(); |
116 | 116 | } |
117 | 117 | return $this->none(); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | break; |
69 | 69 | |
70 | 70 | default: |
71 | - $function = 'Capwelton\LibOrm\ORM_' . $this->fieldtype . 'Field'; |
|
71 | + $function = 'Capwelton\LibOrm\ORM_'.$this->fieldtype.'Field'; |
|
72 | 72 | $field = $function($this->fieldname); |
73 | 73 | break; |
74 | 74 | } |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | $labelledItem = $W->LabelledWidget($this->name, $widget, null); |
154 | 154 | $labelledItem->setName($this->fieldname); |
155 | 155 | |
156 | - if(! empty($this->description)){ |
|
156 | + if (!empty($this->description)) { |
|
157 | 157 | $labelledItem->setDescription($this->description); |
158 | 158 | } |
159 | 159 |
@@ -80,14 +80,14 @@ discard block |
||
80 | 80 | ORM_BoolField('visible')->setOutputOptions($App->translate('No'), $App->translate('Yes'))->setDescription($App->translate('Column in list')) |
81 | 81 | ); |
82 | 82 | |
83 | - if($App->onlineShop){ |
|
83 | + if ($App->onlineShop) { |
|
84 | 84 | $this->addFields(ORM_BoolField('visible_in_shop')); |
85 | 85 | } |
86 | 86 | } |
87 | 87 | |
88 | 88 | public function save(ORMRecord $record, $noTrace = false) |
89 | 89 | { |
90 | - if(! $record->fieldname){ |
|
90 | + if (!$record->fieldname) { |
|
91 | 91 | $record->fieldname = $this->getFieldName($record->name); |
92 | 92 | } |
93 | 93 | |
@@ -108,11 +108,11 @@ discard block |
||
108 | 108 | $name = preg_replace('/[^a-zA-Z0-9]+/', '', $name); |
109 | 109 | $name = mb_strtolower($name); |
110 | 110 | |
111 | - if(empty($name)){ |
|
111 | + if (empty($name)) { |
|
112 | 112 | throw new AppSaveException($this->App()->translate('The name is mandatory')); |
113 | 113 | } |
114 | 114 | |
115 | - return '_' . $name; |
|
115 | + return '_'.$name; |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | /** |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | |
127 | 127 | $arr = array(); |
128 | 128 | |
129 | - if(isset($App->Article)){ |
|
129 | + if (isset($App->Article)) { |
|
130 | 130 | $arr['Article'] = $App->translate('Products database'); |
131 | 131 | } |
132 | 132 |
@@ -75,8 +75,8 @@ |
||
75 | 75 | public function serialize(AppRecord $record) |
76 | 76 | { |
77 | 77 | $values = $record->getValues(); |
78 | - foreach ($values as $key => $value){ |
|
79 | - if($value instanceof ORMRecordSet){ |
|
78 | + foreach ($values as $key => $value) { |
|
79 | + if ($value instanceof ORMRecordSet) { |
|
80 | 80 | $values[$key] = $value->id; |
81 | 81 | } |
82 | 82 | } |