@@ -30,6 +30,19 @@ class Journals extends CI_Model
3030 public function __construct ()
3131 {
3232 parent ::__construct ();
33+
34+ $ this ->db ->conn_id ->createFunction (
35+ 'locale ' ,
36+ function ($ data , $ locale = 'root ' ) {
37+ static $ collators = array ();
38+
39+ if (isset ($ collators [$ locale ]) !== true ) {
40+ $ collators [$ locale ] = new \Collator ($ locale );
41+ }
42+
43+ return $ collators [$ locale ]->getSortKey ($ data );
44+ }
45+ );
3346 }
3447
3548 /**
@@ -73,7 +86,7 @@ public function list_all_subject_areas($language)
7386 * @param string $letter
7487 * @return array
7588 */
76- public function list_all_journals ($ limit , $ offset , $ status = false , $ matching = false , $ search = false , $ letter = false )
89+ public function list_all_journals ($ limit , $ offset , $ status = false , $ matching = false , $ search = false , $ letter = false , $ locale = ' root ' )
7790 {
7891
7992 $ this ->db ->from ($ this ->journals_table );
@@ -82,7 +95,7 @@ public function list_all_journals($limit, $offset, $status = false, $matching =
8295
8396 $ this ->db ->limit ($ limit , $ offset );
8497 $ this ->db ->group_by ('title_search ' );
85- $ this ->db ->order_by (' title_search ' , 'ASC ' );
98+ $ this ->db ->order_by (" locale('title ', '$ locale ') " );
8699
87100 return $ this ->get_results_obj ();
88101 }
0 commit comments