1 |
a45e4bc1
|
Assos Assos
|
<?php
|
2 |
feca1e4a
|
Assos Assos
|
|
3 |
a45e4bc1
|
Assos Assos
|
/**
|
4 |
|
|
* Views' relationship handlers.
|
5 |
|
|
*/
|
6 |
feca1e4a
|
Assos Assos
|
class webform_handler_relationship_submission_data extends views_handler_relationship {
|
7 |
a45e4bc1
|
Assos Assos
|
|
8 |
feca1e4a
|
Assos Assos
|
/**
|
9 |
|
|
*
|
10 |
|
|
*/
|
11 |
|
|
public function option_definition() {
|
12 |
a45e4bc1
|
Assos Assos
|
$options = parent::option_definition();
|
13 |
|
|
$options['webform_nid'] = array('default' => NULL);
|
14 |
|
|
$options['webform_cid'] = array('default' => NULL);
|
15 |
|
|
return $options;
|
16 |
|
|
}
|
17 |
|
|
|
18 |
feca1e4a
|
Assos Assos
|
/**
|
19 |
|
|
*
|
20 |
|
|
*/
|
21 |
|
|
public function options_form(&$form, &$form_state) {
|
22 |
a45e4bc1
|
Assos Assos
|
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 |
feca1e4a
|
Assos Assos
|
/**
|
33 |
|
|
*
|
34 |
|
|
*/
|
35 |
|
|
public function options_validate(&$form, &$form_state) {
|
36 |
a45e4bc1
|
Assos Assos
|
parent::options_validate($form, $form_state);
|
37 |
|
|
_webform_views_options_validate($form, $form_state);
|
38 |
|
|
}
|
39 |
|
|
|
40 |
feca1e4a
|
Assos Assos
|
/**
|
41 |
|
|
*
|
42 |
|
|
*/
|
43 |
|
|
public function options_submit(&$form, &$form_state) {
|
44 |
a45e4bc1
|
Assos Assos
|
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 |
feca1e4a
|
Assos Assos
|
public function query() {
|
54 |
a45e4bc1
|
Assos Assos
|
$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 |
feca1e4a
|
Assos Assos
|
|
69 |
a45e4bc1
|
Assos Assos
|
} |