-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnode_example.module
More file actions
89 lines (78 loc) · 2.13 KB
/
Copy pathnode_example.module
File metadata and controls
89 lines (78 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<?php
/**
* * @file
* Module file for Node Example module.
*
* This module is developed as a part of Google Summerof Code'12 project.
* Author: Lali Sudaththa Devamanthri
* Mentor: María Leandro, Peter Borsa
*
* This module is still is development stage.
*
*
* To use this module, OG module and Event contents must be integrate
*/
/**
* Implements hook_menu().
* providing a default pages to illustrate the user nodes
*
*/
function node_example_menu() {
$items['examples/node_example'] = array(
'page callback' => 'node_example_page',
'access arguments' => array('access content'),
'title' => 'Group Nodes Test',
);
$items['examples/timeline'] = array(
'page callback' => 'timeline_page',
'access arguments' => array('access content'),
'title' => 'Timeline ',
);
return $items;
}
/**
* function for filter user nodes from tables
* @return array of user event nodes
*/
function node_example_page() {
// building a renderable array that will be our page.
// For now we just declare the array.
$renderable_array = array();
/*
* get user subscribes group list ID
*/
global $user;
$sql1 = 'SELECT gid FROM {og_membership} ogm WHERE ogm.etid = :log';
$group_result = db_query($sql1,
array(
':log' => $user->uid,
)
);
$renderable_array['explanation'] = array(
'#markup' => t("Node created for registered groups by you, will show here"),
);
// get the group owned nodes ID
foreach ($group_result as $groupID){
$sql2 = 'SELECT etid FROM {og_membership} ogm WHERE ogm.gid = :group AND entity_type = :type';
$events_group = db_query($sql2,
array(
':type' => 'node',
':group' => $groupID->gid,
)
);
//get the nodes
foreach ($events_group as $row) {
$node = node_load($row->etid);
$renderable_array['node_list'][]= node_view($node, 'example_node_list');
}
}
//return json_encode($renderable_array);
return $renderable_array;
}
/**
* Function for integarate TimelineJS library
* this part still in development
*
*/
function timeline_page() {
}