Gitlab CSE Unil

Commit 2ceecfdd authored by M. Chardon's avatar M. Chardon
Browse files

bug recordagain false

parent 968944f0
......@@ -613,20 +613,21 @@ class audioannotation_assignement {
}
}
if ($audioannotation->id > 0 && $audioannotation->recordagain || $audioannotation->id == null) {
//enregistrement des fichiers
try {
$hasSoundRecord = false;
$fileAudio = null;
$filesAudio = $fs->get_area_files($this->context->id, AUDIOANNOT_MODNAME_COMPLETE, $this::SOUND, $rendu->id);
//find the first file
foreach ($filesAudio as $file) {
if ($file->get_filesize() == 0) {
continue;
}
$fileAudio = $file;
break;
//if ($audioannotation->id > 0 && $audioannotation->recordagain || $audioannotation->id == null) {
//enregistrement des fichiers
try {
$hasSoundRecord = false;
$fileAudio = null;
$filesAudio = $fs->get_area_files($this->context->id, AUDIOANNOT_MODNAME_COMPLETE, $this::SOUND, $rendu->id);
//find the first file
foreach ($filesAudio as $file) {
if ($file->get_filesize() == 0) {
continue;
}
$fileAudio = $file;
break;
}
if (!$fileAudio || $audioannotation->recordagain == 1) {
if (array_key_exists($this::FILERECORD . $i, $formDataArr) && intval($formDataArr[$this::FILERECORD . $i]) > 0 && ($fileAudio == null || $fileAudio->get_id() != $formDataArr[$this::FILERECORD . $i])) {
$contextuser = context_user::instance($USER->id);
if (!$files = $fs->get_area_files($contextuser->id, 'user', 'draft', $formDataArr[$this::FILERECORD . $i], 'id DESC', false)) {
......@@ -661,17 +662,18 @@ class audioannotation_assignement {
} else {
$nbRendusSave++;
}
} catch (\file_exception $e) {
$this->deleteAssignementPartError($rendu);
$devoir->flasherror = 'Erreur de chargement de fichier. Fichier probablement corrompu.';
} catch (Exception $exc) {
$this->deleteAssignementPartError($rendu);
$devoir->flasherror = 'Erreur delors de l\'enregistrement du fichier.';
}
if ($hasSoundRecord) {
editor::delAllAnnotation($rendu->id);
}
} catch (\file_exception $e) {
$this->deleteAssignementPartError($rendu);
$devoir->flasherror = 'Erreur de chargement de fichier. Fichier probablement corrompu.';
} catch (Exception $exc) {
$this->deleteAssignementPartError($rendu);
$devoir->flasherror = 'Erreur delors de l\'enregistrement du fichier.';
}
if ($hasSoundRecord) {
editor::delAllAnnotation($rendu->id);
}
//}
if ($rendu && array_key_exists($this::ANNEXES . $i, $formDataArr)) {
file_save_draft_area_files($formDataArr[$this::ANNEXES . $i], $this->context->id, AUDIOANNOT_MODNAME_COMPLETE, $this::ATTACHMENT, $rendu->id, array('subdirs' => 0, 'maxbytes' => 10485760, 'maxfiles' => 5));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment