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


PHP SmartyWrap::assign方法代码示例

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


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

示例1: runAllModules

 public static function runAllModules($lexems, $definitions)
 {
     $adsModules = Config::get('global.adsModulesH');
     if ($adsModules) {
         foreach ($adsModules as $adsModule) {
             require_once util_getRootPath() . "phplib/ads/{$adsModule}/{$adsModule}AdsModule.php";
             $className = ucfirst($adsModule) . 'AdsModule';
             $module = new $className();
             $result = $module->run(empty($lexems) ? null : $lexems, empty($definitions) ? null : $definitions);
             if ($result) {
                 SmartyWrap::assign('adsProvider', $adsModule);
                 SmartyWrap::assign('adsProviderParams', $result);
                 break;
             }
         }
     }
 }
开发者ID:florinp,项目名称:dexonline,代码行数:17,代码来源:adsModule.php

示例2: util_getRequestParameter

$provider = util_getRequestParameter('provider');
// Display a banner for this provider
$go = util_getRequestParameter('go');
// Track a click and redirect to this provider
$clickurl = util_getRequestParameter('clickurl');
// Sent to us by OpenX; when displaying a banner, we have to link to this URL
if ($go) {
    $provider = $go;
    $go = true;
}
require_once "../phplib/ads/{$provider}/{$provider}AdsModule.php";
if ($provider == 'diverta') {
    $bookId = util_getRequestParameter('bookId');
    $book = DivertaBook::get_by_id($bookId);
    if (!$book) {
        exit;
    }
    if ($go) {
        $book->clicks++;
        $book->save();
        util_redirect($book->url);
    }
    $book->impressions++;
    $book->save();
    SmartyWrap::assign('book', $book);
    SmartyWrap::assign('hasImage', file_exists(util_getRootPath() . "wwwbase/img/diverta/thumb/{$book->sku}.jpg"));
}
SmartyWrap::assign('clickurl', str_replace('__', '&', $clickurl));
$output = SmartyWrap::fetch("ads/{$provider}.ihtml");
$output = addslashes(str_replace("\n", ' ', $output));
print "document.write(\"{$output}\");";
开发者ID:Jobava,项目名称:mirror-dexonline,代码行数:31,代码来源:custom-ad.php

示例3: session_getUser

<?php

require_once "../phplib/util.php";
$user = session_getUser();
if (!$user) {
    util_redirect('auth/login');
}
SmartyWrap::assign('bookmarks', UserWordBookmarkDisplayObject::getByUser($user->id));
SmartyWrap::display('cuvinte-favorite.tpl');
开发者ID:florinp,项目名称:dexonline,代码行数:9,代码来源:cuvinte-favorite.php

示例4: foreach

    // Exercise the fields we'll need later in the view.
    // TODO: this code replicates code from search.php
    $hasUnrecommendedForms = false;
    foreach ($filtered_lexems as $l) {
        foreach ($l->getLexemModels() as $lm) {
            $lm->getModelType();
            $lm->getSourceNames();
            $map = $lm->loadInflectedFormMap();
            $lm->addLocInfo();
            foreach ($map as $ifs) {
                foreach ($ifs as $if) {
                    $hasUnrecommendedForms |= !$if->recommended;
                }
            }
        }
    }
    SmartyWrap::assign('hasUnrecommendedForms', $hasUnrecommendedForms);
    SmartyWrap::assign('lexems', $filtered_lexems);
    SmartyWrap::assign('showParadigm', true);
    SmartyWrap::assign('locParadigm', session_user_prefers(Preferences::LOC_PARADIGM));
    SmartyWrap::assign('onlyParadigm', !$ajax);
} else {
    FlashMessage::add("Niciun rezultat pentru {$cuv}.");
    SmartyWrap::assign('page_title', "Eroare");
}
if ($ajax) {
    SmartyWrap::displayWithoutSkin('bits/multiParadigm.ihtml');
} else {
    SmartyWrap::addCss('paradigm');
    SmartyWrap::display('search.ihtml');
}
开发者ID:Jobava,项目名称:mirror-dexonline,代码行数:31,代码来源:paradigm.php

示例5: array

$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);
SmartyWrap::assign('models', $models);
SmartyWrap::assign('modelTypes', $modelTypes);
SmartyWrap::assign('searchResults', $searchResults);
SmartyWrap::assign('lmMatrix', $lmMatrix);
SmartyWrap::assign('recentLinks', RecentLink::loadForUser());
SmartyWrap::addCss('paradigm');
SmartyWrap::displayAdminPage('admin/bulkLabel.tpl');
开发者ID:florinp,项目名称:dexonline,代码行数:31,代码来源:bulkLabel.php

