Message Details

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

 

Plugging in

 

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

 

$message = new PreachitMessage($study, $config);

In this call the $study value can either be the id for the Preachit message you want to use or the full database object for the Preachit message. The $config value needs to be an array. At the moment we only use 5 keys in this array. First, the 'runplugin' key. This can be set to true or false depending on whether you want plugins to be run on the text of the message. The other four keys allow you to set the height and width of the different players. They are 'audiowidth', 'videowidth', 'audioheight', 'videoheight'.

 

Function list

 

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

 

$message->item

Returns the database object for the message

 

$message->id

Returns the id for the message

 

$message->name($menuid = 0)

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

 

$message->nameonly()

Returns the name of the message with no link.

 

$message->url($menuid = 0)

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

 

$message->date()

Returns the date of the message.

 

$message->rawdate()

Returns the date without timezone adjustment. The date returned will be in GMT timezone.

 

$message->description()

Returns the description of the message with no link.

 

$message->text()

Returns the text of the message with no link.

 

$message->scripture($modify = 0)

Returns the scripture references for the message. If $modify is set to 1 it will only return the reference entered as scripture reference 1 in the form. If it is set to 2 then the call will only return the scripture reference 2 from the form.

 

$message->seriesname($link = 0, $menuid = 0)

Returns the series name. If the $link setting is set to 2 then this will only return the series name. If it is set to 1 or left then the return will include the series name and a link to the series page. If the menuid is set to greater than 0 then this will be set as the menuid in the link.

 

$message->partno()

Returns a numerical position for this message in a series that it is linked to.

 

$message->teachername($link = 0, $menuid = 0)

Returns the teacher name. If the $link setting is set to 2 then this will only return the teacher name. If it is set to 1 or left then the return will include the teacher name and a link to the teacher page. If the menuid is set to greater than 0 then this will be set as the menuid in the link.

 

$message->ministryname($link = 0, $menuid = 0)

Returns the ministry name. If the $link setting is set to 2 then this will only return the ministry name. If it is set to 1 or left then the return will include the ministry name and a link to the series page. If the menuid is set to greater than 0 then this will be set as the menuid in the link.

 

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

Returns an image for this message. The type can be set to 'message', 'teacher', 'series', 'ministry'. The size can be set to 'sm', 'med', 'lrg', 'ori'. This allows you to call an image attributed to the message or teacher, series or ministry that the message is linked to. 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.

 

$message->duration()

Returns the duration of the message.

 

$message->listen($menuid = 0)

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

 

$message->watch($menuid = 0)

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

 

$message->read($menuid = 0)

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

 

$message->notes()

Returns the link to the notes file for the message.

 

$message->slides()

Returns the link to the slides file for the message.

 

$message->downloadaudio()

Returns the link to download the audio for the message.

 

$message->downloadvideo()

Returns the link to download the video for the message.

 

$message->audiourl()

Returns the direct url for the audio file.

 

$message->videourl()

Returns the direct url for the video file.

 

$message->notesurl()

Returns the direct url for the notes file.

 

$message->slidesurl()

Returns the direct url for the slides file.

 

$message->purchaseaudio()

Returns the link to purchase the audio as set in the message form.

 

$message->purchasevideo()

Returns the link to purchase the video as set in the message form.

 

$message->amlink($menuid = 0)

Returns the link to as associated media page for this message if the message is linked to another message in the message form. If the menuid is set to greater than 0 then this will be set as the menuid in the link.

 

$message->audiosize()

Returns the file size in megabytes for the audio file.

 

$message->altaudiosize()

Returns the file size in megabytes for the alternative download audio file.

 

$message->videosize()

Returns the file size in megabytes for the video file.

 

$message->altvideosize()

Returns the file size in megabytes for the alternative video file.

 

$message->notessize()

Returns the file size in megabytes for the notes file.

 

$message->slidessize()

Returns the file size in megabytes for the slides file.

 

$message->audioprice()

Returns the price entered for audio file in the message form.

 

$message->videoprice()

Returns the price entered for video file in the message form.

 

$message->audioplayer($width = null, $height = null)

Returns the audio player object. This contains two entries. Under the key ->code you will find the html for the player. Under the key ->script you will find the url for a javascript file to load if needed.

 

$message->videoplayer($width = null, $height = null)

Returns the video player object. This contains two entries. Under the key ->code you will find the html for the player. Under the key ->script you will find the url for a javascript file to load if needed.

 

$message->vclip1($width = null, $height = null)

Returns the object for the first video clip entered in the message form. This contains two entries. Under the key ->code you will find the html for the player. Under the key ->script you will find the url for a javascript file to load if needed.

 

$message->vclip2($width = null, $height = null)

Returns the object for the second video clip entered in the message form. This contains two entries. Under the key ->code you will find the html for the player. Under the key ->script you will find the url for a javascript file to load if needed.

 

$message->vclip3($width = null, $height = null)

Returns the object for the third video clip entered in the message form. This contains two entries. Under the key ->code you will find the html for the player. Under the key ->script you will find the url for a javascript file to load if needed.

 

$message->edit()

Returns the link to edit the message.

 

$message->hits()

Returns the number of hits for the message.

 

$message->downloads()

Returns the number of downloads for the message.

 

$message->tags()

Returns a text string of tags and links for the message.

 

$message->share()

Returns the share code for this message. This combines the information for the message with the share options set up in the share area of the Preachit administrator.

 

$message->access()

Returns the access values set for the Preachit message. This is in a object format and returns the value set for the message as well as any ministry or series it is linked with.

 

$message->commentno()

Returns the number of comments that have been left through the chosen comment engine for this message.

 

$message->comment()

Returns the html for the comment engine to be displayed with this message.

 

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