mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 08:26:37 +02:00
MDL-16166 centralised enabling of subsystems, fixed some warnings and general cleanup
This commit is contained in:
parent
3c184e1464
commit
90658eefb0
24 changed files with 84 additions and 48 deletions
|
@ -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)) {
|
||||
print_error('invalidformdata', '', $CFG->wwwroot.'/user/index.php?id='.$id);
|
||||
|
@ -25,7 +29,7 @@ if (!empty($users) && confirm_sesskey()) {
|
|||
$note->courseid = $id;
|
||||
$note->format = FORMAT_PLAIN;
|
||||
foreach ($users as $k => $v) {
|
||||
if(!$user = $DB->get_record('user', array('id'=>$v)) || empty($contents[$k])) {
|
||||
if (!$user = $DB->get_record('user', array('id'=>$v)) || empty($contents[$k])) {
|
||||
continue;
|
||||
}
|
||||
$note->id = 0;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -858,7 +858,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,7 +2,7 @@
|
|||
|
||||
require_once(dirname(dirname(__FILE__)) . '/config.php');
|
||||
|
||||
if (empty($CFG->portfolioenabled)) {
|
||||
if (empty($CFG->enableportfolios)) {
|
||||
print_error('disabled', 'portfolio');
|
||||
}
|
||||
|
||||
|
|
|
@ -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'));
|
||||
}
|
||||
|
||||
|
@ -239,7 +239,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
if (empty($userindexpage) && $user->id == $USER->id && !empty($CFG->portfolioenabled) && has_capability('moodle/portfolio:export', get_system_context())) {
|
||||
if (!empty($user) and empty($userindexpage) && $user->id == $USER->id && !empty($CFG->enableportfolios) && has_capability('moodle/portfolio:export', get_system_context())) {
|
||||
|
||||
/// Portfolio tab
|
||||
require_once($CFG->libdir . '/portfoliolib.php');
|
||||
|
@ -249,15 +249,16 @@
|
|||
}
|
||||
|
||||
// Repository Tab
|
||||
if ($user->id == $USER->id) {
|
||||
if (!empty($user) and $user->id == $USER->id) {
|
||||
require_once($CFG->dirroot . '/repository/lib.php');
|
||||
if (repository_instances($COURSE->context, $USER->id)) {
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
if (repository_instances($coursecontext, $USER->id)) {
|
||||
$toprow[] = new tabobject('repositories', $CFG->wwwroot .'/user/repository.php', get_string('repositories', 'repository'));
|
||||
}
|
||||
}
|
||||
|
||||
/// Messaging tab
|
||||
if (has_capability('moodle/user:editownmessageprofile', $systemcontext)) {
|
||||
if (!empty($user) and empty($userindexpage) and has_capability('moodle/user:editownmessageprofile', $systemcontext)) {
|
||||
$toprow[] = new tabobject('editmessage', $CFG->wwwroot.'/message/edit.php?id='.$user->id.'&course='.$course->id, get_string('editmymessage', 'message'));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue