0% found this document useful (0 votes)
158 views

Fullcalendar Into Phpmakercode

To integrate a calendar generated by PHPmaker with a FullCalendar plugin, the following changes need to be made: 1. Modify the PHPmaker generated code to include the calendar files and check login status. 2. Make changes to the calendar files like setting paths and checking for the config file. 3. Optionally modify FullCalendar.js to load events for the agenda view. 4. Configure options like paths, language, and database settings in the config.php file.

Uploaded by

Sinan Yıldız
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
158 views

Fullcalendar Into Phpmakercode

To integrate a calendar generated by PHPmaker with a FullCalendar plugin, the following changes need to be made: 1. Modify the PHPmaker generated code to include the calendar files and check login status. 2. Make changes to the calendar files like setting paths and checking for the config file. 3. Optionally modify FullCalendar.js to load events for the agenda view. 4. Configure options like paths, language, and database settings in the config.php file.

Uploaded by

Sinan Yıldız
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

How to integrate the calendar in

PHPmaker generated code.


The calendar(PHP/MySQL solution) is based on fullcalendar (jQuery plugin by
Adam Shaw)

To integrate the calendar there are some modifications necessary:

Make changes to phpmaker-generated code


Make changes to the calendar
Make changes to Fullcalendar.js
Set custom configs

The directory in which the calendar is located must be placed next to the directory that PHPmaker
has generated.
In this case that was:
/fullcalendar (the PHPmaker generated code)
/kaltest2 (tha calendar made by Paul Wolbers)

A wish of
The title of every event starts with the user_id. (example: 11-)
If the event is made by the administrator then the title starts with A-
Make changes to phpmaker-generated code
1
[required]
In header.php :

Delete or put comments (<!-- -->) around the next 3 lines.


These lines are for the old (DHTML) calendar.
<!—
<script type="text/javascript" src="calendar/calendar.js"></script>
<script type="text/javascript" src="calendar/lang/calendar-en.js"></script>
<script type="text/javascript" src="calendar/calendar-setup.js"></script>
-->

2
In the new page “blankpage.php” on the following lines:

[required] Around line 249 : (before ‘include_once "footer.php"’)

Insert this code:


include_once "../kaltest2/index.php";

Change ‘kaltest2’ to the correct name of the folder

!! the name ‘blankpage’ should be replaced with another name, otherwise the page will be
overwritten if you add another blankpage

[optional] Around line 12 : (behind ‘<?php include_once "userfn9.php" ?><?php’)

Insert this code:


if(REDIRECT_TO_LOGIN_WHEN_NOT_LOGGEDIN &&
!isset($_SESSION['fullcalendar_status_UserID'])) {
header('location: login.php');
exit;
}

What does that do?


REDIRECT_TO_LOGIN_WHEN_NOT_LOGGEDIN can be true or false and is set in
kaltest2/configs/config.php.
When set to true, the calendar is not visible when someone is not logged in and tries to go to the
blankpage in the browser. Instead the visitor sees the loginpage.
When set to false, the calendar is visible and contains public items.

Inserting this code is optional.


It is meant to redirect the user to the loginpage, when the user is trying to access the calendar (in this
case ‘blankpage.php’) directly in the browser.
When you want to show a public calendar when no user is logged in, it’s not necessary to add these
lines, but I recommend to insert it and then set ‘REDIRECT_TO_LOGIN_WHEN_NOT_LOGGEDIN’ to false in
kaltest2/configs/config.php.
Make changes to the calendar
In this case: ‘kaltest2’

1
[required]
Kaltest2/include/default.inc.php on line 7, set the correct path to the ‘configs’ directory:
if(file_exists('/home/.../public_html/kaltest2/configs/config.php')) {
require_once '/home/.../public_html/kaltest2/configs/config.php';
} else if(file_exists('../configs/config.php')) {
require_once '../configs/config.php';
}

Originally this was not necessary to change, but somehow the config.php can’t be found otherwise.
(I will do some testing on my server and when I find a solution I will let you know)

