当前位置: 首页>>代码示例>>PHP>>正文


PHP Definition::loadByLexemId方法代码示例

本文整理汇总了PHP中Definition::loadByLexemId方法的典型用法代码示例。如果您正苦于以下问题:PHP Definition::loadByLexemId方法的具体用法?PHP Definition::loadByLexemId怎么用?PHP Definition::loadByLexemId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Definition的用法示例。


在下文中一共展示了Definition::loadByLexemId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getSourcesForLexem

function getSourcesForLexem($lexem)
{
    global $SOURCES;
    $defs = Definition::loadByLexemId($lexem->id);
    $sources = array();
    foreach ($defs as $def) {
        $shortName = $SOURCES[$def->sourceId]->shortName;
        if (!in_array($shortName, $sources)) {
            $sources[] = $shortName;
        }
    }
    return '(' . implode(',', $sources) . ')';
}
开发者ID:florinp,项目名称:dexonline,代码行数:13,代码来源:mergePlantFamilies.php

示例2: assert_options

<?php

require_once '../../phplib/util.php';
assert_options(ASSERT_BAIL, 1);
debug_off();
$dbResult = mysql_query("select * from lexems where lexem_id not in " . "(select LexemId from LexemDefinitionMap, Definition " . "where DefinitionId = Definition.Id " . "and SourceId not in (6, 8) and Status = 0)");
$seen = 0;
$split = 0;
while (($dbRow = mysql_fetch_assoc($dbResult)) != null) {
    $l = Lexem::createFromDbRow($dbRow);
    $defs = Definition::loadByLexemId($l->id);
    if (!count($defs)) {
        continue;
    }
    $seen++;
    // Remove the -ul accent where possible.
    if (text_endsWith($l->form, 'ul')) {
        $form = substr($l->form, 0, strlen($l->form) - 2);
        $otherLexems = Lexem::loadByForm($form);
        if (count($otherLexems)) {
            print "REMOVING -UL FROM: {$l->form}\n";
            foreach ($otherLexems as $otherLexem) {
                foreach ($defs as $def) {
                    LexemDefinitionMap::associate($otherLexem->id, $def->id);
                }
            }
            $l->delete();
            $split++;
            continue;
        }
    }
开发者ID:florinp,项目名称:dexonline,代码行数:31,代码来源:splitSynonyms.php

示例3: handleLexemActions

function handleLexemActions()
{
    $lexemId = util_getRequestParameter('lexemId');
    $lexem = Lexem::get_by_id($lexemId);
    $associateDefinitionId = util_getRequestParameter('associateDefinitionId');
    if ($associateDefinitionId) {
        LexemDefinitionMap::associate($lexem->id, $associateDefinitionId);
        util_redirect("lexemEdit.php?lexemId={$lexem->id}");
    }
    $dissociateDefinitionId = util_getRequestParameter('dissociateDefinitionId');
    if ($dissociateDefinitionId) {
        LexemDefinitionMap::dissociate($lexem->id, $dissociateDefinitionId);
        util_redirect("lexemEdit.php?lexemId={$lexem->id}");
    }
    $createDefinition = util_getRequestParameter('createDefinition');
    $miniDefTarget = util_getRequestParameter('miniDefTarget');
    if ($createDefinition) {
        $def = Model::factory('Definition')->create();
        $def->userId = session_getUserId();
        $def->sourceId = Source::get_by_shortName('Neoficial')->id;
        $def->lexicon = $lexem->formNoAccent;
        $def->internalRep = '@' . mb_strtoupper(AdminStringUtil::internalize($lexem->form, false)) . '@ v. @' . $miniDefTarget . '.@';
        $def->htmlRep = AdminStringUtil::htmlize($def->internalRep, $def->sourceId);
        $def->status = Definition::ST_ACTIVE;
        $def->save();
        LexemDefinitionMap::associate($lexem->id, $def->id);
        util_redirect("lexemEdit.php?lexemId={$lexem->id}");
    }
    $deleteLexem = util_getRequestParameter('deleteLexem');
    if ($deleteLexem) {
        $homonyms = Model::factory('Lexem')->where('formNoAccent', $lexem->formNoAccent)->where_not_equal('id', $lexem->id)->find_many();
        $lexem->delete();
        SmartyWrap::assign('lexem', $lexem);
        SmartyWrap::assign('homonyms', $homonyms);
        SmartyWrap::displayAdminPage('admin/lexemDeleted.tpl');
        exit;
    }
    $cloneLexem = util_getRequestParameter('cloneLexem');
    if ($cloneLexem) {
        $newLexem = $lexem->cloneLexem();
        log_userLog("Cloned lexem {$lexem->id} ({$lexem->form}), new id is {$newLexem->id}");
        util_redirect("lexemEdit.php?lexemId={$newLexem->id}");
    }
    $mergeLexem = util_getRequestParameter('mergeLexem');
    $mergeLexemId = util_getRequestParameter('mergeLexemId');
    if ($mergeLexem) {
        $other = Lexem::get_by_id($mergeLexemId);
        if ($lexem->form != $other->form) {
            FlashMessage::add('Nu pot unifica lexemele deoarece accentele diferă. Rezolvați diferența și încercați din nou.');
            util_redirect("lexemEdit.php?lexemId={$lexem->id}");
        }
        $defs = Definition::loadByLexemId($lexem->id);
        foreach ($defs as $def) {
            LexemDefinitionMap::associate($other->id, $def->id);
        }
        // Add lexem models from $lexem to $other if the form is the same. Exclude T-type models.
        $displayOrder = count($other->getLexemModels());
        foreach ($lexem->getLexemModels() as $lm) {
            if ($lm->modelType != 'T' && !$other->hasModel($lm->modelType, $lm->modelNumber)) {
                $lm->lexemId = $other->id;
                $lm->displayOrder = ++$displayOrder;
                $lm->save();
            }
        }
        // Add meanings from $lexem to $other and renumber their displayOrder and breadcrumb
        // displayOrders are generated sequentially regardless of level.
        // Breadcrumbs follow levels so only their first part changes.
        $counter = Model::factory('Meaning')->where('lexemId', $other->id)->count();
        $numRoots = Model::factory('Meaning')->where('lexemId', $other->id)->where('parentId', 0)->count();
        $meanings = Model::factory('Meaning')->where('lexemId', $lexem->id)->order_by_asc('displayOrder')->find_many();
        foreach ($meanings as $m) {
            $m->lexemId = $other->id;
            $m->displayOrder = ++$counter;
            $parts = explode('.', $m->breadcrumb, 2);
            $parts[0] += $numRoots;
            $m->breadcrumb = implode('.', $parts);
            $m->save();
        }
        // Add images and image tags from $lexem to $other
        $visuals = Visual::get_all_by_lexemeId($lexem->id);
        foreach ($visuals as $v) {
            $v->lexemeId = $other->id;
            $v->save();
        }
        $visualTags = VisualTag::get_all_by_lexemeId($lexem->id);
        foreach ($visualTags as $vt) {
            $vt->lexemeId = $other->id;
            $vt->save();
        }
        $lexem->delete();
        util_redirect("lexemEdit.php?lexemId={$other->id}");
    }
}
开发者ID:florinp,项目名称:dexonline,代码行数:93,代码来源:lexemEdit.php

示例4: log_userLog

}
if ($updateLexem && !$errorMessage) {
    if ($oldModelType == 'VT' && $lexem->modelType != 'VT') {
        $lexem->deleteParticiple($oldModelNumber);
    }
    if (($oldModelType == 'VT' || $oldModelType == 'V') && ($lexem->modelType != 'VT' && $lexem->modelType != 'V')) {
        $lexem->deleteLongInfinitive();
    }
    $lexem->save();
    // There are two reasons to regenerate the paradigm: the model has changed
    // or the form has changed. It's easier to do it every time.
    $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);
开发者ID:nastasie-octavian,项目名称:DEXonline,代码行数:31,代码来源:lexemEdit.php


注:本文中的Definition::loadByLexemId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。