本文整理汇总了PHP中user_pref_get函数的典型用法代码示例。如果您正苦于以下问题:PHP user_pref_get函数的具体用法?PHP user_pref_get怎么用?PHP user_pref_get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了user_pref_get函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: edit_account_prefs
function edit_account_prefs($p_user_id = null, $p_error_if_protected = true, $p_accounts_menu = true, $p_redirect_url = '')
{
if (null === $p_user_id) {
$p_user_id = auth_get_current_user_id();
}
$t_redirect_url = $p_redirect_url;
if (is_blank($t_redirect_url)) {
$t_redirect_url = 'account_prefs_page.php';
}
# protected account check
if (user_is_protected($p_user_id)) {
if ($p_error_if_protected) {
trigger_error(ERROR_PROTECTED_ACCOUNT, ERROR);
} else {
return;
}
}
if (!user_pref_exists($p_user_id)) {
user_pref_set_default($p_user_id);
}
# prefix data with u_
$t_pref = user_pref_get($p_user_id);
# Account Preferences Form BEGIN
?>
<br />
<div align="center">
<form method="post" action="account_prefs_update.php">
<input type="hidden" name="user_id" value="<?php
echo $p_user_id;
?>
" />
<input type="hidden" name="redirect_url" value="<?php
echo $t_redirect_url;
?>
" />
<table class="width75" cellspacing="1">
<tr>
<td class="form-title">
<?php
echo lang_get('default_account_preferences_title');
?>
</td>
<td class="right">
<?php
if ($p_accounts_menu) {
print_account_menu('account_prefs_page.php');
}
?>
</td>
</tr>
<tr class="row-1">
<td class="category" width="50%">
<?php
echo lang_get('default_project');
?>
</td>
<td width="50%">
<select name="default_project">
<?php
print_project_option_list($t_pref->default_project);
?>
</select>
</td>
</tr>
<tr class="row-2">
<td class="category">
<?php
echo lang_get('advanced_report');
?>
</td>
<td>
<input type="checkbox" name="advanced_report" <?php
check_checked($t_pref->advanced_report, ON);
?>
/>
</td>
</tr>
<tr class="row-1">
<td class="category">
<?php
echo lang_get('advanced_view');
?>
</td>
<td>
<input type="checkbox" name="advanced_view" <?php
check_checked($t_pref->advanced_view, ON);
?>
/>
</td>
</tr>
<tr class="row-2">
<td class="category">
<?php
echo lang_get('advanced_update');
?>
</td>
<td>
<input type="checkbox" name="advanced_update" <?php
check_checked($t_pref->advanced_update, ON);
?>
//.........这里部分代码省略.........
开发者ID:amjadtbssm,项目名称:website,代码行数:101,代码来源:account_prefs_inc.php
示例2: user_pref_set_pref
/**
* Set a user preference
*
* By getting the prefs for the project first we deal fairly well with defaults.
* If there are currently no prefs for that project, the ALL_PROJECTS prefs will
* be returned so we end up storing a new set of prefs for the given project
* based on the prefs for ALL_PROJECTS. If there isn't even an entry for
* ALL_PROJECTS, we'd get returned a default UserPreferences object to modify.
* @param int $p_user_id
* @param string $p_pref_name
* @param string $p_pref_value
* @param int $p_project_id
* @return true
*/
function user_pref_set_pref( $p_user_id, $p_pref_name, $p_pref_value, $p_project_id = ALL_PROJECTS ) {
$t_prefs = user_pref_get( $p_user_id, $p_project_id );
$t_prefs->$p_pref_name = $p_pref_value;
user_pref_set( $p_user_id, $t_prefs, $p_project_id );
return true;
}
开发者ID:rombert,项目名称:mantisbt,代码行数:23,代码来源:user_pref_api.php
示例3: helper_get_current_project
/**
* Return the current project id as stored in a cookie
* If no cookie exists, the user's default project is returned
* @return int
*/
function helper_get_current_project()
{
global $g_project_override, $g_cache_current_project;
if ($g_project_override !== null) {
return $g_project_override;
}
if ($g_cache_current_project === null) {
$t_cookie_name = config_get('project_cookie');
$t_project_id = gpc_get_cookie($t_cookie_name, null);
if (null === $t_project_id) {
$t_pref = user_pref_get(auth_get_current_user_id(), ALL_PROJECTS, false);
$t_project_id = $t_pref->default_project;
} else {
$t_project_id = explode(';', $t_project_id);
$t_project_id = $t_project_id[count($t_project_id) - 1];
}
if (!project_exists($t_project_id) || 0 == project_get_field($t_project_id, 'enabled') || !access_has_project_level(VIEWER, $t_project_id)) {
$t_project_id = ALL_PROJECTS;
}
$g_cache_current_project = (int) $t_project_id;
}
return $g_cache_current_project;
}
开发者ID:nextgens,项目名称:mantisbt,代码行数:28,代码来源:helper_api.php
示例4: edit_account_prefs
/**
* Display html form to edit account preferences
*
* @param integer $p_user_id A valid user identifier.
* @param boolean $p_error_if_protected Whether to error if the account is protected.
* @param boolean $p_accounts_menu Display account preferences menu.
* @param string $p_redirect_url Redirect URI.
* @return void
*/
function edit_account_prefs($p_user_id = null, $p_error_if_protected = true, $p_accounts_menu = true, $p_redirect_url = '')
{
if (null === $p_user_id) {
$p_user_id = auth_get_current_user_id();
}
$t_redirect_url = $p_redirect_url;
if (is_blank($t_redirect_url)) {
$t_redirect_url = 'account_prefs_page.php';
}
# protected account check
if (user_is_protected($p_user_id)) {
if ($p_error_if_protected) {
trigger_error(ERROR_PROTECTED_ACCOUNT, ERROR);
} else {
return;
}
}
$t_pref = user_pref_get($p_user_id);
# Account Preferences Form BEGIN
?>
<div id="account-prefs-update-div" class="form-container">
<form id="account-prefs-update-form" method="post" action="account_prefs_update.php">
<fieldset>
<legend><span><?php
echo lang_get('default_account_preferences_title');
?>
</span></legend>
<?php
echo form_security_field('account_prefs_update');
?>
<input type="hidden" name="user_id" value="<?php
echo $p_user_id;
?>
" />
<input type="hidden" name="redirect_url" value="<?php
echo $t_redirect_url;
?>
" />
<?php
if ($p_accounts_menu) {
print_account_menu('account_prefs_page.php');
}
?>
<div class="field-container">
<label for="default-project-id"><span><?php
echo lang_get('default_project');
?>
</span></label>
<span class="select">
<select id="default-project-id" name="default_project">
<?php
# Count number of available projects
$t_projects = current_user_get_accessible_projects();
$t_num_proj = count($t_projects);
if ($t_num_proj == 1) {
$t_num_proj += count(current_user_get_accessible_subprojects($t_projects[0]));
}
# Don't display "All projects" in selection list if there is only 1
print_project_option_list((int) $t_pref->default_project, $t_num_proj != 1);
?>
</select>
</span>
<span class="label-style"></span>
</div>
<div class="field-container">
<label for="refresh-delay"><span><?php
echo lang_get('refresh_delay');
?>
</span></label>
<span class="input"><input id="refresh-delay" type="text" name="refresh_delay" size="4" maxlength="4" value="<?php
echo $t_pref->refresh_delay;
?>
" /> <?php
echo lang_get('minutes');
?>
</span>
<span class="label-style"></span>
</div>
<div class="field-container">
<label for="redirect-delay"><span><?php
echo lang_get('redirect_delay');
?>
</span></label>
<span class="input"><input id="redirect-delay" type="text" name="redirect_delay" size="4" maxlength="3" value="<?php
echo $t_pref->redirect_delay;
?>
" /> <?php
echo lang_get('seconds');
?>
</span>
//.........这里部分代码省略.........
开发者ID:gtn,项目名称:mantisbt,代码行数:101,代码来源:account_prefs_inc.php
示例5: gpc_get_string
$f_redirect_url = gpc_get_string('redirect_url');
user_ensure_exists($f_user_id);
$t_user = user_get_row($f_user_id);
# This page is currently called from the manage_* namespace and thus we
# have to allow authorised users to update the accounts of other users.
# TODO: split this functionality into manage_user_prefs_update.php
if (auth_get_current_user_id() != $f_user_id) {
access_ensure_global_level(config_get('manage_user_threshold'));
access_ensure_global_level($t_user['access_level']);
} else {
# Protected users should not be able to update the preferences of their
# user account. The anonymous user is always considered a protected
# user and hence will also not be allowed to update preferences.
user_ensure_unprotected($f_user_id);
}
$t_prefs = user_pref_get($f_user_id);
$t_prefs->redirect_delay = gpc_get_int('redirect_delay');
$t_prefs->refresh_delay = gpc_get_int('refresh_delay');
$t_prefs->default_project = gpc_get_int('default_project');
$t_lang = gpc_get_string('language');
if (lang_language_exists($t_lang)) {
$t_prefs->language = $t_lang;
}
$t_prefs->email_on_new = gpc_get_bool('email_on_new');
$t_prefs->email_on_assigned = gpc_get_bool('email_on_assigned');
$t_prefs->email_on_feedback = gpc_get_bool('email_on_feedback');
$t_prefs->email_on_resolved = gpc_get_bool('email_on_resolved');
$t_prefs->email_on_closed = gpc_get_bool('email_on_closed');
$t_prefs->email_on_reopened = gpc_get_bool('email_on_reopened');
$t_prefs->email_on_bugnote = gpc_get_bool('email_on_bugnote');
$t_prefs->email_on_status = gpc_get_bool('email_on_status');
开发者ID:fur81,项目名称:zofaxiopeu,代码行数:31,代码来源:account_prefs_update.php
示例6: user_pref_set_pref
/**
* Set a user preference
*
* By getting the prefs for the project first we deal fairly well with defaults.
* If there are currently no prefs for that project, the ALL_PROJECTS prefs will
* be returned so we end up storing a new set of prefs for the given project
* based on the prefs for ALL_PROJECTS. If there isn't even an entry for
* ALL_PROJECTS, we'd get returned a default UserPreferences object to modify.
* @param int $p_user_id
* @param string $p_pref_name
* @param string $p_pref_value
* @param int $p_project_id
* @return true
*/
function user_pref_set_pref($p_user_id, $p_pref_name, $p_pref_value, $p_project_id = ALL_PROJECTS)
{
$t_prefs = user_pref_get($p_user_id, $p_project_id);
if ($t_prefs->{$p_pref_name} != $p_pref_value) {
$t_prefs->{$p_pref_name} = $p_pref_value;
user_pref_set($p_user_id, $t_prefs, $p_project_id);
}
return true;
}
开发者ID:Tarendai,项目名称:spring-website,代码行数:23,代码来源:user_pref_api.php
示例7: user_pref_set_pref
function user_pref_set_pref($p_user_id, $p_pref_name, $p_pref_value, $p_project_id = ALL_PROJECTS)
{
$c_user_id = db_prepare_int($p_user_id);
$c_pref_name = db_prepare_string($p_pref_name);
$c_pref_value = db_prepare_string($p_pref_value);
$c_project_id = db_prepare_int($p_project_id);
$t_prefs = user_pref_get($p_user_id, $p_project_id);
$t_prefs->{$p_pref_name} = $p_pref_value;
user_pref_set($p_user_id, $t_prefs, $p_project_id);
return true;
}
开发者ID:amjadtbssm,项目名称:website,代码行数:11,代码来源:user_pref_api.php
示例8: plugin_file
' />
<link rel='stylesheet' type='text/css' href='<?php
echo plugin_file('bower/fullcalendar/dist/fullcalendar.print.css');
?>
' media='print' />
<script type='text/javascript' src='<?php
echo plugin_file('bower/fullcalendar/dist/fullcalendar.min.js');
?>
'></script>
<?php
// Récupération du projet et de l'utilisateur courant et de ses droits
$t_user_id = auth_get_current_user_id();
$t_user_access_level = current_user_get_access_level();
$t_project_id = helper_get_current_project();
//Récupération du code d'affichage de la langue si l'utilisateur est identifié
$t_pref = user_pref_get($t_user_id);
$codeLang = AgendaPlugin::getFullCalendarLocaleCode($t_pref->language);
?>
<script type='text/javascript' src='<?php
echo plugin_file('bower/fullcalendar/dist/lang/' . $codeLang . '.js');
?>
'></script>
<!-- MantisAgenda Resources -->
<script type='text/javascript' src='<?php
echo plugin_file('fullcalendar_init.js');
?>
'></script>
<link rel='stylesheet' type='text/css' href='<?php
echo plugin_file('mantisagenda.css');
?>
开发者ID:nenes25,项目名称:mantisbt_agenda,代码行数:31,代码来源:Agenda_page.php
示例9: edit_account_prefs
function edit_account_prefs($p_user_id = null, $p_error_if_protected = true, $p_accounts_menu = true, $p_redirect_url = '')
{
if (null === $p_user_id) {
$p_user_id = auth_get_current_user_id();
}
$t_redirect_url = $p_redirect_url;
if (is_blank($t_redirect_url)) {
$t_redirect_url = 'account_prefs_page.php';
}
# protected account check
if (user_is_protected($p_user_id)) {
if ($p_error_if_protected) {
trigger_error(ERROR_PROTECTED_ACCOUNT, ERROR);
} else {
return;
}
}
# prefix data with u_
$t_pref = user_pref_get($p_user_id);
# Account Preferences Form BEGIN
?>
<br />
<div align="center">
<form method="post" action="account_prefs_update.php">
<?php
echo form_security_field('account_prefs_update');
?>
<input type="hidden" name="user_id" value="<?php
echo $p_user_id;
?>
" />
<input type="hidden" name="redirect_url" value="<?php
echo $t_redirect_url;
?>
" />
<table class="width75" cellspacing="1">
<tr>
<td class="form-title">
<?php
echo lang_get('default_account_preferences_title');
?>
</td>
<td class="right">
<?php
if ($p_accounts_menu) {
print_account_menu('account_prefs_page.php');
}
?>
</td>
</tr>
<tr <?php
echo helper_alternate_class();
?>
>
<td class="category" width="50%">
<?php
echo lang_get('default_project');
?>
</td>
<td width="50%">
<select name="default_project">
<?php
# Count number of available projects
$t_projects = current_user_get_accessible_projects();
$t_num_proj = count($t_projects);
if ($t_num_proj == 1) {
$t_num_proj += count(current_user_get_accessible_subprojects($t_projects[0]));
}
# Don't display "All projects" in selection list if there is only 1
print_project_option_list($t_pref->default_project, $t_num_proj != 1);
?>
</select>
</td>
</tr>
<tr <?php
echo helper_alternate_class();
?>
>
<td class="category">
<?php
echo lang_get('refresh_delay');
?>
</td>
<td>
<input type="text" name="refresh_delay" size="4" maxlength="4" value="<?php
echo $t_pref->refresh_delay;
?>
" /> <?php
echo lang_get('minutes');
?>
</td>
</tr>
<tr <?php
echo helper_alternate_class();
?>
>
<td class="category">
<?php
echo lang_get('redirect_delay');
?>
//.........这里部分代码省略.........
开发者ID:Tarendai,项目名称:spring-website,代码行数:101,代码来源:account_prefs_inc.php
注:本文中的user_pref_get函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论