Search in sources :

Example 46 with Controller

use of org.olat.core.gui.control.Controller in project OpenOLAT by OpenOLAT.

the class CPRunController method createNodeRunConstructionResult.

public NodeRunConstructionResult createNodeRunConstructionResult(UserRequest ureq, String selectedNodeId) {
    NodeRunConstructionResult ncr;
    if (isExternalMenuConfigured()) {
        // integrate it into the olat menu
        Controller ctrl = TitledWrapperHelper.getWrapper(ureq, getWindowControl(), this, cpNode, "o_cp_icon");
        if (StringHelper.containsNonWhitespace(selectedNodeId) && treeModel.getNodeById(selectedNodeId) != null) {
            selNodeId = selectedNodeId;
        }
        ncr = new NodeRunConstructionResult(ctrl, treeModel, selNodeId, treeNodeClickListener);
    } else {
        // no menu to integrate
        Controller ctrl = TitledWrapperHelper.getWrapper(ureq, getWindowControl(), this, cpNode, "o_cp_icon");
        ncr = new NodeRunConstructionResult(ctrl);
    }
    return ncr;
}
Also used : NodeRunConstructionResult(org.olat.course.run.navigation.NodeRunConstructionResult) CPDisplayController(org.olat.modules.cp.CPDisplayController) Controller(org.olat.core.gui.control.Controller) NodeEditController(org.olat.course.editor.NodeEditController) BasicController(org.olat.core.gui.control.controller.BasicController)

Example 47 with Controller

use of org.olat.core.gui.control.Controller in project OpenOLAT by OpenOLAT.

the class MemberInfoController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    if (formLayout instanceof FormLayoutContainer) {
        FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
        Controller dpc = new DisplayPortraitController(ureq, getWindowControl(), identity, true, false);
        // auto dispose
        listenTo(dpc);
        layoutCont.put("image", dpc.getInitialComponent());
        layoutCont.contextPut("fullname", StringHelper.escapeHtml(userManager.getUserDisplayName(identity)));
    }
    // user properties
    FormLayoutContainer userPropertiesContainer = FormLayoutContainer.createDefaultFormLayout_6_6("userProperties", getTranslator());
    formLayout.add("userProperties", userPropertiesContainer);
    List<UserPropertyHandler> userPropertyHandlers = userManager.getUserPropertyHandlersFor(getClass().getCanonicalName(), false);
    for (UserPropertyHandler userPropertyHandler : userPropertyHandlers) {
        if (userPropertyHandler == null)
            continue;
        String propName = userPropertyHandler.getName();
        String value = userPropertyHandler.getUserProperty(identity.getUser(), getLocale());
        String key = userPropertyHandler.i18nFormElementLabelKey();
        if (value == null) {
            value = "";
        }
        uifactory.addStaticTextElement("up_" + propName, key, value, userPropertiesContainer);
    }
    // course informations
    FormLayoutContainer courseInfosContainer = FormLayoutContainer.createDefaultFormLayout_9_3("courseInfos", getTranslator());
    formLayout.add("courseInfos", courseInfosContainer);
    membershipCreationEl = uifactory.addStaticTextElement("firstTime", "course.membership.creation", "", courseInfosContainer);
    if (securityModule.isUserLastVisitVisible(ureq.getUserSession().getRoles())) {
        Formatter formatter = Formatter.getInstance(getLocale());
        String lastVisit = "";
        String numOfVisits = "0";
        if (courseInfos != null) {
            if (courseInfos.getRecentLaunch() != null) {
                lastVisit = formatter.formatDate(courseInfos.getRecentLaunch());
            }
            if (courseInfos.getVisit() >= 0) {
                numOfVisits = Integer.toString(courseInfos.getVisit());
            }
        }
        uifactory.addStaticTextElement("lastTime", "course.lastTime", lastVisit, courseInfosContainer);
        uifactory.addStaticTextElement("numOfVisits", "course.numOfVisits", numOfVisits, courseInfosContainer);
    }
    // links
    if (withLinks) {
        homeLink = uifactory.addFormLink("home", formLayout, Link.BUTTON);
        homeLink.setIconLeftCSS("o_icon o_icon_home");
        formLayout.add("home", homeLink);
        contactLink = uifactory.addFormLink("contact", formLayout, Link.BUTTON);
        contactLink.setIconLeftCSS("o_icon o_icon_mail");
        formLayout.add("contact", contactLink);
        if (repoEntryKey != null) {
            assessmentLink = uifactory.addFormLink("assessment", formLayout, Link.BUTTON);
            assessmentLink.setIconLeftCSS("o_icon o_icon_certificate");
            formLayout.add("assessment", assessmentLink);
        }
    }
}
Also used : DisplayPortraitController(org.olat.user.DisplayPortraitController) Formatter(org.olat.core.util.Formatter) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) DisplayPortraitController(org.olat.user.DisplayPortraitController) FormBasicController(org.olat.core.gui.components.form.flexible.impl.FormBasicController) Controller(org.olat.core.gui.control.Controller) UserPropertyHandler(org.olat.user.propertyhandlers.UserPropertyHandler)

