Skip to content

Commit

Permalink
Merge branch 'trunk' of github.com:ILIAS-eLearning/ILIAS into trunk
Browse files Browse the repository at this point in the history
  • Loading branch information
smeyer-ilias committed Oct 18, 2023
2 parents 54950dc + ccb1b6d commit e6cdcc7
Show file tree
Hide file tree
Showing 129 changed files with 3,917 additions and 1,600 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
/Services/UICore/artifacts/ctrl_security.php
/Services/Component/artifacts/*
/Services/EventHandling/artifacts/*
/Services/Object/artifacts/*

# Directories
/data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ public function __construct(

$this->addMultiCommand("sendMembers", $this->lng->txt("exc_send_assignment"));

if ($this->mode == self::MODE_BY_ASSIGNMENT) {
$this->addMultiCommand("sendGradingNotification", $this->lng->txt("exc_send_grading_notification"));
}

if ($this->mode == self::MODE_BY_ASSIGNMENT &&
$this->ass &&
$this->ass->hasTeam()) {
Expand Down Expand Up @@ -483,7 +487,9 @@ protected function parseRow(
}
}

if ($this->ass_type != null && $this->ass_type->supportsWebDirAccess() && $a_row['submission_obj']->hasSubmittedPrintVersion()) {
$ass_type = $this->ass_type ?: ilExAssignmentTypes::getInstance()->getById($a_ass->getType());

if ($ass_type->supportsWebDirAccess() && $a_row['submission_obj']->hasSubmittedPrintVersion()) {
$url = $ilCtrl->getLinkTarget($this->getParentObject(), "openSubmissionView");
$items[] = $this->ui_factory->link()->standard($this->lng->txt("exc_tbl_action_open_submission"), $url)->withOpenInNewViewport(true);
if ($a_row['submission_obj']->hasSubmittedPrintVersion()) {
Expand Down
60 changes: 60 additions & 0 deletions Modules/Exercise/classes/class.ilExerciseMailNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ class ilExerciseMailNotification extends ilMailNotification
public const TYPE_FEEDBACK_FILE_ADDED = 20;
public const TYPE_SUBMISSION_UPLOAD = 30;
public const TYPE_FEEDBACK_TEXT_ADDED = 40;
public const TYPE_GRADING_DONE = 70;
protected \ILIAS\Exercise\InternalDomainService $domain;

protected ilObjUser $user;
protected int $ass_id;
Expand All @@ -33,6 +35,7 @@ public function __construct()
global $DIC;

$this->user = $DIC->user();
$this->domain = $DIC->exercise()->internal()->domain();
parent::__construct();
}

Expand All @@ -46,6 +49,23 @@ public function getAssignmentId(): int
return $this->ass_id;
}

protected function addOpenSubmission(): void
{
$ass = new ilExAssignment($this->getAssignmentId());
$types = ilExAssignmentTypes::getInstance();
$type = $types->getById($ass->getType());
if ($type->supportsWebDirAccess()) {
$submission = new ilExSubmission($ass, $this->user->getId());
if ($submission->hasSubmittedPrintVersion()) {
$this->appendBody("\n\n");
$this->appendBody(sprintf(
$this->getLanguageText('exc_submission_open_notification_link'),
$this->createPermanentLink(array(), "_" . $this->getAssignmentId() . "_" . $this->user->getId() . "_opensubmission")
));
}
}
}

public function send(): bool
{
$ilUser = $this->user;
Expand Down Expand Up @@ -141,6 +161,7 @@ public function send(): bool
// $this->getLanguageText("exc_submission_no_new_files")));
//}
}
$this->addOpenSubmission();

$this->appendBody("\n\n");
$this->appendBody(sprintf(
Expand Down Expand Up @@ -189,6 +210,45 @@ public function send(): bool
$this->sendMail(array($rcp));
}
break;

case self::TYPE_GRADING_DONE:

foreach ($this->getRecipients() as $rcp) {
$this->initLanguage($rcp);
$this->initMail();
$this->setSubject(
sprintf(
$this->getLanguageText('exc_msg_grading_done'),
$this->getObjectTitle(true)
)
);
$this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
$this->appendBody("\n\n");
$this->appendBody(
sprintf(
$this->getLanguageText('exc_msg_grading_done_body'),
$this->getObjectTitle(false)
)
);
$this->appendBody("\n");
$this->appendBody(
$this->getLanguageText('obj_exc') . ": " . $this->getObjectTitle(true)
);
$this->appendBody("\n");
$this->appendBody(
$this->getLanguageText('exc_assignment') . ": " .
ilExAssignment::lookupTitle($this->getAssignmentId())
);
$this->appendBody("\n\n");
$this->appendBody($this->getLanguageText('exc_mail_permanent_link'));
$this->appendBody("\n");
$this->appendBody($this->createPermanentLink(array(), '_' . $this->getAssignmentId()) .
'#fb' . $this->getAssignmentId());
$this->getMail()->appendInstallationSignature(true);

$this->sendMail(array($rcp));
}
break;
}
return true;
}
Expand Down
27 changes: 27 additions & 0 deletions Modules/Exercise/classes/class.ilExerciseManagementGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -2320,4 +2320,31 @@ public function collectFeedbackDataFromPeer(

return $data;
}

public function sendGradingNotificationObject(): void
{

$ass_id = $this->request->getAssId();
$selected_users = $this->request->getSelectedParticipants();

$graded_users = array_filter($selected_users, function ($user_id) {
return $this->assignment->getMemberStatus($user_id)->getStatus() !== "notgraded";
});

if (count($graded_users) === 0) {
$this->tpl->setOnScreenMessage("failure", $this->lng->txt("exc_no_graded_mem_selected"), true);
$this->ctrl->redirect($this, $this->getViewBack());
}

$not = new ilExerciseMailNotification();
$not->setType(ilExerciseMailNotification::TYPE_GRADING_DONE);
$not->setAssignmentId($ass_id);
$not->setObjId($this->exercise->getId());
$not->setRefId($this->exercise->getRefId());
$not->setRecipients($graded_users);
$not->send();
$this->tpl->setOnScreenMessage("success", $this->lng->txt("exc_graded_mem_notified"), true);
$this->ctrl->redirect($this, $this->getViewBack());
}

}
9 changes: 9 additions & 0 deletions Modules/Exercise/classes/class.ilObjExerciseGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -855,6 +855,7 @@ public static function _goto(
switch (end($parts)) {
case "download":
case "setdownload":
case "opensubmission":
$action = $parts[3];
$member = $parts[2];
$ass_id = $parts[1];
Expand Down Expand Up @@ -897,6 +898,14 @@ public static function _goto(
);
break;

case "opensubmission":
$ilCtrl->setParameterByClass("ilExerciseHandlerGUI", "member_id", $member);
$ilCtrl->redirectByClass(
array("ilExerciseHandlerGUI", "ilObjExerciseGUI", "ilExerciseManagementGUI"),
"openSubmissionView"
);
break;

default:
if (($parts[1] ?? "") != "") {
$ilCtrl->setParameterByClass("ilExerciseHandlerGUI", "ass_id", $parts[1]);
Expand Down
45 changes: 45 additions & 0 deletions Modules/File/classes/ObjectProperties/FileObjectProperties.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

/**
* This file is part of ILIAS, a powerful learning management system
* published by ILIAS open source e-Learning e.V.
*
* ILIAS is licensed with the GPL-3.0,
* see https://www.gnu.org/licenses/gpl-3.0.en.html
* You should have received a copy of said license along with the
* source code, too.
*
* If this is not the case or you just want to try ILIAS, you'll find
* us at:
* https://www.ilias.de
* https://github.com/ILIAS-eLearning
*
*********************************************************************/

