1818class CallOnLineController extends Controller
1919{
2020 public $ attributeOrder = 't.duration DESC, status ASC ' ;
21- public $ extraValues = array ( 'idUser ' => 'username,credit ' ) ;
21+ public $ extraValues = [ 'idUser ' => 'username,credit ' ] ;
2222
23- public $ fieldsInvisibleClient = array (
23+ public $ fieldsInvisibleClient = [
2424 'tronco ' ,
25- ) ;
25+ ] ;
2626
27- public $ fieldsInvisibleAgent = array (
27+ public $ fieldsInvisibleAgent = [
2828 'tronco ' ,
29- ) ;
29+ ] ;
3030
3131 public function init ()
3232 {
@@ -73,9 +73,9 @@ public function actionGetChannelDetails()
7373
7474 if (preg_match ('/^MC\!/ ' , $ channel ['accountcode ' ])) {
7575
76- $ modelPhonenumber = PhoneNumber::model ()->find ('number = :key ' , array ( ':key ' => $ channel ['Caller ID ' ]) );
76+ $ modelPhonenumber = PhoneNumber::model ()->find ('number = :key ' , [ ':key ' => $ channel ['Caller ID ' ]] );
7777
78- echo json_encode (array (
78+ echo json_encode ([
7979 'success ' => true ,
8080 'msg ' => 'success ' ,
8181 'description ' => Yii::app ()->session ['isAdmin ' ] ? print_r ($ channel , true ) : '' ,
@@ -85,10 +85,10 @@ public function actionGetChannelDetails()
8585 'from_ip ' => $ from_ip ,
8686 'reinvite ' => preg_match ("/local/ " , $ reinvite ) ? 'no ' : 'yes ' ,
8787 'ndiscado ' => $ channel ['Caller ID ' ],
88- ) );
88+ ] );
8989
9090 } else {
91- echo json_encode (array (
91+ echo json_encode ([
9292 'success ' => true ,
9393 'msg ' => 'success ' ,
9494 'description ' => Yii::app ()->session ['isAdmin ' ] ? print_r ($ channel , true ) : '' ,
@@ -98,13 +98,13 @@ public function actionGetChannelDetails()
9898 'from_ip ' => $ from_ip ,
9999 'reinvite ' => preg_match ("/local/ " , $ reinvite ) ? 'no ' : 'yes ' ,
100100 'ndiscado ' => $ channel ['dnid ' ],
101- ) );
101+ ] );
102102 }
103103 }
104104
105105 public function actionDestroy ()
106106 {
107- if (! AccessManager::getInstance ($ this ->instanceModel ->getModule ())->canDelete ()) {
107+ if ( ! AccessManager::getInstance ($ this ->instanceModel ->getModule ())->canDelete ()) {
108108 header ('HTTP/1.0 401 Unauthorized ' );
109109 die ("Access denied to delete in module: " . $ this ->instanceModel ->getModule ());
110110 }
@@ -113,27 +113,27 @@ public function actionDestroy()
113113 $ values = $ this ->getAttributesRequest ();
114114 $ namePk = $ this ->abstractModel ->primaryKey ();
115115 $ arrayPkAlias = explode ('. ' , $ this ->abstractModel ->primaryKey ());
116- $ ids = array () ;
116+ $ ids = [] ;
117117
118118 foreach ($ values as $ key => $ channel ) {
119119
120- $ modelChannel = $ this ->abstractModel ->find ('canal = :key ' , array ( ':key ' => $ channel ['channel ' ]) );
120+ $ modelChannel = $ this ->abstractModel ->find ('canal = :key ' , [ ':key ' => $ channel ['channel ' ]] );
121121 if (isset ($ modelChannel ->canal )) {
122122 AsteriskAccess::instance ()->hangupRequest ($ modelChannel ->canal , $ modelChannel ->server );
123123 }
124124 }
125125
126126 # retorna o resultado da execucao
127- echo json_encode (array (
127+ echo json_encode ([
128128 $ this ->nameSuccess => true ,
129129 $ this ->nameMsg => $ this ->success ,
130- ) );
130+ ] );
131131
132132 }
133133
134134 public function actionSpyCall ()
135135 {
136- if (! isset ($ _POST ['id_sip ' ])) {
136+ if ( ! isset ($ _POST ['id_sip ' ])) {
137137 $ dialstr = 'SIP/ ' . $ this ->config ['global ' ]['channel_spy ' ];
138138 } else {
139139 $ modelSip = Sip::model ()->findByPk ((int ) $ _POST ['id_sip ' ]);
@@ -153,10 +153,10 @@ public function actionSpyCall()
153153
154154 AsteriskAccess::generateCallFile ($ call );
155155
156- echo json_encode (array (
156+ echo json_encode ([
157157 'success ' => true ,
158158 'msg ' => 'Start Spy ' ,
159- ) );
159+ ] );
160160 }
161161
162162 public function setAttributesModels ($ attributes , $ models )
@@ -166,28 +166,34 @@ public function setAttributesModels($attributes, $models)
166166 $ modelSip = Sip::model ()->findAll ();
167167 $ modelServers = Servers::model ()->findAll ('type != :key1 AND status IN (1,4) AND host != :key ' , [':key ' => 'localhost ' , ':key1 ' => 'sipproxy ' ]);
168168
169- if (! isset ($ modelServers [0 ])) {
170- array_push ($ modelServers , array (
169+ if ( ! isset ($ modelServers [0 ])) {
170+ array_push ($ modelServers , [
171171 'name ' => 'Master ' ,
172172 'host ' => 'localhost ' ,
173173 'type ' => 'mbilling ' ,
174174 'username ' => 'magnus ' ,
175175 'password ' => 'magnussolution ' ,
176- ) );
176+ ] );
177177 }
178178
179179 $ array = '' ;
180180 $ totalUP = 0 ;
181+ $ i = 1 ;
181182 foreach ($ modelServers as $ key => $ server ) {
182183 if ($ server ['type ' ] == 'mbilling ' ) {
183184 $ server ['host ' ] = 'localhost ' ;
184185 }
185186
186- $ modelCallOnLine = CallOnLine::model ()->count ('server = :key ' , array ( 'key ' => $ server ['host ' ]) );
187+ $ modelCallOnLine = CallOnLine::model ()->count ('server = :key ' , [ 'key ' => $ server ['host ' ]] );
187188
188- $ modelCallOnLineUp = CallOnLine::model ()->count ('server = :key AND status = :key1 ' , array ( 'key ' => $ server ['host ' ], ':key1 ' => 'Up ' ) );
189+ $ modelCallOnLineUp = CallOnLine::model ()->count ('server = :key AND status = :key1 ' , [ 'key ' => $ server ['host ' ], ':key1 ' => 'Up ' ] );
189190 $ totalUP += $ modelCallOnLineUp ;
190191 $ array .= '<font color="black"> ' . strtoupper ($ server ['name ' ]) . '</font> <font color="blue">T: ' . $ modelCallOnLine . '</font> <font color="green">A: ' . $ modelCallOnLineUp . '</font> |  ' ;
192+
193+ if ($ i % 13 == 0 ) {
194+ $ array .= "<br> " ;
195+ }
196+ $ i ++;
191197 }
192198
193199 $ attributes [0 ]['serverSum ' ] = $ array ;
0 commit comments