-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuseractions.module
More file actions
132 lines (112 loc) · 2.86 KB
/
useractions.module
File metadata and controls
132 lines (112 loc) · 2.86 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<?php
/**
* Hook theme.
* Define the templates to render the users actions
*
* @return array
* @author fran
**/
function useractions_theme()
{
return array(
'useractions_block_actions_autenticado' => array('arguments' => array('items'=> array())),
);
}
/**
* undocumented function
*
* @return void
* @author /bin/bash: niutil: command not found
**/
/*
* bloque 0 : User actions block
*/
function useractions_block($op = 'list', $delta = 0, $edit = array())
{
global $user;
switch($op)
{
case 'list':
$blocks[0]['info'] = t('User actions: User actions');
return $blocks;
case 'view':
if ($delta == 0)
{
$block['subject'] = "";
$items['links'] = _useractions_get_actions();
$items['info'] = _useractions_get_userinfo();
$block['content'] = _useractions_block_actions($items);
return $block;
}
}
}
/**
* Select the tpl.php file for the current user.
*
* @return $output: The hmtl code with the actions.
* @author fran
**/
function _useractions_block_actions($items)
{
global $user;
/* Hasta nueva orden se queda asi
if ($user->uid == 1 || in_array('administrador', $user->roles)) {
$tpl = "_administrador";
}
else {
$tpl = "_autenticado";
}
*/
return theme('useractions_block_actions_autenticado', $items);
}
/**
* Generate the links to show in the action block
*
* @return $links
* @author fran
**/
function _useractions_get_actions()
{
$links = array();
//@fran : esto debería de hacerse por interfaz.
$links[] = l('Añadir un evento', 'node/add/agenda');
$links[] = l('Crear una entrada de blog', 'node/add/blog');
$links[] = l('Crear un caso', 'node/add/caso');
$links[] = l('Crear una consulta', 'node/add/consulta');
$links[] = l('Añadir un documento', 'node/add/documento');
$links[] = l('Añadir un enlace', 'node/add/enlace');
$links[] = l('Proponer una idea', 'node/add/idea');
$links[] = l('Añadir una imagen', 'node/add/galeria');
$links[] = l('Crear una noticia', 'node/add/noticia');
$links[] = l('Crear un recurso general', 'node/add/otros');
$links[] = l('Crear una entrada en el foro', 'node/add/forum');
$links[] = l('Añadir un video', 'node/add/video');
return $links;
}
/**
* Get the user information to display
*
* @return $info
* @author fran
**/
function _useractions_get_userinfo()
{
global $user;
$info = array(
"name" => $user->name,
"image" => $user->picture,
);
return $info;
}
/**
* return the HTML code of the actions block. Does nothing, el html will be use from
* a template file (useractions_block_actions_autenticadoh.tpl.php)
*
* @return $output : html code
* @author fran
**/
function theme_useractions_block_actions_autenticado($item)
{
$output = "<span>useractions.module theme_useractions_block_actions_autenticado</span>";
return $output;
}