Ignore:
Timestamp:
Nov 21, 2013, 7:10:41 PM (10 years ago)
Author:
mistic100
Message:
  • display info about current logged user
  • add button to hide the bar
  • fix select boxes
File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/AdminTools/include/MultiView.class.php

    r25618 r25619  
    88{
    99  /** @var bool $is_admin */
    10   private $is_admin;
     10  private $is_admin = false;
    1111
    1212  /** @var array $data */
    1313  private $data = array();
     14
     15  /** @var array $user */
     16  private $user = array();
    1417
    1518  /**
     
    5255
    5356  /**
     57   * @return array
     58   */
     59  public function get_user()
     60  {
     61    return $this->user;
     62  }
     63
     64  /**
    5465   * Save $data in session
    5566   */
     
    93104  public function user_init()
    94105  {
     106    global $user, $conf;
     107
    95108    $this->is_admin = is_admin();
    96109
     110    $this->user = array(
     111      'id' => $user['id'],
     112      'username' => $user['username'],
     113      );
     114
    97115    if ($this->is_admin)
    98116    {
    99       global $user, $conf;
     117      if ($this->data['view_as'] == 0)
     118      {
     119        $this->data['view_as'] = $user['id'];
     120      }
     121      if (empty($this->data['lang']))
     122      {
     123        $this->data['lang'] = $user['language'];
     124      }
     125      if (empty($this->data['theme']))
     126      {
     127        $this->data['theme'] = $user['theme'];
     128      }
    100129
    101130      // view_as
     
    104133        $this->data['view_as'] = (int)$_GET['view_as'];
    105134      }
    106       if ($this->data['view_as'] != $user['id'] and $this->data['view_as'] != 0)
     135      if ($this->data['view_as'] != $user['id'])
    107136      {
    108137        $user = build_user($this->data['view_as'], true);
     
    116145        $this->data['theme'] = $_GET['theme'];
    117146      }
    118       if ($this->data['theme'] != '')
    119       {
    120         $user['theme'] = $this->data['theme'];
    121       }
     147      $user['theme'] = $this->data['theme'];
    122148
    123149      // lang
     
    126152        $this->data['lang'] = $_GET['lang'];
    127153      }
    128       if ($this->data['lang'] != '')
    129       {
    130         $user['language'] = $this->data['lang'];
    131       }
     154      $user['language'] = $this->data['lang'];
    132155
    133156      // show_queries
Note: See TracChangeset for help on using the changeset viewer.