public static function getChanged($tId) { $ret = array(); if ($tId !== 1) { $q = "SELECT Req, Trans FROM Page_StaticTranslation WHERE TranslationId = 1"; foreach (DataProvider::fetchAll($q) as $r) { $req = $r['Req']; $q = "SELECT Trans FROM Page_StaticTranslation WHERE " . "Req = '{$req}' AND TranslationId = {$tId} AND Time < (" . "SELECT Time FROM Page_StaticTranslation " . "WHERE Req = '{$req}' AND TranslationId = 1)"; foreach (DataProvider::fetchAll($q) as $x) { array_push($ret, array('Description' => TranslationProvider::getDescription($req), 'Original' => $r['Trans'], 'Translation' => array('TranslationId' => $tId, 'Translation' => $x['Trans'], 'Payload' => $req, 'TranslationProvider' => 'StaticTranslationProvider'))); } } } return $ret; }
public function page($tId, $study, $offset) { //Setup $ret = array(); $description = TranslationProvider::getDescription('dt_studyTitle_trans'); $category = $this->getName(); //Page query: $o = $offset == -1 ? '' : " LIMIT 30 OFFSET {$offset}"; $q = "SELECT Field, Trans " . "FROM Page_DynamicTranslation " . "WHERE TranslationId = 1 " . "AND Category = '{$category}'{$o}"; foreach ($this->fetchRows($q) as $r) { $sName = $r[0]; $q = $this->getTranslationQuery($sName, $tId); $translation = $this->querySingleRow($q); array_push($ret, array('Description' => $description, 'Original' => $r[1], 'Translation' => array('TranslationId' => $tId, 'Translation' => $translation[0], 'Payload' => $sName, 'TranslationProvider' => $this->getName()))); } return $ret; }
/** @param $category String @return $description array('Req' => String, 'Description' => String) || array() Given a $category this method fetches the description text that belongs to it. */ public static function categoryToDescription($category) { //Checking projections: $regex = '/^' . preg_quote($category, '/') . '$/'; $projections = TranslationColumnProjection::filterCategoryRegex(self::$projections, $regex); if (count($projections) !== 0) { $desc = current($projections)->getDescription(); if ($desc instanceof Exception) { Config::error('' . $desc); return array(); } return $desc; } //Checking provider edge case: if (array_key_exists($category, self::$providers)) { if ($category === 'StudyTitleTranslationProvider') { return TranslationProvider::getDescription('dt_studyTitle_trans'); } else { Config::error("Unexpected case in Translation::categoryToDescription for {$category}"); } } return array(); }