Commit ad744e38 authored by Nigel McNie's avatar Nigel McNie Committed by Nigel McNie
Browse files

Send notifications on view creation and access change (bug #397)

parent acb9e5b4
......@@ -75,9 +75,7 @@ function createview4_submit(Pieform $form, $values) {
$view->startdate = db_format_timestamp($data['startdate']);
$view->stopdate = db_format_timestamp($data['stopdate']);
$view->ctime = $view->mtime = $view->atime = $time;
log_debug($view);
$viewid = insert_record('view', $view, 'id', true);
log_debug('inserted view as id ' . $viewid);
foreach ($data['artefacts'] as $block => $blockdata) {
if ($blockdata['type'] == 'label') {
......@@ -136,6 +134,11 @@ function createview4_submit(Pieform $form, $values) {
}
}
$data = new StdClass;
$data->owner = $USER->get('id');
$data->view = $viewid;
activity_occurred('newview', $data);
db_commit();
$SESSION->add_ok_msg(get_string('viewcreatedsuccessfully', 'view'));
redirect(get_config('wwwroot') . 'view/');
......
......@@ -148,6 +148,8 @@ function editviewaccess_submit(Pieform $form, $values) {
AND usr IN(' . $userids . ')');
}
$beforeusers = activity_get_viewaccess_users($viewid, $USER->get('id'));
// Procedure:
// get list of current friends - this is available in global $data
// compare with list of new friends
......@@ -192,6 +194,13 @@ function editviewaccess_submit(Pieform $form, $values) {
break;
}
}
$data = new StdClass;
$data->view = $viewid;
$data->owner = $USER->get('id');
$data->oldusers = $beforeusers;
activity_occurred('viewaccess', $data);
db_commit();
$SESSION->add_ok_msg(get_string('viewaccesseditedsuccessfully'));
redirect('view/');
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment