Google Calendar integration.

We're upgrading our support forum. Replies are currently closed. Please view our Documentation and FAQ using the menu above.

Hi people,
I am having some problems with Google Calendar integration.
Firstly, how do I view the calendar? I have followed instructions on website but only seem to get CRON remembers when viewing on Google.
Any help with this would be much appreciated 🙂

I know its an old thread, but I can not find an answer anywhere.

Yes I would like to know how to see the every day events I add to my UCM Calendar in my Google Calendar.

I have added all the ical links (from UCM Settings->GoogleCal) to my Google Calendar, but when I add an even to to my UCM Calendar, these are not shown in my Google Calendar, either I am missing something, or UCM doesnt support this..? but I would of thought it does, I mean, it does other calendars like Transactions and Summaries.

I have the same problem! Is it even possible to intergrate Google Calender with UCM Pro? Please let us know 🙂

Yep, I bought this product and one of the main things I needed was the Google Calendar integration for Jobs. It shows on the Code Canyon site that it comes with a Google Calendar export plugin. Is there a way to get it to export the jobs to google calendar?

@rab497, So if I understand this correctly? I can connect my phone to Google Calender, and if I set an appointment on that – and I connect my Google Calender with UCM Pro – it will shows my appointment on UCM Pro?
Is it difficult to achieve this? Because if that is possible, I will defenitly buy this!

No, the Google Calendar export plugin only exports a few things to an ics file which you can add to your Google Calendar using the ‘Add Url…’ option under more calendars.
The things that get exported are fixed, they are the dahsboard alerts, and some Financial stuff.
I wanted, and kind of expected the Google Calendar integration to be a bit better. To be able to view jobs and appointments, maybe update them through Google Calendar etc. This does not seem possible at the moment.
I have knocked up some code myself to export the jobs in the calender to be able to add them to a Google Calender the same as the standard stuff.
It is very simple, but it achieves some of the function I thought would be available as standard. I can now see the job appointments in Google Calendar, with links to the job in UCM. It is read only, all updates have to be done via UCM and there is an indeterminate amount of time for updated appointments or new appointments to appear in Google Calendar.

I am also not able to get anything in google calendar. I am expecting the jobs to come. Even dashboard alerts are also not showing there. Please help.

The jobs will not show. UCM doesn’t do this at the moment. I received a reply from dtbaker to say that this will be something available in the next big update.
The update I made, involved adding a new case to the switch statement in the handle_hook function in job.php, and creating a new template file in the calendar/pages directory.
It is a quick hack to make the jobs export in an ics file which you can then subscribe to through most calendar applications.
If you are interested I can post the code required.

@rab497: Thanks dear for replying. Well, dashboard alerts are also not working? Also, I will love to make changes as per your suggestion. Please post the code here.

OK, before you do this MAKE A BACKUP and also, you must understand;
* You will NOT be able to change the information via the calendar, all updates must be done through UCM, these will then update when the calendar application refreshes.
* Refresh rates for subscribed calendars are dependant on the application you use to view the calendar. If I add the calendar to my GMail account the refresh is very slow. It can take hours for changes to show. On an iPhone it is 15mins as standard.
* These changes will get overwritten if the files are subject to upgrades.
* This code only gives jobs since the start of March 2015. If you need other date options you will need to change the code.
* The security in this system is that the hash must be exact to work. If you give the URL to somebody they will be able to see your calendar information. (This is the same as the GoogleCal plugin with the financial summaries etc.)

1. Create a new file called ‘ical_jobs.php’ in the folder includes/plugin_calendar/pages/
2. Copy the following contents into it.


  * Based on code written by dtbaker.
  * Copyright: dtbaker 2012
  * Licence: Please check for licence details. 
  * More licence clarification available here: 

header('Content-type: text/calendar; charset=utf-8');
header('Content-Disposition: inline; filename="jobs.ics"');

$alerts = array();

$results = handle_hook("job_alerts", 'calendar', true);

