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


PHP Source::get_by_id方法代码示例

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


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

示例1: doSearch

 /**
  * Searches the definition
  * @access protected
  * @return void
  * */
 protected function doSearch()
 {
     $q = str_replace("'", "\\'", $this->query);
     $where = "lexicon like '{$q}%'";
     if (strlen($q) >= 3) {
         $where = " lexicon like '%{$q}%'";
     }
     $where .= " order by lexicon = '{$q}', lexicon, id limit 20";
     $definitions = Model::factory('Definition')->raw_query("select * from Definition where {$where}", null)->find_many();
     $result = '';
     foreach ($definitions as $definition) {
         $source = Source::get_by_id($definition->sourceId);
         $result .= ($result == '' ? '' : "\n") . $definition->lexicon . " - " . substr($definition->internalRep, 0, 80) . ' (' . $source->shortName . ') [{' . $definition->id . '}]';
     }
     return $result;
 }
开发者ID:nastasie-octavian,项目名称:DEXonline,代码行数:21,代码来源:wotdGetDefinitions.php

示例2: util_getRequestParameter

<?php

require_once "../phplib/util.php";
$submitButton = util_getRequestParameter('submitButton');
if ($submitButton) {
    util_assertModerator(PRIV_ADMIN);
    $order = 1;
    $ids = util_getRequestParameter("ids");
    foreach ($ids as $id) {
        $src = Source::get_by_id($id);
        $src->displayOrder = $order++;
        $src->save();
    }
    FlashMessage::add('Ordinea a fost salvată.', 'info');
    util_redirect('surse');
}
$sources = util_isModerator(PRIV_VIEW_HIDDEN) ? Model::factory('Source')->order_by_asc('displayOrder')->find_many() : Model::factory('Source')->where_not_equal('isOfficial', SOURCE_TYPE_HIDDEN)->order_by_asc('displayOrder')->find_many();
smarty_assign('sources', $sources);
smarty_assign('page_title', 'Surse');
smarty_displayCommonPageWithSkin('surse.ihtml');
开发者ID:nastasie-octavian,项目名称:DEXonline,代码行数:20,代码来源:surse.php

示例3: util_getRequestParameter

<?php

require_once "../../phplib/util.php";
$lexemId = util_getRequestParameter('lexemId');
$defs = Definition::loadByLexemId($lexemId);
$results = array();
foreach ($defs as $def) {
    $htmlRep = str_replace("\n", ' ', $def->htmlRep);
    $source = Source::get_by_id($def->sourceId);
    $results[] = array('id' => $def->id, 'shortName' => $source->shortName, 'status' => $def->getStatusName(), 'htmlRep' => $htmlRep);
}
SmartyWrap::assign('results', $results);
SmartyWrap::displayWithoutSkin('ajax/getDefinitionsForLexem.tpl');
开发者ID:florinp,项目名称:dexonline,代码行数:13,代码来源:getDefinitionsForLexem.php

示例4: util_hideEmptyRequestParameters

<?php

require_once "../../phplib/util.php";
util_hideEmptyRequestParameters();
util_assertModerator(PRIV_LOC);
util_assertNotMirror();
$sourceId = util_getRequestParameter('source');
$nick = util_getRequestParameter('nick');
$loc = util_getRequestParameter('loc');
$source = Source::get_by_id($sourceId);
switch ($loc) {
    case 0:
        $srcClause = " and not l.isLoc";
        smarty_assign('sectionTitle', "Lexeme din {$source->shortName} neincluse în LOC");
        break;
    case 1:
        $srcClause = " and l.isLoc";
        smarty_assign('sectionTitle', "Lexeme din {$source->shortName} incluse în LOC");
        break;
    case 2:
        $srcClause = "";
        smarty_assign('sectionTitle', "Lexeme din {$source->shortName}");
        break;
    default:
        exit;
}
$nickClause = '';
if ($nick) {
    $user = User::get_by_nick($nick);
    if ($user) {
        $nickClause = "and d.userId = {$user->id}";
开发者ID:nastasie-octavian,项目名称:DEXonline,代码行数:31,代码来源:viewLocLexems.php

示例5: util_assertModerator

<?php

require_once "../phplib/util.php";
util_assertModerator(PRIV_ADMIN);
$sourceId = util_getRequestParameter('id');
$submitButton = util_getRequestParameter('submitButton');
$src = $sourceId ? Source::get_by_id($sourceId) : Model::factory('Source')->create();
if ($submitButton) {
    $src->name = util_getRequestParameter("name");
    $src->shortName = util_getRequestParameter("shortName");
    $src->urlName = util_getRequestParameter("urlName");
    $src->author = util_getRequestParameter("author");
    $src->publisher = util_getRequestParameter("publisher");
    $src->year = util_getRequestParameter("year");
    $src->link = util_getRequestParameter("link");
    $src->isActive = util_getRequestParameterWithDefault("isActive", 0);
    $src->isOfficial = util_getRequestParameterWithDefault("isOfficial", 0);
    $src->canContribute = util_getRequestParameterWithDefault("canContribute", 0);
    $src->canModerate = util_getRequestParameterWithDefault("canModerate", 0);
    $src->canDistribute = util_getRequestParameterWithDefault("canDistribute", 0);
    $src->defCount = util_getRequestIntParameter("defCount");
    if (validate($src)) {
        // For new sources, set displayOrder to the highest available + 1
        if (!$sourceId) {
            $src->displayOrder = Model::factory('Source')->count() + 1;
        }
        $src->updatePercentComplete();
        $src->save();
        FlashMessage::add('Modificările au fost salvate', 'info');
        util_redirect("editare-sursa?id={$src->id}");
    }
开发者ID:Jobava,项目名称:mirror-dexonline,代码行数:31,代码来源:editare-sursa.php

示例6: db_execute

            $l = Lexem::get_by_id($ldm->lexemId);
            $otherLdms = LexemDefinitionMap::get_all_by_lexemId($l->id);
            if (!$l->isLoc && !count($otherLdms)) {
                $l->delete();
            }
        }
    } else {
        db_execute("delete from LexemDefinitionMap where definitionId = {$definitionId}");
        foreach ($ldms as $ldm) {
            $ldm->save();
        }
    }
    log_userLog("Edited definition {$definition->id} ({$definition->lexicon})");
    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());
开发者ID:nastasie-octavian,项目名称:DEXonline,代码行数:31,代码来源:definitionEdit.php

示例7: getSimilarSource

 public static function getSimilarSource($sourceId)
 {
     $ss = Model::factory('SimilarSource')->select('similarSource')->where('sourceId', $sourceId)->find_one();
     return $ss ? Source::get_by_id($ss->similarSource) : null;
 }
开发者ID:florinp,项目名称:dexonline,代码行数:5,代码来源:SimilarSource.php


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