From bbba0d4de7c0bb6036263c668bcfce10beb666fb Mon Sep 17 00:00:00 2001 From: vadivel J Date: Thu, 24 Oct 2024 12:47:26 +0530 Subject: [PATCH] changes in employee module --- app/Controllers/Employeedetails.php | 115 ++++------------------------ app/Views/addEmployeenew.php | 4 +- app/Views/editEmployeenew.php | 23 +++--- 3 files changed, 30 insertions(+), 112 deletions(-) diff --git a/app/Controllers/Employeedetails.php b/app/Controllers/Employeedetails.php index 1c020e38..5344a673 100755 --- a/app/Controllers/Employeedetails.php +++ b/app/Controllers/Employeedetails.php @@ -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 + */ @@ -249,6 +219,10 @@ class Employeedetails extends BaseController $photo->move($uploadDir, $newName); $Picture = $newName; } + else{ + echo "Incorrect file format provided"; + return false; + } } } // $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*/ + function UpdateEmployee() @@ -700,41 +643,12 @@ class Employeedetails extends BaseController $EmpId = $this->request->getGet('empId'); - $PictureName = $this->request->getPost('Image'); - $ModifyPictureName = $this->request->getPost('ModifyImage'); + //if it is empty it means the default image is selected + $oldPictureName = $this->request->getPost('oldImageName'); $Picture = ""; - if ($PictureName != '') { - - - 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()) { + $photo = $this->request->getFile('photo'); + + if (isset($photo) && $photo->isValid() && !$photo->hasMoved()) { $uploadDir = ROOTPATH . 'public/uploads/images/'; $allowedTypes = ['jpg', 'jpeg', 'png', 'gif']; if (in_array($photo->getExtension(), $allowedTypes)) { @@ -745,10 +659,11 @@ class Employeedetails extends BaseController $photo->move($uploadDir, $newName); $Picture = $newName; } - } + + }else{ + $Picture=$oldPictureName; } - } - //echo $Picture; + $FirstName = $this->request->getPost('FirstName'); $LastName = $this->request->getPost('LastName'); diff --git a/app/Views/addEmployeenew.php b/app/Views/addEmployeenew.php index 690ced32..25f0e013 100755 --- a/app/Views/addEmployeenew.php +++ b/app/Views/addEmployeenew.php @@ -430,7 +430,7 @@
-
+
@@ -439,7 +439,7 @@
your image
+ alt="your image" style="width: 139px;" />
diff --git a/app/Views/editEmployeenew.php b/app/Views/editEmployeenew.php index e51b9720..202b2e4f 100755 --- a/app/Views/editEmployeenew.php +++ b/app/Views/editEmployeenew.php @@ -109,10 +109,13 @@ if (!empty($EmpDetails)) { } $isactive = $Emp->IsActive; + $ProfilePicPath=''; + if (!empty($Emp->ProfilePic)) { - $ProfilePic = 'public/uploads/images/' . $Emp->ProfilePic; + + $ProfilePicPath = base_url().'public/uploads/images/' . $Emp->ProfilePic; } else { - $ProfilePic = 'public/assets/dist/img/avatar.png'; + $ProfilePicPath = base_url().'public/assets/dist/img/avatar.png'; } $Reference_Name = $Emp->Reference_Name; $Reference_ContactNumber = $Emp->Reference_ContactNumber; @@ -199,7 +202,9 @@ if (!empty($EmpDetails)) {
- +
@@ -208,7 +213,7 @@ if (!empty($EmpDetails)) {
your image @@ -229,15 +234,13 @@ if (!empty($EmpDetails)) {
- - + +