The primary task was to implement the architecture in Joomla! library. Albeit having �clear specs about final outcome, it was not straight forward. The first hurdle was to follow Joomla! style i.e. using JTable for CURD while ensuring that the performance and features are not limited by it. Also as it is Joomla! 1.6 is targetted and there is no clear documentation available, I chose to follow JUser (a core joomla library class) as reference because it parallels JTaxonomyTree and JTaxonomyLeaf two primary classes exposed by Taxonomy framework. This post talks about the library design.
I had some discussion with the mentors as where to place the taxonomy library folder, and finally it was decided to go under libraries/joomla/taxonomy, although it could be moved later to to libraries/taxonomy if it is deemed to be more appropriate.
- The latest code can be checked here :�http://labs.joomla.org/svn/labs/playground/people/garthee/trunk/
- The demo can be tried at (need not parallel the version in SVN) : http://gsoc.theebgar.net/administrator/index.php?option=com_taxonomy
JTaxonomy
At the root JTaxonomy class which extends JClass, exposes the full set of features. It is used in a singleton form and must be invoked as
jimport(‘joomla.taxonomy.taxonomy’);
$taxonomy =&JTaxonomy::getInstance();
This class provides the following set of methods
1. Tree related
&getTreeList($extension = null)
&getTrees($extension = null)
&getTree($id = 0, $options = null)
First returns an array of tree names keyed by tree IDs, second returns an array tree objects keyed by tree IDs, and the last gives tree object for the given tree ID. They are eventually routed through JTaxonomyTree which provides the implmentation for trees.
2. Leaf related
&getLeafList($options = null)
&getLeaves($options = null)
&getLeaf($id = 0, $options = null)
&getLeafHierarchy($tid, $options = null)
The last function serves a important function implemented in a helper class. It builds a complete leaf hierarchy under a given tree.
&getMap()
JTaxonomyTree
JTaxonomyTree extends JClass, and mainly handles the CRUD operations which are routed through its JTable subclass JTabeTaxTree class.

JTaxonomyTree Class

JTableTaxTree Class
JTaxonomyLeaf

JTaxonomyLeaf class

JTableTaxLeaf class
JTaxonomyMap
This is class handles the object – leaf mapping, the fundamental operation of taxonomy frame, through standard methods. The implementation is expected to change with the requirements imposed, which will be actually finalized along with the implementation of com_contentPlus (a content component with taxonomy support). �This class together with JHTMLTaxonomy is expected to provide a complete form support to the integration with any components.

JTaxonomyMap Class

JHTMLTaxonomy JHTML subclass
Summary
Although the feature sets of Taxonomy Library is currently completely determined, it might evolve with the requirements of components and plugins as demanded. Hence it is provided here for reference and feedback only. In the next blog I will discuss the dilemma we had in compromising between performance, standard pattern and generality.
Tags: GSoC, Joomla, PHP, taxonomy
This entry was posted on Friday, June 19th, 2009 at 3:58 am
You can follow any responses to this entry through the RSS 2.0 feed.





