Foros de discusión
How to access Calendar Event fields in Application Display Template (ADT)
Vyash Janki, modificado hace 9 años.
How to access Calendar Event fields in Application Display Template (ADT)
New Member Mensaje: 1 Fecha de incorporación: 14/10/14 Mensajes recientes
Hi!
I've created a custom ADT for my Asset Publisher whereby I want to display Calender events only. Now, I want to display, let's say the start and end date of an event. I'm currently struggling with:
Needless to say it isn't working. So how do I access Calendar events-related fields (start date, location, ...) in an ADT?!
I've created a custom ADT for my Asset Publisher whereby I want to display Calender events only. Now, I want to display, let's say the start and end date of an event. I'm currently struggling with:
#if (!$entries.isEmpty())
#foreach ($entry in $entries)
$entry.getStartDate()
<br>
$entry.getEndDate()
#end
#end
Needless to say it isn't working. So how do I access Calendar events-related fields (start date, location, ...) in an ADT?!
James Falkner, modificado hace 9 años.
RE: How to access Calendar Event fields in Application Display Template (AD
Liferay Legend Mensajes: 1399 Fecha de incorporación: 17/09/10 Mensajes recientes
How about:
#set ($calService = $utilLocator.findUtil("calendar-portlet", "com.liferay.calendar.service.CalendarBookingLocalService"))
#if (!$entries.isEmpty())
#foreach ($entry in $entries)
#set ($calBookingEntry = $calService.getCalendarBooking($entry.getAssetRenderer().getClassPK()))
<ul>
<li>Title: $calBookingEntry.getTitle($locale)</li></ul>
<li>Start: $dateTool.format($calBookingEntry.getStartTime())
</li>
End: $dateTool.format($calBookingEntry.getEndTime())
#end
#end
Rahul Joshi, modificado hace 6 años.
RE: How to access Calendar Event fields in Application Display Template (AD
Junior Member Mensajes: 63 Fecha de incorporación: 3/03/17 Mensajes recientes
Any help on how I can sort the calendar events by the event date?
Sourabh Lonikar, modificado hace 6 años.
RE: How to access Calendar Event fields in Application Display Template (AD
Junior Member Mensajes: 42 Fecha de incorporación: 14/11/16 Mensajes recientesJames Falkner:
How about:#set ($calService = $utilLocator.findUtil("calendar-portlet", "com.liferay.calendar.service.CalendarBookingLocalService")) #if (!$entries.isEmpty()) #foreach ($entry in $entries) #set ($calBookingEntry = $calService.getCalendarBooking($entry.getAssetRenderer().getClassPK())) <ul> <li>Title: $calBookingEntry.getTitle($locale)</li></ul> <li>Start: $dateTool.format($calBookingEntry.getStartTime()) </li>
End: $dateTool.format($calBookingEntry.getEndTime()) #end #end
Hi James.
This start date is coming in msec format as string. Hence I cannot use "?string["yyyy-MM-dd"]}" for showing date in proper format. How should I go about to get date in proper format ?
Regards,
Sourabh Lonikar, modificado hace 6 años.
RE: How to access Calendar Event fields in Application Display Template (AD
Junior Member Mensajes: 42 Fecha de incorporación: 14/11/16 Mensajes recientes
I am using below code to get date in proper format but I am getting wrong date:
calBookingEntry.getStartTime()?datetime("ssssssssssssssss")?string["yyyy-MM-dd"]
Actual Output : 2014-09-15
Desired Output : 2017-07-18
calBookingEntry.getStartTime()?datetime("ssssssssssssssss")?string["yyyy-MM-dd"]
Actual Output : 2014-09-15
Desired Output : 2017-07-18