Passed
Push — master ( e80252...a999dd )
by Nikolay
32:05 queued 14:50
created
www/admin-cabinet/app/plugins/NotFoundPlugin.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -14,14 +14,14 @@
 block discarded – undo
14 14
 class NotFoundPlugin extends Plugin
15 15
 {
16 16
 
17
-	/**
18
-	 * This action is executed before execute any action in the application
19
-	 *
20
-	 * @param Event $event
21
-	 * @param Dispatcher $dispatcher
22
-	 */
23
-	public function beforeException(Event $event, MvcDispatcher $dispatcher, Exception $exception)
24
-	{
17
+    /**
18
+     * This action is executed before execute any action in the application
19
+     *
20
+     * @param Event $event
21
+     * @param Dispatcher $dispatcher
22
+     */
23
+    public function beforeException(Event $event, MvcDispatcher $dispatcher, Exception $exception)
24
+    {
25 25
     if ($exception instanceof DispatcherException) {
26 26
         switch ($exception->getCode()) {
27 27
             case Dispatcher::EXCEPTION_HANDLER_NOT_FOUND:
Please login to merge, or discard this patch.
www/admin-cabinet/app/plugins/SecurityPlugin.php 3 patches
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -27,36 +27,36 @@
 block discarded – undo
27 27
      */
28 28
     public function beforeDispatch(Event $event, Dispatcher $dispatcher)
29 29
     {
30
-		if($_SERVER['REMOTE_ADDR'] == '127.0.0.1'){
31
-			return true;
32
-		}
30
+        if($_SERVER['REMOTE_ADDR'] == '127.0.0.1'){
31
+            return true;
32
+        }
33 33
 
34
-	    $controller = strtoupper( $dispatcher->getControllerName() );
35
-		if ($this->request->isAjax()){
36
-			if ( $controller !== 'SESSION'){
37
-				if (!is_array($this->sessionRO) || !key_exists('auth', $this->sessionRO )){
38
-					$this->response->setStatusCode( 403, "Forbidden" )
39
-					               ->sendHeaders();
40
-					$this->response->setContent( 'The user isn\'t authenticated' );
41
-					$this->response->send();
42
-					return FALSE;
43
-				}
44
-			}
45
-		} else { // не AJAX запрос
46
-			$auth = $this->session->get( 'auth' );
47
-			if ( ! $auth && $controller !== 'SESSION' ) {
48
-				$dispatcher->forward( [
49
-					'controller' => 'session',
50
-					'action'     => 'index',
51
-				] );
52
-			} elseif ($controller == 'INDEX'){
53
-				// TODO: когда будет главная страница сделаем переадресацию на нее
54
-				$dispatcher->forward( [
55
-					'controller' => 'extensions',
56
-					'action'     => 'index',
57
-				] );
58
-			}
59
-		}
34
+        $controller = strtoupper( $dispatcher->getControllerName() );
35
+        if ($this->request->isAjax()){
36
+            if ( $controller !== 'SESSION'){
37
+                if (!is_array($this->sessionRO) || !key_exists('auth', $this->sessionRO )){
38
+                    $this->response->setStatusCode( 403, "Forbidden" )
39
+                                    ->sendHeaders();
40
+                    $this->response->setContent( 'The user isn\'t authenticated' );
41
+                    $this->response->send();
42
+                    return FALSE;
43
+                }
44
+            }
45
+        } else { // не AJAX запрос
46
+            $auth = $this->session->get( 'auth' );
47
+            if ( ! $auth && $controller !== 'SESSION' ) {
48
+                $dispatcher->forward( [
49
+                    'controller' => 'session',
50
+                    'action'     => 'index',
51
+                ] );
52
+            } elseif ($controller == 'INDEX'){
53
+                // TODO: когда будет главная страница сделаем переадресацию на нее
54
+                $dispatcher->forward( [
55
+                    'controller' => 'extensions',
56
+                    'action'     => 'index',
57
+                ] );
58
+            }
59
+        }
60 60
     }
61 61
 
62 62
 }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -27,34 +27,34 @@
 block discarded – undo
27 27
      */
28 28
     public function beforeDispatch(Event $event, Dispatcher $dispatcher)
29 29
     {
30
-		if($_SERVER['REMOTE_ADDR'] == '127.0.0.1'){
30
+		if ($_SERVER['REMOTE_ADDR'] == '127.0.0.1') {
31 31
 			return true;
32 32
 		}
33 33
 
34
-	    $controller = strtoupper( $dispatcher->getControllerName() );
35
-		if ($this->request->isAjax()){
36
-			if ( $controller !== 'SESSION'){
37
-				if (!is_array($this->sessionRO) || !key_exists('auth', $this->sessionRO )){
38
-					$this->response->setStatusCode( 403, "Forbidden" )
34
+	    $controller = strtoupper($dispatcher->getControllerName());
35
+		if ($this->request->isAjax()) {
36
+			if ($controller !== 'SESSION') {
37
+				if (!is_array($this->sessionRO) || !key_exists('auth', $this->sessionRO)) {
38
+					$this->response->setStatusCode(403, "Forbidden")
39 39
 					               ->sendHeaders();
40
-					$this->response->setContent( 'The user isn\'t authenticated' );
40
+					$this->response->setContent('The user isn\'t authenticated');
41 41
 					$this->response->send();
42 42
 					return FALSE;
43 43
 				}
44 44
 			}
45 45
 		} else { // не AJAX запрос
46
-			$auth = $this->session->get( 'auth' );
47
-			if ( ! $auth && $controller !== 'SESSION' ) {
48
-				$dispatcher->forward( [
46
+			$auth = $this->session->get('auth');
47
+			if (!$auth && $controller !== 'SESSION') {
48
+				$dispatcher->forward([
49 49
 					'controller' => 'session',
50 50
 					'action'     => 'index',
51
-				] );
52
-			} elseif ($controller == 'INDEX'){
51
+				]);
52
+			} elseif ($controller == 'INDEX') {
53 53
 				// TODO: когда будет главная страница сделаем переадресацию на нее
54
-				$dispatcher->forward( [
54
+				$dispatcher->forward([
55 55
 					'controller' => 'extensions',
56 56
 					'action'     => 'index',
57
-				] );
57
+				]);
58 58
 			}
59 59
 		}
60 60
     }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
39 39
 					               ->sendHeaders();
40 40
 					$this->response->setContent( 'The user isn\'t authenticated' );
41 41
 					$this->response->send();
42
-					return FALSE;
42
+					return false;
43 43
 				}
44 44
 			}
45 45
 		} else { // не AJAX запрос
Please login to merge, or discard this patch.
www/admin-cabinet/app/plugins/AdditionalAssets.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
         /**
16 16
          * Сервис для работы с JS и CSS файлами
17 17
          */
18
-        $di->set('assets', function (){
18
+        $di->set('assets', function() {
19 19
             $config     = $this->get('config');
20 20
             $manager    = new Phalcon\Assets\Manager();
21 21
             $dispatcher = $this->get('dispatcher');
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
             // Сохраним перевод в файл если его еще нет
550 550
             $language   = $this->get('language');
551 551
             $langJSFile = "public/js/cache/localization-{$language}-{$version}.min.js";
552
-            if ( ! file_exists($langJSFile)) {
552
+            if (!file_exists($langJSFile)) {
553 553
                 $arrStr = [];
554 554
                 foreach ($this->get('messages') as $key => $value) {
555 555
                     $arrStr[$key] = str_replace("'", "\\'",
@@ -566,8 +566,8 @@  discard block
 block discarded – undo
566 566
 
567 567
 
568 568
             // Название получаемого файла
569
-            $resultCombinedName = Text::uncamelize(ucfirst($controller) . ucfirst($action), '-');
570
-            $resultCombinedName = strlen($resultCombinedName) !== '' ? $resultCombinedName . '-' : '';
569
+            $resultCombinedName = Text::uncamelize(ucfirst($controller).ucfirst($action), '-');
570
+            $resultCombinedName = strlen($resultCombinedName) !== '' ? $resultCombinedName.'-' : '';
571 571
 
572 572
 
573 573
             $headerCollectionCSS->join(true);
@@ -582,16 +582,16 @@  discard block
 block discarded – undo
582 582
             $headerCollectionJS->setPrefix('public/');
583 583
             $footerCollectionJS->setPrefix('public/');
584 584
             foreach ($headerCollectionJS as $resource) {
585
-                $resource->setPath($resource->getPath() . '?v=' . $version);
585
+                $resource->setPath($resource->getPath().'?v='.$version);
586 586
             }
587 587
             foreach ($footerCollectionJS as $resource) {
588
-                $resource->setPath($resource->getPath() . '?v=' . $version);
588
+                $resource->setPath($resource->getPath().'?v='.$version);
589 589
             }
590 590
             foreach ($semanticCollectionJS as $resource) {
591
-                $resource->setPath($resource->getPath() . '?v=' . $version);
591
+                $resource->setPath($resource->getPath().'?v='.$version);
592 592
             }
593 593
             foreach ($semanticCollectionCSS as $resource) {
594
-                $resource->setPath($resource->getPath() . '?v=' . $version);
594
+                $resource->setPath($resource->getPath().'?v='.$version);
595 595
             }
596 596
 
597 597
             $headerCollectionJSForExtensions->join(true);
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,8 @@
 block discarded – undo
15 15
         /**
16 16
          * Сервис для работы с JS и CSS файлами
17 17
          */
18
-        $di->set('assets', function (){
18
+        $di->set('assets', function ()
19
+        {
19 20
             $config     = $this->get('config');
20 21
             $manager    = new Phalcon\Assets\Manager();
21 22
             $dispatcher = $this->get('dispatcher');
Please login to merge, or discard this patch.
www/admin-cabinet/app/plugins/NormalizeControllerNamePlugin.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -20,14 +20,14 @@
 block discarded – undo
20 20
 class NormalizeControllerNamePlugin extends Plugin
21 21
 {
22 22
 
23
-	/**
24
-	 * This action is executed before execute any action in the application
25
-	 *
26
-	 * @param Event $event
27
-	 * @param Dispatcher $dispatcher
28
-	 */
29
-	public function beforeDispatch(Event $event, Dispatcher $dispatcher) :void
30
-	{
23
+    /**
24
+     * This action is executed before execute any action in the application
25
+     *
26
+     * @param Event $event
27
+     * @param Dispatcher $dispatcher
28
+     */
29
+    public function beforeDispatch(Event $event, Dispatcher $dispatcher) :void
30
+    {
31 31
         $controller = $dispatcher->getControllerName();
32 32
         if ( strpos( $controller, '-' ) > 0 ) {
33 33
             $controller = str_replace('-', '_', $controller);
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -29,15 +29,15 @@  discard block
 block discarded – undo
29 29
 	public function beforeDispatch(Event $event, Dispatcher $dispatcher) :void
30 30
 	{
31 31
         $controller = $dispatcher->getControllerName();
32
-        if ( strpos( $controller, '-' ) > 0 ) {
32
+        if (strpos($controller, '-') > 0) {
33 33
             $controller = str_replace('-', '_', $controller);
34 34
         }
35 35
         $dispatcher->setControllerName(ucfirst($controller));
36 36
 
37
-        if ( stripos( $controller, 'module' ) === 0 ) {
38
-            $dispatcher->setModuleName( 'PBXExtension' );
37
+        if (stripos($controller, 'module') === 0) {
38
+            $dispatcher->setModuleName('PBXExtension');
39 39
         } else {
40
-            $dispatcher->setModuleName( 'PBXCore' );
40
+            $dispatcher->setModuleName('PBXCore');
41 41
         }
42 42
     }
43 43
 
@@ -51,10 +51,10 @@  discard block
 block discarded – undo
51 51
     {
52 52
         $controller = $dispatcher->getControllerName();
53 53
 
54
-        if ( strpos( $controller, '_' ) > 0 ) {
55
-            $dispatcher->setControllerName(Text::camelize( $controller));
54
+        if (strpos($controller, '_') > 0) {
55
+            $dispatcher->setControllerName(Text::camelize($controller));
56 56
         } else {
57
-            $dispatcher->setControllerName(ucfirst( $controller ));
57
+            $dispatcher->setControllerName(ucfirst($controller));
58 58
         }
59 59
 
60 60
     }
Please login to merge, or discard this patch.
www/admin-cabinet/app/controllers/ConferenceRoomsController.php 4 patches
Indentation   +108 added lines, -108 removed lines patch added patch discarded remove patch
@@ -15,40 +15,40 @@  discard block
 block discarded – undo
15 15
 
16 16
 
17 17
     /**
18
-	 * Построение списка конференц комнат
19
-	 */
18
+     * Построение списка конференц комнат
19
+     */
20 20
     public function indexAction()
21 21
     {
22
-    	$records = ConferenceRooms::find();
22
+        $records = ConferenceRooms::find();
23 23
         $this->view->records = $records;
24 24
     }
25 25
 
26 26
 
27 27
     /**
28
-	 * Карточка редактирования конференц комнаты
29
-	 *
30
-	 * @param string|NULL $uniqid
31
-	 */
32
-	public function modifyAction(string $uniqid=null){
33
-	    $record = ConferenceRooms::findFirstByUniqid($uniqid);
28
+     * Карточка редактирования конференц комнаты
29
+     *
30
+     * @param string|NULL $uniqid
31
+     */
32
+    public function modifyAction(string $uniqid=null){
33
+        $record = ConferenceRooms::findFirstByUniqid($uniqid);
34 34
         if (!$record){
35 35
             $record            = new ConferenceRooms();
36
-	        $record->uniqid    = strtoupper('CONFERENCE-'.md5(time()));
37
-	        $record->extension = Extensions::getNextFreeApplicationNumber();
36
+            $record->uniqid    = strtoupper('CONFERENCE-'.md5(time()));
37
+            $record->extension = Extensions::getNextFreeApplicationNumber();
38 38
         }
39 39
         $this->view->form = new ConferenceRoomEditForm($record);
40
-	    $this->view->represent  = $record->getRepresent();
40
+        $this->view->represent  = $record->getRepresent();
41 41
 
42 42
     }
43 43
 
44 44
 
45
-	/**
46
-	 * Сохранение конференц комнаты
47
-	 */
48
-	public function saveAction()
45
+    /**
46
+     * Сохранение конференц комнаты
47
+     */
48
+    public function saveAction()
49 49
     {
50 50
         if (!$this->request->isPost()) return;
51
-	    $this->db->begin();
51
+        $this->db->begin();
52 52
         $data = $this->request->getPost();
53 53
         $room = ConferenceRooms::findFirstByUniqid($data['uniqid']);
54 54
         if (!$room)  {
@@ -62,105 +62,105 @@  discard block
 block discarded – undo
62 62
             $extension->public_access     = 1;
63 63
 
64 64
         } else {
65
-	        $extension = $room->Extensions;
65
+            $extension = $room->Extensions;
66
+        }
67
+
68
+        // Заполним параметры внутреннего номера
69
+        if (!$this->updateExtension($extension, $data)){
70
+            $this->view->success=false;
71
+            $this->db->rollback();
72
+            return;
73
+        }
74
+
75
+        // Заполним параметры участников очереди
76
+        if (!$this->updateConferenceRoom($room, $data)){
77
+            $this->view->success=false;
78
+            $this->db->rollback();
79
+            return;
66 80
         }
67 81
 
68
-	    // Заполним параметры внутреннего номера
69
-	    if (!$this->updateExtension($extension, $data)){
70
-		    $this->view->success=false;
71
-		    $this->db->rollback();
72
-		    return;
73
-	    }
74
-
75
-	    // Заполним параметры участников очереди
76
-	    if (!$this->updateConferenceRoom($room, $data)){
77
-		    $this->view->success=false;
78
-		    $this->db->rollback();
79
-		    return;
80
-	    }
81
-
82
-	    $this->flash->success($this->translation->_('ms_SuccessfulSaved'));
83
-	    $this->view->success=true;
84
-	    $this->db->commit();
85
-
86
-	    // Если это было создание карточки то надо перегрузить страницу с указанием ID
87
-	    if (empty($data['id'])){
88
-		    $this->view->reload = "conference-rooms/modify/{$data['uniqid']}";
89
-	    }
82
+        $this->flash->success($this->translation->_('ms_SuccessfulSaved'));
83
+        $this->view->success=true;
84
+        $this->db->commit();
85
+
86
+        // Если это было создание карточки то надо перегрузить страницу с указанием ID
87
+        if (empty($data['id'])){
88
+            $this->view->reload = "conference-rooms/modify/{$data['uniqid']}";
89
+        }
90
+    }
91
+
92
+
93
+    /**
94
+     * Удаление конференцкомнаты
95
+     * @param string|NULL $uniqid
96
+     */
97
+    public function deleteAction(string $uniqid=null){
98
+        $this->db->begin();
99
+        $queue = ConferenceRooms::findFirstByUniqid($uniqid);
100
+
101
+        $errors = false;
102
+        if($queue && !$queue->Extensions->delete())
103
+            $errors = $queue->Extensions->getMessages();
104
+
105
+        if ($errors){
106
+            $this->flash->warning(implode('<br>', $errors));
107
+            $this->db->rollback();
108
+        }
109
+        else
110
+        {
111
+            $this->db->commit();
112
+        }
113
+        return $this->forward('conference-rooms/index');
90 114
     }
91 115
 
92 116
 
93 117
     /**
94
-	 * Удаление конференцкомнаты
95
-	 * @param string|NULL $uniqid
96
-	 */
97
-	public function deleteAction(string $uniqid=null){
98
-	    $this->db->begin();
99
-	    $queue = ConferenceRooms::findFirstByUniqid($uniqid);
100
-
101
-	    $errors = false;
102
-	    if($queue && !$queue->Extensions->delete())
103
-		    $errors = $queue->Extensions->getMessages();
104
-
105
-	    if ($errors){
106
-		    $this->flash->warning(implode('<br>', $errors));
107
-		    $this->db->rollback();
108
-	    }
109
-	    else
110
-	    {
111
-		    $this->db->commit();
112
-	    }
113
-	    return $this->forward('conference-rooms/index');
118
+     * Обновление параметров внутреннего номера
119
+     * @param \Models\Extensions $extension
120
+     * @param array $data массив полей из POST запроса
121
+     * @return bool update result
122
+     */
123
+    private function updateExtension(Extensions $extension, array $data){
124
+
125
+        $extension->number=$data['extension'];
126
+        $extension->callerid=parent::transliterate($data['name']);
127
+        if ($extension->save()=== false){
128
+            $errors = $extension->getMessages();
129
+            $this->flash->error(implode('<br>', $errors));
130
+            return false;
131
+        }
132
+
133
+        return TRUE;
134
+
114 135
     }
115 136
 
116 137
 
117 138
     /**
118
-	 * Обновление параметров внутреннего номера
119
-	 * @param \Models\Extensions $extension
120
-	 * @param array $data массив полей из POST запроса
121
-	 * @return bool update result
122
-	 */
123
-	private function updateExtension(Extensions $extension, array $data){
124
-
125
-		$extension->number=$data['extension'];
126
-		$extension->callerid=parent::transliterate($data['name']);
127
-		if ($extension->save()=== false){
128
-			$errors = $extension->getMessages();
129
-			$this->flash->error(implode('<br>', $errors));
130
-			return false;
131
-		}
132
-
133
-		return TRUE;
134
-
135
-	}
136
-
137
-
138
-	/**
139
-	 * Обновление параметров очереди
140
-	 * @param \Models\ConferenceRooms $room
141
-	 * @param array $data массив полей из POST запроса
142
-	 * @return bool update result
143
-	 */
144
-	private function updateConferenceRoom(ConferenceRooms $room, array $data){
145
-		foreach ($room as $name => $value) {
146
-			switch ($name){
147
-				case "extension":
148
-					$room->$name = $data[$name];
149
-					break;
150
-				case "name":
151
-					$room->$name = $data[$name];
152
-					break;
153
-				default:
154
-					if (!array_key_exists( $name, $data)) continue;
155
-					$room->$name = $data[$name];
156
-			}
157
-		}
158
-		if ($room->save()=== false){
159
-			$errors = $room->getMessages();
160
-			$this->flash->error(implode('<br>', $errors));
161
-			return false;
162
-		}
163
-
164
-		return TRUE;
165
-	}
139
+     * Обновление параметров очереди
140
+     * @param \Models\ConferenceRooms $room
141
+     * @param array $data массив полей из POST запроса
142
+     * @return bool update result
143
+     */
144
+    private function updateConferenceRoom(ConferenceRooms $room, array $data){
145
+        foreach ($room as $name => $value) {
146
+            switch ($name){
147
+                case "extension":
148
+                    $room->$name = $data[$name];
149
+                    break;
150
+                case "name":
151
+                    $room->$name = $data[$name];
152
+                    break;
153
+                default:
154
+                    if (!array_key_exists( $name, $data)) continue;
155
+                    $room->$name = $data[$name];
156
+            }
157
+        }
158
+        if ($room->save()=== false){
159
+            $errors = $room->getMessages();
160
+            $this->flash->error(implode('<br>', $errors));
161
+            return false;
162
+        }
163
+
164
+        return TRUE;
165
+    }
166 166
 }
167 167
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -29,15 +29,15 @@  discard block
 block discarded – undo
29 29
 	 *
30 30
 	 * @param string|NULL $uniqid
31 31
 	 */
32
-	public function modifyAction(string $uniqid=null){
32
+	public function modifyAction(string $uniqid = null) {
33 33
 	    $record = ConferenceRooms::findFirstByUniqid($uniqid);
34
-        if (!$record){
35
-            $record            = new ConferenceRooms();
34
+        if (!$record) {
35
+            $record = new ConferenceRooms();
36 36
 	        $record->uniqid    = strtoupper('CONFERENCE-'.md5(time()));
37 37
 	        $record->extension = Extensions::getNextFreeApplicationNumber();
38 38
         }
39 39
         $this->view->form = new ConferenceRoomEditForm($record);
40
-	    $this->view->represent  = $record->getRepresent();
40
+	    $this->view->represent = $record->getRepresent();
41 41
 
42 42
     }
43 43
 
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	    $this->db->begin();
52 52
         $data = $this->request->getPost();
53 53
         $room = ConferenceRooms::findFirstByUniqid($data['uniqid']);
54
-        if (!$room)  {
54
+        if (!$room) {
55 55
             $room = new ConferenceRooms();
56 56
             $extension = new Extensions();
57 57
             $extension->type     = "CONFERENCE";
@@ -66,25 +66,25 @@  discard block
 block discarded – undo
66 66
         }
67 67
 
68 68
 	    // Заполним параметры внутреннего номера
69
-	    if (!$this->updateExtension($extension, $data)){
70
-		    $this->view->success=false;
69
+	    if (!$this->updateExtension($extension, $data)) {
70
+		    $this->view->success = false;
71 71
 		    $this->db->rollback();
72 72
 		    return;
73 73
 	    }
74 74
 
75 75
 	    // Заполним параметры участников очереди
76
-	    if (!$this->updateConferenceRoom($room, $data)){
77
-		    $this->view->success=false;
76
+	    if (!$this->updateConferenceRoom($room, $data)) {
77
+		    $this->view->success = false;
78 78
 		    $this->db->rollback();
79 79
 		    return;
80 80
 	    }
81 81
 
82 82
 	    $this->flash->success($this->translation->_('ms_SuccessfulSaved'));
83
-	    $this->view->success=true;
83
+	    $this->view->success = true;
84 84
 	    $this->db->commit();
85 85
 
86 86
 	    // Если это было создание карточки то надо перегрузить страницу с указанием ID
87
-	    if (empty($data['id'])){
87
+	    if (empty($data['id'])) {
88 88
 		    $this->view->reload = "conference-rooms/modify/{$data['uniqid']}";
89 89
 	    }
90 90
     }
@@ -94,15 +94,15 @@  discard block
 block discarded – undo
94 94
 	 * Удаление конференцкомнаты
95 95
 	 * @param string|NULL $uniqid
96 96
 	 */
97
-	public function deleteAction(string $uniqid=null){
97
+	public function deleteAction(string $uniqid = null) {
98 98
 	    $this->db->begin();
99 99
 	    $queue = ConferenceRooms::findFirstByUniqid($uniqid);
100 100
 
101 101
 	    $errors = false;
102
-	    if($queue && !$queue->Extensions->delete())
102
+	    if ($queue && !$queue->Extensions->delete())
103 103
 		    $errors = $queue->Extensions->getMessages();
104 104
 
105
-	    if ($errors){
105
+	    if ($errors) {
106 106
 		    $this->flash->warning(implode('<br>', $errors));
107 107
 		    $this->db->rollback();
108 108
 	    }
@@ -120,11 +120,11 @@  discard block
 block discarded – undo
120 120
 	 * @param array $data массив полей из POST запроса
121 121
 	 * @return bool update result
122 122
 	 */
123
-	private function updateExtension(Extensions $extension, array $data){
123
+	private function updateExtension(Extensions $extension, array $data) {
124 124
 
125
-		$extension->number=$data['extension'];
126
-		$extension->callerid=parent::transliterate($data['name']);
127
-		if ($extension->save()=== false){
125
+		$extension->number = $data['extension'];
126
+		$extension->callerid = parent::transliterate($data['name']);
127
+		if ($extension->save() === false) {
128 128
 			$errors = $extension->getMessages();
129 129
 			$this->flash->error(implode('<br>', $errors));
130 130
 			return false;
@@ -141,9 +141,9 @@  discard block
 block discarded – undo
141 141
 	 * @param array $data массив полей из POST запроса
142 142
 	 * @return bool update result
143 143
 	 */
144
-	private function updateConferenceRoom(ConferenceRooms $room, array $data){
144
+	private function updateConferenceRoom(ConferenceRooms $room, array $data) {
145 145
 		foreach ($room as $name => $value) {
146
-			switch ($name){
146
+			switch ($name) {
147 147
 				case "extension":
148 148
 					$room->$name = $data[$name];
149 149
 					break;
@@ -151,11 +151,11 @@  discard block
 block discarded – undo
151 151
 					$room->$name = $data[$name];
152 152
 					break;
153 153
 				default:
154
-					if (!array_key_exists( $name, $data)) continue;
154
+					if (!array_key_exists($name, $data)) continue;
155 155
 					$room->$name = $data[$name];
156 156
 			}
157 157
 		}
158
-		if ($room->save()=== false){
158
+		if ($room->save() === false) {
159 159
 			$errors = $room->getMessages();
160 160
 			$this->flash->error(implode('<br>', $errors));
161 161
 			return false;
Please login to merge, or discard this patch.
Braces   +21 added lines, -12 removed lines patch added patch discarded remove patch
@@ -11,7 +11,8 @@  discard block
 block discarded – undo
11 11
 use Models\Extensions;
12 12
 
13 13
 
14
-class ConferenceRoomsController extends BaseController {
14
+class ConferenceRoomsController extends BaseController
15
+{
15 16
 
16 17
 
17 18
     /**
@@ -29,7 +30,8 @@  discard block
 block discarded – undo
29 30
 	 *
30 31
 	 * @param string|NULL $uniqid
31 32
 	 */
32
-	public function modifyAction(string $uniqid=null){
33
+	public function modifyAction(string $uniqid=null)
34
+	{
33 35
 	    $record = ConferenceRooms::findFirstByUniqid($uniqid);
34 36
         if (!$record){
35 37
             $record            = new ConferenceRooms();
@@ -46,8 +48,10 @@  discard block
 block discarded – undo
46 48
 	 * Сохранение конференц комнаты
47 49
 	 */
48 50
 	public function saveAction()
49
-    {
50
-        if (!$this->request->isPost()) return;
51
+	{
52
+        if (!$this->request->isPost()) {
53
+            return;
54
+        }
51 55
 	    $this->db->begin();
52 56
         $data = $this->request->getPost();
53 57
         $room = ConferenceRooms::findFirstByUniqid($data['uniqid']);
@@ -94,19 +98,20 @@  discard block
 block discarded – undo
94 98
 	 * Удаление конференцкомнаты
95 99
 	 * @param string|NULL $uniqid
96 100
 	 */
97
-	public function deleteAction(string $uniqid=null){
101
+	public function deleteAction(string $uniqid=null)
102
+	{
98 103
 	    $this->db->begin();
99 104
 	    $queue = ConferenceRooms::findFirstByUniqid($uniqid);
100 105
 
101 106
 	    $errors = false;
102
-	    if($queue && !$queue->Extensions->delete())
103
-		    $errors = $queue->Extensions->getMessages();
107
+	    if($queue && !$queue->Extensions->delete()) {
108
+	    		    $errors = $queue->Extensions->getMessages();
109
+	    }
104 110
 
105 111
 	    if ($errors){
106 112
 		    $this->flash->warning(implode('<br>', $errors));
107 113
 		    $this->db->rollback();
108
-	    }
109
-	    else
114
+	    } else
110 115
 	    {
111 116
 		    $this->db->commit();
112 117
 	    }
@@ -120,7 +125,8 @@  discard block
 block discarded – undo
120 125
 	 * @param array $data массив полей из POST запроса
121 126
 	 * @return bool update result
122 127
 	 */
123
-	private function updateExtension(Extensions $extension, array $data){
128
+	private function updateExtension(Extensions $extension, array $data)
129
+	{
124 130
 
125 131
 		$extension->number=$data['extension'];
126 132
 		$extension->callerid=parent::transliterate($data['name']);
@@ -141,7 +147,8 @@  discard block
 block discarded – undo
141 147
 	 * @param array $data массив полей из POST запроса
142 148
 	 * @return bool update result
143 149
 	 */
144
-	private function updateConferenceRoom(ConferenceRooms $room, array $data){
150
+	private function updateConferenceRoom(ConferenceRooms $room, array $data)
151
+	{
145 152
 		foreach ($room as $name => $value) {
146 153
 			switch ($name){
147 154
 				case "extension":
@@ -151,7 +158,9 @@  discard block
 block discarded – undo
151 158
 					$room->$name = $data[$name];
152 159
 					break;
153 160
 				default:
154
-					if (!array_key_exists( $name, $data)) continue;
161
+					if (!array_key_exists( $name, $data)) {
162
+					    continue;
163
+					}
155 164
 					$room->$name = $data[$name];
156 165
 			}
157 166
 		}
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 			return false;
131 131
 		}
132 132
 
133
-		return TRUE;
133
+		return true;
134 134
 
135 135
 	}
136 136
 
@@ -161,6 +161,6 @@  discard block
 block discarded – undo
161 161
 			return false;
162 162
 		}
163 163
 
164
-		return TRUE;
164
+		return true;
165 165
 	}
166 166
 }
167 167
\ No newline at end of file
Please login to merge, or discard this patch.
www/admin-cabinet/app/controllers/PbxExtensionModulesController.php 2 patches
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
     {
25 25
         $licKey = PbxSettings::getValueByKey('PBXLicense');
26 26
         if (strlen($licKey) !== 28
27
-            || ! Text::startsWith($licKey, 'MIKO-')) {
27
+            || !Text::startsWith($licKey, 'MIKO-')) {
28 28
             return $this->forward('licensing/modify/pbx-extension-modules');
29 29
         }
30 30
         // Очистим кеш хранилища для получения актульной информации о свободном месте
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
         $unCamelizedControllerName  = Text::uncamelize($uniqid, '-');
63 63
         $previousMenuSettings       = PbxSettings::findFirstByKey($menuSettings);
64 64
         $this->view->showAtMainMenu = $previousMenuSettings !== false;
65
-        if ( ! $previousMenuSettings) {
65
+        if (!$previousMenuSettings) {
66 66
             $previousMenuSettings        = new PbxSettings();
67 67
             $previousMenuSettings->key   = $menuSettings;
68 68
             $value                       = [
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
         }
78 78
         $options                = json_decode($previousMenuSettings->value, true);
79 79
         $this->view->form       = new PbxExtensionModuleSettingsForm($previousMenuSettings, $options);
80
-        $this->view->title      = $this->translation->_('ext_SettingsForModule') . ' ' . $this->translation->_("Breadcrumb$uniqid");
80
+        $this->view->title      = $this->translation->_('ext_SettingsForModule').' '.$this->translation->_("Breadcrumb$uniqid");
81 81
         $this->view->submitMode = null;
82 82
         $this->view->indexUrl   = $unCamelizedControllerName;
83 83
     }
@@ -89,17 +89,17 @@  discard block
 block discarded – undo
89 89
     public function saveModuleSettingsAction(): void
90 90
     {
91 91
 
92
-        if ( ! $this->request->isPost()) {
92
+        if (!$this->request->isPost()) {
93 93
             return;
94 94
         }
95 95
         $data = $this->request->getPost();
96 96
 
97 97
         $record = PbxSettings::findFirstByKey($data['key']);
98
-        if ( ! $record) {
98
+        if (!$record) {
99 99
             $record      = new PbxSettings();
100 100
             $record->key = $data['key'];
101 101
         }
102
-        $value         = [
102
+        $value = [
103 103
             'uniqid'        => $data['uniqid'],
104 104
             'href'          => $data['href'],
105 105
             'group'         => $data['menu-group'],
@@ -163,8 +163,8 @@  discard block
 block discarded – undo
163 163
             $controller = new $controllerClass();
164 164
             if ($controller->enableAction() === false) {
165 165
                 $messages = $this->flash->getMessages();
166
-                if ($messages){
167
-                    foreach ($messages as $index=>$message){
166
+                if ($messages) {
167
+                    foreach ($messages as $index=>$message) {
168 168
                         $this->flash->$index($message[0]);
169 169
                     }
170 170
                 } else {
@@ -179,8 +179,8 @@  discard block
 block discarded – undo
179 179
         // Проверим нет ли битых ссылок, которые мешают включить модуль
180 180
         // например удалили сотрудника, а модуль указывает на его extension
181 181
         //
182
-        $moduleModelsDir = $this->config->application->modulesDir . $uniqid . '/Models';
183
-        $results         = glob($moduleModelsDir . '/*.php', GLOB_NOSORT);
182
+        $moduleModelsDir = $this->config->application->modulesDir.$uniqid.'/Models';
183
+        $results         = glob($moduleModelsDir.'/*.php', GLOB_NOSORT);
184 184
         foreach ($results as $file) {
185 185
             $className        = pathinfo($file)['filename'];
186 186
             $moduleModelClass = "\\Modules\\{$uniqid}\\Models\\{$className}";
@@ -213,18 +213,18 @@  discard block
 block discarded – undo
213 213
                 }
214 214
             }
215 215
         }
216
-        if (!$error){
216
+        if (!$error) {
217 217
             $this->flash->clear();
218 218
         }
219 219
         $this->db->rollback('temporary'); // Откатываем временную транзакцию
220 220
 
221 221
         // Если ошибок нет, включаем Firewall и модуль
222
-        if ( ! $error && ! $this->enableFirewallSettings($uniqid)) {
222
+        if (!$error && !$this->enableFirewallSettings($uniqid)) {
223 223
             $this->flash->error('Error on enable firewall settings');
224 224
 
225 225
             return;
226 226
         }
227
-        if ( ! $error) {
227
+        if (!$error) {
228 228
             $module = PbxExtensionModules::findFirstByUniqid($uniqid);
229 229
             if ($module) {
230 230
                 $module->disabled = '0';
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
         $this->view->success = false;
253 253
 
254 254
         $controllerClass = "{$uniqid}Controller";
255
-        if ( ! class_exists($controllerClass)) {
255
+        if (!class_exists($controllerClass)) {
256 256
             $this->flash->error("Class {$controllerClass} doesn't exist");
257 257
 
258 258
             return;
@@ -268,8 +268,8 @@  discard block
 block discarded – undo
268 268
             $controller = new $controllerClass();
269 269
             if ($controller->disableAction() === false) {
270 270
                 $messages = $this->flash->getMessages();
271
-                if ($messages){
272
-                    foreach ($messages as $index=>$message){
271
+                if ($messages) {
272
+                    foreach ($messages as $index=>$message) {
273 273
                         $this->flash->$index($message[0]);
274 274
                     }
275 275
                 } else {
@@ -285,8 +285,8 @@  discard block
 block discarded – undo
285 285
         // Попытаемся удалить текущий модуль, если ошибок не будет, значит можно выклчать
286 286
         // Например на модуль может ссылаться запись в таблице Extensions, которую надо удалить при отключении
287 287
         // модуля
288
-        $moduleModelsDir = $this->config->application->modulesDir . $uniqid . '/Models';
289
-        $results         = glob($moduleModelsDir . '/*.php', GLOB_NOSORT);
288
+        $moduleModelsDir = $this->config->application->modulesDir.$uniqid.'/Models';
289
+        $results         = glob($moduleModelsDir.'/*.php', GLOB_NOSORT);
290 290
         foreach ($results as $file) {
291 291
             $className        = pathinfo($file)['filename'];
292 292
             $moduleModelClass = "\\Modules\\{$uniqid}\\Models\\{$className}";
@@ -314,12 +314,12 @@  discard block
 block discarded – undo
314 314
                             $parameters['bind']       = [];
315 315
                             foreach ($mappedFields as $index => $mappedField) {
316 316
                                 $parameters['conditions']             .= $index > 0 ? ' OR ' : '';
317
-                                $parameters['conditions']             .= $mappedField . '= :field' . $index . ':';
317
+                                $parameters['conditions']             .= $mappedField.'= :field'.$index.':';
318 318
                                 $bindField                            = $referencedFields[$index];
319
-                                $parameters['bind']['field' . $index] = $record->$bindField;
319
+                                $parameters['bind']['field'.$index] = $record->$bindField;
320 320
                             }
321 321
                             $relatedRecords = $relatedModel::find($parameters);
322
-                            if ( ! $error && ! $relatedRecords->delete()) {
322
+                            if (!$error && !$relatedRecords->delete()) {
323 323
                                 $error = true;
324 324
                                 $this->flash->error($relatedRecords->getMessages());
325 325
                             }
@@ -328,19 +328,19 @@  discard block
 block discarded – undo
328 328
                 }
329 329
             }
330 330
         }
331
-        if (!$error){
331
+        if (!$error) {
332 332
             $this->flash->clear();
333 333
         }
334 334
         $this->db->rollback('temporary'); // Откатываем временную транзакцию
335 335
 
336 336
         // Если ошибок нет, выключаем Firewall и модуль
337
-        if ( ! $error && ! $this->disableFirewallSettings($uniqid)) {
337
+        if (!$error && !$this->disableFirewallSettings($uniqid)) {
338 338
             $this->flash->error('Error on disable firewall settings');
339 339
 
340 340
             return;
341 341
         }
342 342
 
343
-        if ( ! $error) {
343
+        if (!$error) {
344 344
             $module = PbxExtensionModules::findFirstByUniqid($uniqid);
345 345
             if ($module) {
346 346
                 $module->disabled = '1';
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
     protected function enableFirewallSettings($uniqid): bool
369 369
     {
370 370
         $class = "\\Modules\\{$uniqid}\\setup\\FirewallRules";
371
-        if ( ! class_exists($class)) {
371
+        if (!class_exists($class)) {
372 372
             return true;
373 373
         }
374 374
         $this->db->begin();
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
                 if (array_key_exists($network->id, $previousRules)) {
403 403
                     $newRule->action = $previousRules[$network->id];
404 404
                 }
405
-                if ( ! $newRule->save()) {
405
+                if (!$newRule->save()) {
406 406
                     $errors[] = $newRule->getMessages();
407 407
                 }
408 408
             }
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
     protected function disableFirewallSettings($uniqid): bool
431 431
     {
432 432
         $class = "\\Modules\\{$uniqid}\\setup\\FirewallRules";
433
-        if ( ! class_exists($class)) {
433
+        if (!class_exists($class)) {
434 434
             return true;
435 435
         }
436 436
         $errors       = [];
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
             $savedState[$detailRule->networkfilterid] = $detailRule->action;
443 443
         }
444 444
         $this->db->begin();
445
-        if ( ! $currentRules->delete()) {
445
+        if (!$currentRules->delete()) {
446 446
             $errors[] = $currentRules->getMessages();
447 447
         }
448 448
 
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
             $previousRuleSettings->key = "{$uniqid}FirewallSettings";
453 453
         }
454 454
         $previousRuleSettings->value = json_encode($savedState);
455
-        if ( ! $previousRuleSettings->save()) {
455
+        if (!$previousRuleSettings->save()) {
456 456
             $errors[] = $previousRuleSettings->getMessages();
457 457
         }
458 458
         if (count($errors) > 0) {
Please login to merge, or discard this patch.
Upper-Lower-Casing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
      */
59 59
     public function modifyAction($uniqid): void
60 60
     {
61
-        $menuSettings               = "AdditionalMenuItem{$uniqid}";
61
+        $menuSettings               = "additionalmenuitem{$uniqid}";
62 62
         $unCamelizedControllerName  = Text::uncamelize($uniqid, '-');
63 63
         $previousMenuSettings       = PbxSettings::findFirstByKey($menuSettings);
64 64
         $this->view->showAtMainMenu = $previousMenuSettings !== false;
@@ -70,14 +70,14 @@  discard block
 block discarded – undo
70 70
                 'href'          => $this->url->get($unCamelizedControllerName),
71 71
                 'group'         => '',
72 72
                 'iconClass'     => 'puzzle piece',
73
-                'caption'       => "Breadcrumb$uniqid",
73
+                'caption'       => "breadcrumb$uniqid",
74 74
                 'showAtSidebar' => false,
75 75
             ];
76 76
             $previousMenuSettings->value = json_encode($value);
77 77
         }
78 78
         $options                = json_decode($previousMenuSettings->value, true);
79 79
         $this->view->form       = new PbxExtensionModuleSettingsForm($previousMenuSettings, $options);
80
-        $this->view->title      = $this->translation->_('ext_SettingsForModule') . ' ' . $this->translation->_("Breadcrumb$uniqid");
80
+        $this->view->title      = $this->translation->_('ext_SettingsForModule') . ' ' . $this->translation->_("breadcrumb$uniqid");
81 81
         $this->view->submitMode = null;
82 82
         $this->view->indexUrl   = $unCamelizedControllerName;
83 83
     }
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
                 }
142 142
             }
143 143
         } else {
144
-            $this->flash->error("Class {$setupClass} doesn't exist");
144
+            $this->flash->error("class {$setupClass} doesn't exist");
145 145
 
146 146
             return;
147 147
         }
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 
158 158
         // Если в контроллере есть функция корректного включения, вызовем ее,
159 159
         // например модуль умной маршртутизации прописывает себя в маршруты
160
-        $controllerClass = "{$uniqid}Controller";
160
+        $controllerClass = "{$uniqid}controller";
161 161
         if (class_exists($controllerClass)
162 162
             && method_exists($controllerClass, 'enableAction')) {
163 163
             $controller = new $controllerClass();
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
                 $module->disabled = '0';
231 231
                 if ($module->save() === true) {
232 232
                     $this->view->success = true;
233
-                    $controllerClass     = "{$uniqid}Controller";
233
+                    $controllerClass     = "{$uniqid}controller";
234 234
                     if (class_exists($controllerClass)
235 235
                         && method_exists($controllerClass, 'disableAction')) {
236 236
                         $controller = new $controllerClass();
@@ -251,9 +251,9 @@  discard block
 block discarded – undo
251 251
     {
252 252
         $this->view->success = false;
253 253
 
254
-        $controllerClass = "{$uniqid}Controller";
254
+        $controllerClass = "{$uniqid}controller";
255 255
         if ( ! class_exists($controllerClass)) {
256
-            $this->flash->error("Class {$controllerClass} doesn't exist");
256
+            $this->flash->error("class {$controllerClass} doesn't exist");
257 257
 
258 258
             return;
259 259
         }
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
                 $module->disabled = '1';
347 347
                 if ($module->save() === true) {
348 348
                     $this->view->success = true;
349
-                    $controllerClass     = "{$uniqid}Controller";
349
+                    $controllerClass     = "{$uniqid}controller";
350 350
                     if (class_exists($controllerClass)
351 351
                         && method_exists($controllerClass, 'disableAction')) {
352 352
                         $controller = new $controllerClass();
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
         }
374 374
         $this->db->begin();
375 375
         $defaultRules         = $class::getDefaultRules();
376
-        $previousRuleSettings = PbxSettings::findFirstByKey("{$uniqid}FirewallSettings");
376
+        $previousRuleSettings = PbxSettings::findFirstByKey("{$uniqid}firewallsettings");
377 377
         $previousRules        = [];
378 378
         if ($previousRuleSettings) {
379 379
             $previousRules = json_decode($previousRuleSettings->value, true);
@@ -446,10 +446,10 @@  discard block
 block discarded – undo
446 446
             $errors[] = $currentRules->getMessages();
447 447
         }
448 448
 
449
-        $previousRuleSettings = PbxSettings::findFirstByKey("{$uniqid}FirewallSettings");
449
+        $previousRuleSettings = PbxSettings::findFirstByKey("{$uniqid}firewallsettings");
450 450
         if ($previousRuleSettings === false) {
451 451
             $previousRuleSettings      = new PbxSettings();
452
-            $previousRuleSettings->key = "{$uniqid}FirewallSettings";
452
+            $previousRuleSettings->key = "{$uniqid}firewallsettings";
453 453
         }
454 454
         $previousRuleSettings->value = json_encode($savedState);
455 455
         if ( ! $previousRuleSettings->save()) {
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
         $result  = [];
476 476
         $modules = PbxExtensionModules::find('disabled="0"');
477 477
         foreach ($modules as $module) {
478
-            $menuSettings         = "AdditionalMenuItem{$module->uniqid}";
478
+            $menuSettings         = "additionalmenuitem{$module->uniqid}";
479 479
             $previousMenuSettings = PbxSettings::findFirstByKey($menuSettings);
480 480
             if ($previousMenuSettings) {
481 481
                 $result['items'][] = json_decode($previousMenuSettings->value, true);
Please login to merge, or discard this patch.
www/admin-cabinet/app/controllers/AsteriskManagersController.php 4 patches
Indentation   +135 added lines, -135 removed lines patch added patch discarded remove patch
@@ -8,143 +8,143 @@
 block discarded – undo
8 8
  */
9 9
 
10 10
 use Models\AsteriskManagerUsers,
11
-	Models\NetworkFilters;
11
+    Models\NetworkFilters;
12 12
 use Phalcon\Mvc\Model\Resultset;
13 13
 
14 14
 class AsteriskManagersController extends BaseController {
15 15
 
16
-	private $arrCheckBoxes;
17
-
18
-	/**
19
-	 * Инициализация базового класса
20
-	 */
21
-	public function initialize() :void{
22
-		$this->arrCheckBoxes = [
23
-			'call',
24
-			'cdr',
25
-			'originate',
26
-			'reporting',
27
-			'agent',
28
-			'config',
29
-			'dialplan',
30
-			'dtmf',
31
-			'log',
32
-			'system',
33
-			'user',
34
-			'verbose',
35
-		];
36
-		parent::initialize();
37
-	}
38
-
39
-	/**
40
-	 * Построение списка пользователей Asterisk Managers
41
-	 */
42
-	public function indexAction() {
43
-		$amiUsers = AsteriskManagerUsers::find();
44
-		$amiUsers->setHydrateMode(
45
-			Resultset::HYDRATE_ARRAYS
46
-		);
47
-
48
-		$arrNetworkFilters = [];
49
-		$networkFilters    = NetworkFilters::find();
50
-		foreach ( $networkFilters as $filter ) {
51
-			$arrNetworkFilters[ $filter->id ] = $filter->getRepresent();
52
-		}
53
-		$this->view->networkFilters = $arrNetworkFilters;
54
-		$this->view->amiUsers       = $amiUsers;
55
-	}
56
-
57
-
58
-	/**
59
-	 * Форма настроек пользователя Asterisk Managers
60
-	 *
61
-	 * @param string $id идентификатор редактируемого пользователя
62
-	 */
63
-	public function modifyAction( $id = NULL ) {
64
-
65
-		$manager = AsteriskManagerUsers::findFirstById( $id );
66
-		if ( ! $manager ) {
67
-			$manager = new AsteriskManagerUsers();
68
-		}
69
-
70
-		$arrNetworkFilters = [];
71
-		$networkFilters    = NetworkFilters::getAllowedFiltersForType( [
72
-			'AJAM',
73
-			'AMI',
74
-		] );
75
-		$arrNetworkFilters['none']
76
-		                   = $this->translation->_( 'ex_NoNetworkFilter' );
77
-		foreach ( $networkFilters as $filter ) {
78
-			$arrNetworkFilters[ $filter->id ] = $filter->getRepresent();
79
-		}
80
-
81
-
82
-		$this->view->form = new AsteriskManagerEditForm( $manager,
83
-			[
84
-				'network_filters'     => $arrNetworkFilters,
85
-				'array_of_checkboxes' => $this->arrCheckBoxes,
86
-			] );
87
-
88
-		$this->view->arrCheckBoxes = $this->arrCheckBoxes;
89
-		$this->view->represent     = $manager->getRepresent();
90
-	}
91
-
92
-
93
-	/**
94
-	 * Сохраенение настроек Asterisk Manager
95
-	 */
96
-	public function saveAction() {
97
-		if ( ! $this->request->isPost()) return;
98
-
99
-		$data    = $this->request->getPost();
100
-		$manager = false;
101
-		if (isset($data['id'])){
102
-			$manager = AsteriskManagerUsers::findFirst( $data['id'] );
103
-		}
104
-		if (!$manager) {
105
-			$manager = new AsteriskManagerUsers();
106
-		}
107
-
108
-		foreach ( $manager as $name => $value ) {
109
-			if ( in_array( $name, $this->arrCheckBoxes ) ) {
110
-				$manager->$name = '';
111
-				$manager->$name .= ( $data[ $name . '_read' ] === 'on' ) ? 'read' : '';
112
-				$manager->$name .= ( $data[ $name . '_write' ] === 'on' ) ? 'write' : '';
113
-				continue;
114
-			}
115
-
116
-			if ( ! array_key_exists( $name, $data ) ) {
117
-				continue;
118
-			}
119
-			$manager->$name = $data[ $name ];
120
-
121
-		}
122
-		$errors = FALSE;
123
-		if ( ! $manager->save() ) {
124
-			$errors = $manager->getMessages();
125
-		}
126
-
127
-		if ( $errors ) {
128
-			$this->flash->warning( implode( '<br>', $errors ) );
129
-			$this->view->success = false;
130
-		} else {
131
-			$this->flash->success( $this->translation->_( 'ms_SuccessfulSaved' ) );
132
-			$this->view->success = TRUE;
133
-			$this->view->reload = "asterisk-managers/modify/{$manager->id}";
134
-		}
135
-	}
136
-
137
-	/**
138
-	 * Удаление Asterisk Manager
139
-	 */
140
-	public function deleteAction( $amiId = NULL ) {
141
-
142
-		$manager = AsteriskManagerUsers::findFirstByid( $amiId );
143
-		if ( $manager ) {
144
-			$manager->delete();
145
-		}
146
-
147
-		return $this->forward( 'asterisk-managers/index' );
148
-
149
-	}
16
+    private $arrCheckBoxes;
17
+
18
+    /**
19
+     * Инициализация базового класса
20
+     */
21
+    public function initialize() :void{
22
+        $this->arrCheckBoxes = [
23
+            'call',
24
+            'cdr',
25
+            'originate',
26
+            'reporting',
27
+            'agent',
28
+            'config',
29
+            'dialplan',
30
+            'dtmf',
31
+            'log',
32
+            'system',
33
+            'user',
34
+            'verbose',
35
+        ];
36
+        parent::initialize();
37
+    }
38
+
39
+    /**
40
+     * Построение списка пользователей Asterisk Managers
41
+     */
42
+    public function indexAction() {
43
+        $amiUsers = AsteriskManagerUsers::find();
44
+        $amiUsers->setHydrateMode(
45
+            Resultset::HYDRATE_ARRAYS
46
+        );
47
+
48
+        $arrNetworkFilters = [];
49
+        $networkFilters    = NetworkFilters::find();
50
+        foreach ( $networkFilters as $filter ) {
51
+            $arrNetworkFilters[ $filter->id ] = $filter->getRepresent();
52
+        }
53
+        $this->view->networkFilters = $arrNetworkFilters;
54
+        $this->view->amiUsers       = $amiUsers;
55
+    }
56
+
57
+
58
+    /**
59
+     * Форма настроек пользователя Asterisk Managers
60
+     *
61
+     * @param string $id идентификатор редактируемого пользователя
62
+     */
63
+    public function modifyAction( $id = NULL ) {
64
+
65
+        $manager = AsteriskManagerUsers::findFirstById( $id );
66
+        if ( ! $manager ) {
67
+            $manager = new AsteriskManagerUsers();
68
+        }
69
+
70
+        $arrNetworkFilters = [];
71
+        $networkFilters    = NetworkFilters::getAllowedFiltersForType( [
72
+            'AJAM',
73
+            'AMI',
74
+        ] );
75
+        $arrNetworkFilters['none']
76
+                            = $this->translation->_( 'ex_NoNetworkFilter' );
77
+        foreach ( $networkFilters as $filter ) {
78
+            $arrNetworkFilters[ $filter->id ] = $filter->getRepresent();
79
+        }
80
+
81
+
82
+        $this->view->form = new AsteriskManagerEditForm( $manager,
83
+            [
84
+                'network_filters'     => $arrNetworkFilters,
85
+                'array_of_checkboxes' => $this->arrCheckBoxes,
86
+            ] );
87
+
88
+        $this->view->arrCheckBoxes = $this->arrCheckBoxes;
89
+        $this->view->represent     = $manager->getRepresent();
90
+    }
91
+
92
+
93
+    /**
94
+     * Сохраенение настроек Asterisk Manager
95
+     */
96
+    public function saveAction() {
97
+        if ( ! $this->request->isPost()) return;
98
+
99
+        $data    = $this->request->getPost();
100
+        $manager = false;
101
+        if (isset($data['id'])){
102
+            $manager = AsteriskManagerUsers::findFirst( $data['id'] );
103
+        }
104
+        if (!$manager) {
105
+            $manager = new AsteriskManagerUsers();
106
+        }
107
+
108
+        foreach ( $manager as $name => $value ) {
109
+            if ( in_array( $name, $this->arrCheckBoxes ) ) {
110
+                $manager->$name = '';
111
+                $manager->$name .= ( $data[ $name . '_read' ] === 'on' ) ? 'read' : '';
112
+                $manager->$name .= ( $data[ $name . '_write' ] === 'on' ) ? 'write' : '';
113
+                continue;
114
+            }
115
+
116
+            if ( ! array_key_exists( $name, $data ) ) {
117
+                continue;
118
+            }
119
+            $manager->$name = $data[ $name ];
120
+
121
+        }
122
+        $errors = FALSE;
123
+        if ( ! $manager->save() ) {
124
+            $errors = $manager->getMessages();
125
+        }
126
+
127
+        if ( $errors ) {
128
+            $this->flash->warning( implode( '<br>', $errors ) );
129
+            $this->view->success = false;
130
+        } else {
131
+            $this->flash->success( $this->translation->_( 'ms_SuccessfulSaved' ) );
132
+            $this->view->success = TRUE;
133
+            $this->view->reload = "asterisk-managers/modify/{$manager->id}";
134
+        }
135
+    }
136
+
137
+    /**
138
+     * Удаление Asterisk Manager
139
+     */
140
+    public function deleteAction( $amiId = NULL ) {
141
+
142
+        $manager = AsteriskManagerUsers::findFirstByid( $amiId );
143
+        if ( $manager ) {
144
+            $manager->delete();
145
+        }
146
+
147
+        return $this->forward( 'asterisk-managers/index' );
148
+
149
+    }
150 150
 }
151 151
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
 
48 48
 		$arrNetworkFilters = [];
49 49
 		$networkFilters    = NetworkFilters::find();
50
-		foreach ( $networkFilters as $filter ) {
51
-			$arrNetworkFilters[ $filter->id ] = $filter->getRepresent();
50
+		foreach ($networkFilters as $filter) {
51
+			$arrNetworkFilters[$filter->id] = $filter->getRepresent();
52 52
 		}
53 53
 		$this->view->networkFilters = $arrNetworkFilters;
54 54
 		$this->view->amiUsers       = $amiUsers;
@@ -60,30 +60,30 @@  discard block
 block discarded – undo
60 60
 	 *
61 61
 	 * @param string $id идентификатор редактируемого пользователя
62 62
 	 */
63
-	public function modifyAction( $id = NULL ) {
63
+	public function modifyAction($id = NULL) {
64 64
 
65
-		$manager = AsteriskManagerUsers::findFirstById( $id );
66
-		if ( ! $manager ) {
65
+		$manager = AsteriskManagerUsers::findFirstById($id);
66
+		if (!$manager) {
67 67
 			$manager = new AsteriskManagerUsers();
68 68
 		}
69 69
 
70 70
 		$arrNetworkFilters = [];
71
-		$networkFilters    = NetworkFilters::getAllowedFiltersForType( [
71
+		$networkFilters    = NetworkFilters::getAllowedFiltersForType([
72 72
 			'AJAM',
73 73
 			'AMI',
74
-		] );
74
+		]);
75 75
 		$arrNetworkFilters['none']
76
-		                   = $this->translation->_( 'ex_NoNetworkFilter' );
77
-		foreach ( $networkFilters as $filter ) {
78
-			$arrNetworkFilters[ $filter->id ] = $filter->getRepresent();
76
+		                   = $this->translation->_('ex_NoNetworkFilter');
77
+		foreach ($networkFilters as $filter) {
78
+			$arrNetworkFilters[$filter->id] = $filter->getRepresent();
79 79
 		}
80 80
 
81 81
 
82
-		$this->view->form = new AsteriskManagerEditForm( $manager,
82
+		$this->view->form = new AsteriskManagerEditForm($manager,
83 83
 			[
84 84
 				'network_filters'     => $arrNetworkFilters,
85 85
 				'array_of_checkboxes' => $this->arrCheckBoxes,
86
-			] );
86
+			]);
87 87
 
88 88
 		$this->view->arrCheckBoxes = $this->arrCheckBoxes;
89 89
 		$this->view->represent     = $manager->getRepresent();
@@ -94,41 +94,41 @@  discard block
 block discarded – undo
94 94
 	 * Сохраенение настроек Asterisk Manager
95 95
 	 */
96 96
 	public function saveAction() {
97
-		if ( ! $this->request->isPost()) return;
97
+		if (!$this->request->isPost()) return;
98 98
 
99 99
 		$data    = $this->request->getPost();
100 100
 		$manager = false;
101
-		if (isset($data['id'])){
102
-			$manager = AsteriskManagerUsers::findFirst( $data['id'] );
101
+		if (isset($data['id'])) {
102
+			$manager = AsteriskManagerUsers::findFirst($data['id']);
103 103
 		}
104 104
 		if (!$manager) {
105 105
 			$manager = new AsteriskManagerUsers();
106 106
 		}
107 107
 
108
-		foreach ( $manager as $name => $value ) {
109
-			if ( in_array( $name, $this->arrCheckBoxes ) ) {
108
+		foreach ($manager as $name => $value) {
109
+			if (in_array($name, $this->arrCheckBoxes)) {
110 110
 				$manager->$name = '';
111
-				$manager->$name .= ( $data[ $name . '_read' ] === 'on' ) ? 'read' : '';
112
-				$manager->$name .= ( $data[ $name . '_write' ] === 'on' ) ? 'write' : '';
111
+				$manager->$name .= ($data[$name.'_read'] === 'on') ? 'read' : '';
112
+				$manager->$name .= ($data[$name.'_write'] === 'on') ? 'write' : '';
113 113
 				continue;
114 114
 			}
115 115
 
116
-			if ( ! array_key_exists( $name, $data ) ) {
116
+			if (!array_key_exists($name, $data)) {
117 117
 				continue;
118 118
 			}
119
-			$manager->$name = $data[ $name ];
119
+			$manager->$name = $data[$name];
120 120
 
121 121
 		}
122 122
 		$errors = FALSE;
123
-		if ( ! $manager->save() ) {
123
+		if (!$manager->save()) {
124 124
 			$errors = $manager->getMessages();
125 125
 		}
126 126
 
127
-		if ( $errors ) {
128
-			$this->flash->warning( implode( '<br>', $errors ) );
127
+		if ($errors) {
128
+			$this->flash->warning(implode('<br>', $errors));
129 129
 			$this->view->success = false;
130 130
 		} else {
131
-			$this->flash->success( $this->translation->_( 'ms_SuccessfulSaved' ) );
131
+			$this->flash->success($this->translation->_('ms_SuccessfulSaved'));
132 132
 			$this->view->success = TRUE;
133 133
 			$this->view->reload = "asterisk-managers/modify/{$manager->id}";
134 134
 		}
@@ -137,14 +137,14 @@  discard block
 block discarded – undo
137 137
 	/**
138 138
 	 * Удаление Asterisk Manager
139 139
 	 */
140
-	public function deleteAction( $amiId = NULL ) {
140
+	public function deleteAction($amiId = NULL) {
141 141
 
142
-		$manager = AsteriskManagerUsers::findFirstByid( $amiId );
143
-		if ( $manager ) {
142
+		$manager = AsteriskManagerUsers::findFirstByid($amiId);
143
+		if ($manager) {
144 144
 			$manager->delete();
145 145
 		}
146 146
 
147
-		return $this->forward( 'asterisk-managers/index' );
147
+		return $this->forward('asterisk-managers/index');
148 148
 
149 149
 	}
150 150
 }
151 151
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +13 added lines, -6 removed lines patch added patch discarded remove patch
@@ -11,7 +11,8 @@  discard block
 block discarded – undo
11 11
 	Models\NetworkFilters;
12 12
 use Phalcon\Mvc\Model\Resultset;
13 13
 
14
-class AsteriskManagersController extends BaseController {
14
+class AsteriskManagersController extends BaseController
15
+{
15 16
 
16 17
 	private $arrCheckBoxes;
17 18
 
@@ -39,7 +40,8 @@  discard block
 block discarded – undo
39 40
 	/**
40 41
 	 * Построение списка пользователей Asterisk Managers
41 42
 	 */
42
-	public function indexAction() {
43
+	public function indexAction()
44
+	{
43 45
 		$amiUsers = AsteriskManagerUsers::find();
44 46
 		$amiUsers->setHydrateMode(
45 47
 			Resultset::HYDRATE_ARRAYS
@@ -60,7 +62,8 @@  discard block
 block discarded – undo
60 62
 	 *
61 63
 	 * @param string $id идентификатор редактируемого пользователя
62 64
 	 */
63
-	public function modifyAction( $id = NULL ) {
65
+	public function modifyAction( $id = NULL )
66
+	{
64 67
 
65 68
 		$manager = AsteriskManagerUsers::findFirstById( $id );
66 69
 		if ( ! $manager ) {
@@ -93,8 +96,11 @@  discard block
 block discarded – undo
93 96
 	/**
94 97
 	 * Сохраенение настроек Asterisk Manager
95 98
 	 */
96
-	public function saveAction() {
97
-		if ( ! $this->request->isPost()) return;
99
+	public function saveAction()
100
+	{
101
+		if ( ! $this->request->isPost()) {
102
+		    return;
103
+		}
98 104
 
99 105
 		$data    = $this->request->getPost();
100 106
 		$manager = false;
@@ -137,7 +143,8 @@  discard block
 block discarded – undo
137 143
 	/**
138 144
 	 * Удаление Asterisk Manager
139 145
 	 */
140
-	public function deleteAction( $amiId = NULL ) {
146
+	public function deleteAction( $amiId = NULL )
147
+	{
141 148
 
142 149
 		$manager = AsteriskManagerUsers::findFirstByid( $amiId );
143 150
 		if ( $manager ) {
Please login to merge, or discard this patch.
Upper-Lower-Casing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	 *
61 61
 	 * @param string $id идентификатор редактируемого пользователя
62 62
 	 */
63
-	public function modifyAction( $id = NULL ) {
63
+	public function modifyAction( $id = null ) {
64 64
 
65 65
 		$manager = AsteriskManagerUsers::findFirstById( $id );
66 66
 		if ( ! $manager ) {
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 			$manager->$name = $data[ $name ];
120 120
 
121 121
 		}
122
-		$errors = FALSE;
122
+		$errors = false;
123 123
 		if ( ! $manager->save() ) {
124 124
 			$errors = $manager->getMessages();
125 125
 		}
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 			$this->view->success = false;
130 130
 		} else {
131 131
 			$this->flash->success( $this->translation->_( 'ms_SuccessfulSaved' ) );
132
-			$this->view->success = TRUE;
132
+			$this->view->success = true;
133 133
 			$this->view->reload = "asterisk-managers/modify/{$manager->id}";
134 134
 		}
135 135
 	}
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	/**
138 138
 	 * Удаление Asterisk Manager
139 139
 	 */
140
-	public function deleteAction( $amiId = NULL ) {
140
+	public function deleteAction( $amiId = null ) {
141 141
 
142 142
 		$manager = AsteriskManagerUsers::findFirstByid( $amiId );
143 143
 		if ( $manager ) {
Please login to merge, or discard this patch.
www/admin-cabinet/app/controllers/IvrMenuController.php 4 patches
Indentation   +173 added lines, -173 removed lines patch added patch discarded remove patch
@@ -17,8 +17,8 @@  discard block
 block discarded – undo
17 17
 
18 18
 
19 19
     /**
20
-	 * Построение списка IVR меню
21
-	 */
20
+     * Построение списка IVR меню
21
+     */
22 22
     public function indexAction()
23 23
     {
24 24
         $this->view->ivrmenu =  IvrMenu::find();
@@ -26,24 +26,24 @@  discard block
 block discarded – undo
26 26
 
27 27
 
28 28
     /**
29
-	 * Карточка редактирования IVR меню
30
-	 *
31
-	 * @param null $ivrmenuid идентификатор меню
32
-	 */
33
-	public function modifyAction($ivrmenuid=null){
29
+     * Карточка редактирования IVR меню
30
+     *
31
+     * @param null $ivrmenuid идентификатор меню
32
+     */
33
+    public function modifyAction($ivrmenuid=null){
34 34
 
35 35
         $ivrmenu                = IvrMenu::findFirstByUniqid($ivrmenuid);
36 36
         $ivrActionsList         =[];
37
-		$soundfilesList[""]     = $this->translation->_( "sf_SelectAudioFile" );
38
-		$extensionList[""]      = $this->translation->_( "ex_SelectNumber" );
37
+        $soundfilesList[""]     = $this->translation->_( "sf_SelectAudioFile" );
38
+        $extensionList[""]      = $this->translation->_( "ex_SelectNumber" );
39 39
         $extensionListForFilter =[];
40 40
         if (!$ivrmenu) {
41 41
             $ivrmenu                   = new IvrMenu();
42 42
             $ivrmenu->uniqid           =   strtoupper('IVR-'.md5($ivrmenu->id.time()));
43
-	        $ivrmenu->number_of_repeat = 3;
44
-	        $ivrmenu->extension
45
-	                                   = Extensions::getNextFreeApplicationNumber();
46
-	        $ivrmenu->timeout		   = 7;
43
+            $ivrmenu->number_of_repeat = 3;
44
+            $ivrmenu->extension
45
+                                        = Extensions::getNextFreeApplicationNumber();
46
+            $ivrmenu->timeout		   = 7;
47 47
 
48 48
         } else {
49 49
             $extensionListForFilter[]= $ivrmenu->timeout_extension;
@@ -58,11 +58,11 @@  discard block
 block discarded – undo
58 58
             $actions=IvrMenuActions::find($parameters);
59 59
             foreach ($actions as $action){
60 60
                 $ivrActionsList[]=[
61
-	                'id'                 =>$action->id,
62
-	                'extension'          =>$action->extension,
63
-	                'extensionRepresent' => str_replace( '"', '\\"',
64
-		                $action->Extensions->getRepresent() ),
65
-	                'digits'             =>$action->digits
61
+                    'id'                 =>$action->id,
62
+                    'extension'          =>$action->extension,
63
+                    'extensionRepresent' => str_replace( '"', '\\"',
64
+                        $action->Extensions->getRepresent() ),
65
+                    'digits'             =>$action->digits
66 66
                 ];
67 67
                 $extensionListForFilter[]= $action->extension;
68 68
             }
@@ -83,9 +83,9 @@  discard block
 block discarded – undo
83 83
         }
84 84
 
85 85
         // Список звуковых файлов для IVR
86
-		$soundFiles = SoundFiles::find();
86
+        $soundFiles = SoundFiles::find();
87 87
         foreach ($soundFiles as $soundFile){
88
-	        $soundfilesList[ $soundFile->id ] = $soundFile->getRepresent();
88
+            $soundfilesList[ $soundFile->id ] = $soundFile->getRepresent();
89 89
         }
90 90
 
91 91
         $form = new IvrMenuEditForm($ivrmenu, [
@@ -94,14 +94,14 @@  discard block
 block discarded – undo
94 94
         ]);
95 95
         $this->view->form = $form;
96 96
         $this->view->ivractions=$ivrActionsList;
97
-	    $this->view->represent  = $ivrmenu->getRepresent();
97
+        $this->view->represent  = $ivrmenu->getRepresent();
98 98
 
99 99
     }
100 100
 
101 101
 
102 102
     /**
103
-	 * Сохранение ivr меню
104
-	 */
103
+     * Сохранение ivr меню
104
+     */
105 105
     public function saveAction()
106 106
     {
107 107
         if (!$this->request->isPost()) return;
@@ -122,43 +122,43 @@  discard block
 block discarded – undo
122 122
             $extension->public_access     = 1;
123 123
 
124 124
         } else {
125
-	        $extension = $ivrMenuRecord->Extensions;
125
+            $extension = $ivrMenuRecord->Extensions;
126 126
         }
127 127
 
128
-	    // Заполним параметры внутреннего номера
129
-	    if (!$this->updateExtension($extension, $data)){
130
-		    $this->view->success=false;
131
-		    $this->db->rollback();
132
-		    return;
133
-	    }
134
-
135
-	    // Заполним параметры IVR меню
136
-	    if (!$this->updateIVRMenu($ivrMenuRecord, $data)){
137
-		    $this->view->success=false;
138
-		    $this->db->rollback();
139
-		    return;
140
-	    }
141
-
142
-	    // Заполним параметры участников IVR Меню
143
-	    if (!$this->updateIVRMenuActions($data)){
144
-		    $this->view->success=false;
145
-		    $this->db->rollback();
146
-		    return;
147
-	    }
148
-
149
-	    $this->view->success=true;
150
-	    $this->db->commit();
151
-
152
-	    // Если это было создание карточки то надо перегрузить страницу с указанием ID
153
-	    if (empty($data['id'])){
154
-		    $this->view->reload = "ivr-menu/modify/{$data['uniqid']}";
155
-	    }
128
+        // Заполним параметры внутреннего номера
129
+        if (!$this->updateExtension($extension, $data)){
130
+            $this->view->success=false;
131
+            $this->db->rollback();
132
+            return;
133
+        }
134
+
135
+        // Заполним параметры IVR меню
136
+        if (!$this->updateIVRMenu($ivrMenuRecord, $data)){
137
+            $this->view->success=false;
138
+            $this->db->rollback();
139
+            return;
140
+        }
141
+
142
+        // Заполним параметры участников IVR Меню
143
+        if (!$this->updateIVRMenuActions($data)){
144
+            $this->view->success=false;
145
+            $this->db->rollback();
146
+            return;
147
+        }
148
+
149
+        $this->view->success=true;
150
+        $this->db->commit();
151
+
152
+        // Если это было создание карточки то надо перегрузить страницу с указанием ID
153
+        if (empty($data['id'])){
154
+            $this->view->reload = "ivr-menu/modify/{$data['uniqid']}";
155
+        }
156 156
     }
157 157
 
158
-	/**
159
-	 * Удаление ivr меню
160
-	 * @param null $uniqid
161
-	 */
158
+    /**
159
+     * Удаление ivr меню
160
+     * @param null $uniqid
161
+     */
162 162
     public function deleteAction($uniqid=null){
163 163
         $this->db->begin();
164 164
         $ivrmenu = IvrMenu::findFirstByUniqid($uniqid);
@@ -181,123 +181,123 @@  discard block
 block discarded – undo
181 181
     }
182 182
 
183 183
 
184
-	/**
185
-	 * Обновление параметров внутреннего номера
186
-	 * @param \Models\Extensions $extension
187
-	 * @param array $data массив полей из POST запроса
188
-	 * @return bool update result
189
-	 */
190
-	private function updateExtension(Extensions $extension, array $data){
191
-
192
-		$extension->number=$data['extension'];
193
-		$extension->callerid=parent::transliterate($data['name']);
194
-		if ($extension->save()=== false){
195
-			$errors = $extension->getMessages();
196
-			$this->flash->error(implode('<br>', $errors));
197
-			return false;
198
-		}
199
-
200
-		return TRUE;
201
-
202
-	}
203
-
204
-
205
-	/**
206
-	 * Обновление параметров IVR меню
207
-	 *
208
-	 * @param \Models\IvrMenu $ivrMenu
209
-	 * @param array           $data массив полей из POST запроса
210
-	 *
211
-	 * @return bool update result
212
-	 */
213
-	private function updateIVRMenu(IvrMenu $ivrMenu, array $data ) {
214
-
215
-		// Заполним параметры записи Ivr Menu
216
-		foreach ($ivrMenu as $name => $value) {
217
-			switch ($name) {
218
-				case "extension":
219
-					$ivrMenu->$name = $data[$name];
220
-					break;
221
-				case "name":
222
-					$ivrMenu->$name = $data[$name];
223
-					break;
224
-				case "allow_enter_any_internal_extension":
225
-					if (array_key_exists($name, $data) && $data[$name]=="on")
226
-						$ivrMenu->$name = "1";
227
-					else
228
-						$ivrMenu->$name = "0";
229
-					break;
230
-				default:
231
-					if (!array_key_exists($name, $data)) continue;
232
-					$ivrMenu->$name = $data[$name];
233
-			}
234
-		}
235
-		if ( $ivrMenu->save()=== false){
236
-			$errors = $ivrMenu->getMessages();
237
-			$this->flash->error(implode('<br>', $errors));
238
-			return false;
239
-		}
240
-
241
-		return TRUE;
242
-
243
-	}
244
-
245
-
246
-	/**
247
-	 * Обновление действий в IVR меню
248
-	 * @param array $data массив полей из POST запроса
249
-	 * @return bool update result
250
-	 */
251
-	private function updateIVRMenuActions(array $data){
252
-
253
-		$existDigits = [];
254
-
255
-		// Заполним параметры IvrMenuActions
256
-		$arrActions=json_decode($data['actions']);
257
-		foreach ($arrActions as $value) {
258
-
259
-			$parameters=[
260
-				'conditions'=>'ivr_menu_id = :uniqid: AND digits=:digits:',
261
-				'bind' =>[
262
-					'digits'=>$value->digits,
263
-					'uniqid'=> $data['uniqid']
264
-				]
265
-			];
266
-			$newRule = IvrMenuActions::findFirst($parameters);
267
-			if ($newRule==false){
268
-				$newRule = new IvrMenuActions();
269
-				$newRule->digits = $value->digits;
270
-				$newRule->ivr_menu_id = $data['uniqid'];
271
-			}
272
-			$newRule->extension = $value->extension;
273
-			if ($newRule->save() === false) {
274
-				$errors = $newRule->getMessages();
275
-				$this->flash->warning(implode('<br>', $errors));
276
-				$this->view->success = false;
277
-				return FALSE;
278
-			}
279
-			$existDigits[] = $value->digits;
280
-		}
281
-
282
-		// Удалим лишние элементы меню
283
-		$parameters = [
284
-			'conditions'=>'digits NOT IN ({numbers:array}) AND ivr_menu_id=:uniqid:',
285
-			'bind' =>[
286
-				'numbers'=>$existDigits,
287
-				'uniqid'=> $data['uniqid']
288
-			]
289
-		];
290
-
291
-		$deletedActions = IvrMenuActions::find($parameters);
292
-		if ($deletedActions && $deletedActions->delete()=== FALSE){
293
-			$errors = $deletedActions->getMessages();
294
-			$this->flash->error(implode('<br>', $errors));
295
-			return FALSE;
296
-		}
297
-
298
-		return TRUE;
299
-
300
-	}
184
+    /**
185
+     * Обновление параметров внутреннего номера
186
+     * @param \Models\Extensions $extension
187
+     * @param array $data массив полей из POST запроса
188
+     * @return bool update result
189
+     */
190
+    private function updateExtension(Extensions $extension, array $data){
191
+
192
+        $extension->number=$data['extension'];
193
+        $extension->callerid=parent::transliterate($data['name']);
194
+        if ($extension->save()=== false){
195
+            $errors = $extension->getMessages();
196
+            $this->flash->error(implode('<br>', $errors));
197
+            return false;
198
+        }
199
+
200
+        return TRUE;
201
+
202
+    }
203
+
204
+
205
+    /**
206
+     * Обновление параметров IVR меню
207
+     *
208
+     * @param \Models\IvrMenu $ivrMenu
209
+     * @param array           $data массив полей из POST запроса
210
+     *
211
+     * @return bool update result
212
+     */
213
+    private function updateIVRMenu(IvrMenu $ivrMenu, array $data ) {
214
+
215
+        // Заполним параметры записи Ivr Menu
216
+        foreach ($ivrMenu as $name => $value) {
217
+            switch ($name) {
218
+                case "extension":
219
+                    $ivrMenu->$name = $data[$name];
220
+                    break;
221
+                case "name":
222
+                    $ivrMenu->$name = $data[$name];
223
+                    break;
224
+                case "allow_enter_any_internal_extension":
225
+                    if (array_key_exists($name, $data) && $data[$name]=="on")
226
+                        $ivrMenu->$name = "1";
227
+                    else
228
+                        $ivrMenu->$name = "0";
229
+                    break;
230
+                default:
231
+                    if (!array_key_exists($name, $data)) continue;
232
+                    $ivrMenu->$name = $data[$name];
233
+            }
234
+        }
235
+        if ( $ivrMenu->save()=== false){
236
+            $errors = $ivrMenu->getMessages();
237
+            $this->flash->error(implode('<br>', $errors));
238
+            return false;
239
+        }
240
+
241
+        return TRUE;
242
+
243
+    }
244
+
245
+
246
+    /**
247
+     * Обновление действий в IVR меню
248
+     * @param array $data массив полей из POST запроса
249
+     * @return bool update result
250
+     */
251
+    private function updateIVRMenuActions(array $data){
252
+
253
+        $existDigits = [];
254
+
255
+        // Заполним параметры IvrMenuActions
256
+        $arrActions=json_decode($data['actions']);
257
+        foreach ($arrActions as $value) {
258
+
259
+            $parameters=[
260
+                'conditions'=>'ivr_menu_id = :uniqid: AND digits=:digits:',
261
+                'bind' =>[
262
+                    'digits'=>$value->digits,
263
+                    'uniqid'=> $data['uniqid']
264
+                ]
265
+            ];
266
+            $newRule = IvrMenuActions::findFirst($parameters);
267
+            if ($newRule==false){
268
+                $newRule = new IvrMenuActions();
269
+                $newRule->digits = $value->digits;
270
+                $newRule->ivr_menu_id = $data['uniqid'];
271
+            }
272
+            $newRule->extension = $value->extension;
273
+            if ($newRule->save() === false) {
274
+                $errors = $newRule->getMessages();
275
+                $this->flash->warning(implode('<br>', $errors));
276
+                $this->view->success = false;
277
+                return FALSE;
278
+            }
279
+            $existDigits[] = $value->digits;
280
+        }
281
+
282
+        // Удалим лишние элементы меню
283
+        $parameters = [
284
+            'conditions'=>'digits NOT IN ({numbers:array}) AND ivr_menu_id=:uniqid:',
285
+            'bind' =>[
286
+                'numbers'=>$existDigits,
287
+                'uniqid'=> $data['uniqid']
288
+            ]
289
+        ];
290
+
291
+        $deletedActions = IvrMenuActions::find($parameters);
292
+        if ($deletedActions && $deletedActions->delete()=== FALSE){
293
+            $errors = $deletedActions->getMessages();
294
+            $this->flash->error(implode('<br>', $errors));
295
+            return FALSE;
296
+        }
297
+
298
+        return TRUE;
299
+
300
+    }
301 301
 
302 302
 
303 303
 }
304 304
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	 */
22 22
     public function indexAction()
23 23
     {
24
-        $this->view->ivrmenu =  IvrMenu::find();
24
+        $this->view->ivrmenu = IvrMenu::find();
25 25
     }
26 26
 
27 27
 
@@ -30,62 +30,62 @@  discard block
 block discarded – undo
30 30
 	 *
31 31
 	 * @param null $ivrmenuid идентификатор меню
32 32
 	 */
33
-	public function modifyAction($ivrmenuid=null){
33
+	public function modifyAction($ivrmenuid = null) {
34 34
 
35 35
         $ivrmenu                = IvrMenu::findFirstByUniqid($ivrmenuid);
36
-        $ivrActionsList         =[];
37
-		$soundfilesList[""]     = $this->translation->_( "sf_SelectAudioFile" );
38
-		$extensionList[""]      = $this->translation->_( "ex_SelectNumber" );
39
-        $extensionListForFilter =[];
36
+        $ivrActionsList         = [];
37
+		$soundfilesList[""]     = $this->translation->_("sf_SelectAudioFile");
38
+		$extensionList[""]      = $this->translation->_("ex_SelectNumber");
39
+        $extensionListForFilter = [];
40 40
         if (!$ivrmenu) {
41 41
             $ivrmenu                   = new IvrMenu();
42
-            $ivrmenu->uniqid           =   strtoupper('IVR-'.md5($ivrmenu->id.time()));
42
+            $ivrmenu->uniqid           = strtoupper('IVR-'.md5($ivrmenu->id.time()));
43 43
 	        $ivrmenu->number_of_repeat = 3;
44 44
 	        $ivrmenu->extension
45 45
 	                                   = Extensions::getNextFreeApplicationNumber();
46
-	        $ivrmenu->timeout		   = 7;
46
+	        $ivrmenu->timeout = 7;
47 47
 
48 48
         } else {
49
-            $extensionListForFilter[]= $ivrmenu->timeout_extension;
49
+            $extensionListForFilter[] = $ivrmenu->timeout_extension;
50 50
             // Списк экстеншенов очереди
51
-            $parameters =[
51
+            $parameters = [
52 52
                 'order'=>'digits',
53 53
                 'conditions'=>'ivr_menu_id=:menu:',
54 54
                 'bind'=>[
55 55
                     'menu'=>$ivrmenu->uniqid
56 56
                 ]
57 57
             ];
58
-            $actions=IvrMenuActions::find($parameters);
59
-            foreach ($actions as $action){
60
-                $ivrActionsList[]=[
58
+            $actions = IvrMenuActions::find($parameters);
59
+            foreach ($actions as $action) {
60
+                $ivrActionsList[] = [
61 61
 	                'id'                 =>$action->id,
62 62
 	                'extension'          =>$action->extension,
63
-	                'extensionRepresent' => str_replace( '"', '\\"',
64
-		                $action->Extensions->getRepresent() ),
63
+	                'extensionRepresent' => str_replace('"', '\\"',
64
+		                $action->Extensions->getRepresent()),
65 65
 	                'digits'             =>$action->digits
66 66
                 ];
67
-                $extensionListForFilter[]= $action->extension;
67
+                $extensionListForFilter[] = $action->extension;
68 68
             }
69 69
         }
70 70
 
71 71
         // Список всех эктеншенов выбранных ранее для правил адресации
72
-        if (count($extensionListForFilter)>0){
73
-        $parameters =[
72
+        if (count($extensionListForFilter) > 0) {
73
+        $parameters = [
74 74
             'conditions'=>'number IN ({ids:array})',
75 75
             'bind'=>[
76 76
                 'ids'=>$extensionListForFilter
77 77
             ]
78 78
         ];
79 79
         $extensions = Extensions::find($parameters);
80
-        foreach ($extensions as $record){
81
-            $extensionList[$record->number]=$record->getRepresent();
80
+        foreach ($extensions as $record) {
81
+            $extensionList[$record->number] = $record->getRepresent();
82 82
         }
83 83
         }
84 84
 
85 85
         // Список звуковых файлов для IVR
86 86
 		$soundFiles = SoundFiles::find();
87
-        foreach ($soundFiles as $soundFile){
88
-	        $soundfilesList[ $soundFile->id ] = $soundFile->getRepresent();
87
+        foreach ($soundFiles as $soundFile) {
88
+	        $soundfilesList[$soundFile->id] = $soundFile->getRepresent();
89 89
         }
90 90
 
91 91
         $form = new IvrMenuEditForm($ivrmenu, [
@@ -93,8 +93,8 @@  discard block
 block discarded – undo
93 93
             'soundfiles'=>$soundfilesList
94 94
         ]);
95 95
         $this->view->form = $form;
96
-        $this->view->ivractions=$ivrActionsList;
97
-	    $this->view->represent  = $ivrmenu->getRepresent();
96
+        $this->view->ivractions = $ivrActionsList;
97
+	    $this->view->represent = $ivrmenu->getRepresent();
98 98
 
99 99
     }
100 100
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 
111 111
         $data = $this->request->getPost();
112 112
         $ivrMenuRecord = IvrMenu::findFirstByUniqid($data['uniqid']);
113
-        if ($ivrMenuRecord==false) {
113
+        if ($ivrMenuRecord == false) {
114 114
             $ivrMenuRecord = new IvrMenu();
115 115
 
116 116
             $extension = new Extensions();
@@ -118,39 +118,39 @@  discard block
 block discarded – undo
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
 
124 124
         } else {
125 125
 	        $extension = $ivrMenuRecord->Extensions;
126 126
         }
127 127
 
128 128
 	    // Заполним параметры внутреннего номера
129
-	    if (!$this->updateExtension($extension, $data)){
130
-		    $this->view->success=false;
129
+	    if (!$this->updateExtension($extension, $data)) {
130
+		    $this->view->success = false;
131 131
 		    $this->db->rollback();
132 132
 		    return;
133 133
 	    }
134 134
 
135 135
 	    // Заполним параметры IVR меню
136
-	    if (!$this->updateIVRMenu($ivrMenuRecord, $data)){
137
-		    $this->view->success=false;
136
+	    if (!$this->updateIVRMenu($ivrMenuRecord, $data)) {
137
+		    $this->view->success = false;
138 138
 		    $this->db->rollback();
139 139
 		    return;
140 140
 	    }
141 141
 
142 142
 	    // Заполним параметры участников IVR Меню
143
-	    if (!$this->updateIVRMenuActions($data)){
144
-		    $this->view->success=false;
143
+	    if (!$this->updateIVRMenuActions($data)) {
144
+		    $this->view->success = false;
145 145
 		    $this->db->rollback();
146 146
 		    return;
147 147
 	    }
148 148
 
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 = "ivr-menu/modify/{$data['uniqid']}";
155 155
 	    }
156 156
     }
@@ -159,15 +159,15 @@  discard block
 block discarded – undo
159 159
 	 * Удаление ivr меню
160 160
 	 * @param null $uniqid
161 161
 	 */
162
-    public function deleteAction($uniqid=null){
162
+    public function deleteAction($uniqid = null) {
163 163
         $this->db->begin();
164 164
         $ivrmenu = IvrMenu::findFirstByUniqid($uniqid);
165 165
 
166 166
         $errors = false;
167
-        if($ivrmenu && !$ivrmenu->Extensions->delete())
167
+        if ($ivrmenu && !$ivrmenu->Extensions->delete())
168 168
             $errors = $ivrmenu->Extensions->getMessages();
169 169
 
170
-        if ($errors){
170
+        if ($errors) {
171 171
             $this->flash->warning(implode('<br>', $errors));
172 172
             $this->db->rollback();
173 173
         }
@@ -187,11 +187,11 @@  discard block
 block discarded – undo
187 187
 	 * @param array $data массив полей из POST запроса
188 188
 	 * @return bool update result
189 189
 	 */
190
-	private function updateExtension(Extensions $extension, array $data){
190
+	private function updateExtension(Extensions $extension, array $data) {
191 191
 
192
-		$extension->number=$data['extension'];
193
-		$extension->callerid=parent::transliterate($data['name']);
194
-		if ($extension->save()=== false){
192
+		$extension->number = $data['extension'];
193
+		$extension->callerid = parent::transliterate($data['name']);
194
+		if ($extension->save() === false) {
195 195
 			$errors = $extension->getMessages();
196 196
 			$this->flash->error(implode('<br>', $errors));
197 197
 			return false;
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 	 *
211 211
 	 * @return bool update result
212 212
 	 */
213
-	private function updateIVRMenu(IvrMenu $ivrMenu, array $data ) {
213
+	private function updateIVRMenu(IvrMenu $ivrMenu, array $data) {
214 214
 
215 215
 		// Заполним параметры записи Ivr Menu
216 216
 		foreach ($ivrMenu as $name => $value) {
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 					$ivrMenu->$name = $data[$name];
223 223
 					break;
224 224
 				case "allow_enter_any_internal_extension":
225
-					if (array_key_exists($name, $data) && $data[$name]=="on")
225
+					if (array_key_exists($name, $data) && $data[$name] == "on")
226 226
 						$ivrMenu->$name = "1";
227 227
 					else
228 228
 						$ivrMenu->$name = "0";
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 					$ivrMenu->$name = $data[$name];
233 233
 			}
234 234
 		}
235
-		if ( $ivrMenu->save()=== false){
235
+		if ($ivrMenu->save() === false) {
236 236
 			$errors = $ivrMenu->getMessages();
237 237
 			$this->flash->error(implode('<br>', $errors));
238 238
 			return false;
@@ -248,15 +248,15 @@  discard block
 block discarded – undo
248 248
 	 * @param array $data массив полей из POST запроса
249 249
 	 * @return bool update result
250 250
 	 */
251
-	private function updateIVRMenuActions(array $data){
251
+	private function updateIVRMenuActions(array $data) {
252 252
 
253 253
 		$existDigits = [];
254 254
 
255 255
 		// Заполним параметры IvrMenuActions
256
-		$arrActions=json_decode($data['actions']);
256
+		$arrActions = json_decode($data['actions']);
257 257
 		foreach ($arrActions as $value) {
258 258
 
259
-			$parameters=[
259
+			$parameters = [
260 260
 				'conditions'=>'ivr_menu_id = :uniqid: AND digits=:digits:',
261 261
 				'bind' =>[
262 262
 					'digits'=>$value->digits,
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 				]
265 265
 			];
266 266
 			$newRule = IvrMenuActions::findFirst($parameters);
267
-			if ($newRule==false){
267
+			if ($newRule == false) {
268 268
 				$newRule = new IvrMenuActions();
269 269
 				$newRule->digits = $value->digits;
270 270
 				$newRule->ivr_menu_id = $data['uniqid'];
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 		];
290 290
 
291 291
 		$deletedActions = IvrMenuActions::find($parameters);
292
-		if ($deletedActions && $deletedActions->delete()=== FALSE){
292
+		if ($deletedActions && $deletedActions->delete() === FALSE) {
293 293
 			$errors = $deletedActions->getMessages();
294 294
 			$this->flash->error(implode('<br>', $errors));
295 295
 			return FALSE;
Please login to merge, or discard this patch.
Braces   +27 added lines, -17 removed lines patch added patch discarded remove patch
@@ -13,7 +13,8 @@  discard block
 block discarded – undo
13 13
     Models\IvrMenuActions;
14 14
 
15 15
 
16
-class IvrMenuController extends BaseController {
16
+class IvrMenuController extends BaseController
17
+{
17 18
 
18 19
 
19 20
     /**
@@ -30,7 +31,8 @@  discard block
 block discarded – undo
30 31
 	 *
31 32
 	 * @param null $ivrmenuid идентификатор меню
32 33
 	 */
33
-	public function modifyAction($ivrmenuid=null){
34
+	public function modifyAction($ivrmenuid=null)
35
+	{
34 36
 
35 37
         $ivrmenu                = IvrMenu::findFirstByUniqid($ivrmenuid);
36 38
         $ivrActionsList         =[];
@@ -104,7 +106,9 @@  discard block
 block discarded – undo
104 106
 	 */
105 107
     public function saveAction()
106 108
     {
107
-        if (!$this->request->isPost()) return;
109
+        if (!$this->request->isPost()) {
110
+            return;
111
+        }
108 112
 
109 113
         $this->db->begin();
110 114
 
@@ -159,20 +163,20 @@  discard block
 block discarded – undo
159 163
 	 * Удаление ivr меню
160 164
 	 * @param null $uniqid
161 165
 	 */
162
-    public function deleteAction($uniqid=null){
166
+    public function deleteAction($uniqid=null)
167
+    {
163 168
         $this->db->begin();
164 169
         $ivrmenu = IvrMenu::findFirstByUniqid($uniqid);
165 170
 
166 171
         $errors = false;
167
-        if($ivrmenu && !$ivrmenu->Extensions->delete())
168
-            $errors = $ivrmenu->Extensions->getMessages();
172
+        if($ivrmenu && !$ivrmenu->Extensions->delete()) {
173
+                    $errors = $ivrmenu->Extensions->getMessages();
174
+        }
169 175
 
170 176
         if ($errors){
171 177
             $this->flash->warning(implode('<br>', $errors));
172 178
             $this->db->rollback();
173
-        }
174
-
175
-        else
179
+        } else
176 180
         {
177 181
             $this->db->commit();
178 182
         }
@@ -187,7 +191,8 @@  discard block
 block discarded – undo
187 191
 	 * @param array $data массив полей из POST запроса
188 192
 	 * @return bool update result
189 193
 	 */
190
-	private function updateExtension(Extensions $extension, array $data){
194
+	private function updateExtension(Extensions $extension, array $data)
195
+	{
191 196
 
192 197
 		$extension->number=$data['extension'];
193 198
 		$extension->callerid=parent::transliterate($data['name']);
@@ -210,7 +215,8 @@  discard block
 block discarded – undo
210 215
 	 *
211 216
 	 * @return bool update result
212 217
 	 */
213
-	private function updateIVRMenu(IvrMenu $ivrMenu, array $data ) {
218
+	private function updateIVRMenu(IvrMenu $ivrMenu, array $data )
219
+	{
214 220
 
215 221
 		// Заполним параметры записи Ivr Menu
216 222
 		foreach ($ivrMenu as $name => $value) {
@@ -222,13 +228,16 @@  discard block
 block discarded – undo
222 228
 					$ivrMenu->$name = $data[$name];
223 229
 					break;
224 230
 				case "allow_enter_any_internal_extension":
225
-					if (array_key_exists($name, $data) && $data[$name]=="on")
226
-						$ivrMenu->$name = "1";
227
-					else
228
-						$ivrMenu->$name = "0";
231
+					if (array_key_exists($name, $data) && $data[$name]=="on") {
232
+											$ivrMenu->$name = "1";
233
+					} else {
234
+											$ivrMenu->$name = "0";
235
+					}
229 236
 					break;
230 237
 				default:
231
-					if (!array_key_exists($name, $data)) continue;
238
+					if (!array_key_exists($name, $data)) {
239
+					    continue;
240
+					}
232 241
 					$ivrMenu->$name = $data[$name];
233 242
 			}
234 243
 		}
@@ -248,7 +257,8 @@  discard block
 block discarded – undo
248 257
 	 * @param array $data массив полей из POST запроса
249 258
 	 * @return bool update result
250 259
 	 */
251
-	private function updateIVRMenuActions(array $data){
260
+	private function updateIVRMenuActions(array $data)
261
+	{
252 262
 
253 263
 		$existDigits = [];
254 264
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 			return false;
198 198
 		}
199 199
 
200
-		return TRUE;
200
+		return true;
201 201
 
202 202
 	}
203 203
 
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 			return false;
239 239
 		}
240 240
 
241
-		return TRUE;
241
+		return true;
242 242
 
243 243
 	}
244 244
 
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 				$errors = $newRule->getMessages();
275 275
 				$this->flash->warning(implode('<br>', $errors));
276 276
 				$this->view->success = false;
277
-				return FALSE;
277
+				return false;
278 278
 			}
279 279
 			$existDigits[] = $value->digits;
280 280
 		}
@@ -289,13 +289,13 @@  discard block
 block discarded – undo
289 289
 		];
290 290
 
291 291
 		$deletedActions = IvrMenuActions::find($parameters);
292
-		if ($deletedActions && $deletedActions->delete()=== FALSE){
292
+		if ($deletedActions && $deletedActions->delete()=== false){
293 293
 			$errors = $deletedActions->getMessages();
294 294
 			$this->flash->error(implode('<br>', $errors));
295
-			return FALSE;
295
+			return false;
296 296
 		}
297 297
 
298
-		return TRUE;
298
+		return true;
299 299
 
300 300
 	}
301 301
 
Please login to merge, or discard this patch.
www/admin-cabinet/app/controllers/NetworkController.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
         $arrEth['new'] = $template;
32 32
 
33 33
         $internetInterface = LanInterfaces::findFirstByInternet(1);
34
-        if ( ! $internetInterface) {
34
+        if (!$internetInterface) {
35 35
             $internetInterface = new LanInterfaces();
36 36
         }
37 37
         // Найдем дополнительные интерфейсы, которые можно удалить
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
      */
55 55
     public function saveAction(): void
56 56
     {
57
-        if ( ! $this->request->isPost()) {
57
+        if (!$this->request->isPost()) {
58 58
             return;
59 59
         }
60 60
 
@@ -120,9 +120,9 @@  discard block
 block discarded – undo
120 120
                 case 'extipaddr':
121 121
                     if ($itIsInternetInterfce) {
122 122
                         if (array_key_exists($name, $data)) {
123
-                            $eth->$name = ($data['usenat'] == 'on') ? $data[$name] : $data['ipaddr_' . $eth->id];
123
+                            $eth->$name = ($data['usenat'] == 'on') ? $data[$name] : $data['ipaddr_'.$eth->id];
124 124
                         } else {
125
-                            $eth->$name = $data['ipaddr_' . $eth->id];
125
+                            $eth->$name = $data['ipaddr_'.$eth->id];
126 126
                         }
127 127
                     } else {
128 128
                         $eth->$name = '';
@@ -141,8 +141,8 @@  discard block
 block discarded – undo
141 141
                     }
142 142
                     break;
143 143
                 case 'dhcp':
144
-                    if (array_key_exists($name . '_' . $eth->id, $data)) {
145
-                        $eth->$name = ($data['dhcp_' . $eth->id]) == 'on' ? "1" : "0";
144
+                    if (array_key_exists($name.'_'.$eth->id, $data)) {
145
+                        $eth->$name = ($data['dhcp_'.$eth->id]) == 'on' ? "1" : "0";
146 146
                     }
147 147
                     break;
148 148
                 case 'internet':
@@ -151,13 +151,13 @@  discard block
 block discarded – undo
151 151
                 case 'ipaddr':
152 152
                 case 'subnet':
153 153
                     $eth->$name = '';
154
-                    if (array_key_exists($name . '_' . $eth->id, $data)) {
155
-                        $eth->$name = ($data['dhcp_' . $eth->id]) == 'on' ? '' : $data[$name . '_' . $eth->id];
154
+                    if (array_key_exists($name.'_'.$eth->id, $data)) {
155
+                        $eth->$name = ($data['dhcp_'.$eth->id]) == 'on' ? '' : $data[$name.'_'.$eth->id];
156 156
                     }
157 157
                     break;
158 158
                 case 'interface':
159 159
                     if ($eth->id == 'new') {
160
-                        $eth->$name = LanInterfaces::findFirstById($data[$name . '_' . $eth->id])->interface;
160
+                        $eth->$name = LanInterfaces::findFirstById($data[$name.'_'.$eth->id])->interface;
161 161
                     }
162 162
                     break;
163 163
                 case 'domain':
@@ -172,8 +172,8 @@  discard block
 block discarded – undo
172 172
                     }
173 173
                     break;
174 174
                 default:
175
-                    if (array_key_exists($name . '_' . $eth->id, $data)) {
176
-                        $eth->$name = $data[$name . '_' . $eth->id];
175
+                    if (array_key_exists($name.'_'.$eth->id, $data)) {
176
+                        $eth->$name = $data[$name.'_'.$eth->id];
177 177
                     }
178 178
 
179 179
             }
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
     public function deleteAction($ethId = '')
189 189
     {
190 190
         $eth = LanInterfaces::findFirstById($ethId);
191
-        if ( ! $eth || $eth->delete() === false) {
191
+        if (!$eth || $eth->delete() === false) {
192 192
             $errors = $eth->getMessages();
193 193
             $this->flash->warning(implode('<br>', $errors));
194 194
             $this->view->success = false;
Please login to merge, or discard this patch.