Developer guide

The developer's guide provides technical information, suggestions and answers of frequently asked questions about the gamification platform. If you would like to gamify your Joomla! application, you should use Gamification API, Joomla plugin events and observer events.

How to extend Gamification platform?

Joomla provides an excellent opportunity for developers and other third parties to extend the capabilities of the CMS through a variety of extensions.

You can extend the system developing Components, Modules or Plug-ins.

If you are new in Joomla, you can start from Developer Documentation to learn more about options to extend its capabilities.

What is Gamification API?

This is a library that comes with the platform and you should use it to interact with the platform.

You will find a documentation about Gamification API on the ITPrism APIs site.

Plugin Events

Information about all plug-in events provided by the gamification platform. You will be able to use them to extend your application, developing own plug-ins.

 

Observer Events

Information about all observer events provided by the gamification library. You will be able to use them to do observable managers that will process data when an action occurs in the system.

You should use JObserverMapper::addObserverClassToClass to assign observer to observable manager. You can use the plugin System - Gamification as example about how to do it.

When you create an observer, you should extend abstract observers that you will find in that folder.

libraries/Gamification/Observer

Example

Assign observer Leveling to user points manager. When system increase or decreased points, the events in the observer Leveling will be triggered.

JObserverMapper::addObserverClassToClass('Gamification\\Observer\\User\\Leveling', 'Gamification\\User\\Points\\PointsManager', $options);
 

onBeforePointsIncrease

Description

This event will be invoked before system increase user points.

Parameters

context - The context of the content being passed to the manager (e.g. com_user.registration). Use this to check whether you are in the desired context for the object.

value - points number

&points - reference to user points object that will be used to store the new value (Gamification\User\Points\Points).

&options - reference to an object that provides additional options.

Return Value

This event does not return any value or object.

Example

Gamification\User\Points\PointsManager

 

onAfterPointsIncrease

Description

This event will be invoked after system increase user points.

Parameters

context - The context of the content being passed to the manager (e.g. com_user.registration). Use this to check whether you are in the desired context for the object.

value - points number

&points - reference to user points object that will be used to store the new value (Gamification\User\Points\Points).

&options - reference to an object that provides additional options.

Return Value

This event does not return any value or object.

Example

Gamification\User\Points\PointsManager

 

onBeforePointsDecrease

Description

This event will be invoked before system decrease user points.

Parameters

context - The context of the content being passed to the manager (e.g. com_user.registration). Use this to check whether you are in the desired context for the object.

value - points number

&points - reference to user points object that will be used to store the new value (Gamification\User\Points\Points).

&options - reference to an object that provides additional options.

Return Value

This event does not return any value or object.

Example

Gamification\User\Points\PointsManager

 

onAfterPointsDecrease

Description

This event will be invoked after system decrease user points.

Parameters

context - The context of the content being passed to the manager (e.g. com_user.registration). Use this to check whether you are in the desired context for the object.

value - points number

&points - reference to user points object that will be used to store the new value (Gamification\User\Points\Points).

&options - reference to an object that provides additional options.

Return Value

This event does not return any value or object.

Example

Gamification\User\Points\PointsManager

 

onBeforeAccomplishAchievement

Description

This event will be invoked before user accomplish an achievement.

Parameters

context - The context of the content being passed to the manager (e.g. com_user.registration). Use this to check whether you are in the desired context for the object.

&achievement - reference to user achievement object that will be used to store it (Gamification\User\Achievement\Achievement).

&options - reference to an object that provides additional options.

Return Value

This event does not return any value or object.

Example

Gamification\User\Achievement\AchievementManager

 

onAfterAccomplishAchievement

Description

This event will be invoked after user accomplish an achievement.

Parameters

context - The context of the content being passed to the manager (e.g. com_user.registration). Use this to check whether you are in the desired context for the object.

&achievement - reference to user achievement object that will be used to store it (Gamification\User\Achievement\Achievement).

&options - reference to an object that provides additional options.

Return Value

This event does not return any value or object.

Example

Gamification\User\Achievement\AchievementManager

 

onBeforeGiveBadge

Description

This event will be invoked before system give a badge.

Parameters

context - The context of the content being passed to the manager (e.g. com_user.registration). Use this to check whether you are in the desired context for the object.

&badge - reference to user badge object that will be used to store it (Gamification\User\Badge\Badge).

&options - reference to an object that provides additional options.

Return Value

This event does not return any value or object.

Example

Gamification\User\Badge\BadgeManager

 

onAfterGiveBadge

Description

This event will be invoked before system give a badge.

Parameters

context - The context of the content being passed to the manager (e.g. com_user.registration). Use this to check whether you are in the desired context for the object.

&badge - reference to user badge object that will be used to store it (Gamification\User\Badge\Badge).

&options - reference to an object that provides additional options.

Return Value

This event does not return any value or object.

Example

Gamification\User\Badge\BadgeManager

 

onBeforeLevelUp

Description

This event will be invoked before user level up.

Parameters

context - the context of the content being passed to the manager (e.g. com_user.registration). Use this to check whether you are in the desired context for the object.

&level - reference to user level object that will be used to store it (Gamification\User\Level\Level).

&options - reference to an object that provides additional options.

Return Value

This event does not return any value or object.

Example

Gamification\User\Level\LevelManager

 

