Ministry Details

With Preachit 4.1 it is now possible to access the Preachit core engine and get access to Preachit ministry details from other extensions in Joomla. Here we show you how to hook into the ministry api and list the various functions you can call.

 

Plugging in

 

To plug into the Preachit ministry api you will first need to load the relevant php file into your script. Here is the call you need:

 

require_once(JPATH_SITE.DIRECTORY_SEPARATOR.'components/com_preachit/helpers/info-builder.php');

Once you've loaded in the file you then need to activate the Preachit ministry class:

 

$ministry = new PreachitMinistry($ministry, $config);

In this call the $ministry value can either be the id for the Preachit ministry you want to use or the full database object for the Preachit ministry. The $config value needs to be an array. At the moment we only use 1 key in this array; the 'runplugin' key. This can be set to true or false depending on whether you want plugins to be run on the description field of the ministry.

 

Function list

 

Below is a list of calls that can be made and the details they will return:

 

$ministry->item

Returns the database object for the ministry

 

$ministry->id

Returns the id for the ministry

 

$ministry->name($menuid = 0)

Returns the name of the ministry with a link. If the menuid is set to greater than 0 then this will be set as the menuid in the link.

 

$ministry->nameonly()

Returns the name of the ministry with no link.

 

$ministry->url($menuid = 0)

Returns the link for the ministry. If the menuid is set to greater than 0 then this will be set as the menuid in the link.

 

$ministry->count()

Returns the number of sermons linked to this ministry.

 

$ministry->countseries()

Returns the number of series linked to this ministry.

 

$ministry->image($size, $bd = null, $menuid = 0)

Returns an image for this ministry. The size can be set to 'sm', 'med', 'lrg', 'ori'. Set $fb to 'fb' if you want the function to return the original url for the image. Set $fb to 'url' if you want the function to return the url for the resized image. If $fb is not set then the function will return the image as a complete html image tag wrapped in a link to the relevant details so that you just need to insert it in your page. If the menuid is set to greater than 0 then this will be set as the menuid in the link.

 

$ministry->description()

Returns the description of the ministry.

 

$ministry->access()

Returns the access group set for the ministry.

 

$ministry->extrafields()

Returns the array for any extra fields that have been set up through the extra fields area of the Preachit administrator. The array format puts the alias for each extra field as the key in the array.

Cron Job Starts