declare(strict_types=1);

use ILIAS\Object\Properties\ObjectTypeSpecificProperties\AbstractObjectTypeSpecificProperties;
use ILIAS\Object\Properties\ObjectTypeSpecificProperties\ilObjectTypeSpecificPropertyProviders;

class FileObjectProperties extends AbstractObjectTypeSpecificProperties
{
protected ?FileObjectPropertyProviders $providers = null;

public function getObjectTypeString(): string
{
return ilObjFile::OBJECT_TYPE;
}

public function getProviders(): ilObjectTypeSpecificPropertyProviders
{
if ($this->providers === null) {
$this->providers = new FileObjectPropertyProviders();
}
return $this->providers;
}

public function preload(array $object_ids): void
{
return;
}
}
102 changes: 102 additions & 0 deletions Modules/File/classes/ObjectProperties/FileObjectPropertyProviders.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
<?php

/**
* This file is part of ILIAS, a powerful learning management system
* published by ILIAS open source e-Learning e.V.
*
* ILIAS is licensed with the GPL-3.0,
* see https://www.gnu.org/licenses/gpl-3.0.en.html
* You should have received a copy of said license along with the
* source code, too.
*
* If this is not the case or you just want to try ILIAS, you'll find
* us at:
* https://www.ilias.de
* https://github.com/ILIAS-eLearning
*
*********************************************************************/

