本文整理汇总了PHP中phpbb\user::get_iso_lang_id方法的典型用法代码示例。如果您正苦于以下问题:PHP user::get_iso_lang_id方法的具体用法?PHP user::get_iso_lang_id怎么用?PHP user::get_iso_lang_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phpbb\user
的用法示例。
在下文中一共展示了user::get_iso_lang_id方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_all_fields
/**
* @return array
*/
public function get_all_fields()
{
$sql = 'SELECT l.lang_name, f.field_ident
FROM ' . PROFILE_LANG_TABLE . ' l, ' . PROFILE_FIELDS_TABLE . ' f
WHERE l.lang_id = ' . $this->user->get_iso_lang_id() . '
AND f.field_active = 1
AND f.field_no_view = 0
AND f.field_hide = 0
AND l.field_id = f.field_id
ORDER BY f.field_order';
$result = $this->db->sql_query($sql);
$cpf_options = false;
while ($row = $this->db->sql_fetchrow($result)) {
$cpf_options[$row['field_ident']] = $row['lang_name'];
}
$this->db->sql_freeresult($result);
return $cpf_options;
}
示例2: build_insert_sql_array
/**
* Build Array for user insertion into custom profile fields table
*/
public function build_insert_sql_array($cp_data)
{
$sql_not_in = array();
foreach ($cp_data as $key => $null) {
$sql_not_in[] = strncmp($key, 'pf_', 3) === 0 ? substr($key, 3) : $key;
}
$sql = 'SELECT f.field_type, f.field_ident, f.field_default_value, l.lang_default_value
FROM ' . $this->fields_language_table . ' l, ' . $this->fields_table . ' f
WHERE l.lang_id = ' . $this->user->get_iso_lang_id() . '
' . (sizeof($sql_not_in) ? ' AND ' . $this->db->sql_in_set('f.field_ident', $sql_not_in, true) : '') . '
AND l.field_id = f.field_id';
$result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result)) {
$profile_field = $this->type_collection[$row['field_type']];
$cp_data['pf_' . $row['field_ident']] = $profile_field->get_default_field_value($row);
}
$this->db->sql_freeresult($result);
return $cp_data;
}
示例3: display
/**
* Display the rules page
*
* @return \Symfony\Component\HttpFoundation\Response A Symfony Response object
* @access public
*/
public function display()
{
// When board rules are disabled, redirect users back to the forum index
if (empty($this->config['boardrules_enable'])) {
redirect(append_sid("{$this->root_path}index.{$this->php_ext}"));
}
// Add boardrules controller language file
$this->user->add_lang_ext('phpbb/boardrules', 'boardrules_controller');
$last_right_id = null;
// Used to help determine when to close nesting structures
$depth = 0;
// Used to track the depth of nesting level
$cat_counter = 1;
// Numeric counter used for categories
$rule_counter = 'a';
// Alpha counter used for rules
// Grab all the rules in the current user's language
$entities = $this->rule_operator->get_rules($this->user->get_iso_lang_id());
/* @var $entity \phpbb\boardrules\entity\rule */
foreach ($entities as $entity) {
if ($entity->get_right_id() - $entity->get_left_id() > 1) {
// Rule categories
$is_category = true;
$anchor = $entity->get_anchor() ?: $this->user->lang('BOARDRULES_CATEGORY_ANCHOR', $cat_counter);
// Increment nesting level depth counter
$depth++;
// Increment category counter
$cat_counter++;
// Reset rule counter
$rule_counter = 'a';
} else {
// Rules
$is_category = false;
$anchor = $entity->get_anchor() ?: $this->user->lang('BOARDRULES_RULE_ANCHOR', $cat_counter - 1 . $rule_counter);
// Increment rule counter
$rule_counter++;
}
// Determine how deeply nested we are and use closing tags as necessary
$diff = $last_right_id !== null ? $entity->get_left_id() - $last_right_id : 1;
if ($diff > 1) {
for ($i = 1; $i < $diff; $i++) {
$depth--;
// decrement the nesting level depth counter
$this->template->assign_block_vars('rules', array('S_CLOSE_LIST' => true));
}
}
// Set last_right_id value with the current item's value
$last_right_id = $entity->get_right_id();
// Assign values to template vars for this rule entity
$this->template->assign_block_vars('rules', array('TITLE' => $entity->get_title(), 'MESSAGE' => $entity->get_message_for_display(), 'U_ANCHOR' => $anchor, 'S_IS_CATEGORY' => $is_category));
}
// By this point, if any nested structures are still open, attempt to close them
if ($depth > 0) {
for ($i = 0; $i < $depth; $i++) {
$this->template->assign_block_vars('rules', array('S_CLOSE_LIST' => true));
}
}
// Assign values to template vars for the rules page
$this->template->assign_vars(array('S_BOARD_RULES' => true, 'S_CATEGORIES' => $cat_counter > 1 ? true : false, 'BOARDRULES_EXPLAIN' => $this->user->lang('BOARDRULES_EXPLAIN', $this->config['sitename'])));
// Assign breadcrumb template vars for the rules page
$this->template->assign_block_vars('navlinks', array('U_VIEW_FORUM' => $this->helper->route('phpbb_boardrules_main_controller'), 'FORUM_NAME' => $this->user->lang('BOARDRULES')));
// Send all data to the template file
return $this->helper->render('boardrules_controller.html', $this->user->lang('BOARDRULES'));
}