MDL-17472 notes: backported disabling of notes and general refactoring from HEAD
This commit is contained in:
@@ -54,6 +54,7 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
$temp->add(new admin_setting_configtext('minpasswordnonalphanum', get_string('minpasswordnonalphanum', 'admin'), get_string('configminpasswordnonalphanum', 'admin'), 1, PARAM_INT));
|
||||
$temp->add(new admin_setting_configcheckbox('disableuserimages', get_string('disableuserimages', 'admin'), get_string('configdisableuserimages', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('emailchangeconfirmation', get_string('emailchangeconfirmation', 'admin'), get_string('configemailchangeconfirmation', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('enablenotes', get_string('enablenotes', 'notes'), get_string('configenablenotes', 'notes'), 1));
|
||||
$ADMIN->add('security', $temp);
|
||||
|
||||
|
||||
|
||||
+14
-10
@@ -1,28 +1,32 @@
|
||||
<?PHP // $Id$
|
||||
// note.php
|
||||
|
||||
$string['addnewnote'] = 'Add a new note';
|
||||
// note.php
|
||||
$string['addnewnote'] = 'Add a new note';
|
||||
$string['addnewnoteselect'] = 'Select users to write notes about';
|
||||
$string['bynameondate'] = 'by $a->name - $a->date';
|
||||
$string['cannotdeletepost'] = 'Error occured while deleting post';
|
||||
$string['configenablenotes'] = 'Enable storing of notes about individual users.';
|
||||
$string['content'] = 'Content';
|
||||
$string['course'] = 'course';
|
||||
$string['coursenotes'] = 'Course notes';
|
||||
$string['created'] = 'created';
|
||||
$string['deleteconfirm'] = 'Delete this note?';
|
||||
$string['coursenotes'] = 'Course notes';
|
||||
$string['deletenotes'] = 'Delete all notes';
|
||||
$string['deleteconfirm'] = 'Delete this note?';
|
||||
$string['editnote'] = 'Edit note';
|
||||
$string['enablenotes'] = 'Enable notes';
|
||||
$string['invalidid'] = 'Invalid note ID specified';
|
||||
$string['groupaddnewnote'] = 'Add a common note';
|
||||
$string['nocontent'] = 'Note content can not be empty';
|
||||
$string['nonotes'] = 'There are no notes of this type yet';
|
||||
$string['note'] = 'Note';
|
||||
$string['notes'] = 'Notes';
|
||||
$string['nonotes'] = 'There are no notes of this type yet';
|
||||
$string['nopermissiontodelete'] = 'You may not delete this note';
|
||||
$string['notesdisabled'] = 'Notes are disabled, sorry.';
|
||||
$string['notesnotvisible'] = 'You are not allowed to view the notes.';
|
||||
$string['nocontent'] = 'Note content can not be empty';
|
||||
$string['nouser'] = 'You must select a user';
|
||||
$string['personal'] = 'personal';
|
||||
$string['personalnotes'] = 'Personal notes';
|
||||
$string['publishstate'] = 'Status';
|
||||
$string['personal'] = 'personal';
|
||||
$string['unknown'] = 'unknown';
|
||||
$string['site'] = 'site';
|
||||
$string['sitenotes'] = 'Site notes';
|
||||
$string['unknown'] = 'unknown';
|
||||
|
||||
?>
|
||||
|
||||
+1
-1
@@ -4535,7 +4535,7 @@ has_capability('moodle/course:viewhiddenuserfields', $context)) {
|
||||
$output .= '<a href="'.$CFG->wwwroot.'/blog/index.php?userid='.$user->id.'">'.get_string('blogs','blog').'</a><br />';
|
||||
}
|
||||
//link to notes
|
||||
if (has_capability('moodle/notes:manage', $context) || has_capability('moodle/notes:view', $context)) {
|
||||
if (!empty($CFG->enablenotes) and (has_capability('moodle/notes:manage', $context) || has_capability('moodle/notes:view', $context))) {
|
||||
$output .= '<a href="'.$CFG->wwwroot.'/notes/index.php?course=' . $course->id. '&user='.$user->id.'">'.get_string('notes','notes').'</a><br />';
|
||||
}
|
||||
|
||||
|
||||
+2
-76
@@ -1,85 +1,11 @@
|
||||
<?php // $Id$
|
||||
|
||||
require_once('../config.php');
|
||||
require_once('lib.php');
|
||||
|
||||
/// retrieve parameters
|
||||
$courseid = required_param('course', PARAM_INT);
|
||||
$userid = required_param('user', PARAM_INT);
|
||||
|
||||
/// locate course information
|
||||
if (!($course = get_record('course', 'id', $courseid))) {
|
||||
error('Incorrect course id found');
|
||||
}
|
||||
redirect("edit.php?courseid=$courseid&userid=$userid");
|
||||
|
||||
/// require login to access notes
|
||||
require_login($course->id);
|
||||
|
||||
/// locate context information
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
|
||||
/// check capability
|
||||
require_capability('moodle/notes:manage', $context);
|
||||
|
||||
|
||||
/// locate user information
|
||||
if (!($user = get_record('user', 'id', $userid))) {
|
||||
error('Incorrect user id found');
|
||||
}
|
||||
|
||||
/// build-up form
|
||||
require_once('edit_form.php');
|
||||
|
||||
/// create form
|
||||
$noteform = new note_edit_form();
|
||||
|
||||
/// if form was cancelled then return to the previous notes list
|
||||
if ($noteform->is_cancelled()) {
|
||||
redirect($CFG->wwwroot . '/notes/index.php?course=' . $courseid . '&user=' . $userid);
|
||||
}
|
||||
|
||||
/// if data was submitted and validated, then save it to database
|
||||
if ($formdata = $noteform->get_data()) {
|
||||
$note = new object();
|
||||
$note->courseid = $formdata->course;
|
||||
$note->content = $formdata->content;
|
||||
$note->format = FORMAT_PLAIN;
|
||||
$note->userid = $formdata->user;
|
||||
$note->publishstate = $formdata->publishstate;
|
||||
if (note_save($note)) {
|
||||
add_to_log($note->courseid, 'notes', 'add', 'index.php?course='.$note->courseid.'&user='.$note->userid . '#note-' . $note->id , 'add note');
|
||||
}
|
||||
// redirect to notes list that contains this note
|
||||
redirect($CFG->wwwroot . '/notes/index.php?course=' . $note->courseid . '&user=' . $note->userid);
|
||||
}
|
||||
|
||||
if($noteform->is_submitted()) {
|
||||
// if data was submitted with errors, then use it as default for new form
|
||||
$note = $noteform->get_submitted_data(false);
|
||||
} else {
|
||||
// if data was not submitted yet, then use default values
|
||||
$note = new object();
|
||||
$note->id = 0;
|
||||
$note->course = $courseid;
|
||||
$note->user = $userid;
|
||||
$note->publishstate = optional_param('state', NOTES_STATE_PUBLIC, PARAM_ALPHA);
|
||||
}
|
||||
$noteform->set_data($note);
|
||||
$strnotes = get_string('addnewnote', 'notes');
|
||||
|
||||
/// output HTML
|
||||
$nav = array();
|
||||
if (has_capability('moodle/course:viewparticipants', $context) || has_capability('moodle/site:viewparticipants', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
$nav[] = array('name' => get_string('participants'), 'link' => $CFG->wwwroot . '/user/index.php?id=' . $course->id, 'type' => 'misc');
|
||||
}
|
||||
$nav[] = array('name' => fullname($user), 'link' => $CFG->wwwroot . '/user/view.php?id=' . $user->id. '&course=' . $course->id, 'type' => 'misc');
|
||||
$nav[] = array('name' => get_string('notes', 'notes'), 'link' => $CFG->wwwroot . '/notes/index.php?course=' . $course->id . '&user=' . $user->id, 'type' => 'misc');
|
||||
$nav[] = array('name' => $strnotes, 'link' => '', 'type' => 'activity');
|
||||
|
||||
print_header($course->shortname . ': ' . $strnotes, $course->fullname, build_navigation($nav));
|
||||
|
||||
print_heading(fullname($user));
|
||||
|
||||
$noteform->display();
|
||||
print_footer();
|
||||
//note: this script is not used anymore - removed from HEAD
|
||||
?>
|
||||
|
||||
+12
-7
@@ -4,7 +4,7 @@ require_once('../config.php');
|
||||
require_once('lib.php');
|
||||
|
||||
// retrieve parameters
|
||||
$noteid = required_param('note', PARAM_INT);
|
||||
$noteid = required_param('id', PARAM_INT);
|
||||
|
||||
// locate note information
|
||||
if (!$note = note_load($noteid)) {
|
||||
@@ -22,14 +22,18 @@ if (!$course = get_record('course', 'id', $note->courseid)) {
|
||||
}
|
||||
|
||||
// require login to access notes
|
||||
require_login($course->id);
|
||||
require_login($course);
|
||||
|
||||
// locate context information
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
|
||||
// check capability
|
||||
if (!has_capability('moodle/notes:manage', $context)) {
|
||||
error('You may not delete this note');
|
||||
print_error('nopermissiontodelete', 'notes');
|
||||
}
|
||||
|
||||
if (empty($CFG->enablenotes)) {
|
||||
print_error('notesdisabled', 'notes');
|
||||
}
|
||||
|
||||
if (data_submitted() && confirm_sesskey()) {
|
||||
@@ -38,14 +42,15 @@ if (data_submitted() && confirm_sesskey()) {
|
||||
if (note_delete($noteid)) {
|
||||
add_to_log($note->courseid, 'notes', 'delete', 'index.php?course='.$note->courseid.'&user='.$note->userid . '#note-' . $note->id , 'delete note');
|
||||
} else {
|
||||
error('Error occured while deleting post', $returnurl);
|
||||
print_error('cannotdeletepost', 'notes', $returnurl);
|
||||
}
|
||||
redirect($returnurl);
|
||||
|
||||
} else {
|
||||
// if data was not submitted yet, then show note data with a delete confirmation form
|
||||
$strnotes = get_string('notes', 'notes');
|
||||
$optionsyes = array('note'=>$noteid, 'sesskey'=>sesskey());
|
||||
$optionsno = array('course'=>$course->id, 'user'=>$note->userid);
|
||||
$optionsyes = array('id'=>$noteid, 'sesskey'=>sesskey());
|
||||
$optionsno = array('course'=>$course->id, 'user'=>$note->userid);
|
||||
|
||||
// output HTML
|
||||
if (has_capability('moodle/course:viewparticipants', $context) || has_capability('moodle/site:viewparticipants', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
@@ -60,4 +65,4 @@ if (data_submitted() && confirm_sesskey()) {
|
||||
note_print($note, NOTES_SHOW_BODY | NOTES_SHOW_HEAD);
|
||||
print_footer();
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
||||
+29
-27
@@ -2,13 +2,27 @@
|
||||
|
||||
require_once('../config.php');
|
||||
require_once('lib.php');
|
||||
require_once('edit_form.php');
|
||||
|
||||
/// retrieve parameters
|
||||
$noteid = required_param('note', PARAM_INT);
|
||||
$noteid = optional_param('id', 0, PARAM_INT);
|
||||
|
||||
/// locate note information
|
||||
if (!$note = note_load($noteid)) {
|
||||
error('Incorrect note id specified');
|
||||
if ($noteid) {
|
||||
//existing note
|
||||
if (!$note = note_load($noteid)) {
|
||||
print_error('invalidid', 'notes');
|
||||
}
|
||||
|
||||
} else {
|
||||
// adding new note
|
||||
$courseid = required_param('courseid', PARAM_INT);
|
||||
$userid = required_param('userid', PARAM_INT);
|
||||
$state = optional_param('publishstate', NOTES_STATE_PUBLIC, PARAM_ALPHA);
|
||||
|
||||
$note = new object();
|
||||
$note->courseid = $courseid;
|
||||
$note->userid = $userid;
|
||||
$note->publishstate = $state;
|
||||
}
|
||||
|
||||
/// locate course information
|
||||
@@ -22,34 +36,29 @@
|
||||
}
|
||||
|
||||
/// require login to access notes
|
||||
require_login($course->id);
|
||||
require_login($course);
|
||||
|
||||
/// locate context information
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
|
||||
/// check capability
|
||||
require_capability('moodle/notes:manage', $context);
|
||||
|
||||
/// build-up form
|
||||
require_once('edit_form.php');
|
||||
|
||||
/// get option values for the user select
|
||||
if (empty($CFG->enablenotes)) {
|
||||
print_error('notesdisabled', 'notes');
|
||||
}
|
||||
|
||||
/// create form
|
||||
$noteform = new note_edit_form();
|
||||
|
||||
/// set defaults
|
||||
$noteform->set_data($note);
|
||||
|
||||
/// if form was cancelled then return to the notes list of the note
|
||||
if ($noteform->is_cancelled()) {
|
||||
redirect($CFG->wwwroot . '/notes/index.php?course=' . $note->courseid . '&user=' . $note->userid);
|
||||
}
|
||||
|
||||
/// if data was submitted and validated, then save it to database
|
||||
if ($formdata = $noteform->get_data()){
|
||||
$note->courseid = $formdata->course;
|
||||
$note->userid = $formdata->user;
|
||||
$note->content = $formdata->content;
|
||||
$note->format = FORMAT_PLAIN;
|
||||
$note->publishstate = $formdata->publishstate;
|
||||
if ($note = $noteform->get_data()){
|
||||
if (note_save($note)) {
|
||||
add_to_log($note->courseid, 'notes', 'update', 'index.php?course='.$note->courseid.'&user='.$note->userid . '#note-' . $note->id, 'update note');
|
||||
}
|
||||
@@ -57,18 +66,11 @@
|
||||
redirect($CFG->wwwroot . '/notes/index.php?course=' . $note->courseid . '&user=' . $note->userid);
|
||||
}
|
||||
|
||||
|
||||
if ($noteform->is_submitted()) {
|
||||
// if data was submitted with errors, then use it as default for new form
|
||||
$note = $noteform->get_submitted_data(false);
|
||||
if ($noteid) {
|
||||
$strnotes = get_string('editnote', 'notes');
|
||||
} else {
|
||||
// if data was not submitted yet, then used values retrieved from the database
|
||||
$note->user = $note->userid;
|
||||
$note->course = $note->courseid;
|
||||
$note->note = $note->id;
|
||||
$strnotes = get_string('addnewnote', 'notes');
|
||||
}
|
||||
$noteform->set_data($note);
|
||||
$strnotes = get_string('editnote', 'notes');
|
||||
|
||||
/// output HTML
|
||||
$nav = array();
|
||||
|
||||
+4
-4
@@ -21,14 +21,14 @@ class note_edit_form extends moodleform {
|
||||
|
||||
$this->add_action_buttons();
|
||||
|
||||
$mform->addElement('hidden', 'course');
|
||||
$mform->addElement('hidden', 'courseid');
|
||||
$mform->setType('course', PARAM_INT);
|
||||
|
||||
$mform->addElement('hidden', 'user');
|
||||
$mform->addElement('hidden', 'userid');
|
||||
$mform->setType('user', PARAM_INT);
|
||||
|
||||
$mform->addElement('hidden', 'note');
|
||||
$mform->setType('note', PARAM_INT);
|
||||
$mform->addElement('hidden', 'id');
|
||||
$mform->setType('id', PARAM_INT);
|
||||
}
|
||||
}
|
||||
?>
|
||||
+6
-3
@@ -51,9 +51,12 @@
|
||||
}
|
||||
|
||||
/// require login to access notes
|
||||
require_login($course->id);
|
||||
require_login($course);
|
||||
add_to_log($courseid, 'notes', 'view', 'index.php?course='.$courseid.'&user='.$userid, 'view notes');
|
||||
|
||||
if (empty($CFG->enablenotes)) {
|
||||
print_error('notesdisabled', 'notes');
|
||||
}
|
||||
|
||||
/// output HTML
|
||||
if ($course->id == SITEID) {
|
||||
@@ -62,7 +65,7 @@
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id); // Course context
|
||||
}
|
||||
$systemcontext = get_context_instance(CONTEXT_SYSTEM); // SYSTEM context
|
||||
|
||||
|
||||
$strnotes = get_string('notes', 'notes');
|
||||
$nav = array();
|
||||
if (has_capability('moodle/course:viewparticipants', $coursecontext) || has_capability('moodle/site:viewparticipants', $systemcontext)) {
|
||||
@@ -77,7 +80,7 @@
|
||||
|
||||
$showroles = 1;
|
||||
$currenttab = 'notes';
|
||||
require_once($CFG->dirroot .'/user/tabs.php');
|
||||
require($CFG->dirroot .'/user/tabs.php');
|
||||
|
||||
$strsitenotes = get_string('sitenotes', 'notes');
|
||||
$strcoursenotes = get_string('coursenotes', 'notes');
|
||||
|
||||
+25
-20
@@ -74,22 +74,23 @@ function note_load($note_id) {
|
||||
*/
|
||||
function note_save(&$note) {
|
||||
global $USER;
|
||||
|
||||
// setup & clean fields
|
||||
$note->module = 'notes';
|
||||
$note->module = 'notes';
|
||||
$note->lastmodified = time();
|
||||
$note->usermodified = $USER->id;
|
||||
if(empty($note->format)) {
|
||||
if (empty($note->format)) {
|
||||
$note->format = FORMAT_PLAIN;
|
||||
}
|
||||
if(empty($note->publishstate)) {
|
||||
if (empty($note->publishstate)) {
|
||||
$note->publishstate = NOTES_STATE_PUBLIC;
|
||||
}
|
||||
// save data
|
||||
if(empty($note->id)) {
|
||||
if (empty($note->id)) {
|
||||
// insert new note
|
||||
$note->created = $note->lastmodified;
|
||||
if($id = insert_record('post', $note)) {
|
||||
$note->id = $id;
|
||||
if ($id = insert_record('post', $note)) {
|
||||
$note = addslashes_recursive(get_record('post', 'id', $id));
|
||||
$result = true;
|
||||
} else {
|
||||
$result = false;
|
||||
@@ -124,7 +125,11 @@ function note_get_state_name($state) {
|
||||
if (empty($states)) {
|
||||
$states = note_get_state_names();
|
||||
}
|
||||
return @$states[$state];
|
||||
if (isset($states[$state])) {
|
||||
return $states[$state];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -147,8 +152,8 @@ function note_get_state_names() {
|
||||
* @param int $detail OR-ed NOTES_SHOW_xyz flags that specify which note parts to print
|
||||
*/
|
||||
function note_print($note, $detail = NOTES_SHOW_FULL) {
|
||||
|
||||
global $CFG, $USER;
|
||||
|
||||
if (!$user = get_record('user','id',$note->userid)) {
|
||||
debugging("User $note->userid not found");
|
||||
return;
|
||||
@@ -158,9 +163,9 @@ function note_print($note, $detail = NOTES_SHOW_FULL) {
|
||||
return;
|
||||
}
|
||||
$context = get_context_instance(CONTEXT_COURSE, $note->courseid);
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
|
||||
$authoring = new object;
|
||||
$authoring = new object();
|
||||
$authoring->name = '<a href="'.$CFG->wwwroot.'/user/view.php?id='.$author->id.'&course='.$note->courseid.'">'.fullname($author).'</a>';
|
||||
$authoring->date = userdate($note->lastmodified);
|
||||
|
||||
@@ -169,7 +174,7 @@ function note_print($note, $detail = NOTES_SHOW_FULL) {
|
||||
'" id="note-'. $note->id .'">';
|
||||
|
||||
// print note head (e.g. author, user refering to, etc)
|
||||
if($detail & NOTES_SHOW_HEAD) {
|
||||
if ($detail & NOTES_SHOW_HEAD) {
|
||||
echo '<div class="header">';
|
||||
echo '<div class="user">';
|
||||
print_user_picture($user, $note->courseid, $user->picture);
|
||||
@@ -181,19 +186,19 @@ function note_print($note, $detail = NOTES_SHOW_FULL) {
|
||||
}
|
||||
|
||||
// print note content
|
||||
if($detail & NOTES_SHOW_BODY) {
|
||||
if ($detail & NOTES_SHOW_BODY) {
|
||||
echo '<div class="content">';
|
||||
echo format_text($note->content, $note->format);
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
// print note options (e.g. delete, edit)
|
||||
if($detail & NOTES_SHOW_FOOT) {
|
||||
if (has_capability('moodle/notes:manage', $sitecontext) && $note->publishstate == NOTES_STATE_SITE ||
|
||||
if ($detail & NOTES_SHOW_FOOT) {
|
||||
if (has_capability('moodle/notes:manage', $systemcontext) && $note->publishstate == NOTES_STATE_SITE ||
|
||||
has_capability('moodle/notes:manage', $context) && ($note->publishstate == NOTES_STATE_PUBLIC || $note->usermodified == $USER->id)) {
|
||||
echo '<div class="footer"><p>';
|
||||
echo '<a href="'.$CFG->wwwroot.'/notes/edit.php?note='.$note->id. '">'. get_string('edit') .'</a> | ';
|
||||
echo '<a href="'.$CFG->wwwroot.'/notes/delete.php?note='.$note->id. '">'. get_string('delete') .'</a>';
|
||||
echo '<a href="'.$CFG->wwwroot.'/notes/edit.php?id='.$note->id. '">'. get_string('edit') .'</a> | ';
|
||||
echo '<a href="'.$CFG->wwwroot.'/notes/delete.php?id='.$note->id. '">'. get_string('delete') .'</a>';
|
||||
echo '</p></div>';
|
||||
}
|
||||
}
|
||||
@@ -227,22 +232,22 @@ function note_print_list($notes, $detail = NOTES_SHOW_FULL) {
|
||||
* @param string $state state of the notes (i.e. draft, public, site) ('' means any)
|
||||
* @param int $author id of the user who modified the note last time (0 means any)
|
||||
*/
|
||||
function note_print_notes($header, $addcourseid = 0, $viewnotes = true, $courseid = 0, $userid = 0, $state = '', $author = 0)
|
||||
{
|
||||
function note_print_notes($header, $addcourseid = 0, $viewnotes = true, $courseid = 0, $userid = 0, $state = '', $author = 0) {
|
||||
global $CFG;
|
||||
|
||||
if ($header) {
|
||||
echo '<h3 class="notestitle">' . $header . '</h3>';
|
||||
echo '<div class="notesgroup">';
|
||||
}
|
||||
if ($addcourseid) {
|
||||
if ($userid) {
|
||||
echo '<p><a href="'. $CFG->wwwroot .'/notes/add.php?course=' . $addcourseid . '&user=' . $userid . '&state=' . $state . '">' . get_string('addnewnote', 'notes') . '</a></p>';
|
||||
echo '<p><a href="'. $CFG->wwwroot .'/notes/edit.php?courseid=' . $addcourseid . '&userid=' . $userid . '&publishstate=' . $state . '">' . get_string('addnewnote', 'notes') . '</a></p>';
|
||||
} else {
|
||||
echo '<p><a href="'. $CFG->wwwroot .'/user/index.php?id=' . $addcourseid. '">' . get_string('addnewnoteselect', 'notes') . '</a></p>';
|
||||
}
|
||||
}
|
||||
if ($viewnotes) {
|
||||
$notes =& note_list($courseid, $userid, $state, $author);
|
||||
$notes = note_list($courseid, $userid, $state, $author);
|
||||
if ($notes) {
|
||||
note_print_list($notes);
|
||||
}
|
||||
|
||||
@@ -16,6 +16,10 @@ require_login($course->id);
|
||||
// to create notes the current user needs a capability
|
||||
require_capability('moodle/notes:manage', $context);
|
||||
|
||||
if (empty($CFG->enablenotes)) {
|
||||
print_error('notesdisabled', 'notes');
|
||||
}
|
||||
|
||||
if (!empty($users) && confirm_sesskey()) {
|
||||
if (count($users) != count($contents) || count($users) != count($states)) {
|
||||
error('Parameters malformation', $CFG->wwwroot.'/user/index.php?id='.$id);
|
||||
|
||||
@@ -17,6 +17,10 @@ require_login($course->id);
|
||||
// to create notes the current user needs a capability
|
||||
require_capability('moodle/notes:manage', $context);
|
||||
|
||||
if (empty($CFG->enablenotes)) {
|
||||
print_error('notesdisabled', 'notes');
|
||||
}
|
||||
|
||||
if (!empty($users) && !empty($content) && confirm_sesskey()) {
|
||||
$note = new object();
|
||||
$note->courseid = $id;
|
||||
|
||||
+1
-1
@@ -755,7 +755,7 @@
|
||||
echo '<input type="button" onclick="checknone()" value="'.get_string('deselectall').'" /> ';
|
||||
$displaylist = array();
|
||||
$displaylist['messageselect.php'] = get_string('messageselectadd');
|
||||
if (has_capability('moodle/notes:manage', $context) && $context->id != $frontpagectx->id) {
|
||||
if (!empty($CFG->enablenotes) && has_capability('moodle/notes:manage', $context) && $context->id != $frontpagectx->id) {
|
||||
$displaylist['addnote.php'] = get_string('addnewnote', 'notes');
|
||||
$displaylist['groupaddnote.php'] = get_string('groupaddnewnote', 'notes');
|
||||
}
|
||||
|
||||
+2
-2
@@ -59,7 +59,7 @@
|
||||
$toprow[] = new tabobject('blogs', $CFG->wwwroot.'/blog/index.php?filtertype=course&filterselect='.$filterselect, get_string('blogs','blog'));
|
||||
}
|
||||
|
||||
if (has_capability('moodle/notes:manage', $coursecontext) || has_capability('moodle/notes:view', $coursecontext)) {
|
||||
if (!empty($CFG->enablenotes) and (has_capability('moodle/notes:manage', $coursecontext) || has_capability('moodle/notes:view', $coursecontext))) {
|
||||
$toprow[] = new tabobject('notes', $CFG->wwwroot.'/notes/index.php?filtertype=course&filterselect=' . $filterselect, get_string('notes', 'notes'));
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@
|
||||
$toprow[] = new tabobject('blogs', $CFG->wwwroot.'/blog/index.php?userid='.$user->id.'&courseid='.$course->id, get_string('blog', 'blog'));
|
||||
}
|
||||
|
||||
if (has_capability('moodle/notes:manage', $coursecontext) || has_capability('moodle/notes:view', $coursecontext)) {
|
||||
if (!empty($CFG->enablenotes) and (has_capability('moodle/notes:manage', $coursecontext) || has_capability('moodle/notes:view', $coursecontext))) {
|
||||
$toprow[] = new tabobject('notes', $CFG->wwwroot.'/notes/index.php?course='.$course->id . '&user=' . $user->id, get_string('notes', 'notes'));
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
// This is compared against the values stored in the database to determine
|
||||
// whether upgrades should be performed (see lib/db/*.php)
|
||||
|
||||
$version = 2007101532.05; // YYYYMMDD = date of the 1.9 branch (don't change)
|
||||
$version = 2007101532.06; // YYYYMMDD = date of the 1.9 branch (don't change)
|
||||
// X = release number 1.9.[0,1,2,3...]
|
||||
// Y.YY = micro-increments between releases
|
||||
|
||||
|
||||
Reference in New Issue
Block a user