Commit 9efe9ec8 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Merge branch 'master' of git+ssh://git.mahara.org/git/mahara

parents 53d2f535 4d860976
......@@ -219,6 +219,7 @@ function adduser_submit(Pieform $form, $values) {
$user->id = create_user($user, array(), $authinstance->institution, $authinstance, $values['remoteusername']);
if (isset($user->admin) && $user->admin) {
require_once('activity.php');
activity_add_admin_defaults(array($user->id));
}
......
......@@ -35,6 +35,7 @@ define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'admin');
define('SECTION_PAGE', 'adminusers');
require_once('pieforms/pieform.php');
require_once('activity.php');
$smarty = smarty();
// Get users who are currently administrators
......
......@@ -32,6 +32,7 @@ define('TITLE', get_string('accountsettings', 'admin'));
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'admin');
require_once('pieforms/pieform.php');
require_once('activity.php');
$id = param_integer('id');
$user = new User;
......
......@@ -95,6 +95,7 @@ function adminusers_submit(Pieform $form, $values) {
SET admin = 1
WHERE usr IN (' . join(',', $values['users']) . ') AND institution = ' . db_quote($inst));
}
require_once('activity.php');
activity_add_admin_defaults($values['users']);
db_commit();
$SESSION->add_ok_msg(get_string('adminusersupdated', 'admin'));
......
......@@ -35,6 +35,7 @@ define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'admin');
define('SECTION_PAGE', 'staffusers');
require_once('pieforms/pieform.php');
require_once('activity.php');
$smarty = smarty();
// Get users who are currently staff
......
......@@ -938,6 +938,7 @@ function artefact_instance_from_type($artefact_type, $user_id=null) {
function artefact_watchlist_notification($artefactid) {
// gets all the views containing this artefact or a parent of this artefact and creates a watchlist activity for each view
if ($views = get_column_sql('SELECT DISTINCT view FROM {view_artefact} WHERE artefact IN (' . implode(',', array_merge(array_keys(artefact_get_parents_for_cache($artefactid)), array($artefactid))) . ')')) {
require_once('activity.php');
foreach ($views as $view) {
activity_occurred('watchlist', (object)array('view' => $view));
}
......
......@@ -41,12 +41,15 @@ if (!$user) {
}
if ($group->jointype != 'invite'
|| record_exists('group_member', 'group', $groupid, 'member', $userid)
|| record_exists('group_member_invite', 'group', $groupid, 'member', $userid)
|| group_user_access($groupid) != 'admin') {
throw new AccessDeniedException(get_string('cannotinvitetogroup', 'group'));
}
if (record_exists('group_member', 'group', $groupid, 'member', $userid)
|| record_exists('group_member_invite', 'group', $groupid, 'member', $userid)) {
throw new UserException(get_string('useralreadyinvitedtogroup', 'group'));
}
define('TITLE', get_string('invitemembertogroup', 'group', display_name($userid), $group->name));
$roles = group_get_role_info($groupid);
......@@ -54,6 +57,7 @@ foreach ($roles as $k => &$v) {
$v = $v->display;
}
safe_require('grouptype', $group->grouptype);
$form = pieform(array(
'name' => 'invitetogroup',
'autofocus' => false,
......@@ -69,6 +73,7 @@ $form = pieform(array(
'type' => 'select',
'options' => $roles,
'title' => get_string('Role', 'group'),
'defaultvalue' => call_static_method('GroupType' . $group->grouptype, 'default_role'),
),
'submit' => array(
'type' => 'submitcancel',
......@@ -93,6 +98,7 @@ function invitetogroup_submit(Pieform $form, $values) {
$data->role = $values['role'];
insert_record('group_member_invite', $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'),
......
......@@ -244,6 +244,7 @@ $string['addusertogroup'] = 'Add to ';
$string['inviteusertojoingroup'] = 'Invite to ';
$string['invitemembertogroup'] = 'Invite %s to join \'%s\'';
$string['cannotinvitetogroup'] = 'You can\'t invite this user to this group';
$string['useralreadyinvitedtogroup'] = 'This user has already been invited to, or is already a member of, this group.';
$string['removefriend'] = 'Remove friend';
$string['denyfriendrequestlower'] = 'Deny friend request';
......
......@@ -261,6 +261,7 @@ class Institution {
delete_records('usr_institution_request', 'usr', $userinst->usr, 'institution', $this->name);
// Copy institution views to the user's portfolio
copy_views_for_user($user->id, get_column('view', 'id', 'institution', $this->name, 'copynewuser', 1));
require_once('activity.php');
activity_occurred('maharamessage', $message);
handle_event('updateuser', $userinst->usr);
db_commit();
......@@ -287,6 +288,7 @@ class Institution {
delete_records('usr_institution_request', 'usr', $user->id);
}
insert_record('usr_institution_request', $request);
require_once('activity.php');
activity_occurred('institutionmessage', $message);
handle_event('updateuser', $user->id);
db_commit();
......@@ -305,6 +307,7 @@ class Institution {
db_begin();
delete_records('usr_institution_request', 'usr', $userid, 'institution', $this->name,
'confirmedusr', 1);
require_once('activity.php');
activity_occurred('maharamessage', $message);
handle_event('updateuser', $userid);
db_commit();
......@@ -319,6 +322,7 @@ class Institution {
'confirmedinstitution' => 1,
'ctime' => db_format_timestamp(time())
));
require_once('activity.php');
activity_occurred('institutionmessage', (object) array(
'messagetype' => 'invite',
'users' => array($userid),
......
......@@ -638,6 +638,7 @@ function suspend_user($suspendeduserid, $reason, $suspendinguserid=null) {
$message->users = array($suspendeduserid);
$message->subject = get_string_from_language($lang, 'youraccounthasbeensuspended');
$message->message = get_string_from_language($lang, 'youraccounthasbeensuspendedtext');
require_once('activity.php');
activity_occurred('maharamessage', $message);
handle_event('suspenduser', $suspendeduserid);
......@@ -661,6 +662,7 @@ function unsuspend_user($userid) {
$message->users = array($userid);
$message->subject = get_string_from_language($lang, 'youraccounthasbeenunsuspended');
$message->message = get_string_from_language($lang, 'youraccounthasbeenunsuspendedtext');
require_once('activity.php');
activity_occurred('maharamessage', $message);
handle_event('unsuspenduser', $userid);
......@@ -818,6 +820,7 @@ function send_user_message($to, $message, $from=null) {
$messagepref = get_account_preference($to->id, 'messages');
if ((is_friend($from->id, $to->id) && $messagepref == 'friends') || $messagepref == 'allow' || $from->get('admin')) {
require_once('activity.php');
activity_occurred('usermessage',
array(
'userto' => $to->id,
......@@ -1122,6 +1125,7 @@ function addfriend_submit(Pieform $form, $values) {
$n->subject = get_string_from_language($lang, 'addedtofriendslistsubject', 'group');
$n->message = get_string_from_language($lang, 'addedtofriendslistmessage', 'group', $displayname, $displayname);
require_once('activity.php');
activity_occurred('maharamessage', $n);
$SESSION->add_ok_msg(get_string('friendformaddsuccess', 'group', display_name($user)));
redirect('/user/view.php?id=' . $values['id']);
......
......@@ -318,7 +318,7 @@ class View {
public function set_access($accessdata) {
global $USER;
require_once(get_config('libroot') . 'activity.php');
require_once('activity.php');
// For users who are being removed from having access to this view, they
// need to have the view and any attached artefacts removed from their
......@@ -623,6 +623,7 @@ class View {
$data = (object)array(
'view' => $this->get('id'),
);
require_once('activity.php');
activity_occurred('watchlist', $data);
if (!defined('JSON')) {
......
......@@ -2,7 +2,6 @@
{include file="sidebar.tpl"}
{include file="columnleftstart.tpl"}
<h2>{$heading|escape}</h2>
{include file="group/simplegroup.tpl" group=$GROUP}
{$form}
{include file="columnleftend.tpl"}
......
......@@ -91,6 +91,7 @@ function denyrequest_submit(Pieform $form, $values) {
else {
$n->message = get_string_from_language($lang, 'friendrequestrejectedmessage', 'group', $displayname);
}
require_once('activity.php');
activity_occurred('maharamessage', $n);
$SESSION->add_ok_msg(get_string('friendformrejectsuccess', 'group'));
switch (param_alpha('returnto', 'myfriends')) {
......
......@@ -91,6 +91,7 @@ function removefriend_submit(Pieform $form, $values) {
else {
$n->message = get_string_from_language($lang, 'removedfromfriendslistmessage', 'group', $displayname);
}
require_once('activity.php');
activity_occurred('maharamessage', $n);
$SESSION->add_ok_msg(get_string('friendformremovesuccess', 'group', display_name($id)));
......
......@@ -96,6 +96,7 @@ function requestfriendship_submit(Pieform $form, $values) {
else {
$n->message = get_string_from_language($lang, 'requestedfriendlistmessage', 'group', $displayname);
}
require_once('activity.php');
activity_occurred('maharamessage', $n);
$SESSION->add_ok_msg(get_string('friendformrequestsuccess', 'group', display_name($id)));
......
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