Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds

Building a Calender Application in Joomla! using Fabrik

Save for later
  • 180 min read
  • 2010-02-19 00:00:00

article-image

Getting ready

You need a working installation of Joomla! 1.5.x. For exercise purpose, you can install that on your local computer. The web server should have PHP5 installed. Then you need to install Fabrik component. This component is available for free from http://fabrikar.com/download. Download the latest version of the component and install it from Extensions | Install/Uninstall screen in Joomla! administration panel.


Also plan for the application you want to develop. For example, we are developing an event calender. This event calender will contain the following information:


  • Event Category
  • Event Name
  • Venue
  • Start Date & Time
  • End Date & Time
  • Event Description
  • Attached Document
  • Created by


This is a very simple list of information we need. Based on the we will create two database tables: categories and events. The table structure is shown in the following diagram.



building-calender-application-joomla-using-fabrik-img-0

The above table diagrams show that categories table is linked to events table by foreign key category_id. Similarly, we have added user_id field in events table, so that we can link it to jos_users table. Whenever a user creates an event, his or her user ID will be added to this field.


For creating the tables in Joomla! database, connect to that database using phpMyadmin or some other interface, and run the following SQL command:


CREATE TABLE `categories` (
`id` INTEGER AUTO_INCREMENT DEFAULT NULL ,
`name` VARCHAR(200) DEFAULT NULL ,
PRIMARY KEY (`id`)
) COMMENT 'contains categories of events';

CREATE TABLE `events` (
`id` INTEGER AUTO_INCREMENT DEFAULT NULL ,
`category_id` INTEGER DEFAULT NULL ,
`event_name` MEDIUMTEXT DEFAULT NULL ,
`venue` VARCHAR(100) DEFAULT NULL ,
`start` DATETIME DEFAULT NULL ,
`end` DATETIME DEFAULT NULL ,
`description` MEDIUMTEXT DEFAULT NULL ,
`attachment` VARCHAR(250) DEFAULT NULL ,
`user_id` INTEGER DEFAULT NULL ,
PRIMARY KEY (`id`)
) COMMENT 'list of events';

ALTER TABLE `events` ADD FOREIGN KEY (category_id) REFERENCES
`categories` (`id`);


Unlock access to the largest independent learning library in Tech for FREE!
Get unlimited access to 7500+ expert-authored eBooks and video courses covering every tech area you can think of.
Renews at AU $19.99/month. Cancel anytime

Successful execution of the above code block will create two tables and add a foreign key to events table linking it to categories table.


With creation of these two table we are set to create our event calendar application.


How to do it...


Follow the steps below:


  1. From Joomla! Administration panel, click Components | Fabrik |  Connections. That shows existing database connections. By default, connection to Joomla! database is created. You can create  new database connection by clicking New button and filling in the form.
    building-calender-application-joomla-using-fabrik-img-1
  2. Click on Tables link in this screen. That shows existing tables created in Fabrik.
    building-calender-application-joomla-using-fabrik-img-2

  3. In Table screen, click on New button to add a new table. That shows Table: [New] screen.
    building-calender-application-joomla-using-fabrik-img-3

    In Label field type Categories, and in Introduction field, type Event Categories. Then select Yes in Published radio box to the right side. Accept default values for other fields. Then click Access tab. That shows Access Rights.


    building-calender-application-joomla-using-fabrik-img-4

    Accept the default values in Access tab. Now click Data tab. From here you have to configure which data table you want to use.


    building-calender-application-joomla-using-fabrik-img-5

    From Connection drop down list, select site database. Then click on Link to Table drop down list and select categories table. In Order By drop down list, select name. There are some other options in this tab, but those cannot be configured until you save the table. Now click Save button to save the table.