if (is_array($results)) {
    foreach ($results as $res) {
        if (is_array($res)) {
            foreach ($res as $r) {
                $alerts[] = $r;

PRODID:-//Ultimate Client Manager/Calendar Plugin v1.0//EN

if (count($alerts)) {
    foreach ($alerts as $alert) {
		if( 0 < $alert['start_time'] ){
			$end = isset($alert['end_time']) ? date('Ymd\THis\Z', $alert['end_time']) : date('Ymd\THis\Z', $alert['start_time']);
DTSTAMP:'.date('Ymd\THis\Z', time()).'
DTSTART:'.date('Ymd\THis\Z', $alert['start_time']).'
DESCRIPTION: Customer:'.$alert['link']."<br />".$alert['other_details'].'


3. In the file includes/plugin_job/job.php around line 977 (Depends which version of the file you have) find the lines

				return $alerts;
        return false;

    public static function hook_calendar_events($callback, $start_time, $end_time){

4. After the ‘break;’ line add the code between the comments to make it look as below

				return $alerts;
// New code starts
			case "job_alerts":
				$jobs = self::get_jobs( array(
					   'date_start_after'  => "2015/03/01",
				) );
				$calendar_events = array();
				foreach ( $jobs as $job ) {
					$calendar_events[] = array(
						'uid'           => md5($job['job_id']) . '',
						'subject'       => $job['name'],
						'customer_id'   => $job['customer_id'],
						'start_time'    => strtotime( $job['date_start'] . ( ! empty( $job['time_start'] ) ? ' ' . $job['time_start'] : '' ) ),
						'end_time'      => strtotime( $job['date_start'] . ( ! empty( $job['time_end'] ) ? ' ' . $job['time_end'] : '' ) ),
						'all_day'       => empty( $job['time_start'] ),
						'user_id'       => $job['user_id'],
						'description'   => 'Test Description',
						'link'          => ( $job['customer_id'] ? module_customer::link_open( $job['customer_id'], true ) : '' ),
						'other_details' => _l( 'Job: %s', module_job::link_open( $job['job_id'], true, $job ) ),
						'staff_ids'     => array( $job['user_id'] ), // todo - add job task staff members here.
				return $calendar_events;
// New code ends
        return false;

    public static function hook_calendar_events($callback, $start_time, $end_time){

5. In the file includes/plugin_calendar/pages/calendar_settings.php around line 45 before the <?php line add the following code to make it look the same.

    <a>" target="_blank"><?php echo module_calendar::link_calendar('finance_summary',array());?></a>
<!-- New code Starts -->
<p><?php _e('Here is the URL for <strong>Jobs</strong>');?></p>
    <a>" target="_blank"><?php echo module_calendar::link_calendar('jobs',array());?></a>
<!-- New code Ends -->

<?php }else{ ?>

6. Finished

Now when you go into the GoogleCal page in the Settings you will have a new link at the bottom of the page. The link should be used to subscribe to the calendar in whichever calendar application you choose.

Thanks for this, I’ll see if I can include it in the next update.

I’m almost done with a full ical export of the UCM “Calendar”. So anything that appears in the UCM Calendar can be exported into a single ical file.

Good news about the full export option. It would be really good if you could include this in an update for the time being.

Things that could be quite easily improved would be to have a config option for the number of weeks to include prior to todays date. I have put a nominal date in, but that should really be set to be something sensible like -1 weeks to reduce the ics file size in the long run.
'date_start_after' => date('Y/m/d', strtotime("-1 week")),

In the job.php file, the job id should bring in the domain name, at the moment it is hard coded.
'uid' => md5($job['job_id']) . '@' . $_SERVER["SERVER_NAME"],

Also people should set their webservers to gzip the mime type ‘text/calendar’ as this will reduce data transfer if people are using this with a mobile connection.

Hey everyone, latest update contains a full calendar export to ical.

Please upgrade and then check Settings > Calendar for the instructions.

There are individual staff URLs that can be used to show each staff members ical export data, or there is the overall admin “everything” ical export link.

As we add more data to the UCM calendar in the future these will automatically come over to the ical export.

Wow, you weren’t joking when you said you were nearly finished with the Calendar export!! Thanks I will have a look at the updates later.

The forum ‘General Support’ is closed to new topics and replies.

cgcomputersGoogle Calendar integration.