internal_api

This plugin is designed to be a tool for non-Jomres Component Developers to help them interact with Jomres.
 
At the time of writing, this plugin is designed to make it easy to pull the property list and property details pages through a few lines of code.
 
Let's say that you are a Joomla developer and you want to pull some pages from Jomres. This a relatively straightforward thing to do, if you're familiar with Jomres, but what if you're not?
 
Enter the Internal API plugin! It does some magic so you don't have to.
 
The code
 
Ok, hypothetically speaking, you're a developer with your own component. Now, you know a property uid and you want to display Jomres' property details page without having to figure out Jomres to do it.
 
 
First, you'll need to install the alt_init plugin, then the internal_api plugin. Once that's done, you're ready to use the following lines of code :
 
require_once(JPATH_BASE.DS.'jomres'.DS.'core-plugins'.DS.'internal_api'.DS.'internal_api.php');
$arguments = array();
$arguments['property_uid'] = 1;
$property_details = internal_api::get("viewproperty",$arguments);
 
echo $property_details;
 
Naturally you'd replace the 1 of the property uid with your own code.
 
That's it. That's all you need to do to import the property details page into your own application.
 
 
Let's look at an everso slightly more complicated example, the property list. Again, you know the property uids you want to show, so how would you do it?
 
require_once(JPATH_BASE.DS.'jomres'.DS.'core-plugins'.DS.'internal_api'.DS.'internal_api.php');
$arguments = array();
$arguments['property_uids'] = array(1,2,3);
$arguments['showheaders'] = true;
$arguments['jomsearch_sortby'] = 2;
$property_list = internal_api::get("listproperties",$arguments);
 
echo $property_list;
 
This is a little bit more complicated because you have a couple of options that we didn't see in the previous example, the showheaders option, and the jomsearch_sortby option.
 
Showheaders should be pretty self explanatory, it defines whether or not the calling script should show the headers. Unless you've got a good reason to set this to false, we advise you to leave it set to true, because with it set to false some crucial javascript may be missing from the page.
 
The jomsearch_sortby argument refers to the options that are set by the Sort Order dropdown in the property list. In the example above we've set it to 2, which means to sort by property name. If you'd like to see the other sort options, open j01009a_filterproperties.class.php in your favourite editor and see the available options.
 
Note : The sortby option may produce seemingly misleading property lists if any of the property uids in the list are configured to be featured properties.This is because the 010009 scripts will re-order the results based on whether or not properties are considered featured. Featured properties are bumped to the top of the list, regardless of the sort order chosen.
 
Note : Any links in the pages passed back will resolve to the Jomres component, meaning if a user clicks on a link they'll be taken from your component to the Jomres component.
 
 
 
 
This document is copyright Vince Wooll/Woollyinwales IT, 2011. All rights reserved.