Foros de discusión

show calendar events in custom portlet

juan meza, modificado hace 7 años.

show calendar events in custom portlet

Regular Member Mensajes: 228 Fecha de incorporación: 6/01/14 Mensajes recientes
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, modificado hace 7 años.

RE: show calendar events in custom portlet (Respuesta)

Regular Member Mensajes: 228 Fecha de incorporación: 6/01/14 Mensajes recientes
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, modificado hace 6 años.

RE: show calendar events in custom portlet

Regular Member Mensajes: 153 Fecha de incorporación: 25/11/08 Mensajes recientes
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, modificado hace 6 años.

RE: show calendar events in custom portlet

Regular Member Mensajes: 228 Fecha de incorporación: 6/01/14 Mensajes recientes
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, modificado hace 6 años.

RE: show calendar events in custom portlet

Regular Member Mensajes: 153 Fecha de incorporación: 25/11/08 Mensajes recientes
Thanks Juan !! That was helpful emoticon