Template Class

With Preachit 4.1 we've put together a template class that includes a lot of the features that we've put into our templates. This makes these functions available to those who want to create their own templates. Here we show you how to hook into the template api and list the various functions you can call.

 

Plugging in

 

To plug into the Preachit template 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/template.php');

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

 

$helper = new Preachittemplate();

Function list

 

$helper->params

This is the template params object.

 

$helper->Mparams

This is the menu id params object.

 

$helper->view

This is the current view being seen.

 

$helper->getbookarray()

This function returns an array of the Bible books used in Preachit. For each row of the array there is a value key which holds the id and a text key which holds the name.

 

$helper->getbooklist($filter)

This is a function that can be used from the message list view. It will return a drop down select list of books which can be used for filtering the sermons. When you make the call use $this->filter for the filter value.

 

$helper->getteacherarray()

This function returns an array of the teachers used in Preachit. For each row of the array there is a value key which holds the id and a text key which holds the name.

 

$helper->getteacherlist($filter)

This is a function that can be used from the message list view. It will return a drop down select list of teachers which can be used for filtering the sermons. When you make the call use $this->filter for the filter value.

 

helper->getseriesarray()

This function returns an array of the series used in Preachit. For each row of the array there is a value key which holds the id and a text key which holds the name.

 

$helper->getserieslist($filter)

This is a function that can be used from the message list view. It will return a drop down select list of series which can be used for filtering the sermons. When you make the call use $this->filter for the filter value.

 

helper->getministryarray()

This function returns an array of the ministries used in Preachit. For each row of the array there is a value key which holds the id and a text key which holds the name.

 

$helper->getministrylist($filter)

This is a function that can be used from the message list view. It will return a drop down select list of ministries which can be used for filtering the sermons. When you make the call use $this->filter for the filter value.

 

$helper->getyeararray()

This function returns an array of years or months (depending on the template setting for dates) which have sermons preached in them. For each row of the array there is a value key which holds the id and a text key which holds the name.

 

$helper->getyearlist($filter)

This is a function that can be used from the message list view. It will return a drop down select list of dates which can be used for filtering the sermons. When you make the call use $this->filter for the filter value.

 

$helper->gettagarray()

This function returns an array of tags which have sermons attached to them. For each row of the array there is a value key which holds the id and a text key which holds the name.

 

$helper->gettaglist($filter)

This is a function that can be used from the message list view. It will return a drop down select list of tags which can be used for filtering the sermons. When you make the call use $this->filter for the filter value.

 

$helper->getFilterresetbtn()

This is a function that can be used to get the html for a button that will reset the filters and refresh the message list page. When the function is activated it will load in a js file needed for the reset and refresh.

 

$helper->getalphalist($table, $column)

This function returns a string list for sorting the series or the teachers in the series list and in the teacher list respectively by the starting letter. The $table value needs to be the database table - '#__piseries' or '#__piteachers' - and the $column needs to be database column that you want to return the alphabetical list for - 'name' for series or 'lastname' for teacher give the best results.

 

$helper->gettagalphalist()

This function returns a string list for sorting the tag list by letter. It will give a set of links that can be used to show the tags that begin with the letter in the taglist.

 

$helper->getchapterlist($book)

This function returns a string containing links for sorting the message list by chapter in a particular book. The $book value needs to be set to the id of the book record that is being sorted by.

 

$helper->getmonthlist($year)

This function returns a string containing links for sorting the message list by months in a particular year. The $year value needs to be set to the current year being viewed.

 

$helper->getsearchbox($text, $label= null, $value = null, $button = false, $button_text = null, $button_image = null, $button_pos = null)

This is a function that can be used to get the html for a search box. If displayed within a form that has the action pointing to a Preachit message list then the entry will be used by Preachit to filter the list. $text is the placeholder text. $label is the label for the search box. $value is the current search value that can be pre-filled in the form. $button is a boolean to determine if you want a search button or not. $button_text is a string for the text in the button. $button_image is the url for an image in the button. If no button image is submitted then the button will be return with an span within it with the class icon-search so that you can use css to attach an icon to the button. $button_pos takes a string - either 'top', 'bottom', 'left' or 'right' to determine where the button is in relation to the search box.

 

$helper->getsearchPhraseSelectors()

This function returns the html for three search type selectors. They are 'All', 'Any', "Exact' and will determine how Preachit uses the search phrase to search the database. By default Preachit uses 'All' to determine it's search so if these selectors aren't used that will be the type of search Preachit uses.

 

$helper->getpodcastlinks()

This function returns a string containing links to the podcasts set un the 'podcastlink' parameter in the template parameters.

 

$helper->getyearlink($year, $type)

This function returns the link for the year previous or after the current year that is being used for the filter in the message list. $year needs to be the current year. $type can either be 'previous' or 'next'.

 

$helper->getbooklink($book, $type)

This function returns the link for the book previous or after the current book that is being used for the filter in the message list. $book needs to be the current book id. $type can either be 'previous' or 'next'.

 

$helper->getnavbar($listview)

