コード例 #1
0
ファイル: bulkLabel.php プロジェクト: florinp/dexonline
if (!$hasInvariableModel) {
    $models[] = Model::factory('FlexModel')->where('modelType', 'I')->where('number', '1')->find_one();
}
$modelTypes = array();
foreach ($models as $m) {
    $modelTypes[] = ModelType::get_by_code($m->modelType);
}
$lexems = Model::factory('Lexem')->table_alias('l')->select('l.*')->join('LexemModel', 'lm.lexemId = l.id', 'lm')->where('lm.modelType', 'T')->where_like('l.reverse', "{$reverseSuffix}%")->order_by_asc('l.formNoAccent')->limit(20)->find_many();
// $lmMatrix[$i][$j] = lexem model (with inflected forms) for lexem $i and model $j
$lmMatrix = array();
foreach ($lexems as $l) {
    $lm = $l->getFirstLexemModel();
    $lmArray = array();
    foreach ($models as $m) {
        // Force a reload
        $lm = LexemModel::get_by_id($lm->id);
        $lm->modelType = $m->modelType;
        $lm->modelNumber = $m->number;
        $lm->generateInflectedFormMap();
        $lmArray[] = $lm;
    }
    $lmMatrix[] = $lmArray;
}
// Load the definitions for each lexem
$searchResults = array();
foreach ($lexems as $l) {
    $definitions = Definition::loadByLexemId($l->id);
    $searchResults[] = SearchResult::mapDefinitionArray($definitions);
}
SmartyWrap::assign('suffix', $suffix);
SmartyWrap::assign('lexems', $lexems);
コード例 #2
0
ファイル: cloneModel.php プロジェクト: florinp/dexonline
        if ($modelType == 'V') {
            $pm = ParticipleModel::loadByVerbModel($modelNumber);
            $clonePm = Model::factory('ParticipleModel')->create();
            $clonePm->verbModel = $newModelNumber;
            $clonePm->adjectiveModel = $pm->adjectiveModel;
            $clonePm->save();
        }
        // Migrate the selected lexems.
        if ($chooseLexems && $lexemModelIds) {
            foreach ($lexemModelIds as $lexemModelId) {
                $lm = LexemModel::get_by_id($lexemModelId);
                $lm->modelNumber = $newModelNumber;
                $lm->save();
                // It is not necessary to regenerate the paradigm for now, since
                // the inflected forms are identical.
            }
        }
        util_redirect('../admin/index.php');
        exit;
    }
} else {
    $newModelNumber = $modelNumber . ".1";
}
$lexemModels = LexemModel::loadByCanonicalModel($modelType, $modelNumber);
SmartyWrap::assign('modelType', $modelType);
SmartyWrap::assign('modelNumber', $modelNumber);
SmartyWrap::assign('newModelNumber', $newModelNumber);
SmartyWrap::assign('lexemModels', $lexemModels);
SmartyWrap::assign('errorMessage', $errorMessages);
SmartyWrap::assign('recentLinks', RecentLink::loadForUser());
SmartyWrap::displayAdminPage('admin/cloneModel.tpl');
コード例 #3
0
<?php

require_once "../../phplib/util.php";
$id = util_getRequestParameter('id');
$lm = LexemModel::get_by_lexemId_displayOrder($id, 1);
print json_encode(array('modelType' => $lm->modelType, 'modelNumber' => $lm->modelNumber, 'restriction' => $lm->restriction));
コード例 #4
0
ファイル: Lexem.php プロジェクト: florinp/dexonline
 public function delete()
 {
     if ($this->id) {
         if ($this->hasModelType('VT')) {
             $this->deleteParticiple();
         }
         if ($this->hasModelType('VT') || $this->hasModelType('V')) {
             $this->deleteLongInfinitive();
         }
         LexemDefinitionMap::deleteByLexemId($this->id);
         Meaning::delete_all_by_lexemId($this->id);
         Relation::delete_all_by_lexemId($this->id);
         LexemModel::delete_all_by_lexemId($this->id);
     }
     // Clear the variantOfId field for lexems having $this as main.
     $lexemsToClear = Lexem::get_all_by_variantOfId($this->id);
     foreach ($lexemsToClear as $l) {
         $l->variantOfId = null;
         $l->save();
     }
     parent::delete();
 }
