106 lines
3.5 KiB
PHP
106 lines
3.5 KiB
PHP
<?php
|
|
/**
|
|
* Created by PhpStorm.
|
|
* User: karthi
|
|
* Date: 11/9/17
|
|
* Time: 5:28 PM
|
|
*/
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
class master_model extends CI_Model
|
|
{
|
|
|
|
/*
|
|
* get user login details
|
|
* params:email,password
|
|
* created by karthi
|
|
* */
|
|
|
|
/*
|
|
* Default login abc123 -> e99a18c428cb38d5f260853678922e03
|
|
*/
|
|
|
|
public function addfees($feesdetails)
|
|
{
|
|
|
|
$this->db->insert('T_AFeesDetails',$feesdetails);
|
|
$r = $this->db->affected_rows();
|
|
return $r;
|
|
|
|
}
|
|
public function getfees()
|
|
{
|
|
|
|
$this->db->select('T_AFeesDetails.FeesName,T_AFeesDetails.FeesDescription,T_AFeesDetails.Active');
|
|
$this->db->from('T_AFeesDetails');
|
|
$result = $this->db->get();
|
|
return $result;
|
|
|
|
}
|
|
|
|
public function login($mobile = null, $password = null)
|
|
{
|
|
//echo $mobile;die;
|
|
$this->db->select('t1.MobileNumber, t1.Password,t1.ListCode');
|
|
$this->db->from('' . LOGIN . ' as t1');
|
|
$this->db->where('t1.MobileNumber', $mobile);
|
|
$this->db->or_where('t1.StaffID', $mobile);
|
|
// $this->db->join('' . STAFF . ' as t2', 't1.StaffID = t2.StaffID', 'LEFT');
|
|
$this->db->where('t1.IsActive', 1);
|
|
//$this->db->where('t2.IsActive', 1);
|
|
$loginDetails = $this->db->get(LOGIN)->first_row();
|
|
//print_r($loginDetails);die;
|
|
|
|
//print_r($loginDetails);die;
|
|
|
|
if($loginDetails) {
|
|
|
|
if($loginDetails->Password == $password){
|
|
$result['loginStatus'] = true;
|
|
$result['details'] = $loginDetails;
|
|
}
|
|
else {
|
|
$result['loginStatus'] = false;
|
|
$result['message'] = "Please Enter Password !!";
|
|
}
|
|
} else {
|
|
$result['loginStatus'] = false;
|
|
$result['message'] = "Your login is de-activated or don't have login.";
|
|
}
|
|
|
|
/*$this->db->join('areas a', 'a.id = e.id_area', 'inner');
|
|
$this->db->join('horario h', 'h.id = e.id_horario', 'inner');
|
|
$this->db->join('dia d', 'd.id = e.id_data', 'inner');
|
|
$this->db->join('tipo_evento t', 't.id = e.id_tipo', 'inner');
|
|
$this->db->join('campus c', 'c.id = e.id_unidade', 'inner');
|
|
if ( $id != null ){
|
|
$this->db->where('e.id', $id);
|
|
return $this->db->get('eventos')->first_row();
|
|
} else {
|
|
return $this->db->get('eventos')->result();
|
|
}*/
|
|
return $result;
|
|
|
|
}
|
|
|
|
public function change_Password( $userId, $newPassword, $oldPassword, $updateOn) {
|
|
$this->db->select('Password');
|
|
$this->db->from(LOGIN);
|
|
$this->db->where('ID', $userId);
|
|
$loginDetails = $this->db->get()->first_row();
|
|
if ($loginDetails->Password == $oldPassword) {
|
|
$sql = "UPDATE ".LOGIN." SET Password='$newPassword', UpdatedBy='$userId', UpdatedOn='$updateOn' WHERE ID='$userId'";
|
|
if($this->db->query($sql) == '1'){
|
|
$result['changePassStatus'] = true;
|
|
$result['message'] = "Your Password Successfully changed !!";
|
|
} else {
|
|
$result['changePassStatus'] = false;
|
|
$result['message'] = "Please try Again !!";
|
|
}
|
|
} else {
|
|
$result['changePassStatus'] = false;
|
|
$result['message'] = "Your Current Password miss match, Please try Again !!";
|
|
}
|
|
return $result;
|
|
}
|
|
} |