X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=DataObjects%2FI18n.php;h=c7ea606ba2dfff433d3076833342b494df8021a3;hb=f61e0023b975638a8a1c239decbdcc45e87f192d;hp=f997e6973533ba04eee0754e5f3ad8a93bae5893;hpb=129a3598d2a55a4747e08bcfef6c538da0b32331;p=Pman.Core diff --git a/DataObjects/I18n.php b/DataObjects/I18n.php index f997e697..c7ea606b 100644 --- a/DataObjects/I18n.php +++ b/DataObjects/I18n.php @@ -7,7 +7,7 @@ * It should eventually replace most of that.. * */ -require_once 'DB/DataObject.php'; +class_exists('DB_DataObject') ? '' : require_once 'DB/DataObject.php'; class Pman_Core_DataObjects_I18n extends DB_DataObject { @@ -131,6 +131,10 @@ class Pman_Core_DataObjects_I18n extends DB_DataObject "); } + + if (!empty($q['!code'])) { + $this->whereAddIn('!lkey', explode(',', $q['!code']), 'string'); + } if (!empty($q['query']['name'])) { //DB_DAtaObject::debugLevel(1); $v = strtoupper($this->escape($q['query']['name'])); @@ -147,6 +151,23 @@ class Pman_Core_DataObjects_I18n extends DB_DataObject } } + function lookupCode($inlang,$ltype,$name) + { + $x = DB_DataObject::factory('i18n'); + $x->ltype = $ltype; + $x->lval = $name; + $x->inlang= $inlang; + + $x->limit(1); + if ($x->find(true) && !empty($x->lkey)) { + return $x->lkey; + } + return ''; + + + } + + function translate($inlang,$ltype,$kval) { @@ -291,7 +312,6 @@ class Pman_Core_DataObjects_I18n extends DB_DataObject $this->buildDB('l'); $this->buildDB('m'); $this->buildDB('p', 'en'); - return; }