예제 #1
0
 /**
  * Constructor.
  *
  * @param    array    An optional associative array of configuration settings.
  * @see        JController
  * @since    1.6
  */
 public function __construct($config = array())
 {
     parent::__construct();
     $mainframe =& JFactory::getApplication();
     $baseStateVars = array('search' => array('', 'string', 1), 'filter_order' => array('a.ordering', 'cmd', 1), 'filter_order_Dir' => array('', 'cmd', 1), 'filter_state' => array('', 'cmd', 1));
     if (isset($config['state_vars'])) {
         $config['state_vars'] = array_merge($baseStateVars, $config['state_vars']);
     } else {
         $config['state_vars'] = $baseStateVars;
     }
     if (isset($config['default_ordering'])) {
         $this->defaultOrdering = $config['default_ordering'];
     } else {
         $this->defaultOrdering = ' a.ordering ';
     }
     if (isset($config['title_field'])) {
         $this->titleField = $config['title_field'];
     } else {
         $this->titleField = 'a.title';
     }
     if (isset($config['main_table'])) {
         $this->mainTable = $config['main_table'];
     } else {
         $this->getMainTable();
     }
     if (isset($config['context'])) {
         $this->context = $config['context'];
     } else {
         $this->getContext();
     }
     if ($config['state_vars']) {
         foreach ($config['state_vars'] as $name => $values) {
             $storeInSession = isset($values[2]) ? $values[2] : 0;
             $type = isset($values[1]) ? $values[1] : null;
             $default = isset($values[0]) ? $values[0] : null;
             if ($storeInSession) {
                 $value = $mainframe->getUserStateFromRequest($this->context . '.' . $name, $name, $default, $type);
             } else {
                 $value = JRequest::getVar($name, $default, 'default', $type);
             }
             $this->setState($name, $value);
         }
     }
     // Get the pagination request variables
     $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
     $limitstart = $mainframe->getUserStateFromRequest($this->context . '.limitstart', 'limitstart', 0, 'int');
     // In case limit has been changed, adjust limitstart accordingly
     $limitstart = $limit != 0 ? floor($limitstart / $limit) * $limit : 0;
     $this->setState('limit', $limit);
     $this->setState('limitstart', $limitstart);
 }
예제 #2
0
파일: model.php 프로젝트: AxelFG/ckbran-inf
 /**
  * Constructor
  *
  * @since 1.5
  */
 function __construct($config = array())
 {
     parent::__construct();
     if (isset($config['table_filename'])) {
         $this->tableFileName = $config['table_filename'];
     } else {
         $this->getTableFilename();
     }
     if (isset($config['table_name'])) {
         $this->tableName = $config['table_name'];
     } else {
         $this->tableName = $this->_db->getPrefix() . strtolower(OSF_TABLE_PREFIX . '_' . OSInflector::pluralize($this->getName()));
     }
     $array = JRequest::getVar('cid', array(0), '', 'array');
     $edit = JRequest::getVar('edit', true);
     if ($edit) {
         $this->setId((int) $array[0]);
     }
 }
예제 #3
0
 function __construct()
 {
     parent::__construct();
 }