summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWolfgang Ziegler2006-12-25 22:24:17 (GMT)
committer Wolfgang Ziegler2006-12-25 22:24:17 (GMT)
commit686f3a2e7e8d7ecded0bf472fa9ef0b6faf8e342 (patch)
treeb23dd0f795692cfd534782f6e11a4de93f2326a2
parentd4b870e6ea0aa6ba517a571720a5a85acb60ccec (diff)
added usernode module support for the basic views integration
-rw-r--r--buddylist_views.inc120
1 files changed, 118 insertions, 2 deletions
diff --git a/buddylist_views.inc b/buddylist_views.inc
index 9d414bc..5504e4c 100644
--- a/buddylist_views.inc
+++ b/buddylist_views.inc
@@ -100,13 +100,69 @@ function buddylist_views_tables() {
),
),
);
+ $tables['usernode_buddylist_buddyof'] = array(
+ "name" => "buddylist",
+ "join" => array(
+ "left" => array(
+ "table" => "usernode",
+ "field" => "uid",
+ ),
+ "right" => array(
+ "field" => "uid",
+ ),
+ ),
+ 'filters' => array(
+ 'uid' => array(
+ 'name' => t('Buddylist: Username Is A Buddy Of Usernode'),
+ 'operator' => 'views_handler_operator_or',
+ 'list' => 'views_handler_filter_username',
+ 'value-type' => 'array',
+ 'help' => t('This allows you to filter by buddies of a particular user.'),
+ ),
+ 'currentuid' => array(
+ 'field' => 'uid',
+ 'name' => t('Buddylist: Current User Is A Buddy Of Usernode'),
+ 'operator' => 'views_handler_operator_eqneq',
+ 'list' => 'views_handler_filter_usercurrent',
+ 'help' => t('This allows you to filter by buddies of the current user.'),
+ ),
+ ),
+ );
+ $tables['usernode_buddylist_buddyof'] = array(
+ "name" => "buddylist",
+ "join" => array(
+ "left" => array(
+ "table" => "usernode",
+ "field" => "uid",
+ ),
+ "right" => array(
+ "field" => "uid",
+ ),
+ ),
+ 'filters' => array(
+ 'buddy' => array(
+ 'name' => t('Buddylist: Username Is A Buddy Of Usernode'),
+ 'operator' => 'views_handler_operator_or',
+ 'list' => 'views_handler_filter_username',
+ 'value-type' => 'array',
+ 'help' => t('This allows you to filter by buddies of a particular user.'),
+ ),
+ 'currentuid' => array(
+ 'field' => 'buddy',
+ 'name' => t('Buddylist: Current User Is A Buddy Of Usernode'),
+ 'operator' => 'views_handler_operator_eqneq',
+ 'list' => 'views_handler_filter_usercurrent',
+ 'help' => t('This allows you to filter by buddies of the current user.'),
+ ),
+ ),
+ );
}
return($tables);
}
function buddylist_views_default_views() {
$view = new stdClass();
- $view->name = 'buddylist';
+ $view->name = 'buddylist_posts';
$view->description = 'A list of nodes created by buddies of current user';
$view->access = array ();
$view->view_args_php = '';
@@ -116,7 +172,7 @@ function buddylist_views_default_views() {
$view->page_footer = '';
$view->page_empty = '';
$view->page_type = 'table';
- $view->url = 'buddies';
+ $view->url = 'buddies/posts';
$view->use_pager = TRUE;
$view->nodes_per_page = '10';
$view->sort = array (
@@ -167,6 +223,66 @@ function buddylist_views_default_views() {
);
$view->requires = array(node, users, buddylist_users);
$views[$view->name] = $view;
+
+
+ if (module_exist('usernode')) {
+ $view = new stdClass();
+ $view->name = 'buddylist';
+ $view->description = 'Buddies of the current user';
+ $view->access = array();
+ $view->view_args_php = '';
+ $view->page = TRUE;
+ $view->page_title = 'Buddylist';
+ $view->page_header = 'Buddies of the current user<br />';
+ $view->page_type = 'table';
+ $view->url = 'buddies';
+ $view->use_pager = TRUE;
+ $view->nodes_per_page = '10';
+ $view->sort = array (
+ array (
+ 'tablename' => 'node',
+ 'field' => 'created',
+ 'sortorder' => 'DESC',
+ 'options' => 'normal',
+ ),
+ );
+ $view->field = array (
+ array (
+ 'tablename' => 'node',
+ 'field' => 'title',
+ 'label' => 'Name',
+ 'handler' => 'views_handler_field_nodelink',
+ 'options' => 'link',
+ ),
+ );
+ $view->filter = array (
+ array (
+ 'tablename' => 'node',
+ 'field' => 'status',
+ 'operator' => '=',
+ 'options' => '',
+ 'value' => '1',
+ ),
+ array (
+ 'tablename' => 'usernode_buddylist',
+ 'field' => 'currentuid',
+ 'operator' => '=',
+ 'options' => '',
+ 'value' => '***CURRENT_USER***',
+ ),
+ array (
+ 'tablename' => 'node',
+ 'field' => 'type',
+ 'operator' => 'OR',
+ 'options' => '',
+ 'value' => array (0 => 'usernode'),
+ ),
+ );
+ $view->exposed_filter = array (
+ );
+ $view->requires = array(node, usernode_buddylist);
+ $views[$view->name] = $view;
+ }
return($views);
}