-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinteractions.php
More file actions
59 lines (51 loc) · 1.75 KB
/
interactions.php
File metadata and controls
59 lines (51 loc) · 1.75 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
<?php
/**
*
* @package mahara
* @subpackage core
* @author Catalyst IT Ltd
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later
* @copyright For copyright information on Mahara, please see the README file distributed with this software.
*
*/
define('INTERNAL', 1);
define('MENUITEM', 'groups');
require(dirname(dirname(__FILE__)) . '/init.php');
require_once(get_config('docroot') . 'interaction/lib.php');
require_once(get_config('libroot') . 'group.php');
define('GROUP', param_integer('id'));
$group = group_current_group();
if (group_user_access($group->id, $USER->get('id')) != 'admin') {
throw new AccessDeniedException(get_string('notallowedtoeditinteraction', 'group'));
}
define('TITLE', get_string('groupinteractions', 'group'));
$interactiontypes = array_flip(
array_map(
create_function('$a', 'return $a->name;'),
plugins_installed('interaction')
)
);
if (!$interactions = get_records_select_array('interaction_instance',
'"group" = ? AND deleted = ?', array($group->id, 0),
'plugin, ctime', 'id, plugin, title')) {
$interactions = array();
}
$names = array();
foreach (array_keys($interactiontypes) as $plugin) {
$names[$plugin] = array(
'single' => get_string('name', 'interaction.' . $plugin),
'plural' => get_string('nameplural', 'interaction.' . $plugin)
);
}
foreach ($interactions as $i) {
if (!is_array($interactiontypes[$i->plugin])) {
$interactiontypes[$i->plugin] = array();
}
$interactiontypes[$i->plugin][] = $i;
}
$smarty = smarty();
$smarty->assign('group', $group);
$smarty->assign('data', $interactiontypes);
$smarty->assign('pluginnames', $names);
$smarty->assign('subheading', TITLE);
$smarty->display('group/interactions.tpl');