1 |
85ad3d82
|
Assos Assos
|
<?php
|
2 |
|
|
|
3 |
|
|
/**
|
4 |
|
|
* @file
|
5 |
|
|
* Contains the boolean flagged field handler.
|
6 |
|
|
*/
|
7 |
|
|
|
8 |
|
|
/**
|
9 |
|
|
* Views field handler for the flagged field.
|
10 |
|
|
*
|
11 |
|
|
* @ingroup views
|
12 |
|
|
*/
|
13 |
|
|
class flag_handler_field_flagged extends views_handler_field_boolean {
|
14 |
|
|
|
15 |
|
|
function init(&$view, &$options) {
|
16 |
|
|
parent::init($view, $options);
|
17 |
|
|
|
18 |
|
|
// Add our boolean labels.
|
19 |
|
|
$this->formats['flag'] = array(t('Flagged'), t('Not flagged'));
|
20 |
|
|
// TODO: We could probably lift the '(Un)Flagged message' strings from the
|
21 |
|
|
// flag object, but a) we need to lift that from the relationship we're on
|
22 |
|
|
// and b) they will not necessarily make sense in a static context.
|
23 |
|
|
}
|
24 |
|
|
|
25 |
|
|
/**
|
26 |
|
|
* Called to add the field to a query.
|
27 |
|
|
*/
|
28 |
|
|
function query() {
|
29 |
|
|
$this->ensure_my_table();
|
30 |
|
|
// Add the formula.
|
31 |
|
|
$this->field_alias = $this->query->add_field(NULL, "($this->table_alias.uid IS NOT NULL)", 'flagging_flagged');
|
32 |
|
|
|
33 |
|
|
$this->add_additional_fields();
|
34 |
|
|
}
|
35 |
|
|
|
36 |
|
|
} |