本文整理汇总了PHP中SmartyWrap::display方法的典型用法代码示例。如果您正苦于以下问题:PHP SmartyWrap::display方法的具体用法?PHP SmartyWrap::display怎么用?PHP SmartyWrap::display使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SmartyWrap
的用法示例。
在下文中一共展示了SmartyWrap::display方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: util_redirect
}
}
}
}
if ($error) {
FlashMessage::add($error);
util_redirect(util_getWwwRoot() . 'preferinte');
}
$user = session_getUser();
if (!$user) {
FlashMessage::add('Nu puteți alege o imagine de profil dacă nu sunteți autentificat.');
util_redirect(util_getWwwRoot());
}
// Remove any old files (with different extensions)
$oldFiles = glob(util_getRootPath() . "wwwbase/img/user/{$user->id}_raw.*");
foreach ($oldFiles as $oldFile) {
unlink($oldFile);
}
$ext = pathinfo($file['name'], PATHINFO_EXTENSION);
$destFileName = util_getRootPath() . "wwwbase/img/user/{$user->id}_raw.{$ext}";
if (!move_uploaded_file($file['tmp_name'], $destFileName)) {
FlashMessage::add('A intervenit o eroare la copierea fișierului.');
util_redirect(util_getWwwRoot() . 'preferinte');
}
chmod($destFileName, 0666);
SmartyWrap::addCss('jcrop');
SmartyWrap::addJs('jcrop');
SmartyWrap::assign('page_title', "Editarea pozei de profil");
SmartyWrap::assign('rawFileName', "{$user->id}_raw.{$ext}");
SmartyWrap::display('editare-avatar.ihtml');
示例2: count
$user->email = StringUtil::scrambleEmail($user->email);
// Find the rank of this user by number of words and number of characters
$topWords = TopEntry::getTopData(CRIT_WORDS, SORT_DESC, true);
$numUsers = count($topWords);
$rankWords = 0;
while ($rankWords < $numUsers && $topWords[$rankWords]->userNick != $nick) {
$rankWords++;
}
$userData['rank_words'] = $rankWords + 1;
if ($rankWords < $numUsers) {
$topEntry = $topWords[$rankWords];
$userData['last_submission'] = $topEntry->timestamp;
$userData['num_words'] = $topEntry->numDefinitions;
$userData['num_chars'] = $topEntry->numChars;
}
$topChars = TopEntry::getTopData(CRIT_CHARS, SORT_DESC, true);
$numUsers = count($topChars);
$rankChars = 0;
while ($rankChars < $numUsers && $topChars[$rankChars]->userNick != $nick) {
$rankChars++;
}
$userData['rank_chars'] = $rankChars + 1;
SmartyWrap::assign('medals', Medal::loadForUser($user));
if (util_isModerator(PRIV_ADMIN)) {
// Admins can grant/revoke medals
SmartyWrap::assign('allMedals', Medal::$DATA);
}
SmartyWrap::assign('user', $user);
SmartyWrap::assign('userData', $userData);
SmartyWrap::display('user.tpl');
示例3: util_getRequestParameter
<?php
require_once "../phplib/util.php";
$form = util_getRequestParameter('form');
$locVersion = util_getRequestParameter('locVersion');
$locVersions = Config::getLocVersions();
if (!util_isModerator(PRIV_LOC)) {
$locVersions = array_slice($locVersions, 1);
// remove the version in progress
}
if ($locVersion && $form) {
LocVersion::changeDatabase($locVersion);
$form = StringUtil::cleanupQuery($form);
$field = StringUtil::hasDiacritics($form) ? 'formNoAccent' : 'formUtf8General';
$data = Model::factory('InflectedForm')->table_alias('I')->select('I.form', 'inflectedForm')->select('L.formNoAccent', 'lexemFormNoAccent')->select('L.form', 'lexemForm')->select('LM.modelType', 'modelType')->select('LM.modelNumber', 'modelNumber')->select('LM.restriction', 'restriction')->select('Infl.description', 'inflection')->join('LexemModel', 'I.lexemModelId = LM.id', 'LM')->join('Lexem', 'LM.lexemId = L.id', 'L')->join('ModelType', 'LM.modelType = MT.code', 'MT')->join('Model', 'MT.canonical = M.modelType and LM.modelNumber = M.number', 'M')->join('ModelDescription', 'M.id = MD.modelId and I.variant = MD.variant and I.inflectionId = MD.inflectionId', 'MD')->join('Inflection', 'I.inflectionId = Infl.id', 'Infl')->where('MD.applOrder', 0)->where("I.{$field}", $form)->where('LM.isLoc', 1)->where('MD.isLoc', 1)->order_by_asc('LM.lexemId')->find_array();
SmartyWrap::assign('page_title', 'Verificare LOC: ' . $form);
SmartyWrap::assign('form', $form);
SmartyWrap::assign('selectedLocVersion', $locVersion);
SmartyWrap::assign('data', $data);
} else {
SmartyWrap::assign('selectedLocVersion', $locVersions[0]->name);
SmartyWrap::assign('page_title', 'Căutare formă flexionară în LOC ' . $form);
}
SmartyWrap::addJs('modelDropdown');
SmartyWrap::assign('suggestHiddenSearchForm', true);
SmartyWrap::assign('page_title', 'Scrabble');
SmartyWrap::assign('locVersions', $locVersions);
SmartyWrap::display('scrabble.ihtml');
示例4: strtotime
// Always use the first of the month
$timestamp = $date ? strtotime($date) : time();
$mysqlDate = date("Y-m-01", $timestamp);
if ($mysqlDate < WOTM_BIG_BANG || $mysqlDate > $today && !util_isModerator(PRIV_ADMIN)) {
util_redirect(util_getWwwRoot() . 'cuvantul-lunii');
}
$wotm = WordOfTheMonth::getWotM($mysqlDate);
$def = Definition::get_by_id($wotm->definitionId);
if ($type == 'url') {
SmartyWrap::assign('today', $today);
SmartyWrap::assign('title', $def->lexicon);
SmartyWrap::displayWithoutSkin('bits/wotmurl.tpl');
exit;
}
$searchResults = SearchResult::mapDefinitionArray(array($def));
$cYear = date('Y', $timestamp);
$cMonth = date('n', $timestamp);
$nextTS = mktime(0, 0, 0, $cMonth + 1, 1, $cYear);
$prevTS = mktime(0, 0, 0, $cMonth - 1, 1, $cYear);
if ($mysqlDate > WOTM_BIG_BANG) {
SmartyWrap::assign('prevmon', date('Y/m', $prevTS));
}
if ($mysqlDate < $today || util_isModerator(PRIV_ADMIN)) {
SmartyWrap::assign('nextmon', date('Y/m', $nextTS));
}
SmartyWrap::assign('imageUrl', $wotm->getImageUrl());
SmartyWrap::assign('artist', $wotm->getArtist());
SmartyWrap::assign('timestamp', $timestamp);
SmartyWrap::assign('searchResult', array_pop($searchResults));
SmartyWrap::display('wotm.tpl');
示例5: 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');
}
示例6: util_getRequestParameter
<?php
require_once "../phplib/util.php";
$type = util_getRequestParameter('t');
if ($type == 'rss') {
$articles = WikiArticle::getRss();
$results = array();
foreach ($articles as $a) {
$results[] = array('title' => $a->title, 'description' => $a->htmlContents, 'pubDate' => date('D, d M Y H:i:s', $a->modDate) . ' EEST', 'link' => sprintf("http://%s/articol/%s", $_SERVER['HTTP_HOST'], $a->getUrlTitle()));
}
header("Content-type: application/rss+xml");
SmartyWrap::assign('rss_title', 'Articole lingvistice - dexonline');
SmartyWrap::assign('rss_link', 'http://' . $_SERVER['HTTP_HOST'] . '/rss/articole/');
SmartyWrap::assign('rss_description', 'Articole pe teme lingvistice de la dexonline');
SmartyWrap::assign('rss_pubDate', date('D, d M Y H:i:s') . ' EEST');
SmartyWrap::assign('results', $results);
SmartyWrap::displayWithoutSkin('xml/rss.tpl');
exit;
}
SmartyWrap::assign('wikiTitles', WikiArticle::loadAllTitles());
SmartyWrap::display('articole.tpl');
示例7: set_time_limit
require_once "../../phplib/util.php";
set_time_limit(0);
// If no GET arguments are set, print usage and return.
if (count($_GET) == 0) {
SmartyWrap::addCss('polar');
SmartyWrap::displayWithoutSkin('update3Instructions.tpl');
return;
}
util_enforceGzipEncoding();
header('Content-type: text/xml');
$export = util_getRequestParameter('export');
$timestamp = util_getRequestIntParameter('timestamp');
$version = util_getRequestParameterWithDefault('version', '3.0');
if ($export && util_isDesktopBrowser() && !session_getUser()) {
SmartyWrap::display('bits/updateError.tpl');
exit;
}
if ($export == 'sources') {
SmartyWrap::assign('sources', Model::factory('Source')->find_many());
SmartyWrap::displayWithoutSkin('xml/update3Sources.tpl');
} else {
if ($export == 'inflections') {
SmartyWrap::assign('inflections', Model::factory('Inflection')->order_by_asc('id')->find_many());
SmartyWrap::displayWithoutSkin('xml/update3Inflections.tpl');
} else {
if ($export == 'abbrev') {
SmartyWrap::assign('abbrev', AdminStringUtil::loadRawAbbreviations());
SmartyWrap::displayWithoutSkin('xml/update3Abbrev.tpl');
} else {
if ($export == 'definitions') {
示例8: setlocale
<?php
require_once "../phplib/util.php";
setlocale(LC_ALL, "ro_RO.utf8");
SmartyWrap::addCss('mill');
SmartyWrap::addJs('mill');
SmartyWrap::display("mill.tpl");
示例9: util_redirect
FlashMessage::add('Date incorecte');
util_redirect('scrabble');
}
LocVersion::changeDatabase($locVersion);
$models = FlexModel::loadByType($modelType->code);
$lexemModels = array();
foreach ($models as $m) {
$lexemModels[] = getLexemModel($m->exponent, $modelType->code, $m->number);
}
SmartyWrap::addCss('paradigm');
SmartyWrap::assign('page_title', 'Modele de flexiune');
SmartyWrap::assign('models', $models);
SmartyWrap::assign('lexemModels', $lexemModels);
SmartyWrap::assign('locVersion', $locVersion);
SmartyWrap::assign('modelType', $modelType);
SmartyWrap::display('modele-flexiune.ihtml');
/*************************************************************************/
/**
* Returns a LexemModel for a given word and model. Creates one if one doesn't exist.
**/
function getLexemModel($form, $modelType, $modelNumber)
{
// Load by canonical model, so if $modelType is V, look for a lexem with type V or VT.
$lm = Model::factory('LexemModel')->table_alias('lm')->select('lm.*')->join('Lexem', 'l.id = lm.lexemId', 'l')->join('ModelType', 'modelType = code', 'mt')->where('mt.canonical', $modelType)->where('lm.modelNumber', $modelNumber)->where('l.form', $form)->limit(1)->find_one();
if ($lm) {
$lm->loadInflectedFormMap();
} else {
$l = Lexem::deepCreate($form, $modelType, $modelNumber);
$lm = $l->getFirstLexemModel();
$lm->generateInflectedFormMap();
}
示例10: count
$definition->abbrevReview = count($ambiguousMatches) ? ABBREV_AMBIGUOUS : ABBREV_REVIEW_COMPLETE;
$definition->save();
log_userLog("Added definition {$definition->id} ({$definition->lexicon})");
foreach ($lexemIds as $lexemId) {
$lexemId = addslashes(AdminStringUtil::formatLexem($lexemId));
if (StringUtil::startsWith($lexemId, '@')) {
// create a new lexem
$lexem = Lexem::deepCreate(substr($lexemId, 1), 'T', '1');
$lexem->deepSave();
LexemDefinitionMap::associate($lexem->id, $definition->id);
log_userLog("Created lexem {$lexem->id} ({$lexem->form})");
} else {
$lexem = Lexem::get_by_id($lexemId);
LexemDefinitionMap::associate($lexem->id, $definition->id);
log_userLog("Associating with lexem {$lexem->id} ({$lexem->form})");
}
}
FlashMessage::add('Definiția a fost trimisă. Un moderator o va examina în scurt timp. Vă mulțumim!', 'info');
util_redirect('contribuie');
}
} else {
SmartyWrap::assign('sourceId', session_getDefaultContribSourceId());
}
SmartyWrap::assign('lexemIds', $lexemIds);
SmartyWrap::assign('contribSources', Model::factory('Source')->where('canContribute', true)->order_by_asc('displayOrder')->find_many());
SmartyWrap::assign('page_title', 'Contribuie cu definiții');
SmartyWrap::assign('suggestNoBanner', true);
SmartyWrap::addCss('jqueryui', 'select2');
SmartyWrap::addJs('jqueryui', 'select2', 'select2Dev');
SmartyWrap::display('contribuie.ihtml');
/**************************************************************************/
示例11: array
$lexemCounts = array();
$canDelete = array();
foreach ($modelTypes as $mt) {
$numLexems = Model::factory('LexemModel')->where('modelType', $mt->code)->count();
$numDependants = Model::factory('ModelType')->where('canonical', $mt->code)->count();
$modelCounts[] = Model::factory('FlexModel')->where('modelType', $mt->code)->count();
$lexemCounts[] = $numLexems;
$canDelete[] = $numLexems == 0 && $numDependants <= 1;
}
SmartyWrap::assign('canonicalModelTypes', ModelType::loadCanonical());
SmartyWrap::assign('modelTypes', $modelTypes);
SmartyWrap::assign('modelCounts', $modelCounts);
SmartyWrap::assign('lexemCounts', $lexemCounts);
SmartyWrap::assign('canDelete', $canDelete);
SmartyWrap::assign('showAddForm', $showAddForm);
SmartyWrap::display('tipuri-modele.tpl');
/***************************************************************************/
function validateAdd($mt)
{
if (!$mt->code) {
FlashMessage::add('Codul nu poate fi vid.');
}
if (ModelType::get_by_code($mt->code)) {
FlashMessage::add("Codul '{$mt->code}' este deja folosit.");
}
if (!$mt->description) {
FlashMessage::add('Descrierea nu poate fi vidă. Ea trebuie să indice partea de vorbire și este vizibilă la afișarea paradigmelor.');
}
return FlashMessage::getMessage() == null;
}
function validateEdit($mt)
示例12: util_getRequestParameter
$deleteId = util_getRequestParameter('deleteId');
$submitButton = util_getRequestParameter('submitButton');
if ($deleteId) {
$mt = MeaningTag::get_by_id($deleteId);
$mtms = MeaningTagMap::get_all_by_meaningTagId($mt->id);
if (count($mtms)) {
FlashMessage::add("Nu pot șterge eticheta «{$mt->value}», deoarece unele sensuri o folosesc.", 'error');
} else {
$mt->delete();
FlashMessage::add("Am șters eticheta «{$mt->value}».", 'info');
}
util_redirect('etichete-sensuri');
}
if ($submitButton) {
util_assertModerator(PRIV_ADMIN);
$values = explode(',', $value);
foreach ($values as $value) {
$value = trim($value);
if ($value && !MeaningTag::get_by_value($value)) {
$mt = Model::factory('MeaningTag')->create();
$mt->value = $value;
$mt->save();
}
}
FlashMessage::add('Etichetele au fost salvate.', 'info');
util_redirect('etichete-sensuri');
}
$meaningTags = Model::factory('MeaningTag')->order_by_asc('value')->find_many();
SmartyWrap::assign('meaningTags', $meaningTags);
SmartyWrap::display('etichete-sensuri.tpl');
示例13: count
$definition->lexicon = AdminStringUtil::extractLexicon($definition);
$definition->abbrevReview = count($ambiguousMatches) ? ABBREV_AMBIGUOUS : ABBREV_REVIEW_COMPLETE;
$definition->save();
log_userLog("Added definition {$definition->id} ({$definition->lexicon})");
foreach ($lexemIds as $lexemId) {
$lexemId = addslashes(AdminStringUtil::formatLexem($lexemId));
if (StringUtil::startsWith($lexemId, '@')) {
// create a new lexem
$lexem = Lexem::deepCreate(substr($lexemId, 1), 'T', '1');
$lexem->deepSave();
LexemDefinitionMap::associate($lexem->id, $definition->id);
log_userLog("Created lexem {$lexem->id} ({$lexem->form})");
} else {
$lexem = Lexem::get_by_id($lexemId);
LexemDefinitionMap::associate($lexem->id, $definition->id);
log_userLog("Associating with lexem {$lexem->id} ({$lexem->form})");
}
}
FlashMessage::add('Definiția a fost trimisă. Un moderator o va examina în scurt timp. Vă mulțumim!', 'info');
util_redirect('contribuie');
}
} else {
SmartyWrap::assign('sourceId', session_getDefaultContribSourceId());
}
SmartyWrap::assign('lexemIds', $lexemIds);
SmartyWrap::assign('contribSources', Model::factory('Source')->where('canContribute', true)->order_by_asc('displayOrder')->find_many());
SmartyWrap::assign('suggestNoBanner', true);
SmartyWrap::addCss('jqueryui', 'select2');
SmartyWrap::addJs('jqueryui', 'select2', 'select2Dev');
SmartyWrap::display('contribuie.tpl');
/**************************************************************************/
示例14: util_redirect
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}");
}
}
SmartyWrap::assign('src', $src);
SmartyWrap::assign('page_title', $sourceId ? "Editare sursă {$src->shortName}" : "Adăugare sursă");
SmartyWrap::addCss('jqueryui');
SmartyWrap::addJs('jqueryui');
SmartyWrap::display('editare-sursa.ihtml');
/**
* Returns true on success, false on errors.
*/
function validate($src)
{
$success = true;
if (!$src->name) {
FlashMessage::add('Numele nu poate fi vid.');
$success = false;
}
if (!$src->shortName) {
FlashMessage::add('Numele scurt nu poate fi vid.');
$success = false;
}
if (!$src->urlName) {
示例15: util_getRequestParameter
$submitButton = util_getRequestParameter('submitButton');
if ($deleteId) {
$mt = MeaningTag::get_by_id($deleteId);
$mtms = MeaningTagMap::get_all_by_meaningTagId($mt->id);
if (count($mtms)) {
FlashMessage::add("Nu pot șterge eticheta «{$mt->value}», deoarece unele sensuri o folosesc.", 'error');
} else {
$mt->delete();
FlashMessage::add("Am șters eticheta «{$mt->value}».", 'info');
}
util_redirect('etichete-sensuri');
}
if ($submitButton) {
util_assertModerator(PRIV_ADMIN);
$values = explode(',', $value);
foreach ($values as $value) {
$value = trim($value);
if ($value && !MeaningTag::get_by_value($value)) {
$mt = Model::factory('MeaningTag')->create();
$mt->value = $value;
$mt->save();
}
}
FlashMessage::add('Etichetele au fost salvate.', 'info');
util_redirect('etichete-sensuri');
}
$meaningTags = Model::factory('MeaningTag')->order_by_asc('value')->find_many();
SmartyWrap::assign('meaningTags', $meaningTags);
SmartyWrap::assign('page_title', 'Etichete pentru sensuri');
SmartyWrap::display('etichete-sensuri.ihtml');