| Server IP : 188.114.97.2 / Your IP : 104.23.243.201 Web Server : Apache/2.4.59 (Debian) System : Linux EDL-STRETCH 4.19.0-27-amd64 #1 SMP Debian 4.19.316-1 (2024-06-25) x86_64 User : edlftp ( 1002) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/git/sms.edl.codes.solutions/application/models/ |
Upload File : |
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Profile_model extends CI_Model {
function __construct() {
parent::__construct();
$this->load->model('crud_model');
$this->load->model('email_model');
$this->load->database();
}
function language(){
$query = $this->db->get('mod772_icl_languages');
$query = $query->result_array();
return $query;
}
function data_profile(){
$id = $this->session->userdata('userID');
$role = $this->session->userdata('login_type');
$profile = array();
if($role == "admin"){
$user = $this->crud_model->get_user_info($id);
$profile = array(
'lang' => $user[0]['lang'],
'dob' => 'n/a',
'phone' => $user[0]['phone'],
'l1' => 'n/a',
'l2' => 'n/a',
'coun' => 'n/a',
'state' => 'n/a',
'pc' => 'n/a',
'location' => 'n/a'
);
}
else if($role == "teacher"){
$teacher = $this->crud_model->get_teacher_info($id);
$teacherLang = $this->crud_model->get_teacher_lang($id);
$user = $this->crud_model->get_user_info($id);
$address = $this->crud_model->get_user_address($teacher[0]['address_id']);
$profile = array(
'lang' => $user[0]['lang'],
'dob' => $teacher[0]['dob'],
'phone' => $user[0]['phone'],
'l1' => $address[0]['line_1'],
'l2' => $address[0]['line_2'],
'coun' => $address[0]['country'],
'state' => $address[0]['state'],
'pc' => $address[0]['postcode'],
'location' => $address[0]['location']
);
}
else{
}
return $profile;
}
function password_reset($pass){
$id = $this->session->userdata('userID');
$role = $this->session->userdata('login_type');
$name = $this->crud_model->get_student_name($id);
$email = $this->crud_model->get_user_email($id);
$lang = $this->crud_model->get_user_lang($id);
$lang = $this->intToIso($lang);
if($this->email_model->password_reset_email($lang,$role,$name,$email,$pass)){
$this->db->where('user_id',$id);
$this->db->update('user',array('password'=>password_hash($pass,PASSWORD_DEFAULT)));
return true;
}else{
return false;
}
}
function set_session_lang(){
$id = $this->session->userdata('userID');
$lang = $this->crud_model->get_user_lang($id);
$language = $this->intToString($lang);
$this->session->set_userdata('current_language', $language);
}
function intToString($id){
$query = $this->db->get_where('mod772_icl_languages', array('id' => $id));
$res = $query->result_array();
foreach ($res as $row)
return strtolower($row['english_name']);
}
function intToIso($id){
$query = $this->db->get_where('mod772_icl_languages', array('id' => $id));
$res = $query->result_array();
foreach ($res as $row)
return strtolower($row['tag']);
}
function intToStringC($id){
$query = $this->db->get_where('course_language', array('course_language_id' => $id));
$res = $query->result_array();
foreach ($res as $row)
return strtolower($row['name']);
}
function isoToLang($iso){
$query = $this->db->get_where('mod772_icl_languages', array('tag' => $iso));
$res = $query->result_array();
foreach ($res as $row)
return strtolower($row['english_name']);
}
}