Révision feca1e4a
Ajouté par Assos Assos il y a presque 7 ans
drupal7/sites/all/modules/webform/views/webform_plugin_row_submission_view.inc | ||
---|---|---|
13 | 13 |
* @ingroup views_row_plugins |
14 | 14 |
*/ |
15 | 15 |
class webform_views_plugin_row_submission_view extends views_plugin_row { |
16 |
// Basic properties that let the row style follow relationships. |
|
16 |
/** |
|
17 |
* Basic properties that let the row style follow relationships. |
|
18 |
*/ |
|
17 | 19 |
public $base_table = 'webform_submissions'; |
18 | 20 |
public $base_field = 'sid'; |
19 | 21 |
|
20 |
// Stores the nodes loaded with pre_render. |
|
22 |
/** |
|
23 |
* Stores the nodes loaded with pre_render. |
|
24 |
*/ |
|
21 | 25 |
private $submissions = array(); |
22 | 26 |
private $nodes = array(); |
23 | 27 |
|
24 |
function option_definition() { |
|
28 |
/** |
|
29 |
* |
|
30 |
*/ |
|
31 |
public function option_definition() { |
|
25 | 32 |
$options = parent::option_definition(); |
26 | 33 |
|
27 | 34 |
$options['format'] = array('default' => 'html'); |
... | ... | |
29 | 36 |
return $options; |
30 | 37 |
} |
31 | 38 |
|
32 |
function options_form(&$form, &$form_state) { |
|
39 |
/** |
|
40 |
* |
|
41 |
*/ |
|
42 |
public function options_form(&$form, &$form_state) { |
|
33 | 43 |
parent::options_form($form, $form_state); |
34 | 44 |
|
35 | 45 |
$options = $this->options_form_summary_options(); |
... | ... | |
44 | 54 |
/** |
45 | 55 |
* Return the main options, which are shown in the summary title. |
46 | 56 |
*/ |
47 |
function options_form_summary_options() { |
|
57 |
public function options_form_summary_options() {
|
|
48 | 58 |
return array( |
49 | 59 |
'html' => t('HTML'), |
50 | 60 |
'text' => t('Plain text'), |
51 | 61 |
); |
52 | 62 |
} |
53 | 63 |
|
54 |
function summary_title() { |
|
64 |
/** |
|
65 |
* |
|
66 |
*/ |
|
67 |
public function summary_title() { |
|
55 | 68 |
$options = $this->options_form_summary_options(); |
56 | 69 |
return check_plain($options[$this->options['format']]); |
57 | 70 |
} |
58 | 71 |
|
59 |
function pre_render($values) { |
|
72 |
/** |
|
73 |
* |
|
74 |
*/ |
|
75 |
public function pre_render($values) { |
|
60 | 76 |
$sids = array(); |
61 | 77 |
foreach ($values as $row) { |
62 | 78 |
$sids[] = $row->{$this->field_alias}; |
... | ... | |
72 | 88 |
$this->nodes = $nids ? node_load_multiple($nids) : array(); |
73 | 89 |
} |
74 | 90 |
|
75 |
function render($row) { |
|
91 |
/** |
|
92 |
* |
|
93 |
*/ |
|
94 |
public function render($row) { |
|
76 | 95 |
if (isset($this->submissions[$row->{$this->field_alias}])) { |
77 | 96 |
$submission = $this->submissions[$row->{$this->field_alias}]; |
78 | 97 |
$node = $this->nodes[$submission->nid]; |
... | ... | |
92 | 111 |
return $format == 'html' ? $render : nl2br(check_plain($render)); |
93 | 112 |
} |
94 | 113 |
} |
114 |
|
|
95 | 115 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules