ok
| Direktori : /home/gainstransformin/www/Gains_admin/application/models/ |
| Current File : /home/gainstransformin/www/Gains_admin/application/models/Master_Model.php |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Master_Model extends CI_Model {
//--------- Reliable Registration
public function get_gym_data()
{
$query = $this->db->query("SELECT `gym_id`, `gym_name`, `gym_mobile`, `gym_email`, `gym_add`, `gym_fee`, `gym_joining_date`, `gym_logo`, `gym_password`
FROM `gym`
WHERE
`gym_id`='".$this->session->userdata('fk_gym_id')."'");
return $query->row_array();
}
public function get_plan_list(){
$query = $this->db->query("SELECT `plan_id`, `plan_name` FROM `plan` WHERE 1");
return $query->result_array();
}
public function save_enquiry(){
$mem_regi_date=date("Y-m-d");
$mem_birthdate=date("Y-m-d",strtotime($this->input->post('enq_birthdate')));
$result=$query = $this->db->query("INSERT INTO `member_registration`( `mem_no`, `mem_name`, `mem_add`, `mem_birthdate`,
`mem_gender`, `mem_mobile_no`, `mem_workplace`,
`mem_emergeny_mobile`, `mem_reference`, `mem_regi_date` , `fk_emp_id`, `fk_gym_id`) VALUES(
'".$this->input->post('enq_no')."',
'".$this->input->post('enq_name')."',
'".$this->input->post('enq_add')."',
'".$mem_birthdate."',
'".$this->input->post('enq_gender')."',
'".$this->input->post('enq_mobile_no')."',
'".$this->input->post('enq_workplace')."',
'".$this->input->post('enq_emergeny_mobile')."',
'".$this->input->post('enq_reference')."',
'".$mem_regi_date."',
'".$this->session->userdata('aid')."','".$this->session->userdata('fk_gym_id')."'
)");
return $result;
}
public function gym_view_all_enquiry(){
$query = $this->db->query("SELECT `mem_id`, `mem_no`, `mem_name`, `mem_add`, `mem_birthdate`, `mem_gender`, `mem_mobile_no`, `mem_email`, `mem_workplace`, `mem_emergeny_name`, `mem_emergeny_mobile`, `mem_reference`, `mem_regi_date`, `mem_staus`, `fk_emp_id`, `fk_gym_id`
FROM `member_registration`
WHERE mem_staus='enquiry'
and fk_gym_id='".$this->session->userdata('fk_gym_id')."'
ORDER BY `mem_id` DESC ");
return $query->result_array();
}
public function enquiryDetails($id){
$query = $this->db->query("SELECT `mem_id`, `mem_no`, `mem_name`, `mem_add`, `mem_birthdate`, `mem_gender`, `mem_mobile_no`, `mem_email`, `mem_workplace`, `mem_emergeny_mobile`, `mem_reference`, `mem_regi_date`, `mem_staus`, `fk_emp_id`,`fk_gym_id`
FROM `member_registration`
where mem_id=".$id);
return $query->row_array();
}
public function update_member_detail(){
$newdate=date("Y-m-d",strtotime($this->input->post('mem_birthdate')));
$query = $this->db->query("UPDATE `member_registration`
SET
`mem_name`='".$this->input->post('mem_name')."',
`mem_add`='".$this->input->post('mem_add')."',
`mem_birthdate`='".$newdate."',
`mem_gender`='".$this->input->post('mem_gender')."',
`mem_mobile_no`='".$this->input->post('mem_mobile_no')."',
`mem_workplace`='".$this->input->post('mem_workplace')."',
`mem_emergeny_mobile`='".$this->input->post('mem_emergeny_mobile')."',
`mem_reference`='".$this->input->post('mem_reference')."'
WHERE `mem_id`='".$this->input->post('mem_id')."'");
return $query;
}
public function gym_view_all_emp_list(){
$query = $this->db->query("SELECT `emp_id`, `emp_name`, `emp_mob`, `emp_email`, `emp_add`, `fk_gym_id`, `emp_password`, `emp_designation`
FROM `employee`
where fk_gym_id='".$this->session->userdata('fk_gym_id')."'
and `emp_designation`='Staff'
");
return $query->result_array();
}
public function getloginUser_data(){
$query = $this->db->query("SELECT *
FROM `tbl_admin`
where `log_id`='".$this->session->userdata('log_id')."'
");
return $query->row_array();
}
public function save_new_employee(){
$result1=$query = $this->db->query("INSERT INTO `employee`( `emp_name`, `emp_mob`, `emp_email`, `emp_add`, `fk_gym_id`, `emp_password`, `emp_designation`) VALUES(
'".$this->input->post('emp_name')."',
'".$this->input->post('emp_mob')."',
'".$this->input->post('emp_email')."',
'".$this->input->post('emp_add')."',
'".$this->session->userdata('fk_gym_id')."',
'".$this->input->post('emp_password')."',
'Staff'
)");
return $result1;
}
public function deleteemp(){
return $query = $this->db->query("DELETE FROM `employee` WHERE `emp_id` ='".$this->input->get('deleteId')."'");
}
public function ajaxgymFeesDynamic(){
$query = $this->db->query("SELECT `plan_id`, `plan_fees` FROM `plan` WHERE plan_id='".$this->input->post('rawCatId')."' ");
return $query->row_array();
}
public function gym_forgot_password(){
$query = $this->db->query("SELECT `emp_id`,`fk_gym_id`,`emp_password` FROM `employee`
WHERE `emp_password`='".$this->input->post('Current_Password')."'
AND `emp_id`='".$this->session->userdata('aid')."'");
if($query->num_rows()>0)
{
return $result = $this->db->query("UPDATE `employee` SET `emp_password`='".$this->input->post('New_Password')."'
WHERE
`emp_id`='".$this->session->userdata('aid')."'");
}
return 0;
}
}