示例6: session_login

$data['identity'] = $provider;
if (isset($data['name'])) {
    $data['fullname'] = $data['name'];
}
$user = User::get_by_identity_openidConnectSub($provider, $data['sub']);
if (!$user && $oidc->getPlainOpenid()) {
    // This may be the first time the user logs in after the migration from
    // OpenID 2.0 to OpenID Connect.
    $user = User::get_by_identity($oidc->getPlainOpenid());
    if ($user) {
        $user->identity = null;
        // session_login will overwrite it
    }
}
if ($user) {
    session_login($user, $data);
} else {
    // First time logging in, must claim an existing account or create a new one
    // TODO this duplicates code in revenireOpenid.php
    $user = isset($data['email']) ? User::get_by_email($data['email']) : null;
    $loginType = $user ? 0 : (isset($data['fullname']) ? 1 : (isset($data['nickname']) ? 2 : 3));
    // Store the identity in a temporary file. Don't print it in the form, because then it can be faked on the next page.
    $randString = util_randomCapitalLetterString(20);
    FileCache::put($randString, $data);
    SmartyWrap::assign('page_title', 'Autentificare cu OpenID');
    SmartyWrap::assign('suggestHiddenSearchForm', true);
    SmartyWrap::assign('data', $data);
    SmartyWrap::assign('randString', $randString);
    SmartyWrap::assign('loginType', $loginType);
    SmartyWrap::display('auth/chooseIdentity.ihtml');
}
开发者ID:Jobava,项目名称:mirror-dexonline,代码行数:31,代码来源:revenireOpenidConnect.php

示例7: foreach

foreach ($recordSet as $row) {
    $changeSet = $row;
    $changeSet['changesCount'] = 0;
    if ($row['OldUserId'] !== $row['NewUserId']) {
        $changeSet['changesCount']++;
    }
    if ($row['OldSourceId'] !== $row['NewSourceId']) {
        $changeSet['changesCount']++;
    }
    if ($row['OldStatus'] !== $row['NewStatus']) {
        $changeSet['OldStatusName'] = $statuses[$row['OldStatus']];
        $changeSet['NewStatusName'] = $statuses[$row['NewStatus']];
        $changeSet['changesCount']++;
    }
    if ($row['OldLexicon'] !== $row['NewLexicon']) {
        $changeSet['changesCount']++;
    }
    if ($row['OldModUserId'] !== $row['NewModUserId']) {
        $changeSet['changesCount']++;
    }
    if ($row['OldInternalRep'] !== $row['NewInternalRep']) {
        $changeSet['diff'] = LDiff::htmlDiff($row['OldInternalRep'], $row['NewInternalRep']);
        $changeSet['changesCount']++;
    }
    if ($changeSet['changesCount'] > 0) {
        $changeSets[] = $changeSet;
    }
}
SmartyWrap::assign('def', $def);
SmartyWrap::assign('changeSets', $changeSets);
SmartyWrap::display('istoria-definitiei.tpl');
开发者ID:florinp,项目名称:dexonline,代码行数:31,代码来源:istoria-definitiei.php

示例8: substr

        $s = substr($s, 0, $m['position']) . " {$MARKER} " . substr($s, $m['position'], $m['length']) . " {$MARKER} " . substr($s, $m['position'] + $m['length']);
    }
    $s = AdminStringUtil::htmlize($s, $def->sourceId);
    // Split the definition into n ambiguities and n+1 bits of text between the ambiguities
    $text = array();
    $ambiguities = array();
    while (($p = strpos($s, $MARKER)) !== false) {
        $chunk = trim(substr($s, 0, $p));
        $s = trim(substr($s, $p + strlen($MARKER)));
        if (count($text) == count($ambiguities)) {
            $text[] = $chunk;
        } else {
            $ambiguities[] = $chunk;
        }
    }
    $text[] = trim($s);
    SmartyWrap::assign('text', $text);
    SmartyWrap::assign('ambiguities', $ambiguities);
}
SmartyWrap::assign('def', $def);
SmartyWrap::assign('recentLinks', RecentLink::loadForUser());
SmartyWrap::assign('sectionTitle', 'Examinare abrevieri');
SmartyWrap::addJs('jquery');
SmartyWrap::displayAdminPage('admin/randomAbbrevReview.ihtml');
/**
 * Sort matches from last to first
 */
