Passed
Push — master ( e80252...a999dd )
by Nikolay
32:05 queued 14:50
created
www/admin-cabinet/app/controllers/CallDetailRecordsController.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
             return;
49 49
         }
50 50
         // Посчитаем количество уникальных звонков с учетом фильтров
51
-        if ( ! empty($searchPhrase['value'])) {
51
+        if (!empty($searchPhrase['value'])) {
52 52
             $this->prepareConditionsForSearchPhrases($searchPhrase['value'], $parameters);
53 53
             // Если мы не смогли расшифровать строку запроса вернем пустой результата
54 54
             if (empty($parameters['conditions'])) {
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 
103 103
         $arrCdr = [];
104 104
 
105
-        $objectLinkedCallRecord = (object)[
105
+        $objectLinkedCallRecord = (object) [
106 106
             'linkedid'    => '',
107 107
             'disposition' => '',
108 108
             'start'       => '',
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
         ];
115 115
 
116 116
         foreach ($selectedRecords as $record) {
117
-            if ( ! array_key_exists($record->linkedid, $arrCdr)) {
117
+            if (!array_key_exists($record->linkedid, $arrCdr)) {
118 118
                 $arrCdr[$record->linkedid] = clone $objectLinkedCallRecord;
119 119
             }
120 120
             if ($record->is_app !== '1'
@@ -129,12 +129,12 @@  discard block
 block discarded – undo
129 129
             $linkedRecord->disposition = $linkedRecord->disposition !== 'ANSWERED' ? $disposition : 'ANSWERED';
130 130
             $linkedRecord->start       = $linkedRecord->start === '' ? $record->start : $linkedRecord->start;
131 131
             $linkedRecord->src_num     = $linkedRecord->src_num === '' ? $record->src_num : $linkedRecord->src_num;
132
-            if ( ! empty($record->did)) {
132
+            if (!empty($record->did)) {
133 133
                 $linkedRecord->dst_num = $record->did;
134 134
             } else {
135 135
                 $linkedRecord->dst_num = $linkedRecord->dst_num === '' ? $record->dst_num : $linkedRecord->dst_num;
136 136
             }
137
-            $linkedRecord->billsec += (int)$record->billsec;
137
+            $linkedRecord->billsec += (int) $record->billsec;
138 138
             if ($disposition === 'ANSWERED') {
139 139
                 $linkedRecord->answered[] = [
140 140
                     'id'            => $record->id,
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
         }
148 148
         $output = [];
149 149
         foreach ($arrCdr as $cdr) {
150
-            $timing   = gmdate($cdr->billsec<3600?'i:s':'G:i:s', $cdr->billsec);
150
+            $timing   = gmdate($cdr->billsec < 3600 ? 'i:s' : 'G:i:s', $cdr->billsec);
151 151
             $output[] = [
152 152
                 date('d-m-Y H:i:s', strtotime($cdr->start)),
153 153
                 $cdr->src_num,
@@ -187,19 +187,19 @@  discard block
 block discarded – undo
187 187
                 $date                                  = DateTime::createFromFormat('d/m/Y', $matches[0][0]);
188 188
                 $requestedDate                         = $date->format('Y-m-d');
189 189
                 $tomorrowDate                          = $date->modify('+1 day')->format('Y-m-d');
190
-                $parameters['conditions']              .= 'start BETWEEN :dateFromPhrase1: AND :dateFromPhrase2:';
190
+                $parameters['conditions'] .= 'start BETWEEN :dateFromPhrase1: AND :dateFromPhrase2:';
191 191
                 $parameters['bind']['dateFromPhrase1'] = $requestedDate;
192 192
                 $parameters['bind']['dateFromPhrase2'] = $tomorrowDate;
193 193
                 $searchPhrase                          = str_replace($matches[0][0], "", $searchPhrase);
194 194
             } elseif (count($matches[0]) === 2) {
195
-                $parameters['conditions']              .= 'start BETWEEN :dateFromPhrase1: AND :dateFromPhrase2:';
195
+                $parameters['conditions'] .= 'start BETWEEN :dateFromPhrase1: AND :dateFromPhrase2:';
196 196
                 $date                                  = DateTime::createFromFormat('d/m/Y', $matches[0][0]);
197 197
                 $requestedDate                         = $date->format('Y-m-d');
198 198
                 $parameters['bind']['dateFromPhrase1'] = $requestedDate;
199 199
                 $date                                  = DateTime::createFromFormat('d/m/Y', $matches[0][1]);
200 200
                 $tomorrowDate                          = $date->modify('+1 day')->format('Y-m-d');
201 201
                 $parameters['bind']['dateFromPhrase2'] = $tomorrowDate;
202
-                $searchPhrase                          = str_replace([$matches[0][0],$matches[0][1]], '', $searchPhrase);
202
+                $searchPhrase                          = str_replace([$matches[0][0], $matches[0][1]], '', $searchPhrase);
203 203
             }
204 204
         }
205 205
 
@@ -211,17 +211,17 @@  discard block
 block discarded – undo
211 211
             $extensionsLength = PbxSettings::getValueByKey('PBXInternalExtensionLength');
212 212
             if ($parameters['conditions'] !== '') {
213 213
                 $parameters['conditions'] .= ' AND (';
214
-                $needCloseAnd             = true;
214
+                $needCloseAnd = true;
215 215
             }
216 216
             if (count($matches[0]) === 1) {
217 217
                 if ($extensionsLength === strlen($matches[0][0])) {
218
-                    $parameters['conditions']            .= 'src_num = :SearchPhrase1: OR dst_num = :SearchPhrase2:';
218
+                    $parameters['conditions'] .= 'src_num = :SearchPhrase1: OR dst_num = :SearchPhrase2:';
219 219
                     $parameters['bind']['SearchPhrase1'] = $matches[0][0];
220 220
                     $parameters['bind']['SearchPhrase2'] = $matches[0][0];
221 221
                 } else {
222 222
 
223 223
                     $seekNumber                          = substr($matches[0][0], -9);
224
-                    $parameters['conditions']            .= 'src_num LIKE :SearchPhrase1: OR dst_num LIKE :SearchPhrase2: OR did LIKE :SearchPhrase3:';
224
+                    $parameters['conditions'] .= 'src_num LIKE :SearchPhrase1: OR dst_num LIKE :SearchPhrase2: OR did LIKE :SearchPhrase3:';
225 225
                     $parameters['bind']['SearchPhrase1'] = "%{$seekNumber}%";
226 226
                     $parameters['bind']['SearchPhrase2'] = "%{$seekNumber}%";
227 227
                     $parameters['bind']['SearchPhrase3'] = "%{$seekNumber}%";
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
                     $parameters['bind']['SearchPhrase7'] = "%{$seekNumber1}%";
288 288
                     $parameters['bind']['SearchPhrase8'] = "%{$seekNumber0}%";
289 289
                 }
290
-                $searchPhrase = str_replace([$matches[0][0],$matches[0][1]], '', $searchPhrase);
290
+                $searchPhrase = str_replace([$matches[0][0], $matches[0][1]], '', $searchPhrase);
291 291
             }
292 292
             if ($needCloseAnd) {
293 293
                 $parameters['conditions'] .= ')';
Please login to merge, or discard this patch.
www/admin-cabinet/app/controllers/LicensingController.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -30,15 +30,15 @@  discard block
 block discarded – undo
30 30
      */
31 31
     public function modifyAction($backurl = null): void
32 32
     {
33
-        if ($this->language === 'ru'){
34
-            $this->view->modulesExampleImgPath = $this->url->get( 'public/img/modules-example-ru.png' );
33
+        if ($this->language === 'ru') {
34
+            $this->view->modulesExampleImgPath = $this->url->get('public/img/modules-example-ru.png');
35 35
         } else {
36
-            $this->view->modulesExampleImgPath = $this->url->get( 'public/img/modules-example-en.png' );;
36
+            $this->view->modulesExampleImgPath = $this->url->get('public/img/modules-example-en.png'); ;
37 37
         }
38 38
 
39 39
         // Форма лицензионного ключа
40 40
         $licKey                           = PbxSettings::getValueByKey('PBXLicense');
41
-        $changeLicenseKeyForm  = new LicensingChangeLicenseKeyForm(null, ['licKey' => $licKey]);
41
+        $changeLicenseKeyForm = new LicensingChangeLicenseKeyForm(null, ['licKey' => $licKey]);
42 42
         $this->view->changeLicenseKeyForm = $changeLicenseKeyForm;
43 43
 
44 44
         // Форма активации купона
@@ -58,11 +58,11 @@  discard block
 block discarded – undo
58 58
      */
59 59
     public function updateLicenseAction(): void
60 60
     {
61
-        if ( ! $this->request->isPost()) {
61
+        if (!$this->request->isPost()) {
62 62
             return;
63 63
         }
64 64
         $data = $this->request->getPost();
65
-        if ( ! empty($data['licKey'])) {
65
+        if (!empty($data['licKey'])) {
66 66
             $oldLicKey = PbxSettings::getValueByKey('PBXLicense');
67 67
             if ($oldLicKey !== $data['licKey']) {
68 68
 
@@ -72,10 +72,10 @@  discard block
 block discarded – undo
72 72
                     $this->licenseWorker->changeLicenseKey($data['licKey']);
73 73
                     $this->licenseWorker->addTrial('11'); // Askozia PBX
74 74
                     $this->view->success = true;
75
-                } elseif ( ! empty($licenseInfo) && strpos($licenseInfo, '2026') !== false) {
75
+                } elseif (!empty($licenseInfo) && strpos($licenseInfo, '2026') !== false) {
76 76
                     $this->flash->error($this->translation->_('lic_FailedCheckLicense2026'));
77 77
                     $this->view->success = false;
78
-                } elseif  (! empty($licenseInfo)) {
78
+                } elseif (!empty($licenseInfo)) {
79 79
                     $this->flash->error($licenseInfo);
80 80
                     $this->view->success = false;
81 81
                 } else {
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
                 }
85 85
 
86 86
             }
87
-            if ( ! empty($data['coupon'])) {
87
+            if (!empty($data['coupon'])) {
88 88
                 $result
89 89
                     = $this->licenseWorker->activateCoupon($data['coupon']);
90 90
                 if ($result === true) {
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
         }
112 112
 
113 113
         if ($this->view->success === true) {
114
-            if ( ! empty($data['backurl'])) {
114
+            if (!empty($data['backurl'])) {
115 115
                 $this->view->reload = $data['backurl'].'/index/';
116 116
             } else {
117 117
                 $this->view->reload = 'licensing/modify/';
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
     {
130 130
         $this->db->begin();
131 131
         $record = PbxSettings::findFirstByKey('PBXLicense');
132
-        if ( ! $record) {
132
+        if (!$record) {
133 133
             $record      = new PbxSettings();
134 134
             $record->key = 'PBXLicense';
135 135
         }
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
     public function getBaseFeatureStatusAction() :void
190 190
     {
191 191
         $checkBaseFeature = $this->licenseWorker->featureAvailable(33);
192
-        if ($checkBaseFeature['success']===false) {
192
+        if ($checkBaseFeature['success'] === false) {
193 193
             $this->view->success = false;
194 194
             $this->view->message = $this->licenseWorker->translateLicenseErrorMessage($checkBaseFeature['error']);
195 195
         } else {
@@ -203,21 +203,21 @@  discard block
 block discarded – undo
203 203
     public function captureFeatureForProductIdAction() :void
204 204
     {
205 205
         $this->view->success = true;
206
-        if ( ! $this->request->isPost()) {
206
+        if (!$this->request->isPost()) {
207 207
             return;
208 208
         }
209 209
         $data = $this->request->getPost();
210
-        if (!isset( $data['licFeatureId'], $data['licProductId'])){
210
+        if (!isset($data['licFeatureId'], $data['licProductId'])) {
211 211
             return;
212 212
         }
213
-        if ($data['licFeatureId']> 0){
213
+        if ($data['licFeatureId'] > 0) {
214 214
             // Пробуем захватить фичу
215 215
             $result = $this->licenseWorker->captureFeature($data['licFeatureId']);
216
-            if ($result['success']===false) {
216
+            if ($result['success'] === false) {
217 217
                 // Добавим тириал и захватим фичу еще раз
218 218
                 $this->licenseWorker->addTrial($data['licProductId']);
219 219
                 $result = $this->licenseWorker->captureFeature($data['licFeatureId']);
220
-                if ($result['success']===false) {
220
+                if ($result['success'] === false) {
221 221
                     $this->view->message = $this->licenseWorker->translateLicenseErrorMessage($result['error']);
222 222
                     $this->view->success = false;
223 223
                 }
Please login to merge, or discard this patch.
www/admin-cabinet/app/controllers/SoundFilesController.php 4 patches
Indentation   +104 added lines, -104 removed lines patch added patch discarded remove patch
@@ -13,109 +13,109 @@
 block discarded – undo
13 13
 class SoundFilesController extends BaseController {
14 14
 
15 15
 
16
-	/**
17
-	 * Построение списка файлов
18
-	 */
19
-	public function indexAction() {
20
-
21
-		$files = SoundFiles::find();
22
-
23
-		$this->view->files = $files;
24
-
25
-	}
26
-
27
-
28
-	/**
29
-	 * Открытие карточки редактирования Файла записи
30
-	 *
31
-	 * @param string $id редактируемой записи
32
-	 */
33
-	public function modifyAction( string $id = NULL ) {
34
-		$file = SoundFiles::findFirstById( $id );
35
-		if (!$file) {
36
-			$file = new SoundFiles();
37
-		}
38
-
39
-		$form                  = new SoundFilesEditForm( $file );
40
-		$this->view->form      = $form;
41
-		$this->view->audioPath = empty($file->path)?'':"/pbxcore/api/cdr/playback?view={$file->path}";
42
-
43
-	}
44
-
45
-
46
-	/**
47
-	 * Сохранение параметров переопределения системного файла
48
-	 * @return void
49
-	 */
50
-	public function saveAction(){
51
-		if (!$this->request->isPost()) {
52
-			return;
53
-		}
54
-		$data = $this->request->getPost();
55
-
56
-		$soundFile = SoundFiles::findFirstById( $data['id'] );
57
-		if ( $soundFile === FALSE ) {
58
-			$soundFile = new SoundFiles();
59
-		}
60
-
61
-		foreach ( $soundFile as $name => $value ) {
62
-			switch ($name ) {
63
-				case "id":
64
-					break;
65
-				default:
66
-					if (!array_key_exists($name, $data)) {
67
-						continue;
68
-					}
69
-					$soundFile->$name = $data[ $name];
70
-			}
71
-		}
72
-
73
-		if ( $soundFile->save() === FALSE ) {
74
-			$errors = $soundFile->getMessages();
75
-			$this->flash->error(implode('<br>', $errors));
76
-			$this->view->success = false;
77
-		} else {
78
-			$this->flash->success($this->translation->_('ms_SuccessfulSaved'));
79
-			$this->view->success = true;
80
-			// Если это было создание карточки то надо перегрузить страницу с указанием ID
81
-			if ( empty( $data['id'] ) ) {
82
-				$this->view->reload = "sound-files/modify/{$soundFile->id}";
83
-			}
84
-		}
85
-	}
86
-
87
-	/**
88
-	 * Удаление файла по его ID
89
-	 *
90
-	 * @param string $id
91
-	 */
92
-	public function deleteAction( string $id = NULL ) {
93
-		$soundFile = SoundFiles::findFirstById( $id );
94
-		$errors   = FALSE;
95
-		if ( $soundFile && ! $soundFile->delete() ) {
96
-			$errors = $soundFile->getMessages();
97
-		}
98
-		if ( $errors ) {
99
-			$this->flash->error( implode( '<br>', $errors ) );
100
-			$this->view->success = FALSE;
101
-		} else {
102
-			$this->view->success = TRUE;
103
-		}
104
-	}
105
-
106
-	/**
107
-	 * Получение полного пути к файлу по его ID
108
-	 *
109
-	 * @param string $id
110
-	 */
111
-	public function getPathByIdAction( string $id = NULL ) {
112
-		$soundFile = SoundFiles::findFirstById( $id );
113
-		if ( $soundFile ) {
114
-			$this->view->message = $soundFile->path;
115
-			$this->view->success = TRUE;
116
-		} else {
117
-			$this->view->success = FALSE;
118
-		}
119
-	}
16
+    /**
17
+     * Построение списка файлов
18
+     */
19
+    public function indexAction() {
20
+
21
+        $files = SoundFiles::find();
22
+
23
+        $this->view->files = $files;
24
+
25
+    }
26
+
27
+
28
+    /**
29
+     * Открытие карточки редактирования Файла записи
30
+     *
31
+     * @param string $id редактируемой записи
32
+     */
33
+    public function modifyAction( string $id = NULL ) {
34
+        $file = SoundFiles::findFirstById( $id );
35
+        if (!$file) {
36
+            $file = new SoundFiles();
37
+        }
38
+
39
+        $form                  = new SoundFilesEditForm( $file );
40
+        $this->view->form      = $form;
41
+        $this->view->audioPath = empty($file->path)?'':"/pbxcore/api/cdr/playback?view={$file->path}";
42
+
43
+    }
44
+
45
+
46
+    /**
47
+     * Сохранение параметров переопределения системного файла
48
+     * @return void
49
+     */
50
+    public function saveAction(){
51
+        if (!$this->request->isPost()) {
52
+            return;
53
+        }
54
+        $data = $this->request->getPost();
55
+
56
+        $soundFile = SoundFiles::findFirstById( $data['id'] );
57
+        if ( $soundFile === FALSE ) {
58
+            $soundFile = new SoundFiles();
59
+        }
60
+
61
+        foreach ( $soundFile as $name => $value ) {
62
+            switch ($name ) {
63
+                case "id":
64
+                    break;
65
+                default:
66
+                    if (!array_key_exists($name, $data)) {
67
+                        continue;
68
+                    }
69
+                    $soundFile->$name = $data[ $name];
70
+            }
71
+        }
72
+
73
+        if ( $soundFile->save() === FALSE ) {
74
+            $errors = $soundFile->getMessages();
75
+            $this->flash->error(implode('<br>', $errors));
76
+            $this->view->success = false;
77
+        } else {
78
+            $this->flash->success($this->translation->_('ms_SuccessfulSaved'));
79
+            $this->view->success = true;
80
+            // Если это было создание карточки то надо перегрузить страницу с указанием ID
81
+            if ( empty( $data['id'] ) ) {
82
+                $this->view->reload = "sound-files/modify/{$soundFile->id}";
83
+            }
84
+        }
85
+    }
86
+
87
+    /**
88
+     * Удаление файла по его ID
89
+     *
90
+     * @param string $id
91
+     */
92
+    public function deleteAction( string $id = NULL ) {
93
+        $soundFile = SoundFiles::findFirstById( $id );
94
+        $errors   = FALSE;
95
+        if ( $soundFile && ! $soundFile->delete() ) {
96
+            $errors = $soundFile->getMessages();
97
+        }
98
+        if ( $errors ) {
99
+            $this->flash->error( implode( '<br>', $errors ) );
100
+            $this->view->success = FALSE;
101
+        } else {
102
+            $this->view->success = TRUE;
103
+        }
104
+    }
105
+
106
+    /**
107
+     * Получение полного пути к файлу по его ID
108
+     *
109
+     * @param string $id
110
+     */
111
+    public function getPathByIdAction( string $id = NULL ) {
112
+        $soundFile = SoundFiles::findFirstById( $id );
113
+        if ( $soundFile ) {
114
+            $this->view->message = $soundFile->path;
115
+            $this->view->success = TRUE;
116
+        } else {
117
+            $this->view->success = FALSE;
118
+        }
119
+    }
120 120
 
121 121
 }
122 122
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -30,15 +30,15 @@  discard block
 block discarded – undo
30 30
 	 *
31 31
 	 * @param string $id редактируемой записи
32 32
 	 */
33
-	public function modifyAction( string $id = NULL ) {
34
-		$file = SoundFiles::findFirstById( $id );
33
+	public function modifyAction(string $id = NULL) {
34
+		$file = SoundFiles::findFirstById($id);
35 35
 		if (!$file) {
36 36
 			$file = new SoundFiles();
37 37
 		}
38 38
 
39
-		$form                  = new SoundFilesEditForm( $file );
39
+		$form                  = new SoundFilesEditForm($file);
40 40
 		$this->view->form      = $form;
41
-		$this->view->audioPath = empty($file->path)?'':"/pbxcore/api/cdr/playback?view={$file->path}";
41
+		$this->view->audioPath = empty($file->path) ? '' : "/pbxcore/api/cdr/playback?view={$file->path}";
42 42
 
43 43
 	}
44 44
 
@@ -47,30 +47,30 @@  discard block
 block discarded – undo
47 47
 	 * Сохранение параметров переопределения системного файла
48 48
 	 * @return void
49 49
 	 */
50
-	public function saveAction(){
50
+	public function saveAction() {
51 51
 		if (!$this->request->isPost()) {
52 52
 			return;
53 53
 		}
54 54
 		$data = $this->request->getPost();
55 55
 
56
-		$soundFile = SoundFiles::findFirstById( $data['id'] );
57
-		if ( $soundFile === FALSE ) {
56
+		$soundFile = SoundFiles::findFirstById($data['id']);
57
+		if ($soundFile === FALSE) {
58 58
 			$soundFile = new SoundFiles();
59 59
 		}
60 60
 
61
-		foreach ( $soundFile as $name => $value ) {
62
-			switch ($name ) {
61
+		foreach ($soundFile as $name => $value) {
62
+			switch ($name) {
63 63
 				case "id":
64 64
 					break;
65 65
 				default:
66 66
 					if (!array_key_exists($name, $data)) {
67 67
 						continue;
68 68
 					}
69
-					$soundFile->$name = $data[ $name];
69
+					$soundFile->$name = $data[$name];
70 70
 			}
71 71
 		}
72 72
 
73
-		if ( $soundFile->save() === FALSE ) {
73
+		if ($soundFile->save() === FALSE) {
74 74
 			$errors = $soundFile->getMessages();
75 75
 			$this->flash->error(implode('<br>', $errors));
76 76
 			$this->view->success = false;
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 			$this->flash->success($this->translation->_('ms_SuccessfulSaved'));
79 79
 			$this->view->success = true;
80 80
 			// Если это было создание карточки то надо перегрузить страницу с указанием ID
81
-			if ( empty( $data['id'] ) ) {
81
+			if (empty($data['id'])) {
82 82
 				$this->view->reload = "sound-files/modify/{$soundFile->id}";
83 83
 			}
84 84
 		}
@@ -89,14 +89,14 @@  discard block
 block discarded – undo
89 89
 	 *
90 90
 	 * @param string $id
91 91
 	 */
92
-	public function deleteAction( string $id = NULL ) {
93
-		$soundFile = SoundFiles::findFirstById( $id );
94
-		$errors   = FALSE;
95
-		if ( $soundFile && ! $soundFile->delete() ) {
92
+	public function deleteAction(string $id = NULL) {
93
+		$soundFile = SoundFiles::findFirstById($id);
94
+		$errors = FALSE;
95
+		if ($soundFile && !$soundFile->delete()) {
96 96
 			$errors = $soundFile->getMessages();
97 97
 		}
98
-		if ( $errors ) {
99
-			$this->flash->error( implode( '<br>', $errors ) );
98
+		if ($errors) {
99
+			$this->flash->error(implode('<br>', $errors));
100 100
 			$this->view->success = FALSE;
101 101
 		} else {
102 102
 			$this->view->success = TRUE;
@@ -108,9 +108,9 @@  discard block
 block discarded – undo
108 108
 	 *
109 109
 	 * @param string $id
110 110
 	 */
111
-	public function getPathByIdAction( string $id = NULL ) {
112
-		$soundFile = SoundFiles::findFirstById( $id );
113
-		if ( $soundFile ) {
111
+	public function getPathByIdAction(string $id = NULL) {
112
+		$soundFile = SoundFiles::findFirstById($id);
113
+		if ($soundFile) {
114 114
 			$this->view->message = $soundFile->path;
115 115
 			$this->view->success = TRUE;
116 116
 		} else {
Please login to merge, or discard this patch.
Braces   +12 added lines, -6 removed lines patch added patch discarded remove patch
@@ -10,13 +10,15 @@  discard block
 block discarded – undo
10 10
 use Models\SoundFiles;
11 11
 use Phalcon\Text;
12 12
 
13
-class SoundFilesController extends BaseController {
13
+class SoundFilesController extends BaseController
14
+{
14 15
 
15 16
 
16 17
 	/**
17 18
 	 * Построение списка файлов
18 19
 	 */
19
-	public function indexAction() {
20
+	public function indexAction()
21
+	{
20 22
 
21 23
 		$files = SoundFiles::find();
22 24
 
@@ -30,7 +32,8 @@  discard block
 block discarded – undo
30 32
 	 *
31 33
 	 * @param string $id редактируемой записи
32 34
 	 */
33
-	public function modifyAction( string $id = NULL ) {
35
+	public function modifyAction( string $id = NULL )
36
+	{
34 37
 		$file = SoundFiles::findFirstById( $id );
35 38
 		if (!$file) {
36 39
 			$file = new SoundFiles();
@@ -47,7 +50,8 @@  discard block
 block discarded – undo
47 50
 	 * Сохранение параметров переопределения системного файла
48 51
 	 * @return void
49 52
 	 */
50
-	public function saveAction(){
53
+	public function saveAction()
54
+	{
51 55
 		if (!$this->request->isPost()) {
52 56
 			return;
53 57
 		}
@@ -89,7 +93,8 @@  discard block
 block discarded – undo
89 93
 	 *
90 94
 	 * @param string $id
91 95
 	 */
92
-	public function deleteAction( string $id = NULL ) {
96
+	public function deleteAction( string $id = NULL )
97
+	{
93 98
 		$soundFile = SoundFiles::findFirstById( $id );
94 99
 		$errors   = FALSE;
95 100
 		if ( $soundFile && ! $soundFile->delete() ) {
@@ -108,7 +113,8 @@  discard block
 block discarded – undo
108 113
 	 *
109 114
 	 * @param string $id
110 115
 	 */
111
-	public function getPathByIdAction( string $id = NULL ) {
116
+	public function getPathByIdAction( string $id = NULL )
117
+	{
112 118
 		$soundFile = SoundFiles::findFirstById( $id );
113 119
 		if ( $soundFile ) {
114 120
 			$this->view->message = $soundFile->path;
Please login to merge, or discard this patch.
Upper-Lower-Casing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	 *
31 31
 	 * @param string $id редактируемой записи
32 32
 	 */
33
-	public function modifyAction( string $id = NULL ) {
33
+	public function modifyAction( string $id = null ) {
34 34
 		$file = SoundFiles::findFirstById( $id );
35 35
 		if (!$file) {
36 36
 			$file = new SoundFiles();
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 		$data = $this->request->getPost();
55 55
 
56 56
 		$soundFile = SoundFiles::findFirstById( $data['id'] );
57
-		if ( $soundFile === FALSE ) {
57
+		if ( $soundFile === false ) {
58 58
 			$soundFile = new SoundFiles();
59 59
 		}
60 60
 
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 			}
71 71
 		}
72 72
 
73
-		if ( $soundFile->save() === FALSE ) {
73
+		if ( $soundFile->save() === false ) {
74 74
 			$errors = $soundFile->getMessages();
75 75
 			$this->flash->error(implode('<br>', $errors));
76 76
 			$this->view->success = false;
@@ -89,17 +89,17 @@  discard block
 block discarded – undo
89 89
 	 *
90 90
 	 * @param string $id
91 91
 	 */
92
-	public function deleteAction( string $id = NULL ) {
92
+	public function deleteAction( string $id = null ) {
93 93
 		$soundFile = SoundFiles::findFirstById( $id );
94
-		$errors   = FALSE;
94
+		$errors   = false;
95 95
 		if ( $soundFile && ! $soundFile->delete() ) {
96 96
 			$errors = $soundFile->getMessages();
97 97
 		}
98 98
 		if ( $errors ) {
99 99
 			$this->flash->error( implode( '<br>', $errors ) );
100
-			$this->view->success = FALSE;
100
+			$this->view->success = false;
101 101
 		} else {
102
-			$this->view->success = TRUE;
102
+			$this->view->success = true;
103 103
 		}
104 104
 	}
105 105
 
@@ -108,13 +108,13 @@  discard block
 block discarded – undo
108 108
 	 *
109 109
 	 * @param string $id
110 110
 	 */
111
-	public function getPathByIdAction( string $id = NULL ) {
111
+	public function getPathByIdAction( string $id = null ) {
112 112
 		$soundFile = SoundFiles::findFirstById( $id );
113 113
 		if ( $soundFile ) {
114 114
 			$this->view->message = $soundFile->path;
115
-			$this->view->success = TRUE;
115
+			$this->view->success = true;
116 116
 		} else {
117
-			$this->view->success = FALSE;
117
+			$this->view->success = false;
118 118
 		}
119 119
 	}
120 120
 
Please login to merge, or discard this patch.
www/admin-cabinet/app/controllers/OutOffWorkTimeController.php 4 patches
Indentation   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -14,42 +14,42 @@  discard block
 block discarded – undo
14 14
 class OutOffWorkTimeController extends BaseController {
15 15
 
16 16
 
17
-	/**
18
-	 * Построение списка правила маршрутизации в нерабочее время
19
-	 */
17
+    /**
18
+     * Построение списка правила маршрутизации в нерабочее время
19
+     */
20 20
     public function indexAction()
21 21
     {
22 22
         $paremeters = array(
23
-	        'order' => 'date_from, weekday_from, time_from',
23
+            'order' => 'date_from, weekday_from, time_from',
24 24
         );
25
-	    $timeframesTable=[];
25
+        $timeframesTable=[];
26 26
         $timeFrames= OutWorkTimes::find($paremeters);
27 27
         foreach ($timeFrames as $timeFrame){
28
-               $timeframesTable[]=[
29
-	               'id'               =>$timeFrame->id,
30
-	               'date_from'        => ( ! empty( $timeFrame->date_from ) )
31
-	                                     > 0 ? date( "d/m/Y",
32
-		               $timeFrame->date_from ) : '',
33
-	               'date_to'          => ( ! empty( $timeFrame->date_to ) ) > 0
34
-		               ? date( "d/m/Y", $timeFrame->date_to ) : '',
35
-	               'weekday_from'     =>(!empty($timeFrame->weekday_from))?$this->translation->_(date('D', strtotime("Sunday +{$timeFrame->weekday_from} days"))):'',
36
-	               'weekday_to'       =>(!empty($timeFrame->weekday_to))?$this->translation->_(date('D', strtotime("Sunday +{$timeFrame->weekday_to} days"))):'',
37
-	               'time_from'        => $timeFrame->time_from,
38
-	               'time_to'          =>$timeFrame->time_to,
39
-	               'action'           =>$timeFrame->action,
40
-	               'audio_message_id' =>($timeFrame->SoundFiles)?$timeFrame->SoundFiles->name:'',
41
-	               'extension'        =>($timeFrame->Extensions)?$timeFrame->Extensions->getRepresent():'',
42
-	               'description'      =>$timeFrame->description,
28
+                $timeframesTable[]=[
29
+                    'id'               =>$timeFrame->id,
30
+                    'date_from'        => ( ! empty( $timeFrame->date_from ) )
31
+                                            > 0 ? date( "d/m/Y",
32
+                        $timeFrame->date_from ) : '',
33
+                    'date_to'          => ( ! empty( $timeFrame->date_to ) ) > 0
34
+                       ? date( "d/m/Y", $timeFrame->date_to ) : '',
35
+                    'weekday_from'     =>(!empty($timeFrame->weekday_from))?$this->translation->_(date('D', strtotime("Sunday +{$timeFrame->weekday_from} days"))):'',
36
+                    'weekday_to'       =>(!empty($timeFrame->weekday_to))?$this->translation->_(date('D', strtotime("Sunday +{$timeFrame->weekday_to} days"))):'',
37
+                    'time_from'        => $timeFrame->time_from,
38
+                    'time_to'          =>$timeFrame->time_to,
39
+                    'action'           =>$timeFrame->action,
40
+                    'audio_message_id' =>($timeFrame->SoundFiles)?$timeFrame->SoundFiles->name:'',
41
+                    'extension'        =>($timeFrame->Extensions)?$timeFrame->Extensions->getRepresent():'',
42
+                    'description'      =>$timeFrame->description,
43 43
                 ];
44 44
         }
45 45
 
46 46
         $this->view->indexTable = $timeframesTable;
47 47
     }
48 48
 
49
-	/**
50
-	 * Карточка редактирования записи нерабочего времени
51
-	 * @param null $id
52
-	 */
49
+    /**
50
+     * Карточка редактирования записи нерабочего времени
51
+     * @param null $id
52
+     */
53 53
     public function modifyAction($id=null)
54 54
     {
55 55
         $timeFrame = OutWorkTimes::findFirstById($id);
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
             $timeFrame = new OutWorkTimes();
58 58
         }
59 59
 
60
-	    $forwardingExtensions[""] = $this->translation->_( "ex_SelectNumber" );
60
+        $forwardingExtensions[""] = $this->translation->_( "ex_SelectNumber" );
61 61
         $parameters               =[
62 62
             'conditions'=>'number = :extension:',
63 63
             'bind'=>[
@@ -66,10 +66,10 @@  discard block
 block discarded – undo
66 66
         ];
67 67
         $extensions               = Extensions::find($parameters);
68 68
         foreach ($extensions as $record){
69
-              $forwardingExtensions[$record->number]=$record->getRepresent();
69
+                $forwardingExtensions[$record->number]=$record->getRepresent();
70 70
         }
71 71
 
72
-	    $audioMessages[""] = $this->translation->_( "sf_SelectAudioFile" );
72
+        $audioMessages[""] = $this->translation->_( "sf_SelectAudioFile" );
73 73
         $soundFiles        = SoundFiles::find();
74 74
         foreach ($soundFiles as $record){
75 75
             $audioMessages[$record->id]=$record->name;
@@ -92,18 +92,18 @@  discard block
 block discarded – undo
92 92
             'week-days'=>$weekDays
93 93
         ]);
94 94
         $this->view->form = $form;
95
-	    $this->view->represent  = $timeFrame->getRepresent();
95
+        $this->view->represent  = $timeFrame->getRepresent();
96 96
     }
97 97
 
98
-	/**
99
-	 * Сохранение записи нерабочего времени
100
-	 */
98
+    /**
99
+     * Сохранение записи нерабочего времени
100
+     */
101 101
     public function saveAction()
102 102
     {
103 103
         if (!$this->request->isPost()) return;
104 104
         $data = $this->request->getPost();
105 105
 
106
-	    $this->db->begin();
106
+        $this->db->begin();
107 107
         $timeFrame = OutWorkTimes::findFirstByid($data['id']);
108 108
         if ($timeFrame==false) {
109 109
             $timeFrame= new OutWorkTimes();
@@ -114,21 +114,21 @@  discard block
 block discarded – undo
114 114
             switch ($name) {
115 115
                 case 'weekday_from':
116 116
                 case 'weekday_to':
117
-	                if ( ! array_key_exists( $name, $data ) ) {
118
-		                $timeFrame->$name = '';
119
-	                }
120
-	                $timeFrame->$name = ( $data[ $name ] < 1 ) ? NULL
121
-		                : $data[ $name ];
117
+                    if ( ! array_key_exists( $name, $data ) ) {
118
+                        $timeFrame->$name = '';
119
+                    }
120
+                    $timeFrame->$name = ( $data[ $name ] < 1 ) ? NULL
121
+                        : $data[ $name ];
122 122
                     break;
123 123
                 case 'date_from':
124 124
                 case 'date_to':
125
-	            case 'time_from':
126
-	            case 'time_to':
127
-		            if ( ! array_key_exists( $name, $data ) ) {
128
-			            $timeFrame->$name = '';
129
-		            }
130
-		            $timeFrame->$name = $data[ $name ];
131
-		            break;
125
+                case 'time_from':
126
+                case 'time_to':
127
+                    if ( ! array_key_exists( $name, $data ) ) {
128
+                        $timeFrame->$name = '';
129
+                    }
130
+                    $timeFrame->$name = $data[ $name ];
131
+                    break;
132 132
                 default:
133 133
                     if (!array_key_exists( $name, $data)) continue;
134 134
                     $timeFrame->$name = $data[ $name];
@@ -139,27 +139,27 @@  discard block
 block discarded – undo
139 139
             $errors = $timeFrame->getMessages();
140 140
             $this->flash->warning(implode('<br>', $errors));
141 141
             $this->view->success=false;
142
-	        $this->db->rollback();
142
+            $this->db->rollback();
143 143
             return;
144 144
         }
145 145
 
146
-	    $this->flash->success($this->translation->_('ms_SuccessfulSaved'));
147
-	    $this->view->success=true;
148
-	    $this->db->commit();
146
+        $this->flash->success($this->translation->_('ms_SuccessfulSaved'));
147
+        $this->view->success=true;
148
+        $this->db->commit();
149 149
 
150
-	    // Если это было создание карточки то надо перегрузить страницу с указанием ID
151
-	    if (empty($data['id'])){
152
-		    $this->view->reload = "out-off-work-time/modify/{$timeFrame->id}";
153
-	    }
150
+        // Если это было создание карточки то надо перегрузить страницу с указанием ID
151
+        if (empty($data['id'])){
152
+            $this->view->reload = "out-off-work-time/modify/{$timeFrame->id}";
153
+        }
154 154
 
155 155
     }
156 156
 
157
-	/**
158
-	 * Удаление запси с данными о нерабочем времени
159
-	 * @param null $id
160
-	 */
157
+    /**
158
+     * Удаление запси с данными о нерабочем времени
159
+     * @param null $id
160
+     */
161 161
     public function deleteAction($id=null){
162
-    	$timeFrame = OutWorkTimes::findFirstByid($id);
162
+        $timeFrame = OutWorkTimes::findFirstByid($id);
163 163
         if ($timeFrame) $timeFrame->delete();
164 164
         return $this->forward('OutOffWorkTime/index');
165 165
 
Please login to merge, or discard this patch.
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -22,23 +22,23 @@  discard block
 block discarded – undo
22 22
         $paremeters = array(
23 23
 	        'order' => 'date_from, weekday_from, time_from',
24 24
         );
25
-	    $timeframesTable=[];
26
-        $timeFrames= OutWorkTimes::find($paremeters);
27
-        foreach ($timeFrames as $timeFrame){
28
-               $timeframesTable[]=[
25
+	    $timeframesTable = [];
26
+        $timeFrames = OutWorkTimes::find($paremeters);
27
+        foreach ($timeFrames as $timeFrame) {
28
+               $timeframesTable[] = [
29 29
 	               'id'               =>$timeFrame->id,
30
-	               'date_from'        => ( ! empty( $timeFrame->date_from ) )
31
-	                                     > 0 ? date( "d/m/Y",
32
-		               $timeFrame->date_from ) : '',
33
-	               'date_to'          => ( ! empty( $timeFrame->date_to ) ) > 0
34
-		               ? date( "d/m/Y", $timeFrame->date_to ) : '',
35
-	               'weekday_from'     =>(!empty($timeFrame->weekday_from))?$this->translation->_(date('D', strtotime("Sunday +{$timeFrame->weekday_from} days"))):'',
36
-	               'weekday_to'       =>(!empty($timeFrame->weekday_to))?$this->translation->_(date('D', strtotime("Sunday +{$timeFrame->weekday_to} days"))):'',
30
+	               'date_from'        => (!empty($timeFrame->date_from))
31
+	                                     > 0 ? date("d/m/Y",
32
+		               $timeFrame->date_from) : '',
33
+	               'date_to'          => (!empty($timeFrame->date_to)) > 0
34
+		               ? date("d/m/Y", $timeFrame->date_to) : '',
35
+	               'weekday_from'     =>(!empty($timeFrame->weekday_from)) ? $this->translation->_(date('D', strtotime("Sunday +{$timeFrame->weekday_from} days"))) : '',
36
+	               'weekday_to'       =>(!empty($timeFrame->weekday_to)) ? $this->translation->_(date('D', strtotime("Sunday +{$timeFrame->weekday_to} days"))) : '',
37 37
 	               'time_from'        => $timeFrame->time_from,
38 38
 	               'time_to'          =>$timeFrame->time_to,
39 39
 	               'action'           =>$timeFrame->action,
40
-	               'audio_message_id' =>($timeFrame->SoundFiles)?$timeFrame->SoundFiles->name:'',
41
-	               'extension'        =>($timeFrame->Extensions)?$timeFrame->Extensions->getRepresent():'',
40
+	               'audio_message_id' =>($timeFrame->SoundFiles) ? $timeFrame->SoundFiles->name : '',
41
+	               'extension'        =>($timeFrame->Extensions) ? $timeFrame->Extensions->getRepresent() : '',
42 42
 	               'description'      =>$timeFrame->description,
43 43
                 ];
44 44
         }
@@ -50,29 +50,29 @@  discard block
 block discarded – undo
50 50
 	 * Карточка редактирования записи нерабочего времени
51 51
 	 * @param null $id
52 52
 	 */
53
-    public function modifyAction($id=null)
53
+    public function modifyAction($id = null)
54 54
     {
55 55
         $timeFrame = OutWorkTimes::findFirstById($id);
56
-        if (!$timeFrame){
56
+        if (!$timeFrame) {
57 57
             $timeFrame = new OutWorkTimes();
58 58
         }
59 59
 
60
-	    $forwardingExtensions[""] = $this->translation->_( "ex_SelectNumber" );
61
-        $parameters               =[
60
+	    $forwardingExtensions[""] = $this->translation->_("ex_SelectNumber");
61
+        $parameters = [
62 62
             'conditions'=>'number = :extension:',
63 63
             'bind'=>[
64 64
                 'extension'=>$timeFrame->extension
65 65
             ]
66 66
         ];
67
-        $extensions               = Extensions::find($parameters);
68
-        foreach ($extensions as $record){
69
-              $forwardingExtensions[$record->number]=$record->getRepresent();
67
+        $extensions = Extensions::find($parameters);
68
+        foreach ($extensions as $record) {
69
+              $forwardingExtensions[$record->number] = $record->getRepresent();
70 70
         }
71 71
 
72
-	    $audioMessages[""] = $this->translation->_( "sf_SelectAudioFile" );
73
-        $soundFiles        = SoundFiles::find();
74
-        foreach ($soundFiles as $record){
75
-            $audioMessages[$record->id]=$record->name;
72
+	    $audioMessages[""] = $this->translation->_("sf_SelectAudioFile");
73
+        $soundFiles = SoundFiles::find();
74
+        foreach ($soundFiles as $record) {
75
+            $audioMessages[$record->id] = $record->name;
76 76
         }
77 77
 
78 78
         $availableActions = [
@@ -81,18 +81,18 @@  discard block
 block discarded – undo
81 81
         ];
82 82
 
83 83
         $weekDays = ['-1'=>'-'];
84
-        for ($i="1"; $i<=7; $i++){
85
-            $weekDays[$i]=$this->translation->_(date('D', strtotime("Sunday +{$i} days")));
84
+        for ($i = "1"; $i <= 7; $i++) {
85
+            $weekDays[$i] = $this->translation->_(date('D', strtotime("Sunday +{$i} days")));
86 86
         }
87 87
 
88
-        $form = new TimeFrameEditForm($timeFrame,[
88
+        $form = new TimeFrameEditForm($timeFrame, [
89 89
             'extensions'=>$forwardingExtensions,
90 90
             'audio-message'=>$audioMessages,
91 91
             'available-actions'=>$availableActions,
92 92
             'week-days'=>$weekDays
93 93
         ]);
94 94
         $this->view->form = $form;
95
-	    $this->view->represent  = $timeFrame->getRepresent();
95
+	    $this->view->represent = $timeFrame->getRepresent();
96 96
     }
97 97
 
98 98
 	/**
@@ -105,8 +105,8 @@  discard block
 block discarded – undo
105 105
 
106 106
 	    $this->db->begin();
107 107
         $timeFrame = OutWorkTimes::findFirstByid($data['id']);
108
-        if ($timeFrame==false) {
109
-            $timeFrame= new OutWorkTimes();
108
+        if ($timeFrame == false) {
109
+            $timeFrame = new OutWorkTimes();
110 110
         }
111 111
 
112 112
         // Заполним параметры пользователя
@@ -114,41 +114,41 @@  discard block
 block discarded – undo
114 114
             switch ($name) {
115 115
                 case 'weekday_from':
116 116
                 case 'weekday_to':
117
-	                if ( ! array_key_exists( $name, $data ) ) {
117
+	                if (!array_key_exists($name, $data)) {
118 118
 		                $timeFrame->$name = '';
119 119
 	                }
120
-	                $timeFrame->$name = ( $data[ $name ] < 1 ) ? NULL
121
-		                : $data[ $name ];
120
+	                $timeFrame->$name = ($data[$name] < 1) ? NULL
121
+		                : $data[$name];
122 122
                     break;
123 123
                 case 'date_from':
124 124
                 case 'date_to':
125 125
 	            case 'time_from':
126 126
 	            case 'time_to':
127
-		            if ( ! array_key_exists( $name, $data ) ) {
127
+		            if (!array_key_exists($name, $data)) {
128 128
 			            $timeFrame->$name = '';
129 129
 		            }
130
-		            $timeFrame->$name = $data[ $name ];
130
+		            $timeFrame->$name = $data[$name];
131 131
 		            break;
132 132
                 default:
133
-                    if (!array_key_exists( $name, $data)) continue;
134
-                    $timeFrame->$name = $data[ $name];
133
+                    if (!array_key_exists($name, $data)) continue;
134
+                    $timeFrame->$name = $data[$name];
135 135
             }
136 136
         }
137 137
 
138
-        if ($timeFrame->save()=== false){
138
+        if ($timeFrame->save() === false) {
139 139
             $errors = $timeFrame->getMessages();
140 140
             $this->flash->warning(implode('<br>', $errors));
141
-            $this->view->success=false;
141
+            $this->view->success = false;
142 142
 	        $this->db->rollback();
143 143
             return;
144 144
         }
145 145
 
146 146
 	    $this->flash->success($this->translation->_('ms_SuccessfulSaved'));
147
-	    $this->view->success=true;
147
+	    $this->view->success = true;
148 148
 	    $this->db->commit();
149 149
 
150 150
 	    // Если это было создание карточки то надо перегрузить страницу с указанием ID
151
-	    if (empty($data['id'])){
151
+	    if (empty($data['id'])) {
152 152
 		    $this->view->reload = "out-off-work-time/modify/{$timeFrame->id}";
153 153
 	    }
154 154
 
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 	 * Удаление запси с данными о нерабочем времени
159 159
 	 * @param null $id
160 160
 	 */
161
-    public function deleteAction($id=null){
161
+    public function deleteAction($id = null) {
162 162
     	$timeFrame = OutWorkTimes::findFirstByid($id);
163 163
         if ($timeFrame) $timeFrame->delete();
164 164
         return $this->forward('OutOffWorkTime/index');
Please login to merge, or discard this patch.
Braces   +13 added lines, -5 removed lines patch added patch discarded remove patch
@@ -11,7 +11,8 @@  discard block
 block discarded – undo
11 11
     Models\SoundFiles,
12 12
     Models\Extensions;
13 13
 
14
-class OutOffWorkTimeController extends BaseController {
14
+class OutOffWorkTimeController extends BaseController
15
+{
15 16
 
16 17
 
17 18
 	/**
@@ -100,7 +101,9 @@  discard block
 block discarded – undo
100 101
 	 */
101 102
     public function saveAction()
102 103
     {
103
-        if (!$this->request->isPost()) return;
104
+        if (!$this->request->isPost()) {
105
+            return;
106
+        }
104 107
         $data = $this->request->getPost();
105 108
 
106 109
 	    $this->db->begin();
@@ -130,7 +133,9 @@  discard block
 block discarded – undo
130 133
 		            $timeFrame->$name = $data[ $name ];
131 134
 		            break;
132 135
                 default:
133
-                    if (!array_key_exists( $name, $data)) continue;
136
+                    if (!array_key_exists( $name, $data)) {
137
+                        continue;
138
+                    }
134 139
                     $timeFrame->$name = $data[ $name];
135 140
             }
136 141
         }
@@ -158,9 +163,12 @@  discard block
 block discarded – undo
158 163
 	 * Удаление запси с данными о нерабочем времени
159 164
 	 * @param null $id
160 165
 	 */
161
-    public function deleteAction($id=null){
166
+    public function deleteAction($id=null)
167
+    {
162 168
     	$timeFrame = OutWorkTimes::findFirstByid($id);
163
-        if ($timeFrame) $timeFrame->delete();
169
+        if ($timeFrame) {
170
+            $timeFrame->delete();
171
+        }
164 172
         return $this->forward('OutOffWorkTime/index');
165 173
 
166 174
     }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -117,7 +117,7 @@
 block discarded – undo
117 117
 	                if ( ! array_key_exists( $name, $data ) ) {
118 118
 		                $timeFrame->$name = '';
119 119
 	                }
120
-	                $timeFrame->$name = ( $data[ $name ] < 1 ) ? NULL
120
+	                $timeFrame->$name = ( $data[ $name ] < 1 ) ? null
121 121
 		                : $data[ $name ];
122 122
                     break;
123 123
                 case 'date_from':
Please login to merge, or discard this patch.
www/admin-cabinet/app/controllers/CallQueuesController.php 4 patches
Indentation   +250 added lines, -250 removed lines patch added patch discarded remove patch
@@ -15,10 +15,10 @@  discard block
 block discarded – undo
15 15
 
16 16
 class CallQueuesController extends BaseController {
17 17
 
18
-	/**
19
-	 * Получение списка очередей вызовово
20
-	 */
21
-	public function indexAction()
18
+    /**
19
+     * Получение списка очередей вызовово
20
+     */
21
+    public function indexAction()
22 22
     {
23 23
         $queues = CallQueues::find();
24 24
         $this->view->queues = $queues;
@@ -26,12 +26,12 @@  discard block
 block discarded – undo
26 26
 
27 27
 
28 28
     /**
29
-	 * Карточка редактирования очереди
30
-	 *
31
-	 * @param string $uniqid - идентификатор редактируемой очереди
32
-	 */
33
-	public function modifyAction(string $uniqid=null){
34
-		$queue = CallQueues::findFirstByUniqid($uniqid);
29
+     * Карточка редактирования очереди
30
+     *
31
+     * @param string $uniqid - идентификатор редактируемой очереди
32
+     */
33
+    public function modifyAction(string $uniqid=null){
34
+        $queue = CallQueues::findFirstByUniqid($uniqid);
35 35
         $queueMembersList=[];
36 36
         $soundfilesList=[];
37 37
         $extensionList = [];
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
             $queue->announce_position           =   1;
45 45
             $queue->announce_hold_time          =   1;
46 46
             $queue->periodic_announce_frequency =45;
47
-	        $queue->extension
48
-	                                            = Extensions::getNextFreeApplicationNumber();
47
+            $queue->extension
48
+                                                = Extensions::getNextFreeApplicationNumber();
49 49
 
50 50
         } else {
51 51
             // Списк экстеншенов очереди
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
             }
67 67
         }
68 68
 
69
-		$extensionList[""] = $this->translation->_( "ex_SelectNumber" );
69
+        $extensionList[""] = $this->translation->_( "ex_SelectNumber" );
70 70
         // Список всех используемых эктеншенов
71 71
         $parameters =[
72 72
             'conditions'=>'number IN ({ids:array})',
@@ -84,9 +84,9 @@  discard block
 block discarded – undo
84 84
         }
85 85
 
86 86
         // Список звуковых файлов для очередей
87
-		$soundfilesList[""]    = $this->translation->_( "sf_SelectAudioFile" );
88
-		$soundfilesList[ - 1 ] = '-';
89
-		$soundFiles            = SoundFiles::find();
87
+        $soundfilesList[""]    = $this->translation->_( "sf_SelectAudioFile" );
88
+        $soundfilesList[ - 1 ] = '-';
89
+        $soundFiles            = SoundFiles::find();
90 90
         foreach ($soundFiles as $soundFile){
91 91
             $soundfilesList[$soundFile->id]=$soundFile->name;
92 92
         }
@@ -97,70 +97,70 @@  discard block
 block discarded – undo
97 97
         ]);
98 98
         $this->view->form = $form;
99 99
         $this->view->extensionsTable=$queueMembersList;
100
-	    $this->view->represent  = $queue->getRepresent();
100
+        $this->view->represent  = $queue->getRepresent();
101 101
     }
102 102
 
103 103
 
104
-	/**
105
-	 * Сохранение очереди через AJAX запрос из формы
106
-	 */
107
-	public function saveAction()
104
+    /**
105
+     * Сохранение очереди через AJAX запрос из формы
106
+     */
107
+    public function saveAction()
108 108
     {
109
-	    if (!$this->request->isPost()) return;
110
-	    $this->db->begin();
111
-
112
-	    $data = $this->request->getPost();
113
-	    $queue = CallQueues::findFirstByUniqid($data['uniqid']);
114
-	    if (!$queue)  {
115
-		    $queue = new CallQueues();
116
-		    $extension = new Extensions();
117
-		    $extension->type     = "QUEUE";
118
-		    $extension->number   = $data["extension"];
119
-		    $extension->callerid = parent::transliterate($data["name"]);
120
-		    $extension->userid   = null;
121
-		    $extension->show_in_phonebook  = 1;
122
-		    $extension->public_access     = 1;
123
-	    } else {
124
-		    $extension = $queue->Extensions;
125
-	    }
126
-
127
-	    // Заполним параметры внутреннего номера
128
-	    if (!$this->updateExtension($extension, $data)){
129
-		    $this->view->success=false;
130
-		    $this->db->rollback();
131
-		    return;
132
-	    }
133
-
134
-	    // Заполним параметры пользователя
135
-	    if (!$this->updateQueue($queue, $data)){
136
-		    $this->view->success=false;
137
-		    $this->db->rollback();
138
-		    return;
139
-	    }
140
-
141
-	    // Заполним параметры участников очереди
142
-	    if (!$this->updateQueueMembers($data)){
143
-		    $this->view->success=false;
144
-		    $this->db->rollback();
145
-		    return;
146
-	    }
147
-
148
-	    $this->flash->success($this->translation->_('ms_SuccessfulSaved'));
149
-	    $this->view->success=true;
150
-	    $this->db->commit();
151
-
152
-	    // Если это было создание карточки то надо перегрузить страницу с указанием ID
153
-	    if (empty($data['id'])){
154
-		    $this->view->reload = "call-queues/modify/{$data['uniqid']}";
155
-	    }
109
+        if (!$this->request->isPost()) return;
110
+        $this->db->begin();
111
+
112
+        $data = $this->request->getPost();
113
+        $queue = CallQueues::findFirstByUniqid($data['uniqid']);
114
+        if (!$queue)  {
115
+            $queue = new CallQueues();
116
+            $extension = new Extensions();
117
+            $extension->type     = "QUEUE";
118
+            $extension->number   = $data["extension"];
119
+            $extension->callerid = parent::transliterate($data["name"]);
120
+            $extension->userid   = null;
121
+            $extension->show_in_phonebook  = 1;
122
+            $extension->public_access     = 1;
123
+        } else {
124
+            $extension = $queue->Extensions;
125
+        }
126
+
127
+        // Заполним параметры внутреннего номера
128
+        if (!$this->updateExtension($extension, $data)){
129
+            $this->view->success=false;
130
+            $this->db->rollback();
131
+            return;
132
+        }
133
+
134
+        // Заполним параметры пользователя
135
+        if (!$this->updateQueue($queue, $data)){
136
+            $this->view->success=false;
137
+            $this->db->rollback();
138
+            return;
139
+        }
140
+
141
+        // Заполним параметры участников очереди
142
+        if (!$this->updateQueueMembers($data)){
143
+            $this->view->success=false;
144
+            $this->db->rollback();
145
+            return;
146
+        }
147
+
148
+        $this->flash->success($this->translation->_('ms_SuccessfulSaved'));
149
+        $this->view->success=true;
150
+        $this->db->commit();
151
+
152
+        // Если это было создание карточки то надо перегрузить страницу с указанием ID
153
+        if (empty($data['id'])){
154
+            $this->view->reload = "call-queues/modify/{$data['uniqid']}";
155
+        }
156 156
     }
157 157
 
158 158
 
159 159
     /**
160
-	 * Удаление очереди по ее ID
161
-	 * @param string $uniqid
162
-	 */
163
-	public function deleteAction(string $uniqid=null){
160
+     * Удаление очереди по ее ID
161
+     * @param string $uniqid
162
+     */
163
+    public function deleteAction(string $uniqid=null){
164 164
         $this->db->begin();
165 165
         $queue = CallQueues::findFirstByUniqid($uniqid);
166 166
 
@@ -180,182 +180,182 @@  discard block
 block discarded – undo
180 180
     }
181 181
 
182 182
 
183
-	/**
184
-	 * Обновление параметров очереди
185
-	 * @param \Models\CallQueues $queue
186
-	 * @param array $data массив полей из POST запроса
187
-	 * @return bool update result
188
-	 */
189
-	private function updateQueue(CallQueues $queue, array $data){
190
-		foreach ($queue as $name => $value) {
191
-			switch($name) {
192
-				case "extension":
193
-					$queue->$name = $data[$name];
194
-					break;
195
-				case "name":
196
-					$queue->$name = $data[$name];
197
-					break;
198
-				case "recive_calls_while_on_a_call":
199
-				case "announce_position":
200
-				case "announce_hold_time":
201
-					if (array_key_exists($name, $data))
202
-						$queue->$name = ($data[$name]=='on') ? "1" : "0";
203
-					else
204
-						$queue->$name = "0";
205
-					break;
206
-
207
-				case "periodic_announce_sound_id":
208
-				case "redirect_to_extension_if_repeat_exceeded":
209
-					if (!array_key_exists($name, $data) || empty($data[$name])) {
210
-						$queue->$name = null;
211
-						continue;
212
-					}
213
-					$queue->$name = $data[$name];
214
-					break;
215
-				case "redirect_to_extension_if_empty":
216
-					if (!array_key_exists($name, $data) || empty($data[$name])) {
217
-						$queue->$name = null;
218
-						continue;
219
-					}
220
-					$queue->$name = $data[$name];
221
-
222
-					break;
223
-				case "timeout_to_redirect_to_extension":
224
-					if (!array_key_exists($name, $data)) continue;
225
-					if (empty($data[$name])) {
226
-						$queue->$name = null;
227
-					} else {
228
-						$queue->$name = $data[$name];
229
-					}
230
-					break;
231
-				case "timeout_extension":
232
-					if (!array_key_exists($name, $data)
233
-					    || empty($data[$name])
234
-					             || (array_key_exists('timeout_to_redirect_to_extension', $data)
235
-					                 && intval($data['timeout_to_redirect_to_extension'])===0)) {
236
-						$queue->$name = null;
237
-						continue;
238
-					}
239
-					$queue->$name = $data[$name];
240
-
241
-					break;
242
-				case "number_unanswered_calls_to_redirect":
243
-					if (!array_key_exists($name, $data)) continue;
244
-					if (empty($data[$name])) {
245
-						$queue->$name = null;
246
-					} else {
247
-						$queue->$name = $data[$name];
248
-					}
249
-					break;
250
-				case "redirect_to_extension_if_unanswered":
251
-					if (!array_key_exists($name, $data)
252
-					    || empty($data[$name])
253
-					             || (array_key_exists('number_unanswered_calls_to_redirect', $data)
254
-					                 && intval($data['number_unanswered_calls_to_redirect'])===0)) {
255
-						$queue->$name = null;
256
-						continue;
257
-					}
258
-					$queue->$name = $data[$name];
259
-
260
-					break;
261
-				default:
262
-					if (!array_key_exists($name, $data)) continue;
263
-					$queue->$name = $data[$name];
264
-			}
265
-		}
266
-
267
-		if ($queue->save()=== false){
268
-			$errors = $queue->getMessages();
269
-			$this->flash->error(implode('<br>', $errors));
270
-			return false;
271
-		}
272
-
273
-		return TRUE;
274
-	}
275
-
276
-
277
-	/**
278
-	 * Обновление параметров внутреннего номера
279
-	 * @param \Models\Extensions $extension
280
-	 * @param array $data массив полей из POST запроса
281
-	 * @return bool update result
282
-	 */
283
-	private function updateExtension(Extensions $extension, array $data){
284
-
285
-		$extension->number=$data['extension'];
286
-		$extension->callerid=parent::transliterate($data['name']);
287
-		if ($extension->save()=== false){
288
-			$errors = $extension->getMessages();
289
-			$this->flash->error(implode('<br>', $errors));
290
-			return false;
291
-		}
292
-
293
-		return TRUE;
294
-
295
-	}
296
-
297
-
298
-	/**
299
-	 * Обновление списка участников очереди
300
-	 *
301
-	 * @param array $data массив полей из POST запроса
302
-	 * @return bool update result
303
-	 */
304
-	private function updateQueueMembers(array $data){
305
-
306
-		$realMembers=[];
307
-		// Обновим настройки у существующих членов очереди
308
-		$membersTable=json_decode($data['members']);
309
-		foreach ($membersTable as $member) {
310
-			$parameters = [
311
-				'conditions'=>'extension = :number: AND queue=:uniqid:',
312
-				'bind'=>[
313
-					'number'=>$member->number,
314
-					'uniqid'=> $data['uniqid']
315
-				]
316
-			];
317
-			$queueMembers = CallQueueMembers::find($parameters);
318
-			if ($queueMembers->count()>1){
319
-				// откуда то взались лишние. Надо их всех удалить и создать нового
320
-				if ($queueMembers->delete()=== FALSE){
321
-					$errors = $queueMembers->getMessages();
322
-					$this->flash->error(implode('<br>', $errors));
323
-					return FALSE;
324
-				}
325
-				$queueMember = new CallQueueMembers();
326
-			} elseif ($queueMembers->count()==1){
327
-				$queueMember = $queueMembers->getFirst();
328
-			} else {
329
-				$queueMember = new CallQueueMembers();
330
-			}
331
-
332
-			$queueMember->priority    = $member->priority;
333
-			$queueMember->extension   = $member->number;
334
-			$queueMember->queue       = $data['uniqid'];
335
-			$realMembers[]= $member->number;
336
-			if ($queueMember->save()=== FALSE){
337
-				$errors = $queueMember->getMessages();
338
-				$this->flash->error(implode('<br>', $errors));
339
-				return FALSE;
340
-			}
341
-		}
342
-
343
-		// Удалим членов очереди которх нет в списке
344
-		$parameters = [
345
-			'conditions'=>'extension NOT IN  ({numbers:array}) AND queue=:uniqid:',
346
-			'bind' =>[
347
-				'numbers'=>$realMembers,
348
-				'uniqid'=> $data['uniqid']
349
-			]
350
-		];
351
-
352
-		$deletedMembers = CallQueueMembers::find($parameters);
353
-		if ($deletedMembers && $deletedMembers->delete()=== FALSE){
354
-			$errors = $deletedMembers->getMessages();
355
-			$this->flash->error(implode('<br>', $errors));
356
-			return FALSE;
357
-		}
358
-
359
-		return TRUE;
360
-	}
183
+    /**
184
+     * Обновление параметров очереди
185
+     * @param \Models\CallQueues $queue
186
+     * @param array $data массив полей из POST запроса
187
+     * @return bool update result
188
+     */
189
+    private function updateQueue(CallQueues $queue, array $data){
190
+        foreach ($queue as $name => $value) {
191
+            switch($name) {
192
+                case "extension":
193
+                    $queue->$name = $data[$name];
194
+                    break;
195
+                case "name":
196
+                    $queue->$name = $data[$name];
197
+                    break;
198
+                case "recive_calls_while_on_a_call":
199
+                case "announce_position":
200
+                case "announce_hold_time":
201
+                    if (array_key_exists($name, $data))
202
+                        $queue->$name = ($data[$name]=='on') ? "1" : "0";
203
+                    else
204
+                        $queue->$name = "0";
205
+                    break;
206
+
207
+                case "periodic_announce_sound_id":
208
+                case "redirect_to_extension_if_repeat_exceeded":
209
+                    if (!array_key_exists($name, $data) || empty($data[$name])) {
210
+                        $queue->$name = null;
211
+                        continue;
212
+                    }
213
+                    $queue->$name = $data[$name];
214
+                    break;
215
+                case "redirect_to_extension_if_empty":
216
+                    if (!array_key_exists($name, $data) || empty($data[$name])) {
217
+                        $queue->$name = null;
218
+                        continue;
219
+                    }
220
+                    $queue->$name = $data[$name];
221
+
222
+                    break;
223
+                case "timeout_to_redirect_to_extension":
224
+                    if (!array_key_exists($name, $data)) continue;
225
+                    if (empty($data[$name])) {
226
+                        $queue->$name = null;
227
+                    } else {
228
+                        $queue->$name = $data[$name];
229
+                    }
230
+                    break;
231
+                case "timeout_extension":
232
+                    if (!array_key_exists($name, $data)
233
+                        || empty($data[$name])
234
+                                 || (array_key_exists('timeout_to_redirect_to_extension', $data)
235
+                                     && intval($data['timeout_to_redirect_to_extension'])===0)) {
236
+                        $queue->$name = null;
237
+                        continue;
238
+                    }
239
+                    $queue->$name = $data[$name];
240
+
241
+                    break;
242
+                case "number_unanswered_calls_to_redirect":
243
+                    if (!array_key_exists($name, $data)) continue;
244
+                    if (empty($data[$name])) {
245
+                        $queue->$name = null;
246
+                    } else {
247
+                        $queue->$name = $data[$name];
248
+                    }
249
+                    break;
250
+                case "redirect_to_extension_if_unanswered":
251
+                    if (!array_key_exists($name, $data)
252
+                        || empty($data[$name])
253
+                                 || (array_key_exists('number_unanswered_calls_to_redirect', $data)
254
+                                     && intval($data['number_unanswered_calls_to_redirect'])===0)) {
255
+                        $queue->$name = null;
256
+                        continue;
257
+                    }
258
+                    $queue->$name = $data[$name];
259
+
260
+                    break;
261
+                default:
262
+                    if (!array_key_exists($name, $data)) continue;
263
+                    $queue->$name = $data[$name];
264
+            }
265
+        }
266
+
267
+        if ($queue->save()=== false){
268
+            $errors = $queue->getMessages();
269
+            $this->flash->error(implode('<br>', $errors));
270
+            return false;
271
+        }
272
+
273
+        return TRUE;
274
+    }
275
+
276
+
277
+    /**
278
+     * Обновление параметров внутреннего номера
279
+     * @param \Models\Extensions $extension
280
+     * @param array $data массив полей из POST запроса
281
+     * @return bool update result
282
+     */
283
+    private function updateExtension(Extensions $extension, array $data){
284
+
285
+        $extension->number=$data['extension'];
286
+        $extension->callerid=parent::transliterate($data['name']);
287
+        if ($extension->save()=== false){
288
+            $errors = $extension->getMessages();
289
+            $this->flash->error(implode('<br>', $errors));
290
+            return false;
291
+        }
292
+
293
+        return TRUE;
294
+
295
+    }
296
+
297
+
298
+    /**
299
+     * Обновление списка участников очереди
300
+     *
301
+     * @param array $data массив полей из POST запроса
302
+     * @return bool update result
303
+     */
304
+    private function updateQueueMembers(array $data){
305
+
306
+        $realMembers=[];
307
+        // Обновим настройки у существующих членов очереди
308
+        $membersTable=json_decode($data['members']);
309
+        foreach ($membersTable as $member) {
310
+            $parameters = [
311
+                'conditions'=>'extension = :number: AND queue=:uniqid:',
312
+                'bind'=>[
313
+                    'number'=>$member->number,
314
+                    'uniqid'=> $data['uniqid']
315
+                ]
316
+            ];
317
+            $queueMembers = CallQueueMembers::find($parameters);
318
+            if ($queueMembers->count()>1){
319
+                // откуда то взались лишние. Надо их всех удалить и создать нового
320
+                if ($queueMembers->delete()=== FALSE){
321
+                    $errors = $queueMembers->getMessages();
322
+                    $this->flash->error(implode('<br>', $errors));
323
+                    return FALSE;
324
+                }
325
+                $queueMember = new CallQueueMembers();
326
+            } elseif ($queueMembers->count()==1){
327
+                $queueMember = $queueMembers->getFirst();
328
+            } else {
329
+                $queueMember = new CallQueueMembers();
330
+            }
331
+
332
+            $queueMember->priority    = $member->priority;
333
+            $queueMember->extension   = $member->number;
334
+            $queueMember->queue       = $data['uniqid'];
335
+            $realMembers[]= $member->number;
336
+            if ($queueMember->save()=== FALSE){
337
+                $errors = $queueMember->getMessages();
338
+                $this->flash->error(implode('<br>', $errors));
339
+                return FALSE;
340
+            }
341
+        }
342
+
343
+        // Удалим членов очереди которх нет в списке
344
+        $parameters = [
345
+            'conditions'=>'extension NOT IN  ({numbers:array}) AND queue=:uniqid:',
346
+            'bind' =>[
347
+                'numbers'=>$realMembers,
348
+                'uniqid'=> $data['uniqid']
349
+            ]
350
+        ];
351
+
352
+        $deletedMembers = CallQueueMembers::find($parameters);
353
+        if ($deletedMembers && $deletedMembers->delete()=== FALSE){
354
+            $errors = $deletedMembers->getMessages();
355
+            $this->flash->error(implode('<br>', $errors));
356
+            return FALSE;
357
+        }
358
+
359
+        return TRUE;
360
+    }
361 361
 }
362 362
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -30,35 +30,35 @@  discard block
 block discarded – undo
30 30
 	 *
31 31
 	 * @param string $uniqid - идентификатор редактируемой очереди
32 32
 	 */
33
-	public function modifyAction(string $uniqid=null){
33
+	public function modifyAction(string $uniqid = null) {
34 34
 		$queue = CallQueues::findFirstByUniqid($uniqid);
35
-        $queueMembersList=[];
36
-        $soundfilesList=[];
35
+        $queueMembersList = [];
36
+        $soundfilesList = [];
37 37
         $extensionList = [];
38 38
         if (!$queue) {
39 39
             $queue                              = new CallQueues();
40
-            $queue->uniqid                      =   strtoupper('QUEUE-'.md5($queue->id.time()));
41
-            $queue->caller_hear                 =   'moh';
40
+            $queue->uniqid                      = strtoupper('QUEUE-'.md5($queue->id.time()));
41
+            $queue->caller_hear                 = 'moh';
42 42
             $queue->seconds_to_ring_each_member = 20;
43
-            $queue->seconds_for_wrapup          =   15;
44
-            $queue->announce_position           =   1;
45
-            $queue->announce_hold_time          =   1;
46
-            $queue->periodic_announce_frequency =45;
43
+            $queue->seconds_for_wrapup          = 15;
44
+            $queue->announce_position           = 1;
45
+            $queue->announce_hold_time          = 1;
46
+            $queue->periodic_announce_frequency = 45;
47 47
 	        $queue->extension
48 48
 	                                            = Extensions::getNextFreeApplicationNumber();
49 49
 
50 50
         } else {
51 51
             // Списк экстеншенов очереди
52
-            $parameters =[
52
+            $parameters = [
53 53
                 'order'=>'priority',
54 54
                 'conditions'=>'queue=:queue:',
55 55
                 'bind'=>[
56 56
                     'queue'=>$queue->uniqid
57 57
                 ]
58 58
             ];
59
-            $members=CallQueueMembers::find($parameters);
60
-            foreach ($members as $member){
61
-                $queueMembersList[]=[
59
+            $members = CallQueueMembers::find($parameters);
60
+            foreach ($members as $member) {
61
+                $queueMembersList[] = [
62 62
                     'id'=>$member->id,
63 63
                     'number'=>$member->extension,
64 64
                     'callerid'=>$member->Extensions->getRepresent()
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
             }
67 67
         }
68 68
 
69
-		$extensionList[""] = $this->translation->_( "ex_SelectNumber" );
69
+		$extensionList[""] = $this->translation->_("ex_SelectNumber");
70 70
         // Список всех используемых эктеншенов
71
-        $parameters =[
71
+        $parameters = [
72 72
             'conditions'=>'number IN ({ids:array})',
73 73
             'bind'=>[
74 74
                 'ids'=>[
@@ -79,16 +79,16 @@  discard block
 block discarded – undo
79 79
                 ]]
80 80
         ];
81 81
         $extensions = Extensions::find($parameters);
82
-        foreach ($extensions as $record){
83
-            $extensionList[$record->number]=$record->getRepresent();
82
+        foreach ($extensions as $record) {
83
+            $extensionList[$record->number] = $record->getRepresent();
84 84
         }
85 85
 
86 86
         // Список звуковых файлов для очередей
87
-		$soundfilesList[""]    = $this->translation->_( "sf_SelectAudioFile" );
88
-		$soundfilesList[ - 1 ] = '-';
87
+		$soundfilesList[""]    = $this->translation->_("sf_SelectAudioFile");
88
+		$soundfilesList[ -1] = '-';
89 89
 		$soundFiles            = SoundFiles::find();
90
-        foreach ($soundFiles as $soundFile){
91
-            $soundfilesList[$soundFile->id]=$soundFile->name;
90
+        foreach ($soundFiles as $soundFile) {
91
+            $soundfilesList[$soundFile->id] = $soundFile->name;
92 92
         }
93 93
 
94 94
         $form = new CallQueueEditForm($queue, [
@@ -96,8 +96,8 @@  discard block
 block discarded – undo
96 96
             'soundfiles'=>$soundfilesList
97 97
         ]);
98 98
         $this->view->form = $form;
99
-        $this->view->extensionsTable=$queueMembersList;
100
-	    $this->view->represent  = $queue->getRepresent();
99
+        $this->view->extensionsTable = $queueMembersList;
100
+	    $this->view->represent = $queue->getRepresent();
101 101
     }
102 102
 
103 103
 
@@ -111,46 +111,46 @@  discard block
 block discarded – undo
111 111
 
112 112
 	    $data = $this->request->getPost();
113 113
 	    $queue = CallQueues::findFirstByUniqid($data['uniqid']);
114
-	    if (!$queue)  {
114
+	    if (!$queue) {
115 115
 		    $queue = new CallQueues();
116 116
 		    $extension = new Extensions();
117 117
 		    $extension->type     = "QUEUE";
118 118
 		    $extension->number   = $data["extension"];
119 119
 		    $extension->callerid = parent::transliterate($data["name"]);
120 120
 		    $extension->userid   = null;
121
-		    $extension->show_in_phonebook  = 1;
122
-		    $extension->public_access     = 1;
121
+		    $extension->show_in_phonebook = 1;
122
+		    $extension->public_access = 1;
123 123
 	    } else {
124 124
 		    $extension = $queue->Extensions;
125 125
 	    }
126 126
 
127 127
 	    // Заполним параметры внутреннего номера
128
-	    if (!$this->updateExtension($extension, $data)){
129
-		    $this->view->success=false;
128
+	    if (!$this->updateExtension($extension, $data)) {
129
+		    $this->view->success = false;
130 130
 		    $this->db->rollback();
131 131
 		    return;
132 132
 	    }
133 133
 
134 134
 	    // Заполним параметры пользователя
135
-	    if (!$this->updateQueue($queue, $data)){
136
-		    $this->view->success=false;
135
+	    if (!$this->updateQueue($queue, $data)) {
136
+		    $this->view->success = false;
137 137
 		    $this->db->rollback();
138 138
 		    return;
139 139
 	    }
140 140
 
141 141
 	    // Заполним параметры участников очереди
142
-	    if (!$this->updateQueueMembers($data)){
143
-		    $this->view->success=false;
142
+	    if (!$this->updateQueueMembers($data)) {
143
+		    $this->view->success = false;
144 144
 		    $this->db->rollback();
145 145
 		    return;
146 146
 	    }
147 147
 
148 148
 	    $this->flash->success($this->translation->_('ms_SuccessfulSaved'));
149
-	    $this->view->success=true;
149
+	    $this->view->success = true;
150 150
 	    $this->db->commit();
151 151
 
152 152
 	    // Если это было создание карточки то надо перегрузить страницу с указанием ID
153
-	    if (empty($data['id'])){
153
+	    if (empty($data['id'])) {
154 154
 		    $this->view->reload = "call-queues/modify/{$data['uniqid']}";
155 155
 	    }
156 156
     }
@@ -160,15 +160,15 @@  discard block
 block discarded – undo
160 160
 	 * Удаление очереди по ее ID
161 161
 	 * @param string $uniqid
162 162
 	 */
163
-	public function deleteAction(string $uniqid=null){
163
+	public function deleteAction(string $uniqid = null) {
164 164
         $this->db->begin();
165 165
         $queue = CallQueues::findFirstByUniqid($uniqid);
166 166
 
167 167
         $errors = false;
168
-        if($queue && !$queue->Extensions->delete())
168
+        if ($queue && !$queue->Extensions->delete())
169 169
             $errors = $queue->Extensions->getMessages();
170 170
 
171
-        if ($errors){
171
+        if ($errors) {
172 172
             $this->flash->warning(implode('<br>', $errors));
173 173
             $this->db->rollback();
174 174
         }
@@ -186,9 +186,9 @@  discard block
 block discarded – undo
186 186
 	 * @param array $data массив полей из POST запроса
187 187
 	 * @return bool update result
188 188
 	 */
189
-	private function updateQueue(CallQueues $queue, array $data){
189
+	private function updateQueue(CallQueues $queue, array $data) {
190 190
 		foreach ($queue as $name => $value) {
191
-			switch($name) {
191
+			switch ($name) {
192 192
 				case "extension":
193 193
 					$queue->$name = $data[$name];
194 194
 					break;
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 				case "announce_position":
200 200
 				case "announce_hold_time":
201 201
 					if (array_key_exists($name, $data))
202
-						$queue->$name = ($data[$name]=='on') ? "1" : "0";
202
+						$queue->$name = ($data[$name] == 'on') ? "1" : "0";
203 203
 					else
204 204
 						$queue->$name = "0";
205 205
 					break;
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 					if (!array_key_exists($name, $data)
233 233
 					    || empty($data[$name])
234 234
 					             || (array_key_exists('timeout_to_redirect_to_extension', $data)
235
-					                 && intval($data['timeout_to_redirect_to_extension'])===0)) {
235
+					                 && intval($data['timeout_to_redirect_to_extension']) === 0)) {
236 236
 						$queue->$name = null;
237 237
 						continue;
238 238
 					}
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 					if (!array_key_exists($name, $data)
252 252
 					    || empty($data[$name])
253 253
 					             || (array_key_exists('number_unanswered_calls_to_redirect', $data)
254
-					                 && intval($data['number_unanswered_calls_to_redirect'])===0)) {
254
+					                 && intval($data['number_unanswered_calls_to_redirect']) === 0)) {
255 255
 						$queue->$name = null;
256 256
 						continue;
257 257
 					}
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 			}
265 265
 		}
266 266
 
267
-		if ($queue->save()=== false){
267
+		if ($queue->save() === false) {
268 268
 			$errors = $queue->getMessages();
269 269
 			$this->flash->error(implode('<br>', $errors));
270 270
 			return false;
@@ -280,11 +280,11 @@  discard block
 block discarded – undo
280 280
 	 * @param array $data массив полей из POST запроса
281 281
 	 * @return bool update result
282 282
 	 */
283
-	private function updateExtension(Extensions $extension, array $data){
283
+	private function updateExtension(Extensions $extension, array $data) {
284 284
 
285
-		$extension->number=$data['extension'];
286
-		$extension->callerid=parent::transliterate($data['name']);
287
-		if ($extension->save()=== false){
285
+		$extension->number = $data['extension'];
286
+		$extension->callerid = parent::transliterate($data['name']);
287
+		if ($extension->save() === false) {
288 288
 			$errors = $extension->getMessages();
289 289
 			$this->flash->error(implode('<br>', $errors));
290 290
 			return false;
@@ -301,11 +301,11 @@  discard block
 block discarded – undo
301 301
 	 * @param array $data массив полей из POST запроса
302 302
 	 * @return bool update result
303 303
 	 */
304
-	private function updateQueueMembers(array $data){
304
+	private function updateQueueMembers(array $data) {
305 305
 
306
-		$realMembers=[];
306
+		$realMembers = [];
307 307
 		// Обновим настройки у существующих членов очереди
308
-		$membersTable=json_decode($data['members']);
308
+		$membersTable = json_decode($data['members']);
309 309
 		foreach ($membersTable as $member) {
310 310
 			$parameters = [
311 311
 				'conditions'=>'extension = :number: AND queue=:uniqid:',
@@ -315,15 +315,15 @@  discard block
 block discarded – undo
315 315
 				]
316 316
 			];
317 317
 			$queueMembers = CallQueueMembers::find($parameters);
318
-			if ($queueMembers->count()>1){
318
+			if ($queueMembers->count() > 1) {
319 319
 				// откуда то взались лишние. Надо их всех удалить и создать нового
320
-				if ($queueMembers->delete()=== FALSE){
320
+				if ($queueMembers->delete() === FALSE) {
321 321
 					$errors = $queueMembers->getMessages();
322 322
 					$this->flash->error(implode('<br>', $errors));
323 323
 					return FALSE;
324 324
 				}
325 325
 				$queueMember = new CallQueueMembers();
326
-			} elseif ($queueMembers->count()==1){
326
+			} elseif ($queueMembers->count() == 1) {
327 327
 				$queueMember = $queueMembers->getFirst();
328 328
 			} else {
329 329
 				$queueMember = new CallQueueMembers();
@@ -332,8 +332,8 @@  discard block
 block discarded – undo
332 332
 			$queueMember->priority    = $member->priority;
333 333
 			$queueMember->extension   = $member->number;
334 334
 			$queueMember->queue       = $data['uniqid'];
335
-			$realMembers[]= $member->number;
336
-			if ($queueMember->save()=== FALSE){
335
+			$realMembers[] = $member->number;
336
+			if ($queueMember->save() === FALSE) {
337 337
 				$errors = $queueMember->getMessages();
338 338
 				$this->flash->error(implode('<br>', $errors));
339 339
 				return FALSE;
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 		];
351 351
 
352 352
 		$deletedMembers = CallQueueMembers::find($parameters);
353
-		if ($deletedMembers && $deletedMembers->delete()=== FALSE){
353
+		if ($deletedMembers && $deletedMembers->delete() === FALSE) {
354 354
 			$errors = $deletedMembers->getMessages();
355 355
 			$this->flash->error(implode('<br>', $errors));
356 356
 			return FALSE;
Please login to merge, or discard this patch.
Braces   +35 added lines, -20 removed lines patch added patch discarded remove patch
@@ -13,13 +13,14 @@  discard block
 block discarded – undo
13 13
     Models\CallQueueMembers;
14 14
 
15 15
 
16
-class CallQueuesController extends BaseController {
16
+class CallQueuesController extends BaseController
17
+{
17 18
 
18 19
 	/**
19 20
 	 * Получение списка очередей вызовово
20 21
 	 */
21 22
 	public function indexAction()
22
-    {
23
+	{
23 24
         $queues = CallQueues::find();
24 25
         $this->view->queues = $queues;
25 26
     }
@@ -30,7 +31,8 @@  discard block
 block discarded – undo
30 31
 	 *
31 32
 	 * @param string $uniqid - идентификатор редактируемой очереди
32 33
 	 */
33
-	public function modifyAction(string $uniqid=null){
34
+	public function modifyAction(string $uniqid=null)
35
+	{
34 36
 		$queue = CallQueues::findFirstByUniqid($uniqid);
35 37
         $queueMembersList=[];
36 38
         $soundfilesList=[];
@@ -105,8 +107,10 @@  discard block
 block discarded – undo
105 107
 	 * Сохранение очереди через AJAX запрос из формы
106 108
 	 */
107 109
 	public function saveAction()
108
-    {
109
-	    if (!$this->request->isPost()) return;
110
+	{
111
+	    if (!$this->request->isPost()) {
112
+	        return;
113
+	    }
110 114
 	    $this->db->begin();
111 115
 
112 116
 	    $data = $this->request->getPost();
@@ -160,19 +164,20 @@  discard block
 block discarded – undo
160 164
 	 * Удаление очереди по ее ID
161 165
 	 * @param string $uniqid
162 166
 	 */
163
-	public function deleteAction(string $uniqid=null){
167
+	public function deleteAction(string $uniqid=null)
168
+	{
164 169
         $this->db->begin();
165 170
         $queue = CallQueues::findFirstByUniqid($uniqid);
166 171
 
167 172
         $errors = false;
168
-        if($queue && !$queue->Extensions->delete())
169
-            $errors = $queue->Extensions->getMessages();
173
+        if($queue && !$queue->Extensions->delete()) {
174
+                    $errors = $queue->Extensions->getMessages();
175
+        }
170 176
 
171 177
         if ($errors){
172 178
             $this->flash->warning(implode('<br>', $errors));
173 179
             $this->db->rollback();
174
-        }
175
-        else
180
+        } else
176 181
         {
177 182
             $this->db->commit();
178 183
         }
@@ -186,7 +191,8 @@  discard block
 block discarded – undo
186 191
 	 * @param array $data массив полей из POST запроса
187 192
 	 * @return bool update result
188 193
 	 */
189
-	private function updateQueue(CallQueues $queue, array $data){
194
+	private function updateQueue(CallQueues $queue, array $data)
195
+	{
190 196
 		foreach ($queue as $name => $value) {
191 197
 			switch($name) {
192 198
 				case "extension":
@@ -198,10 +204,11 @@  discard block
 block discarded – undo
198 204
 				case "recive_calls_while_on_a_call":
199 205
 				case "announce_position":
200 206
 				case "announce_hold_time":
201
-					if (array_key_exists($name, $data))
202
-						$queue->$name = ($data[$name]=='on') ? "1" : "0";
203
-					else
204
-						$queue->$name = "0";
207
+					if (array_key_exists($name, $data)) {
208
+											$queue->$name = ($data[$name]=='on') ? "1" : "0";
209
+					} else {
210
+											$queue->$name = "0";
211
+					}
205 212
 					break;
206 213
 
207 214
 				case "periodic_announce_sound_id":
@@ -221,7 +228,9 @@  discard block
 block discarded – undo
221 228
 
222 229
 					break;
223 230
 				case "timeout_to_redirect_to_extension":
224
-					if (!array_key_exists($name, $data)) continue;
231
+					if (!array_key_exists($name, $data)) {
232
+					    continue;
233
+					}
225 234
 					if (empty($data[$name])) {
226 235
 						$queue->$name = null;
227 236
 					} else {
@@ -240,7 +249,9 @@  discard block
 block discarded – undo
240 249
 
241 250
 					break;
242 251
 				case "number_unanswered_calls_to_redirect":
243
-					if (!array_key_exists($name, $data)) continue;
252
+					if (!array_key_exists($name, $data)) {
253
+					    continue;
254
+					}
244 255
 					if (empty($data[$name])) {
245 256
 						$queue->$name = null;
246 257
 					} else {
@@ -259,7 +270,9 @@  discard block
 block discarded – undo
259 270
 
260 271
 					break;
261 272
 				default:
262
-					if (!array_key_exists($name, $data)) continue;
273
+					if (!array_key_exists($name, $data)) {
274
+					    continue;
275
+					}
263 276
 					$queue->$name = $data[$name];
264 277
 			}
265 278
 		}
@@ -280,7 +293,8 @@  discard block
 block discarded – undo
280 293
 	 * @param array $data массив полей из POST запроса
281 294
 	 * @return bool update result
282 295
 	 */
283
-	private function updateExtension(Extensions $extension, array $data){
296
+	private function updateExtension(Extensions $extension, array $data)
297
+	{
284 298
 
285 299
 		$extension->number=$data['extension'];
286 300
 		$extension->callerid=parent::transliterate($data['name']);
@@ -301,7 +315,8 @@  discard block
 block discarded – undo
301 315
 	 * @param array $data массив полей из POST запроса
302 316
 	 * @return bool update result
303 317
 	 */
304
-	private function updateQueueMembers(array $data){
318
+	private function updateQueueMembers(array $data)
319
+	{
305 320
 
306 321
 		$realMembers=[];
307 322
 		// Обновим настройки у существующих членов очереди
Please login to merge, or discard this patch.
Upper-Lower-Casing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 			return false;
271 271
 		}
272 272
 
273
-		return TRUE;
273
+		return true;
274 274
 	}
275 275
 
276 276
 
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 			return false;
291 291
 		}
292 292
 
293
-		return TRUE;
293
+		return true;
294 294
 
295 295
 	}
296 296
 
@@ -317,10 +317,10 @@  discard block
 block discarded – undo
317 317
 			$queueMembers = CallQueueMembers::find($parameters);
318 318
 			if ($queueMembers->count()>1){
319 319
 				// откуда то взались лишние. Надо их всех удалить и создать нового
320
-				if ($queueMembers->delete()=== FALSE){
320
+				if ($queueMembers->delete()=== false){
321 321
 					$errors = $queueMembers->getMessages();
322 322
 					$this->flash->error(implode('<br>', $errors));
323
-					return FALSE;
323
+					return false;
324 324
 				}
325 325
 				$queueMember = new CallQueueMembers();
326 326
 			} elseif ($queueMembers->count()==1){
@@ -333,10 +333,10 @@  discard block
 block discarded – undo
333 333
 			$queueMember->extension   = $member->number;
334 334
 			$queueMember->queue       = $data['uniqid'];
335 335
 			$realMembers[]= $member->number;
336
-			if ($queueMember->save()=== FALSE){
336
+			if ($queueMember->save()=== false){
337 337
 				$errors = $queueMember->getMessages();
338 338
 				$this->flash->error(implode('<br>', $errors));
339
-				return FALSE;
339
+				return false;
340 340
 			}
341 341
 		}
342 342
 
@@ -350,12 +350,12 @@  discard block
 block discarded – undo
350 350
 		];
351 351
 
352 352
 		$deletedMembers = CallQueueMembers::find($parameters);
353
-		if ($deletedMembers && $deletedMembers->delete()=== FALSE){
353
+		if ($deletedMembers && $deletedMembers->delete()=== false){
354 354
 			$errors = $deletedMembers->getMessages();
355 355
 			$this->flash->error(implode('<br>', $errors));
356
-			return FALSE;
356
+			return false;
357 357
 		}
358 358
 
359
-		return TRUE;
359
+		return true;
360 360
 	}
361 361
 }
362 362
\ No newline at end of file
Please login to merge, or discard this patch.
www/admin-cabinet/app/controllers/UpdateController.php 3 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -13,11 +13,11 @@
 block discarded – undo
13 13
 class UpdateController extends BaseController {
14 14
 
15 15
 
16
-	/**
17
-	 * Обновление станции до нового релиза
18
-	 *
19
-	 */
20
-	public function indexAction() {
21
-		$this->view->submitMode = NULL;
22
-	}
16
+    /**
17
+     * Обновление станции до нового релиза
18
+     *
19
+     */
20
+    public function indexAction() {
21
+        $this->view->submitMode = NULL;
22
+    }
23 23
 }
24 24
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -10,14 +10,16 @@
 block discarded – undo
10 10
 use Models\PbxSettings;
11 11
 use Phalcon\Text;
12 12
 
13
-class UpdateController extends BaseController {
13
+class UpdateController extends BaseController
14
+{
14 15
 
15 16
 
16 17
 	/**
17 18
 	 * Обновление станции до нового релиза
18 19
 	 *
19 20
 	 */
20
-	public function indexAction() {
21
+	public function indexAction()
22
+	{
21 23
 		$this->view->submitMode = NULL;
22 24
 	}
23 25
 }
24 26
\ No newline at end of file
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,6 +18,6 @@
 block discarded – undo
18 18
 	 *
19 19
 	 */
20 20
 	public function indexAction() {
21
-		$this->view->submitMode = NULL;
21
+		$this->view->submitMode = null;
22 22
 	}
23 23
 }
24 24
\ No newline at end of file
Please login to merge, or discard this patch.
www/admin-cabinet/app/controllers/IncomingRoutesController.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
         }
55 55
         //Маршрут по умолчанию
56 56
         $defaultRule = IncomingRoutingTable::findFirstById(1);
57
-        if ( ! $defaultRule) {
57
+        if (!$defaultRule) {
58 58
             $defaultRule           = new IncomingRoutingTable();
59 59
             $defaultRule->id       = 1;
60 60
             $defaultRule->action   = 'busy';
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
                 ],
73 73
             ],
74 74
         ];
75
-        $extensions               = Extensions::find($parameters);
75
+        $extensions = Extensions::find($parameters);
76 76
         foreach ($extensions as $record) {
77 77
             $forwardingExtensions[$record->number] = $record ? $record->getRepresent() : '';
78 78
         }
@@ -91,12 +91,12 @@  discard block
 block discarded – undo
91 91
      */
92 92
     public function modifyAction($ruleId = null)
93 93
     {
94
-        if ((int)$ruleId === 1) {
94
+        if ((int) $ruleId === 1) {
95 95
             return $this->forward('incoming-routes/index');
96 96
         } // Первая строка маршрут по умолчанию, ее не трогаем.
97 97
 
98 98
         $rule = IncomingRoutingTable::findFirstByid($ruleId);
99
-        if ( ! $rule) {
99
+        if (!$rule) {
100 100
             $rule = new IncomingRoutingTable();
101 101
         }
102 102
 
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
                 ],
121 121
             ],
122 122
         ];
123
-        $extensions               = Extensions::find($parameters);
123
+        $extensions = Extensions::find($parameters);
124 124
         foreach ($extensions as $record) {
125 125
             $forwardingExtensions[$record->number] = $record ? $record->getRepresent() : '';
126 126
         }
@@ -137,13 +137,13 @@  discard block
 block discarded – undo
137 137
      */
138 138
     public function saveAction()
139 139
     {
140
-        if ( ! $this->request->isPost()) {
140
+        if (!$this->request->isPost()) {
141 141
             return;
142 142
         }
143 143
         $this->db->begin();
144 144
         $data = $this->request->getPost();
145 145
         $rule = IncomingRoutingTable::findFirstByid($data['id']);
146
-        if ( ! $rule) {
146
+        if (!$rule) {
147 147
             $rule = new IncomingRoutingTable();
148 148
         }
149 149
 
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
                 case 'priority':
160 160
                     if (empty($data[$name])) {
161 161
                         // Найдем строчку с самым высоким приоиртетом, кроме 9999
162
-                        $params      = [
162
+                        $params = [
163 163
                             'column'     => 'priority',
164 164
                             'conditions' => 'priority != 9999',
165 165
                         ];
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
      */
206 206
     public function deleteAction(string $ruleId)
207 207
     {
208
-        if ((int)$ruleId === 1) {
208
+        if ((int) $ruleId === 1) {
209 209
             return $this->forward('incoming-routes/index'); // Первая строка маршрут по умолчанию, ее не трогаем.
210 210
         }
211 211
 
@@ -225,20 +225,20 @@  discard block
 block discarded – undo
225 225
      */
226 226
     public function changePriorityAction(string $ruleId = null)
227 227
     {
228
-        if ((int)$ruleId === 1) {
228
+        if ((int) $ruleId === 1) {
229 229
             return;
230 230
         } // Первая строка маршрут по умолчанию, ее не трогаем.
231 231
 
232 232
         $this->view->disable();
233 233
         $result = false;
234 234
 
235
-        if ( ! $this->request->isPost()) {
235
+        if (!$this->request->isPost()) {
236 236
             return;
237 237
         }
238 238
         $data = $this->request->getPost();
239 239
         $rule = IncomingRoutingTable::findFirstById($ruleId);
240 240
         if ($rule) {
241
-            $rule->priority = (int)$data['newPriority'];
241
+            $rule->priority = (int) $data['newPriority'];
242 242
             $result         = $rule->update();
243 243
         }
244 244
         echo json_encode($result);
Please login to merge, or discard this patch.
www/admin-cabinet/app/controllers/UsersController.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,13 +14,13 @@
 block discarded – undo
14 14
     /**
15 15
      * Проверка на доступность емейл адреса
16 16
      */
17
-    public function availableAction($email){
17
+    public function availableAction($email) {
18 18
         $result = true;
19 19
         $extension = Users::findFirstByEmail($email);
20 20
         if ($extension) {
21 21
             $result = false;
22 22
         }
23
-        $this->view->emailAvailable=$result;
23
+        $this->view->emailAvailable = $result;
24 24
     }
25 25
 
26 26
 }
27 27
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,12 +9,14 @@
 block discarded – undo
9 9
 
10 10
 use \Models\Users;
11 11
 
12
-class UsersController extends BaseController {
12
+class UsersController extends BaseController
13
+{
13 14
 
14 15
     /**
15 16
      * Проверка на доступность емейл адреса
16 17
      */
17
-    public function availableAction($email){
18
+    public function availableAction($email)
19
+    {
18 20
         $result = true;
19 21
         $extension = Users::findFirstByEmail($email);
20 22
         if ($extension) {
Please login to merge, or discard this patch.
www/admin-cabinet/app/controllers/AdvicesController.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
                 }
41 41
             }
42 42
             $newResult = $this->$currentAdvice();
43
-            if ( ! empty($newResult)) {
43
+            if (!empty($newResult)) {
44 44
                 $arrMessages[] = $newResult;
45 45
             }
46 46
             $this->session->set($currentAdvice, json_encode(['LastMessage' => $newResult, 'LastTimeStamp' => time()]));
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
         $result              = [];
50 50
         foreach ($arrMessages as $message) {
51 51
             foreach ($message as $key => $value) {
52
-                if ( ! empty($value)) {
52
+                if (!empty($value)) {
53 53
                     $result[$key][] = $value;
54 54
                 }
55 55
             }
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
      */
106 106
     private function checkStorage()
107 107
     {
108
-        if ( ! is_array($_COOKIE) || ! array_key_exists(session_name(), $_COOKIE)) {
108
+        if (!is_array($_COOKIE) || !array_key_exists(session_name(), $_COOKIE)) {
109 109
             return [];
110 110
         }
111 111
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
         curl_setopt($ch, CURLOPT_URL, $url);
116 116
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
117 117
         curl_setopt($ch, CURLOPT_TIMEOUT, 3);
118
-        curl_setopt($ch, CURLOPT_COOKIE, session_name() . '=' . $_COOKIE[session_name()]);
118
+        curl_setopt($ch, CURLOPT_COOKIE, session_name().'='.$_COOKIE[session_name()]);
119 119
         $output = curl_exec($ch);
120 120
         curl_close($ch);
121 121
         $storageList = json_decode($output, false);
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
     private function checkRegistration()
182 182
     {
183 183
         $licKey = Models\PbxSettings::getValueByKey('PBXLicense');
184
-        if ( ! empty($licKey)) {
184
+        if (!empty($licKey)) {
185 185
 
186 186
             $checkBaseFeature = $this->licenseWorker->featureAvailable(33);
187 187
             if ($checkBaseFeature['success'] === false) {
Please login to merge, or discard this patch.