Skip to content
Snippets Groups Projects
Commit e527ded1 authored by uhensler's avatar uhensler
Browse files

OO-4207: Let reset learning path status during development

parent 2068cd91
No related branches found
No related tags found
No related merge requests found
Showing
with 60 additions and 11 deletions
......@@ -19,13 +19,26 @@
*/
package org.olat.course.learningpath.ui;
import java.util.List;
import org.olat.core.gui.UserRequest;
import org.olat.core.gui.components.Component;
import org.olat.core.gui.components.link.Link;
import org.olat.core.gui.components.link.LinkFactory;
import org.olat.core.gui.components.stack.TooledController;
import org.olat.core.gui.components.stack.TooledStackedPanel;
import org.olat.core.gui.components.stack.TooledStackedPanel.Align;
import org.olat.core.gui.components.velocity.VelocityContainer;
import org.olat.core.gui.control.Event;
import org.olat.core.gui.control.WindowControl;
import org.olat.core.gui.control.controller.BasicController;
import org.olat.core.helpers.Settings;
import org.olat.course.run.userview.UserCourseEnvironment;
import org.olat.modules.assessment.AssessmentEntry;
import org.olat.modules.assessment.AssessmentService;
import org.olat.modules.assessment.model.AssessmentEntryStatus;
import org.olat.repository.RepositoryEntry;
import org.springframework.beans.factory.annotation.Autowired;
/**
*
......@@ -33,25 +46,57 @@ import org.olat.course.run.userview.UserCourseEnvironment;
* @author uhensler, urs.hensler@frentix.com, http://www.frentix.com
*
*/
public class IdentityOverviewController extends BasicController {
public class IdentityOverviewController extends BasicController implements TooledController {
private final TooledStackedPanel stackPanel;
private final VelocityContainer mainVC;
private Link resetStatusLink;
private LearningPathListController learningPathListController;
private RepositoryEntry courseEntry;
@Autowired
private AssessmentService assessmentService;
public IdentityOverviewController(UserRequest ureq, WindowControl wControl, UserCourseEnvironment userCourseEnvironment) {
public IdentityOverviewController(UserRequest ureq, WindowControl wControl, TooledStackedPanel stackPanel,
UserCourseEnvironment userCourseEnvironment) {
super(ureq, wControl);
this.stackPanel = stackPanel;
this.courseEntry = userCourseEnvironment.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
mainVC = createVelocityContainer("identity_overview");
LearningPathListController learningPathListController = new LearningPathListController(ureq, wControl, userCourseEnvironment);
learningPathListController = new LearningPathListController(ureq, wControl, userCourseEnvironment);
listenTo(learningPathListController);
mainVC.put("list", learningPathListController.getInitialComponent());
putInitialPanel(mainVC);
}
@Override
public void initTools() {
if (Settings.isDebuging()) {
resetStatusLink = LinkFactory.createToolLink("reset.all.status", translate("reset.all.status"), this);
resetStatusLink.setIconLeftCSS("o_icon o_icon-lg o_icon_exclamation");
stackPanel.addTool(resetStatusLink, Align.right);
}
}
@Override
protected void event(UserRequest ureq, Component source, Event event) {
//
if (source == resetStatusLink) {
doResetStatus();
}
}
private void doResetStatus() {
List<AssessmentEntry> assessmentEntries = assessmentService.loadAssessmentEntriesByAssessedIdentity(getIdentity(), courseEntry);
for (AssessmentEntry assessmentEntry : assessmentEntries) {
assessmentEntry.setAssessmentStatus(AssessmentEntryStatus.notStarted);
assessmentService.updateAssessmentEntry(assessmentEntry);
}
learningPathListController.loadModel();
}
@Override
......
......@@ -82,7 +82,7 @@ public class LearningPathListController extends FormBasicController {
loadModel();
}
private void loadModel() {
void loadModel() {
GenericTreeModel learningPathTreeModel = LearningPathTreeModelBuilder.builder(userCourseEnv)
.create();
List<LearningPathRow> rows = forgeRows(learningPathTreeModel);
......
......@@ -10,6 +10,7 @@ config.obligation.mandatory=Obligatorisch
config.obligation.optional=Freiwillig
no.configurations=In diesen Kursbaustein stehen keine Konfigurationen zum Lernpfad zu Verf\u00FCgung.
pane.tab.learning.path=Lernpfad
reset.all.status=ALLE Stati zur\u00FCcksetzen
table.empty=Es sind keine Kurselemnte vorhanden.
table.header.date.done=Datum erledigt
table.header.duration=Zeitvorgabe
......
......@@ -10,6 +10,7 @@ config.obligation.mandatory=Mandatory
config.obligation.optional=Optional
no.configuration=No configurations for the learning path are available in this course element.
pane.tab.learning.path=Learning path
reset.all.status=Reset ALL status
table.empty=There are no course elements available.
table.header.date.done=Date done
table.header.duration=Duration
......
......@@ -1664,7 +1664,8 @@ public class CourseRuntimeController extends RepositoryEntryRuntimeController im
if(delayedClose == Delayed.learningPath || requestForClose(ureq)) {
OLATResourceable ores = OresHelper.createOLATResourceableType("LearningPath");
WindowControl swControl = addToHistory(ureq, ores, null);
IdentityOverviewController identityOverviewCtrl = new IdentityOverviewController(ureq, swControl, getUserCourseEnvironment());
IdentityOverviewController identityOverviewCtrl = new IdentityOverviewController(ureq, swControl,
toolbarPanel, getUserCourseEnvironment());
listenTo(identityOverviewCtrl);
pushController(ureq, translate("command.learning.path"), identityOverviewCtrl);
......
......@@ -124,6 +124,7 @@ $fa-css-prefix: "o_icon" !default;
.o_icon_eportfolio_link:before { content: $fa-var-puzzle-piece; }
.o_icon_eraser:before { content: $fa-var-eraser; }
.o_icon_error:before { content: $fa-var-exclamation-circle; color: $brand-danger;}
.o_icon_exclamation:before { content: $fa-var-exclamation;}
.o_icon_expand:before { content: $fa-var-expand;}
.o_icon_expenditure:before { content: $fa-var-clock-o;}
.o_icon_export:before { content: $fa-var-share-square-o;}
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment