events file format - meshesha/jCal GitHub Wiki

#events file format ##xml format

<?xml version="1.0" encoding="UTF-8"?>
<jcal>
    <event>
        <id>event index</id>
        <name>event name</name>
        <type>event type</type>
        <startdate>event start date</startdate>
        <enddate>event end date<enddate/>
        <starttime>event start time<starttime/>
        <endtime>event end time<endtime/>
        <bgcolor>event background color<bgcolor/>
        <color>event text color<color/>
        <url>event url link<url/>
    </event>
</jcal>

###more than one event

<?xml version="1.0" encoding="UTF-8"?>
<jcal>
    <event>
        <id>1</id>
        <name>event-1</name>
        .
        .
        .
    </event>
    <event>
        <id>2</id>
        <name>event-2</name>
        .
        .
        .
    </event>
        .
        .
        .
</jcal>

##json format

{
"jcal": [
    {
        "id":"event index",
        "name":"event name",
        "type":"event type",
        "startdate":"event start date",
        "enddate":"event end date",
        "starttime":"event start time",
        "endtime":"event end time",
        "bgcolor":"event background color",
        "color":"event text color",
        "url":"event url link"
    }
]}

###more than one event

{
"jcal": [
    {
        "id":"1",
        "name":"event-1",
        .
        .
        .
    },
    {
        "id":"2",
        "name":"event-2",
        .
        .
        .
    },
        .
        .
        .
]}

##xml and json parametrs Description: event index - number which use to Identify each event [1,2,3,...].
event name - the name of the event [text].
event type - (optional)[text].
event start date - the start date of the event.must be in format: YYYY-mm-dd where YYYY-year,
      mm-month, dd-day [2016-11-30].
event end date - (optional) the end date of the event. same format as start date.
event start time - (optional) the start time of the event. in 24 hour format, hh:**mm **where hh-hour, mm-minute [23:30].
event end time - (optional) the end time of the event.same format as the start time.
event background color - (optional) background color of event ['red' or '#ff0000'].
event text color - (optional) text color of event ['blue' or '#0000ff'].
event url link - (optional) in list view mode, when click on the event ,the link will be run ['http://my/link'].

##using ajax and php This plugin use ajax technology and POST type connection.
when you choose to use php and provide url link to php file, the plugin send 'data' with two parametrs: month and year separated with the word 'AND'.

$('#my_calendar_greg_en').jcal({
    .
    .
    url: 'path/to/event.php',
    dataType: 'php',
    .
    .
    .
});

###event.php

 if(isset($_POST["data"])){
     $data = $_POST["data"];
     $data_array = explode("AND",$data);
     $month = $data_array[0];
     $year = $data_array[1];
     .
     //yore code
     .
     echo $your_data; //most be in json format.
 }

The returned (echo) data from php file must be as above json formt. ##using joomla Platform For using joomla platform , it is a same as using above php method , but you don't need to provide url. you need specify phpPlatfrom:'joomla'.

$('#my_calendar_greg_en').jcal({
    .
    .
    phpPlatform:'joomla',
    dataType: 'php',
    .
    .
    .
});

In joomla module, you need to add function in modYourModuleNameHelper class of helper.php file with the name: "getCreateJsonAjax()".

 defined( '_JEXEC' ) or die;

class modYourModuleNameHelper
{
    .
    .
    //yore code
    .
    public static function getCreateJsonAjax(){
        $input  = JFactory::getApplication()->input;
        $data = $input->get('data');
        $data_array = explode("AND",$data);
        $month = $data_array[0];
        $year = $data_array[1];
        .
        //yore code
        .
        return $your_data; //most be in json format.
    }
    .
    .
    //yore code
    .
}

The returned data from getCreateJsonAjax() function must be as above json formt.

⚠️ **GitHub.com Fallback** ⚠️