Skip to content
Snippets Groups Projects
Commit 82d65316 authored by srosse's avatar srosse
Browse files

OO-3286: adapt archive data methods to curriculums

parent 788ccd9c
No related branches found
No related tags found
No related merge requests found
...@@ -26,7 +26,6 @@ import java.util.zip.ZipOutputStream; ...@@ -26,7 +26,6 @@ import java.util.zip.ZipOutputStream;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.apache.commons.io.IOUtils;
import org.olat.core.gui.media.MediaResource; import org.olat.core.gui.media.MediaResource;
import org.olat.core.id.OLATResourceable; import org.olat.core.id.OLATResourceable;
import org.olat.core.logging.OLog; import org.olat.core.logging.OLog;
...@@ -104,17 +103,13 @@ public class ArchiveResource implements MediaResource { ...@@ -104,17 +103,13 @@ public class ArchiveResource implements MediaResource {
String urlEncodedLabel = StringHelper.urlEncodeUTF8(label); String urlEncodedLabel = StringHelper.urlEncodeUTF8(label);
hres.setHeader("Content-Disposition","attachment; filename*=UTF-8''" + urlEncodedLabel); hres.setHeader("Content-Disposition","attachment; filename*=UTF-8''" + urlEncodedLabel);
hres.setHeader("Content-Description", urlEncodedLabel); hres.setHeader("Content-Description", urlEncodedLabel);
ZipOutputStream zout = null; try(ZipOutputStream zout = new ZipOutputStream(hres.getOutputStream())) {
try {
zout = new ZipOutputStream(hres.getOutputStream());
zout.setLevel(9); zout.setLevel(9);
ICourse course = CourseFactory.loadCourse(courseOres); ICourse course = CourseFactory.loadCourse(courseOres);
courseNode.archiveNodeData(locale, course, options, zout, encoding); courseNode.archiveNodeData(locale, course, options, zout, encoding);
} catch (Exception e) { } catch (Exception e) {
log.error("", e); log.error("", e);
} finally {
IOUtils.closeQuietly(zout);
} }
} }
......
...@@ -526,17 +526,21 @@ public class IdentityListCourseNodeController extends FormBasicController ...@@ -526,17 +526,21 @@ public class IdentityListCourseNodeController extends FormBasicController
private void fillAlternativeToAssessableIdentityList(AssessmentToolOptions options, SearchAssessedIdentityParams params) { private void fillAlternativeToAssessableIdentityList(AssessmentToolOptions options, SearchAssessedIdentityParams params) {
List<Group> baseGroups = new ArrayList<>(); List<Group> baseGroups = new ArrayList<>();
if((assessmentCallback.canAssessRepositoryEntryMembers() if(assessmentCallback.canAssessRepositoryEntryMembers() || assessmentCallback.canAssessNonMembers()) {
&& (assessmentCallback.getCoachedGroups() == null || assessmentCallback.getCoachedGroups().isEmpty()))
|| assessmentCallback.canAssessNonMembers()) {
baseGroups.add(repositoryService.getDefaultGroup(courseEntry)); baseGroups.add(repositoryService.getDefaultGroup(courseEntry));
} }
if(assessmentCallback.getCoachedGroups() != null && assessmentCallback.getCoachedGroups().size() > 0) { if(assessmentCallback.canAssessBusinessGoupMembers() && assessmentCallback.getCoachedGroups() != null && !assessmentCallback.getCoachedGroups().isEmpty()) {
for(BusinessGroup coachedGroup:assessmentCallback.getCoachedGroups()) { for(BusinessGroup coachedGroup:assessmentCallback.getCoachedGroups()) {
baseGroups.add(coachedGroup.getBaseGroup()); baseGroups.add(coachedGroup.getBaseGroup());
} }
} }
options.setGroups(baseGroups); if(assessmentCallback.canAssessCurriculumMembers()) {
List<CurriculumElement> coachedCurriculumElements = coachCourseEnv.getCoachedCurriculumElements();
for(CurriculumElement coachedCurriculumElement:coachedCurriculumElements) {
baseGroups.add(coachedCurriculumElement.getGroup());
}
}
options.setAlternativeGroupsOfIdentities(baseGroups);
options.setNonMembers(params.isNonMembers()); options.setNonMembers(params.isNonMembers());
} }
......
...@@ -80,9 +80,9 @@ public class QTI12StatisticsToolController extends BasicController implements Ac ...@@ -80,9 +80,9 @@ public class QTI12StatisticsToolController extends BasicController implements Ac
if(asOptions.getGroup() != null) { if(asOptions.getGroup() != null) {
List<Group> bGroups = Collections.singletonList(asOptions.getGroup().getBaseGroup()); List<Group> bGroups = Collections.singletonList(asOptions.getGroup().getBaseGroup());
searchParams.setLimitToGroups(bGroups); searchParams.setLimitToGroups(bGroups);
} else if(asOptions.getGroups() != null) { } else if(asOptions.getAlternativeGroupsOfIdentities() != null) {
searchParams.setMayViewAllUsersAssessments(asOptions.isNonMembers()); searchParams.setMayViewAllUsersAssessments(asOptions.isNonMembers());
searchParams.setLimitToGroups(asOptions.getGroups()); searchParams.setLimitToGroups(asOptions.getAlternativeGroupsOfIdentities());
} }
RepositoryEntry testEntry = courseNode.getReferencedRepositoryEntry(); RepositoryEntry testEntry = courseNode.getReferencedRepositoryEntry();
......
...@@ -85,8 +85,8 @@ public class QTI21RuntimeStatisticsController extends BasicController implements ...@@ -85,8 +85,8 @@ public class QTI21RuntimeStatisticsController extends BasicController implements
if(asOptions.getGroup() != null) { if(asOptions.getGroup() != null) {
List<Group> bGroups = Collections.singletonList(asOptions.getGroup().getBaseGroup()); List<Group> bGroups = Collections.singletonList(asOptions.getGroup().getBaseGroup());
searchParams.setLimitToGroups(bGroups); searchParams.setLimitToGroups(bGroups);
} else if(asOptions.getGroups() != null) { } else if(asOptions.getAlternativeGroupsOfIdentities() != null) {
searchParams.setLimitToGroups(asOptions.getGroups()); searchParams.setLimitToGroups(asOptions.getAlternativeGroupsOfIdentities());
} }
QTI21DeliveryOptions deliveryOptions = qtiService.getDeliveryOptions(testEntry); QTI21DeliveryOptions deliveryOptions = qtiService.getDeliveryOptions(testEntry);
......
...@@ -109,8 +109,8 @@ public class QTI21StatisticsToolController extends BasicController implements Ac ...@@ -109,8 +109,8 @@ public class QTI21StatisticsToolController extends BasicController implements Ac
if(asOptions.getGroup() != null) {// filter by business group if(asOptions.getGroup() != null) {// filter by business group
List<Group> bGroups = Collections.singletonList(asOptions.getGroup().getBaseGroup()); List<Group> bGroups = Collections.singletonList(asOptions.getGroup().getBaseGroup());
searchParams.setLimitToGroups(bGroups); searchParams.setLimitToGroups(bGroups);
} else if(asOptions.getGroups() != null) { } else if(asOptions.getAlternativeGroupsOfIdentities() != null) {
searchParams.setLimitToGroups(asOptions.getGroups()); searchParams.setLimitToGroups(asOptions.getAlternativeGroupsOfIdentities());
} else { } else {
searchParams.setViewNonMembers(asOptions.isNonMembers()); searchParams.setViewNonMembers(asOptions.isNonMembers());
} }
......
...@@ -76,11 +76,17 @@ public class AssessmentToolOptions { ...@@ -76,11 +76,17 @@ public class AssessmentToolOptions {
this.identities = identities; this.identities = identities;
} }
public List<Group> getGroups() { /**
* This is a list of groups which eventually (if set) can
* used instead of the list of identities.
*
* @return A list of base groups.
*/
public List<Group> getAlternativeGroupsOfIdentities() {
return groups; return groups;
} }
public void setGroups(List<Group> groups) { public void setAlternativeGroupsOfIdentities(List<Group> groups) {
this.groups = groups; this.groups = groups;
} }
......
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