util_redirect('definitionEdit.php?definitionId=' . $definitionId); } $source = Source::get_by_id($definition->sourceId); if (!$refreshButton && !$acceptButton && !$moveButton) { // If a button was pressed, then this is a POST request and the URL // does not contain the definition ID. RecentLink::createOrUpdate(sprintf("Definiție: %s (%s)", $definition->lexicon, $source->shortName)); } smarty_assign('def', $definition); smarty_assign('source', $source); smarty_assign('user', User::get_by_id($definition->userId)); smarty_assign('comment', $comment); smarty_assign('commentUser', $commentUser); smarty_assign('lexems', $lexems); smarty_assign('typos', Typo::get_all_by_definitionId($definition->id)); smarty_assign('homonyms', loadSetHomonyms($lexems)); smarty_assign("allStatuses", util_getAllStatuses()); smarty_assign("allModeratorSources", Model::factory('Source')->where('canModerate', true)->order_by_asc('displayOrder')->find_many()); smarty_assign('recentLinks', RecentLink::loadForUser()); smarty_displayWithoutSkin('admin/definitionEdit.ihtml'); /** * Load all lexems having the same form as one of the given lexems, but exclude the given lexems. **/ function loadSetHomonyms($lexems) { if (count($lexems) == 0) { return array(); } $names = array(); $ids = array(); foreach ($lexems as $l) {
// does not contain the definition ID. RecentLink::createOrUpdate(sprintf("Definiție: %s (%s)", $definition->lexicon, $source->shortName)); } SmartyWrap::assign('isOCR', $isOCR); if ($definitionId) { SmartyWrap::assign('definitionId', $definitionId); } SmartyWrap::assign('def', $definition); SmartyWrap::assign('source', $source); SmartyWrap::assign('sim', SimilarRecord::create($definition, $lexemIds)); SmartyWrap::assign('user', User::get_by_id($definition->userId)); SmartyWrap::assign('comment', $comment); SmartyWrap::assign('commentUser', $commentUser); SmartyWrap::assign('lexemIds', $lexemIds); SmartyWrap::assign('typos', Typo::get_all_by_definitionId($definition->id)); SmartyWrap::assign('homonyms', loadSetHomonyms($lexems)); SmartyWrap::assign("allModeratorSources", Model::factory('Source')->where('canModerate', true)->order_by_asc('displayOrder')->find_many()); SmartyWrap::assign('recentLinks', RecentLink::loadForUser()); SmartyWrap::addCss('jqueryui', 'select2'); SmartyWrap::addJs('jquery', 'jqueryui', 'select2', 'select2Dev', 'definitionEdit'); SmartyWrap::displayAdminPage('admin/definitionEdit.tpl'); /** * Load all lexems having the same form as one of the given lexems, but exclude the given lexems. **/ function loadSetHomonyms($lexems) { if (count($lexems) == 0) { return array(); } $names = util_objectProperty($lexems, 'formNoAccent'); $ids = util_objectProperty($lexems, 'id');