1. Fabrik 3.8 has been released. As usual, we strongly recommend that you backup your site (using Akeeba) before upgrading. Report any issues in the forums, we will answer promptly.

Application Tutorials - Real Examples

Sep 11, 2015
Application Tutorials - Real Examples
  • For some developers, there is nothing like seeing a real-life application in action to get those creative fabrik juices flowing! On this page is a list of advanced Fabrik applications with tutorials on how some of the advanced parts of the application were accomplished.

    The tutorials on this page assume that you are completely familiar with fabrik concepts like tables/lists, forms, group and elements and know SQL and how fabrik relates to the underlying database. They also assume a basic level of knowledge of php and javascript and css and how to edit and post these files to your joomla/fabrik server.

    With that caveat, here are the tutorials!


    SkyRun Vacation Rentals (top)

    A back-end reservation system for holiday rentals in resorts.
    • The first video should be viewed before viewing any of the following tutorials to understand the business application being shown and see the front-end:
    • coming soon - Tutorial 1 - Modifying table row appearence using row-specifric CSS (easy)
    • coming soon - Tutorial 2 - Using SQL views with fabrik to show summarized data in a table (medium)
    • coming soon - Tutorial 3 - Creating a custom template for your table with buttons (medium)
    • coming soon - Tutorial 4 - Hiding and showing form fields (no coding required)
    • coming soon - Tutorial 5 - Ajax to fill out form fields based on another form fields (medium)
    • coming soon - Tutorial 6 - Using form submission plug-ins to create a simple process/workflow for handling multi-step actions like refunding a credit card payment where you type the amount to refund, then process the form - (hard)

    Customer Management (top)

    A Back-end system for manage customers and a Frontend system for customers information.
    This is a hands-on experience. Still a work in progress. This is my step-by-step tutorial on what i'm currently developing in my company. Please comment or give your thoughts. If you would do differently please feel free to help ... ( send message to nusilmar )

    First of all i'm trying to have a system for backend management and a frontend system for customers get some info.


    Create customer list/form/elements
    1. To begin, let's create a list for customers. Nothing special here, just create a list labeled "Customer" and in the data tab put in the data table name eg "fab_customers". The form, group and base elements are created (no change required, for now).
    2. Now go to elements and create the following elements ( I believe that i don't need to explain step-by-step how to create a simple element, so only if needed i will explain that element) :
      1. Go to Elements and filter by Customers Group
      2. As you can see the base elements are already there, and to avoid them to show in List disable them ( click on the button in Show in List column)
      3. Create the following fields (I'll assume most default settings. May change according to your needs.):
        1. Name ( field plugin )
        2. Address (field plugin)
        3. City ( field plugin)
        4. Postal code ( field plugin)
        5. email (field plugin, may activate a validation for the e-mail)
        6. phone (field plugin)
        7. customer internal code ( field plugin - to be used in connection with the ERP, to fetch pending values, related to unpaid invoices. To be checked later in this tutorial)
        8. geomap (googlemap plugin - to later create a visualization of customers distribution in google map. If you need help on this plugin check the wiki about it or ask in the foruns)
        9. Further fields could be created , ( like VAT number, Country, Payment terms, ...) so please feel free to add your own
      4. Insert some data ( create some customers)
    Create a customer/joomla link table
    1. The purpose of this list / table is to be able to connect joomla users to one or more companies. Since this application can be used by customers, technicians and administrators, it makes sense that there may be multiple employees of a company / client with access to company data they work, using the joomla account to enter, and in the case of technical (support, marketing, sales) can access various companies / clients they have on their purview. I hope this explanation was clear, otherwise correct it or come in contact with me (see link above).
    2. This table/list is going to be used in pre-filters for all the other tables/lists in both the frontend and in the backend, although it could be used only on frontend.
    3. Create a list labeled "User/Customer" and in the data tab put in the data table name eg "fab_usercust". The form, group and base elements are created (no change required, for now).
    4. Now go to elements and create the following elements :
      1. Go to Elements and filter by User/Customer Group
      2. As above disable list View for base fields ( id and date)
      3. Create the following fields :
        1. customer ( database join plugin - Render as Dropdown, connect to fab_customers , value "id" and label "name")
        2. usercustomer ( user plugin - if you wish could set this options : User Data : Name ; Update on edit : Yes )
      4. Insert some data. You could select a company and then start to add joomla users to that company. Attention : Access privileges still apply
    How to add a Pre-filter to filter customer tables that a joomla user may access
    1. What I have currently implemented is to create pre-filters in menu entries for fabrik lists, but can create the same pre-filters for backoffice, although I think the ideal is to always use the menus in frontoffice, even for managers. This way i believe you will get more control on what you do.
    2. To use the pre-filter create a menu entry of fabrik list type, choose the fabrik list to show (as of now the customer list will be the only one that could be used, but as we create new lists, provided they have the customer ID field we will be able to use these instructions).
      1. Go to options and select fabrik list pre-filter (attention : should save first the menu before you access the pre-filter because only after saving the options will be available).
      2. Add a new prefilter with this configuration:
        1. choose in first option “AND”
        2. In Elements choose the one that referred the customer code (which in the existing table is the id field)
        3. In Condition choose IN
        4. In Value put SELECT customer FROM fab_usercust WHERE usercustomer = {$my-> id}
        5. In Type choose Query
        6. In Access choose what applies (can choose Public)
    Create List of Software Versions Installed on Clients
    1. This list is used to proceed with the record of software installed on the client , including billing software for various software houses, where there are several different software (multiple brands and multiple lines) and each line of software that has several versions (with corrections or tax updates). Since this option is very targeted to the area where i work you may take some ideas for your own projects. Then we need to create a list where we will launch the installed versions. Since I intend to create something with this Structure (client, software, line, version, is updated?) we can see that we need some auxiliary tables to help us in creating the list, including customer (existing, if you follow this tutorial) , software, software line and software version.
    2. Although it is probably overkill, I created the following auxiliary lists:
      1. Software House - Where to put the various software houses that work
      2. Software Line - Where to put the various lines of software from those software houses
      3. Versions - Where to put all the versions of the software lines.
    3. Create Software House list/form/elements
      1. Create a list labeled "Software House" and in the data tab put in the data table name eg "fab_softwarehouse". The form, group and base elements are created (no change required, for now).
      2. Now go to elements and create the following elements ( filter by Software House group)
      3. Create the following fields (I'll assume most default settings. May change according to your needs.maintain default fields (id and date)):
        1. Software_House ( field plugin )
        2. Further fields could be created , ( like Address, Country, ...) so please feel free to add your own
      4. Insert some data ( create some Software Houses)
    4. Create Software Line list/form/elements
      1. Create a list labeled "Software Line" and in the data tab put in the data table name eg "fab_softwareline". The form, group and base elements are created (no change required, for now).
      2. Now go to elements and create the following elements ( filter by Software Line group)
      3. Create the following fields (I'll assume most default settings. May change according to your needs.Maintain default fields (id and date)):
        1. Software_Line ( field plugin )
        2. Software_House ( databasejoin plugin, on data tab : render as dropdown, connection site_database, list fab_softwarehouse, Value id, Label Software_House)
      4. Insert some data ( create some Software Line)
    5. Create Software Versions list/form/elements
      1. Create a list labeled "Software Versions" and in the data tab put in the data table name eg "fab_softwareversion". The form, group and base elements are created (no change required, for now).
      2. Now go to elements and create the following elements ( filter by Software Versions group)
      3. Create the following fields (I'll assume most default settings. May change according to your needs. Maintain default fields (id and date)):
        1. Software House ( databasejoin, Render as Dropdown, connect to fab_softwarehouse , value "id" and label "Software House")
        2. Software Line ( cascadingdropdown, on data tab : (process as dropdown box, link site database, list Software Line, id : id, label Software Line), on observe tab : element to observe : Software House, External Key : Software House))
        3. Version ( field plugin)
        4. Is Updated (yesno plugin)
          1. Due to my lack of expertise on Fabrik i still cannot figure how to automaticaly set the last version of a certain software Line as the updated one so what i have to do is : every time a new version is released i need to go to the previous version of that software line and mark NO in the Is Updated field and YES on the latest version. When i or when someone figure out how to do it, this wiki will be updated.
      4. Further fields could be created , so please feel free to add your own
      5. Insert some data ( create some Software Versions)
    6. Create Installed Versions List/form/elements
      1. Create a list labeled "Installed Versions" and in the data tab put in the data table name eg "fab_installedversion". The form, group and base elements are created (no change required, for now).
      2. Now go to elements and create the following elements ( filter by Install Versions group)
      3. Create the following fields (I'll assume most default settings. May change according to your needs. Maintain default fields (id and date)):
        1. Customer ( databasejoin, Render as Dropdown, connect to fab_customers , value "id" and label "Customer")
        2. Software_House ( databasejoin, on data tab : Render as Dropdown, connect to fab_softwarehouse , value "id" and label "Software_House")
        3. Software_Line ( cascadingdropdown , on data tab : (process as dropdown box, link site database, list Software Line, id : id, label Software Line), on observe tab : element to observe : Software House, External Key : Software House))
        4. Version ( cascadingdropdown , on data tab : (process as dropdown box, link site database, list Software Versions, id : id, label Version), on observe tab : element to observe : Software Line, External Key : Software Line))
        5. Is Updated (yesno plugin)
          1. This one is not to be edited, but there is a lack in Fabrik to disable editing on this type of field ( at least i can't find it). This field is updated automaticaly by running a cron job that updates every record on Installed Versions List to the value in Software Versions List
      4. Further fields could be created , so please feel free to add your own
      5. Insert some data ( create some Installed Versions)
    7. Create the Cron Job on Schedule
      1. In order to the Installed Version be updated automaticaly ( it doesn't matter what value you put in {fab_installedversion___is_updated} field , every time a new version is released it would be very time consuming to update every single record in Installed Version List, so the best way is to automaticaly update that field) you have to create a schedule job, so you have to :
        1. Create a new Schedule
        2. Label : Version Update
        3. Every 1 minute ( change this to a realistic value, i've defined to 1 minute but you could set it as you want)
        4. Link : Site database
        5. List : Installed Versions
        6. Plugin : PHP
        7. Script PHP : no Choice
        8. Setup PHP : put this code :
          1. PHP:

            // Get the db object
            $db = JFactory::getDbo();
            // Build the query – Tables names = CASE SENSITIVE
            $query = $db->getQuery(true);
            $query
            -> update('fab_installedversion AS a')
            -> join('LEFT','fab_softwareversion AS b ON a.Version=b.id')
            -> set('a.isupdated = b.isupdated');
            $db->setQuery($query);
            // Run the query
            $found = (int) $db->execute();
             
          2. Check the lists and fields in the code to make sure they match on what you've created
        9. Remember that schedule jobs only run manualy on Schedule-Run or after a view is made on your site ( if i'm wrong correct me)
    Create other tables. (coming soon , and i really mean soon ( not like the other example here ...))
    Since this application is mainly oriented for my area and for my needs ,possibly some concepts are not understood.
    The tables to be developed are:
    1. Services Sheet (registration services performed on the client)
    2. Software Licenses (Registration of software licenses registered on the client (used mainly because of ERP Software))
    3. Contracts (contracts of renewal of software support)
    4. Pending values (indication of the amounts pending payment from the customer)
    Please wait some time, as i'm trying to write the full tutorial ... Will update soon.