Example #1
0
 public function dashboard()
 {
     //print_r($this->getCustomer());
     $data = $this->getCustomer();
     $data['pageTitle'] = "Dashboard";
     loadViewFiles(true, false, 'customer/dashboard', $data);
 }
Example #2
0
 public function signUp()
 {
     $data['pageTitle'] = "Sign Up";
     loadViewFiles(true, false, 'authentication/signup', $data);
 }
Example #3
0
 /**
  * Function to save user details
  */
 public function save()
 {
     try {
         $data = array();
         $postData = $this->input->post();
         $this->load->library('form_validation');
         $this->form_validation->set_rules('first_name', 'first_name', 'trim|required');
         $this->form_validation->set_rules('last_name', 'last_name', 'trim|required');
         $this->form_validation->set_rules('email', 'email', 'trim|required|valid_email');
         $redirectUrl = 'users/create';
         if (!$postData['phone'] && !$postData['mobile']) {
             $this->form_validation->set_rules('phone', 'phone', 'trim|required|regex_match[/^[0-9]+$/]');
             $this->form_validation->set_rules('mobile', 'mobile', 'trim|required|regex_match[/^[0-9]+$/]');
         }
         if ($this->form_validation->run() && !$this->user_model->isEmailAlreadyExists($postData['email'], $postData['id'])) {
             $userId = $this->user_model->saveUser($postData);
             if ($userId) {
                 $this->session->set_flashdata('successMsg', 'User Account created successfully.');
                 $redirectUrl = $redirectUrl . "?id=" . $userId;
                 redirect($redirectUrl, 'refresh');
                 return true;
             }
         }
     } catch (Exception $e) {
         loadViewFiles(true, false, 'error', $data);
         log_message("error", $e->getMessage());
     }
     if ($postData['id']) {
         $redirectUrl = $redirectUrl . '?id=' . $postData['id'];
     }
     $this->session->set_flashdata('errorMsg', 'Error while saving user details. Please try again.');
     redirect($redirectUrl, 'refresh');
     return;
 }