58 $this->lng = $DIC->language();
59 $this->lng->loadLanguageModule(
'exc');
61 $this->ass_types_with_files = array(
67 $this->logger = $DIC->logger()->exc();
106 $this->exercise_id = $input[0]->getValue();
107 $this->exercise_ref_id = $input[1]->getValue();
108 $assignment_id = $input[2]->getValue();
110 $this->user_id = $input[4]->getValue();
113 if ($assignment_id > 0) {
128 $out->setValue($final_directory);
140 $dir = $this->target_directory .
"/" . $a_directory;
146 copy($a_file, $dir .
"/" . basename($a_file));
168 foreach ($this->title_columns as $title) {
169 $this->excel->setCell(1, $col, $title);
189 $path = $this->temp_dir . DIRECTORY_SEPARATOR;
190 if ($this->participant_id > 0) {
192 $path .= $user_dir . DIRECTORY_SEPARATOR;
203 $this->logger->dump(
"lang key => " . $this->lng->getLangKey());
204 $this->submissions_directory = $this->target_directory . DIRECTORY_SEPARATOR . $this->lng->txt(
"exc_ass_submission_zip");
219 if ($this->participant_id > 0) {
220 $exc_members_id = array($this->participant_id);
222 $exc_members_id =
$exercise->members_obj->getMembers();
226 $exc_members_id = $filter->filterParticipantsByAccess();
228 foreach ($exc_members_id as $member_id) {
230 $submission->updateTutorDownloadTime();
235 foreach ($submission->getFiles() as $file) {
236 $members[$file[
"user_id"]][
"files"][$file[
"returned_id"]] = $file;
240 $members[$member_id][
"name"] = $tmp_obj->getFirstname() .
" " . $tmp_obj->getLastname();
277 $values = $submission->getPeerReview()->getPeerReviewValues($feedback_giver,
$participant_id);
279 foreach ($this->criteria_items as $item) {
283 $crit_id = $item->getId();
284 $crit_type = $item->getType();
285 $crit_title = $item->getTitle();
286 if ($crit_title ==
"") {
287 $crit_title = $item->getTranslatedType();
290 if (!in_array($crit_title, $this->title_columns)) {
291 $this->title_columns[] = $crit_title;
293 switch ($crit_type) {
295 if ($values[$crit_id] == 1) {
296 $this->excel->setCell($row, $col, $this->lng->txt(
"yes"));
297 } elseif ($values[$crit_id] == -1) {
298 $this->excel->setCell($row, $col, $this->lng->txt(
"no"));
312 $sub_obj_type =
"peer";
314 $sub_obj_type .=
"_" . $crit_id;
317 $this->assignment->getId(),
323 if ($rating_int = round((
int) $rating)) {
324 $this->excel->setCell($row, $col, $rating_int);
330 $this->excel->setCell($row, $col, $values[$crit_id]);
332 $this->excel->setCell($row, $col, $values[
'text']);
341 $crit_file_obj->setPeerReviewContext($this->assignment, $feedback_giver,
$participant_id);
342 $files = $crit_file_obj->getFiles();
344 $extra_crit_column = 0;
345 foreach ($files as $file) {
346 if ($extra_crit_column) {
347 $this->title_columns[] = $crit_title .
"_" . $extra_crit_column;
349 $extra_crit_column++;
352 $this->excel->setCell($row, $col,
"./" . $dir . DIRECTORY_SEPARATOR . basename($file));
353 $this->excel->addLink($row, $col,
'./' . $dir . DIRECTORY_SEPARATOR . basename($file));
354 $this->excel->setColors($this->excel->getCoordByColumnAndRow($col, $row), self::BG_COLOR, self::LINK_COLOR);
366 $dir = self::FBK_DIRECTORY . DIRECTORY_SEPARATOR .
382 $ilDB = $DIC->database();
385 if ($this->participant_id > 0) {
389 $query =
"SELECT MAX(max_num) AS max" .
390 " FROM (SELECT COUNT(user_id) AS max_num FROM exc_returned" .
391 " WHERE obj_id=" . $a_obj_id .
". AND ass_id=" . $a_ass_id . $and .
" AND mimetype IS NOT NULL" .
392 " GROUP BY user_id) AS COUNTS";
395 $row =
$ilDB->fetchAssoc($set);
406 public function addLink($a_row, $a_col, $a_submission_file)
408 $user_id = $a_submission_file[
'user_id'];
411 $filepath =
'./' . $this->lng->txt(
"exc_ass_submission_zip") . DIRECTORY_SEPARATOR . $targetdir . DIRECTORY_SEPARATOR;
412 switch ($this->assignment->getType()) {
414 $filepath .= $a_submission_file[
'filetitle'];
420 if (!$wsp_tree->getRootId()) {
421 $wsp_tree->createTreeForUser(
$user_id);
423 $node = $wsp_tree->getNodeData((
int) $a_submission_file[
'filetitle']);
424 $filepath .=
"blog_" . $node[
'obj_id'] . DIRECTORY_SEPARATOR .
"index.html";
428 $filepath .=
"prt_" . $a_submission_file[
'filetitle'] . DIRECTORY_SEPARATOR .
"index.html";
434 $this->excel->addLink($a_row, $a_col, $filepath);
440 $ass_has_feedback =
false;
441 $ass_has_criteria =
false;
445 $assignment_type = $this->assignment->getType();
451 if (!isset($this->temp_dir)) {
457 if (in_array($assignment_type, $this->ass_types_with_files)) {
462 if ($this->assignment->getPeerReview()) {
463 $ass_has_feedback =
true;
467 $first_excel_column_for_review = self::FIRST_DEFAULT_REVIEW_COLUMN;
470 if ($this->
isExcelNeeded($assignment_type, $ass_has_feedback)) {
475 $this->excel->addSheet($this->sanitized_title);
479 $this->title_columns = array(
480 $this->lng->txt(
'lastname'),
481 $this->lng->txt(
'firstname'),
482 $this->lng->txt(
'login'),
483 $this->lng->txt(
'exc_last_submission')
485 switch ($assignment_type) {
487 $this->title_columns[] = $this->lng->txt(
"exc_submission_text");
491 if ($num_columns_submission > 1) {
492 for (
$i = 1;
$i <= $num_columns_submission;
$i++) {
493 $this->title_columns[] = $this->lng->txt(
"exc_submission_file") .
" " .
$i;
496 $this->title_columns[] = $this->lng->txt(
"exc_submission_file");
499 $first_excel_column_for_review += $num_columns_submission - 1;
502 $this->title_columns[] = $this->lng->txt(
"exc_submission");
505 if ($ass_has_feedback) {
506 $this->title_columns[] = $this->lng->txt(
"exc_peer_review_giver");
507 $this->title_columns[] = $this->lng->txt(
'exc_last_submission');
512 if ($this->criteria_items = $this->assignment->getPeerReviewCriteriaCatalogueItems()) {
513 $ass_has_criteria =
true;
516 if ($this->participant_id > 0) {
517 $participants = array($this->participant_id);
523 $participants = $filter->filterParticipantsByAccess();
528 $submission =
new ilExSubmission($this->assignment, $participant_id);
529 $submission_files = $submission->getFiles();
531 if ($submission_files) {
533 $this->excel->setCell($row, self::PARTICIPANT_LASTNAME_COLUMN, $participant_name[
'lastname']);
534 $this->excel->setCell($row, self::PARTICIPANT_FIRSTNAME_COLUMN, $participant_name[
'firstname']);
535 $this->excel->setCell($row, self::PARTICIPANT_LOGIN_COLUMN, $participant_name[
'login']);
538 if (!in_array($assignment_type, $this->ass_types_with_files)) {
539 foreach ($submission_files as $submission_file) {
540 $this->excel->setCell($row, self::SUBMISSION_DATE_COLUMN, $submission_file[
'timestamp']);
541 $this->excel->setCell($row, self::FIRST_DEFAULT_SUBMIT_COLUMN, $submission_file[
'atext']);
544 $col = self::FIRST_DEFAULT_SUBMIT_COLUMN;
545 foreach ($submission_files as $submission_file) {
546 $this->excel->setCell($row, self::SUBMISSION_DATE_COLUMN, $submission_file[
'timestamp']);
549 $this->excel->setCell($row, $col, $this->lng->txt(
"open"));
551 $this->excel->setCell($row, $col, $submission_file[
'filetitle']);
553 $this->excel->setColors($this->excel->getCoordByColumnAndRow($col, $row), self::BG_COLOR, self::LINK_COLOR);
554 $this->
addLink($row, $col, $submission_file);
559 if ($ass_has_feedback) {
560 if ($col < $first_excel_column_for_review) {
561 $col = $first_excel_column_for_review;
563 $reviews = $peer_review->getPeerReviewsByPeerId($participant_id);
566 $current_review_row = 0;
567 foreach ($reviews as $review) {
569 if ($review[
'tstamp']) {
570 $current_review_row++;
571 if ($current_review_row > 1) {
572 for (
$i = 0;
$i < $first_excel_column_for_review;
$i++) {
573 $cell_to_copy = $this->excel->getCell($row,
$i);
574 $this->excel->setCell($row + 1,
$i, $cell_to_copy);
575 if (
$i >= self::FIRST_DEFAULT_SUBMIT_COLUMN) {
576 $this->excel->setColors($this->excel->getCoordByColumnAndRow(
$i, $row + 1), self::BG_COLOR, self::LINK_COLOR);
582 $feedback_giver = $review[
'giver_id'];
586 $this->excel->setCell(
589 $feedback_giver_name[
'lastname'] .
", " . $feedback_giver_name[
'firstname'] .
" [" . $feedback_giver_name[
'login'] .
"]" 592 $this->excel->setCell($row, $col + 1, $review[
'tstamp']);
594 if ($ass_has_criteria) {
606 $this->excel->writeToFile($this->target_directory .
"/" . $this->sanitized_title);
615 $ilDB = $DIC->database();
618 $set =
$ilDB->query(
"SELECT usr_id" .
619 " FROM exc_mem_ass_status" .
620 " WHERE ass_id = " .
$ilDB->quote($this->assignment->getId(),
"integer"));
622 while ($rec =
$ilDB->fetchAssoc($set)) {
623 $members[] = $rec[
'usr_id'];
static getInstanceByType($a_type)
static _lookupName($a_user_id)
lookup user name
getAssignmentMembersIds()
static makeDirParents($a_dir)
Create a new directory and all parent directories.
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data
static getInstanceById($a_id)
__construct()
Constructor.
static downloadAllAssignmentFiles(ilExAssignment $a_ass, array $members, $to_path)
Download all submitted files of an assignment (all user)
copyFileToSubDirectory($a_directory, $a_file)
Copy a file in the Feedback_files directory TODO use the new filesystem.
const PARTICIPANT_LASTNAME_COLUMN
const FIRST_DEFAULT_SUBMIT_COLUMN
Class ilExerciseMembersFilter.
createSubmissionsDirectory()
Create the directory with the assignment title.
static getASCIIFilename($a_filename)
convert utf8 to ascii filename
static getDirectoryNameFromUserData($a_user_id)
Tree handler for personal workspace.
createTargetDirectory()
Create the directory with the assignment title.
const SUBMISSION_DATE_COLUMN
static getRatingForUserAndObject( $a_obj_id, $a_obj_type, $a_sub_obj_id, $a_sub_obj_type, $a_user_id, $a_category_id=null)
Get rating for a user and an object.
collectAssignmentData($assignment_id)
addLink($a_row, $a_col, $a_submission_file)
Mapping the links to use them on the excel.
static getInstancesByExercise($a_exc_id)
addColumnTitles()
Set the Excel column titles.
run(array $input, Observer $observer)
run the job
static createDirectory($a_dir, $a_mod=0755)
create directory
isExcelNeeded($a_ass_type, $a_has_fbk)
createUniqueTempDirectory()
Description of class class.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
getFeedbackDirectory(int $participant_id, int $feedback_giver)
see also bug https://mantis.ilias.de/view.php?id=30999
getExpectedTimeOfTaskInSeconds()
int the amount of seconds this task usually taskes. If your task-duration scales with the the amount ...
collectSubmissionFiles()
Store the zip file which contains all submission files in the target directory.
static ilTempnam($a_temp_path=null)
Returns a unique and non existing Path for e temporary file or directory.
const FIRST_DEFAULT_REVIEW_COLUMN
const PARTICIPANT_LOGIN_COLUMN
const PARTICIPANT_FIRSTNAME_COLUMN
Exercise submission //TODO: This class has to much static methods related to delivered "files"...
getExtraColumnsForSubmissionFiles($a_obj_id, $a_ass_id)
Get the number of max amount of files submitted by a single user in the assignment.
addCriteriaToExcel($feedback_giver, $participant_id, $row, $col)
Add criteria data to the excel.