Exemple #1
0
     } else {
         $destino = text2url($_SESSION['user']['id'] . '_' . $_SESSION['user']['name']);
     }
     $name = text2url($_POST['nombre']);
     $ruta = subirArchivo($_FILES['fichero'], $destino, $name);
     $documentation = new Documentation($db);
     $data = array();
     if (isset($_POST['paciente'])) {
         $data['id_patient'] = $_POST['paciente'];
     } else {
         $data['id_patient'] = $_SESSION['user']['id'];
     }
     $data['emisor'] = $_SESSION['user']['type'];
     $data['url'] = $ruta;
     $data['nombre'] = $_POST['nombre'];
     $result = $documentation->insertDocumentation($data);
     if ($result->resultado) {
         echo 'ok';
     }
     break;
 case "erase_file":
     $documentation = new Documentation($db);
     if ($_SESSION['user']['type'] == PATIENT) {
         $filtros = array();
         add_filter($filtros, 'id_documentation', $data['id']);
         add_filter($filtros, 'id_patient', $_SESSION['user']['id']);
         $result = $documentation->get($filtros);
         if ($result->resultado) {
             $datos = array();
             $datos['eliminado_paciente'] = 1;
             $result = $documentation->updateDocumentation($datos, $data['id']);