use of org.olat.group.BusinessGroup in project OpenOLAT by OpenOLAT.
the class HomeCalendarManager method addCalendars.
/**
* Append the calendars of a list of groups. The groups must have their calendar tool
* enabled, this routine doesn't check it.
* @param ureq
* @param groups
* @param isOwner
* @param calendars
*/
private void addCalendars(List<BusinessGroup> groups, boolean isOwner, boolean isParticipant, List<KalendarRenderWrapper> calendars, Map<CalendarKey, CalendarUserConfiguration> configMap) {
Map<Long, Long> groupKeyToAccess = CoreSpringFactory.getImpl(CollaborationManager.class).lookupCalendarAccess(groups);
for (BusinessGroup bGroup : groups) {
try {
KalendarRenderWrapper groupCalendarWrapper = calendarManager.getGroupCalendar(bGroup);
groupCalendarWrapper.setPrivateEventsVisible(true);
// set calendar access
int iCalAccess = CollaborationTools.CALENDAR_ACCESS_OWNERS;
Long lCalAccess = groupKeyToAccess.get(bGroup.getKey());
if (lCalAccess != null) {
iCalAccess = lCalAccess.intValue();
}
if (iCalAccess == CollaborationTools.CALENDAR_ACCESS_OWNERS && !isOwner) {
groupCalendarWrapper.setAccess(KalendarRenderWrapper.ACCESS_READ_ONLY);
} else {
groupCalendarWrapper.setAccess(KalendarRenderWrapper.ACCESS_READ_WRITE);
}
CalendarUserConfiguration config = configMap.get(groupCalendarWrapper.getCalendarKey());
if (config != null) {
groupCalendarWrapper.setConfiguration(config);
}
if (isOwner || isParticipant) {
groupCalendarWrapper.setPrivateEventsVisible(true);
}
calendars.add(groupCalendarWrapper);
} catch (Exception e) {
log.error("Cannot read calendar of group: " + bGroup, e);
}
}
}
use of org.olat.group.BusinessGroup in project OpenOLAT by OpenOLAT.
the class AssessedIdentityListController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
if (formLayout instanceof FormLayoutContainer) {
FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
layoutCont.contextPut("title", testEntry.getDisplayname());
RepositoryHandler handler = repositoryHandlerFactory.getRepositoryHandler(testEntry);
layoutCont.contextPut("cssClass", RepositoyUIFactory.getIconCssClass(handler.getSupportedType()));
}
// add the table
FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
if (isAdministrativeUser) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(IdentityCourseElementCols.username, "select"));
}
int colIndex = AssessmentToolConstants.USER_PROPS_OFFSET;
for (int i = 0; i < userPropertyHandlers.size(); i++) {
UserPropertyHandler userPropertyHandler = userPropertyHandlers.get(i);
boolean visible = UserManager.getInstance().isMandatoryUserProperty(AssessmentToolConstants.usageIdentifyer, userPropertyHandler);
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(visible, userPropertyHandler.i18nColumnDescriptorLabelKey(), colIndex, "select", true, "userProp-" + colIndex));
colIndex++;
}
if (element.hasAttemptsConfigured()) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(IdentityCourseElementCols.attempts, "select"));
}
if (element.hasScoreConfigured()) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(IdentityCourseElementCols.min, "select", new ScoreCellRenderer()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(IdentityCourseElementCols.max, "select", new ScoreCellRenderer()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(IdentityCourseElementCols.score, "select", new ScoreCellRenderer()));
}
if (element.hasPassedConfigured()) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(IdentityCourseElementCols.passed, new PassedCellRenderer()));
}
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(IdentityCourseElementCols.assessmentStatus, new AssessmentStatusCellRenderer(getLocale())));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(IdentityCourseElementCols.initialLaunchDate, "select"));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, IdentityCourseElementCols.lastModified, "select"));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(IdentityCourseElementCols.lastUserModified, "select"));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, IdentityCourseElementCols.lastCoachModified, "select"));
usersTableModel = new AssessedIdentityListTableModel(columnsModel, element);
usersTableModel.setCertificateMap(new ConcurrentHashMap<>());
tableEl = uifactory.addTableElement(getWindowControl(), "table", usersTableModel, 20, false, getTranslator(), formLayout);
tableEl.setExportEnabled(true);
tableEl.setSearchEnabled(new AssessedIdentityListProvider(getIdentity(), testEntry, testEntry, null, assessmentCallback), ureq.getUserSession());
List<FlexiTableFilter> filters = new ArrayList<>();
filters.add(new FlexiTableFilter(translate("filter.passed"), "passed"));
filters.add(new FlexiTableFilter(translate("filter.failed"), "failed"));
filters.add(new FlexiTableFilter(translate("filter.inProgress"), "inProgress"));
filters.add(new FlexiTableFilter(translate("filter.inReview"), "inReview"));
filters.add(new FlexiTableFilter(translate("filter.done"), "done"));
tableEl.setFilters("", filters, false);
if (assessmentCallback.canAssessBusinessGoupMembers()) {
List<BusinessGroup> coachedGroups;
if (assessmentCallback.isAdmin()) {
SearchBusinessGroupParams params = new SearchBusinessGroupParams();
coachedGroups = businessGroupService.findBusinessGroups(params, testEntry, 0, -1);
} else {
coachedGroups = assessmentCallback.getCoachedGroups();
}
if (coachedGroups.size() > 0) {
List<FlexiTableFilter> groupFilters = new ArrayList<>();
for (BusinessGroup coachedGroup : coachedGroups) {
String groupName = StringHelper.escapeHtml(coachedGroup.getName());
groupFilters.add(new FlexiTableFilter(groupName, coachedGroup.getKey().toString(), "o_icon o_icon_group"));
}
tableEl.setExtendedFilterButton(translate("filter.groups"), groupFilters);
}
}
}
use of org.olat.group.BusinessGroup in project OpenOLAT by OpenOLAT.
the class WikiPageChangeOrCreateNotificationHandler method getTitleItem.
private TitleItem getTitleItem(Publisher p, Translator translator) {
Long resId = p.getResId();
String type = p.getResName();
String title;
if ("BusinessGroup".equals(type)) {
BusinessGroup bg = CoreSpringFactory.getImpl(BusinessGroupService.class).loadBusinessGroup(resId);
title = translator.translate("notifications.header.group", new String[] { bg.getName() });
} else if (CourseModule.getCourseTypeName().equals(type)) {
String displayName = RepositoryManager.getInstance().lookupDisplayNameByOLATResourceableId(resId);
title = translator.translate("notifications.header.course", new String[] { displayName });
} else {
title = translator.translate("notifications.header");
}
return new TitleItem(title, Wiki.CSS_CLASS_WIKI_ICON);
}
use of org.olat.group.BusinessGroup in project OpenOLAT by OpenOLAT.
the class GroupPortfolioIndexer method doIndex.
@Override
public void doIndex(SearchResourceContext parentResourceContext, Object businessObj, OlatFullIndexer indexerWriter) throws IOException, InterruptedException {
if (!portfolioModule.isEnabled())
return;
if (!(businessObj instanceof BusinessGroup))
throw new AssertException("businessObj must be BusinessGroup");
BusinessGroup businessGroup = (BusinessGroup) businessObj;
NarrowedPropertyManager npm = NarrowedPropertyManager.getInstance(businessGroup);
Property mapKeyProperty = npm.findProperty(null, null, CollaborationTools.PROP_CAT_BG_COLLABTOOLS, CollaborationTools.KEY_PORTFOLIO);
// Check if portfolio map property exist
if (mapKeyProperty != null) {
Long mapKey = mapKeyProperty.getLongValue();
String version = mapKeyProperty.getStringValue();
if (version == null || !version.equals("2")) {
PortfolioStructure map = frontendManager.loadPortfolioStructureByKey(mapKey);
if (map != null) {
SearchResourceContext resourceContext = new SearchResourceContext(parentResourceContext);
resourceContext.setBusinessControlFor(BusinessGroupMainRunController.ORES_TOOLPORTFOLIO);
resourceContext.setDocumentType(TYPE);
resourceContext.setParentContextType(GroupDocument.TYPE);
resourceContext.setParentContextName(businessGroup.getName());
Document document = PortfolioMapDocument.createDocument(resourceContext, map);
indexerWriter.addDocument(document);
}
}
}
}
use of org.olat.group.BusinessGroup in project OpenOLAT by OpenOLAT.
the class CourseGroupMgmtTest method testPutCourseGroup.
@Test
public void testPutCourseGroup() throws IOException, URISyntaxException {
assertTrue(conn.login("administrator", "openolat"));
GroupVO vo = new GroupVO();
vo.setName("hello");
vo.setDescription("hello description");
vo.setMinParticipants(new Integer(-1));
vo.setMaxParticipants(new Integer(-1));
Long courseId = courseRepoEntry.getOlatResource().getResourceableId();
URI request = UriBuilder.fromUri(getContextURI()).path("/repo/courses/" + courseId + "/groups").build();
HttpPut method = conn.createPut(request, MediaType.APPLICATION_JSON, true);
conn.addJsonEntity(method, vo);
HttpResponse response = conn.execute(method);
assertEquals(200, response.getStatusLine().getStatusCode());
GroupVO responseVo = conn.parse(response, GroupVO.class);
assertNotNull(responseVo);
assertEquals(vo.getName(), responseVo.getName());
BusinessGroup bg = businessGroupService.loadBusinessGroup(responseVo.getKey());
assertNotNull(bg);
assertEquals(bg.getKey(), responseVo.getKey());
assertEquals(bg.getName(), vo.getName());
assertEquals(bg.getDescription(), vo.getDescription());
assertNull(bg.getMinParticipants());
assertNull(bg.getMaxParticipants());
}
Aggregations