Your IP : 10.0.84.116


Current Path : /var/www/www.yekclass.com/public_html/components/com_droptables/views/dbtable/
Upload File :
Current File : /var/www/www.yekclass.com/public_html/components/com_droptables/views/dbtable/view.raw.php

<?php
/**
 * Droptables
 *
 * We developed this code with our hearts and passion.
 * We hope you found it useful, easy to understand and to customize.
 * Otherwise, please feel free to contact us at contact@joomunited.com *
 *
 * @package   Droptables
 * @copyright Copyright (C) 2014 JoomUnited (http://www.joomunited.com). All rights reserved.
 * @copyright Copyright (C) 2014 Damien Barrère (http://www.crac-design.com). All rights reserved.
 * @license   GNU General Public License version 2 or later; http://www.gnu.org/licenses/gpl-2.0.html
 */


defined('_JEXEC') || die;


/**
 * Class DroptablesViewDbtable
 */
class DroptablesViewDbtable extends JViewLegacy
{
    /**
     * State
     *
     * @var mixed
     */
    protected $state;

    /**
     * Display the view
     *
     * @param null|string $tpl The name of the template file to parse; automatically searches through the template paths.
     *
     * @return mixed
     */
    public function display($tpl = null)
    {
        $id_table = JFactory::getApplication()->input->getInt('id_table');
        JModelLegacy::addIncludePath(JPATH_ROOT . '/administrator/components/com_droptables/models/', 'DroptablesModel');
        $model                      = JModelLegacy::getInstance('Dbtable', 'droptablesModel');
        $this->selected_tables      = array();
        $this->availableColumns     = array();
        $this->selected_columns     = array();
        $this->join_rules           = array();
        $this->params               = new stdClass();
        $this->id_table             = $id_table;
        $this->default_ordering_dir = 'asc';
        $modelTable                 = JModelLegacy::getInstance('Table', 'droptablesModel');
        $item                       = $modelTable->getItem($id_table);
        $params                     = $item->params;
        if (empty($params) || !array_key_exists('tables', $params)) {
            $id_table = null;
        }
        if ($id_table) {
            $item                          = $modelTable->getItem($id_table);
            $params                        = $item->params;
            $this->params                  = $params;
            $this->selected_tables         = $params['tables'];
            $columns                       = $model->listMySQLColumns($this->selected_tables);
            $this->availableColumns        = $columns['all_columns'];
            $this->selected_columns        = $params['mysql_columns'];
            $this->sorted_columns          = $columns['sorted_columns'];
            $this->join_rules              = isset($params['join_rules']) ? $params['join_rules'] : array();
            $this->default_ordering_column = $params['default_ordering'];
            $this->default_ordering_dir    = $params['default_ordering_dir'];
            $this->custom_titles           = $params['custom_titles'];
        }
        $this->mysql_tables = $model->listMySQLTables();
        parent::display($tpl);
    }
}