onAfterLevelUp

Description

This event will be invoked after user level up.

Parameters

context - the context of the content being passed to the manager (e.g. com_user.registration). Use this to check whether you are in the desired context for the object.

&level - reference to user level object that will be used to store it (Gamification\User\Level\Level).

&options - reference to an object that provides additional options.

Return Value

This event does not return any value or object.

Example

Gamification\User\Level\LevelManager

 

onBeforeGiveRank

Description

This event will be invoked before user accomplish a higher rank.

Parameters

context - The context of the content being passed to the manager (e.g. com_user.registration). Use this to check whether you are in the desired context for the object.

&rank - reference to user rank object that will be used to store it (Gamification\User\Rank\Rank).

&options - reference to an object that provides additional options.

Return Value

This event does not return any value or object.

Example

Gamification\User\Rank\RankManager

 

onAfterGiveRank

Description

This event will be invoked after user accomplish a higher rank.

Parameters

context - The context of the content being passed to the manager (e.g. com_user.registration). Use this to check whether you are in the desired context for the object.

&rank - reference to user rank object that will be used to store it (Gamification\User\Rank\Rank).

&options - reference to an object that provides additional options.

Return Value

This event does not return any value or object.

Example

Gamification\User\Rank\RankManager

 

onBeforeGiveReward

Description

This event will be invoked before system gives reward to a user.

Parameters

context - The context of the content being passed to the manager (e.g. com_user.registration). Use this to check whether you are in the desired context for the object.

&reward - reference to user reward object that will be used to store it (Gamification\User\Reward\Reward).

&options - reference to an object that provides additional options.

Return Value

This event does not return any value or object.

Example

Gamification\User\Reward\RewardManager

 

onAfterGiveReward

Description

This event will be invoked after system gives reward to a user.

Parameters

context - The context of the content being passed to the manager (e.g. com_user.registration). Use this to check whether you are in the desired context for the object.

&reward - reference to user reward object that will be used to store it (Gamification\User\Reward\Reward).

&options - reference to an object that provides additional options.

Return Value

This event does not return any value or object.

Example

Gamification\User\Reward\RewardManager

How to debug the system and payment plug-ins?

If there is a problem with your system and you would like to find more information about the error, you have to debug your system. That will give you more information about the problem.

  1. Go to "System" -> "Global Configuration" -> "System" -> "Debug Settings".
  2. Set to "Yes" the option "Debug System".
  3. Now go to tab "Server" and set option "Error Reporting" to maximum.

Now, the system should display information about the error.

You can also check log files in folder "/logs" or the log file "error_log" in your main folder.

How to change PHP version on your hosting?

You will find a tool in your hosting control panel, that will give you an option to switch your PHP version to higher.

Here you are more information.

How to change PHP version on shared servers?

PHP version change

How to change your PHP version in CPanel?

How to edit views of the extension?

If you would like to add elements or to edit the HTML code of some pages, you have to override the component views. The system provides an easy way to do that. You have to make a copy of a view in your template folder and you have to edit it.
Here you are more information about how to do it.

How to customize styles for a component page and modules?

If you would like to write styles for some elements or modules to fine-tune the appearance of your site, you should use class suffix options.

You will find more information about that feature on the following pages.

How to override the styles of the component?

Gamification platform includes CSS file with some styles. If you would like to edit these styles, you should override the file.

The file is "media/com_gamification/css/frontend.style.css".

To override it, you have to make a new one in a folder "css/com_gamification" in your template.

For example, you have to paste the file in that folder.

templates/my_template/css/com_gamification/frontend.style.css

So, the system will load the new styles instead old ones.

The styles of the components are included in "components/com_gamification/gamification.php"

You will find more information about that Joomla! feature on the following pages.

How to include missed Twitter Bootstrap styles and components?

Some templates do not provide a full set of Twitter Bootstrap styles and JavaScript components. That makes your pages to look badly.

There are several solutions:

  • You can include missed styles and components in your template code manually.
  • You can find a template that provides many of the standard Bootstrap elements. If you would like, you can try the templates developed by YouJoomla.
  • You can hire a designer to fix your template or to do a template for your needs. You can do it on sites for freelancers like Freelancer.com.

How to disable strict errors?

If you get error message like this "Strict Standards: Declaration of ..... should be compatible with ...." you should change the error reporting option.

There are two solutions:

  • To change Joomla! option

Go to System -> Global Configuration -> Server (Tab). Select other option for "Error Reporting".

  • To change server options

Check this out - PHP 5 disable strict standards error

How to contribute code to the platform?

If you would like to contribute a code (fix an issue or add new feature), you should send pull request to the distribution of Gamification Platform.

  1. You should fork the repository and clone "develop" branch on your PC.
  2. Install distribution just like do with Joomla.
  3. Create a branch, write your code and send pull request to the branch "develop".

Here you are additional information about how to contribute and create pull request on GitHub.

 

Share this post

Submit to DeliciousSubmit to DiggSubmit to FacebookSubmit to Google PlusSubmit to StumbleuponSubmit to TechnoratiSubmit to TwitterSubmit to LinkedIn

Free Subscription

You can get the latest publication via RSS, Twitter or Facebook. And I can also deliver last news to you for free via Email:

RSS subscription Find us on Facebook Google+ page Follow me