function positionCmp($a, $b)
{
    return $b['position'] - $a['position'];
}
开发者ID:Jobava,项目名称:mirror-dexonline,代码行数:31,代码来源:randomAbbrevReview.php

示例9: util_redirect

    $v = Visual::get_by_path($fileName);
    if (!$v) {
        $v = Visual::createFromFile($fileName);
    }
    util_redirect("?id={$v->id}");
}
$v = Visual::get_by_id($id);
if ($saveButton) {
    $v->lexemeId = $lexemId;
    $v->revised = $revised;
    $v->save();
    util_redirect("?id={$v->id}");
}
if ($addTagButton) {
    $vt = Model::factory('VisualTag')->create();
    $vt->imageId = $v->id;
    $vt->lexemeId = $tagLexemId;
    $vt->label = $tagLabel;
    $vt->textXCoord = $textXCoord;
    $vt->textYCoord = $textYCoord;
    $vt->imgXCoord = $imgXCoord;
    $vt->imgYCoord = $imgYCoord;
    $vt->save();
    util_redirect("?id={$v->id}");
}
SmartyWrap::assign('visual', $v);
SmartyWrap::assign('lexem', Lexem::get_by_id($v->lexemeId));
SmartyWrap::assign('sectionTitle', 'Etichetare imagini pentru definiții');
SmartyWrap::addCss('jqueryui-smoothness', 'jcrop', 'select2', 'jqgrid', 'jqueryui', 'gallery');
SmartyWrap::addJs('jquery', 'jqueryui', 'jcrop', 'visualTag', 'select2', 'select2Dev', 'jqgrid', 'gallery');
SmartyWrap::displayAdminPage('admin/visualTag.ihtml');
开发者ID:Jobava,项目名称:mirror-dexonline,代码行数:31,代码来源:visualTag.php

示例10: session_getUser

<?php

require_once "../phplib/util.php";
$user = session_getUser();
$haveEuPlatescCredentials = Config::get('euplatesc.euPlatescMid') && Config::get('euplatesc.euPlatescKey');
SmartyWrap::assign('suggestHiddenSearchForm', true);
SmartyWrap::assign('suggestNoBanner', true);
SmartyWrap::assign('haveEuPlatescCredentials', $haveEuPlatescCredentials);
SmartyWrap::assign('defaultEmail', $user ? $user->email : '');
SmartyWrap::addCss('jqueryui');
SmartyWrap::addJs('jqueryui');
SmartyWrap::display('doneaza.tpl');
开发者ID:florinp,项目名称:dexonline,代码行数:12,代码来源:doneaza.php

示例11: 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');
}
if (util_isModerator(PRIV_VIEW_HIDDEN)) {
    $sources = Model::factory('Source')->order_by_asc('displayOrder')->find_many();
} else {
    $sources = Model::factory('Source')->where_not_equal('isOfficial', SOURCE_TYPE_HIDDEN)->order_by_asc('displayOrder')->find_many();
}
SmartyWrap::assign('sources', $sources);
SmartyWrap::addCss('jqueryui');
SmartyWrap::addJs('jqueryui', 'jqTableDnd', 'tablesorter');
SmartyWrap::display('surse.tpl');
开发者ID:florinp,项目名称:dexonline,代码行数:25,代码来源:surse.php

