/** Returns an array containing only the accented forms, not the entire InflectedForm objects **/ function loadIfArrayByLexemId($lexemId) { $ifs = InflectedForm::loadByLexemId($lexemId); $result = array(); foreach ($ifs as $if) { $result[] = $if->form; } return $result; }
prepareDefForVersion($def); smarty_assign('def', $def); smarty_assign('lexemIds', $lexemIds); smarty_assign('user', userCache_get($def->userId)); smarty_displayWithoutSkin('common/update3Definitions.ihtml'); } print "</Definitions>\n"; } else { if ($export == 'lexems') { $lexemDbResult = db_execute("select * from Lexem where modDate >= '{$timestamp}' order by modDate, id"); print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; print "<Lexems>\n"; print "<NumResults>" . $lexemDbResult->rowCount() . "</NumResults>\n"; foreach ($lexemDbResult as $dbRow) { $lexem = Model::factory('Lexem')->create($dbRow); smarty_assign('ifs', InflectedForm::loadByLexemId($lexem->id)); smarty_assign('lexem', $lexem); smarty_displayWithoutSkin('common/update3Lexems.ihtml'); } print "</Lexems>\n"; } } } } } /****************************************************************************/ function userCache_init() { $GLOBALS['USER'] = array(); } function userCache_get($key)
function dumpLexems($query, $fileName, $message) { log_scriptLog($message); $results = db_execute($query); $file = gzopen($fileName, 'wb9'); gzwrite($file, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); gzwrite($file, "<Lexems>\n"); foreach ($results as $row) { $lexem = Model::factory('Lexem')->create($row); smarty_assign('lexem', $lexem); smarty_assign('ifs', InflectedForm::loadByLexemId($lexem->id)); gzwrite($file, smarty_fetch('xmldump/lexem.ihtml')); } gzwrite($file, "</Lexems>\n"); gzclose($file); }