Révision 5d12d676
Ajouté par Assos Assos il y a environ 6 ans
drupal7/sites/all/modules/views/handlers/views_handler_argument_formula.inc | ||
---|---|---|
16 | 16 |
* @ingroup views_argument_handlers |
17 | 17 |
*/ |
18 | 18 |
class views_handler_argument_formula extends views_handler_argument { |
19 |
var $formula = NULL; |
|
19 |
|
|
20 |
/** |
|
21 |
* |
|
22 |
*/ |
|
23 |
public $formula = NULL; |
|
24 |
|
|
20 | 25 |
/** |
21 |
* Constructor
|
|
26 |
* {@inheritdoc}
|
|
22 | 27 |
*/ |
23 |
function construct() { |
|
28 |
public function construct() {
|
|
24 | 29 |
parent::construct(); |
25 | 30 |
|
26 | 31 |
if (!empty($this->definition['formula'])) { |
... | ... | |
28 | 33 |
} |
29 | 34 |
} |
30 | 35 |
|
31 |
function get_formula() { |
|
36 |
/** |
|
37 |
* |
|
38 |
*/ |
|
39 |
public function get_formula() { |
|
32 | 40 |
return str_replace('***table***', $this->table_alias, $this->formula); |
33 | 41 |
} |
34 | 42 |
|
35 | 43 |
/** |
36 | 44 |
* Build the summary query based on a formula |
37 | 45 |
*/ |
38 |
function summary_query() { |
|
46 |
public function summary_query() {
|
|
39 | 47 |
$this->ensure_my_table(); |
40 | 48 |
// Now that our table is secure, get our formula. |
41 | 49 |
$formula = $this->get_formula(); |
... | ... | |
50 | 58 |
/** |
51 | 59 |
* Build the query based upon the formula |
52 | 60 |
*/ |
53 |
function query($group_by = FALSE) { |
|
61 |
public function query($group_by = FALSE) {
|
|
54 | 62 |
$this->ensure_my_table(); |
55 | 63 |
// Now that our table is secure, get our formula. |
56 | 64 |
$placeholder = $this->placeholder(); |
57 |
$formula = $this->get_formula() .' = ' . $placeholder; |
|
65 |
$formula = $this->get_formula() . ' = ' . $placeholder;
|
|
58 | 66 |
$placeholders = array( |
59 | 67 |
$placeholder => $this->argument, |
60 | 68 |
); |
61 | 69 |
$this->query->add_where(0, $formula, $placeholders, 'formula'); |
62 | 70 |
} |
71 |
|
|
63 | 72 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules