Example #1
0
 /**
  * Method to auto-populate the model state.
  * Note. Calling getState in this method will result in recursion.
  *
  * @param string $ordering - name of column
  * @param string $direction - direction
  *
  * @return void
  * @since  1.0
  */
 protected function populateState($ordering = null, $direction = null)
 {
     // Initialise variables.
     $app = JFactory::getApplication();
     $session = JFactory::getSession();
     // Adjust the context to support modal layouts.
     if ($layout = JRequest::getVar('layout')) {
         $this->context .= '.' . $layout;
     }
     $form = JRequest::getVar('form');
     $name = $this->getName();
     if ($form != $name) {
         $search = $app->getUserState($this->context . '.filter.search');
         $published = $app->getUserState($this->context . '.filter.published');
         $published = $published ? $published : '';
     } else {
         $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
         if ($search == "Search...") {
             $search = "";
         }
         $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', '');
     }
     $this->setState('filter.published', $published);
     $this->setState('filter.search', $search);
     // List state information.
     parent::populateState('a.automailing_name', 'asc');
 }