changes in employee module
This commit is contained in:
parent
1be49e8aea
commit
bbba0d4de7
@ -199,37 +199,7 @@ class Employeedetails extends BaseController
|
|||||||
* This function is used to save the new Employee form in the database
|
* This function is used to save the new Employee form in the database
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* This function is used to save the new Employee form in the database
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* This function is used to save the new Employee form in the database
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* This function is used to save the new Employee form in the database
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* This function is used to save the new Employee form in the database
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* This function is used to save the new Employee form in the database
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* This function is used to save the new Employee form in the database
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* This function is used to save the new Employee form in the database
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* This function is used to save the new Employee form in the database
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* This function is used to save the new Employee form in the database
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* This function is used to save the new Employee form in the database
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* This function is used to save the new Employee form in the database
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -249,6 +219,10 @@ class Employeedetails extends BaseController
|
|||||||
$photo->move($uploadDir, $newName);
|
$photo->move($uploadDir, $newName);
|
||||||
$Picture = $newName;
|
$Picture = $newName;
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
echo "Incorrect file format provided";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// $Profile = $this->request->getPost('photo');
|
// $Profile = $this->request->getPost('photo');
|
||||||
@ -661,38 +635,7 @@ class Employeedetails extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* To Update the employee details*/
|
/* To Update the employee details*/
|
||||||
/* To Update the employee details*/
|
|
||||||
/* To Update the employee details*/
|
|
||||||
/* To Update the employee details*/
|
|
||||||
/* To Update the employee details*/
|
|
||||||
/* To Update the employee details*/
|
|
||||||
/* To Update the employee details*/
|
|
||||||
/* To Update the employee details*/
|
|
||||||
/* To Update the employee details*/
|
|
||||||
/* To Update the employee details*/
|
|
||||||
/* To Update the employee details*/
|
|
||||||
/* To Update the employee details*/
|
|
||||||
/* To Update the employee details*/
|
|
||||||
/* To Update the employee details*/
|
|
||||||
/* To Update the employee details*/
|
|
||||||
/* To Update the employee details*/
|
|
||||||
/* To Update the employee details*/
|
|
||||||
/* To Update the employee details*/
|
|
||||||
/* To Update the employee details*/
|
|
||||||
/* To Update the employee details*/
|
|
||||||
/* To Update the employee details*/
|
|
||||||
/* To Update the employee details*/
|
|
||||||
/* To Update the employee details*/
|
|
||||||
/* To Update the employee details*/
|
|
||||||
/* To Update the employee details*/
|
|
||||||
/* To Update the employee details*/
|
|
||||||
/* To Update the employee details*/
|
|
||||||
/* To Update the employee details*/
|
|
||||||
/* To Update the employee details*/
|
|
||||||
/* To Update the employee details*/
|
|
||||||
/* To Update the employee details*/
|
|
||||||
/* To Update the employee details*/
|
|
||||||
/* To Update the employee details*/
|
|
||||||
|
|
||||||
|
|
||||||
function UpdateEmployee()
|
function UpdateEmployee()
|
||||||
@ -700,41 +643,12 @@ class Employeedetails extends BaseController
|
|||||||
|
|
||||||
$EmpId = $this->request->getGet('empId');
|
$EmpId = $this->request->getGet('empId');
|
||||||
|
|
||||||
$PictureName = $this->request->getPost('Image');
|
//if it is empty it means the default image is selected
|
||||||
$ModifyPictureName = $this->request->getPost('ModifyImage');
|
$oldPictureName = $this->request->getPost('oldImageName');
|
||||||
$Picture = "";
|
$Picture = "";
|
||||||
if ($PictureName != '') {
|
$photo = $this->request->getFile('photo');
|
||||||
|
|
||||||
|
if (isset($photo) && $photo->isValid() && !$photo->hasMoved()) {
|
||||||
if (strlen((string)$ModifyPictureName) == 0) {
|
|
||||||
|
|
||||||
$Picture = $PictureName;
|
|
||||||
} else {
|
|
||||||
|
|
||||||
$photo = $this->request->getFile('ModifyImage');
|
|
||||||
if (!$photo || !$photo->isValid()) {
|
|
||||||
$photo = $this->request->getFile('photo');
|
|
||||||
}
|
|
||||||
if (isset($photo)) {
|
|
||||||
if ($photo->isValid() && !$photo->hasMoved()) {
|
|
||||||
$uploadDir = ROOTPATH . 'public/uploads/images/';
|
|
||||||
$allowedTypes = ['jpg', 'jpeg', 'png', 'gif'];
|
|
||||||
if (in_array($photo->getExtension(), $allowedTypes)) {
|
|
||||||
$newName = $photo->getRandomName();
|
|
||||||
if (!is_dir($uploadDir)) {
|
|
||||||
mkdir($uploadDir, 0777, true);
|
|
||||||
}
|
|
||||||
$photo->move($uploadDir, $newName);
|
|
||||||
$Picture = $newName;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
//echo 'Not Exists';
|
|
||||||
$photo = $this->request->getFile('photo');
|
|
||||||
if (isset($photo)) {
|
|
||||||
if ($photo->isValid() && !$photo->hasMoved()) {
|
|
||||||
$uploadDir = ROOTPATH . 'public/uploads/images/';
|
$uploadDir = ROOTPATH . 'public/uploads/images/';
|
||||||
$allowedTypes = ['jpg', 'jpeg', 'png', 'gif'];
|
$allowedTypes = ['jpg', 'jpeg', 'png', 'gif'];
|
||||||
if (in_array($photo->getExtension(), $allowedTypes)) {
|
if (in_array($photo->getExtension(), $allowedTypes)) {
|
||||||
@ -745,10 +659,11 @@ class Employeedetails extends BaseController
|
|||||||
$photo->move($uploadDir, $newName);
|
$photo->move($uploadDir, $newName);
|
||||||
$Picture = $newName;
|
$Picture = $newName;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
}else{
|
||||||
|
$Picture=$oldPictureName;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
//echo $Picture;
|
|
||||||
|
|
||||||
$FirstName = $this->request->getPost('FirstName');
|
$FirstName = $this->request->getPost('FirstName');
|
||||||
$LastName = $this->request->getPost('LastName');
|
$LastName = $this->request->getPost('LastName');
|
||||||
|
|||||||
@ -430,7 +430,7 @@
|
|||||||
|
|
||||||
<div class="tab-pane active" id="first">
|
<div class="tab-pane active" id="first">
|
||||||
|
|
||||||
<form id="accountForm" method="post" action="#" class="form-horizontal">
|
<form id="accountForm" method="post" enctype="multipart/form-data" action="#" class="form-horizontal">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
||||||
<div class="col-md-2">
|
<div class="col-md-2">
|
||||||
@ -439,7 +439,7 @@
|
|||||||
<div class="box-header">
|
<div class="box-header">
|
||||||
<img id="profilepicture"
|
<img id="profilepicture"
|
||||||
src="<?php echo base_url(); ?>public/assets/dist/img/avatar.png"
|
src="<?php echo base_url(); ?>public/assets/dist/img/avatar.png"
|
||||||
alt="your image" style="width: 139px;" /><br />
|
alt="your image" style="width: 139px;" /><br/>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -109,10 +109,13 @@ if (!empty($EmpDetails)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$isactive = $Emp->IsActive;
|
$isactive = $Emp->IsActive;
|
||||||
|
$ProfilePicPath='';
|
||||||
|
|
||||||
if (!empty($Emp->ProfilePic)) {
|
if (!empty($Emp->ProfilePic)) {
|
||||||
$ProfilePic = 'public/uploads/images/' . $Emp->ProfilePic;
|
|
||||||
|
$ProfilePicPath = base_url().'public/uploads/images/' . $Emp->ProfilePic;
|
||||||
} else {
|
} else {
|
||||||
$ProfilePic = 'public/assets/dist/img/avatar.png';
|
$ProfilePicPath = base_url().'public/assets/dist/img/avatar.png';
|
||||||
}
|
}
|
||||||
$Reference_Name = $Emp->Reference_Name;
|
$Reference_Name = $Emp->Reference_Name;
|
||||||
$Reference_ContactNumber = $Emp->Reference_ContactNumber;
|
$Reference_ContactNumber = $Emp->Reference_ContactNumber;
|
||||||
@ -199,7 +202,9 @@ if (!empty($EmpDetails)) {
|
|||||||
|
|
||||||
<div class="tab-pane active" id="first">
|
<div class="tab-pane active" id="first">
|
||||||
|
|
||||||
<form id="accountForm" method="post" action="#" class="form-horizontal">
|
<form id="accountForm" method="post" action="#"
|
||||||
|
enctype="multipart/form-data"
|
||||||
|
class="form-horizontal">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
||||||
<div class="col-md-2">
|
<div class="col-md-2">
|
||||||
@ -208,7 +213,7 @@ if (!empty($EmpDetails)) {
|
|||||||
<div class="box-header">
|
<div class="box-header">
|
||||||
|
|
||||||
<img id="profilepicture"
|
<img id="profilepicture"
|
||||||
src="<?php echo base_url() . $ProfilePic; ?>"
|
src="<?php echo $ProfilePicPath; ?>"
|
||||||
alt="your image" style="width: 139px;" />
|
alt="your image" style="width: 139px;" />
|
||||||
|
|
||||||
|
|
||||||
@ -229,15 +234,13 @@ if (!empty($EmpDetails)) {
|
|||||||
<br>
|
<br>
|
||||||
|
|
||||||
<input type='file' onchange="readURL(this);" id="photo"
|
<input type='file' onchange="readURL(this);" id="photo"
|
||||||
value="<?php echo base_url() . $ProfilePic; ?>"
|
|
||||||
name="photo" />
|
name="photo" />
|
||||||
|
|
||||||
|
|
||||||
<input type="hidden" name="Image" id="Image"
|
<input type="hidden" name="oldImageName" id="Image"
|
||||||
value="<?php echo $ProfilePic; ?>" class="form-control"
|
value="<?php echo $Emp->ProfilePic; ?>" class="form-control"
|
||||||
readonly>
|
readonly>
|
||||||
<input type="hidden" name="ModifyImage" id="ModifyImage"
|
|
||||||
class="form-control" readonly>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user