Commit ae8f8b45 authored by Martyn Smith's avatar Martyn Smith Committed by Martyn Smith
Browse files
parents 060a9b4b 82f287b6
......@@ -362,6 +362,13 @@ class ArtefactTypeBlog extends ArtefactType {
public function public_feedback_allowed() {
return $this->get('commentsallowed');
}
public function feedback_notify_owner() {
return $this->get('commentsnotify');
}
}
/**
......@@ -770,6 +777,14 @@ class ArtefactTypeBlogPost extends ArtefactType {
}
public function feedback_notify_owner() {
// Notify owner of comments on posts when the blog has
// commentsnotify set to 1;
$parent = get_field('artefact', 'parent', 'id', $this->get('id'));
return get_field('artefact_blog_blog', 'commentsnotify', 'blog', $parent);
}
}
?>
......@@ -521,6 +521,16 @@ abstract class ArtefactType {
}
/**
* By default users are notified of all feedback on artefacts
* which they own. Artefact types which want to allow this
* notification to be turned off should redefine this function.
*/
public function feedback_notify_owner() {
return true;
}
/**
* returns path to icon
* can be called statically but not defined so
......
......@@ -64,7 +64,7 @@ $editcommunity = pieform(array(
'type' => 'wysiwyg',
'title' => get_string('communitydescription'),
'rows' => 10,
'cols' => 80,
'cols' => 70,
'defaultvalue' => $community_data->description,
),
'membershiptype' => array(
......
......@@ -368,6 +368,7 @@ $string['addtowatchlist'] = 'Add %s to watchlist';
$string['addtowatchlistwithchildren'] = 'Add entire %s contents to watchlist';
$string['alreadyinwatchlist'] = 'This %s is already in your watchlist';
$string['attachedfileaddedtofolder'] = "The attached file %s has been added to your '%s' folder.";
$string['attachfile'] = "Attach file";
$string['complaint'] = 'Complaint';
$string['date'] = 'Date';
$string['feedback'] = 'Feedback';
......
......@@ -180,11 +180,15 @@ function handle_activity($activitytype, $data, $cron=false) {
}
if (!empty($data->artefact)) { // feedback on artefact
$data->subject = get_string('newfeedbackonartefact', 'activity');
if (!$artefact = get_record('artefact', 'id', $data->artefact)) {
throw new InvalidArgumentException("Couldn't find artefact with id " . $data->artefact);
require_once('artefact.php');
$artefact = artefact_instance_from_id($data->artefact);
if ($artefact->feedback_notify_owner()) {
$userid = $artefact->get('owner');
}
$userid = $artefact->owner;
$data->subject .= ' ' .$artefact->title;
else {
$userid = null;
}
$data->subject .= ' ' .$artefact->get('title');
if (empty($data->url)) {
// @todo this might change later
$data->url = get_config('wwwroot') . 'view/view.php?artefact='
......@@ -203,7 +207,12 @@ function handle_activity($activitytype, $data, $cron=false) {
$data->url = get_config('wwwroot') . 'view/view.php?view=' . $data->view;
}
}
$users = activity_get_users($activitytype->name, array($userid));
if ($userid) {
$users = activity_get_users($activitytype->name, array($userid));
}
else {
$users = array();
}
break;
// and now the harder ones
case 'watchlist':
......
......@@ -100,6 +100,10 @@ if (!insert_record('view_feedback', $data)) {
$f->delete();
}
require_once('activity.php');
activity_occurred('feedback', $data);
redirect(get_config('wwwroot') . 'view/view.php?view=' . $viewid);
?>
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