How to set up 15 minute increments and axis labels in Calendar.

Topics related to AppGini plugins/add-ons go here.
Post Reply
mdannatt
Veteran Member
Posts: 41
Joined: 2020-01-27 17:34

How to set up 15 minute increments and axis labels in Calendar.

Post by mdannatt » 2021-11-07 14:33

I've seen a few posts asking how to set 15 minute increments in Calendar. Here is how I did it.

1. I am assuming you know how to install calendar correctly.
2. Set up your tables correctly, making sure you have a start datetime (format type datetime in AG) and end datetime(format type datetime in AG). I find the date/time pickers a bit cumbersome, so to speed up input, I have a third field: duration. (format type INT in AG). In the Options List for duration, I have 15,30,45,60 minute durations.

The end datetime is a calculated field. set the data type to datetime and also check 'read only'. In the calculated field tab, add the following sql query:

Code: Select all

 
SELECT
date_add(`start_date`,INTERVAL `duration` MINUTE)
FROM
    your_database_name.your_table_name
WHERE
your_table_name.id = %ID%
 
Next, and I can't stress this enough, use PHPMyAdmin or similar to check that a test entry is actually hitting the database and stored in the correct format. I spent hours with a sql query that worked, only to eventually discover that the end datetime was not being correctly recorded. This is particularly true if you format dates differently from the system default.

Once you have installed the calendar, created at least one event type and one calendar, click the blue "GENERATE CALENDAR FILES' button. in your HOOKS folder, you will find a file called calendar-your_calender_name.php. Open it up using your favourite editor, and scroll to about line 67 and look for TIMEGRIDWEEK. Immediately after scrollTime: Cal.scrollTime, paste in the following code:

Code: Select all

						slotDuration: '00:15:00',
						slotLabelInterval: "00:15",
						minTime: "06:00:00",
						maxTime: "18:15:00",
						axisFormat: 'HH:mm'
In this example, I am setting the slots to 15 minutes, as well as the label interval to 15 minutes. My client only works during business hours, so I set the mintime and maxtime to office hours.

Now scroll down to TIMEGRIDDAY, and paste in exactly the same code as above. Save the file.

that's it, you're done! Both the day view and the week view will now render in 15-minute increments and are correctly labelled.

Other:
there is a div id called
<div id="your_calendar_name"></div>, so you could do this using jquery in the header-extras.php file,but I couldn't get it to work.
Remember that changes to your calendar will mean regenerating your files and the edited PHP file will be overwritten.

MD
Roses are red, Violets are blue, unexpected '}' on line 32

SkayyHH
Veteran Member
Posts: 425
Joined: 2015-04-27 21:18

Re: How to set up 15 minute increments and axis labels in Calendar.

Post by SkayyHH » 2021-11-08 04:25

That's great. Thank you for sharing! Do you also have an idea how to enter recurring appointments. e.g. birthdays?

Many greetings,

mdannatt
Veteran Member
Posts: 41
Joined: 2020-01-27 17:34

Re: How to set up 15 minute increments and axis labels in Calendar.

Post by mdannatt » 2021-11-08 08:20

I am working my way through this idea:

https://newbedev.com/jquery-fullcalenda ... ring-event

but I haven't made much progress. If I get it working, I will post it here.
Roses are red, Violets are blue, unexpected '}' on line 32

User avatar
a.gneady
Site Admin
Posts: 1281
Joined: 2012-09-27 14:46
Contact:

Re: How to set up 15 minute increments and axis labels in Calendar.

Post by a.gneady » 2021-11-09 23:32

mdannatt wrote:
2021-11-08 08:20
Roses are red, Violets are blue, unexpected '}' on line 32
Out of curiosity, is there a story behind this signature? :)
:idea: AppGini plugins to add more power to your apps:
  • DataTalk is an innovative AppGini plugin based on ChatGPT that allows you to interact with your AppGini database using natural language questions, without writing any SQL. Check the demo video
  • Mass Update plugin: Update multiple records at once and improve your workflow efficiency.
  • Check our other plugins and get a generous discount of up to 30% when buying 2 or more plugins.

Post Reply