@@ -30,23 +30,25 @@ public function index()
3030 {
3131
3232 $ where = array ();
33- if (!empty ($ this ->request ->getQuery ['locale ' ]))
34- $ where ['locale ' ] = $ this ->request ->getQuery ['locale ' ];
33+
34+ if (!empty ($ this ->request ->getQuery ('locale ' )))
35+ $ where ['locale ' ] = $ this ->request ->getQuery ('locale ' );
3536 if (!empty ($ this ->request ->data ['locale ' ]))
3637 $ where ['locale ' ] = $ this ->request ->data ['locale ' ];
3738
38- if (!empty ($ this ->request ->getQuery [ 'msgstr ' ] ))
39- $ where ['msgstr like ' ] = '% ' . $ this ->request ->getQuery [ 'msgstr ' ] . '% ' ;
39+ if (!empty ($ this ->request ->getQuery ( 'msgstr ' ) ))
40+ $ where ['msgstr like ' ] = '% ' . $ this ->request ->getQuery ( 'msgstr ' ) . '% ' ;
4041 if (!empty ($ this ->request ->data ['msgstr ' ]))
4142 $ where ['msgstr like ' ] = '% ' . $ this ->request ->data ['msgstr ' ] . '% ' ;
4243
43- if (!empty ($ this ->request ->getQuery ['status ' ]))
44- $ where ['status ' ] = $ this ->request ->getQuery ['status ' ];
44+ if (!empty ($ this ->request ->getQuery ('status ' )))
45+ $ where ['status ' ] = $ this ->request ->getQuery ('status ' );
46+
4547 if (!empty ($ this ->request ->data ['status ' ]))
4648 $ where ['status ' ] = $ this ->request ->data ['status ' ];
4749
4850 $ query = $ this ->Translations ->find ()->where ($ where );
49-
51+
5052 $ this ->set ('translations ' , $ this ->paginate ($ query ));
5153 $ this ->set ('_serialize ' , ['translations ' ]);
5254 $ this ->set ('WnkTranslation ' , Configure::read ('WnkTranslation ' ));
@@ -72,13 +74,13 @@ public function cockpit()
7274 $ table = $ wnkConf ['tablePrefix ' ] . $ table ;
7375
7476 $ q = "select locale,status,count(*) as cnt from " . $ table ;
75- $ q .= "where locale in (select distinct locale where status ='Original') " ;
77+ $ q .= " where locale in (select distinct locale where status ='Original') " ;
7678 $ q .= "group by locale,status order by 1,2 " ;
7779 $ tset = $ conn ->execute ($ q )->fetchAll ('assoc ' );
7880 $ this ->set ('original ' , $ tset );
7981
8082 $ q = "select locale,status,count(*) as cnt from " . $ table ;
81- $ q .= "where locale NOT in (select distinct locale where status ='Original') " ;
83+ $ q .= " where locale NOT in (select distinct locale where status ='Original') " ;
8284 $ q .= "group by locale,status order by 1,2 " ;
8385 $ tset = $ conn ->execute ($ q )->fetchAll ('assoc ' );
8486 $ this ->set ('tsets ' , $ tset );
@@ -215,4 +217,14 @@ public function googletranslate() {
215217 return $ this ->redirect (['action ' => 'index ' ]);
216218 }
217219 }
220+
221+ public function deleteunused ()
222+ {
223+ $ this ->autoRender = false ;
224+ $ rc = $ this ->Translations ->deleteunused ();
225+ $ this ->Flash ->success (__ ('del ended. ' ) . ' ' . $ rc );
226+ return $ this ->redirect (['action ' => 'cockpit ' ]);
227+ }
228+
229+
218230}
0 commit comments