Example #1
0
 public function login()
 {
     $inputs['username'] = array('type' => 'input', 'label' => 'Username', 'rules' => 'required');
     $inputs['password'] = array('type' => 'password', 'label' => 'Password', 'rules' => 'required');
     if (rbt_valid_post($inputs)) {
         $this->load->model('users');
         $response = $this->users->login($this->input->post('username'), $this->input->post('password'));
         if ($response['status']) {
             toshout(array($response['message'] => 'success'));
             redirect('dashboard/index');
         } else {
             toshout(array($response['message'] => 'danger'));
         }
         // show_sess();
     }
     $data['inputs'] = $inputs;
     $this->load->view('umum_login', $data);
 }
Example #2
0
 public function new_data()
 {
     $inputs['datetime'] = array('type' => 'input', 'label' => 'Date & Time (Y-m-d H:m:s)', 'rules' => 'required');
     $inputs['weight'] = array('type' => 'input', 'label' => 'Weight (kg)', 'rules' => 'required|decimal');
     $inputs['fat'] = array('type' => 'input', 'label' => 'Fat (%)', 'rules' => 'required|decimal');
     $inputs['water'] = array('type' => 'input', 'label' => 'Water (%)', 'rules' => 'required|decimal');
     $inputs['muscle'] = array('type' => 'input', 'label' => 'Muscle (%)', 'rules' => 'required|decimal');
     $inputs['bone'] = array('type' => 'input', 'label' => 'Bone (%)', 'rules' => 'required|decimal');
     $inputs['kcal'] = array('type' => 'input', 'label' => 'KCal (kcal)', 'rules' => 'required|integer');
     $inputs['waist'] = array('type' => 'input', 'label' => 'Waist (cm)', 'rules' => 'required|integer');
     $defaults = array('datetime' => date('Y-m-d H:i:s'));
     if (rbt_valid_post($inputs)) {
         $user = $this->session->userdata('user');
         $_POST['user_id'] = $user['id'];
         // dumper($this->input->post());
         $this->db->insert('data', $this->input->post());
         toshout(array('Your data has been saved' => 'success'));
         redirect('dashboard/data');
     }
     $data['inputs'] = $inputs;
     $data['title'] = 'New Data';
     $data['defaults'] = $defaults;
     $this->load->view('dashboard_form', $data);
 }
Example #3
0
 public function testMailer()
 {
     $input = array('to' => array('type' => 'text', 'display' => 'To', 'rules' => 'required|valid_email'), 'subject' => array('type' => 'text', 'display' => 'Subject', 'rules' => 'required'), 'message' => array('type' => 'text', 'display' => 'Message', 'rules' => 'required'));
     if (rbt_valid_post($input)) {
         //load email libraries
         $this->load->library('amazon_ses');
         // dumper($this->amazon_ses->address_is_verified('*****@*****.**'));
         $this->amazon_ses->to($this->input->post('to'));
         $this->amazon_ses->subject($this->input->post('subject'));
         $this->amazon_ses->message($this->input->post('message'));
         $this->amazon_ses->debug(TRUE);
         dumper($this->amazon_ses->send());
         // dumper(scandir('./ses-cert'));
     }
     // dumper();
     rbt_make_form($input);
 }
Example #4
0
 public function feature_group()
 {
     $form['display'] = array('type' => 'text', 'display' => 'Display Name:', 'rules' => 'required');
     $form['description'] = array('type' => 'textarea', 'display' => 'Description:', 'rules' => 'required');
     $data['inputs'] = $form;
     if (rbt_valid_post($form)) {
         if (!$this->uri->segment(3)) {
             $this->db->insert('feature_group', $this->input->post());
             toshout('Success insert the feature group into DB', 'success');
         } else {
             $this->db->where('id', $this->uri->segment(3));
             $this->db->update('feature_group', $this->input->post());
             toshout('Success update the feature group', 'success');
         }
         //dumper('yeah');
         $_POST = array();
     }
     $query = $this->db->get('feature_group');
     foreach ($query->result_array() as $fgg) {
         $feat_gr[$fgg['id']] = $fgg;
     }
     if ($this->uri->segment(3)) {
         $_POST = $feat_gr[$this->uri->segment(3)];
     }
     $data['feature_groups'] = $feat_gr;
     $this->load->view('v_sacl_feature_group', $data);
 }
Example #5
0
 public function purchase()
 {
     $inputs['upload_receipt'] = array('type' => 'upload', 'label' => 'Upload Resit', 'rules' => 'upload_path:locked/receipts|allowed_types:gif,png,jpeg,jpg,pdf|max_size:1000|overwrite:TRUE');
     $inputs['manual_receipt'] = array('type' => 'textarea', 'label' => 'ATAU Taip Maklumat Resit', 'rules' => '');
     $data['inputs'] = $inputs;
     $this->load->model('Purchase');
     if (rbt_valid_post($inputs)) {
         toshout_success('Maklumat Bayaran telah selamat kami terima. Kami akan sahkan bayaran tuan secepat mungkin. <b>Emel berserta link download</b> akan di hantar setelah bayaran di sahkan. Terima kasih!');
         $res = $this->Purchase->approve_manual($this->uri->segment(3), $this->input->post());
         // redirect('umum/purchase/'.$this->uri->segment(3));
     }
     $purchase = $this->Purchase->get_details($this->uri->segment(3));
     // will send status as pending
     $data['purchase'] = $purchase;
     // if(rbt_valid_post($inputs)){
     // 	// tukar status as payment_confirmed ... so boleh redirect download terus
     // 	$this->db->where('key', $this->uri->segment(3));
     // 	$this->db->update('purchases', array('status'=>'payment_confirmed'));
     // }
     $this->load->view('umum_purchase', $data);
 }