1 |
a45e4bc1
|
Assos Assos
|
<?php
|
2 |
|
|
/**
|
3 |
|
|
* @file
|
4 |
|
|
* Views' relationship handlers.
|
5 |
|
|
*/
|
6 |
|
|
|
7 |
|
|
class webform_handler_relationship_submission_data extends views_handler_relationship {
|
8 |
|
|
|
9 |
|
|
function option_definition() {
|
10 |
|
|
$options = parent::option_definition();
|
11 |
|
|
$options['webform_nid'] = array('default' => NULL);
|
12 |
|
|
$options['webform_cid'] = array('default' => NULL);
|
13 |
|
|
return $options;
|
14 |
|
|
}
|
15 |
|
|
|
16 |
|
|
function options_form(&$form, &$form_state) {
|
17 |
|
|
parent::options_form($form, $form_state);
|
18 |
|
|
form_load_include($form_state, 'inc', 'webform', 'views/webform.views');
|
19 |
|
|
|
20 |
|
|
$nid = (int) $this->options['webform_nid'];
|
21 |
|
|
$cid = (int) $this->options['webform_cid'];
|
22 |
|
|
|
23 |
|
|
// Helper function provides webform_nid and webform_cid options.
|
24 |
|
|
_webform_views_options_form($form, $form_state, $nid, $cid);
|
25 |
|
|
}
|
26 |
|
|
|
27 |
|
|
function options_validate(&$form, &$form_state) {
|
28 |
|
|
parent::options_validate($form, $form_state);
|
29 |
|
|
_webform_views_options_validate($form, $form_state);
|
30 |
|
|
}
|
31 |
|
|
|
32 |
|
|
function options_submit(&$form, &$form_state) {
|
33 |
|
|
parent::options_submit($form, $form_state);
|
34 |
|
|
_webform_views_options_submit($form, $form_state);
|
35 |
|
|
}
|
36 |
|
|
|
37 |
|
|
/**
|
38 |
|
|
* Called to implement a relationship in a query.
|
39 |
|
|
*
|
40 |
|
|
* It respects the given component ids, provided via options form.
|
41 |
|
|
*/
|
42 |
|
|
function query() {
|
43 |
|
|
$this->definition['extra'][] = array(
|
44 |
|
|
'table' => NULL,
|
45 |
|
|
'field' => "%alias.nid",
|
46 |
|
|
'value' => $this->options['webform_nid'],
|
47 |
|
|
);
|
48 |
|
|
$this->definition['extra'][] = array(
|
49 |
|
|
'table' => NULL,
|
50 |
|
|
'field' => "%alias.cid",
|
51 |
|
|
'value' => $this->options['webform_cid'],
|
52 |
|
|
);
|
53 |
|
|
|
54 |
|
|
// The rest of building the join is performed by the parent.
|
55 |
|
|
parent::query();
|
56 |
|
|
}
|
57 |
|
|
} |