</td>
</tr>
+<tr valign="top">
+ <td align="right">messaging:</td>
+ <td>
+ <?php
+ unset($options);
+ $options[0] = get_string("no");
+ $options[1] = get_string("yes");
+
+ choose_from_menu ($options, "messaging", $config->messaging, "", "", "");
+ ?>
+ </td>
+ <td>
+ <?php print_string("configmessaging") ?>
+ </td>
+</tr>
+
<tr>
<td colspan="3" align="center">
<input type="hidden" name="sesskey" value="<?php p($sesskey) ?>" />
$this->content->text = '';
$this->content->footer = '';
- if (empty($this->instance) or empty($USER->id) or isguest()) {
+ if (empty($this->instance) or empty($USER->id) or isguest() or empty($CFG->messaging)) {
return $this->content;
}
$this->content->text .= '<img src="'.$CFG->pixpath.'/i/user.gif" style="height: 16px; width:16px; vertical-align: middle;" alt="" /> ';
}
$this->content->text .= '<a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&course='.$this->instance->pageid.'" title="'.$timeago.'">'.$user->fullname.'</a>';
- if (!empty($USER->id)) { // Only when logged in
+ if (!empty($USER->id) and ($USER->id != $user->id) and !empty($CFG->messaging)) { // Only when logged in
$this->content->text .= ' <a target="message_'.$user->id.'" href="'.$CFG->wwwroot.'/message/user.php?id='.$user->id.'" onclick="return openpopup(\'/message/user.php?id='.$user->id.'\', \'message_'.$user->id.'\', \'menubar=0,location=0,scrollbars,status,resizable,width=400,height=500\', 0);"><img height="11" width="11" src="'.$CFG->pixpath.'/t/message.gif"></a>';
}
$this->content->text .= '</div>';
$string['configlongtimenosee'] = 'If students haven\'t logged in for a very long time, then they are automatically unsubscribed from courses. This parameter specifies that time limit.';
$string['configmaxbytes'] = 'This specifies a maximum size that uploaded files can be throughout the whole site. This setting is limited by the PHP setting upload_max_filesize and the Apache setting LimitRequestBody. In turn, maxbytes limits the range of sizes that can be chosen at course level or module level.';
$string['configmaxeditingtime'] = 'This specifies the amount of time people have to re-edit forum postings, journal feedback etc. Usually 30 minutes is a good value.';
+$string['configmessaging'] = 'Should the messaging system between site users be enabled?';
$string['confignoreplyaddress'] = 'Emails are sometimes sent out on behalf of a user (eg forum posts). The email address you specify here will be used as the \"From\" address in those cases when the recipients should not be able to reply directly to the user (eg when a user chooses to keep their address private).';
$string['confignotifyloginfailures'] = 'If login failures have been recorded, email notifications can be sent out. Who should see these notifications?';
$string['confignotifyloginthreshold'] = 'If notifications about failed logins are active, how many failed login attempts by one user or one IP address is it worth notifying about?';
'longtimenosee' => 100,
'maxbytes' => 0,
'maxeditingtime' => 1800,
+ 'messaging' => true,
'noreplyaddress' => 'noreply@'.$_SERVER['HTTP_HOST'],
'notifyloginfailures' => '',
'notifyloginthreshold' => 10,
include ($CFG->dirroot .'/theme/'. $CFG->theme .'/header.html');
- echo message_popup_window();
+ if (!empty($CFG->messaging)) {
+ echo message_popup_window();
+ }
}
/**
require_login();
+ if (empty($CFG->messaging)) {
+ error("Messaging is disabled on this site");
+ }
+
/// Script parameters
$userid1 = required_param('user1', PARAM_INT);
if (! $user1 = get_record("user", "id", $userid1)) { // Check it's correct
require_login(0, false);
+ if (empty($CFG->messaging)) {
+ error("Messaging is disabled on this site");
+ }
+
/// Optional variables that may be passed in
$tab = optional_param('tab', 'contacts'); // current tab - default to contacts
$addcontact = optional_param('addcontact', 0, PARAM_INT); // adding a contact
require_login();
+ if (empty($CFG->messaging)) {
+ error("Messaging is disabled on this site");
+ }
+
/// Script parameters
$userid = required_param('id', PARAM_INT);
$frame = optional_param('frame', '', PARAM_ALPHA);
echo "<input type=\"submit\" value=\"".get_string("loginas")."\" />";
echo "</form></td>";
}
- if ($USER->id == $user->id) {
- if ($countmessages = count_records('message', 'useridto', $user->id)) {
- $messagebuttonname = get_string("messages", "message")."($countmessages)";
+ if (!empty($CFG->messaging)) {
+ if ($USER->id == $user->id) {
+ if ($countmessages = count_records('message', 'useridto', $user->id)) {
+ $messagebuttonname = get_string("messages", "message")."($countmessages)";
+ } else {
+ $messagebuttonname = get_string("messages", "message");
+ }
+ echo "<td nowrap=\"nowrap\"><form target=\"message\" action=\"../message/index.php\" method=\"get\">";
+ echo "<input type=\"submit\" value=\"$messagebuttonname\" onclick=\"return openpopup('/message/index.php', 'message', 'menubar=0,location=0,scrollbars,status,resizable,width=400,height=500', 0);\" />";
+ echo "</form></td>";
} else {
- $messagebuttonname = get_string("messages", "message");
+ echo "<td nowrap=\"nowrap\"><form target=\"message_$user->id\" action=\"../message/user.php\" method=\"get\">";
+ echo "<input type=\"hidden\" name=\"id\" value=\"$user->id\" />";
+ echo "<input type=\"submit\" value=\"".get_string("sendmessage", "message")."\" onclick=\"return openpopup('/message/user.php?id=$user->id', 'message_$user->id', 'menubar=0,location=0,scrollbars,status,resizable,width=400,height=500', 0);\" />";
+ echo "</form></td>";
}
- echo "<td nowrap=\"nowrap\"><form target=\"message\" action=\"../message/index.php\" method=\"get\">";
- echo "<input type=\"submit\" value=\"$messagebuttonname\" onclick=\"return openpopup('/message/index.php', 'message', 'menubar=0,location=0,scrollbars,status,resizable,width=400,height=500', 0);\" />";
- echo "</form></td>";
- } else {
- echo "<td nowrap=\"nowrap\"><form target=\"message_$user->id\" action=\"../message/user.php\" method=\"get\">";
- echo "<input type=\"hidden\" name=\"id\" value=\"$user->id\" />";
- echo "<input type=\"submit\" value=\"".get_string("sendmessage", "message")."\" onclick=\"return openpopup('/message/user.php?id=$user->id', 'message_$user->id', 'menubar=0,location=0,scrollbars,status,resizable,width=400,height=500', 0);\" />";
- echo "</form></td>";
}
echo "<td></td>";
echo "</tr></table></center>\n";