コード例 #5
0
ファイル: lexemEdit.php プロジェクト: florinp/dexonline
    $def->internalRepAbbrev = AdminStringUtil::expandAbbreviations($def->internalRep, $def->sourceId);
    $def->htmlRepAbbrev = AdminStringUtil::htmlize($def->internalRepAbbrev, $def->sourceId);
}
$searchResults = SearchResult::mapDefinitionArray($definitions);
$definitionLexem = mb_strtoupper(AdminStringUtil::internalize($lexem->form, false));
$meaningTags = Model::factory('MeaningTag')->order_by_asc('value')->find_many();
$ss = $lexem->structStatus;
$oss = $original->structStatus;
// syntactic sugar
$canEdit = array('general' => util_isModerator(PRIV_EDIT), 'defStructured' => util_isModerator(PRIV_EDIT), 'description' => util_isModerator(PRIV_EDIT), 'form' => !$lexem->isLoc() || util_isModerator(PRIV_LOC), 'hyphenations' => $ss == Lexem::STRUCT_STATUS_IN_PROGRESS || util_isModerator(PRIV_EDIT), 'loc' => (int) util_isModerator(PRIV_LOC), 'meanings' => $ss == Lexem::STRUCT_STATUS_IN_PROGRESS || util_isModerator(PRIV_EDIT), 'paradigm' => util_isModerator(PRIV_EDIT), 'pronunciations' => $ss == Lexem::STRUCT_STATUS_IN_PROGRESS || util_isModerator(PRIV_EDIT), 'sources' => util_isModerator(PRIV_LOC | PRIV_EDIT), 'structStatus' => $oss == Lexem::STRUCT_STATUS_NEW || $oss == Lexem::STRUCT_STATUS_IN_PROGRESS || util_isModerator(PRIV_EDIT), 'tags' => util_isModerator(PRIV_LOC | PRIV_EDIT), 'variants' => $ss == Lexem::STRUCT_STATUS_IN_PROGRESS || util_isModerator(PRIV_EDIT));
// Prepare a list of models for each LexemModel, to be used in the paradigm drop-down.
$models = array();
foreach ($lexem->getLexemModels() as $lm) {
    $models[] = FlexModel::loadByType($lm->modelType);
}
$stemLexemModel = LexemModel::create('T', 1);
SmartyWrap::assign('lexem', $lexem);
SmartyWrap::assign('lexemModels', $lexem->getLexemModels());
SmartyWrap::assign('stemLexemModel', $stemLexemModel);
SmartyWrap::assign('searchResults', $searchResults);
SmartyWrap::assign('definitionLexem', $definitionLexem);
SmartyWrap::assign('homonyms', Model::factory('Lexem')->where('formNoAccent', $lexem->formNoAccent)->where_not_equal('id', $lexem->id)->find_many());
SmartyWrap::assign('meaningTags', $meaningTags);
SmartyWrap::assign('modelTypes', Model::factory('ModelType')->order_by_asc('code')->find_many());
SmartyWrap::assign('models', $models);
SmartyWrap::assign('jsonSources', Source::getJson());
SmartyWrap::assign('modelsT', FlexModel::loadByType('T'));
SmartyWrap::assign('canEdit', $canEdit);
SmartyWrap::assign('structStatusNames', Lexem::$STRUCT_STATUS_NAMES);
SmartyWrap::addCss('jqueryui-smoothness', 'paradigm', 'select2', 'lexemEdit', 'windowEngine', 'textComplete');
SmartyWrap::addJs('jqueryui', 'select2', 'select2Dev', 'lexemEdit', 'windowEngine', 'cookie', 'modelDropdown', 'textComplete');