Ejemplo n.º 1
0
 $employee->delete_flag = $delete_flag;
 $employee->login = $login;
 $employee->password = $password;
 $employee->email = $email;
 $employee->post = $post;
 $employee->birthday = parse_date('{Y}-{m}-{d}', $birthday, false);
 $employee->home_address = $home_address;
 $employee->office_phone = $office_phone;
 $employee->home_phone = $home_phone;
 $employee->cellular = $cellular;
 $employee->room = $room;
 $errors = $employee->IsValidData();
 $uploaded_file = '';
 if ($_FILES['photo']['error'] == UPLOAD_ERR_OK) {
     $uploaded_file = $_FILES['photo']['tmp_name'];
     if (!$employee->CheckImageType($uploaded_file)) {
         $errors[] = 'Неверный формат изображения. Допустимые форматы: gif/jpeg/png';
     }
 } else {
     if ($_FILES['photo']['error'] != UPLOAD_ERR_NO_FILE) {
         $errors[] = 'Ошибка загрузки фотографии: ERROR ' . $_FILES['photo']['error'];
     }
 }
 if (count($errors) == 0) {
     $employee->birthday = parse_date('{Y}-{m}-{d}', $birthday, true);
     $employee->Save();
     if ($uploaded_file != '') {
         $employee->UploadPhoto($uploaded_file);
         $employee->SetPhotoFlag(true);
     }
     $db = db_class::get_instance();