public function __construct($id) { parent::__construct($id); $form = new \Zippy\Html\Panel('welcomform'); $form->add(new Label('username')); $form->add(new ClickLink('logout', $this, 'LogoutClick')); $this->add($form); $form->add(new Label('adminmenu', '')); if ($_COOKIE['remember'] && System::getUser()->user_id == 0) { $arr = explode('_', $_COOKIE['remember']); $_config = parse_ini_file(_ROOT . 'config/config.ini', true); if ($arr[0] > 0 && $arr[1] === md5($arr[0] . $_config['common']['salt'])) { $user = User::load($arr[0]); } if ($user instanceof User) { System::setUser($user); $_SESSION['user_id'] = $user->user_id; //для использования вне Application $_SESSION['userlogin'] = $user->userlogin; //для использования вне Application // @mkdir(_ROOT . UPLOAD_USERS .$user->user_id) ; // \ZippyERP\System\Util::removeDirRec(_ROOT . UPLOAD_USERS .$user->user_id.'/tmp') ; // @mkdir(_ROOT .UPLOAD_USERS .$user->user_id .'/tmp') ; } } }
public function __construct($user_id) { parent::__construct(); $this->user = \ZippyERP\System\User::load($user_id); $this->add(new Label('login', $this->user->userlogin)); $this->add(new Label('createdate', date('Y-m-d', $this->user->registration_date))); $this->add(new Label('userroles', 'Зарегистрировнный пользователь')); $this->add(new \Zippy\Html\Form\Form('roleform'))->setVisible(System::getUser()->userlogin == 'admin'); $this->roleform->add(new \Zippy\Html\DataList\DataView("rolerow", new \ZCL\DB\EntityDataSource('\\ZippyERP\\System\\Role'), $this, 'OnAddRoleRow'))->Reload(); $this->roleform->setSubmitHandler($this, 'OnSubmit'); }
public function getItem($id) { return User::load($id); }