Révision 5d12d676
Ajouté par Assos Assos il y a environ 6 ans
drupal7/sites/all/modules/views/modules/node/views_handler_field_history_user_timestamp.inc | ||
---|---|---|
14 | 14 |
* @ingroup views_field_handlers |
15 | 15 |
*/ |
16 | 16 |
class views_handler_field_history_user_timestamp extends views_handler_field_node { |
17 |
function init(&$view, &$options) { |
|
17 |
|
|
18 |
/** |
|
19 |
* {@inheritdoc} |
|
20 |
*/ |
|
21 |
public function init(&$view, &$options) { |
|
18 | 22 |
parent::init($view, $options); |
19 | 23 |
global $user; |
20 | 24 |
if ($user->uid) { |
... | ... | |
26 | 30 |
} |
27 | 31 |
} |
28 | 32 |
|
29 |
function option_definition() { |
|
33 |
/** |
|
34 |
* {@inheritdoc} |
|
35 |
*/ |
|
36 |
public function option_definition() { |
|
30 | 37 |
$options = parent::option_definition(); |
31 | 38 |
|
32 | 39 |
$options['comments'] = array('default' => FALSE, 'bool' => TRUE); |
... | ... | |
34 | 41 |
return $options; |
35 | 42 |
} |
36 | 43 |
|
37 |
function options_form(&$form, &$form_state) { |
|
44 |
/** |
|
45 |
* {@inheritdoc} |
|
46 |
*/ |
|
47 |
public function options_form(&$form, &$form_state) { |
|
38 | 48 |
parent::options_form($form, $form_state); |
39 | 49 |
if (module_exists('comment')) { |
40 | 50 |
$form['comments'] = array( |
... | ... | |
46 | 56 |
} |
47 | 57 |
} |
48 | 58 |
|
49 |
function query() { |
|
59 |
/** |
|
60 |
* {@inheritdoc} |
|
61 |
*/ |
|
62 |
public function query() { |
|
50 | 63 |
// Only add ourselves to the query if logged in. |
51 | 64 |
global $user; |
52 | 65 |
if (!$user->uid) { |
... | ... | |
55 | 68 |
parent::query(); |
56 | 69 |
} |
57 | 70 |
|
58 |
function render($values) { |
|
71 |
/** |
|
72 |
* {@inheritdoc} |
|
73 |
*/ |
|
74 |
public function render($values) { |
|
59 | 75 |
// Let's default to 'read' state. |
60 | 76 |
// This code shadows node_mark, but it reads from the db directly and |
61 | 77 |
// we already have that info. |
... | ... | |
65 | 81 |
$last_read = $this->get_value($values); |
66 | 82 |
$changed = $this->get_value($values, 'changed'); |
67 | 83 |
|
68 |
$last_comment = module_exists('comment') && !empty($this->options['comments']) ? $this->get_value($values, 'last_comment') : 0;
|
|
84 |
$last_comment = module_exists('comment') && !empty($this->options['comments']) ? $this->get_value($values, 'last_comment') : 0; |
|
69 | 85 |
|
70 | 86 |
if (!$last_read && $changed > NODE_NEW_LIMIT) { |
71 | 87 |
$mark = MARK_NEW; |
... | ... | |
79 | 95 |
return $this->render_link(theme('mark', array('type' => $mark)), $values); |
80 | 96 |
} |
81 | 97 |
} |
98 |
|
|
82 | 99 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules