本文整理汇总了PHP中Preferences::getWidgets方法的典型用法代码示例。如果您正苦于以下问题:PHP Preferences::getWidgets方法的具体用法?PHP Preferences::getWidgets怎么用?PHP Preferences::getWidgets使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Preferences
的用法示例。
在下文中一共展示了Preferences::getWidgets方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: function
<?php
require_once "../phplib/util.php";
require_once "../phplib/ads/adsModule.php";
// Display a custom ad 50% of the times
if (rand(0, 99) < 50) {
AdsModule::runAllModules(null, null);
}
$widgets = Preferences::getWidgets(session_getUser());
$numEnabledWidgets = array_reduce($widgets, function ($result, $w) {
return $result + $w['enabled'];
});
$wordCount = Definition::getWordCount();
$wordCountRough = $wordCount - $wordCount % 10000;
SmartyWrap::assign('page_title', 'Dicționar explicativ al limbii române');
SmartyWrap::assign('onHomePage', '1');
SmartyWrap::assign('letters', preg_split('//u', 'aăâbcdefghiîjklmnopqrsștțuvwxyz'));
SmartyWrap::assign('words_total', util_formatNumber($wordCount, 0));
SmartyWrap::assign('words_rough', util_formatNumber($wordCountRough, 0));
SmartyWrap::assign('words_last_month', util_formatNumber(Definition::getWordCountLastMonth(), 0));
SmartyWrap::assign('widgets', $widgets);
SmartyWrap::assign('numEnabledWidgets', $numEnabledWidgets);
/* WotD part */
$wotd = WordOfTheDay::getTodaysWord();
if (!$wotd) {
WordOfTheDay::updateTodaysWord();
$wotd = WordOfTheDay::getTodaysWord();
}
$defId = WordOfTheDayRel::getRefId($wotd->id);
$def = Model::factory('Definition')->where('id', $defId)->where('status', ST_ACTIVE)->find_one();
SmartyWrap::assign('thumbUrl', $wotd->getThumbUrl());
示例2: util_getRequestParameter
<?php
require_once "../phplib/util.php";
$sendButton = util_getRequestParameter('send');
$user = session_getUser();
if ($sendButton) {
$detailsVisible = util_getRequestParameterWithDefault('detailsVisible', 0);
$userPrefs = util_getRequestCheckboxArray('userPrefs', ',');
$skin = util_getRequestParameter('skin');
$widgets = util_getRequestParameter('widgets');
Preferences::set($user, $detailsVisible, $userPrefs, $skin, array_sum($widgets));
FlashMessage::add('Preferințele au fost salvate.', 'info');
util_redirect('preferinte');
}
$detailsVisible = Preferences::getDetailsVisible($user);
$userPrefs = Preferences::getUserPrefs($user);
$skin = Preferences::getSkin($user);
$widgets = Preferences::getWidgets($user);
SmartyWrap::assign('detailsVisible', $detailsVisible);
SmartyWrap::assign('userPrefs', $userPrefs);
SmartyWrap::assign('skin', $skin);
SmartyWrap::assign('availableSkins', Config::get('global.skins'));
SmartyWrap::assign('privilegeNames', $PRIV_NAMES);
SmartyWrap::assign('widgets', $widgets);
SmartyWrap::display('preferinte.tpl');