示例12: implode

    if (count($sourceList)) {
        $pageDescription .= " din dicționarele: " . implode(", ", $sourceList);
    }
    SmartyWrap::assign('pageDescription', $pageDescription);
}
// Ads
AdsModule::runAllModules(empty($lexems) ? null : $lexems, empty($definitions) ? null : $definitions);
SmartyWrap::assign('text', $text);
SmartyWrap::assign('searchType', $searchType);
SmartyWrap::assign('showParadigm', $showParadigm);
SmartyWrap::assign('locParadigm', session_user_prefers(Preferences::LOC_PARADIGM));
SmartyWrap::assign('paradigmLink', $paradigmLink);
SmartyWrap::assign('advancedSearch', $text || $sourceId);
/* Gallery */
$images = empty($lexems) ? array() : Visual::loadAllForLexems($lexems);
SmartyWrap::assign('images', $images);
if (count($images)) {
    SmartyWrap::addCss('gallery');
    SmartyWrap::addJs('gallery');
}
if (!$xml) {
    SmartyWrap::addCss('paradigm');
    SmartyWrap::display('search.tpl');
} else {
    header('Content-type: text/xml');
    SmartyWrap::displayWithoutSkin('xml/search.tpl');
}
if (Config::get('global.logSearch')) {
    $logDefinitions = isset($definitions) ? $definitions : array();
    $log = new Log($cuv, $redirectFrom, $searchType, $redirect, $logDefinitions);
    $log->logData();
开发者ID:florinp,项目名称:dexonline,代码行数:31,代码来源:search.php

示例13: array

if ($submitButton) {
    // Re-rank the inflections according to the order in $inflectionIds
    $modelTypeMap = array();
    foreach ($inflectionIds as $inflId) {
        $infl = Inflection::get_by_id($inflId);
        $rank = array_key_exists($infl->modelType, $modelTypeMap) ? $modelTypeMap[$infl->modelType] + 1 : 1;
        $modelTypeMap[$infl->modelType] = $rank;
        $infl->rank = $rank;
        $infl->save();
    }
    // Add a new inflection if one is given
    if ($newDescription) {
        $infl = Model::factory('Inflection')->create();
        $infl->description = $newDescription;
        $infl->modelType = $newModelType;
        $infl->rank = $modelTypeMap[$newModelType] + 1;
        $infl->save();
    }
    util_redirect('flexiuni');
}
// Tag inflections which can be safely deleted (only those that aren't being used by any model)
$inflections = Model::factory('Inflection')->order_by_asc('modelType')->order_by_asc('rank')->find_many();
$usedInflectionIds = db_getArray('select distinct inflectionId from ModelDescription');
foreach ($inflections as $infl) {
    $infl->canDelete = !in_array($infl->id, $usedInflectionIds);
}
SmartyWrap::assign('suggestHiddenSearchForm', true);
SmartyWrap::assign('inflections', $inflections);
SmartyWrap::assign('modelTypes', ModelType::loadCanonical());
SmartyWrap::addJs('jqTableDnd');
SmartyWrap::display('flexiuni.tpl');
开发者ID:florinp,项目名称:dexonline,代码行数:31,代码来源:flexiuni.php

示例14: util_getRequestParameter

if (!is_int($showSource) || $showSource != 1) {
    $showSource = DEFAULT_SHOW_LIST;
}
$noSkin = (int) util_getRequestParameter('k');
if (!is_int($noSkin) || $noSkin != 1) {
    $noSkin = DEFAULT_SHOW_LIST;
}
/*
$query = sprintf('select id from Lexem order by rand() limit %d', $listLength);
$ids = db_getArray($query);

$query = sprintf(RANDOM_WORDS_QUERY, $showSource?SOURCE_PART_RANDOM_WORDS:'', implode(",",$ids));
$forms = db_getArrayOfRows($query);
*/
$wotd = '';
if (is_null($wListLength)) {
    $query = sprintf(RANDOM_WORDS_QUERY, $showSource ? SOURCE_PART_RANDOM_WORDS : '', $listLength);
} else {
    $query = sprintf(RANDOM_WOTD_QUERY, $wListLength);
    $wotd = ' ale zilei';
}
$forms = db_getArrayOfRows($query);
$cnt = count($forms);
if ($noSkin) {
    SmartyWrap::assign('forms', $forms);
    SmartyWrap::displayWithoutSkin('randomWordListSimple.ihtml');
} else {
    SmartyWrap::assign('forms', $forms);
    SmartyWrap::assign('page_title', "O listă de {$cnt} de cuvinte{$wotd} alese la întâmplare.");
    SmartyWrap::display('randomWordList.ihtml');
}
开发者ID:Jobava,项目名称:mirror-dexonline,代码行数:31,代码来源:randomList.php

示例15: 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');
}
if (util_isModerator(PRIV_VIEW_HIDDEN)) {
    $sources = Model::factory('Source')->order_by_asc('displayOrder')->find_many();
} else {
    $sources = Model::factory('Source')->where_not_equal('isOfficial', SOURCE_TYPE_HIDDEN)->order_by_asc('displayOrder')->find_many();
}
SmartyWrap::assign('sources', $sources);
SmartyWrap::assign('page_title', 'Surse');
SmartyWrap::addCss('jqueryui');
SmartyWrap::addJs('jqueryui', 'jqTableDnd', 'tablesorter');
SmartyWrap::display('surse.ihtml');
开发者ID:Jobava,项目名称:mirror-dexonline,代码行数:26,代码来源:surse.php


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