예제 #1
0
 /**
  * Save multi feedback files
  *
  * @param
  * @return
  */
 function saveMultiFeedbackFiles($a_files, $a_user_id = 0)
 {
     global $ilUser;
     $exc = new ilObjExercise($this->getExerciseId(), false);
     include_once "./Modules/Exercise/classes/class.ilFSStorageExercise.php";
     $fstorage = new ilFSStorageExercise($this->getExerciseId(), $this->getId());
     $fstorage->create();
     $mfu = $fstorage->getMultiFeedbackUploadPath($ilUser->getId());
     if ($a_user_id == 0) {
         $a_user_id = $ilUser->getId();
     }
     $mf_files = $this->getMultiFeedbackFiles();
     foreach ($mf_files as $f) {
         if ($a_files[$f["user_id"]][$f["file"]] != "") {
             $fb_path = $fstorage->getFeedbackPath((int) $f["user_id"]);
             $target = $fb_path . "/" . $f["file"];
             if (is_file($target)) {
                 unlink($target);
             }
             // rename file
             rename($f["full_path"], $target);
             $exc->sendFeedbackFileNotification($f["file"], (int) $f["user_id"], (int) $this->getId());
         }
     }
     $this->clearMultiFeedbackDirectory();
 }
예제 #2
0
 /**
  * Save multi feedback files
  *
  * @param
  * @return
  */
 function saveMultiFeedbackFiles($a_files)
 {
     $exc = new ilObjExercise($this->getExerciseId(), false);
     include_once "./Modules/Exercise/classes/class.ilFSStorageExercise.php";
     $fstorage = new ilFSStorageExercise($this->getExerciseId(), $this->getId());
     $fstorage->create();
     $team_map = array();
     $mf_files = $this->getMultiFeedbackFiles();
     foreach ($mf_files as $f) {
         $user_id = $f["user_id"];
         $file_path = $f["full_path"];
         $file_name = $f["file"];
         // if checked in confirmation gui
         if ($a_files[$user_id][md5($file_name)] != "") {
             // #14294 - team assignment
             if ($this->getType() == ilExAssignment::TYPE_UPLOAD_TEAM) {
                 // just once for each user
                 if (!array_key_exists($user_id, $team_map)) {
                     $team_id = $this->getTeamId($user_id);
                     $team_map[$user_id]["team_id"] = "t" . $team_id;
                     $team_map[$user_id]["noti_rec_ids"] = array();
                     foreach ($this->getTeamMembers($team_id) as $team_user_id) {
                         $team_map[$user_id]["noti_rec_ids"][] = $team_user_id;
                     }
                 }
                 $feedback_id = $team_map[$user_id]["team_id"];
                 $noti_rec_ids = $team_map[$user_id]["noti_rec_ids"];
             } else {
                 $feedback_id = $user_id;
                 $noti_rec_ids = array($user_id);
             }
             if ($feedback_id) {
                 $fb_path = $fstorage->getFeedbackPath($feedback_id);
                 $target = $fb_path . "/" . $file_name;
                 if (is_file($target)) {
                     unlink($target);
                 }
                 // rename file
                 rename($file_path, $target);
                 if ($noti_rec_ids) {
                     $exc->sendFeedbackFileNotification($file_name, $noti_rec_ids, (int) $this->getId());
                 }
             }
         }
     }
     $this->clearMultiFeedbackDirectory();
 }