Search in sources :

Example 6 with ICourse

use of org.olat.course.ICourse in project OpenOLAT by OpenOLAT.

the class CourseLogsArchiveController method showExportFinished.

protected void showExportFinished() {
    ICourse course = CourseFactory.loadCourse(ores);
    VelocityContainer vcFeedback = createVelocityContainer("courselogs_feedback");
    showFileButton = LinkFactory.createButton("showfile", vcFeedback, this);
    vcFeedback.contextPut("body", translate("course.logs.feedback", course.getCourseTitle()));
    myPanel.setContent(vcFeedback);
    // note: polling can't be switched off unfortunatelly
    // this is due to the fact that the jsandcsscomponent can only modify
    // certain parts of the page and it would require a full page refresh
    // to get rid of the poller - and that's not possible currently
    showInfo("course.logs.finished", course.getCourseTitle());
}
Also used : ICourse(org.olat.course.ICourse) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer)

Example 7 with ICourse

use of org.olat.course.ICourse in project OpenOLAT by OpenOLAT.

the class BulkAssessmentTask method getCourseNode.

private AssessableCourseNode getCourseNode() {
    ICourse course = CourseFactory.loadCourse(courseRes);
    CourseNode node = course.getRunStructure().getNode(courseNodeIdent);
    if (node instanceof AssessableCourseNode) {
        return (AssessableCourseNode) node;
    }
    return null;
}
Also used : AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) ICourse(org.olat.course.ICourse) CourseNode(org.olat.course.nodes.CourseNode) TACourseNode(org.olat.course.nodes.TACourseNode) GTACourseNode(org.olat.course.nodes.GTACourseNode) MSCourseNode(org.olat.course.nodes.MSCourseNode) AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) ProjectBrokerCourseNode(org.olat.course.nodes.ProjectBrokerCourseNode)

Example 8 with ICourse

use of org.olat.course.ICourse in project OpenOLAT by OpenOLAT.

the class BulkAssessmentTask method sendFeedback.

private void sendFeedback(List<BulkAssessmentFeedback> feedbacks) {
    if (task == null) {
        log.error("Haven't a task to know creator and modifiers of the task", null);
        return;
    }
    Identity creator = task.getCreator();
    String language = creator.getUser().getPreferences().getLanguage();
    Locale locale = I18nManager.getInstance().getLocaleOrDefault(language);
    Translator translator = Util.createPackageTranslator(BulkAssessmentOverviewController.class, locale, Util.createPackageTranslator(AssessmentManager.class, locale));
    MailManager mailManager = CoreSpringFactory.getImpl(MailManager.class);
    TaskExecutorManager taskManager = CoreSpringFactory.getImpl(TaskExecutorManager.class);
    String feedbackStr = renderFeedback(feedbacks, translator);
    MailBundle mail = new MailBundle();
    mail.setToId(creator);
    mail.setFrom(WebappHelper.getMailConfig("mailReplyTo"));
    List<Identity> modifiers = taskManager.getModifiers(task);
    if (modifiers.size() > 0) {
        ContactList cc = new ContactList("CC");
        cc.addAllIdentites(modifiers);
        mail.setContactList(cc);
    }
    String businessPath = "";
    ICourse course = CourseFactory.loadCourse(courseRes);
    CourseNode node = course.getRunStructure().getNode(courseNodeIdent);
    String courseTitle = course.getCourseTitle();
    String nodeTitle = node.getShortTitle();
    String numOfAssessedIds = Integer.toString(datas == null ? 0 : datas.getRowsSize());
    String date = Formatter.getInstance(locale).formatDateAndTime(new Date());
    mail.setContext(new MailContextImpl(courseRes, courseNodeIdent, businessPath));
    String subject = translator.translate("confirmation.mail.subject", new String[] { courseTitle, nodeTitle });
    String body = translator.translate("confirmation.mail.body", new String[] { courseTitle, nodeTitle, feedbackStr, numOfAssessedIds, date });
    mail.setContent(subject, body);
    mailManager.sendMessage(mail);
}
Also used : Locale(java.util.Locale) TaskExecutorManager(org.olat.core.commons.services.taskexecutor.TaskExecutorManager) MailContextImpl(org.olat.core.util.mail.MailContextImpl) AssessmentManager(org.olat.course.assessment.AssessmentManager) ICourse(org.olat.course.ICourse) ContactList(org.olat.core.util.mail.ContactList) Date(java.util.Date) Translator(org.olat.core.gui.translator.Translator) MailManager(org.olat.core.util.mail.MailManager) CourseNode(org.olat.course.nodes.CourseNode) TACourseNode(org.olat.course.nodes.TACourseNode) GTACourseNode(org.olat.course.nodes.GTACourseNode) MSCourseNode(org.olat.course.nodes.MSCourseNode) AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) ProjectBrokerCourseNode(org.olat.course.nodes.ProjectBrokerCourseNode) Identity(org.olat.core.id.Identity) MailBundle(org.olat.core.util.mail.MailBundle)

