function getNewForms($lexem, $locVersion) { $ifArray = $lexem->generateParadigm(); if ($locVersion >= '5.0') { return InflectedForm::mapByInflectionRank($ifArray); } else { return InflectedForm::mapByInflectionId($ifArray); } }
if (!$result && count($errorMessage) <= 20) { $errorMessage[] = "Nu pot calcula una din formele lexemului " . htmlentities($l->form) . "."; } } } $regenForms[] = $regenRow; } // Now load the affected adjectives if the participle model changed if ($participleNumber != $newParticipleNumber) { $participleParadigms = array(); $participles = loadParticiplesForVerbModel($modelNumber, $participleNumber); foreach ($participles as $p) { $p->modelNumber = $newParticipleNumber; $ifs = $p->generateParadigm(); if (is_array($ifs)) { $participleParadigms[] = InflectedForm::mapByInflectionRank($ifs); } else { $errorMessage[] = "Nu pot declina participiul \"" . htmlentities($p->form) . "\" " . "conform modelului A{$newParticipleNumber}."; $participleParadigms[] = null; } } smarty_assign('participles', $participles); smarty_assign('participleParadigms', $participleParadigms); } if ($confirmButton) { // Save the transforms and model descriptions foreach ($regenTransforms as $inflId => $transformMatrix) { db_execute("delete from ModelDescription where modelId = {$model->id} and inflectionId = {$inflId}"); $variant = 0; foreach ($transformMatrix as $transforms) { $accentShift = array_pop($transforms);
if (!$hasInvariableModel) { $models[] = Model::factory('FlexModel')->where('modelType', 'I')->where('number', '1')->find_one(); } $lexems = Model::factory('Lexem')->where('modelType', 'T')->where_like('reverse', "{$reverseSuffix}%")->order_by_asc('formNoAccent')->limit(20)->find_many(); // $ifMapMatrix[$i][$j] = array of InflectedForms for lexem $i and model $j $ifMapMatrix = array(); foreach ($lexems as $l) { $origModelType = $l->modelType; $origModelNumber = $l->modelNumber; $ifMapArray = array(); foreach ($models as $m) { $l->modelType = $m->modelType; $l->modelNumber = $m->number; $if = $l->generateParadigm(); if (is_array($if)) { $ifMapArray[] = InflectedForm::mapByInflectionRank($if); } else { $ifMapArray[] = null; } } $l->modelType = $origModelType; $l->modelNumber = $origModelNumber; $ifMapMatrix[] = $ifMapArray; } // Load the definitions for each lexem $searchResults = array(); foreach ($lexems as $l) { $definitions = Definition::loadByLexemId($l->id); $searchResults[] = SearchResult::mapDefinitionArray($definitions); } smarty_assign('suffix', $suffix);
function getInflectedFormMap($method) { if ($this->inflectedFormMap === null) { $ifs = $this->getInflectedForms($method); if (is_array($ifs)) { $this->inflectedFormMap = InflectedForm::mapByInflectionRank($ifs); } } return $this->inflectedFormMap; }
$lexem->regenerateParadigm(); log_userLog("Edited lexem {$lexem->id} ({$lexem->form})"); util_redirect("lexemEdit.php?lexemId={$lexem->id}"); } $definitions = Definition::loadByLexemId($lexem->id); $searchResults = SearchResult::mapDefinitionArray($definitions); $definitionLexem = mb_strtoupper(AdminStringUtil::internalize($lexem->form, false)); // Generate new inflected forms, but do not overwrite the old ones. $ifs = $lexem->generateParadigm(); if (!is_array($ifs)) { $infl = Inflection::get_by_id($ifs); if (!$errorMessage) { $errorMessage = "Nu pot genera flexiunea '" . htmlentities($infl->description) . "' " . "conform modelului {$lexem->modelType}{$lexem->modelNumber}."; } } else { $ifMap = InflectedForm::mapByInflectionRank($ifs); smarty_assign('ifMap', $ifMap); smarty_assign('searchResults', $searchResults); } $models = FlexModel::loadByType($lexem->modelType); $sources = LexemSources::getSourceArrayChecked($lexem->source); $sourceNames = LexemSources::getNamesOfSources($lexem->source); $canEditForm = !$lexem->isLoc || util_isModerator(PRIV_LOC); smarty_assign('lexem', $lexem); smarty_assign('sources', $sources); smarty_assign('sourceNames', $sourceNames); smarty_assign('searchResults', $searchResults); smarty_assign('definitionLexem', $definitionLexem); smarty_assign('homonyms', Model::factory('Lexem')->where('formNoAccent', $lexem->formNoAccent)->where_not_equal('id', $lexem->id)->find_many()); smarty_assign('suggestedLexems', loadSuggestions($lexem, 5)); smarty_assign('restrS', FlexStringUtil::contains($lexem->restriction, 'S'));