declare(strict_types=1);

use ILIAS\Object\Properties\ObjectTypeSpecificProperties\ilObjectTypeSpecificPropertyProviders;
use ILIAS\UI\Component\Symbol\Icon\Icon;
use ILIAS\UI\Component\Symbol\Icon\Factory as IconFactory;
use ILIAS\UI\Component\Image\Image;
use ILIAS\UI\Component\Image\Factory as ImageFactory;
use ILIAS\ResourceStorage\Services as StorageService;
use ILIAS\ResourceStorage\Flavour\Definition\CropToSquare;
use ILIAS\ResourceStorage\Flavour\Definition\FlavourDefinition;
use ILIAS\ResourceStorage\Flavour\Definition\PagesToExtract;

class FileObjectPropertyProviders implements ilObjectTypeSpecificPropertyProviders
{
private bool $persist = true;
private int $max_size = 512;
private FlavourDefinition $crop_definition;
private FlavourDefinition $extract_definition;

public function __construct()
{
$this->crop_definition = new CropToSquare($this->persist, $this->max_size);
$this->extract_definition = new PagesToExtract($this->persist, $this->max_size, 1, true);
}

public function getObjectTypeSpecificTileImage(
int $obj_id,
ImageFactory $factory,
StorageService $irss
): ?Image {
if (($flavour_path = $this->getCardImageFallbackPath(
$obj_id,
$irss
)) !== '') {
return $factory->responsive($flavour_path, '');
}

return null;
}

/**
* @description Can be used to take preview flavours as card images
*/
protected function getCardImageFallbackPath(
int $obj_id,
StorageService $irss
): string {
$rid = $irss->manage()->find(ilObjFileAccess::getListGUIData($obj_id)['rid'] ?? '');
if ($rid === null) {
return '';
}
if ($irss->flavours()->possible($rid, $this->crop_definition)) {
$url = $irss->consume()->flavourUrls(
$irss->flavours()->get(
$rid,
$this->crop_definition
)
)->getURLs(false)->current();
if ($url !== null) {
return $url;
}
}
if ($irss->flavours()->possible($rid, $this->extract_definition)) {
$url = $irss->consume()->flavourUrls(
$irss->flavours()->get(
$rid,
$this->extract_definition
)
)->getURLs(false)->current();
if ($url !== null) {
return $url;
}
}
return '';
}

public function getObjectTypeSpecificCustomIcon(
int $obj_id,
IconFactory $icon_factory,
StorageService $irss
): ?Icon {
return null;
}
}
2 changes: 0 additions & 2 deletions Modules/File/classes/class.ilObjFileListGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
*
*********************************************************************/

use ILIAS\FileUpload\MimeType;
use ILIAS\File\Icon\IconDatabaseRepository;
use ILIAS\ResourceStorage\Flavour\Definition\CropToSquare;
use ILIAS\ResourceStorage\Flavour\Definition\FlavourDefinition;
Expand Down Expand Up @@ -114,7 +113,6 @@ protected function getCardImageFallbackPath(int $obj_id, string $type): string
return '';
}


/**
* initialisation
*/
Expand Down
9 changes: 6 additions & 3 deletions Modules/Portfolio/Exercise/class.ilPortfolioExerciseGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -347,12 +347,15 @@ public function getActionButtons(): array
$pe = new ilPortfolioExercise($this->user_id, $this->obj_id);

$buttons = [];
$pages = ilPortfolioPage::getAllPortfolioPages($this->obj_id);
foreach ($pe->getAssignmentsOfPortfolio() as $exercise) {
$ass_id = $exercise["ass_id"];
$buttons[$ass_id] = [];
$submit_button = $this->getSubmitButton($ass_id);
if ($submit_button) {
$buttons[$ass_id][] = $submit_button;
if (count($pages) > 0) {
$submit_button = $this->getSubmitButton($ass_id);
if ($submit_button) {
$buttons[$ass_id][] = $submit_button;
}
}
$download_button = $this->getDownloadSubmissionButton($ass_id);
if ($download_button) {
Expand Down
Loading

0 comments on commit e6cdcc7

Please sign in to comment.