本文整理汇总了PHP中UserService::get_level_lang方法的典型用法代码示例。如果您正苦于以下问题:PHP UserService::get_level_lang方法的具体用法?PHP UserService::get_level_lang怎么用?PHP UserService::get_level_lang使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserService
的用法示例。
在下文中一共展示了UserService::get_level_lang方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: build_view
private function build_view($group_id)
{
if (!empty($group_id)) {
$group = $this->groups_cache->get_group($group_id);
$this->view->put_all(array('C_ADMIN' => AppContext::get_current_user()->check_level(User::ADMIN_LEVEL), 'U_ADMIN_GROUPS' => TPL_PATH_TO_ROOT . '/admin/admin_groups.php?id=' . $group_id, 'GROUP_NAME' => $group['name']));
} else {
$this->view->put_all(array('GROUP_NAME' => $this->lang['groups']));
}
$user_accounts_config = UserAccountsConfig::load();
$number_member = 0;
foreach ($this->get_members_group($group_id) as $user_id) {
if (!empty($user_id)) {
$user = PersistenceContext::get_querier()->select('SELECT
member.display_name, member.level, member.groups, member.warning_percentage, member.delay_banned, ext_field.user_avatar
FROM ' . DB_TABLE_MEMBER . ' member
LEFT JOIN ' . DB_TABLE_MEMBER_EXTENDED_FIELDS . ' ext_field ON ext_field.user_id = member.user_id
WHERE member.user_id = :user_id
', array('user_id' => $user_id))->fetch();
if (!empty($user)) {
//Avatar
$user_avatar = !empty($user['user_avatar']) ? Url::to_rel($user['user_avatar']) : ($user_accounts_config->is_default_avatar_enabled() ? Url::to_rel('/templates/' . AppContext::get_current_user()->get_theme() . '/images/' . $user_accounts_config->get_default_avatar_name()) : '');
$group_color = User::get_group_color($user['groups'], $user['level']);
$this->view->assign_block_vars('members_list', array('C_AVATAR' => $user['user_avatar'] || $user_accounts_config->is_default_avatar_enabled(), 'C_GROUP_COLOR' => !empty($group_color), 'PSEUDO' => $user['display_name'], 'LEVEL' => $user['warning_percentage'] < '100' || time() - $user['delay_banned'] < 0 ? UserService::get_level_lang($user['level']) : $this->lang['banned'], 'LEVEL_CLASS' => UserService::get_level_class($user['level']), 'GROUP_COLOR' => $group_color, 'U_PROFILE' => UserUrlBuilder::profile($user_id)->rel(), 'U_AVATAR' => $user_avatar));
$number_member++;
}
}
}
$this->view->put_all(array('C_NOT_MEMBERS' => $number_member == 0, 'SELECT_GROUP' => $this->build_form($group_id)->display()));
}
示例2: build_view
public function build_view()
{
$active_sessions_start_time = time() - SessionsConfig::load()->get_active_session_duration();
$number_users_online = OnlineService::get_number_users_connected('WHERE user_id <> -1 AND timestamp > :time', array('time' => $active_sessions_start_time));
$pagination = $this->get_pagination($number_users_online);
$users = OnlineService::get_online_users('WHERE s.user_id <> -1 AND s.timestamp > :time
ORDER BY ' . $this->config->get_display_order_request() . '
LIMIT :number_items_per_page OFFSET :display_from', array('number_items_per_page' => $pagination->get_number_items_per_page(), 'display_from' => $pagination->get_display_from(), 'time' => $active_sessions_start_time));
foreach ($users as $user) {
if ($user->get_id() == AppContext::get_current_user()->get_id()) {
$user->set_location_script(OnlineUrlBuilder::home()->rel());
$user->set_location_title($this->lang['online']);
$user->set_last_update(new Date());
}
$group_color = User::get_group_color($user->get_groups(), $user->get_level(), true);
if ($user->get_level() != User::VISITOR_LEVEL) {
$this->view->assign_block_vars('users', array('C_AVATAR' => $user->has_avatar(), 'C_GROUP_COLOR' => !empty($group_color), 'PSEUDO' => $user->get_display_name(), 'LEVEL' => UserService::get_level_lang($user->get_level()), 'LEVEL_CLASS' => UserService::get_level_class($user->get_level()), 'GROUP_COLOR' => $group_color, 'TITLE_LOCATION' => $user->get_location_title(), 'LAST_UPDATE' => $user->get_last_update()->format(Date::FORMAT_DAY_MONTH_YEAR_HOUR_MINUTE), 'U_PROFILE' => UserUrlBuilder::profile($user->get_id())->rel(), 'U_LOCATION' => $user->get_location_script(), 'U_AVATAR' => $user->get_avatar()));
}
}
$this->view->put_all(array('C_PAGINATION' => $pagination->has_several_pages(), 'C_USERS' => count($users), 'PAGINATION' => $pagination->display()));
return $this->view;
}
示例3: build_table
private function build_table()
{
$number_admins = UserService::count_admin_members();
$table_model = new SQLHTMLTableModel(DB_TABLE_MEMBER, 'table', array(new HTMLTableColumn($this->lang['display_name'], 'display_name'), new HTMLTableColumn($this->lang['level'], 'level'), new HTMLTableColumn($this->lang['email']), new HTMLTableColumn($this->lang['registration_date'], 'registration_date'), new HTMLTableColumn($this->lang['last_connection'], 'last_connection_date'), new HTMLTableColumn($this->lang['approbation'], 'approved'), new HTMLTableColumn('')), new HTMLTableSortingRule('display_name', HTMLTableSortingRule::ASC));
$table = new HTMLTable($table_model);
$table_model->set_caption(LangLoader::get_message('members.members-management', 'admin-user-common'));
$results = array();
$result = $table_model->get_sql_results('m LEFT JOIN ' . DB_TABLE_INTERNAL_AUTHENTICATION . ' ia ON ia.user_id = m.user_id');
foreach ($result as $row) {
$user = new User();
$user->set_properties($row);
$edit_link = new LinkHTMLElement(UserUrlBuilder::edit_profile($user->get_id()), '', array('title' => LangLoader::get_message('edit', 'common')), 'fa fa-edit');
if ($user->get_level() != User::ADMIN_LEVEL || $user->get_level() == User::ADMIN_LEVEL && $number_admins > 1) {
$delete_link = new LinkHTMLElement(AdminMembersUrlBuilder::delete($user->get_id()), '', array('title' => LangLoader::get_message('delete', 'common'), 'data-confirmation' => 'delete-element'), 'fa fa-delete');
} else {
$delete_link = new LinkHTMLElement('', '', array('title' => LangLoader::get_message('delete', 'common'), 'onclick' => 'return false;'), 'fa fa-delete icon-disabled');
}
$user_group_color = User::get_group_color($user->get_groups(), $user->get_level(), true);
$results[] = new HTMLTableRow(array(new HTMLTableRowCell(new LinkHTMLElement(UserUrlBuilder::profile($user->get_id()), $user->get_display_name(), !empty($user_group_color) ? array('style' => 'color: ' . $user_group_color) : array(), UserService::get_level_class($user->get_level()))), new HTMLTableRowCell(UserService::get_level_lang($user->get_level())), new HTMLTableRowCell(new LinkHTMLElement('mailto:' . $user->get_email(), $this->lang['email'], array(), 'basic-button smaller')), new HTMLTableRowCell(Date::to_format($row['registration_date'], Date::FORMAT_DAY_MONTH_YEAR)), new HTMLTableRowCell(!empty($row['last_connection_date']) ? Date::to_format($row['last_connection_date'], Date::FORMAT_DAY_MONTH_YEAR) : LangLoader::get_message('never', 'main')), new HTMLTableRowCell($row['approved'] ? LangLoader::get_message('yes', 'common') : LangLoader::get_message('no', 'common')), new HTMLTableRowCell($edit_link->display() . $delete_link->display())));
}
$table->set_rows($table_model->get_number_of_matching_rows(), $results);
$this->view->put_all(array('FORM' => $this->build_form()->display(), 'table' => $table->display()));
}
示例4: get_level_lang
private function get_level_lang()
{
if (!$this->user->is_banned()) {
return UserService::get_level_lang($this->user_infos['level']);
}
return $this->lang['banned'];
}
示例5: while
while ($row = $result->fetch()) {
$row['user_id'] = (int) $row['user_id'];
$is_admin = $row['user_id'] === -1;
if ($is_admin) {
$row['level'] = 2;
}
if (!$is_guest_in_convers) {
$is_guest_in_convers = empty($row['display_name']);
}
//Avatar
$user_avatar = !empty($row['user_avatar']) ? Url::to_rel($row['user_avatar']) : ($user_accounts_config->is_default_avatar_enabled() ? Url::to_rel('/templates/' . $current_user->get_theme() . '/images/' . $user_accounts_config->get_default_avatar_name()) : '');
//Reprise du dernier message de la page précédente.
$row['contents'] = $quote_last_msg == 1 && $i == 0 ? '<span class="text-strong">' . $LANG['quote_last_msg'] . '</span><br /><br />' . $row['contents'] : $row['contents'];
$i++;
$group_color = User::get_group_color($row['groups'], $row['level']);
$tpl->assign_block_vars('pm.msg', array('C_MODERATION_TOOLS' => $current_user->get_id() === $row['user_id'] && $row['id'] === $convers['last_msg_id'] && $row['view_status'] === '0', 'C_VISITOR' => $is_admin, 'C_AVATAR' => $row['user_avatar'] || $user_accounts_config->is_default_avatar_enabled(), 'C_GROUP_COLOR' => !empty($group_color), 'ID' => $row['id'], 'CONTENTS' => FormatingHelper::second_parse($row['contents']), 'DATE' => $LANG['on'] . ' ' . Date::to_format($row['timestamp'], Date::FORMAT_DAY_MONTH_YEAR_HOUR_MINUTE), 'USER_AVATAR' => $user_avatar, 'PSEUDO' => $is_admin ? $LANG['admin'] : (!empty($row['display_name']) ? TextHelper::wordwrap_html($row['display_name'], 13) : $LANG['guest']), 'LEVEL_CLASS' => UserService::get_level_class($row['level']), 'GROUP_COLOR' => $group_color, 'U_PROFILE' => UserUrlBuilder::profile($row['user_id'])->rel(), 'L_LEVEL' => $row['warning_percentage'] < '100' || time() - $row['delay_banned'] < 0 ? UserService::get_level_lang($row['level'] !== null ? $row['level'] : '-1') : LangLoader::get_message('banned', 'user-common')));
//Marqueur de suivis du sujet.
if (!empty($row['track'])) {
$track = true;
}
$j++;
}
$result->dispose();
//Récupération du message quoté.
if (!empty($quote_get)) {
try {
$quote_msg = PersistenceContext::get_querier()->select_single_row(DB_TABLE_PM_MSG, array('user_id', 'contents'), 'WHERE id = :id', array('id' => $quote_get));
} catch (RowNotFoundException $e) {
$error_controller = PHPBoostErrors::unexisting_element();
DispatchManager::redirect($error_controller);
}
示例6: build_view
private function build_view($request)
{
$template = new FileTemplate('framework/content/comments/comments_list.tpl');
$page = $request->get_getint('page', 1);
$id_module = $this->module === null ? null : $this->module->get_id();
$pagination = $this->get_pagination($page);
$this->tpl->put_all(array('C_PAGINATION' => $pagination->has_several_pages(), 'PAGINATION' => $pagination->display()));
$result = PersistenceContext::get_querier()->select('
SELECT comments.*, comments.timestamp AS comment_timestamp, comments.id AS id_comment,
topic.*,
member.user_id, member.display_name, member.level, member.groups,
ext_field.user_avatar
FROM ' . DB_TABLE_COMMENTS . ' comments
LEFT JOIN ' . DB_TABLE_COMMENTS_TOPIC . ' topic ON comments.id_topic = topic.id_topic
LEFT JOIN ' . DB_TABLE_MEMBER . ' member ON member.user_id = comments.user_id
LEFT JOIN ' . DB_TABLE_MEMBER_EXTENDED_FIELDS . ' ext_field ON ext_field.user_id = comments.user_id
' . $this->build_where_request() . '
ORDER BY comments.timestamp DESC
LIMIT :number_items_per_page OFFSET :display_from', array('number_items_per_page' => $pagination->get_number_items_per_page(), 'display_from' => $pagination->get_display_from()));
$user_accounts_config = UserAccountsConfig::load();
$comments_authorizations = new CommentsAuthorizations();
$number_comment = 0;
while ($row = $result->fetch()) {
$id = $row['id_comment'];
$path = $row['path'];
//Avatar
$user_avatar = !empty($row['user_avatar']) ? Url::to_rel($row['user_avatar']) : ($user_accounts_config->is_default_avatar_enabled() ? Url::to_rel('/templates/' . AppContext::get_current_user()->get_theme() . '/images/' . $user_accounts_config->get_default_avatar_name()) : '');
$timestamp = new Date($row['comment_timestamp'], Timezone::SERVER_TIMEZONE);
$group_color = User::get_group_color($row['groups'], $row['level']);
$template->assign_block_vars('comments', array('C_MODERATOR' => $comments_authorizations->is_authorized_moderation(), 'C_VISITOR' => empty($row['login']), 'C_VIEW_TOPIC' => true, 'C_GROUP_COLOR' => !empty($group_color), 'C_AVATAR' => $row['user_avatar'] || $user_accounts_config->is_default_avatar_enabled(), 'U_TOPIC' => Url::to_rel($path), 'U_EDIT' => CommentsUrlBuilder::edit($path, $id)->rel(), 'U_DELETE' => CommentsUrlBuilder::delete($path, $id)->rel(), 'U_PROFILE' => UserUrlBuilder::profile($row['user_id'])->rel(), 'U_AVATAR' => $user_avatar, 'ID_COMMENT' => $id, 'DATE' => $timestamp->format(Date::FORMAT_DAY_MONTH_YEAR_HOUR_MINUTE), 'DATE_ISO8601' => $timestamp->format(Date::FORMAT_ISO8601), 'MESSAGE' => FormatingHelper::second_parse($row['message']), 'USER_ID' => $row['user_id'], 'PSEUDO' => empty($row['login']) ? $row['pseudo'] : $row['login'], 'LEVEL_CLASS' => UserService::get_level_class($row['level']), 'GROUP_COLOR' => $group_color, 'L_LEVEL' => UserService::get_level_lang($row['level'] !== null ? $row['level'] : '-1')));
$template->put_all(array('MODULE_ID' => $row['module_id'], 'ID_IN_MODULE' => $row['id_in_module'], 'L_VIEW_TOPIC' => $this->lang['view-topic']));
$number_comment++;
}
$result->dispose();
$this->tpl->put('C_NO_COMMENT', $number_comment == 0);
$comments_tpl = new FileTemplate('framework/content/comments/comments.tpl');
$comments_tpl->put_all(array('COMMENTS_LIST' => $template, 'MODULE_ID' => $row['module_id'], 'ID_IN_MODULE' => $row['id_in_module']));
return $comments_tpl;
}
示例7: display_comments
/**
* @desc Do not use, this is used for ajax display comments
* @param string $module_id the module identifier
* @param integer $id_in_module id in module used in comments system
* @param string $topic_identifier topic identifier (use if you have several comments system)
* @return object View is a view
*/
public static function display_comments($module_id, $id_in_module, $topic_identifier, $number_comments_display, $authorizations, $display_from_number_comments = false)
{
$template = new FileTemplate('framework/content/comments/comments_list.tpl');
if ($authorizations->is_authorized_read() && $authorizations->is_authorized_access_module()) {
$user_accounts_config = UserAccountsConfig::load();
$condition = !$display_from_number_comments ? ' LIMIT ' . $number_comments_display : ' LIMIT ' . $number_comments_display . ',18446744073709551615';
$result = PersistenceContext::get_querier()->select("\n\t\t\t\tSELECT comments.*, comments.timestamp AS comment_timestamp, comments.id AS id_comment,\n\t\t\t\ttopic.is_locked, topic.path,\n\t\t\t\tmember.user_id, member.display_name, member.level, member.groups, \n\t\t\t\text_field.user_avatar\n\t\t\t\tFROM " . DB_TABLE_COMMENTS . " comments\n\t\t\t\tLEFT JOIN " . DB_TABLE_COMMENTS_TOPIC . " topic ON comments.id_topic = topic.id_topic\n\t\t\t\tLEFT JOIN " . DB_TABLE_MEMBER . " member ON member.user_id = comments.user_id\n\t\t\t\tLEFT JOIN " . DB_TABLE_MEMBER_EXTENDED_FIELDS . " ext_field ON ext_field.user_id = comments.user_id\n\t\t\t\tWHERE topic.module_id = '" . $module_id . "' AND topic.id_in_module = '" . $id_in_module . "' AND topic.topic_identifier = '" . $topic_identifier . "'\n\t\t\t\tORDER BY comments.timestamp " . CommentsConfig::load()->get_order_display_comments() . " " . $condition);
while ($row = $result->fetch()) {
$id = $row['id_comment'];
$path = $row['path'];
//Avatar
$user_avatar = !empty($row['user_avatar']) ? Url::to_rel($row['user_avatar']) : ($user_accounts_config->is_default_avatar_enabled() ? Url::to_rel('/templates/' . AppContext::get_current_user()->get_theme() . '/images/' . $user_accounts_config->get_default_avatar_name()) : '');
$timestamp = new Date($row['comment_timestamp'], Timezone::SERVER_TIMEZONE);
$group_color = User::get_group_color($row['groups'], $row['level']);
$template->assign_block_vars('comments', array('C_MODERATOR' => self::is_authorized_edit_or_delete_comment($authorizations, $id), 'C_VISITOR' => empty($row['display_name']), 'C_GROUP_COLOR' => !empty($group_color), 'C_AVATAR' => $row['user_avatar'] || $user_accounts_config->is_default_avatar_enabled(), 'U_EDIT' => CommentsUrlBuilder::edit($path, $id)->rel(), 'U_DELETE' => CommentsUrlBuilder::delete($path, $id)->rel(), 'U_PROFILE' => UserUrlBuilder::profile($row['user_id'])->rel(), 'U_AVATAR' => $user_avatar, 'ID_COMMENT' => $id, 'DATE' => $timestamp->format(Date::FORMAT_DAY_MONTH_YEAR_HOUR_MINUTE), 'DATE_ISO8601' => $timestamp->format(Date::FORMAT_ISO8601), 'MESSAGE' => FormatingHelper::second_parse($row['message']), 'USER_ID' => $row['user_id'], 'PSEUDO' => empty($row['display_name']) ? $row['pseudo'] : $row['display_name'], 'LEVEL_CLASS' => UserService::get_level_class($row['level']), 'GROUP_COLOR' => $group_color, 'L_LEVEL' => UserService::get_level_lang($row['level'] !== null ? $row['level'] : '-1')));
$template->put_all(array('L_UPDATE' => self::$common_lang['edit'], 'L_DELETE' => self::$common_lang['delete']));
}
$result->dispose();
}
self::$template->put_all(array('MODULE_ID' => $module_id, 'ID_IN_MODULE' => $id_in_module, 'TOPIC_IDENTIFIER' => $topic_identifier));
return $template;
}