37 protected \ILIAS\DI\UIServices
$ui;
59 public function __construct($a_data,
int $a_id,
bool $a_call_by_reference)
63 $this->
lng = $DIC->language();
64 $this->
user = $DIC->user();
65 $this->
ctrl = $DIC->ctrl();
66 $this->
tabs = $DIC->tabs();
67 $this->
help = $DIC[
"ilHelp"];
68 $this->
locator = $DIC[
"ilLocator"];
69 $this->tpl =
$DIC[
"tpl"];
70 $this->
toolbar = $DIC->toolbar();
73 $this->
lng->loadLanguageModule(
'cert');
80 $this->
ctrl->saveParameter($this, [
"ass_id",
"mode",
"from_overview"]);
82 $this->service =
$DIC->exercise()->internal();
83 $this->gui = $this->service->gui();
84 $this->exercise_request =
$DIC->exercise()->internal()->gui()->request();
85 $this->exercise_ui =
$DIC->exercise()->internal()->gui();
86 $this->requested_ass_id = $this->exercise_request->getAssId();
89 $this->requested_ass_id
90 ) === $this->
object->getId()) {
91 $this->ass = $this->exercise_request->getAssignment();
92 } elseif ($this->requested_ass_id > 0) {
95 $this->lp_user_id = ($this->exercise_request->getUserId() > 0 && $this->
access->checkAccess(
"read_learning_progress",
"", $this->exercise_request->getRefId()))
96 ? $this->exercise_request->getUserId()
97 : $this->
user->getId();
98 $this->requested_sort_order = $this->exercise_request->getSortOrder();
99 $this->requested_sort_by = $this->exercise_request->getSortBy();
100 $this->requested_offset = $this->exercise_request->getOffset();
101 $this->requested_ref_id = $this->exercise_request->getRefId();
102 $this->requested_ass_id_goto = $this->exercise_request->getAssIdGoto();
103 $this->
ui = $this->service->gui()->ui();
105 $this->
notification = $this->service->domain()->notification($this->requested_ref_id);
108 $this->ass_manager = $this->service->domain()->assignment()->assignments(
112 $this->item_builder = $this->service->gui()->assignment()->itemBuilder(
114 $this->service->domain()->assignment()->mandatoryAssignments($this->object)
128 $next_class = $this->
ctrl->getNextClass($this);
129 $cmd = $this->
ctrl->getCmd();
136 $this->gui->permanentLink()->setPermanentLink();
140 switch ($next_class) {
141 case "ilinfoscreengui":
142 $ilTabs->activateTab(
"info");
146 case 'ilpermissiongui':
147 $ilTabs->activateTab(
"permissions");
149 $this->
ctrl->forwardCommand($perm_gui);
152 case "illearningprogressgui":
153 $ilTabs->activateTab(
"learning_progress");
156 $this->
object->getRefId(),
159 $this->
ctrl->forwardCommand($new_gui);
160 $this->tabs_gui->setTabActive(
'learning_progress');
163 case 'ilobjectcopygui':
164 $ilCtrl->saveParameter($this,
'new_type');
165 $ilCtrl->setReturnByClass(get_class($this),
'create');
169 $this->
ctrl->forwardCommand($cp);
173 $ilTabs->activateTab(
"export");
175 $exp_gui->addFormat(
"xml");
176 $this->
ctrl->forwardCommand($exp_gui);
179 case "ilcommonactiondispatchergui":
181 $this->
ctrl->forwardCommand($gui);
184 case "ilcertificategui":
186 $this->tabs_gui->activateTab(
"settings");
187 $this->tabs_gui->activateSubTab(
"certificate");
190 $output_gui = $guiFactory->create($this->
object);
192 $this->
ctrl->forwardCommand($output_gui);
195 case "ilexassignmenteditorgui":
197 $ilTabs->activateTab(
"content");
201 $this->object->isCompletionBySubmissionEnabled(),
204 $this->
ctrl->forwardCommand($ass_gui);
207 case "ilexercisemanagementgui":
209 if (
$GLOBALS[
'DIC']->
access()->checkRbacOrPositionPermissionAccess(
210 'edit_submissions_grades',
211 'edit_submissions_grades',
214 $ilTabs->activateTab(
"grades");
216 $this->
ctrl->forwardCommand($mgmt_gui);
222 case "ilexccriteriacataloguegui":
224 $ilTabs->activateTab(
"settings");
226 $ilTabs->activateSubTab(
"crit");
228 $this->
ctrl->forwardCommand($crit_gui);
238 case "ilexcrandomassignmentgui":
239 $gui = $this->exercise_ui->assignment()->getRandomAssignmentGUI();
240 $this->
ctrl->forwardCommand($gui);
243 case 'ilobjectmetadatagui':
245 $this->tabs_gui->setTabActive(
'meta_data');
247 $this->
ctrl->forwardCommand($md_gui);
250 case strtolower(ilAssignmentPresentationGUI::class):
252 $gui = $this->exercise_ui->assignment()->assignmentPresentationGUI($this->
object);
253 $this->
ctrl->forwardCommand($gui);
256 case strtolower(
Settings\SettingsGUI::class):
258 $ilTabs->activateTab(
"settings");
260 $this->tabs_gui->activateSubTab(
"edit");
261 $gui = $this->gui->settings()->settingsGUI(
264 $this->
ctrl->forwardCommand($gui);
290 $a_new_object->saveData();
292 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"exc_added"),
true);
294 $ilCtrl->setParameterByClass(
"ilExAssignmentEditorGUI",
"ref_id", $a_new_object->
getRefId());
295 $ilCtrl->redirectByClass(
"ilExAssignmentEditorGUI",
"addAssignment");
305 $ilCtrl->redirectByClass(
"ilExAssignmentEditorGUI",
"listAssignments");
315 $random_manager =
$service->
domain()->assignment()->randomAssignments($exc);
317 $a_form->
setTitle($this->
lng->txt(
"exc_edit_exercise"));
320 $pres->setTitle($this->
lng->txt(
'obj_presentation'));
324 $a_form = $obj_service->commonSettings()->legacyForm($a_form, $this->
object)->addTileImage();
327 $section->setTitle($this->
lng->txt(
'exc_passing_exc'));
334 $this->
lng->txt(
"exc_pass_all"),
336 $this->lng->txt(
"exc_pass_all_info")
338 $radg->addOption($op1);
340 $this->
lng->txt(
"exc_pass_minimum_nr"),
342 $this->lng->txt(
"exc_pass_minimum_nr_info")
344 $radg->addOption($op2);
346 $this->
lng->txt(
"exc_random_selection"),
348 $this->lng->txt(
"exc_random_selection_info")
351 $op3->setDisabled(
true);
353 $this->
lng->txt(
"exc_random_selection_not_changeable_info") .
" " .
354 implode(
" ", $random_manager->getDeniedActivationReasons())
358 $radg->setDisabled(
true);
360 $this->
lng->txt(
"exc_pass_mode_not_changeable_info") .
" " .
361 implode(
" ", $random_manager->getDeniedDeactivationReasons())
367 $rn->setMaxLength(4);
368 $rn->setRequired(
true);
369 $rn->setMinValue(1,
false);
371 $rn->setMaxValue($cnt,
true);
372 $op3->addSubItem($rn);
374 $radg->addOption($op3);
379 $ni->setMaxLength(4);
380 $ni->setRequired(
true);
382 $min = max($mand, 1);
383 $ni->setMinValue($min,
true);
384 $ni->setInfo($this->
lng->txt(
"exc_min_nr_info"));
385 $op2->addSubItem($ni);
391 $this->
lng->txt(
"exc_passed_status_determination"),
392 "completion_by_submission"
394 $op1 =
new ilRadioOption($this->
lng->txt(
"exc_completion_by_tutor"), 0,
"");
395 $subcompl->addOption($op1);
397 $this->
lng->txt(
"exc_completion_by_submission"),
399 $this->lng->txt(
"exc_completion_by_submission_info")
401 $subcompl->addOption($op2);
410 $section->setTitle($this->
lng->txt(
'exc_publishing'));
415 $cb->setInfo($this->
lng->txt(
"exc_show_submissions_info"));
419 $section->setTitle($this->
lng->txt(
'exc_notification'));
424 $cbox->setInfo($this->
lng->txt(
"exc_submission_notification_info"));
430 $section->setTitle($this->
lng->txt(
'exc_feedback'));
437 $this->
lng->txt(
"exc_settings_feedback_mail"),
440 $option->setInfo($this->
lng->txt(
"exc_settings_feedback_mail_info"));
441 $fdb->addOption($option);
443 $this->
lng->txt(
"exc_settings_feedback_file"),
446 $option->setInfo($this->
lng->txt(
"exc_settings_feedback_file_info"));
447 $fdb->addOption($option);
449 $this->
lng->txt(
"exc_settings_feedback_text"),
452 $option->setInfo($this->
lng->txt(
"exc_settings_feedback_text_info"));
453 $fdb->addOption($option);
457 $section->setTitle($this->
lng->txt(
'obj_features'));
463 ->getObjectPositionSettingsByType($this->
object->getType());
465 if ($position_settings->isActive()) {
481 $a_values[
"show_submissions"] = $this->
object->getShowSubmissions();
482 $a_values[
"pass_mode"] = $this->
object->getPassMode();
483 if ($a_values[
"pass_mode"] ==
"nr") {
484 $a_values[
"pass_nr"] = $this->
object->getPassNr();
487 $a_values[
"nr_random_mand"] = $this->
object->getNrMandatoryRandom();
492 $this->object->getId()
495 $a_values[
'completion_by_submission'] = (
int) $this->
object->isCompletionBySubmissionEnabled();
497 $tfeedback = array();
498 if ($this->
object->hasTutorFeedbackMail()) {
501 if ($this->
object->hasTutorFeedbackText()) {
504 if ($this->
object->hasTutorFeedbackFile()) {
507 $a_values[
'tfeedback'] = $tfeedback;
511 ->isPositionAccessActiveForObject(
527 $this->
object->setShowSubmissions($a_form->
getInput(
"show_submissions"));
528 $this->
object->setPassMode($a_form->
getInput(
"pass_mode"));
529 if ($this->
object->getPassMode() ==
"nr") {
530 $this->
object->setPassNr($a_form->
getInput(
"pass_nr"));
533 $this->
object->setNrMandatoryRandom($a_form->
getInput(
"nr_random_mand"));
536 $this->
object->setCompletionBySubmission($a_form->
getInput(
'completion_by_submission') == 1);
538 $feedback = $a_form->
getInput(
"tfeedback");
539 $this->
object->setTutorFeedback(
541 ? array_sum($feedback)
548 $this->object->getId(),
549 (
bool) $a_form->
getInput(
"notification")
553 $obj_service->commonSettings()->legacyForm($a_form, $this->
object)->saveTileImage();
574 $ilCtrl->getLinkTarget($this,
"showOverview")
580 $ilCtrl->getLinkTargetByClass(
"ilExAssignmentEditorGUI",
"listAssignments")
583 $ilTabs->activateSubTab($a_activate);
586 protected function getTabs(): void
588 if ($this->
ctrl->getNextClass() === strtolower(ilAssignmentPresentationGUI::class)) {
597 $ilHelp->setScreenIdComponent(
"exc");
600 $this->tabs_gui->addTab(
608 $this->tabs_gui->addTab(
611 $this->ctrl->getLinkTargetByClass(
"ilinfoscreengui",
"showSummary")
617 $this->tabs_gui->addTab(
620 $this->ctrl->getLinkTargetByClass(
Settings\SettingsGUI::class,
"")
623 if ($this->
access->checkRbacOrPositionPermissionAccess(
624 'edit_submissions_grades',
625 'edit_submissions_grades',
626 $this->object->getRefId()
628 $this->tabs_gui->addTab(
630 $lng->
txt(
"exc_submissions_and_grades"),
631 $this->ctrl->getLinkTargetByClass(
"ilexercisemanagementgui",
"members")
639 $this->tabs_gui->addTab(
641 $lng->
txt(
'learning_progress'),
642 $this->ctrl->getLinkTargetByClass(array(
'ilobjexercisegui',
'illearningprogressgui'),
'')
647 if ($this->
access->checkAccess(
'write',
'', $this->object->getRefId())) {
649 $mdtab = $mdgui->getTab();
651 $this->tabs_gui->addTarget(
655 "ilobjectmetadatagui"
662 $this->tabs_gui->addTab(
665 $this->ctrl->getLinkTargetByClass(
"ilexportgui",
"")
671 $this->tabs_gui->addTab(
674 $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'),
"perm")
684 $this->
ctrl->redirectByClass(ilInfoScreenGUI::class,
"showSummary");
695 public function infoScreen(): void
701 $ilTabs->activateTab(
"info");
712 $info->enablePrivateNotes();
716 $info->enableNewsEditing();
717 $info->setBlockProperty(
"news",
"settings",
true);
721 $record_gui->setInfoObject(
$info);
722 $record_gui->parse();
725 $info->addMetaDataSections($this->
object->getId(), 0, $this->object->getType());
728 $info->addSection($this->
lng->txt(
"exc_overview"));
734 if (
$a[
"mandatory"]) {
743 $lng->
txt(
"exc_msg_all_mandatory_ass")
749 sprintf(
$lng->
txt(
"exc_msg_min_number_ass"), $this->object->getPassNr())
752 $info->addProperty(
$lng->
txt(
"exc_mandatory"), $exc->getNrMandatoryRandom());
755 $lng->
txt(
"exc_msg_all_mandatory_ass")
764 $st = $this->
object->determinStatusOfUser($ilUser->getId());
765 $status = $st[
"overall_status"];
766 if ($lpcomment !=
"" || $mark !=
"" || $status !=
"notgraded") {
767 $info->addSection($this->
lng->txt(
"exc_feedback_from_tutor"));
768 if ($lpcomment !=
"") {
770 $this->
lng->txt(
"exc_comment"),
776 $this->
lng->txt(
"exc_mark"),
787 if ($status !=
"notgraded") {
792 $path = $icons->getImagePathCompleted();
795 $path = $icons->getImagePathFailed();
801 $img = $icons->renderIcon(
$path,
$lng->
txt(
"exc_" . $status));
804 if ($st[
"failed_a_mandatory"]) {
805 $add =
" (" .
$lng->
txt(
"exc_msg_failed_mandatory") .
")";
806 } elseif ($status ==
"failed") {
807 $add =
" (" .
$lng->
txt(
"exc_msg_missed_minimum_number") .
")";
810 $this->
lng->txt(
"status"),
811 $img .
" " . $this->lng->txt(
"exc_" . $status) . $add
823 $this->
ctrl->redirectByClass(
Settings\SettingsGUI::class,
"");
828 $this->tabs_gui->addSubTab(
830 $this->
lng->txt(
"general_settings"),
831 $this->ctrl->getLinkTarget($this,
"edit")
834 $this->tabs_gui->addSubTab(
836 $this->
lng->txt(
"exc_criteria_catalogues"),
837 $this->ctrl->getLinkTargetByClass(
"ilexccriteriacataloguegui",
"")
841 if ($validator->validate()) {
842 $this->tabs_gui->addSubTab(
844 $this->
lng->txt(
"certificate"),
845 $this->ctrl->getLinkTarget($this,
"certificate")
857 if (is_object($this->
object)) {
860 $this->
object->getTitle(),
861 $this->ctrl->getLinkTarget($this,
"showOverview"),
863 $this->requested_ref_id
883 $this->
ctrl->setParameterByClass(self::class,
"from_overview",
"1");
884 $user = $this->service->domain()->user();
885 $toolbar = $this->service->gui()->toolbar();
886 $tabs = $this->service->gui()->tabs();
893 if ($this->handleRandomAssignmentEntryPage()) {
908 if ($this->certificateDownloadValidator->isCertificateDownloadable(
913 $this->
lng->txt(
"certificate"),
914 $this->ctrl->getLinkTarget($this,
"outCertificate")
918 $f = $this->
ui->factory();
919 $r = $this->
ui->renderer();
922 $random_manager = $this->service->domain()->assignment()->randomAssignments($exc);
925 $list_modes = [$am::TYPE_ONGOING,$am::TYPE_FUTURE,$am::TYPE_PAST];
929 foreach ($list_modes as $lm) {
931 foreach ($this->ass_manager->getList($lm) as
$ass) {
932 if (!$random_manager->isAssignmentVisible(
$ass->
getId(), $this->user->getId())) {
935 $items[$lm][] = $this->item_builder->getItem(
$ass,
$user->
getId());
941 foreach ($items as $lm => $it) {
942 if (count($it) > 0) {
943 $groups[] =
$f->item()->group($this->
lng->txt(
"exc_" . $lm), $it);
946 if (count($groups) > 0) {
947 $panel =
$f->panel()->listing()->standard($this->
lng->txt(
"exc_assignments"), $groups);
949 $panel =
$f->panel()->standard($this->
lng->txt(
"exc_assignments"),
$f->messageBox()->info($this->lng->txt(
"exc_no_assignments")));
953 foreach ($am->getListModes() as $mode =>
$txt) {
956 $mode =
$f->viewControl()->mode(
958 $this->
lng->txt(
"exc_mode_selection")
959 )->withActive($am->getListModeLabel($this->getCurrentMode()));
962 $html .= $r->render([$mode, $panel]);
964 $this->tpl->setContent(
967 $this->
ctrl->setParameterByClass(self::class,
"from_overview",
null);
972 return $this->ass_manager->getValidListMode($this->exercise_request->getMode());
977 $this->
ctrl->setParameterByClass(self::class,
"mode", $mode);
978 $link = $this->
ctrl->getLinkTargetByClass(self::class,
"showOverview");
979 $this->
ctrl->setParameterByClass(self::class,
"mode",
null);
989 $this->tabs_gui->activateTab(
"settings");
990 $this->tabs_gui->activateSubTab(
"certificate");
993 $output_gui = $guiFactory->create($this->
object);
995 $output_gui->certificateEditor();
1002 $database =
$DIC->database();
1003 $logger =
$DIC->logger()->root();
1007 $objectId = $this->
object->
getId();
1009 if (!$this->certificateDownloadValidator->isCertificateDownloadable($ilUser->getId(), $objectId)) {
1010 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"permission_denied"),
true);
1011 $this->
ctrl->redirect($this);
1015 $pdfGenerator =
new ilPdfGenerator($ilUserCertificateRepository);
1020 $this->
lng->txt(
'error_creating_certificate_pdf')
1023 $pdfAction->downloadPdf($ilUser->getId(), $objectId);
1034 if ($this->ass !==
null) {
1036 if (!$state->getCommonDeadline() && $state->getRelativeDeadline()) {
1037 $idl = $state->getIndividualDeadlineObject();
1038 $idl->setStartingTimestamp(time());
1050 public function requestDeadlineObject(): void
1055 if ($this->ass !==
null) {
1057 if ($state->needsIndividualDeadline() && !$state->hasRequestedIndividualDeadline()) {
1058 $idl = $state->getIndividualDeadlineObject();
1059 $idl->setRequested(
true);
1061 $this->
notification->sendDeadlineRequestNotification($this->ass->getId());
1064 $exc->members_obj->assignMembers([
$user->
getId()]);
1075 protected function handleRandomAssignmentEntryPage(): bool
1081 $random_manager =
$service->
domain()->assignment()->randomAssignments($exc);
1082 if ($random_manager->needsStart()) {
1083 $gui = $this->exercise_ui->assignment()->getRandomAssignmentGUI();
1084 $gui->renderStartPage();
Exercise gui request wrapper.
Exercise UI frontend presentation service class.
Exercise internal service.
Validates if an active certificate is stored in the database and can be downloaded by the user.
Just a wrapper class to create Unit Test for other classes.
This class represents an option in a checkbox group.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
static _lookupContainerSetting(int $a_id, string $a_keyword, ?string $a_default_value=null)
redirectByClass( $a_class, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false)
@inheritDoc
getLinkTarget(object $a_gui_obj, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
@inheritDoc
clearParametersByClass(string $a_class)
@inheritDoc
setParameterByClass(string $a_class, string $a_parameter, $a_value)
@inheritDoc
Class ilExAssignmentEditorGUI.
static getAssignmentDataOfExercise(int $a_exc_id)
static lookupExerciseId(int $a_ass_id)
static count(int $a_ex_id)
static countMandatory(int $a_ex_id)
static getInstancesByExercise(int $a_exc_id)
static getInstanceByIds(int $a_ass_id, int $a_user_id=0)
Class ilExcCriteriaCatalogueGUI.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
@ilCtrl_Calls ilExerciseManagementGUI: ilRepositorySearchGUI @ilCtrl_Calls ilExerciseManagementGUI: i...
Export User Interface Class.
static _lookupComment(int $a_usr_id, int $a_obj_id)
static _lookupMark(int $a_usr_id, int $a_obj_id)
static getInstance(int $variant=ilLPStatusIcons::ICON_VARIANT_DEFAULT, ?\ILIAS\UI\Renderer $renderer=null, ?\ILIAS\UI\Factory $factory=null)
loadLanguageModule(string $a_module)
Load language module.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static checkAccess(int $a_ref_id, bool $a_allow_only_read=true)
check access to learning progress
const LP_CONTEXT_REPOSITORY
Class ilObjUserTrackingGUI.
static _tracProgress(int $a_user_id, int $a_obj_id, int $a_ref_id, string $a_obj_type='')
static setNotification(int $type, int $user_id, int $id, bool $status=true)
Set notification status for object and user.
static hasNotification(int $type, int $user_id, int $id)
Check notification status for object and user.
const TYPE_EXERCISE_SUBMISSION
addLocatorItems()
Add locator item.
__construct($a_data, int $a_id, bool $a_call_by_reference)
getModeLink(string $mode)
viewObject()
viewObject container presentation for "administration -> repository, trash, permissions"
Exercise GUIRequest $exercise_request
Exercise Assignment ItemBuilderUI $item_builder
getEditFormCustomValues(array &$a_values)
Add values to custom edit fields.
string $requested_sort_by
string $requested_sort_order
Exercise Assignment AssignmentManager $ass_manager
updateCustom(ilPropertyFormGUI $a_form)
Insert custom update form values into object.
addContentSubTabs(string $a_activate)
ilCertificateDownloadValidator $certificateDownloadValidator
int $requested_ass_id_goto
Exercise InternalGUIService $gui
startAssignmentObject()
Start assignment with relative deadline.
Exercise Notification NotificationManager $notification
afterSave(ilObject $a_new_object)
Post (successful) object creation hook.
Exercise InternalGUIService $exercise_ui
const TUTOR_FEEDBACK_TEXT
const TUTOR_FEEDBACK_MAIL
const TUTOR_FEEDBACK_FILE
GUI class for the workflow of copying objects.
Class ilObjectGUI Basic methods of all Output classes.
getTabs()
@abstract overwrite in derived GUI class of your object type
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
addHeaderAction()
Add header action menu.
prepareOutput(bool $show_sub_objects=true)
initEditCustomForm(ilPropertyFormGUI $a_form)
Add custom fields to update form.
static updateServiceSettingsForm(int $obj_id, ilPropertyFormGUI $form, array $services)
const ORGU_POSITION_ACCESS
static initServiceSettingsForm(int $obj_id, ilPropertyFormGUI $form, array $services)
Class ilObject Basic functions for all objects.
getLongDescription()
get object long description (stored in object_description)
This class represents an option in a radio group.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
activateTab(string $a_id)
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples