summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominik Kiss2007-12-12 15:25:40 (GMT)
committer Dominik Kiss2007-12-12 15:25:40 (GMT)
commit385a4f20272208fca05623221e207b438562f1b7 (patch)
tree9467d47570c668c5c731f7947a8235d07b23ea42
parent5d7be33dede08e33fdca0e8a5eede01aaff0b23f (diff)
fixed some view - bugs (multiple names of tables)
-rw-r--r--buddy_api/buddy_api.views.inc72
1 files changed, 41 insertions, 31 deletions
diff --git a/buddy_api/buddy_api.views.inc b/buddy_api/buddy_api.views.inc
index f00d7c3..6621273 100644
--- a/buddy_api/buddy_api.views.inc
+++ b/buddy_api/buddy_api.views.inc
@@ -12,7 +12,9 @@
*/
function buddy_api_views_tables() {
global $user;
- $tables['usernode'] = array(
+
+ // join from NODE -> USERNODE
+ $tables['baj_usernode'] = array(
'name' => 'usernode',
'join' => array(
'left' => array(
@@ -26,11 +28,12 @@ function buddy_api_views_tables() {
),
);
- $tables['buddylist'] = array(
+ // join from USERNODE -> BUDDYLIST
+ $tables['baj_buddylist'] = array(
'name' => 'buddylist',
'join' => array(
'left' => array(
- 'table' => 'usernode',
+ 'table' => 'baj_usernode',
'field' => 'uid'
),
'right' => array(
@@ -40,11 +43,12 @@ function buddy_api_views_tables() {
),
);
- $tables['users'] = array(
+ // join from BUDDYLIST -> USERS
+ $tables['baj_users'] = array(
'name' => 'users',
'join' => array(
'left' => array(
- 'table' => 'buddylist',
+ 'table' => 'baj_buddylist',
'field' => 'buddy'
),
'right' => array(
@@ -66,11 +70,12 @@ function buddy_api_views_tables() {
),
);
- $tables['buddylist_pending_requests'] = array(
+ // join from usernode to buddylist_pending_requests
+ $tables['baj_buddylist_pending_requests1'] = array(
'name' => 'buddylist_pending_requests',
'join' => array(
'left' => array(
- 'table' => 'usernode',
+ 'table' => 'baj_usernode',
'field' => 'uid'
),
'right' => array(
@@ -80,11 +85,12 @@ function buddy_api_views_tables() {
),
);
- $tables['users2'] = array(
+ // join from buddylist_pending_requests to users
+ $tables['baj_users1'] = array(
'name' => 'users',
'join' => array(
'left' => array(
- 'table' => 'buddylist_pending_requests',
+ 'table' => 'baj_buddylist_pending_requests1',
'field' => 'requestee_uid'
),
'right' => array(
@@ -115,11 +121,13 @@ function buddy_api_views_tables() {
),
);
- $tables['buddylist_pending_requests2'] = array(
+
+ // join from usernode to buddylist_pending_requests
+ $tables['baj_buddylist_pending_requests2'] = array(
'name' => 'buddylist_pending_requests',
'join' => array(
'left' => array(
- 'table' => 'usernode',
+ 'table' => 'baj_usernode',
'field' => 'uid'
),
'right' => array(
@@ -135,11 +143,12 @@ function buddy_api_views_tables() {
),
);
- $tables['users3'] = array(
+ // join from buddylist_pending_requests to users
+ $tables['baj_users2'] = array(
'name' => 'users',
'join' => array(
'left' => array(
- 'table' => 'buddylist_pending_requests2',
+ 'table' => 'baj_buddylist_pending_requests2',
'field' => 'requester_uid'
),
'right' => array(
@@ -215,18 +224,18 @@ function theme_buddy_api_views_handler_field_username_link($obj){
* query handler for cancel link
*/
function buddy_api_views_field_query_handler($fielddata, $fieldinfo, &$query) {
- $query->ensure_table('buddylist_pending_requests');
- $query->add_field('requestee_uid', 'buddylist_pending_requests');
- $query->add_field('requester_uid', 'buddylist_pending_requests');
+ $query->ensure_table('baj_buddylist_pending_requests1');
+ $query->add_field('requestee_uid', 'baj_buddylist_pending_requests1');
+ $query->add_field('requester_uid', 'baj_buddylist_pending_requests1');
}
/**
* query handler for deny and accept link
*/
function buddy_api_views_field_query_handler_ad($fielddata, $fieldinfo, &$query) {
- $query->ensure_table('buddylist_pending_requests2');
- $query->add_field('requestee_uid', 'buddylist_pending_requests2');
- $query->add_field('requester_uid', 'buddylist_pending_requests2');
+ $query->ensure_table('baj_buddylist_pending_requests2');
+ $query->add_field('requestee_uid', 'baj_buddylist_pending_requests2');
+ $query->add_field('requester_uid', 'baj_buddylist_pending_requests2');
}
/**
@@ -309,7 +318,7 @@ return $args;';
);
$view->field = array (
array (
- 'tablename' => 'users',
+ 'tablename' => 'baj_users',
'field' => 'name',
'label' => '',
'handler' => 'buddy_api_views_handler_field_username_link',
@@ -330,8 +339,10 @@ return $args;';
);
$view->requires = array(users, node);
+
+
// Default View for received requests (incoming requests)
- $view1 = new stdClass();
+ $view1 = new stdClass();
$view1->name = 'buddy_api_received_requests';
$view1->description = 'list of received requests';
$view1->access = array (
@@ -382,24 +393,24 @@ return $args;';
);
$view1->field = array (
array (
- 'tablename' => 'users3',
+ 'tablename' => 'baj_users2',
'field' => 'name',
'label' => '',
'handler' => 'buddy_api_views_handler_field_username_link',
),
array (
- 'tablename' => 'buddylist_pending_requests2',
+ 'tablename' => 'baj_buddylist_pending_requests2',
'field' => 'message',
'label' => '',
),
array (
- 'tablename' => 'users3',
+ 'tablename' => 'baj_users2',
'field' => 'accept',
'label' => '',
'handler' => 'buddy_api_views_handler_accept_link',
),
array (
- 'tablename' => 'users3',
+ 'tablename' => 'baj_users2',
'field' => 'deny',
'label' => '',
'handler' => 'buddy_api_views_handler_deny_link',
@@ -409,11 +420,10 @@ return $args;';
);
$view1->exposed_filter = array (
);
- $view1->requires = array(users3, buddylist_pending_requests2);
-
+ $view1->requires = array(baj_users2, baj_buddylist_pending_requests2);
// Default View for sent requests (outgoing requests)
- $view2 = new stdClass();
+ $view2 = new stdClass();
$view2->name = 'buddy_api_sent_requests';
$view2->description = 'list of sent requests';
$view2->access = array (
@@ -464,13 +474,13 @@ return $args;';
);
$view2->field = array (
array (
- 'tablename' => 'users2',
+ 'tablename' => 'baj_users1',
'field' => 'name',
'label' => '',
'handler' => 'buddy_api_views_handler_field_username_link',
),
array (
- 'tablename' => 'users2',
+ 'tablename' => 'baj_users1',
'field' => 'deactivate',
'label' => '',
'handler' => 'buddy_api_views_handler_cancel_link',
@@ -489,7 +499,7 @@ return $args;';
);
$view2->exposed_filter = array (
);
- $view2->requires = array(users2, node);
+ $view2->requires = array(baj_users1, node);
$views[$view->name] = $view;
$views[$view1->name] = $view1;