How to use the script

Instalation:

  • Download the complete calendar package.
  • Unzip the file.
  • Upload all the files a directory in your server (e.g. "calendar").
  • Open your browser to the calendar directory and run the ac-install.php file.
  • Note - the ac-config.inc.file will need write permissions (chmod 777) - alternatively you can modify it manually on your server.
  • Follow the install instructions. This file preforms the following actions:
    • Check database connection - if it fails, it checks write permission on ac-config.inc.php file then shows a form for indicating your database connection data.
    • Once ac-config.inc.php has been configured, it writes the database tables and default data to the database.
    • Shows basic calendar configuration parameters (url, title, num months etc) - these can later be changed from the administration panel.
  • Once the install process is complete, remove the ac-install.php file from the ftp and change the write permissions on the ac-config.inc.php so that it is unwritable.
  • Login to admin ( eg. http://www.your_url.com/calendar/ac-admin/)
    user: admin
    password: demo
    Note - change these default values as soon as possible!
  • Define your calendar items.
  • Include the calendar in your web or application (see readme.txt for more information).
  • That's all. If you are happy and you like it, feel free to make a donation :)
  • NEW - lang folder and files need write permissions (chmod 777) to be able to be administrated via admin

Requirements:

  • PHP 4 or greater
  • MYSQL database
  • Javascript enabled browser

Further Information:

  • Use the Forum for help etc.
  • For custom integration, commercial license etc. please Contact me directly.


Implementation - iframe

The simplest method of including the calendar within your web is to use an "iframe".
This involves nothing more than simply placing the url of the calendar in the "src" attribute of the iframe tag like this:

<iframe width="700px" height="400px" src="/calendar/index.php"></iframe>
Unless you want to get your hands dirty with php code (see below), I suggest that you use this iframe method to include the calendar in your website.

PopUp window

A few years ago this would be a possibly the most common method for showing this sort of information. However, in recent years most browsers block popup windows so it is unlikely that your users will actually ever see the window.
There are many examples of popup window scripts on the internet but I have included an example in case you want to use this method.

<script language="javascript" type="text/javascript">
<!--
function popCalendar(url) {
	calendarWindow=window.open(url,'name','height=200,width=500');
	if (window.focus) {calendarWindow.focus()}
	return false;
}
// -->
</script>

<a href="/calendar/index.php" onclick="return popCalendar('/calendar/index.php')">
see calendar</a>
It is worth noting that, with this particular function, if the user has javascript turned off, the calendar will simply open in the browser.

Implementation - PHP integration

Ideally this is the method your should choose as it completely embeds the calendar in yo.ur page, however it does require a certain amount of php and html knowledge.
To implement the calendar this way you need to do the following things:

  • Include the calendar php file. eg.:
    require_once(ac-includes/cal.inc.php);
    This file will include all the various calendar configuration files which, amongst many other things will define the php constant variables that are then used in the following code snippets.
  • Include the calendar CSS and Javascript files:
    <link rel="stylesheet" href="<?php echo AC_DIR_CSS; ?>avail-calendar.css">
    <script type="text/javascript" src="<?php echo AC_DIR_JS; ?>mootools-core-1.3.2-full-compat-yc.js">
    <script type="text/javascript" src="<?php echo AC_DIR_JS; ?>mootools-cal-public.js">
    
  • Define the basic javascript variables using the built-in variables (note this method will be simplified in the next release):
    var url_ajax_cal = '<?php echo AC_DIR_AJAX; ?>calendar.ajax.php';
    var img_loading_day = '<?php echo AC_DIR_IMAGES; ?>ajax-loader-day.gif';
    var img_loading_month = '<?php echo AC_DIR_IMAGES; ?>ajax-loader-month.gif';	
    var id_item = '<?php echo ID_ITEM; ?>';
    var lang = '<?php echo LANG; ?>';
    var months_to_show = <?php echo AC_NUM_MONTHS; ?>;
    var clickable_past = '<?php echo AC_ACTIVE_PAST_DATES; ?>';
    
  • Show the calendar where you need it in your html code:
    <div id="the_months">
    <?php echo $calendar_months; ?>
    </div>
    
  • Calendar Navigation
    Note - do NOT change the id value of these elements as they are used by the javascript to detect the action required.
    <div id="cal_prev" title="'.$lang["prev_X_months"].'">
      <img src="'.AC_DIR_IMAGES.'icon_prev.gif" class="cal_button">
    </div>
    <div id="cal_next" title="'.$lang["next_X_months"].'">
      <img src="'.AC_DIR_IMAGES.'icon_next.gif" class="cal_button">
    </div>
    
  • Calendar Key and last update date:
    <div id="key_wrapper">
      '.$calendar_states.'
      <div id="footer_data">
      '.$lang["last_update"].': '.get_cal_update_date(ID_ITEM).'
      </div>
    </div>
    
To see a working example of how this all fits together, take a look at the index.php file that is included in the download package.

Finally, for more help, try posting your questions on the Ajax Availability Calenda Forum

Important - PHP 8

There is an issue with the script in PHP 8 which is causing the calendar to not display properly.
Here is a quick fix for existing versions (no need to update):

In ac-includes > common.inc.php and change line 16 (latest version) from this:

//error_reporting(E_ALL ^ E_NOTICE);
to this:
error_reporting(0);

This code turns off PHP error reporting just for the calendar script.

Version 4

I am currently working a completely new version to adapt the code to more modern development techniques.

Follow the project on Github

See demo version 4

icon version 4
New features:
  • Converted into Web Component.
  • No external JavaScript libraries.
  • No images - use modern CSS to show availabililty states.
  • Calendar loaded via JavaScript (no more iFrames).
  • Simple CSS.
  • Responsive:
    • Automatically calculates the number of months to show.
    • The month days adapt to fill the available space.
  • Sinple integration into front-end bookings form.
  • Renovated admin panel with:
    • Possibility to add basic booking details.
    • Interactive customise styling "no code".
    • Language translations stored in the database.
    • Unlimited users and items.
    • Password reminder via email.

Help with installation?

The calendar script is very simple to set up on your server. However, if you prefer, I can install the calendar on your server for you.
Requirements: I will of course also require ftp access to your server. The cost for this service is 40 Euros * (payable via Paypal) however this may need to be adjusted if you have "special" installation requirements.
If you are interested in this option, don't hesitate to contact me via my contact form. I will get back to you as soon as possible.

* Not included in base price: