projects
/
Pman.Core
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix identifiers on eninene migrate
[Pman.Core]
/
DataObjects
/
I18n.php
diff --git
a/DataObjects/I18n.php
b/DataObjects/I18n.php
index
3f52fb5
..
739c80b
100644
(file)
--- a/
DataObjects/I18n.php
+++ b/
DataObjects/I18n.php
@@
-127,9
+127,24
@@
class Pman_Core_DataObjects_I18n extends DB_DataObject
$this->buildDB(); // ensure we have the full database...
$this->selectAdd("
$this->buildDB(); // ensure we have the full database...
$this->selectAdd("
+ id as id,
i18n_translate(ltype, lkey, 'en') as lval_en
");
}
i18n_translate(ltype, lkey, 'en') as lval_en
");
}
+
+ if (!empty($q['_as_code_and_title'])) {
+ $tn = $this->tableName();
+
+ $this->selectAdd();
+ $this->selectAdd("
+ {$tn}.lval as title,
+ {$tn}.lkey as code
+ ");
+ $this->is_active = 1;
+ if (!empty($q['_title'])) {
+ $this->whereAdd("{$tn}.lval like '{$this->escape($_REQUEST['_title'])}%'");
+ }
+ }
if (!empty($q['!code'])) {
$this->whereAddIn('!lkey', explode(',', $q['!code']), 'string');
if (!empty($q['!code'])) {
$this->whereAddIn('!lkey', explode(',', $q['!code']), 'string');
@@
-140,6
+155,10
@@
class Pman_Core_DataObjects_I18n extends DB_DataObject
$this->whereAdd("upper(lval) LIKE '%{$v}%'");
}
$this->whereAdd("upper(lval) LIKE '%{$v}%'");
}
+ if (!empty($q['query']['name_starts'])) {
+ $this->whereAdd("lval LIKE '". $this->escape($q['query']['name_starts']). "%'");
+ }
+
if (!empty($q['_filtered']) && !empty($this->ltype)) {
$cfg = $this->cfg();
$filter = $cfg[$this->ltype];
if (!empty($q['_filtered']) && !empty($this->ltype)) {
$cfg = $this->cfg();
$filter = $cfg[$this->ltype];
@@
-205,6
+224,13
@@
class Pman_Core_DataObjects_I18n extends DB_DataObject
function translate($inlang,$ltype,$kval)
{
function translate($inlang,$ltype,$kval)
{
+
+ static $cache = array();
+ $cache_key = implode(' ', array($inlang,$ltype,$kval));
+ if (isset($cache[$cache_key ])) {
+ return $cache[$cache_key];
+ }
+
$x = DB_DataObject::factory('i18n');
$x->ltype = $ltype;
$x->lkey = $kval;
$x = DB_DataObject::factory('i18n');
$x->ltype = $ltype;
$x->lkey = $kval;
@@
-213,12
+239,15
@@
class Pman_Core_DataObjects_I18n extends DB_DataObject
$x->limit(1);
if ($x->find(true) && !empty($x->lval)) {
$x->limit(1);
if ($x->find(true) && !empty($x->lval)) {
+ $cache[$cache_key] = $x->lval;
return $x->lval;
}
$fallback->inlang = 'en';
if ($fallback->find(true) && !empty($fallback->lval)) {
return $x->lval;
}
$fallback->inlang = 'en';
if ($fallback->find(true) && !empty($fallback->lval)) {
- return $fallback->lval;
+ $cache[$cache_key] = $fallback->lval;
+ return $fallback->lval;
}
}
+ $cache[$cache_key] = $kval;
return $kval;
}
return $kval;
}
@@
-227,7
+256,7
@@
class Pman_Core_DataObjects_I18n extends DB_DataObject
function toTransList($ltype, $inlang)
{
function toTransList($ltype, $inlang)
{
-
+ $this->is_active = 1;
$this->ltype = $ltype;
$this->inlang= $inlang;
$this->selectAdd();
$this->ltype = $ltype;
$this->inlang= $inlang;
$this->selectAdd();