Example #1
0
 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $filters = dblog_filters();
     foreach ($filters as $name => $filter) {
         if ($form_state->hasValue($name)) {
             $_SESSION['dblog_overview_filter'][$name] = $form_state->getValue($name);
         }
     }
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $filters = dblog_filters();
     foreach ($filters as $name => $filter) {
         if (isset($form_state['values'][$name])) {
             $_SESSION['dblog_overview_filter'][$name] = $form_state['values'][$name];
         }
     }
 }
Example #3
0
 /**
  * Builds a query for database log administration filters based on session.
  *
  * @return array
  *   An associative array with keys 'where' and 'args'.
  */
 protected function buildFilterQuery()
 {
     if (empty($_SESSION['dblog_overview_filter'])) {
         return;
     }
     $this->moduleHandler->loadInclude('dblog', 'admin.inc');
     $filters = dblog_filters();
     // Build query.
     $where = $args = array();
     foreach ($_SESSION['dblog_overview_filter'] as $key => $filter) {
         $filter_where = array();
         foreach ($filter as $value) {
             $filter_where[] = $filters[$key]['where'];
             $args[] = $value;
         }
         if (!empty($filter_where)) {
             $where[] = '(' . implode(' OR ', $filter_where) . ')';
         }
     }
     $where = !empty($where) ? implode(' AND ', $where) : '';
     return array('where' => $where, 'args' => $args);
 }