This function returns the html for the nav bar as used in the Chameleon template. The $listview value can be filled with $this->listview which should be defined in all Preachit views.

 

$helper->checkteacher($item)

This function returns true or false and checks to see if the $message item object has a value set for the teacher. This can be used to reduce the amount of calls on the database as a check function on the item before calling a function from one of the Preachit api's.

 

$helper->checkseries($item)

This function returns true or false and checks to see if the $message item object has a value set for the series. This can be used to reduce the amount of calls on the database as a check function on the item before calling a function from one of the Preachit api's.

 

$helper->checkministry($item)

This function returns true or false and checks to see if the $message or $series item object has a value set for the ministry. This can be used to reduce the amount of calls on the database as a check function on the item before calling a function from one of the Preachit api's.

 

$helper->checkwatch($item)

This function returns true or false and checks to see if the $message item object has a value set for the video entry. This can be used to reduce the amount of calls on the database as a check function on the item before calling a function from one of the Preachit api's.

 

$helper->checklisten($item)

This function returns true or false and checks to see if the $message item object has a value set for the audio entry. This can be used to reduce the amount of calls on the database as a check function on the item before calling a function from one of the Preachit api's.

 

$helper->checkdownloadvid($item)

This function returns true or false and checks to see if the $message item object has a value set to download the video. This can be used to reduce the amount of calls on the database as a check function on the item before calling a function from one of the Preachit api's.

 

$helper->checkdownloadaud($item)

This function returns true or false and checks to see if the $message item object has a value set to download the audio. This can be used to reduce the amount of calls on the database as a check function on the item before calling a function from one of the Preachit api's.

 

$helper->checkread($item)

This function returns true or false and checks to see if the $message item object has a value set for the study text entry. This can be used to reduce the amount of calls on the database as a check function on the item before calling a function from one of the Preachit api's.

 

$helper->checknotes($item)

This function returns true or false and checks to see if the $message item object has a value set for the notes file. This can be used to reduce the amount of calls on the database as a check function on the item before calling a function from one of the Preachit api's.

 

$helper->checkslides($item)

This function returns true or false and checks to see if the $message item object has a value set for the slides file. This can be used to reduce the amount of calls on the database as a check function on the item before calling a function from one of the Preachit api's.

 

$helper->checkduration($item)

This function returns true or false and checks to see if the $message item object has a value set for the duration. This can be used to reduce the amount of calls on the database as a check function on the item before calling a function from one of the Preachit api's.

 

$helper->checkscripture($item)

This function returns true or false and checks to see if the $message item object has a value set for the scripture. This can be used to reduce the amount of calls on the database as a check function on the item before calling a function from one of the Preachit api's.

 

$helper->checkcomments($item)

This function returns true or false and checks to see if the $message, $series, $teacher or $ministry item object has a value set for the comments. This can be used to reduce the amount of calls on the database as a check function on the item before calling a function from one of the Preachit api's.

 

$helper->checkdescription($item)

This function returns true or false and checks to see if the $message item object has a value set for the description. This can be used to reduce the amount of calls on the database as a check function on the item before calling a function from one of the Preachit api's.

 

$helper->checktags($item)

This function returns true or false and checks to see if the $message item object has a value set for the tags. This can be used to reduce the amount of calls on the database as a check function on the item before calling a function from one of the Preachit api's.

 

$helper->checkpartno($item)

This function returns true or false and checks to see if the $message item object has a value set for the part number. This can be used to reduce the amount of calls on the database as a check function on the item before calling a function from one of the Preachit api's.

 

$helper->checkedit($item)

This function returns true or false and checks to see if the $message item object has a value set for the edit link. This can be used to reduce the amount of calls on the database as a check function on the item before calling a function from one of the Preachit api's.

 

$helper->checkrole($item)

This function returns true or false and checks to see if the $teacher item object has a value set for the teacher role. This can be used to reduce the amount of calls on the database as a check function on the item before calling a function from one of the Preachit api's.

 

$helper->checkweb($item)

This function returns true or false and checks to see if the $teacher item object has a value set for the teacher's website. This can be used to reduce the amount of calls on the database as a check function on the item before calling a function from one of the Preachit api's.

 

$helper->checkfb($item)

This function returns true or false and checks to see if the $teacher item object has a value set for the teacher's Facebook page. This can be used to reduce the amount of calls on the database as a check function on the item before calling a function from one of the Preachit api's.

 

$helper->checktwit($item)

This function returns true or false and checks to see if the $teacher item object has a value set for the teachers twitter page. This can be used to reduce the amount of calls on the database as a check function on the item before calling a function from one of the Preachit api's.

 

$helper->checktitle($item)

This function returns true or false and checks to see if the $teacher item object has a value set for the teacher's title. This can be used to reduce the amount of calls on the database as a check function on the item before calling a function from one of the Preachit api's.

 

$helper->checkemail($item)

This function returns true or false and checks to see if the $teacher item object has a value set for the teacher's email. This can be used to reduce the amount of calls on the database as a check function on the item before calling a function from one of the Preachit api's.

Cron Job Starts