Package org.olat.core.util

Examples of org.olat.core.util.Formatter


    List<String> buttonRow = getButtonRowFor(row);
    if (insertDateTimeEnabled) {
      plugins.add(INSERTDATETIME_PLUGIN);
      buttonRow.add(INSERTDATETIME_PLUGIN_BUTTONGROUP);
      // use date format defined in org.olat.core package
      Formatter formatter = Formatter.getInstance(locale);
      String dateFormat = formatter.getSimpleDatePatternForDate();
      setQuotedConfigValue(INSERTDATETIME_DATEFORMAT, dateFormat);
      // for the time format we use the standard format (same for all languages)
    } else {
      plugins.remove(INSERTDATETIME_PLUGIN);
      buttonRow.remove(INSERTDATETIME_PLUGIN_BUTTONGROUP);
View Full Code Here


        if (success) {
          // lock information
          String username = sessInfo.getLogin();
          ArrayList lockList = new ArrayList();
          List<LockEntry> locks = CoordinatorManager.getCoordinator().getLocker().adminOnlyGetLockEntries();
          Formatter f = Formatter.getInstance(ureq.getLocale());
          for (LockEntry entry : locks) {
            if (entry.getOwner().getName().equals(username)) {
              lockList.add(entry.getKey()+" "+f.formatDateAndTime(new Date(entry.getLockAquiredTime())));
            }
          }         
          myContent.contextPut("locklist", lockList);
 
          // user environment
View Full Code Here

    c.put("first", identity.getUser().getProperty(UserConstants.FIRSTNAME, getLocale()));
    c.put("last", identity.getUser().getProperty(UserConstants.LASTNAME, getLocale()));
    c.put("email", identity.getUser().getProperty(UserConstants.EMAIL, getLocale()));
    c.put("filename", filename);
    Date now = new Date();
    Formatter f = Formatter.getInstance(ureq.getLocale());
    c.put("date", f.formatDate(now));
    c.put("time", f.formatTime(now));
   
    // update attempts counter for this user: one file - one attempts
    AssessableCourseNode acn = (AssessableCourseNode) node;
    acn.incrementUserAttempts(userCourseEnv);
       
View Full Code Here

    //re could be null, but if we are here it should not be null!
    Roles userRoles = ureq.getUserSession().getRoles();
    boolean showAll = false;
    showAll = userRoles.isAuthor() || userRoles.isOLATAdmin();
    //get changelog
    Formatter formatter = Formatter.getInstance(ureq.getLocale());
    ImsRepositoryResolver resolver = new ImsRepositoryResolver(re.getKey());
    QTIChangeLogMessage[] qtiChangeLog = resolver.getDocumentChangeLog();
    StringBuilder qtiChangelog = new StringBuilder();
    Date msgDate = null;
    if(qtiChangeLog.length>0){
      //there are resource changes
      Arrays.sort(qtiChangeLog);
      for (int i = qtiChangeLog.length-1; i >= 0 ; i--) {
        //show latest change first
        if(!showAll && qtiChangeLog[i].isPublic()){
          //logged in person is a normal user, hence public messages only
          msgDate=new Date(qtiChangeLog[i].getTimestmp());
          qtiChangelog.append("\nChange date: ").append(formatter.formatDateAndTime(msgDate)).append("\n");
          qtiChangelog.append(qtiChangeLog[i].getLogMessage());
          qtiChangelog.append("\n********************************\n");
        }else if (showAll){
          //logged in person is an author, olat admin, owner, show all messages
          msgDate=new Date(qtiChangeLog[i].getTimestmp());
          qtiChangelog.append("\nChange date: ").append(formatter.formatDateAndTime(msgDate)).append("\n");
          qtiChangelog.append(qtiChangeLog[i].getLogMessage());
          qtiChangelog.append("\n********************************\n");
        }//else non public messages are not shown to normal user
      }
    }
View Full Code Here

          calType = CalendarManager.TYPE_GROUP;
          title = translator.translate("cal.notifications.header.group", new String[]{group.getName()});
        }

        if (calType != null) {
          Formatter form = Formatter.getInstance(locale);
          si = new SubscriptionInfo(new TitleItem(title, CSS_CLASS_CALENDAR_ICON), null);
         
          String bPath;
          if(StringHelper.containsNonWhitespace(p.getBusinessPath())) {
            bPath = p.getBusinessPath();
          } else if("CalendarManager.course".equals(p.getResName())) {
            try {
              ICourse course = CourseFactory.loadCourse(p.getResId());
              RepositoryEntry re = RepositoryManager.getInstance().lookupRepositoryEntry(course, true);
              bPath = "[RepositoryEntry:" + re.getKey() + "]";//Fallback
            } catch (Exception e) {
              logError("Error processing calendar notifications of publisher:" + p.getKey(), e);
              return NotificationsManager.getInstance().getNoSubscriptionInfo();
            }
          } else {
            //cannot make link without business path
            return NotificationsManager.getInstance().getNoSubscriptionInfo();
          }
 
          Kalendar cal = CalendarManagerFactory.getInstance().getCalendarManager().getCalendar(calType, id.toString());
          Collection<KalendarEvent> calEvents = cal.getEvents();
          for (KalendarEvent kalendarEvent : calEvents) {
            if (showEvent(compareDate, kalendarEvent)) {
              logDebug("found a KalendarEvent: " + kalendarEvent.getSubject() + " with time: " + kalendarEvent.getBegin()
                  + " modified before: " + compareDate.toString(), null);
              // found a modified event in this calendar
              Date modDate = null;
              if(kalendarEvent.getLastModified() > 0) {
                modDate = new Date(kalendarEvent.getLastModified());
              } else if(kalendarEvent.getCreated() > 0) {
                modDate = new Date(kalendarEvent.getCreated());
              } else if(kalendarEvent.getBegin() != null) {
                modDate = kalendarEvent.getBegin();
              }
             
              String subject = kalendarEvent.getSubject();
              String location = kalendarEvent.getLocation() == null ? "" : translator.translate("cal.notifications.location",
                  new String[] { kalendarEvent.getLocation() });
              String dateStr;
              if (kalendarEvent.isAllDayEvent()) {
                dateStr = form.formatDate(kalendarEvent.getBegin());
              } else {
                dateStr = form.formatDate(kalendarEvent.getBegin()) + " - " + form.formatDate(kalendarEvent.getEnd());
              }
              String desc = translator.translate("cal.notifications.entry", new String[] { subject, dateStr, location });
              String businessPath = bPath + "[path=" + kalendarEvent.getID() + ":0]";
              String urlToSend = NotificationHelper.getURLFromBusinessPathString(p, businessPath);
              SubscriptionListItem subListItem = new SubscriptionListItem(desc, urlToSend, modDate, CSS_CLASS_CALENDAR_ICON);
View Full Code Here

TOP

Related Classes of org.olat.core.util.Formatter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.