Commit eac65fdb authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Add more useful link text for the rest of the notifications


Signed-off-by: default avatarRichard Mansfield <richardm@catalyst.net.nz>
parent e20e5280
......@@ -921,10 +921,8 @@ class ActivityTypeArtefactCommentFeedback extends ActivityTypePlugin {
'section' => 'artefact.comment',
'args' => array($title),
),
'urltext' => (object) array(
'key' => empty($onartefact) ? 'view' : 'artefact',
),
);
$this->urltext = $title;
if ($deletedby) {
$deletedmessage = ArtefactTypeComment::deleted_messages();
......
......@@ -100,7 +100,14 @@ function requestjoingroup_submit(Pieform $form, $values) {
'users' => array($groupadmin),
'subject' => get_string_from_language($adminlang, 'grouprequestsubject', 'group'),
'message' => $message,
'url' => get_config('wwwroot') . 'group/members.php?id=' . $group->id . '&membershiptype=request'));
'url' => get_config('wwwroot') . 'group/members.php?id=' . $group->id . '&membershiptype=request',
'strings' => (object) array(
'urltext' => (object) array(
'key' => 'pendingmembers',
'section' => 'group',
),
),
));
}
$SESSION->add_ok_msg(get_string('grouprequestsent', 'group'));
redirect($goto);
......
......@@ -294,6 +294,7 @@ abstract class ActivityType {
protected $strings;
protected $users = array();
protected $url;
protected $urltext;
protected $id;
protected $type;
protected $activityname;
......@@ -369,6 +370,13 @@ abstract class ActivityType {
$this->strings->urltext = (object) $stringdef;
}
public function get_urltext($user) {
if (empty($this->urltext)) {
return $this->get_string_for_user($user, 'urltext');
}
return $this->urltext;
}
public function get_message($user) {
if (empty($this->message)) {
return $this->get_string_for_user($user, 'message');
......@@ -398,7 +406,7 @@ abstract class ActivityType {
if (!empty($user->url)) {
$userdata->url = $user->url;
}
$userdata->urltext = $this->get_string_for_user($user, 'urltext');
$userdata->urltext = $this->get_urltext($user);
if (empty($user->lang) || $user->lang == 'default') {
$user->lang = get_config('lang');
}
......@@ -612,9 +620,11 @@ class ActivityTypeInstitutionmessage extends ActivityType {
$this->url = get_config('wwwroot') . 'admin/users/institutionusers.php';
$this->users = activity_get_users($this->get_id(), null, null, null,
array($this->institution->name));
$this->add_urltext(array('key' => 'institutionmembers', 'section' => 'admin'));
} else if ($this->messagetype == 'invite') {
$this->url = get_config('wwwroot') . 'account/institutions.php';
$this->users = activity_get_users($this->get_id(), $this->users);
$this->add_urltext(array('key' => 'institutionmembership', 'section' => 'mahara'));
}
}
......
......@@ -456,12 +456,13 @@ function group_invite_user($group, $userid, $userfrom, $role='member') {
ensure_record_exists('group_member_invite', $data, $data);
$lang = get_user_language($user->id);
require_once('activity.php');
activity_occurred('maharamessage',
array('users' => array($user->id),
'subject' => get_string_from_language($lang, 'invitetogroupsubject', 'group'),
'message' => get_string_from_language($lang, 'invitetogroupmessage', 'group', display_name($userfrom, $user), $group->name),
'url' => get_config('wwwroot')
. 'group/view.php?id=' . $group->id));
activity_occurred('maharamessage', array(
'users' => array($user->id),
'subject' => get_string_from_language($lang, 'invitetogroupsubject', 'group'),
'message' => get_string_from_language($lang, 'invitetogroupmessage', 'group', display_name($userfrom, $user), $group->name),
'url' => get_config('wwwroot') . 'group/view.php?id=' . $group->id,
'urltext' => $group->name,
));
}
// Pieforms for various operations on groups
......
......@@ -1523,6 +1523,7 @@ function acceptfriend_submit(Pieform $form, $values) {
redirect('/user/view.php?id=' . $values['id']);
}
// Called when a user adds someone who has friendscontrol set to 'auto'
function addfriend_submit(Pieform $form, $values) {
global $USER, $SESSION;
$user = get_record('usr', 'id', $values['id']);
......@@ -1540,6 +1541,7 @@ function addfriend_submit(Pieform $form, $values) {
$n->users = array($user->id);
$lang = get_user_language($user->id);
$displayname = display_name($USER, $user);
$n->urltext = $displayname;
$f->usr1 = $values['id'];
$f->usr2 = $loggedinid;
......
......@@ -760,6 +760,7 @@ class View {
'message' => get_string_from_language($ownerlang, 'viewreleasedmessage', 'group', $this->get('title'),
$submitinfo['name'], display_name($releaseuser, $this->get_owner_object())),
'url' => $url,
'urltext' => $this->get('title'),
)
);
}
......
......@@ -83,6 +83,7 @@ function denyrequest_submit(Pieform $form, $values) {
$n->users = array($user->id);
$lang = get_user_language($user->id);
$displayname = display_name($USER, $user);
$n->urltext = $displayname;
delete_records('usr_friend_request', 'owner', $loggedinid, 'requester', $id);
$n->subject = get_string_from_language($lang, 'friendrequestrejectedsubject', 'group');
......
......@@ -81,6 +81,7 @@ function removefriend_submit(Pieform $form, $values) {
$n->users = array($user->id);
$lang = get_user_language($user->id);
$displayname = display_name($USER, $user);
$n->urltext = $displayname;
delete_records_select('usr_friend', '(usr1 = ? AND usr2 = ?) OR (usr2 = ? AND usr1 = ?)',
array($id, $loggedinid, $id, $loggedinid));
......
......@@ -85,6 +85,7 @@ function requestfriendship_submit(Pieform $form, $values) {
$n->users = array($user->id);
$lang = get_user_language($user->id);
$displayname = display_name($USER, $user);
$n->strings->urltext = (object) array('key' => 'Requests');
$f->owner = $id;
$f->requester = $loggedinid;
......
......@@ -333,11 +333,13 @@ function addmember_submit(Pieform $form, $values) {
delete_records('group_member_request', 'member', $userid, 'group', $data->group);
$lang = get_user_language($userid);
require_once(get_config('libroot') . 'activity.php');
activity_occurred('maharamessage',
array('users' => array($userid),
'subject' => get_string_from_language($lang, 'addedtogroupsubject', 'group'),
'message' => get_string_from_language($lang, 'addedtogroupmessage', 'group', display_name($USER, $adduser), $ctitle),
'url' => get_config('wwwroot') . 'group/view.php?id=' . $values['group']));
activity_occurred('maharamessage', array(
'users' => array($userid),
'subject' => get_string_from_language($lang, 'addedtogroupsubject', 'group'),
'message' => get_string_from_language($lang, 'addedtogroupmessage', 'group', display_name($USER, $adduser), $ctitle),
'url' => get_config('wwwroot') . 'group/view.php?id=' . $values['group'],
'urltext' => $ctitle,
));
$SESSION->add_ok_msg(get_string('useradded', 'group'));
}
catch (SQLException $e) {
......
......@@ -84,6 +84,9 @@ function submitview_submit(Pieform $form, $values) {
'viewowner' => $USER->get('id'),
'group' => $groupid,
'roles' => get_column('grouptype_roles', 'role', 'grouptype', $group->grouptype, 'see_submitted_views', 1),
'strings' => (object) array(
'urltext' => (object) array('key' => 'view'),
),
));
db_commit();
$SESSION->add_ok_msg(get_string('viewsubmitted', 'view'));
......
Markdown is supported
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