Location: PHPKode > projects > injooosm > administrator/components/com_injooosm/views/cats/view.html.php
<?php
/**
 * Joomla! 1.5 component injooosm
 *
 * @version $Id: view.html.php 2009-11-22 14:03:00$
 * @author Christian Knorr
 * @package injooosm
 * @subpackage backend
 * @license GNU/GPL
 * @filesource
 *
 *
 */

// no direct access
defined('_JEXEC') or die('Restricted access');


// Import Joomla! libraries
jimport( 'joomla.application.component.view');
/**
 *
 */
class injooosmViewCats extends JView {
    /**
     *
     * @global object $mainframe
     * @global string $option
     * @param object $tpl
     * @return
     */
    function display($tpl = null) {
        global $mainframe, $option;

        if($this->getLayout() == 'form'):
			$this->_displayForm($tpl);
            return;
		endif;

        if($this->getLayout() == 'editform'):
			$this->_displayEditcat($tpl);
            return;
		endif;

	$model =& $this->getModel();

	$order = JRequest::getVar( 'order', 'order', 'post', 'string' );

	$filter_order		= $mainframe->getUserStateFromRequest( $option."filter_order",
		'filter_order',
		'ordering',
		'cmd' );
	$filter_order_Dir	= $mainframe->getUserStateFromRequest( $option."filter_order_Dir",
		'filter_order_Dir',
		'',
		'word' );

	$lists['order']		= $filter_order;
	$lists['order_Dir']	= $filter_order_Dir;

	$rows =& $this->get( 'Data');
	$children = array();
	foreach ($rows as $v ) {
		$pt	= $v->parent;
		$list	= @$children[$pt] ? $children[$pt] : array();
		array_push( $list, $v );
		$children[$pt] = $list;
	}
        $levellimit = 50;
        $list = JHTML::_('menu.treerecurse', 0, '', array(), $children, max( 0, $levellimit-1 ) );
        $list = array_slice($list, $limitstart, $limit);
// var_dump($list);die();

	$total		= & $this->get( 'Total');
        $pagination = & $this->get( 'Pagination' );

        $this->assignRef('lists',	$lists);
        $this->assignRef('pagination',	$pagination);
        $this->assignRef('list',    $list);

        parent::display($tpl);
    }

    /**
     *
     * @global object $mainframe
     * @global string $option
     * @param object $tpl
     */
    function _displayForm($tpl)  {
        global $mainframe, $option;

        $model = $this->getModel();
        $parent = $model->getParent();
        array_unshift($parent, array('id' => 0, "title" => JText::_('OSM_NOTHING')));
        $editor =& JFactory::getEditor();
        $lists['block'] 	= JHTML::_('select.booleanlist',  'publish', 'class="inputbox" size="1"', '' );
        $lists['parent'] 	= JHTML::_('select.genericlist', $parent, 'parent', 'size="1"', 'id', 'title', '');
        $config =& injooosmHelper::getConfig();
        $max_file_size = $config->max_size * 1000;

        $this->assignRef('lists',	$lists);
        $this->assignRef('editor', $editor);
        $this->assignRef('maxsize', $max_file_size);

        parent::display($tpl);
    }

    /**
     *
     * @global object $mainframe
     * @param object $tpl
     */
    function _displayEditcat($tpl)  {
        global $mainframe;

        $editor =& JFactory::getEditor();
        $model =& $this->getModel();
        $parent = $model->getParent();
        array_unshift($parent, array('id' => 0, "title" => JText::_('OSM_NOTHING')));
        $id =& JRequest::getInt( 'id');
        $data = $model->getCat($id);
        $lists['block'] 	= JHTML::_('select.booleanlist',  'publish', 'class="inputbox" size="1"', $data->published );
        $lists['parent'] 	= JHTML::_('select.genericlist', $parent, 'parent', 'size="1"', 'id', 'title', $data->parent);

        $config =& injooosmHelper::getConfig();
        $max_file_size = $config->max_size * 1000;

        $this->assignRef('lists',	$lists);
        $this->assignRef('editor', $editor);
        $this->assignRef('maxsize', $max_file_size);
        $this->assignRef('data', $data);

        parent::display($tpl);
    }
    
}
Return current item: injooosm