Teacher Details

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

 

Plugging in

 

To plug into the Preachit teacher 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 teacher class:

 

$teacher = new PreachitTeacher($teacher, $config);

In this call the $teacher value can either be the id for the Preachit teacher you want to use or the full database object for the Preachit teacher. 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 teacher.

 

Function list

 

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

 

$teacher->item

Returns the database object for the teacher

 

$teacher->id

Returns the id for the teacher

 

$teacher->name($menuid = 0)

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

 

$teacher->nameonly()

Returns the name of the teacher with no link.

 

$teacher->url($menuid = 0)

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

 

$teacher->count()

Returns the number of sermons linked to this teacher.

 

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

Returns an image for this teacher. 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.

 

$teacher->description()

Returns the description of the teacher.

 

$teacher->edit()

Returns the edit link for the teacher.

 

$teacher-role()

Returns the role entered for the teacher.

 

$teacher->email()

Returns a link to the email address for the teacher.

 

$teacher->website()

Returns a link to the website for the teacher.

 

$teacher->facebook()

Returns a link to the Facebook page for the teacher.

 

$teacher->twitter()

Returns a link to the twitter page for the teacher.

 

$teacher->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