-
-
Save dawehner/257125 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//$Id$ | |
class content_moderation_handler_filter_pending_revision extends views_handler_filter { | |
function construct() { | |
parent::construct(); | |
$this->additional_fields['node_vid'] = array('table' => 'node', 'field' => 'vid'); | |
$this->additional_fields['revision_vid'] = array('table' => 'node_revision', 'field' => 'vid'); | |
} | |
function query() { | |
//$this->ensure_my_table(); | |
$this->query->add_where($this->options['group'], $this->aliases['node_vid'] ." > ". $this->aliases['revision_vid'], $this->value); | |
); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function content_moderation_views_api() { | |
return array('api' => 2.0); | |
} | |
---- | |
function content_moderation_views_data() { | |
$data = array(); | |
$data['content_moderation']['table']['group'] = t('Node'); | |
$data['content_moderation']['table']['title'] = 'Pending revisions'; | |
$data['content_moderation']['table']['join'] = array( | |
'left_table' => 'node_revisions', | |
'left_field' => 'nid', | |
'field' => 'nid'); | |
$data['content_moderation']['table']['title'] = 'Pending revisions'; | |
$data['content_moderation']['pending_revisions'] = array( | |
'real field' => 'nid', | |
'title' => t('Pending revisions'), | |
'help' => t('Check for pending revisions'), | |
'filter' => array( | |
'handler' => 'content_moderation_handler_filter_pending_revision', | |
), | |
); | |
return $data; | |
} | |
function content_moderation_views_handlers() { | |
return array( | |
'handlers' => array( | |
'content_moderation_handler_filter_pending_revision' => array( | |
'parent' => 'views_handler_filter' | |
) | |
) | |
); | |
} | |
-- | |
class views_handler_filter extends content_moderation_handler_filter_pending_revision { | |
function admin_summary() { } | |
function operator_form() { } | |
function query() { | |
//$table = $this->ensure_my_table(); | |
//$this->query->add_where($this->options['group'], "$table.status <> 0 OR ($table.uid = ***CURRENT_USER*** AND ***CURRENT_USER*** <> 0) OR ***ADMINISTER_NODES*** = 1"); | |
} | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$data['content_moderation']['table']['join'] = array( | |
'field' => 'nid', | |
'left_table' => 'node_revisions', | |
'left_field' => 'nid', | |
'type' => 'inner', | |
'extras' => array( | |
array( | |
'field' => 'vid', | |
'operator' => '<', | |
'numeric' => true, | |
'value' => $VID) | |
) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment