Forums de discussion

show calendar events in custom portlet

juan meza, modifié il y a 7 années.

show calendar events in custom portlet

Regular Member Publications: 228 Date d'inscription: 06/01/14 Publications récentes
Hi, I have Liferay 7 GA3
I want to create a custom portlet (or module) to show the calendar portlet events... I know how to do this in older versions of liferay (6.2) but can some one tell me how to show the calendar events in a custom portlet in liferay 7? or point me in the right direction? how to even retrieve the events

thanks!
juan meza, modifié il y a 7 années.

RE: show calendar events in custom portlet (Réponse)

Regular Member Publications: 228 Date d'inscription: 06/01/14 Publications récentes
Hi, found the solution to my problem... you just have to add the Calendar api configuration to gradle

so add this to your portlet build.gradle dependencies:
compileOnly group: "com.liferay", name: "com.liferay.calendar.api", version: "2.0.2"
compileOnly group: "com.liferay", name: "com.liferay.calendar.service", version: "2.1.9"


and this to your settings.gradle's dependencies... of the workspace
classpath group: "com.liferay", name: "com.liferay.calendar.api", version: "2.0.2"
classpath group: "com.liferay", name: "com.liferay.calendar.service", version: "2.1.9"


and now you can use the calendarBooking api to do whatever you wantemoticon
thumbnail
Manish Kumar Jaiswal, modifié il y a 6 années.

RE: show calendar events in custom portlet

Regular Member Publications: 153 Date d'inscription: 25/11/08 Publications récentes
Hi Juan ,

if possible can you please some code snippets to show the calendar events in Liferay 7 . That will be helpful .

Thanks
juan meza, modifié il y a 6 années.

RE: show calendar events in custom portlet

Regular Member Publications: 228 Date d'inscription: 06/01/14 Publications récentes
sure... you just need to get the calendars:
DynamicQuery dq = com.liferay.calendar.service.CalendarBookingLocalServiceUtil.dynamicQuery();
dq.add(com.liferay.portal.kernel.dao.orm.PropertyFactoryUtil.forName("groupId").eq(themeDisplay.getScopeGroupId()));
List<calendarbooking> calendarBookings = (List)CalendarBookingLocalServiceUtil.dynamicQuery(dq);
		</calendarbooking>


in this example, by groupId (by site or organization)
then just iterate them
for(CalendarBooking event:calendarBookings){
			System.out.println(event.getTitleCurrentValue());
		}


hope it helps emoticon
thumbnail
Manish Kumar Jaiswal, modifié il y a 6 années.

RE: show calendar events in custom portlet

Regular Member Publications: 153 Date d'inscription: 25/11/08 Publications récentes
Thanks Juan !! That was helpful emoticon