From 769edb667b40bc3ebdafee24604ec0d445e817bf Mon Sep 17 00:00:00 2001 From: "venbatechnologies@gmail.com" Date: Thu, 9 Aug 2018 10:27:59 +0530 Subject: [PATCH] profile --- application/config/constants.php | 7 + application/config/routes.php | 3 + .../controllers/Dashboard_Controller.php | 3 +- .../controllers/Favourite_Controller.php | 1 + application/controllers/Login_Controller.php | 2 +- application/controllers/User_Controller.php | 51 ++++- application/libraries/BaseController.php | 1 + application/models/User_Model.php | 38 ++++ application/views/includes/Header.php | 28 ++- application/views/profile.php | 184 ++++++++++++++++++ application/views/register.php | 0 application/views/user_details.php | 6 +- 12 files changed, 313 insertions(+), 11 deletions(-) create mode 100644 application/views/profile.php mode change 100644 => 100755 application/views/register.php mode change 100644 => 100755 application/views/user_details.php diff --git a/application/config/constants.php b/application/config/constants.php index 18d3b4b..57e3db3 100755 --- a/application/config/constants.php +++ b/application/config/constants.php @@ -83,3 +83,10 @@ defined('EXIT_USER_INPUT') OR define('EXIT_USER_INPUT', 7); // invalid user defined('EXIT_DATABASE') OR define('EXIT_DATABASE', 8); // database error defined('EXIT__AUTO_MIN') OR define('EXIT__AUTO_MIN', 9); // lowest automatically-assigned error code defined('EXIT__AUTO_MAX') OR define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code + + + +/**** USER DEFINED CONSTANTS **********/ + +define('ROLE_ADMIN', '1'); +define('REGISTER_USERS', '2'); \ No newline at end of file diff --git a/application/config/routes.php b/application/config/routes.php index 731bf8a..361cd53 100755 --- a/application/config/routes.php +++ b/application/config/routes.php @@ -90,6 +90,9 @@ $route['Add_Register'] = 'Login_Controller/Add_Register'; $route['user_details'] = 'User_Controller/user_details_master'; +$route['profile'] = 'User_Controller/Profile'; +$route['Updateprofile'] = 'User_Controller/Update_Profile'; + $route['logout'] = 'User_Controller/logout'; $route['userListing'] = 'User_Controller/userListing'; diff --git a/application/controllers/Dashboard_Controller.php b/application/controllers/Dashboard_Controller.php index b59ac8e..888cc15 100755 --- a/application/controllers/Dashboard_Controller.php +++ b/application/controllers/Dashboard_Controller.php @@ -15,6 +15,7 @@ class Dashboard_Controller extends BaseController public function __construct(){ parent::__construct(); $this->load->model('Dashboard_Model'); + $this->isLoggedIn(); } /** @@ -31,7 +32,7 @@ class Dashboard_Controller extends BaseController function Dashboard() { $this->global['pageTitle'] = 'Visa : Dashboard'; - $this->loadViews('Dashboard', $this->global,NULL , NULL); + $this->loadViews('Dashboard', $this->global); } /** diff --git a/application/controllers/Favourite_Controller.php b/application/controllers/Favourite_Controller.php index c1c280d..1e4106c 100755 --- a/application/controllers/Favourite_Controller.php +++ b/application/controllers/Favourite_Controller.php @@ -14,6 +14,7 @@ class Favourite_Controller extends BaseController */ public function __construct(){ parent::__construct(); + $this->isLoggedIn(); // $this->load->model('Favourite_Model'); } diff --git a/application/controllers/Login_Controller.php b/application/controllers/Login_Controller.php index 6c34492..157c8f9 100755 --- a/application/controllers/Login_Controller.php +++ b/application/controllers/Login_Controller.php @@ -280,7 +280,7 @@ class Login_Controller extends CI_Controller array( 'email'=>$this->input->post('Email'), 'password'=>getHashedPassword($this->input->post('Password')), 'mobile'=>$this->input->post('PhoneNo'), - 'roleId'=>'2', + 'roleId'=>REGISTER_USERS, 'name'=>$this->input->post('Name'), 'createdDtm'=>date('Y-m-d H:i:s')); $register= $this->Login_Model->Add_Register($Registerdata); diff --git a/application/controllers/User_Controller.php b/application/controllers/User_Controller.php index c277d3e..d2b43a1 100755 --- a/application/controllers/User_Controller.php +++ b/application/controllers/User_Controller.php @@ -26,9 +26,10 @@ class User_Controller extends BaseController */ public function index() { - $this->global['pageTitle'] = 'CodeInsect : Dashboard'; + $this->global['pageTitle'] = 'VISA : Dashboard'; $this->loadViews("dashboard", $this->global, NULL , NULL); + } /** @@ -39,6 +40,54 @@ class User_Controller extends BaseController $data['getuserdetails']= $this->User_Model->Get_UserDetails(); $this->loadViews('user_details', $this->global,$data , NULL); } + + /** + * This function used to load the Profile Details page + */ + function Profile(){ + $this->global['pageTitle'] = 'Visa : Profile Details'; + //$userId=$this->global['userid']; + // echo $userId; + $data['getprofile']= $this->User_Model->Get_Profile($this->global['userid']); + $this->loadViews('profile', $this->global,$data , NULL); + } + + /** + * To Store Register Details + */ + function Update_Profile(){ + + $RegNo = $this->input->post('HideRegNo'); // value getting from hidden field + $userId = $this->input->post('HideuserId'); // value getting from hidden field + + $Registerdata = + array( 'Name'=>$this->input->post('Name'), + 'PhoneNo'=>$this->input->post('PhoneNo'), + 'Email'=>$this->input->post('Email'), + 'AlternateEmail'=>$this->input->post('AlternateEmail'), + 'Designation'=>$this->input->post('Designation'), + 'CompanyName'=>$this->input->post('CompanyName'), + 'CityName'=>$this->input->post('CityName'), + 'CountryName'=>$this->input->post('CountryName'), + 'Address'=>$this->input->post('Address')); + $Userdata = + array( 'email'=>$this->input->post('Email'), + 'password'=>getHashedPassword($this->input->post('Password')), + 'mobile'=>$this->input->post('PhoneNo'), + 'roleId'=>REGISTER_USERS, + 'name'=>$this->input->post('Name')); + $register= $this->User_Model->Update_Register($Registerdata,$RegNo); + $user= $this->User_Model->Update_User($Userdata,$userId); + + if($register == True && $user == True) + { + echo""; + } + else{ + echo""; + + } + } /** * This function is used to load the user list diff --git a/application/libraries/BaseController.php b/application/libraries/BaseController.php index 898d765..4d664a1 100755 --- a/application/libraries/BaseController.php +++ b/application/libraries/BaseController.php @@ -44,6 +44,7 @@ class BaseController extends CI_Controller { $this->lastLogin = $this->session->userdata ( 'lastLogin' ); $this->global ['name'] = $this->name; + $this->global ['userid'] = $this->vendorId; $this->global ['role'] = $this->role; $this->global ['role_text'] = $this->roleText; $this->global ['last_login'] = $this->lastLogin; diff --git a/application/models/User_Model.php b/application/models/User_Model.php index 2393e26..112565b 100755 --- a/application/models/User_Model.php +++ b/application/models/User_Model.php @@ -3,6 +3,9 @@ class User_model extends CI_Model { +/** + * This function is used to get the User Details + */ function Get_UserDetails() { $this->db->select('*'); @@ -11,6 +14,41 @@ class User_model extends CI_Model $UserDetailsData = $query->result(); return $UserDetailsData; } + +/** + * This function is used to get the Profile + */ + function Get_Profile($arg) + { + $this->db->select('reg.*,user.*'); + $this->db->from('Tab_Register reg'); + $this->db->join('Tab_Users user', 'user.name = reg.Name','left'); + $this->db->where('user.userId',$arg); + $query = $this->db->get(); + $ProfileData = $query->result(); + return $ProfileData; + } + + /** + * To Update the values of Country detail on respective CounterCode into 'Tab_Documents' table + * @param arry $CountryMasterDatas : This will have all the edited Country Details + * @param number $Cc : This is Country code + */ + function Update_Register($Registerdata,$RegNo) + { + $this->db->where('RegNo',$RegNo); + $this->db->update('Tab_Register',$Registerdata); + return TRUE; + } + + + function Update_User($Userdata,$userId){ + $this->db->where('userId',$userId); + $this->db->update('Tab_Users',$Userdata); + return TRUE; + } + + /** * This function is used to get the user listing count diff --git a/application/views/includes/Header.php b/application/views/includes/Header.php index d46dfad..47bb35e 100755 --- a/application/views/includes/Header.php +++ b/application/views/includes/Header.php @@ -70,7 +70,8 @@ + +
  • Country Visa Details @@ -168,6 +182,9 @@
  • +
  • User Details @@ -175,6 +192,7 @@
  • + diff --git a/application/views/profile.php b/application/views/profile.php new file mode 100644 index 0000000..ebb463e --- /dev/null +++ b/application/views/profile.php @@ -0,0 +1,184 @@ +PhoneNo; +// } +// } +?> + + + + +
    + +
    +
    + +
    +
    + +
    +
    +
    +
    +
    +
    + User Image +
    +
    + + + +
    +
    +
    + + +
    +
    +
    +
    + + +
    +
    +
    +
    + + +
    +
    +
    +
    + + +
    +
    + +
    +
    + + +
    +
    +
    +
    + + +
    +
    +
    +
    + + +
    +
    +
    +
    + + +
    +
    +
    +
    + + +
    +
    +
    +
    + + +
    +
    +
    +
    + + +
    +
    +
    + +
    +
    + +
    +
    + +
    + +
    + +
    + +
    + + +
    + +
    + + + + + + diff --git a/application/views/register.php b/application/views/register.php old mode 100644 new mode 100755 diff --git a/application/views/user_details.php b/application/views/user_details.php old mode 100644 new mode 100755 index 232e8d1..fe18808 --- a/application/views/user_details.php +++ b/application/views/user_details.php @@ -224,7 +224,7 @@ span:nth-child(3) .slide-up:active { Designation City Name Country Name - + Address Action @@ -244,7 +244,7 @@ span:nth-child(3) .slide-up:active { CompanyName; ?> CityName; ?> CountryName; ?> - + Address; ?> @@ -267,7 +267,7 @@ span:nth-child(3) .slide-up:active { Designation City Name Country Name - + Address Action