/** * Constructor method * * @package MageBridge * @access public * @param null * @return null */ public function __construct() { parent::__construct(); $application = JFactory::getApplication(); $option = JFactory::getApplication()->input->getCmd('option') . '-users'; // Get the pagination request variables $limit = $application->getUserStateFromRequest('global.list.limit', 'limit', JFactory::getConfig()->get('list_limit'), 'int'); $limitstart = $application->getUserStateFromRequest($option . 'limitstart', 'limitstart', 0, 'int'); $this->setState('limit', $limit); $this->setState('limitstart', $limitstart); }
/** * Constructor * * @access public * @subpackage Yireo * @param string $tableAlias * @return null */ public function __construct($tableAlias = null) { // Call the parent constructor $rt = parent::__construct(); // Set the database variables if ($this->_tbl_prefix_auto == true) { $this->_tbl_prefix = $this->_component . 'Table'; } // @todo: Set this in a metadata array $this->_tbl_alias = $tableAlias; $this->_tbl = $this->getTable($tableAlias); if ($this->_tbl) { $this->_tbl_name = $this->_tbl->getTableName(); $this->_tbl_key = $this->_tbl->getKeyName(); } $this->_entity = $tableAlias; $this->_form_name = $tableAlias; // Detect the orderby-default if (empty($this->_orderby_default)) { $this->_orderby_default = $this->_tbl->getDefaultOrderBy(); } if (empty($this->_orderby_title)) { if ($this->_tbl->hasField('title')) { $this->_orderby_title = 'title'; } if ($this->_tbl->hasField('label')) { $this->_orderby_title = 'label'; } if ($this->_tbl->hasField('name')) { $this->_orderby_title = 'name'; } } // Detect checkout if ($this->_tbl->hasField('checked_out')) { $this->_checkout = true; } else { $this->_checkout = false; } // Set the parameters for the frontend if (empty($this->params)) { if ($this->app->isSite() == false) { $this->params = JComponentHelper::getParams($this->_option); } else { $this->params = $this->app->getParams($this->_option); } } // Enable debugging if ($this->params->get('debug', 0) == 1) { $this->_debug = true; } // Determine whether this model is single or not if ($this->_single == null) { $className = get_class($this); if (preg_match('/s$/', $className)) { $this->_single = false; } else { $this->_single = true; } } // Initialize the ID for single records if ($this->isSingular()) { $cid = $this->jinput->get('cid', array(0), '', 'array'); if (!empty($cid) && count($cid) > 0) { $this->setId((int) $cid[0]); } $id = $this->jinput->getInt('id', 0); if (!empty($id) && $id > 0) { $this->setId((int) $id); } // Multiple records } else { // Initialize limiting $this->initLimit(); $this->initLimitstart(); // Initialize ordering $filter_order = $this->getFilter('order', '{tableAlias}.' . $this->_orderby_default, 'string'); $filter_order_Dir = $this->getFilter('order_Dir'); if (!empty($filter_order_Dir)) { $filter_order_Dir = ' ' . strtoupper($filter_order_Dir); } $this->addOrderby($filter_order . $filter_order_Dir); $this->addOrderby('{tableAlias}.' . $this->_orderby_default); } return $rt; }