@@ -21,9 +21,9 @@ |
||
| 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_WIDGETS_PATH', APP_UI_PATH . 'widgets/');
|
|
| 28 | -define('APP_CTRL_PATH', dirname(__FILE__) . '/'); |
|
| 29 | -define('APP_PORTLET_PATH', APP_PHP_PATH . 'portlet/'); |
|
| 30 | 24 | \ No newline at end of file |
| 25 | +define('APP_PHP_PATH', dirname(__FILE__).'/');
|
|
| 26 | +define('APP_SET_PATH', dirname(__FILE__).'/');
|
|
| 27 | +define('APP_UI_PATH', dirname(__FILE__).'/ui/');
|
|
| 28 | +define('APP_WIDGETS_PATH', APP_UI_PATH.'widgets/');
|
|
| 29 | +define('APP_CTRL_PATH', dirname(__FILE__).'/'); |
|
| 30 | +define('APP_PORTLET_PATH', APP_PHP_PATH.'portlet/'); |
|
| 31 | 31 | \ No newline at end of file |
@@ -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(); |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | public function selectUserSSE($user = null) |
| 62 | 62 | {
|
| 63 | - if(!isset($user)){
|
|
| 63 | + if (!isset($user)) {
|
|
| 64 | 64 | $App = $this->App(); |
| 65 | 65 | $user = $App->getCurrentUser(); |
| 66 | 66 | } |
@@ -82,29 +82,29 @@ discard block |
||
| 82 | 82 | $userSSEReloads = $this->select($this->user->is($user)->_AND_($this->type->is(AppSSE::TYPE_RELOAD_SELECTOR))); |
| 83 | 83 | $reloadSelectors = array(); |
| 84 | 84 | $now = date('Y-m-d H:i:s');
|
| 85 | - foreach ($userSSEReloads as $sseMsg){
|
|
| 85 | + foreach ($userSSEReloads as $sseMsg) {
|
|
| 86 | 86 | $reloadSelectors[] = $sseMsg->data; |
| 87 | - if($delete && $now > date($sseMsg->deleteOn)){
|
|
| 87 | + if ($delete && $now > date($sseMsg->deleteOn)) {
|
|
| 88 | 88 | $sseMsg->delete(); |
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - if(!empty($reloadSelectors)){
|
|
| 92 | + if (!empty($reloadSelectors)) {
|
|
| 93 | 93 | $sseData .= '"reloadSelector":'.bab_json_encode($reloadSelectors); |
| 94 | 94 | $hasData = true; |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | $userSSEBrowserNotifications = $this->select($this->user->is($user)->_AND_($this->type->is(AppSSE::TYPE_BROWSER_NOTIFICATION))); |
| 98 | 98 | $browserNotifications = array(); |
| 99 | - foreach ($userSSEBrowserNotifications as $sseMsg){
|
|
| 99 | + foreach ($userSSEBrowserNotifications as $sseMsg) {
|
|
| 100 | 100 | $browserNotifications[] = $sseMsg->data; |
| 101 | - if($delete){
|
|
| 101 | + if ($delete) {
|
|
| 102 | 102 | $sseMsg->delete(); |
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - if(!empty($browserNotifications)){
|
|
| 107 | - if($hasData){
|
|
| 106 | + if (!empty($browserNotifications)) {
|
|
| 107 | + if ($hasData) {
|
|
| 108 | 108 | $sseData .= ', '; |
| 109 | 109 | } |
| 110 | 110 | $sseData .= '"browserNotifications":'.bab_json_encode($browserNotifications); |
@@ -125,20 +125,20 @@ discard block |
||
| 125 | 125 | {
|
| 126 | 126 | $App = $this->App(); |
| 127 | 127 | $users = array(); |
| 128 | - if(!isset($for)){
|
|
| 128 | + if (!isset($for)) {
|
|
| 129 | 129 | $users[] = $App->getCurrentUser(); |
| 130 | 130 | } |
| 131 | - else if(!is_array($for)){
|
|
| 132 | - if($for === 'all'){
|
|
| 131 | + else if (!is_array($for)) {
|
|
| 132 | + if ($for === 'all') {
|
|
| 133 | 133 | $users = $App->getLoggedUsers(); |
| 134 | 134 | } |
| 135 | - else{
|
|
| 135 | + else {
|
|
| 136 | 136 | $users[] = $for; |
| 137 | 137 | } |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | $deleteOn = self::getDeleteOn(); |
| 141 | - foreach ($users as $user){
|
|
| 141 | + foreach ($users as $user) {
|
|
| 142 | 142 | $record = $this->newRecord(); |
| 143 | 143 | $record->user = $user; |
| 144 | 144 | $record->data = $reloadSelector; |
@@ -164,20 +164,20 @@ discard block |
||
| 164 | 164 | {
|
| 165 | 165 | $App = $this->App(); |
| 166 | 166 | $users = array(); |
| 167 | - if(!isset($for)){
|
|
| 167 | + if (!isset($for)) {
|
|
| 168 | 168 | $users[] = $App->getCurrentUser(); |
| 169 | 169 | } |
| 170 | - else if(!is_array($for)){
|
|
| 171 | - if($for === 'all'){
|
|
| 170 | + else if (!is_array($for)) {
|
|
| 171 | + if ($for === 'all') {
|
|
| 172 | 172 | $users = $App->getLoggedUsers(); |
| 173 | 173 | } |
| 174 | - else{
|
|
| 174 | + else {
|
|
| 175 | 175 | $users[] = $for; |
| 176 | 176 | } |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | $deleteOn = self::getDeleteOn(); |
| 180 | - foreach ($users as $user){
|
|
| 180 | + foreach ($users as $user) {
|
|
| 181 | 181 | $record = $this->newRecord(); |
| 182 | 182 | $record->user = $user; |
| 183 | 183 | $record->data = bab_json_encode($data); |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | public function getSource() |
| 46 | 46 | { |
| 47 | 47 | $App = $this->App(); |
| 48 | - return $App->getRecordByRef($this->sourceClass . ':' . $this->sourceId); |
|
| 48 | + return $App->getRecordByRef($this->sourceClass.':'.$this->sourceId); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | /** |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | public function getTarget() |
| 55 | 55 | { |
| 56 | 56 | $App = $this->App(); |
| 57 | - return $App->getRecordByRef($this->targetClass . ':' . $this->targetId); |
|
| 57 | + return $App->getRecordByRef($this->targetClass.':'.$this->targetId); |
|
| 58 | 58 | } |
| 59 | 59 | } |
| 60 | 60 | |
@@ -65,7 +65,7 @@ |
||
| 65 | 65 | |
| 66 | 66 | public function selectUserNotifications($user = null, $seen = false) |
| 67 | 67 | { |
| 68 | - if(! isset($user)){ |
|
| 68 | + if (!isset($user)) { |
|
| 69 | 69 | $App = $this->App(); |
| 70 | 70 | $user = $App->getCurrentUser(); |
| 71 | 71 | } |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | { |
| 44 | 44 | $App = $this->App(); |
| 45 | 45 | $sseSet = $App->SSESet(); |
| 46 | - $sseSet->newReloadSelector('.' . self::NOTIFICATION_PORTLET_CLASS); |
|
| 46 | + $sseSet->newReloadSelector('.'.self::NOTIFICATION_PORTLET_CLASS); |
|
| 47 | 47 | $sseSet->newBrowserNotification(array( |
| 48 | 48 | 'title' => $this->title, |
| 49 | 49 | 'body' => $this->description, |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | $this->seen = true; |
| 59 | 59 | $this->save(); |
| 60 | 60 | $sseSet = $this->App()->SSESet(); |
| 61 | - $sseSet->newReloadSelector('.' . self::NOTIFICATION_PORTLET_CLASS); |
|
| 61 | + $sseSet->newReloadSelector('.'.self::NOTIFICATION_PORTLET_CLASS); |
|
| 62 | 62 | return true; |
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | \ No newline at end of file |
@@ -76,18 +76,18 @@ |
||
| 76 | 76 | public function __call($name, $arguments) |
| 77 | 77 | { |
| 78 | 78 | // We delegate all undefined methods to the $item object. |
| 79 | - if(isset($this->item)){ |
|
| 79 | + if (isset($this->item)) { |
|
| 80 | 80 | $returnedValue = call_user_func_array(array( |
| 81 | 81 | $this->item, |
| 82 | 82 | $name |
| 83 | 83 | ), $arguments); |
| 84 | - if($returnedValue === $this->item){ |
|
| 84 | + if ($returnedValue === $this->item) { |
|
| 85 | 85 | $returnedValue = $this; |
| 86 | 86 | } |
| 87 | 87 | return $returnedValue; |
| 88 | 88 | } |
| 89 | - else{ |
|
| 90 | - trigger_error('the method ' . $name . ' does not exists on ' . get_class($this) . ' and there is no widget defined with the setInheritedItem method'); |
|
| 89 | + else { |
|
| 90 | + trigger_error('the method '.$name.' does not exists on '.get_class($this).' and there is no widget defined with the setInheritedItem method'); |
|
| 91 | 91 | } |
| 92 | 92 | } |
| 93 | 93 | |
@@ -50,14 +50,14 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | $this->setHiddenValue('tg', $App->controllerTg); |
| 52 | 52 | |
| 53 | - if(isset($customfield)){ |
|
| 53 | + if (isset($customfield)) { |
|
| 54 | 54 | $this->setHiddenValue('customfield[id]', $customfield->id); |
| 55 | 55 | $values = $customfield->getValues(); |
| 56 | 56 | |
| 57 | - if(! empty($this->customfield->enumvalues)){ |
|
| 57 | + if (!empty($this->customfield->enumvalues)) { |
|
| 58 | 58 | $values['enumvalues'] = unserialize($this->customfield->enumvalues); |
| 59 | 59 | } |
| 60 | - else{ |
|
| 60 | + else { |
|
| 61 | 61 | $values['enumvalues'] = array( |
| 62 | 62 | '0' => '' |
| 63 | 63 | ); |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | $this->addItem($this->searchable()); |
| 83 | 83 | $this->addItem($this->visible()); |
| 84 | 84 | $this->addItem($this->importable()); |
| 85 | - if($App->onlineShop){ |
|
| 85 | + if ($App->onlineShop) { |
|
| 86 | 86 | $this->addItem($this->visible_in_shop()); |
| 87 | 87 | } |
| 88 | 88 | } |
@@ -175,16 +175,16 @@ discard block |
||
| 175 | 175 | $fieldValuesItem->addItem($W->Label($App->translate('List of available values'))); |
| 176 | 176 | $values = array(); |
| 177 | 177 | |
| 178 | - if(isset($this->customfield) && ! empty($this->customfield->enumvalues)){ |
|
| 178 | + if (isset($this->customfield) && !empty($this->customfield->enumvalues)) { |
|
| 179 | 179 | $values = unserialize($this->customfield->enumvalues); |
| 180 | 180 | |
| 181 | - foreach ($values as $name => $text){ |
|
| 181 | + foreach ($values as $name => $text) { |
|
| 182 | 182 | $fieldValuesItem->addItem($W->LineEdit() |
| 183 | 183 | ->setName((string) $name)); |
| 184 | 184 | } |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | - if(empty($values)){ |
|
| 187 | + if (empty($values)) { |
|
| 188 | 188 | $fieldValuesItem->addItem($W->LineEdit() |
| 189 | 189 | ->setName('1')); |
| 190 | 190 | } |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | $row = $W->Items()->setSizePolicy('row'); |
| 277 | 277 | foreach ($customSections as $customSection) { |
| 278 | 278 | |
| 279 | - list(, , $nbCol) = explode('-', $customSection->sizePolicy); |
|
| 279 | + list(,, $nbCol) = explode('-', $customSection->sizePolicy); |
|
| 280 | 280 | |
| 281 | 281 | if ($currentColumn + $nbCol > 12) { |
| 282 | 282 | $this->addItem($row); |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | $parameters = $displayField['parameters']; |
| 304 | 304 | $classname = isset($parameters['classname']) ? $parameters['classname'] : ''; |
| 305 | 305 | $label = isset($parameters['label']) ? $parameters['label'] : ''; |
| 306 | - $displayFieldMethod = '_' . $displayFieldName; |
|
| 306 | + $displayFieldMethod = '_'.$displayFieldName; |
|
| 307 | 307 | |
| 308 | 308 | if (method_exists($this, $displayFieldMethod)) { |
| 309 | 309 | $value = $this->$displayFieldMethod($customSection, $label); |