예제 #1
0
파일: user_work.php 프로젝트: rhertzog/lcs
 } elseif ($assignmentContent == "FILE") {
     if (isset($_REQUEST['currentWrkUrl'])) {
         // if there was already a file and nothing was provided to replace it, reuse it
         $wrkForm['filename'] = $_REQUEST['currentWrkUrl'];
     } elseif (!is_null($submitGroupWorkUrl)) {
         $wrkForm['filename'] = $assignment->createUniqueFilename(basename($submitGroupWorkUrl));
         $groupWorkFile = get_path('coursesRepositorySys') . '/' . claro_get_course_path() . '/group/' . claro_get_current_group_data('directory') . '/' . $submitGroupWorkUrl;
         $groupWorkFile = secure_file_path($groupWorkFile);
         if (file_exists($groupWorkFile)) {
             copy($groupWorkFile, $assignment->getAssigDirSys() . $wrkForm['filename']);
         } else {
             // if the main thing to provide is a file and that no file was sent
             $dialogBox->error(get_lang('Unable to copy file : %filename', array('%filename' => basename($submitGroupWorkUrl))));
             $formCorrectlySent = false;
         }
     } elseif ($submission->getParentId() == 0) {
         // if the main thing to provide is a file and that no file was sent
         $dialogBox->error(get_lang('Field \'%name\' is required', array('%name' => get_lang('File'))));
         $formCorrectlySent = false;
     }
 } elseif ($assignmentContent == "TEXTFILE") {
     // attached file is optionnal if work type is TEXT AND FILE
     // so the attached file can be deleted only in this mode
     if (!is_null($submitGroupWorkUrl)) {
         $wrkForm['filename'] = $assignment->createUniqueFilename(basename($submitGroupWorkUrl) . '.url');
         create_link_file($assignment->getAssigDirSys() . $wrkForm['filename'], get_path('coursesRepositoryWeb') . claro_get_course_path() . '/' . $submitGroupWorkUrl);
     }
     // if delete of the file is required
     if (isset($_REQUEST['delAttacheDFile'])) {
         $wrkForm['filename'] = '';
         // empty DB field