Projet

Général

Profil

Paste
Télécharger (1,7 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / webform / views / webform_handler_relationship_submission_data.inc @ 01f36513

1
<?php
2

    
3
/**
4
 * Views' relationship handlers.
5
 */
6
class webform_handler_relationship_submission_data extends views_handler_relationship {
7

    
8
  /**
9
   *
10
   */
11
  public function option_definition() {
12
    $options = parent::option_definition();
13
    $options['webform_nid'] = array('default' => NULL);
14
    $options['webform_cid'] = array('default' => NULL);
15
    return $options;
16
  }
17

    
18
  /**
19
   *
20
   */
21
  public function options_form(&$form, &$form_state) {
22
    parent::options_form($form, $form_state);
23
    form_load_include($form_state, 'inc', 'webform', 'views/webform.views');
24

    
25
    $nid = (int) $this->options['webform_nid'];
26
    $cid = (int) $this->options['webform_cid'];
27

    
28
    // Helper function provides webform_nid and webform_cid options.
29
    _webform_views_options_form($form, $form_state, $nid, $cid);
30
  }
31

    
32
  /**
33
   *
34
   */
35
  public function options_validate(&$form, &$form_state) {
36
    parent::options_validate($form, $form_state);
37
    _webform_views_options_validate($form, $form_state);
38
  }
39

    
40
  /**
41
   *
42
   */
43
  public function options_submit(&$form, &$form_state) {
44
    parent::options_submit($form, $form_state);
45
    _webform_views_options_submit($form, $form_state);
46
  }
47

    
48
  /**
49
   * Called to implement a relationship in a query.
50
   *
51
   * It respects the given component ids, provided via options form.
52
   */
53
  public function query() {
54
    $this->definition['extra'][] = array(
55
      'table' => NULL,
56
      'field' => "%alias.nid",
57
      'value' => $this->options['webform_nid'],
58
    );
59
    $this->definition['extra'][] = array(
60
      'table' => NULL,
61
      'field' => "%alias.cid",
62
      'value' => $this->options['webform_cid'],
63
    );
64

    
65
    // The rest of building the join is performed by the parent.
66
    parent::query();
67
  }
68

    
69
}