3
* Mahara: Electronic portfolio, weblog, resume builder and social networking
4
* Copyright (C) 2006-2008 Catalyst IT Ltd (http://www.catalyst.net.nz)
6
* This program is free software: you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation, either version 3 of the License, or
9
* (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program. If not, see <http://www.gnu.org/licenses/>.
21
* @author Catalyst IT Ltd
22
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
23
* @copyright (C) 2006-2008 Catalyst IT Ltd http://catalyst.net.nz
27
define('INTERNAL', 1);
28
define('MENUITEM', 'groups');
29
require(dirname(dirname(__FILE__)) . '/init.php');
30
require_once('pieforms/pieform.php');
32
$groupid = param_integer('id');
34
$group = get_record('group', 'id', $groupid, 'owner', $USER->get('id'), 'deleted', 0);
37
throw new AccessDeniedException(get_string('cantdeletegroup', 'group'));
40
define('TITLE', get_string('deletespecifiedgroup', 'group', $group->name));
42
$views = count_records_sql(
44
FROM {view_access_group} a
49
$form = pieform(array(
50
'name' => 'deletegroup',
56
'type' => 'submitcancel',
57
'value' => array(get_string('yes'), get_string('no')),
58
'goto' => get_config('wwwroot') . 'group/view.php?id=' . $groupid
64
$smarty->assign('heading', TITLE);
65
$smarty->assign('message', $views ? get_string('groupconfirmdeletehasviews', 'group') : get_string('groupconfirmdelete', 'group'));
66
$smarty->assign('form', $form);
67
$smarty->display('group/delete.tpl');
69
function deletegroup_submit(Pieform $form, $values) {
70
global $SESSION, $USER, $groupid;
71
delete_group($groupid);
72
$SESSION->add_ok_msg(get_string('deletegroup', 'group'));
73
redirect('/group/mygroups.php');