<?php
/**
 * @name        Social Pin Board
 * @version	1.0: view.php$
 * @since       Joomla 1.5&1.6&1.7
 * @package	apptha
 * @subpackage	com_socialpinboard
 * @author      Contus Support
 * @copyright   Copyright (C) 2011 powered by Apptha
 * @license     GNU/GPL http://www.gnu.org/copyleft/gpl.html
 */

// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport( 'joomla.application.component.view');
class wishlogueViewsubcatalogues extends WishlogueView
{
    protected $canDo;
    function display($tpl=NULL)
    {
        require_once JPATH_COMPONENT . '/helpers/wishlogue.php';
        $this->canDo = WishlogueHelper::getActions();
        if(JRequest::getVar('task')=='edit' )
        {
            JToolBarHelper::title('All Catalogues'.': [<small>Edit</small>]','category.png');
            JToolBarHelper::save();
            JToolBarHelper::cancel();

            $model = $this->getModel();

            $id=JRequest::getVar('cid');

            $editsubcatalogue = $model->editsubcatalogue($id[0]);
            $this->assignRef('editsubcatalogue', $editsubcatalogue);

            $getcatalogues = $model->getcatalogues();
            $this->assignRef('getcatalogues', $getcatalogues);

            parent::display();
        }

        if(JRequest::getVar('task')=='add' )
        {
            JToolBarHelper::title('All Catalogues'.': [<small>Add</small>]','category.png');
            JToolBarHelper::save();
            JToolBarHelper::cancel();

            $model = $this->getModel();

//            $pinCategory = $model->getNewcategory();
//            $this->assignRef('pinCategory', $pinCategory);

            $getcatalogues = $model->getcatalogues();
            $this->assignRef('getcatalogues', $getcatalogues);

            parent::display();
        }

        if(JRequest::getVar('task')=='' )
        {
            JToolBarHelper::title('All Catalogues', 'category.png');
            if ($this->canDo->get('core.create')) {
				JToolBarHelper::addNew();
            }
            JToolBarHelper::editList();
            if ($this->canDo->get('core.edit')) {
				JToolBarHelper::publishList();
            }
            JToolBarHelper::unpublishList();
			JToolBarHelper::trash();

            $model = $this->getModel('subcatalogues');
            $subcatalogues = $model->getsubcatalogues();
            //echo '<pre>';print_r($subcatalogues); die;
            $this->assignRef('subcatalogues', $subcatalogues);
            parent::display();
        }

        if ($this->canDo->get('core.admin'))
		{
			JToolBarHelper::divider();
			JToolBarHelper::preferences('com_wishlogue');
        }
    }
}
?>
