コード例 #1
0
ファイル: admincp.php プロジェクト: Rotron/hero
 function edit($id)
 {
     $this->load->model('usergroup_model');
     $usergroups = $this->usergroup_model->get_usergroups();
     $usergroup_options = array();
     foreach ($usergroups as $group) {
         $usergroup_options[$group['id']] = $group['name'];
     }
     $user = $this->user_model->get_user($id);
     if (!$user) {
         die(show_error('No user found with that ID.'));
     }
     $this->load->library('admin_form');
     $form = new Admin_form();
     $form->fieldset('System Information');
     $form->text('Username', 'username', $user['username'], FALSE, TRUE, FALSE, TRUE);
     $form->text('Email', 'email', $user['email'], FALSE, TRUE, '*****@*****.**', TRUE);
     $form->password('Password', 'password', '', FALSE, TRUE);
     $form->password('Repeat Password', 'password2', 'Leave blank to keep current password. Passwords must be at least 6 characters in length.', FALSE, TRUE);
     $form->fieldset('Usergroup');
     $form->dropdown('Usergroups', 'usergroups', $usergroup_options, $user['usergroups'], TRUE, TRUE);
     $form->checkbox('Administrator', 'is_admin', '1', $user['is_admin']);
     $form->fieldset('Profile Information');
     $form->names('Name', $user['first_name'], $user['last_name'], FALSE, TRUE);
     $form->custom_fields($this->user_model->get_custom_fields(), $user, TRUE);
     $data = array('user' => array(), 'usergroups' => $usergroup_options, 'default_usergroup' => $this->usergroup_model->get_default(), 'form' => $form->display(), 'form_title' => 'Edit Member Account', 'form_action' => site_url('admincp/users/post_user/edit/' . $user['id']));
     $this->load->view('user_form.php', $data);
 }