This commit is contained in:
venbatechnologies@gmail.com 2018-08-09 10:27:59 +05:30
parent a7ef7d5168
commit 769edb667b
12 changed files with 313 additions and 11 deletions

View File

@ -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');

View File

@ -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';

View File

@ -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);
}
/**

View File

@ -14,6 +14,7 @@ class Favourite_Controller extends BaseController
*/
public function __construct(){
parent::__construct();
$this->isLoggedIn();
// $this->load->model('Favourite_Model');
}

View File

@ -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);

View File

@ -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"<script>alert('Updated Successfully');window.location.href='profile';</script>";
}
else{
echo"<script>alert('Not Saved Try Again');window.location.href='profile';</script>";
}
}
/**
* This function is used to load the user list

View File

@ -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;

View File

@ -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

View File

@ -70,7 +70,8 @@
<li class="dropdown user user-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<img src="<?php echo base_url(); ?>assets/dist/img/user2-160x160.jpg" class="user-image" alt="User Image">
<span class="hidden-xs">VISA Employee</span>
<!--<span class="hidden-xs">VISA Employee</span>-->
<span class="hidden-xs"><?php echo $name; ?></span>
</a>
<ul class="dropdown-menu">
<!-- User image -->
@ -78,8 +79,8 @@
<img src="<?php echo base_url(); ?>assets/dist/img/user2-160x160.jpg" class="img-circle" alt="User Image">
<p>
Visa Employee - Admin
<small>Member of VISA. 2018</small>
<?php echo $name; ?>
<small><?php echo $role_text; ?></small>
</p>
</li>
<!-- Menu Body -->
@ -113,7 +114,7 @@
<img src="<?php echo base_url(); ?>assets/dist/img/user2-160x160.jpg" class="img-circle" alt="User Image">
</div>
<div class="pull-left info">
<p>Visa Employee</p>
<p><?php echo $name; ?></p>
<a href="<?php echo base_url(); ?>#"><i class="fa fa-circle text-success"></i> Online</a>
</div>
</div>
@ -146,6 +147,18 @@
</span>
</a>
</li>
<?php
if($role == REGISTER_USERS){ ?>
<li>
<a href="<?php echo base_url(); ?>profile">
<i class="fa fa-user"></i> <span>Profile</span>
<span class="pull-right-container">
</span>
</a>
</li>
<?php } ?>
<?php
if($role == ROLE_ADMIN){ ?>
<li class="treeview">
<a href="<?php echo base_url(); ?>#">
<i class="fa fa-database"></i>
@ -160,7 +173,8 @@
<li><a href="<?php echo base_url(); ?>visa_type_master"><i class="fa fa-cc-visa"></i>Visa Type Master</a></li>
<li><a href="<?php echo base_url(); ?>document_master"><i class="fa fa-file"></i>Document Master</a></li>
</ul>
</li>
</li>
<?php } ?>
<li>
<a href="<?php echo base_url(); ?>country_visa_details">
<i class="fa fa-globe"></i> <span>Country Visa Details</span>
@ -168,6 +182,9 @@
</span>
</a>
</li>
<?php
//if($role == REGISTER_USERS){}
if($role == ROLE_ADMIN){ ?>
<li>
<a href="<?php echo base_url(); ?>user_details">
<i class="fa fa-users"></i> <span>User Details</span>
@ -175,6 +192,7 @@
</span>
</a>
</li>
<?php } ?>
</ul>
</section>
<!-- /.sidebar -->

View File

@ -0,0 +1,184 @@
<?php
// $PhoneNo = '';
// if(!empty($getprofile)){
// foreach($getprofile as $gp){
// $PhoneNo = $gp->PhoneNo;
// }
// }
?>
<style>
.input-group .input-group-addon {
border:0;
}
.input-group .form-control, .input-group-addon, .input-group-btn{
border-right: 0;
border-left: 0;
border-top: 0;
}
.input-group {
margin-bottom:15px;
}
.btn-primary:hover, .btn-primary:active, .btn-primary.hover{
background-color: #087322;
}
.btn-primary12:hover, .btn-primary12:active, .btn-primary12.hover{
background-color: #FFC107;
color: #fff;
}
.box-title-box{
z-index: 5;
height: 90px;
width: 90px;
border: 3px solid;
border-color: transparent;
border-color: rgba(255,255,255,0.2);
border-radius: 50%;
margin-left: 18px;
box-shadow: 0 4px 20px 0 rgba(0,0,0,.14), 0 7px 10px -5px rgba(233,30,99,.4);
display: inline-block;
margin-top: -80px;
}
.nav-tabs-custom>.nav-tabs>li.active{
border-top-color:#dc2265 !important;
}
.box-solid{
box-shadow: 0 3px 4px 0 rgba(0,0,0,0.14),
0 3px 3px -2px rgba(0,0,0,0.12),
0 1px 8px 0 rgba(0,0,0,0.2);
}
.btn-success.focus, .btn-success:focus{
background-color: #dd2366;
border-color: #dd2366;
box-shadow:0 4px 20px 0 rgba(0,0,0,.14), 0 7px 10px -5px rgba(233,30,99,.4);
}
.btn-success:hover, .btn-success:active, .btn-success.hover {
background-color: rgba(219, 34, 101, 0.64);
border-color: #dd2366;
box-shadow:0 4px 20px 0 rgba(0,0,0,.14), 0 7px 10px -5px rgba(233,30,99,.4);
}
.btn-success {
background-color: #dd2366;
border-color: #dd2366;
box-shadow:0 4px 20px 0 rgba(0,0,0,.14), 0 7px 10px -5px rgba(233,30,99,.4);
}
</style>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper" style="background-color: #eee;">
<!-- Content Header (Page header) -->
<section class="content-header">
</section>
<!-- Main content -->
<section class="content" style="margin-top: 50px;">
<div class="row">
<?php //echo $userid;?>
<div class="col-md-offset-2 col-md-8">
<div class="box box-solid" style="padding: 20px;">
<div class="box-body">
<form class="form-horizontal" role="form" id="Update_Profile" action="<?php echo base_url() ?>Updateprofile" method="post">
<div class="row">
<div class="col-md-12" style="text-align:center;">
<img src="<?php echo base_url(); ?>assets/dist/img/user2-160x160.jpg" class="user-image box-title-box" alt="User Image">
</div>
</div>
<input type="hidden" class="form-control" name="HideRegNo" value="<?php echo $getprofile[0]->RegNo;?>" required />
<input type="hidden" class="form-control" name="HideuserId" value="<?php echo $getprofile[0]->userId;?>" required />
<div class="row" style="margin-top: 20px;">
<div class="col-md-6">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-user"></i></span>
<input type="text" class="form-control" placeholder="Name" name="Name" value="<?php echo $getprofile[0]->Name;?>" readonly />
</div>
</div>
<div class="col-md-6">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-mobile"></i></span>
<input type="number" class="form-control" placeholder="Phone No" name="PhoneNo" value="<?php echo $getprofile[0]->PhoneNo;?>" required />
</div>
</div>
<div class="col-md-6">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-envelope"></i></span>
<input type="mail" class="form-control" placeholder="Email ID" name="Email" value="<?php echo $getprofile[0]->Email;?>" required />
</div>
</div>
<div class="col-md-6">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-envelope"></i></span>
<input type="mail" class="form-control" placeholder="Alternate Email ID" name="AlternateEmail" value="<?php echo $getprofile[0]->AlternateEmail;?>" required />
</div>
</div>
<div class="col-md-6">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-lock"></i></span>
<input type="password" class="form-control" placeholder="Password" name="Password" required />
</div>
</div>
<div class="col-md-6">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-lock"></i></span>
<input type="password" class="form-control" placeholder="Re-password" name="Re-password" required />
</div>
</div>
<div class="col-md-6">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-building"></i></span>
<input type="text" class="form-control" placeholder="Company Name" name="CompanyName" value="<?php echo $getprofile[0]->CompanyName;?>" required />
</div>
</div>
<div class="col-md-6">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-briefcase "></i></span>
<input type="text" class="form-control" placeholder="Designation" name="Designation" value="<?php echo $getprofile[0]->Designation;?>" required />
</div>
</div>
<div class="col-md-6">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-map-signs"></i></span>
<input type="text" class="form-control" placeholder="City" name="CityName" value="<?php echo $getprofile[0]->CityName;?>" required />
</div>
</div>
<div class="col-md-6">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-globe"></i></span>
<input type="text" class="form-control" placeholder="Country" name="CountryName" value="<?php echo $getprofile[0]->CountryName;?>" required />
</div>
</div>
<div class="col-md-12">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-address-card"></i></span>
<input type="text" class="form-control" placeholder="Full Address" name="Address" value="<?php echo $getprofile[0]->Address;?>" required />
</div>
</div>
</div>
<div class="row">
<div class="col-xs-offset-4 col-xs-4">
<input type="Submit" class="btn btn-block btn-success btn-sm" value="UPDATE PROFILE">
</div>
</div>
<?php //print_r($getprofile); ?>
</form>
<!-- /.box-body -->
</div>
<!-- /.box -->
</div>
<!-- ./col -->
</div>
<!-- /.row -->
</section>
<!-- /.content -->
</div>
<!-- /.content-wrapper -->
<!-- jQuery 3 -->
<script src="<?php echo base_url(); ?>assets/bower_components/jquery/dist/jquery.min.js"></script>

0
application/views/register.php Normal file → Executable file
View File

6
application/views/user_details.php Normal file → Executable file
View File

@ -224,7 +224,7 @@ span:nth-child(3) .slide-up:active {
<th>Designation</th>
<th>City Name</th>
<th>Country Name</th>
<!--<th>Address</th>-->
<th>Address</th>
<!--<th>Status</th>-->
<th>Action</th>
</tr>
@ -244,7 +244,7 @@ span:nth-child(3) .slide-up:active {
<td><?php echo $userdetails->CompanyName; ?></td>
<td><?php echo $userdetails->CityName; ?></td>
<td><?php echo $userdetails->CountryName; ?></td>
<!--<td><?php echo $userdetails->Address; ?></td>-->
<td><?php echo $userdetails->Address; ?></td>
<!--<td></td>-->
<!--<td><a data-toggle="modal" ><i data-toggle="tooltip" title="" data-original-title="Click here to view/Edit"></i></a>-->
<!--<td><a id="btn" data-id="<?php //echo $userdetails->RegNo; ?>" data-userid="<?php echo $userdetails->RegNo; ?>" data-toggle="modal"><i class="fa fa-edit" data-toggle="tooltip" title="<?php //echo $userdetails->RegNo; ?> - Click here to view User details"></i>&nbsp;&nbsp;&nbsp;</a></td> -->
@ -267,7 +267,7 @@ span:nth-child(3) .slide-up:active {
<th>Designation</th>
<th>City Name</th>
<th>Country Name</th>
<!--<th>Address</th>-->
<th>Address</th>
<!--<th>Status</th>-->
<th>Action</th>
</tr>