Example 48 with Controller

use of org.olat.core.gui.control.Controller in project OpenOLAT by OpenOLAT.

the class OlatTopNavController method getPortraitCmp.

private Component getPortraitCmp(UserRequest ureq) {
    Controller ctr = new DisplayPortraitController(ureq, getWindowControl(), getIdentity(), false, false, false, true);
    listenTo(ctr);
    return ctr.getInitialComponent();
}
Also used : DisplayPortraitController(org.olat.user.DisplayPortraitController) DisplayPortraitController(org.olat.user.DisplayPortraitController) Controller(org.olat.core.gui.control.Controller) BasicController(org.olat.core.gui.control.controller.BasicController) LockableController(org.olat.core.commons.fullWebApp.LockableController)

Example 49 with Controller

use of org.olat.core.gui.control.Controller in project OpenOLAT by OpenOLAT.

the class GuestBFWCParts method createHeaderController.

/**
 * @see org.olat.core.commons.fullWebApp.BaseFullWebappControllerParts#createHeaderController(org.olat.core.gui.UserRequest, org.olat.core.gui.control.WindowControl)
 */
@Override
public Controller createHeaderController(UserRequest ureq, WindowControl wControl) {
    Controller headerCtr = null;
    // ----------- header, optional (e.g. for logo, advertising ) ------------------
    if (CoreSpringFactory.containsBean("fullWebApp.GuestHeaderControllerCreator")) {
        ControllerCreator headerControllerCreator = (ControllerCreator) CoreSpringFactory.getBean("fullWebApp.GuestHeaderControllerCreator");
        headerCtr = headerControllerCreator.createController(ureq, wControl);
    }
    return headerCtr;
}
Also used : Controller(org.olat.core.gui.control.Controller) OlatFooterController(org.olat.gui.control.OlatFooterController) LockableController(org.olat.core.commons.fullWebApp.LockableController) ControllerCreator(org.olat.core.gui.control.creator.ControllerCreator)

Example 50 with Controller

use of org.olat.core.gui.control.Controller in project OpenOLAT by OpenOLAT.

the class GuestBFWCParts method createFooterController.

/**
 * @see org.olat.core.commons.fullWebApp.BaseFullWebappControllerParts#createFooterController(org.olat.core.gui.UserRequest, org.olat.core.gui.control.WindowControl)
 */
@Override
public LockableController createFooterController(UserRequest ureq, WindowControl wControl) {
    Controller footerCtr = null;
    // ----------- footer, optional (e.g. for copyright, powered by) ------------------
    if (CoreSpringFactory.containsBean("fullWebApp.GuestFooterControllerCreator")) {
        ControllerCreator footerCreator = (ControllerCreator) CoreSpringFactory.getBean("fullWebApp.GuestFooterControllerCreator");
        footerCtr = footerCreator.createController(ureq, wControl);
    } else {
        footerCtr = new OlatFooterController(ureq, wControl);
    }
    return (LockableController) footerCtr;
}
Also used : LockableController(org.olat.core.commons.fullWebApp.LockableController) OlatFooterController(org.olat.gui.control.OlatFooterController) Controller(org.olat.core.gui.control.Controller) OlatFooterController(org.olat.gui.control.OlatFooterController) LockableController(org.olat.core.commons.fullWebApp.LockableController) ControllerCreator(org.olat.core.gui.control.creator.ControllerCreator)

Aggregations

Controller (org.olat.core.gui.control.Controller)372 BasicController (org.olat.core.gui.control.controller.BasicController)114 LayoutMain3ColsController (org.olat.core.commons.fullWebApp.LayoutMain3ColsController)82 NodeEditController (org.olat.course.editor.NodeEditController)82 WindowControl (org.olat.core.gui.control.WindowControl)78 TabbableController (org.olat.core.gui.control.generic.tabbable.TabbableController)74 NodeRunConstructionResult (org.olat.course.run.navigation.NodeRunConstructionResult)62 RepositoryEntry (org.olat.repository.RepositoryEntry)60 Translator (org.olat.core.gui.translator.Translator)54 UserRequest (org.olat.core.gui.UserRequest)52 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)50 OLATResourceable (org.olat.core.id.OLATResourceable)46 ArrayList (java.util.ArrayList)40 ControllerCreator (org.olat.core.gui.control.creator.ControllerCreator)40 MainLayoutBasicController (org.olat.core.gui.control.controller.MainLayoutBasicController)36 Component (org.olat.core.gui.components.Component)34 Roles (org.olat.core.id.Roles)34 Activateable2 (org.olat.core.gui.control.generic.dtabs.Activateable2)32 FormBasicController (org.olat.core.gui.components.form.flexible.impl.FormBasicController)30 ContextEntry (org.olat.core.id.context.ContextEntry)30