Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function display(array $settings, $edit_mode = false)
 {
     $data = $this->context->get_data_ref();
     if (!empty($data['.'][0]['TOTAL_USERS_ONLINE'])) {
         $l_online_users = $data['.'][0]['TOTAL_USERS_ONLINE'];
         $online_userlist = $data['.'][0]['LOGGED_IN_USER_LIST'];
         $l_online_record = $data['.'][0]['RECORD_USERS'];
     } else {
         $item_id = 0;
         $item = 'forum';
         $online_users = obtain_users_online($item_id, $item);
         $user_online_strings = obtain_users_online_string($online_users, $item_id, $item);
         $l_online_users = $user_online_strings['l_online_users'];
         $online_userlist = $user_online_strings['online_userlist'];
         $l_online_record = $this->user->lang('RECORD_ONLINE_USERS', (int) $this->config['record_online_users'], $this->user->format_date($this->config['record_online_date'], false, true));
     }
     $this->ptemplate->assign_vars(array('TOTAL_USERS_ONLINE' => $l_online_users, 'LOGGED_IN_USER_LIST' => $online_userlist, 'RECORD_USERS' => $l_online_record, 'U_VIEWONLINE' => $this->_get_viewonline_url()));
     unset($data);
     return array('title' => 'WHO_IS_ONLINE', 'content' => $this->ptemplate->render_view('blitze/sitemaker', 'blocks/whois.html', 'whois_block'));
 }
Пример #2
0
 /**
  * Get output for a language variable (L_FOO, LA_FOO)
  *
  * This function checks to see if the language var was outputted to $context
  * (e.g. in the ACP, L_TITLE)
  * If not, we return the result of $user->lang()
  *
  * @return string
  */
 function lang()
 {
     $args = func_get_args();
     $key = $args[0];
     $context = $this->context->get_data_ref();
     $context_vars = $context['.'][0];
     if (isset($context_vars['L_' . $key])) {
         return $context_vars['L_' . $key];
     }
     // LA_ is transformed into lang(\'$1\')|escape('js'), so we should not
     // need to check for it
     return call_user_func_array(array($this->language, 'lang'), $args);
 }