views_handler_filter_history_user_timestamp.inc in Views (for Drupal 7) 6.3
File
modules/node/views_handler_filter_history_user_timestamp.inc
View source
<?php
class views_handler_filter_history_user_timestamp extends views_handler_filter {
var $no_operator = TRUE;
function expose_form_right(&$form, &$form_state) {
}
function value_form(&$form, &$form_state) {
if (!empty($form_state['exposed'])) {
if (isset($this->options['expose']['label'])) {
$label = $this->options['expose']['label'];
}
else {
$label = t('Has new content');
}
$form['value'] = array(
'#type' => 'checkbox',
'#title' => $label,
'#default_value' => $this->value,
);
}
}
function query() {
global $user;
if (!$user || !$user->uid) {
return;
}
if (!empty($this->options['exposed']) && empty($this->value)) {
return;
}
$limit = time() - NODE_NEW_LIMIT;
$this
->ensure_my_table();
$field = "{$this->table_alias}.{$this->real_field}";
$node = $this->query
->ensure_table('node', $this->relationship);
if (module_exists('comment')) {
$ncs = $this->query
->ensure_table('node_comment_statistics', $this->relationship);
$clause = "OR {$ncs}.last_comment_timestamp > (***CURRENT_TIME*** - {$limit})";
$clause2 = "OR {$field} < {$ncs}.last_comment_timestamp";
}
$this->query
->add_where($this->options['group'], "({$field} IS NULL AND ({$node}.changed > (***CURRENT_TIME*** - {$limit}) {$clause})) OR {$field} < {$node}.changed {$clause2}");
}
function admin_summary() {
if (!empty($this->options['exposed'])) {
return t('exposed');
}
}
}