/** * Constructor * * For php4 compatability we must not use the __constructor as a constructor for plugins * because func_get_args ( void ) returns a copy of all passed arguments NOT references. * This causes problems with cross-referencing necessary for the observer design pattern. * * @param object $subject The object to observe * @param array $config An array that holds the plugin configuration * @since 1.5 */ function __construct(&$subject, $config) { parent::__construct($subject, $config); $language = JFactory::getLanguage(); $language->load('plg_citruscart_' . $this->_element, JPATH_ADMINISTRATOR, 'en-GB', true); $language->load('plg_citruscart_' . $this->_element, JPATH_ADMINISTRATOR, null, true); }
/** * Override parent::_getState() to do the filtering * * @return object */ function _getState() { $app = JFactory::getApplication(); $model = $this->_getModel('carts'); $ns = $this->_getNamespace(); $state = parent::_getState(); // get the basic state values from the parent method $state['filter_name'] = $app->getUserStateFromRequest($ns . 'name', 'filter_name', '', ''); $state = $this->_handleRangePresets($state); foreach ($state as $key => $value) { $model->setState($key, $value); } return $state; }
/** * Override parent::_getState() to do the filtering * * @return object */ function _getState() { $app = JFactory::getApplication(); $model = $this->_getModel($this->get('default_model')); $ns = $this->_getNamespace(); $state = parent::_getState(); // get the basic state values from the parent method // then add your own custom ones just for this report // $state['filter_name'] = $app->getUserStateFromRequest($ns.'name', 'filter_name', '', ''); //$state['filter_product_id'] = $app->getUserStateFromRequest($ns.'product_id', 'filter_product_id', '', ''); $state['filter_product_name'] = $app->getUserStateFromRequest($ns . 'product_name', 'filter_product_name', '', ''); $state['filter_manufacturer_id'] = $app->getUserStateFromRequest($ns . 'manufacturer_id', 'filter_manufacturer_id', '', ''); // then apply the states to the model foreach ($state as $key => $value) { $model->setState($key, $value); } return $state; }
/** * Override parent::_getState() to do the filtering * * @return object */ function _getState() { $app = JFactory::getApplication(); $model = $this->_getModel($this->default_model); $ns = $this->_getNamespace(); $state = parent::_getState(); // get the basic state values from the parent method $state['filter'] = $app->getUserStateFromRequest($ns, 'filter', '', ''); $state['filter_date_from'] = $app->getUserStateFromRequest($ns . 'date_from', 'filter_date_from', '', ''); $state['filter_date_to'] = $app->getUserStateFromRequest($ns . 'date_to', 'filter_date_to', '', ''); $state['filter_product_name'] = $app->getUserStateFromRequest($ns . 'product_name', 'filter_product_name', '', ''); $state['filter_file_name'] = $app->getUserStateFromRequest($ns . 'file_name', 'filter_file_name', '', ''); $state['direction'] = $app->getUserStateFromRequest($ns . 'direction', 'filter_direction', 'DESC', ''); $state['order'] = $app->getUserStateFromRequest($ns . 'order', 'filter_order', 'file_downloads', ''); $state = $this->_handleRangePresets($state); foreach ($state as $key => $value) { $model->setState($key, $value); } return $state; }