+ $this->form_validation->set_error_delimiters('<span class="error">',
+ '</span>');
+
+ if ($this->form_validation->run('register') === FALSE)
+ {
+ $params = array('title' =>
+ $this->lang->line('ui_nav_menu_register')
+ .' – '
+ . $this->config->item('site_name'),
+ //'metas' => array('description'=>'')
+ );
+ $this->load->library('html_head_params', $params);
+
+ // **
+ // ** LOADING VIEWS
+ // **
+ $this->load->view('html_begin', $this->html_head_params);
+ $this->load->view('header', array('selected_menu' => 'register'));
+
+ $this->load->view('user/register_view', array(
+ 'redirect'=> $redirect
+ ));
+
+ $this->load->view('footer');
+ $this->load->view('html_end');
+ }
+ else
+ {
+ if ($this->user_id !== NULL)
+ {
+ $this->session->set_userdata(array(
+ 'user_id'=> $this->user_id,
+ 'username'=> $this->username
+ ));
+
+ // Redirect to last page before login.
+ header('Location: '. site_url(urldecode_segments($redirect)));
+ }
+ else
+ {
+ $this->session->set_userdata(array(
+ 'username'=> $this->username
+ ));
+
+ // Redirect to register page because an user authenticates here
+ // for the first time with LDAP.
+ // TODO
+ header('Location: '. site_url(urldecode_segments($redirect)));
+ }