Esempio n. 1
0
 public function saveBenefits()
 {
     $benefitsModule = new BenefitsModule();
     $result = $benefitsModule->saveBenefitData($_SERVER['REQUEST_METHOD']);
     $historyType = "";
     if ($result == "SUCCESS_ADD") {
         $historyType = "SAVE BENEFITS";
     } else {
         if ($result == "SUCCESS_UPDATE") {
             $historyType = "UPDATE BENEFITS";
         }
     }
     // insert a history data
     $HC = new HistoryCreator();
     $HC->logFinanceLoanHistory($this->session->userPayroll['users_id'], $_POST['emp_id'], $historyType);
     echo $result;
 }
 public function reuploadProfileImage()
 {
     $employeeID = $this->uri->segment(3);
     // check first if the directory exists
     if (!file_exists("uploads/profileimages/" . $employeeID)) {
         mkdir("uploads/profileimages/" . $employeeID, 0777);
     }
     if (!empty($_FILES)) {
         $cnt = count($_FILES['file']['name']);
         for ($i = 0; $i < $cnt; $i++) {
             $tempFile = $_FILES['file']['tmp_name'];
             $fileName = $_FILES['file']['name'];
             $targetPath = getcwd() . '\\uploads\\profileimages\\' . $employeeID . '\\';
             $targetFile = $targetPath . $fileName;
             move_uploaded_file($tempFile, $targetFile);
             $ext = new SplFileInfo('uploads/profileimages/' . $employeeID . '/' . $fileName);
             $newFilename = 'profileImage.' . $ext->getExtension();
             // rename the uploaded image to the newFilename
             rename($targetFile, 'uploads/profileimages/' . $employeeID . '/' . $newFilename);
         }
     }
     // Create a history record that an employee image profile has been added/replaced
     $HC = new HistoryCreator();
     $HC->logEmployeeHistory($this->session->userPayroll['users_id'], $employeeID, "UPDATE PROFILE IMAGE");
 }