本文整理汇总了PHP中Setting::getById方法的典型用法代码示例。如果您正苦于以下问题:PHP Setting::getById方法的具体用法?PHP Setting::getById怎么用?PHP Setting::getById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Setting
的用法示例。
在下文中一共展示了Setting::getById方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteSetting
function deleteSetting()
{
if (!($setting = Setting::getById((int) $_GET['settingId']))) {
header("Location: index.php?action=listSetting&error=settingNotFound");
return;
}
$setting->delete();
header("Location: index.php?action=listSetting&success=settingDeleted");
}
示例2: editSetting
function editSetting()
{
global $lang;
$page_lang = scandir('inc/lang/' . $_SESSION['language']);
foreach ($page_lang as $file) {
if ($file != '.' && $file != '..') {
$parts = explode(".", $file);
$page = $parts[0];
if ($page == 'setting') {
$page_file = $file;
}
}
}
include_once 'inc/lang/' . $_SESSION['language'] . '/' . $page_file;
if ($_SESSION['access']->settings > 1) {
$results = array();
$results['pageTitle'] = "Edit Setting";
$results['formAction'] = "editSetting";
if (isset($_POST['saveChanges'])) {
// User has posted the setting edit form: save the setting changes
if (!($setting = Setting::getById((int) $_POST['settingId']))) {
header("Location: index.php?error=settingNotFound");
return;
}
$setting->storeFormValues($_POST);
$setting->update();
header("Location: index.php?action=listSetting&success=changesSaved");
} elseif (isset($_POST['cancel'])) {
// User has cancelled their edits: return to the settings list
header("Location: index.php?action=listSetting");
} else {
// User has not posted the setting edit form yet: display the form
$results['setting'] = Setting::getById((int) $_GET['settingId']);
require "inc/layout/editSetting.php";
}
} else {
require "inc/layout/noAccess.php";
}
}
示例3: getById
static function getById($id)
{
return Setting::getById(USERDATA_OPTION, $id);
}
示例4: die
$page->disableDesign();
$user_id = $this->child;
$user = User::get($user_id);
if (!$user) {
die('ECHKKP');
}
echo '<h1>Info:' . $user->name . '</h1>';
if (UserHandler::isOnline($user_id)) {
echo 'Last active ' . ago($user->time_last_active) . '<br/>';
echo 'Otillgänglig för chat?: ' . UserSetting::get($user_id, 'chat_off') . '<br/>';
} else {
echo 'Offline<br/>';
}
echo 'User level: ' . UserHandler::getUserLevel($user_id) . '<br/>';
$gender_id = UserSetting::get($user_id, 'gender');
$gender = Setting::getById(USERDATA_OPTION, $gender_id);
echo 'Gender: ' . $gender . '<br/>';
$pres = UserSetting::get($user_id, 'presentation');
if ($pres) {
echo 'Presentation: ' . $pres . '<br/>';
}
$pic_id = UserSetting::get($user_id, 'picture');
if ($pic_id) {
echo 'Profile picture:<br/>';
$a = new XhtmlComponentA();
$a->href = getThumbUrl($pic_id, 0, 0);
$a->content = showThumb($pic_id, 'Profilbild', 150, 150);
echo $a->render();
} else {
$avatar_opt = UserSetting::get($user_id, 'avatar');
// get pic id from avatar_id