2
[optional]
In Kaltest2/script/script.js set the option showAgendaButton to true or false to show or hide the
agendabutton in the calendar.
Find the next piece of code and add ‘showAgendaButton: true,’

$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
showAgendaButton: true,

Make changes to Fullcalendar.js

[optional if you’re going to use the agenda view]


In fullcalendar.js in line 744:

$('.fc-content-paul').load(' YOUR_SITE /kaltest2/index.php?action=agenda', function() {


Set custom configs

These config-options can be found in kaltest2/configs/config.php

1
Setting correct paths and constants

/**
* FULLCALENDAR INCLUDES
*/
if($_SERVER["HTTP_HOST"] == 'localhost' OR $_SERVER["HTTP_HOST"] == '127.0.0.1') {
// for local testing on your computer
define('FULLCAL_DIR','/home/.../public_html/paulwolbers/kaltest2');
define('FULLCAL_URL','http://localhost/paulwolbers/kaltest2');
define('EXTERNAL_URL',FULLCAL_URL.'/external');
}else{
// PATH DEFINES HERE
define('FULLCAL_DIR','/home/.../public_html/paulwolbers/kaltest2');
define('FULLCAL_URL','YOUR_SITE/kaltest2');
define('EXTERNAL_URL',FULLCAL_URL.'/external');
}
define('CONFIG_DIR',FULLCAL_DIR.'/configs');
define('EXTERNAL_DIR',FULLCAL_DIR.'/external');
define('INCLUDE_DIR', FULLCAL_DIR.'/include');
define('CLASSES_DIR', FULLCAL_DIR.'/model');

/**
* LANGUAGE
*/
define('LANGUAGE', 'DE'); // supported NL, EN, FR, DE, not complete

/**
* CALENDAR
*/
define('USE_CALENDAR_COLOR_FOR_EVENT', true);
define('REDIRECT_TO_LOGIN_WHEN_NOT_LOGGEDIN', true);

/**
* AGENDAVIEW
*/
define('LIMIT_AMOUNT_AGENDA_DAYS', 15); // amount of days that are shown in
// the agendaview

/**
* DRAG AND DROP
*/
define('SHOW_LOGINNAME_IN_CALENDAR', true); // above drag and drop part
define('LOGINNAME_LABEL', 'Logged in: ');
define('REMOVE_AFTER_DROP', true); // show or hide the checkbox

/**
* DRAG AND DROP TEXTS
*/
define('DRAG_AND_DROP_TEXT', 'Drag and drop from this list');
define('REMOVE_AFTER_DROP_TEXT', 'remove after drop');

/**
* EDIT POPUP CONFIG
*/

define('SHOW_DATE_SELECTION', true);
define('SHOW_YEAR', true);
define('START_YEAR', '-2');
define('END_YEAR', '+2');

define('SIMPLE_TIME_SELECT', false); // simple smarty selectbox or jQuery


// timepicker

define('MINHOUR', 5);
define('MAXHOUR', 20);
define('MINUTE_INTERVAL', 15); // timepicker: interval in minutes

define('SHOW_COLOR_SELECTION', true);

Set database config in kaltest2/configs/config.php

if($_SERVER["HTTP_HOST"] == 'localhost') {
// for local testing on your computer
$str_hostname = 'localhost';
$str_username = 'root';
$str_password = '';
$str_database = 'DBNAME';
} else {
// online settings here
$str_hostname = 'localhost';
$str_username = 'USERNAME';
$str_password = 'PASSWORD';
$str_database = 'DBNAME';
}

Events table:
CREATE TABLE IF NOT EXISTS `events` (
`event_id` int(11) NOT NULL auto_increment,
`title` varchar(255) default NULL,
`date_start` date default NULL,
`time_start` time default NULL,
`date_end` date default NULL,
`time_end` time default NULL,
`allDay` tinyint(1) NOT NULL default '0',
`calendartype` varchar(155) NOT NULL,
`user_id` int(11) NOT NULL,
`color` varchar(10) NOT NULL,
PRIMARY KEY (`event_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

You might also like