Example 9 with ICourse

use of org.olat.course.ICourse in project OpenOLAT by OpenOLAT.

the class EfficiencyStatementManager method createUserEfficiencyStatement.

public UserEfficiencyStatement createUserEfficiencyStatement(Date creationDate, Float score, Boolean passed, Identity identity, OLATResource resource) {
    UserEfficiencyStatementImpl efficiencyProperty = new UserEfficiencyStatementImpl();
    efficiencyProperty.setCreationDate(creationDate);
    efficiencyProperty.setLastModified(new Date());
    efficiencyProperty.setScore(score);
    efficiencyProperty.setPassed(passed);
    efficiencyProperty.setTotalNodes(0);
    efficiencyProperty.setAttemptedNodes(0);
    efficiencyProperty.setPassedNodes(0);
    efficiencyProperty.setIdentity(identity);
    efficiencyProperty.setResource(resource);
    ICourse course = CourseFactory.loadCourse(resource.getResourceableId());
    efficiencyProperty.setTitle(course.getCourseEnvironment().getCourseTitle());
    efficiencyProperty.setShortTitle(course.getCourseEnvironment().getRunStructure().getRootNode().getShortTitle());
    efficiencyProperty.setCourseRepoKey(course.getCourseEnvironment().getCourseGroupManager().getCourseEntry().getKey());
    dbInstance.getCurrentEntityManager().persist(efficiencyProperty);
    return efficiencyProperty;
}
Also used : ICourse(org.olat.course.ICourse) UserEfficiencyStatementImpl(org.olat.course.assessment.model.UserEfficiencyStatementImpl) Date(java.util.Date)

Example 10 with ICourse

use of org.olat.course.ICourse in project OpenOLAT by OpenOLAT.

the class CourseAssessmentManagerImpl method getAssessmentDocumentsDirectory.

private File getAssessmentDocumentsDirectory(CourseNode cNode, Identity assessedIdentity) {
    ICourse course = CourseFactory.loadCourse(cgm.getCourseEntry());
    String courseRelPath = course.getCourseEnvironment().getCourseBaseContainer().getRelPath();
    Path path = Paths.get(FolderConfig.getCanonicalRoot(), courseRelPath, ASSESSMENT_DOCS_DIR, cNode.getIdent(), "person_" + assessedIdentity.getKey());
    File file = path.toFile();
    if (!file.exists()) {
        file.mkdirs();
    }
    return file;
}
Also used : Path(java.nio.file.Path) ICourse(org.olat.course.ICourse) File(java.io.File)

Aggregations

ICourse (org.olat.course.ICourse)674 Identity (org.olat.core.id.Identity)262 RepositoryEntry (org.olat.repository.RepositoryEntry)246 CourseNode (org.olat.course.nodes.CourseNode)182 Test (org.junit.Test)158 ArrayList (java.util.ArrayList)102 UserCourseEnvironment (org.olat.course.run.userview.UserCourseEnvironment)90 Date (java.util.Date)84 URI (java.net.URI)76 HttpResponse (org.apache.http.HttpResponse)76 OLATResource (org.olat.resource.OLATResource)64 File (java.io.File)62 IdentityEnvironment (org.olat.core.id.IdentityEnvironment)52 AssessableCourseNode (org.olat.course.nodes.AssessableCourseNode)52 Produces (javax.ws.rs.Produces)48 Roles (org.olat.core.id.Roles)44 Path (javax.ws.rs.Path)42 UserRequest (org.olat.core.gui.UserRequest)42 INode (org.olat.core.util.nodes.INode)40 ScoreEvaluation (org.olat.course.run.scoring.ScoreEvaluation)40