Esempio n. 1
0
 function update()
 {
     $tutor = new Tutor();
     $tutor->setNome($_POST['nome']);
     $tutor->setCpf($_POST['cpf']);
     $tutor->setEmail($_POST['email']);
     $tutor->setSobrenome($_POST['sobrenome']);
     $formacao = array('id' => $_POST['formacao']);
     $titulacao = array('id' => $_POST['titulacao']);
     $tutor->setFormacao($formacao);
     $tutor->setTitulacao($titulacao);
     $tutor->setTutorId($_POST['id']);
     $tutor->setId($_POST['id_pessoa']);
     $tutor->update();
     header("location: ../view/index.php");
 }
     $uploadOk = 1;
     $msg = '';
     if ($newPicture != "") {
         if (move_uploaded_file($_FILES["picture"]["tmp_name"], $targetPicture)) {
             $msg .= "The file " . basename($_FILES["picture"]["name"]) . " has been uploaded.";
             $status = 'ok';
             if (file_exists(MEDIA_FILES_PATH . "tutor/" . $oldPicture)) {
                 unlink(MEDIA_FILES_PATH . "tutor/" . $oldPicture);
             }
             $uploadOk = 1;
         } else {
             $uploadOk = 0;
         }
     }
     if ($uploadOk == 1) {
         echo $tutorObj->update();
     } else {
         $msg = " Sorry, there was an error uploading your tutor picture. ERROR: " . $msg;
         $json = array("status" => 0, "msg" => $msg);
         $dbObj->close();
         //Close Database Connection
         header('Content-type: application/json');
         echo json_encode($json);
     }
 } else {
     $json = array("status" => 0, "msg" => $errorArr);
     $dbObj->close();
     //Close Database Connection
     header('Content-type: application/json');
     echo json_encode($json);
 }