Merge branch 'MOODLE_22_STABLE' into install_22_STABLE
|
@ -50,8 +50,10 @@ if ($course) {
|
||||||
|
|
||||||
// security first
|
// security first
|
||||||
require_login($course, false, $cm);
|
require_login($course, false, $cm);
|
||||||
|
$safeoverridesonly = false;
|
||||||
if (!has_capability('moodle/role:override', $context)) {
|
if (!has_capability('moodle/role:override', $context)) {
|
||||||
require_capability('moodle/role:safeoverride', $context);
|
require_capability('moodle/role:safeoverride', $context);
|
||||||
|
$safeoverridesonly = true;
|
||||||
}
|
}
|
||||||
$PAGE->set_url($url);
|
$PAGE->set_url($url);
|
||||||
$PAGE->set_context($context);
|
$PAGE->set_context($context);
|
||||||
|
@ -119,7 +121,7 @@ if (empty($overridableroles[$roleid])) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we are actually overriding a role, create the table object, and save changes if appropriate.
|
// If we are actually overriding a role, create the table object, and save changes if appropriate.
|
||||||
$overridestable = new override_permissions_table_advanced($context, $roleid, false);
|
$overridestable = new override_permissions_table_advanced($context, $roleid, $safeoverridesonly);
|
||||||
$overridestable->read_submitted_permissions();
|
$overridestable->read_submitted_permissions();
|
||||||
|
|
||||||
if (optional_param('savechanges', false, PARAM_BOOL) && confirm_sesskey()) {
|
if (optional_param('savechanges', false, PARAM_BOOL) && confirm_sesskey()) {
|
||||||
|
|
|
@ -413,6 +413,8 @@ class core_calendar_renderer extends plugin_renderer_base {
|
||||||
|
|
||||||
$table = new html_table();
|
$table = new html_table();
|
||||||
$table->attributes = array('class'=>'calendarmonth calendartable');
|
$table->attributes = array('class'=>'calendarmonth calendartable');
|
||||||
|
$time = make_timestamp($calendar->year, $calendar->month);
|
||||||
|
$table->summary = get_string('calendarheading', 'calendar', userdate($time, get_string('strftimemonthyear')));
|
||||||
$table->data = array();
|
$table->data = array();
|
||||||
|
|
||||||
$header = new html_table_row();
|
$header = new html_table_row();
|
||||||
|
|
|
@ -569,7 +569,7 @@ class comment {
|
||||||
$c->format = $u->cformat;
|
$c->format = $u->cformat;
|
||||||
$c->timecreated = $u->ctimecreated;
|
$c->timecreated = $u->ctimecreated;
|
||||||
$url = new moodle_url('/user/view.php', array('id'=>$u->id, 'course'=>$this->courseid));
|
$url = new moodle_url('/user/view.php', array('id'=>$u->id, 'course'=>$this->courseid));
|
||||||
$c->profileurl = $url->out();
|
$c->profileurl = $url->out(false);
|
||||||
$c->fullname = fullname($u);
|
$c->fullname = fullname($u);
|
||||||
$c->time = userdate($c->timecreated, get_string('strftimerecent', 'langconfig'));
|
$c->time = userdate($c->timecreated, get_string('strftimerecent', 'langconfig'));
|
||||||
$c->content = format_text($c->content, $c->format, $formatoptions);
|
$c->content = format_text($c->content, $c->format, $formatoptions);
|
||||||
|
|
|
@ -1,10 +1,32 @@
|
||||||
<?php
|
<?php
|
||||||
// Displays the top level category or all courses
|
// This file is part of Moodle - http://moodle.org/
|
||||||
// In editing mode, allows the admin to edit a category,
|
//
|
||||||
// and rearrange courses
|
// Moodle is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// Moodle is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays the top level category or all courses
|
||||||
|
* In editing mode, allows the admin to edit a category,
|
||||||
|
* and rearrange courses
|
||||||
|
*
|
||||||
|
* @package core
|
||||||
|
* @subpackage course
|
||||||
|
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||||
|
*/
|
||||||
|
|
||||||
require_once("../config.php");
|
require_once("../config.php");
|
||||||
require_once("lib.php");
|
require_once($CFG->dirroot.'/course/lib.php');
|
||||||
|
|
||||||
$id = required_param('id', PARAM_INT); // Category id
|
$id = required_param('id', PARAM_INT); // Category id
|
||||||
$page = optional_param('page', 0, PARAM_INT); // which page to show
|
$page = optional_param('page', 0, PARAM_INT); // which page to show
|
||||||
|
@ -16,24 +38,17 @@
|
||||||
$movedown = optional_param('movedown', 0, PARAM_INT);
|
$movedown = optional_param('movedown', 0, PARAM_INT);
|
||||||
$moveto = optional_param('moveto', 0, PARAM_INT);
|
$moveto = optional_param('moveto', 0, PARAM_INT);
|
||||||
$resort = optional_param('resort', 0, PARAM_BOOL);
|
$resort = optional_param('resort', 0, PARAM_BOOL);
|
||||||
|
$sesskey = optional_param('sesskey', '', PARAM_RAW);
|
||||||
$site = get_site();
|
|
||||||
|
|
||||||
if (empty($id)) {
|
if (empty($id)) {
|
||||||
print_error("unknowcategory");
|
print_error("unknowcategory");
|
||||||
}
|
}
|
||||||
|
|
||||||
$PAGE->set_category_by_id($id);
|
$PAGE->set_category_by_id($id);
|
||||||
$urlparams = array('id' => $id);
|
|
||||||
if ($page) {
|
|
||||||
$urlparams['page'] = $page;
|
|
||||||
}
|
|
||||||
if ($perpage) {
|
|
||||||
$urlparams['perpage'] = $perpage;
|
|
||||||
}
|
|
||||||
$PAGE->set_url(new moodle_url('/course/category.php', array('id' => $id)));
|
$PAGE->set_url(new moodle_url('/course/category.php', array('id' => $id)));
|
||||||
navigation_node::override_active_url($PAGE->url);
|
// This is sure to be the category context
|
||||||
$context = $PAGE->context;
|
$context = $PAGE->context;
|
||||||
|
// And the object has been loaded for us no need for another DB call
|
||||||
$category = $PAGE->category;
|
$category = $PAGE->category;
|
||||||
|
|
||||||
$canedit = can_edit_in_category($category->id);
|
$canedit = can_edit_in_category($category->id);
|
||||||
|
@ -54,10 +69,12 @@
|
||||||
require_capability('moodle/category:viewhiddencategories', $context);
|
require_capability('moodle/category:viewhiddencategories', $context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$canmanage = has_capability('moodle/category:manage', $context);
|
||||||
|
$sesskeyprovided = !empty($sesskey) && confirm_sesskey($sesskey);
|
||||||
|
|
||||||
// Process any category actions.
|
// Process any category actions.
|
||||||
if (has_capability('moodle/category:manage', $context)) {
|
if ($canmanage && $resort && $sesskeyprovided) {
|
||||||
/// Resort the category if requested
|
// Resort the category if requested
|
||||||
if ($resort and confirm_sesskey()) {
|
|
||||||
if ($courses = get_courses($category->id, "fullname ASC", 'c.id,c.fullname,c.sortorder')) {
|
if ($courses = get_courses($category->id, "fullname ASC", 'c.id,c.fullname,c.sortorder')) {
|
||||||
$i = 1;
|
$i = 1;
|
||||||
foreach ($courses as $course) {
|
foreach ($courses as $course) {
|
||||||
|
@ -67,12 +84,13 @@
|
||||||
fix_course_sortorder(); // should not be needed
|
fix_course_sortorder(); // should not be needed
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Process any course actions.
|
// Process any course actions.
|
||||||
if ($editingon) {
|
if ($editingon && $sesskeyprovided) {
|
||||||
/// Move a specified course to a new category
|
|
||||||
if (!empty($moveto) and $data = data_submitted() and confirm_sesskey()) { // Some courses are being moved
|
// Move a specified course to a new category
|
||||||
|
if (!empty($moveto) and $data = data_submitted()) {
|
||||||
|
// Some courses are being moved
|
||||||
// user must have category update in both cats to perform this
|
// user must have category update in both cats to perform this
|
||||||
require_capability('moodle/category:manage', $context);
|
require_capability('moodle/category:manage', $context);
|
||||||
require_capability('moodle/category:manage', get_context_instance(CONTEXT_COURSECAT, $moveto));
|
require_capability('moodle/category:manage', get_context_instance(CONTEXT_COURSECAT, $moveto));
|
||||||
|
@ -100,8 +118,8 @@
|
||||||
move_courses($courses, $data->moveto);
|
move_courses($courses, $data->moveto);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Hide or show a course
|
// Hide or show a course
|
||||||
if ((!empty($hide) or !empty($show)) and confirm_sesskey()) {
|
if (!empty($hide) or !empty($show)) {
|
||||||
if (!empty($hide)) {
|
if (!empty($hide)) {
|
||||||
$course = $DB->get_record('course', array('id' => $hide));
|
$course = $DB->get_record('course', array('id' => $hide));
|
||||||
$visible = 0;
|
$visible = 0;
|
||||||
|
@ -113,14 +131,16 @@
|
||||||
if ($course) {
|
if ($course) {
|
||||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
|
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||||
require_capability('moodle/course:visibility', $coursecontext);
|
require_capability('moodle/course:visibility', $coursecontext);
|
||||||
|
// Set the visibility of the course
|
||||||
$DB->set_field('course', 'visible', $visible, array('id' => $course->id));
|
$DB->set_field('course', 'visible', $visible, array('id' => $course->id));
|
||||||
$DB->set_field('course', 'visibleold', $visible, array('id' => $course->id)); // we set the old flag when user manually changes visibility of course
|
// we set the old flag when user manually changes visibility of course
|
||||||
|
$DB->set_field('course', 'visibleold', $visible, array('id' => $course->id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Move a course up or down
|
// Move a course up or down
|
||||||
if ((!empty($moveup) or !empty($movedown)) and confirm_sesskey()) {
|
if (!empty($moveup) or !empty($movedown)) {
|
||||||
require_capability('moodle/category:manage', $context);
|
require_capability('moodle/category:manage', $context);
|
||||||
|
|
||||||
// Ensure the course order has continuous ordering
|
// Ensure the course order has continuous ordering
|
||||||
|
@ -148,14 +168,16 @@
|
||||||
|
|
||||||
} // End of editing stuff
|
} // End of editing stuff
|
||||||
|
|
||||||
// Print headings
|
// Prepare the standard URL params for this page. We'll need them later.
|
||||||
$numcategories = $DB->count_records('course_categories');
|
$urlparams = array('id' => $id);
|
||||||
|
if ($page) {
|
||||||
$stradministration = get_string('administration');
|
$urlparams['page'] = $page;
|
||||||
$strcategories = get_string('categories');
|
}
|
||||||
$strcategory = get_string('category');
|
if ($perpage) {
|
||||||
$strcourses = get_string('courses');
|
$urlparams['perpage'] = $perpage;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Begin output
|
||||||
if ($editingon && can_edit_in_category()) {
|
if ($editingon && can_edit_in_category()) {
|
||||||
// Integrate into the admin tree only if the user can edit categories at the top level,
|
// Integrate into the admin tree only if the user can edit categories at the top level,
|
||||||
// otherwise the admin block does not appear to this user, and you get an error.
|
// otherwise the admin block does not appear to this user, and you get an error.
|
||||||
|
@ -171,6 +193,7 @@
|
||||||
}
|
}
|
||||||
echo $OUTPUT->header();
|
echo $OUTPUT->header();
|
||||||
} else {
|
} else {
|
||||||
|
$site = get_site();
|
||||||
$PAGE->set_title("$site->shortname: $category->name");
|
$PAGE->set_title("$site->shortname: $category->name");
|
||||||
$PAGE->set_heading($site->fullname);
|
$PAGE->set_heading($site->fullname);
|
||||||
$PAGE->set_button(print_course_search('', true, 'navbar'));
|
$PAGE->set_button(print_course_search('', true, 'navbar'));
|
||||||
|
@ -184,8 +207,8 @@
|
||||||
make_categories_list($displaylist, $notused);
|
make_categories_list($displaylist, $notused);
|
||||||
|
|
||||||
echo '<div class="categorypicker">';
|
echo '<div class="categorypicker">';
|
||||||
$select = new single_select(new moodle_url('category.php'), 'id', $displaylist, $category->id, null, 'switchcategory');
|
$select = new single_select(new moodle_url('/course/category.php'), 'id', $displaylist, $category->id, null, 'switchcategory');
|
||||||
$select->set_label($strcategories.':');
|
$select->set_label(get_string('categories').':');
|
||||||
echo $OUTPUT->render($select);
|
echo $OUTPUT->render($select);
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
|
||||||
|
@ -204,44 +227,62 @@
|
||||||
echo $OUTPUT->box_end();
|
echo $OUTPUT->box_end();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($editingon && has_capability('moodle/category:manage', $context)) {
|
if ($editingon && $canmanage) {
|
||||||
echo $OUTPUT->container_start('buttons');
|
echo $OUTPUT->container_start('buttons');
|
||||||
|
|
||||||
// Print button to update this category
|
// Print button to update this category
|
||||||
$options = array('id' => $category->id);
|
$url = new moodle_url('/course/editcategory.php', array('id' => $category->id));
|
||||||
echo $OUTPUT->single_button(new moodle_url('/course/editcategory.php', $options), get_string('editcategorythis'), 'get');
|
echo $OUTPUT->single_button($url, get_string('editcategorythis'), 'get');
|
||||||
|
|
||||||
// Print button for creating new categories
|
// Print button for creating new categories
|
||||||
$options = array('parent' => $category->id);
|
$url = new moodle_url('/course/editcategory.php', array('parent' => $category->id));
|
||||||
echo $OUTPUT->single_button(new moodle_url('/course/editcategory.php', $options), get_string('addsubcategory'), 'get');
|
echo $OUTPUT->single_button($url, get_string('addsubcategory'), 'get');
|
||||||
|
|
||||||
echo $OUTPUT->container_end();
|
echo $OUTPUT->container_end();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Print out all the sub-categories
|
// Print out all the sub-categories
|
||||||
if ($subcategories = $DB->get_records('course_categories', array('parent' => $category->id), 'sortorder ASC')) {
|
// In order to view hidden subcategories the user must have the viewhiddencategories
|
||||||
$firstentry = true;
|
// capability in the current category.
|
||||||
|
if (has_capability('moodle/category:viewhiddencategories', $context)) {
|
||||||
|
$categorywhere = '';
|
||||||
|
} else {
|
||||||
|
$categorywhere = 'AND cc.visible = 1';
|
||||||
|
}
|
||||||
|
// We're going to preload the context for the subcategory as we know that we
|
||||||
|
// need it later on for formatting.
|
||||||
|
list($ctxselect, $ctxjoin) = context_instance_preload_sql('cc.id', CONTEXT_COURSECAT, 'ctx');
|
||||||
|
$sql = "SELECT cc.* $ctxselect
|
||||||
|
FROM {course_categories} cc
|
||||||
|
$ctxjoin
|
||||||
|
WHERE cc.parent = :parentid
|
||||||
|
$categorywhere
|
||||||
|
ORDER BY cc.sortorder ASC";
|
||||||
|
$subcategories = $DB->get_recordset_sql($sql, array('parentid' => $category->id));
|
||||||
|
// Prepare a table to display the sub categories.
|
||||||
|
$table = new html_table;
|
||||||
|
$table->attributes = array('border' => '0', 'cellspacing' => '2', 'cellpadding' => '4', 'class' => 'generalbox boxaligncenter category_subcategories');
|
||||||
|
$table->head = array(get_string('subcategories'));
|
||||||
|
$table->data = array();
|
||||||
|
$baseurl = new moodle_url('/course/category.php');
|
||||||
foreach ($subcategories as $subcategory) {
|
foreach ($subcategories as $subcategory) {
|
||||||
if ($subcategory->visible || has_capability('moodle/category:viewhiddencategories', $context)) {
|
// Preload the context we will need it to format the category name shortly.
|
||||||
$subcategorieswereshown = true;
|
context_instance_preload($subcategory);
|
||||||
if ($firstentry) {
|
$context = get_context_instance(CONTEXT_COURSECAT, $subcategory->id);
|
||||||
echo '<table border="0" cellspacing="2" cellpadding="4" class="generalbox boxaligncenter">';
|
// Prepare the things we need to create a link to the subcategory
|
||||||
echo '<tr><th scope="col">'.get_string('subcategories').'</th></tr>';
|
$attributes = $subcategory->visible ? array() : array('class' => 'dimmed');
|
||||||
echo '<tr><td style="white-space: nowrap">';
|
$text = format_string($subcategory->name, true, array('context' => $context));
|
||||||
$firstentry = false;
|
// Add the subcategory to the table
|
||||||
}
|
$baseurl->param('id', $subcategory->id);
|
||||||
$catlinkcss = $subcategory->visible ? '' : ' class="dimmed" ';
|
$table->data[] = array(html_writer::link($baseurl, $text, $attributes));
|
||||||
echo '<a '.$catlinkcss.' href="category.php?id='.$subcategory->id.'">'.
|
|
||||||
format_string($subcategory->name, true, array('context' => get_context_instance(CONTEXT_COURSECAT, $subcategory->id))).'</a><br />';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!$firstentry) {
|
|
||||||
echo '</td></tr></table>';
|
|
||||||
echo '<br />';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Print out all the courses
|
$subcategorieswereshown = (count($table->data) > 0);
|
||||||
|
if ($subcategorieswereshown) {
|
||||||
|
echo html_writer::table($table);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Print out all the courses
|
||||||
$courses = get_courses_page($category->id, 'c.sortorder ASC',
|
$courses = get_courses_page($category->id, 'c.sortorder ASC',
|
||||||
'c.id,c.sortorder,c.shortname,c.fullname,c.summary,c.visible',
|
'c.id,c.sortorder,c.shortname,c.fullname,c.summary,c.visible',
|
||||||
$totalcount, $page*$perpage, $perpage);
|
$totalcount, $page*$perpage, $perpage);
|
||||||
|
@ -260,34 +301,18 @@
|
||||||
} else {
|
} else {
|
||||||
echo $OUTPUT->paging_bar($totalcount, $page, $perpage, "/course/category.php?id=$category->id&perpage=$perpage");
|
echo $OUTPUT->paging_bar($totalcount, $page, $perpage, "/course/category.php?id=$category->id&perpage=$perpage");
|
||||||
|
|
||||||
$strcourses = get_string('courses');
|
|
||||||
$strselect = get_string('select');
|
|
||||||
$stredit = get_string('edit');
|
|
||||||
$strdelete = get_string('delete');
|
|
||||||
$strbackup = get_string('backup');
|
|
||||||
$strrestore = get_string('restore');
|
|
||||||
$strmoveup = get_string('moveup');
|
|
||||||
$strmovedown = get_string('movedown');
|
|
||||||
$strupdate = get_string('update');
|
|
||||||
$strhide = get_string('hide');
|
|
||||||
$strshow = get_string('show');
|
|
||||||
$strsummary = get_string('summary');
|
|
||||||
$strsettings = get_string('settings');
|
|
||||||
|
|
||||||
|
|
||||||
echo '<form id="movecourses" action="category.php" method="post"><div>';
|
echo '<form id="movecourses" action="category.php" method="post"><div>';
|
||||||
echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
|
echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
|
||||||
echo '<table border="0" cellspacing="2" cellpadding="4" class="generalbox boxaligncenter"><tr>';
|
echo '<table border="0" cellspacing="2" cellpadding="4" class="generalbox boxaligncenter"><tr>';
|
||||||
echo '<th class="header" scope="col">'.$strcourses.'</th>';
|
echo '<th class="header" scope="col">'.get_string('courses').'</th>';
|
||||||
if ($editingon) {
|
if ($editingon) {
|
||||||
echo '<th class="header" scope="col">'.$stredit.'</th>';
|
echo '<th class="header" scope="col">'.get_string('edit').'</th>';
|
||||||
echo '<th class="header" scope="col">'.$strselect.'</th>';
|
echo '<th class="header" scope="col">'.get_string('select').'</th>';
|
||||||
} else {
|
} else {
|
||||||
echo '<th class="header" scope="col"> </th>';
|
echo '<th class="header" scope="col"> </th>';
|
||||||
}
|
}
|
||||||
echo '</tr>';
|
echo '</tr>';
|
||||||
|
|
||||||
|
|
||||||
$count = 0;
|
$count = 0;
|
||||||
$abletomovecourses = false; // for now
|
$abletomovecourses = false; // for now
|
||||||
|
|
||||||
|
@ -305,6 +330,7 @@
|
||||||
$atlastpage = true;
|
$atlastpage = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$baseurl = new moodle_url('/course/category.php', $urlparams + array('sesskey' => sesskey()));
|
||||||
foreach ($courses as $acourse) {
|
foreach ($courses as $acourse) {
|
||||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $acourse->id);
|
$coursecontext = get_context_instance(CONTEXT_COURSE, $acourse->id);
|
||||||
|
|
||||||
|
@ -319,60 +345,51 @@
|
||||||
if ($editingon) {
|
if ($editingon) {
|
||||||
echo '<td>';
|
echo '<td>';
|
||||||
if (has_capability('moodle/course:update', $coursecontext)) {
|
if (has_capability('moodle/course:update', $coursecontext)) {
|
||||||
echo $OUTPUT->action_icon(new moodle_url('/course/edit.php',
|
$url = new moodle_url('/course/edit.php', array('id' => $acourse->id, 'category' => $id, 'returnto' => 'category'));
|
||||||
array('id' => $acourse->id, 'category' => $id, 'returnto' => 'category')),
|
echo $OUTPUT->action_icon($url, new pix_icon('t/edit', get_string('settings')));
|
||||||
new pix_icon('t/edit', $strsettings));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// role assignment link
|
// role assignment link
|
||||||
if (has_capability('moodle/course:enrolreview', $coursecontext)) {
|
if (has_capability('moodle/course:enrolreview', $coursecontext)) {
|
||||||
echo $OUTPUT->action_icon(new moodle_url('/enrol/users.php', array('id' => $acourse->id)),
|
$url = new moodle_url('/enrol/users.php', array('id' => $acourse->id));
|
||||||
new pix_icon('i/users', get_string('enrolledusers', 'enrol')));
|
echo $OUTPUT->action_icon($url, new pix_icon('i/users', get_string('enrolledusers', 'enrol')));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (can_delete_course($acourse->id)) {
|
if (can_delete_course($acourse->id)) {
|
||||||
echo $OUTPUT->action_icon(new moodle_url('/course/delete.php', array('id' => $acourse->id)),
|
$url = new moodle_url('/course/delete.php', array('id' => $acourse->id));
|
||||||
new pix_icon('t/delete', $strdelete));
|
echo $OUTPUT->action_icon($url, new pix_icon('t/delete', get_string('delete')));
|
||||||
}
|
}
|
||||||
|
|
||||||
// MDL-8885, users with no capability to view hidden courses, should not be able to lock themselves out
|
// MDL-8885, users with no capability to view hidden courses, should not be able to lock themselves out
|
||||||
if (has_capability('moodle/course:visibility', $coursecontext) && has_capability('moodle/course:viewhiddencourses', $coursecontext)) {
|
if (has_capability('moodle/course:visibility', $coursecontext) && has_capability('moodle/course:viewhiddencourses', $coursecontext)) {
|
||||||
if (!empty($acourse->visible)) {
|
if (!empty($acourse->visible)) {
|
||||||
echo $OUTPUT->action_icon(new moodle_url('/course/category.php',
|
$url = new moodle_url($baseurl, array('hide' => $acourse->id));
|
||||||
array('id' => $category->id, 'page' => $page, 'perpage' => $perpage,
|
echo $OUTPUT->action_icon($url, new pix_icon('t/hide', get_string('hide')));
|
||||||
'hide' => $acourse->id, 'sesskey' => sesskey())),
|
|
||||||
new pix_icon('t/hide', $strhide));
|
|
||||||
} else {
|
} else {
|
||||||
echo $OUTPUT->action_icon(new moodle_url('/course/category.php',
|
$url = new moodle_url($baseurl, array('show' => $acourse->id));
|
||||||
array('id' => $category->id, 'page' => $page, 'perpage' => $perpage,
|
echo $OUTPUT->action_icon($url, new pix_icon('t/show', get_string('show')));
|
||||||
'show' => $acourse->id, 'sesskey' => sesskey())),
|
|
||||||
new pix_icon('t/show', $strshow));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (has_capability('moodle/backup:backupcourse', $coursecontext)) {
|
if (has_capability('moodle/backup:backupcourse', $coursecontext)) {
|
||||||
echo $OUTPUT->action_icon(new moodle_url('/backup/backup.php', array('id' => $acourse->id)),
|
$url = new moodle_url('/backup/backup.php', array('id' => $acourse->id));
|
||||||
new pix_icon('t/backup', $strbackup));
|
echo $OUTPUT->action_icon($url, new pix_icon('t/backup', get_string('backup')));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (has_capability('moodle/restore:restorecourse', $coursecontext)) {
|
if (has_capability('moodle/restore:restorecourse', $coursecontext)) {
|
||||||
echo $OUTPUT->action_icon(new moodle_url('/backup/restorefile.php', array('contextid' => $coursecontext->id)),
|
$url = new moodle_url('/backup/restorefile.php', array('contextid' => $coursecontext->id));
|
||||||
new pix_icon('t/restore', $strrestore));
|
echo $OUTPUT->action_icon($url, new pix_icon('t/restore', get_string('restore')));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (has_capability('moodle/category:manage', $context)) {
|
if ($canmanage) {
|
||||||
if ($up) {
|
if ($up) {
|
||||||
echo $OUTPUT->action_icon(new moodle_url('/course/category.php',
|
$url = new moodle_url($baseurl, array('moveup' => $acourse->id));
|
||||||
array('id' => $category->id, 'page' => $page, 'perpage' => $perpage,
|
echo $OUTPUT->action_icon($url, new pix_icon('t/up', get_string('moveup')));
|
||||||
'moveup' => $acourse->id, 'sesskey' => sesskey())),
|
|
||||||
new pix_icon('t/up', $strmoveup));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($down) {
|
if ($down) {
|
||||||
echo $OUTPUT->action_icon(new moodle_url('/course/category.php',
|
$url = new moodle_url($baseurl, array('movedown' => $acourse->id));
|
||||||
array('id' => $category->id, 'page' => $page, 'perpage' => $perpage,
|
echo $OUTPUT->action_icon($url, new pix_icon('t/down', get_string('movedown')));
|
||||||
'movedown' => $acourse->id, 'sesskey' => sesskey())),
|
|
||||||
new pix_icon('t/down', $strmovedown));
|
|
||||||
}
|
}
|
||||||
$abletomovecourses = true;
|
$abletomovecourses = true;
|
||||||
}
|
}
|
||||||
|
@ -390,9 +407,9 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!empty($acourse->summary)) {
|
if (!empty($acourse->summary)) {
|
||||||
$link = new moodle_url("/course/info.php?id=$acourse->id");
|
$url = new moodle_url("/course/info.php?id=$acourse->id");
|
||||||
echo $OUTPUT->action_link($link, '<img alt="'.get_string('info').'" class="icon" src="'.$OUTPUT->pix_url('i/info') . '" />',
|
echo $OUTPUT->action_link($url, '<img alt="'.get_string('info').'" class="icon" src="'.$OUTPUT->pix_url('i/info') . '" />',
|
||||||
new popup_action('click', $link, 'courseinfo'), array('title'=>$strsummary));
|
new popup_action('click', $url, 'courseinfo'), array('title'=>get_string('summary')));
|
||||||
}
|
}
|
||||||
echo "</td>";
|
echo "</td>";
|
||||||
}
|
}
|
||||||
|
@ -417,21 +434,16 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '<div class="buttons">';
|
echo '<div class="buttons">';
|
||||||
if (has_capability('moodle/category:manage', $context) and $numcourses > 1) {
|
if ($canmanage and $numcourses > 1) {
|
||||||
/// Print button to re-sort courses by name
|
// Print button to re-sort courses by name
|
||||||
unset($options);
|
$url = new moodle_url('/course/category.php', array('id' => $category->id, 'resort' => 'name', 'sesskey' => sesskey()));
|
||||||
$options['id'] = $category->id;
|
echo $OUTPUT->single_button($url, get_string('resortcoursesbyname'), 'get');
|
||||||
$options['resort'] = 'name';
|
|
||||||
$options['sesskey'] = sesskey();
|
|
||||||
echo $OUTPUT->single_button(new moodle_url('category.php', $options), get_string('resortcoursesbyname'), 'get');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (has_capability('moodle/course:create', $context)) {
|
if (has_capability('moodle/course:create', $context)) {
|
||||||
/// Print button to create a new course
|
// Print button to create a new course
|
||||||
unset($options);
|
$url = new moodle_url('/course/edit.php', array('category' => $category->id, 'returnto' => 'category'));
|
||||||
$options['category'] = $category->id;
|
echo $OUTPUT->single_button($url, get_string('addnewcourse'), 'get');
|
||||||
$options['returnto'] = 'category';
|
|
||||||
echo $OUTPUT->single_button(new moodle_url('edit.php', $options), get_string('addnewcourse'), 'get');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($CFG->enablecourserequests) && $category->id == $CFG->defaultrequestcategory) {
|
if (!empty($CFG->enablecourserequests) && $category->id == $CFG->defaultrequestcategory) {
|
||||||
|
@ -442,4 +454,3 @@
|
||||||
print_course_search();
|
print_course_search();
|
||||||
|
|
||||||
echo $OUTPUT->footer();
|
echo $OUTPUT->footer();
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,29 @@
|
||||||
<?php
|
<?php
|
||||||
|
// This file is part of Moodle - http://moodle.org/
|
||||||
|
//
|
||||||
|
// Moodle is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// Moodle is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Page for creating or editing course category name/parent/description.
|
* Page for creating or editing course category name/parent/description.
|
||||||
* When called with an id parameter, edits the category with that id.
|
* When called with an id parameter, edits the category with that id.
|
||||||
* Otherwise it creates a new category with default parent from the parent
|
* Otherwise it creates a new category with default parent from the parent
|
||||||
* parameter, which may be 0.
|
* parameter, which may be 0.
|
||||||
|
*
|
||||||
|
* @package core
|
||||||
|
* @subpackage course
|
||||||
|
* @copyright 2007 Nicolas Connault
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once('../config.php');
|
require_once('../config.php');
|
||||||
|
@ -108,6 +128,21 @@ if ($mform->is_cancelled()) {
|
||||||
redirect('category.php?id='.$newcategory->id.'&categoryedit=on');
|
redirect('category.php?id='.$newcategory->id.'&categoryedit=on');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Unfortunately the navigation never generates correctly for this page because technically
|
||||||
|
// this page doesn't actually exist on the navigation you get here through the course
|
||||||
|
// management page.
|
||||||
|
try {
|
||||||
|
// First up we'll try to make the course management page active seeing as that is
|
||||||
|
// where the user thinks they are.
|
||||||
|
// The big prolem here is that the course management page is a common page
|
||||||
|
// for both editing users and common users.
|
||||||
|
$PAGE->settingsnav->get('root')->get('courses')->get('coursemgmt')->make_active();
|
||||||
|
} catch (Exception $ex) {
|
||||||
|
// Failing that we'll override the URL, not as accurate and chances are things
|
||||||
|
// won't be 100% correct all the time but should work most times.
|
||||||
|
navigation_node::override_active_url(new moodle_url('/course/index.php', array('categoryedit' => 'on')));
|
||||||
|
}
|
||||||
|
|
||||||
$PAGE->set_title($title);
|
$PAGE->set_title($title);
|
||||||
$PAGE->set_heading($fullname);
|
$PAGE->set_heading($fullname);
|
||||||
echo $OUTPUT->header();
|
echo $OUTPUT->header();
|
||||||
|
|
|
@ -177,6 +177,7 @@ if (!$categories = get_categories()) { /// No category yet!
|
||||||
$tempcat->context = get_context_instance(CONTEXT_COURSECAT, $tempcat->id);
|
$tempcat->context = get_context_instance(CONTEXT_COURSECAT, $tempcat->id);
|
||||||
mark_context_dirty('/'.SYSCONTEXTID);
|
mark_context_dirty('/'.SYSCONTEXTID);
|
||||||
fix_course_sortorder(); // Required to build course_categories.depth and .path.
|
fix_course_sortorder(); // Required to build course_categories.depth and .path.
|
||||||
|
set_config('defaultrequestcategory', $tempcat->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Move a category to a new parent if required
|
/// Move a category to a new parent if required
|
||||||
|
|
|
@ -15,10 +15,19 @@
|
||||||
$blocklist = optional_param('blocklist', 0, PARAM_INT);
|
$blocklist = optional_param('blocklist', 0, PARAM_INT);
|
||||||
$modulelist= optional_param('modulelist', '', PARAM_PLUGIN);
|
$modulelist= optional_param('modulelist', '', PARAM_PLUGIN);
|
||||||
|
|
||||||
$PAGE->set_url('/course/search.php', compact('search', 'page', 'perpage', 'blocklist', 'modulelist', 'edit'));
|
// List of minimum capabilities which user need to have for editing/moving course
|
||||||
$PAGE->set_context(get_context_instance(CONTEXT_SYSTEM));
|
$capabilities = array('moodle/course:create', 'moodle/category:manage');
|
||||||
$search = trim(strip_tags($search)); // trim & clean raw searched string
|
|
||||||
|
|
||||||
|
// List of category id's in which current user has course:create and category:manage capability.
|
||||||
|
$usercatlist = array();
|
||||||
|
|
||||||
|
// List of parent category id's
|
||||||
|
$catparentlist = array();
|
||||||
|
|
||||||
|
//Populate usercatlist with list of category id's with required capabilities.
|
||||||
|
make_categories_list($usercatlist, $catparentlist, $capabilities);
|
||||||
|
|
||||||
|
$search = trim(strip_tags($search)); // trim & clean raw searched string
|
||||||
if ($search) {
|
if ($search) {
|
||||||
$searchterms = explode(" ", $search); // Search for words independently
|
$searchterms = explode(" ", $search); // Search for words independently
|
||||||
foreach ($searchterms as $key => $searchterm) {
|
foreach ($searchterms as $key => $searchterm) {
|
||||||
|
@ -32,7 +41,7 @@
|
||||||
$site = get_site();
|
$site = get_site();
|
||||||
|
|
||||||
$urlparams = array();
|
$urlparams = array();
|
||||||
foreach (array('search', 'page', 'blocklist', 'modulelist') as $param) {
|
foreach (array('search', 'page', 'blocklist', 'modulelist', 'edit') as $param) {
|
||||||
if (!empty($$param)) {
|
if (!empty($$param)) {
|
||||||
$urlparams[$param] = $$param;
|
$urlparams[$param] = $$param;
|
||||||
}
|
}
|
||||||
|
@ -41,24 +50,30 @@
|
||||||
$urlparams['perpage'] = $perpage;
|
$urlparams['perpage'] = $perpage;
|
||||||
}
|
}
|
||||||
$PAGE->set_url('/course/search.php', $urlparams);
|
$PAGE->set_url('/course/search.php', $urlparams);
|
||||||
$PAGE->set_context(get_context_instance(CONTEXT_SYSTEM));
|
$PAGE->set_context(context_system::instance());
|
||||||
$PAGE->set_pagelayout('standard');
|
$PAGE->set_pagelayout('standard');
|
||||||
|
|
||||||
if ($CFG->forcelogin) {
|
if ($CFG->forcelogin) {
|
||||||
require_login();
|
require_login();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (can_edit_in_category()) {
|
//Editing is possible if user have system or category level create and manage capability
|
||||||
|
if (can_edit_in_category() || !empty($usercatlist)) {
|
||||||
if ($edit !== -1) {
|
if ($edit !== -1) {
|
||||||
$USER->editing = $edit;
|
$USER->editing = $edit;
|
||||||
}
|
}
|
||||||
$adminediting = $PAGE->user_is_editing();
|
$adminediting = $PAGE->user_is_editing();
|
||||||
|
|
||||||
|
// Set perpage if user can edit in category
|
||||||
|
if ($perpage != 99999) {
|
||||||
|
$perpage = 30;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$adminediting = false;
|
$adminediting = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Editing functions
|
/// Editing functions
|
||||||
if (has_capability('moodle/course:visibility', get_context_instance(CONTEXT_SYSTEM))) {
|
if (has_capability('moodle/course:visibility', context_system::instance())) {
|
||||||
/// Hide or show a course
|
/// Hide or show a course
|
||||||
if ($hide or $show and confirm_sesskey()) {
|
if ($hide or $show and confirm_sesskey()) {
|
||||||
if ($hide) {
|
if ($hide) {
|
||||||
|
@ -74,11 +89,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$capabilities = array('moodle/course:create', 'moodle/category:manage');
|
|
||||||
if (has_any_capability($capabilities, get_context_instance(CONTEXT_SYSTEM)) && ($perpage != 99999)) {
|
|
||||||
$perpage = 30;
|
|
||||||
}
|
|
||||||
|
|
||||||
$displaylist = array();
|
$displaylist = array();
|
||||||
$parentlist = array();
|
$parentlist = array();
|
||||||
make_categories_list($displaylist, $parentlist);
|
make_categories_list($displaylist, $parentlist);
|
||||||
|
@ -94,7 +104,7 @@
|
||||||
$strfrontpage = get_string('frontpage', 'admin');
|
$strfrontpage = get_string('frontpage', 'admin');
|
||||||
$strnovalidcourses = get_string('novalidcourses');
|
$strnovalidcourses = get_string('novalidcourses');
|
||||||
|
|
||||||
if (empty($search) and empty($blocklist) and empty($modulelist)) {
|
if (empty($search) and empty($blocklist) and empty($modulelist) and empty($moveto) and ($edit != -1)) {
|
||||||
$PAGE->navbar->add($strcourses, new moodle_url('/course/index.php'));
|
$PAGE->navbar->add($strcourses, new moodle_url('/course/index.php'));
|
||||||
$PAGE->navbar->add($strsearch);
|
$PAGE->navbar->add($strsearch);
|
||||||
$PAGE->set_title("$site->fullname : $strsearch");
|
$PAGE->set_title("$site->fullname : $strsearch");
|
||||||
|
@ -114,18 +124,28 @@
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$courses = array();
|
||||||
if (!empty($moveto) and $data = data_submitted() and confirm_sesskey()) { // Some courses are being moved
|
if (!empty($moveto) and $data = data_submitted() and confirm_sesskey()) { // Some courses are being moved
|
||||||
if (! $destcategory = $DB->get_record("course_categories", array("id"=>$data->moveto))) {
|
if (!$destcategory = $DB->get_record("course_categories", array("id" => $moveto))) {
|
||||||
print_error('cannotfindcategory', '', '', $data->moveto);
|
print_error('cannotfindcategory', '', '', $moveto);
|
||||||
}
|
}
|
||||||
|
|
||||||
$courses = array();
|
//User should have manage and create capablity on destination category.
|
||||||
|
require_capability('moodle/category:manage', context_coursecat::instance($moveto));
|
||||||
|
require_capability('moodle/course:create', context_coursecat::instance($moveto));
|
||||||
|
|
||||||
foreach ( $data as $key => $value ) {
|
foreach ( $data as $key => $value ) {
|
||||||
if (preg_match('/^c\d+$/', $key)) {
|
if (preg_match('/^c\d+$/', $key)) {
|
||||||
array_push($courses, substr($key, 1));
|
$courseid = substr($key, 1);
|
||||||
|
// user must have category:manage and course:create capability for the course to be moved.
|
||||||
|
$coursecontext = context_course::instance($courseid);
|
||||||
|
foreach ($capabilities as $capability) {
|
||||||
|
require_capability($capability, $coursecontext);
|
||||||
|
array_push($courses, $courseid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
move_courses($courses, $data->moveto);
|
}
|
||||||
|
move_courses($courses, $moveto);
|
||||||
}
|
}
|
||||||
|
|
||||||
// get list of courses containing blocks if required
|
// get list of courses containing blocks if required
|
||||||
|
@ -148,9 +168,7 @@
|
||||||
foreach ($courses as $course) {
|
foreach ($courses as $course) {
|
||||||
$courses[$course->id] = $course;
|
$courses[$course->id] = $course;
|
||||||
}
|
}
|
||||||
}
|
} elseif (!empty($modulelist) and confirm_sesskey()) { // get list of courses containing modules
|
||||||
// get list of courses containing modules if required
|
|
||||||
elseif (!empty($modulelist) and confirm_sesskey()) {
|
|
||||||
$modulename = $modulelist;
|
$modulename = $modulelist;
|
||||||
$sql = "SELECT DISTINCT c.id FROM {".$modulelist."} module, {course} c"
|
$sql = "SELECT DISTINCT c.id FROM {".$modulelist."} module, {course} c"
|
||||||
." WHERE module.course=c.id";
|
." WHERE module.course=c.id";
|
||||||
|
@ -172,18 +190,14 @@
|
||||||
else {
|
else {
|
||||||
$totalcount = 0;
|
$totalcount = 0;
|
||||||
}
|
}
|
||||||
}
|
} else if (!empty($searchterm)) { //Donot do search for empty search request.
|
||||||
else {
|
|
||||||
$courses = get_courses_search($searchterms, "fullname ASC",
|
$courses = get_courses_search($searchterms, "fullname ASC",
|
||||||
$page, $perpage, $totalcount);
|
$page, $perpage, $totalcount);
|
||||||
}
|
}
|
||||||
|
|
||||||
$searchform = print_course_search($search, true, "navbar");
|
|
||||||
|
|
||||||
if (!empty($courses) && has_capability('moodle/course:create', get_context_instance(CONTEXT_SYSTEM))) {
|
|
||||||
$searchform = '';
|
$searchform = '';
|
||||||
// not sure if this capability is the best here
|
//Turn editing should be visible if user have system or category level capability
|
||||||
if (has_capability('moodle/category:manage', get_context_instance(CONTEXT_SYSTEM))) {
|
if (!empty($courses) && (can_edit_in_category() || !empty($usercatlist))) {
|
||||||
if ($PAGE->user_is_editing()) {
|
if ($PAGE->user_is_editing()) {
|
||||||
$string = get_string("turneditingoff");
|
$string = get_string("turneditingoff");
|
||||||
$edit = "off";
|
$edit = "off";
|
||||||
|
@ -191,15 +205,11 @@
|
||||||
$string = get_string("turneditingon");
|
$string = get_string("turneditingon");
|
||||||
$edit = "on";
|
$edit = "on";
|
||||||
}
|
}
|
||||||
|
$params = array_merge($urlparams, array('sesskey' => sesskey(), 'edit' => $edit));
|
||||||
$aurl = new moodle_url("$CFG->wwwroot/course/search.php", array(
|
$aurl = new moodle_url("$CFG->wwwroot/course/search.php", $params);
|
||||||
'edit' => $edit,
|
|
||||||
'sesskey' => sesskey(),
|
|
||||||
'search' => $search,
|
|
||||||
'page' => $page,
|
|
||||||
'perpage' => $perpage));
|
|
||||||
$searchform = $OUTPUT->single_button($aurl, $string, 'get');
|
$searchform = $OUTPUT->single_button($aurl, $string, 'get');
|
||||||
}
|
} else {
|
||||||
|
$searchform = print_course_search($search, true, "navbar");
|
||||||
}
|
}
|
||||||
|
|
||||||
$PAGE->navbar->add($strcourses, new moodle_url('/course/index.php'));
|
$PAGE->navbar->add($strcourses, new moodle_url('/course/index.php'));
|
||||||
|
@ -228,25 +238,30 @@
|
||||||
|
|
||||||
print_navigation_bar($totalcount, $page, $perpage, $encodedsearch, $modulelink);
|
print_navigation_bar($totalcount, $page, $perpage, $encodedsearch, $modulelink);
|
||||||
|
|
||||||
if (!$adminediting) {
|
// Show list of courses
|
||||||
|
if (!$adminediting) { //Not editing mode
|
||||||
foreach ($courses as $course) {
|
foreach ($courses as $course) {
|
||||||
|
// front page don't belong to any category and block can exist.
|
||||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
|
if ($course->category > 0) {
|
||||||
|
|
||||||
$course->summary .= "<br /><p class=\"category\">";
|
$course->summary .= "<br /><p class=\"category\">";
|
||||||
$course->summary .= "$strcategory: <a href=\"category.php?id=$course->category\">";
|
$course->summary .= "$strcategory: <a href=\"category.php?id=$course->category\">";
|
||||||
$course->summary .= $displaylist[$course->category];
|
$course->summary .= $displaylist[$course->category];
|
||||||
$course->summary .= "</a></p>";
|
$course->summary .= "</a></p>";
|
||||||
|
}
|
||||||
print_course($course, $search);
|
print_course($course, $search);
|
||||||
echo $OUTPUT->spacer(array('height'=>5, 'width'=>5, 'br'=>true)); // should be done with CSS instead
|
echo $OUTPUT->spacer(array('height'=>5, 'width'=>5, 'br'=>true)); // should be done with CSS instead
|
||||||
}
|
}
|
||||||
} else {
|
} else { //editing mode
|
||||||
/// Show editing UI.
|
|
||||||
echo "<form id=\"movecourses\" action=\"search.php\" method=\"post\">\n";
|
echo "<form id=\"movecourses\" action=\"search.php\" method=\"post\">\n";
|
||||||
echo "<div><input type=\"hidden\" name=\"sesskey\" value=\"".sesskey()."\" />\n";
|
echo "<div><input type=\"hidden\" name=\"sesskey\" value=\"".sesskey()."\" />\n";
|
||||||
echo "<input type=\"hidden\" name=\"search\" value=\"".s($search)."\" />\n";
|
echo "<input type=\"hidden\" name=\"search\" value=\"".s($search)."\" />\n";
|
||||||
echo "<input type=\"hidden\" name=\"page\" value=\"$page\" />\n";
|
echo "<input type=\"hidden\" name=\"page\" value=\"$page\" />\n";
|
||||||
echo "<input type=\"hidden\" name=\"perpage\" value=\"$perpage\" /></div>\n";
|
echo "<input type=\"hidden\" name=\"perpage\" value=\"$perpage\" /></div>\n";
|
||||||
|
if (!empty($modulelist) and confirm_sesskey()) {
|
||||||
|
echo "<input type=\"hidden\" name=\"modulelist\" value=\"$modulelist\" /></div>\n";
|
||||||
|
} else if (!empty($blocklist) and confirm_sesskey()) {
|
||||||
|
echo "<input type=\"hidden\" name=\"blocklist\" value=\"$blocklist\" /></div>\n";
|
||||||
|
}
|
||||||
echo "<table border=\"0\" cellspacing=\"2\" cellpadding=\"4\" class=\"generalbox boxaligncenter\">\n<tr>\n";
|
echo "<table border=\"0\" cellspacing=\"2\" cellpadding=\"4\" class=\"generalbox boxaligncenter\">\n<tr>\n";
|
||||||
echo "<th scope=\"col\">$strcourses</th>\n";
|
echo "<th scope=\"col\">$strcourses</th>\n";
|
||||||
echo "<th scope=\"col\">$strcategory</th>\n";
|
echo "<th scope=\"col\">$strcategory</th>\n";
|
||||||
|
@ -255,7 +270,7 @@
|
||||||
|
|
||||||
foreach ($courses as $course) {
|
foreach ($courses as $course) {
|
||||||
|
|
||||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
|
$coursecontext = context_course::instance($course->id);
|
||||||
|
|
||||||
$linkcss = $course->visible ? "" : " class=\"dimmed\" ";
|
$linkcss = $course->visible ? "" : " class=\"dimmed\" ";
|
||||||
|
|
||||||
|
@ -278,9 +293,8 @@
|
||||||
echo "<td>".$displaylist[$course->category]."</td>\n";
|
echo "<td>".$displaylist[$course->category]."</td>\n";
|
||||||
echo "<td>\n";
|
echo "<td>\n";
|
||||||
|
|
||||||
// this is ok since this will get inherited from course category context
|
// If user has all required capabilities to move course then show selectable checkbox
|
||||||
// if it is set
|
if (has_all_capabilities($capabilities, $coursecontext)) {
|
||||||
if (has_capability('moodle/category:manage', $coursecontext)) {
|
|
||||||
echo "<input type=\"checkbox\" name=\"c$course->id\" />\n";
|
echo "<input type=\"checkbox\" name=\"c$course->id\" />\n";
|
||||||
} else {
|
} else {
|
||||||
echo "<input type=\"checkbox\" name=\"c$course->id\" disabled=\"disabled\" />\n";
|
echo "<input type=\"checkbox\" name=\"c$course->id\" disabled=\"disabled\" />\n";
|
||||||
|
@ -338,7 +352,8 @@
|
||||||
echo "<br />";
|
echo "<br />";
|
||||||
echo "<input type=\"button\" onclick=\"checkall()\" value=\"$strselectall\" />\n";
|
echo "<input type=\"button\" onclick=\"checkall()\" value=\"$strselectall\" />\n";
|
||||||
echo "<input type=\"button\" onclick=\"checknone()\" value=\"$strdeselectall\" />\n";
|
echo "<input type=\"button\" onclick=\"checknone()\" value=\"$strdeselectall\" />\n";
|
||||||
echo html_writer::select($displaylist, 'moveto', '', array(''=>get_string('moveselectedcoursesto')), array('id'=>'movetoid'));
|
//Select box should only show categories in which user has min capability to move course.
|
||||||
|
echo html_writer::select($usercatlist, 'moveto', '', array(''=>get_string('moveselectedcoursesto')), array('id'=>'movetoid'));
|
||||||
$PAGE->requires->js_init_call('M.util.init_select_autosubmit', array('movecourses', 'movetoid', false));
|
$PAGE->requires->js_init_call('M.util.init_select_autosubmit', array('movecourses', 'movetoid', false));
|
||||||
echo "</td>\n</tr>\n";
|
echo "</td>\n</tr>\n";
|
||||||
echo "</table>\n</form>";
|
echo "</table>\n</form>";
|
||||||
|
@ -384,7 +399,7 @@
|
||||||
$defaultperpage = 10;
|
$defaultperpage = 10;
|
||||||
//If user has course:create or category:manage capability the show 30 records.
|
//If user has course:create or category:manage capability the show 30 records.
|
||||||
$capabilities = array('moodle/course:create', 'moodle/category:manage');
|
$capabilities = array('moodle/course:create', 'moodle/category:manage');
|
||||||
if (has_any_capability($capabilities, get_context_instance(CONTEXT_SYSTEM))) {
|
if (has_any_capability($capabilities, context_system::instance())) {
|
||||||
$defaultperpage = 30;
|
$defaultperpage = 30;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,6 @@ require_once $CFG->dirroot.'/grade/report/grader/lib.php';
|
||||||
|
|
||||||
$courseid = required_param('id', PARAM_INT); // course id
|
$courseid = required_param('id', PARAM_INT); // course id
|
||||||
$page = optional_param('page', 0, PARAM_INT); // active page
|
$page = optional_param('page', 0, PARAM_INT); // active page
|
||||||
$perpageurl = optional_param('perpage', 0, PARAM_INT);
|
|
||||||
$edit = optional_param('edit', -1, PARAM_BOOL); // sticky editting mode
|
$edit = optional_param('edit', -1, PARAM_BOOL); // sticky editting mode
|
||||||
|
|
||||||
$sortitemid = optional_param('sortitemid', 0, PARAM_ALPHANUM); // sort by which grade item
|
$sortitemid = optional_param('sortitemid', 0, PARAM_ALPHANUM); // sort by which grade item
|
||||||
|
@ -127,12 +126,6 @@ if ($data = data_submitted() and confirm_sesskey() and has_capability('moodle/gr
|
||||||
$warnings = array();
|
$warnings = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Override perpage if set in URL
|
|
||||||
if ($perpageurl) {
|
|
||||||
$report->user_prefs['studentsperpage'] = $perpageurl;
|
|
||||||
}
|
|
||||||
|
|
||||||
// final grades MUST be loaded after the processing
|
// final grades MUST be loaded after the processing
|
||||||
$report->load_users();
|
$report->load_users();
|
||||||
$numusers = $report->get_numusers();
|
$numusers = $report->get_numusers();
|
||||||
|
@ -162,6 +155,7 @@ if ($USER->gradeediting[$course->id] && ($report->get_pref('showquickfeedback')
|
||||||
echo '<input type="hidden" value="'.s($courseid).'" name="id" />';
|
echo '<input type="hidden" value="'.s($courseid).'" name="id" />';
|
||||||
echo '<input type="hidden" value="'.sesskey().'" name="sesskey" />';
|
echo '<input type="hidden" value="'.sesskey().'" name="sesskey" />';
|
||||||
echo '<input type="hidden" value="grader" name="report"/>';
|
echo '<input type="hidden" value="grader" name="report"/>';
|
||||||
|
echo '<input type="hidden" value="'.$page.'" name="page"/>';
|
||||||
echo $reporthtml;
|
echo $reporthtml;
|
||||||
echo '<div class="submit"><input type="submit" value="'.s(get_string('update')).'" /></div>';
|
echo '<div class="submit"><input type="submit" value="'.s(get_string('update')).'" /></div>';
|
||||||
echo '</div></form>';
|
echo '</div></form>';
|
||||||
|
|
|
@ -135,12 +135,11 @@ class grade_report_grader extends grade_report {
|
||||||
|
|
||||||
$this->baseurl = new moodle_url('index.php', array('id' => $this->courseid));
|
$this->baseurl = new moodle_url('index.php', array('id' => $this->courseid));
|
||||||
|
|
||||||
$studentsperpage = $this->get_pref('studentsperpage');
|
if (!empty($this->page)) {
|
||||||
if (!empty($studentsperpage)) {
|
$this->baseurl->params(array('page' => $this->page));
|
||||||
$this->baseurl->params(array('perpage' => $studentsperpage, 'page' => $this->page));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->pbarurl = new moodle_url('/grade/report/grader/index.php', array('id' => $this->courseid, 'perpage' => $studentsperpage));
|
$this->pbarurl = new moodle_url('/grade/report/grader/index.php', array('id' => $this->courseid));
|
||||||
|
|
||||||
$this->setup_groups();
|
$this->setup_groups();
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ $cancel = optional_param('cancel', false, PARAM_BOOL);
|
||||||
$group = $DB->get_record('groups', array('id'=>$groupid), '*', MUST_EXIST);
|
$group = $DB->get_record('groups', array('id'=>$groupid), '*', MUST_EXIST);
|
||||||
$course = $DB->get_record('course', array('id'=>$group->courseid), '*', MUST_EXIST);
|
$course = $DB->get_record('course', array('id'=>$group->courseid), '*', MUST_EXIST);
|
||||||
|
|
||||||
$PAGE->set_url('/groups/members.php', array('id'=>$groupid));
|
$PAGE->set_url('/group/members.php', array('group'=>$groupid));
|
||||||
$PAGE->set_pagelayout('standard');
|
$PAGE->set_pagelayout('standard');
|
||||||
|
|
||||||
require_login($course);
|
require_login($course);
|
||||||
|
|
|
@ -54,6 +54,8 @@ $string['blogentriesbyuseraboutmodule'] = 'Blog entries about this {$a->mod} by
|
||||||
$string['blogentrybyuser'] = 'Blog entry by {$a}';
|
$string['blogentrybyuser'] = 'Blog entry by {$a}';
|
||||||
$string['blogpreferences'] = 'Blog preferences';
|
$string['blogpreferences'] = 'Blog preferences';
|
||||||
$string['blogs'] = 'Blogs';
|
$string['blogs'] = 'Blogs';
|
||||||
|
$string['blogscourse'] = 'Course blogs';
|
||||||
|
$string['blogssite'] = 'Site blogs';
|
||||||
$string['blogtags'] = 'Blog tags';
|
$string['blogtags'] = 'Blog tags';
|
||||||
$string['cannotviewcourseblog'] = 'You do not have the required permissions to view blogs in this course';
|
$string['cannotviewcourseblog'] = 'You do not have the required permissions to view blogs in this course';
|
||||||
$string['cannotviewcourseorgroupblog'] = 'You do not have the required permissions to view blogs in this course/group';
|
$string['cannotviewcourseorgroupblog'] = 'You do not have the required permissions to view blogs in this course/group';
|
||||||
|
|
|
@ -128,6 +128,7 @@ $string['settings'] = 'Settings';
|
||||||
$string['settingssaved'] = 'Your settings have been saved';
|
$string['settingssaved'] = 'Your settings have been saved';
|
||||||
$string['showmessagewindow'] = 'Popup window on new message';
|
$string['showmessagewindow'] = 'Popup window on new message';
|
||||||
$string['strftimedaydatetime'] = '%A, %d %B %Y, %I:%M %p';
|
$string['strftimedaydatetime'] = '%A, %d %B %Y, %I:%M %p';
|
||||||
|
$string['thisconversation'] = 'this conversation';
|
||||||
$string['timenosee'] = 'Minutes since I was last seen online';
|
$string['timenosee'] = 'Minutes since I was last seen online';
|
||||||
$string['timesent'] = 'Time sent';
|
$string['timesent'] = 'Time sent';
|
||||||
$string['touserdoesntexist'] = 'You can not send a message to a user id ({$a}) that doesn\'t exist';
|
$string['touserdoesntexist'] = 'You can not send a message to a user id ({$a}) that doesn\'t exist';
|
||||||
|
|
|
@ -46,7 +46,11 @@ foreach ($files as $fsfile) {
|
||||||
// does not exist
|
// does not exist
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (strpos($jsfile, $CFG->dirroot . DIRECTORY_SEPARATOR) !== 0) {
|
if ($CFG->dirroot === '/') {
|
||||||
|
// Some shared hosting sites serve files directly from '/',
|
||||||
|
// this is NOT supported, but at least allow JS when showing
|
||||||
|
// errors and warnings.
|
||||||
|
} else if (strpos($jsfile, $CFG->dirroot . DIRECTORY_SEPARATOR) !== 0) {
|
||||||
// hackers - not in dirroot
|
// hackers - not in dirroot
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1061,7 +1061,10 @@ class global_navigation extends navigation_node {
|
||||||
|
|
||||||
$mycourses = enrol_get_my_courses(NULL, 'visible DESC,sortorder ASC', $limit);
|
$mycourses = enrol_get_my_courses(NULL, 'visible DESC,sortorder ASC', $limit);
|
||||||
$showallcourses = (count($mycourses) == 0 || !empty($CFG->navshowallcourses));
|
$showallcourses = (count($mycourses) == 0 || !empty($CFG->navshowallcourses));
|
||||||
$showcategories = ($showallcourses && $this->show_categories());
|
// When checking if we are to show categories there is an additional override.
|
||||||
|
// If the user is viewing a category then we will load it regardless of settings.
|
||||||
|
// to ensure that the navigation is consistent.
|
||||||
|
$showcategories = $this->page->context->contextlevel == CONTEXT_COURSECAT || ($showallcourses && $this->show_categories());
|
||||||
$issite = ($this->page->course->id == SITEID);
|
$issite = ($this->page->course->id == SITEID);
|
||||||
$ismycourse = (array_key_exists($this->page->course->id, $mycourses));
|
$ismycourse = (array_key_exists($this->page->course->id, $mycourses));
|
||||||
|
|
||||||
|
@ -1086,7 +1089,6 @@ class global_navigation extends navigation_node {
|
||||||
|
|
||||||
$canviewcourseprofile = true;
|
$canviewcourseprofile = true;
|
||||||
|
|
||||||
if (!$issite) {
|
|
||||||
// Next load context specific content into the navigation
|
// Next load context specific content into the navigation
|
||||||
switch ($this->page->context->contextlevel) {
|
switch ($this->page->context->contextlevel) {
|
||||||
case CONTEXT_SYSTEM :
|
case CONTEXT_SYSTEM :
|
||||||
|
@ -1098,9 +1100,17 @@ class global_navigation extends navigation_node {
|
||||||
// This has already been loaded we just need to map the variable
|
// This has already been loaded we just need to map the variable
|
||||||
$coursenode = $frontpagecourse;
|
$coursenode = $frontpagecourse;
|
||||||
$this->load_all_categories($this->page->context->instanceid, $showcategories);
|
$this->load_all_categories($this->page->context->instanceid, $showcategories);
|
||||||
|
if (array_key_exists($this->page->context->instanceid, $this->addedcategories)) {
|
||||||
|
$this->addedcategories[$this->page->context->instanceid]->make_active();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case CONTEXT_BLOCK :
|
case CONTEXT_BLOCK :
|
||||||
case CONTEXT_COURSE :
|
case CONTEXT_COURSE :
|
||||||
|
if ($issite) {
|
||||||
|
// If it is the front page course, or a block on it then
|
||||||
|
// everything has already been loaded.
|
||||||
|
break;
|
||||||
|
}
|
||||||
// Load the course associated with the page into the navigation
|
// Load the course associated with the page into the navigation
|
||||||
$course = $this->page->course;
|
$course = $this->page->course;
|
||||||
if ($showcategories && !$ismycourse) {
|
if ($showcategories && !$ismycourse) {
|
||||||
|
@ -1149,6 +1159,18 @@ class global_navigation extends navigation_node {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CONTEXT_MODULE :
|
case CONTEXT_MODULE :
|
||||||
|
if ($issite) {
|
||||||
|
// If this is the site course then most information will have
|
||||||
|
// already been loaded.
|
||||||
|
// However we need to check if there is more content that can
|
||||||
|
// yet be loaded for the specific module instance.
|
||||||
|
$activitynode = $this->rootnodes['site']->get($this->page->cm->id, navigation_node::TYPE_ACTIVITY);
|
||||||
|
if ($activitynode) {
|
||||||
|
$this->load_activity($this->page->cm, $this->page->course, $activitynode);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
$course = $this->page->course;
|
$course = $this->page->course;
|
||||||
$cm = $this->page->cm;
|
$cm = $this->page->cm;
|
||||||
|
|
||||||
|
@ -1234,6 +1256,11 @@ class global_navigation extends navigation_node {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CONTEXT_USER :
|
case CONTEXT_USER :
|
||||||
|
if ($issite) {
|
||||||
|
// The users profile information etc is already loaded
|
||||||
|
// for the front page.
|
||||||
|
break;
|
||||||
|
}
|
||||||
$course = $this->page->course;
|
$course = $this->page->course;
|
||||||
if ($showcategories && !$ismycourse) {
|
if ($showcategories && !$ismycourse) {
|
||||||
$this->load_all_categories($course->category, $showcategories);
|
$this->load_all_categories($course->category, $showcategories);
|
||||||
|
@ -1258,17 +1285,6 @@ class global_navigation extends navigation_node {
|
||||||
$sections = $this->load_course_sections($course, $coursenode);
|
$sections = $this->load_course_sections($course, $coursenode);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
// We need to check if the user is viewing a front page module.
|
|
||||||
// If so then there is potentially more content to load yet for that
|
|
||||||
// module.
|
|
||||||
if ($this->page->context->contextlevel == CONTEXT_MODULE) {
|
|
||||||
$activitynode = $this->rootnodes['site']->get($this->page->cm->id, navigation_node::TYPE_ACTIVITY);
|
|
||||||
if ($activitynode) {
|
|
||||||
$this->load_activity($this->page->cm, $this->page->course, $activitynode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$limit = 20;
|
$limit = 20;
|
||||||
if (!empty($CFG->navcourselimit)) {
|
if (!empty($CFG->navcourselimit)) {
|
||||||
|
@ -1347,7 +1363,9 @@ class global_navigation extends navigation_node {
|
||||||
protected function show_categories() {
|
protected function show_categories() {
|
||||||
global $CFG, $DB;
|
global $CFG, $DB;
|
||||||
if ($this->showcategories === null) {
|
if ($this->showcategories === null) {
|
||||||
$this->showcategories = !empty($CFG->navshowcategories) && $DB->count_records('course_categories') > 1;
|
$show = $this->page->context->contextlevel == CONTEXT_COURSECAT;
|
||||||
|
$show = $show || (!empty($CFG->navshowcategories) && $DB->count_records('course_categories') > 1);
|
||||||
|
$this->showcategories = $show;
|
||||||
}
|
}
|
||||||
return $this->showcategories;
|
return $this->showcategories;
|
||||||
}
|
}
|
||||||
|
@ -2274,7 +2292,7 @@ class global_navigation extends navigation_node {
|
||||||
if (($CFG->bloglevel == BLOG_GLOBAL_LEVEL or ($CFG->bloglevel == BLOG_SITE_LEVEL and (isloggedin() and !isguestuser())))
|
if (($CFG->bloglevel == BLOG_GLOBAL_LEVEL or ($CFG->bloglevel == BLOG_SITE_LEVEL and (isloggedin() and !isguestuser())))
|
||||||
and has_capability('moodle/blog:view', get_context_instance(CONTEXT_SYSTEM))) {
|
and has_capability('moodle/blog:view', get_context_instance(CONTEXT_SYSTEM))) {
|
||||||
$blogsurls = new moodle_url('/blog/index.php', array('courseid' => $filterselect));
|
$blogsurls = new moodle_url('/blog/index.php', array('courseid' => $filterselect));
|
||||||
$participants->add(get_string('blogs','blog'), $blogsurls->out());
|
$participants->add(get_string('blogscourse','blog'), $blogsurls->out());
|
||||||
}
|
}
|
||||||
if (!empty($CFG->enablenotes) && (has_capability('moodle/notes:manage', $this->page->context) || has_capability('moodle/notes:view', $this->page->context))) {
|
if (!empty($CFG->enablenotes) && (has_capability('moodle/notes:manage', $this->page->context) || has_capability('moodle/notes:view', $this->page->context))) {
|
||||||
$participants->add(get_string('notes','notes'), new moodle_url('/notes/index.php', array('filtertype'=>'course', 'filterselect'=>$course->id)));
|
$participants->add(get_string('notes','notes'), new moodle_url('/notes/index.php', array('filtertype'=>'course', 'filterselect'=>$course->id)));
|
||||||
|
@ -2339,7 +2357,7 @@ class global_navigation extends navigation_node {
|
||||||
and ($CFG->bloglevel == BLOG_GLOBAL_LEVEL or ($CFG->bloglevel == BLOG_SITE_LEVEL and (isloggedin() and !isguestuser())))
|
and ($CFG->bloglevel == BLOG_GLOBAL_LEVEL or ($CFG->bloglevel == BLOG_SITE_LEVEL and (isloggedin() and !isguestuser())))
|
||||||
and has_capability('moodle/blog:view', get_context_instance(CONTEXT_SYSTEM))) {
|
and has_capability('moodle/blog:view', get_context_instance(CONTEXT_SYSTEM))) {
|
||||||
$blogsurls = new moodle_url('/blog/index.php', array('courseid' => $filterselect));
|
$blogsurls = new moodle_url('/blog/index.php', array('courseid' => $filterselect));
|
||||||
$coursenode->add(get_string('blogs','blog'), $blogsurls->out());
|
$coursenode->add(get_string('blogssite','blog'), $blogsurls->out());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Notes
|
// Notes
|
||||||
|
|
|
@ -441,6 +441,12 @@ class theme_config {
|
||||||
if (is_readable($rendererfile)) {
|
if (is_readable($rendererfile)) {
|
||||||
// may contain core and plugin renderers and renderer factory
|
// may contain core and plugin renderers and renderer factory
|
||||||
include_once($rendererfile);
|
include_once($rendererfile);
|
||||||
|
} else {
|
||||||
|
// check if renderers.php file is missnamed renderer.php
|
||||||
|
if (is_readable($this->dir.'/renderer.php')) {
|
||||||
|
debugging('Developer hint: '.$this->dir.'/renderer.php should be renamed to ' . $this->dir."/renderers.php.
|
||||||
|
See: http://docs.moodle.org/dev/Output_renderers#Theme_renderers.", DEBUG_DEVELOPER);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// cascade all layouts properly
|
// cascade all layouts properly
|
||||||
|
|
|
@ -408,7 +408,7 @@ class page_requirements_manager {
|
||||||
array('saving', 'repository'), array('search', 'repository'), array('searching', 'repository'), array('size', 'repository'),
|
array('saving', 'repository'), array('search', 'repository'), array('searching', 'repository'), array('size', 'repository'),
|
||||||
array('submit', 'repository'), array('sync', 'repository'), array('title', 'repository'), array('upload', 'repository'),
|
array('submit', 'repository'), array('sync', 'repository'), array('title', 'repository'), array('upload', 'repository'),
|
||||||
array('uploading', 'repository'), array('xhtmlerror', 'repository'),
|
array('uploading', 'repository'), array('xhtmlerror', 'repository'),
|
||||||
array('cancel'), array('chooselicense', 'repository'), array('author', 'repository'),
|
array('cancel'), array('chooselicense', 'repository'), array('author', 'repository'),array('next', 'moodle'),
|
||||||
array('ok', 'moodle'), array('error', 'moodle'), array('info', 'moodle'), array('norepositoriesavailable', 'repository'), array('norepositoriesexternalavailable', 'repository'),
|
array('ok', 'moodle'), array('error', 'moodle'), array('info', 'moodle'), array('norepositoriesavailable', 'repository'), array('norepositoriesexternalavailable', 'repository'),
|
||||||
array('nofilesattached', 'repository'), array('filepicker', 'repository'),
|
array('nofilesattached', 'repository'), array('filepicker', 'repository'),
|
||||||
array('nofilesavailable', 'repository'), array('overwrite', 'repository'),
|
array('nofilesavailable', 'repository'), array('overwrite', 'repository'),
|
||||||
|
|
|
@ -359,14 +359,14 @@ function search_generate_text_SQL($parsetree, $datafield, $metafield, $mainidfie
|
||||||
|
|
||||||
/// First of all, search for reasons to switch to standard SQL generation
|
/// First of all, search for reasons to switch to standard SQL generation
|
||||||
/// Only mysql are supported for now
|
/// Only mysql are supported for now
|
||||||
if ($DB->get_db_family() != 'mysql') {
|
if ($DB->get_dbfamily() != 'mysql') {
|
||||||
return search_generate_SQL($parsetree, $datafield, $metafield, $mainidfield, $useridfield,
|
return search_generate_SQL($parsetree, $datafield, $metafield, $mainidfield, $useridfield,
|
||||||
$userfirstnamefield, $userlastnamefield, $timefield, $instancefield);
|
$userfirstnamefield, $userlastnamefield, $timefield, $instancefield);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Some languages don't have "word separators" and MySQL FULLTEXT doesn't perform well with them, so
|
/// Some languages don't have "word separators" and MySQL FULLTEXT doesn't perform well with them, so
|
||||||
/// switch to standard SQL search generation
|
/// switch to standard SQL search generation
|
||||||
if ($DB->get_db_family() == 'mysql') {
|
if ($DB->get_dbfamily() == 'mysql') {
|
||||||
$nonseparatedlangs = array('ja', 'th', 'zh_cn', 'zh_tw');
|
$nonseparatedlangs = array('ja', 'th', 'zh_cn', 'zh_tw');
|
||||||
if (in_array(current_language(), $nonseparatedlangs)) {
|
if (in_array(current_language(), $nonseparatedlangs)) {
|
||||||
return search_generate_SQL($parsetree, $datafield, $metafield, $mainidfield, $useridfield,
|
return search_generate_SQL($parsetree, $datafield, $metafield, $mainidfield, $useridfield,
|
||||||
|
@ -445,12 +445,12 @@ function search_generate_text_SQL($parsetree, $datafield, $metafield, $mainidfie
|
||||||
$text_sql_string .= ', ' . $metafield;
|
$text_sql_string .= ', ' . $metafield;
|
||||||
}
|
}
|
||||||
/// Begin with the AGAINST clause
|
/// Begin with the AGAINST clause
|
||||||
$text_sql_string .= ') AGAINST (' . "'";
|
$text_sql_string .= ') AGAINST (';
|
||||||
/// Add the search terms
|
/// Add the search terms
|
||||||
$text_sql_string .= ':sgt'.$p;
|
$text_sql_string .= ':sgt'.$p;
|
||||||
$params['sgt'.$p++] = trim($datasearch_clause);
|
$params['sgt'.$p++] = trim($datasearch_clause);
|
||||||
/// Close AGAINST clause
|
/// Close AGAINST clause
|
||||||
$text_sql_string .= "' IN BOOLEAN MODE)";
|
$text_sql_string .= " IN BOOLEAN MODE)";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// Now add the metasearch_clause
|
/// Now add the metasearch_clause
|
||||||
|
@ -463,12 +463,12 @@ function search_generate_text_SQL($parsetree, $datafield, $metafield, $mainidfie
|
||||||
}
|
}
|
||||||
$text_sql_string .= 'MATCH (' . $metafield;
|
$text_sql_string .= 'MATCH (' . $metafield;
|
||||||
/// Begin with the AGAINST clause
|
/// Begin with the AGAINST clause
|
||||||
$text_sql_string .= ') AGAINST (' . "'";
|
$text_sql_string .= ') AGAINST (';
|
||||||
/// Add the search terms
|
/// Add the search terms
|
||||||
$text_sql_string .= ':sgt'.$p;
|
$text_sql_string .= ':sgt'.$p;
|
||||||
$params['sgt'.$p++] = trim($metasearch_clause);
|
$params['sgt'.$p++] = trim($metasearch_clause);
|
||||||
/// Close AGAINST clause
|
/// Close AGAINST clause
|
||||||
$text_sql_string .= "' IN BOOLEAN MODE)";
|
$text_sql_string .= " IN BOOLEAN MODE)";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// Finally add the non-text conditions
|
/// Finally add the non-text conditions
|
||||||
|
|
|
@ -31,12 +31,9 @@ $course = optional_param('course', SITEID, PARAM_INT); // course id (defaults
|
||||||
$disableall = optional_param('disableall', 0, PARAM_BOOL); //disable all of this user's notifications
|
$disableall = optional_param('disableall', 0, PARAM_BOOL); //disable all of this user's notifications
|
||||||
|
|
||||||
$url = new moodle_url('/message/edit.php');
|
$url = new moodle_url('/message/edit.php');
|
||||||
if ($userid !== $USER->id) {
|
|
||||||
$url->param('id', $userid);
|
$url->param('id', $userid);
|
||||||
}
|
|
||||||
if ($course != SITEID) {
|
|
||||||
$url->param('course', $course);
|
$url->param('course', $course);
|
||||||
}
|
|
||||||
$PAGE->set_url($url);
|
$PAGE->set_url($url);
|
||||||
|
|
||||||
if (!$course = $DB->get_record('course', array('id' => $course))) {
|
if (!$course = $DB->get_record('course', array('id' => $course))) {
|
||||||
|
|
|
@ -816,6 +816,12 @@ function message_print_recent_conversations($user=null, $showicontext=false) {
|
||||||
|
|
||||||
$conversations = message_get_recent_conversations($user);
|
$conversations = message_get_recent_conversations($user);
|
||||||
|
|
||||||
|
// Attach context url information to create the "View this conversation" type links
|
||||||
|
foreach($conversations as $conversation) {
|
||||||
|
$conversation->contexturl = new moodle_url("/message/index.php?user2={$conversation->id}");
|
||||||
|
$conversation->contexturlname = get_string('thisconversation', 'message');
|
||||||
|
}
|
||||||
|
|
||||||
$showotheruser = true;
|
$showotheruser = true;
|
||||||
message_print_recent_messages_table($conversations, $user, $showotheruser, $showicontext);
|
message_print_recent_messages_table($conversations, $user, $showotheruser, $showicontext);
|
||||||
}
|
}
|
||||||
|
|
|
@ -349,10 +349,10 @@ if ($do_show == 'edit') {
|
||||||
echo '<span class="feedback_item_command_toggle">';
|
echo '<span class="feedback_item_command_toggle">';
|
||||||
if ($feedbackitem->required == 1) {
|
if ($feedbackitem->required == 1) {
|
||||||
$buttontitle = get_string('switch_item_to_not_required', 'feedback');
|
$buttontitle = get_string('switch_item_to_not_required', 'feedback');
|
||||||
$buttonimg = 'pics/required.gif';
|
$buttonimg = $OUTPUT->pix_url('required', 'feedback');
|
||||||
} else {
|
} else {
|
||||||
$buttontitle = get_string('switch_item_to_required', 'feedback');
|
$buttontitle = get_string('switch_item_to_required', 'feedback');
|
||||||
$buttonimg = 'pics/notrequired.gif';
|
$buttonimg = $OUTPUT->pix_url('notrequired', 'feedback');
|
||||||
}
|
}
|
||||||
$urlparams = array('switchitemrequired'=>$feedbackitem->id);
|
$urlparams = array('switchitemrequired'=>$feedbackitem->id);
|
||||||
$requiredurl = new moodle_url($url, $urlparams);
|
$requiredurl = new moodle_url($url, $urlparams);
|
||||||
|
|
|
@ -216,6 +216,7 @@ class feedback_item_multichoice extends feedback_item_base {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function print_analysed($item, $itemnr = '', $groupid = false, $courseid = false) {
|
public function print_analysed($item, $itemnr = '', $groupid = false, $courseid = false) {
|
||||||
|
global $OUTPUT;
|
||||||
$sep_dec = get_string('separator_decimal', 'feedback');
|
$sep_dec = get_string('separator_decimal', 'feedback');
|
||||||
if (substr($sep_dec, 0, 2) == '[[') {
|
if (substr($sep_dec, 0, 2) == '[[') {
|
||||||
$sep_dec = FEEDBACK_DECIMAL;
|
$sep_dec = FEEDBACK_DECIMAL;
|
||||||
|
@ -237,7 +238,7 @@ class feedback_item_multichoice extends feedback_item_base {
|
||||||
$pixnr = 0;
|
$pixnr = 0;
|
||||||
foreach ($analysed_vals as $val) {
|
foreach ($analysed_vals as $val) {
|
||||||
$intvalue = $pixnr % 10;
|
$intvalue = $pixnr % 10;
|
||||||
$pix = "pics/$intvalue.gif";
|
$pix = $OUTPUT->pix_url('multichoice/' . $intvalue, 'feedback');
|
||||||
$pixnr++;
|
$pixnr++;
|
||||||
$pixwidth = intval($val->quotient * FEEDBACK_MAX_PIX_LENGTH);
|
$pixwidth = intval($val->quotient * FEEDBACK_MAX_PIX_LENGTH);
|
||||||
$quotient = number_format(($val->quotient * 100), 2, $sep_dec, $sep_thous);
|
$quotient = number_format(($val->quotient * 100), 2, $sep_dec, $sep_thous);
|
||||||
|
|
|
@ -192,6 +192,7 @@ class feedback_item_multichoicerated extends feedback_item_base {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function print_analysed($item, $itemnr = '', $groupid = false, $courseid = false) {
|
public function print_analysed($item, $itemnr = '', $groupid = false, $courseid = false) {
|
||||||
|
global $OUTPUT;
|
||||||
$sep_dec = get_string('separator_decimal', 'feedback');
|
$sep_dec = get_string('separator_decimal', 'feedback');
|
||||||
if (substr($sep_dec, 0, 2) == '[[') {
|
if (substr($sep_dec, 0, 2) == '[[') {
|
||||||
$sep_dec = FEEDBACK_DECIMAL;
|
$sep_dec = FEEDBACK_DECIMAL;
|
||||||
|
@ -212,7 +213,7 @@ class feedback_item_multichoicerated extends feedback_item_base {
|
||||||
$avg = 0.0;
|
$avg = 0.0;
|
||||||
foreach ($analysed_vals as $val) {
|
foreach ($analysed_vals as $val) {
|
||||||
$intvalue = $pixnr % 10;
|
$intvalue = $pixnr % 10;
|
||||||
$pix = "pics/$intvalue.gif";
|
$pix = $OUTPUT->pix_url('multichoice/' . $intvalue, 'feedback');
|
||||||
$pixnr++;
|
$pixnr++;
|
||||||
$pixwidth = intval($val->quotient * FEEDBACK_MAX_PIX_LENGTH);
|
$pixwidth = intval($val->quotient * FEEDBACK_MAX_PIX_LENGTH);
|
||||||
|
|
||||||
|
|
Before Width: | Height: | Size: 35 B After Width: | Height: | Size: 35 B |
Before Width: | Height: | Size: 43 B After Width: | Height: | Size: 43 B |
Before Width: | Height: | Size: 35 B After Width: | Height: | Size: 35 B |
Before Width: | Height: | Size: 35 B After Width: | Height: | Size: 35 B |
Before Width: | Height: | Size: 35 B After Width: | Height: | Size: 35 B |
Before Width: | Height: | Size: 35 B After Width: | Height: | Size: 35 B |
Before Width: | Height: | Size: 35 B After Width: | Height: | Size: 35 B |
Before Width: | Height: | Size: 35 B After Width: | Height: | Size: 35 B |
Before Width: | Height: | Size: 35 B After Width: | Height: | Size: 35 B |
Before Width: | Height: | Size: 35 B After Width: | Height: | Size: 35 B |
Before Width: | Height: | Size: 143 B After Width: | Height: | Size: 143 B |
Before Width: | Height: | Size: 217 B After Width: | Height: | Size: 217 B |
|
@ -58,6 +58,7 @@ if ($mform->is_cancelled()) {
|
||||||
|
|
||||||
} else if ($formdata = $mform->get_data()) {
|
} else if ($formdata = $mform->get_data()) {
|
||||||
$formdata = file_postupdate_standard_filemanager($formdata, 'files', $options, $context, 'mod_folder', 'content', 0);
|
$formdata = file_postupdate_standard_filemanager($formdata, 'files', $options, $context, 'mod_folder', 'content', 0);
|
||||||
|
$DB->set_field('folder', 'revision', $folder->revision+1, array('id'=>$folder->id));
|
||||||
redirect(new moodle_url('/mod/folder/view.php', array('id'=>$cm->id)));
|
redirect(new moodle_url('/mod/folder/view.php', array('id'=>$cm->id)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2882,7 +2882,12 @@ function glossary_comment_validate($comment_param) {
|
||||||
if (!$record = $DB->get_record('glossary_entries', array('id'=>$comment_param->itemid))) {
|
if (!$record = $DB->get_record('glossary_entries', array('id'=>$comment_param->itemid))) {
|
||||||
throw new comment_exception('invalidcommentitemid');
|
throw new comment_exception('invalidcommentitemid');
|
||||||
}
|
}
|
||||||
if (!$glossary = $DB->get_record('glossary', array('id'=>$record->glossaryid))) {
|
if ($record->sourceglossaryid && $record->sourceglossaryid == $comment_param->cm->instance) {
|
||||||
|
$glossary = $DB->get_record('glossary', array('id'=>$record->sourceglossaryid));
|
||||||
|
} else {
|
||||||
|
$glossary = $DB->get_record('glossary', array('id'=>$record->glossaryid));
|
||||||
|
}
|
||||||
|
if (!$glossary) {
|
||||||
throw new comment_exception('invalidid', 'data');
|
throw new comment_exception('invalidid', 'data');
|
||||||
}
|
}
|
||||||
if (!$course = $DB->get_record('course', array('id'=>$glossary->course))) {
|
if (!$course = $DB->get_record('course', array('id'=>$glossary->course))) {
|
||||||
|
|
|
@ -145,8 +145,7 @@ class lesson_page_type_multichoice extends lesson_page {
|
||||||
$answers = $this->get_used_answers();
|
$answers = $this->get_used_answers();
|
||||||
$ncorrect = 0;
|
$ncorrect = 0;
|
||||||
$nhits = 0;
|
$nhits = 0;
|
||||||
$correctresponse = '';
|
$responses = array();
|
||||||
$wrongresponse = '';
|
|
||||||
$correctanswerid = 0;
|
$correctanswerid = 0;
|
||||||
$wronganswerid = 0;
|
$wronganswerid = 0;
|
||||||
// store student's answers for displaying on feedback page
|
// store student's answers for displaying on feedback page
|
||||||
|
@ -155,6 +154,9 @@ class lesson_page_type_multichoice extends lesson_page {
|
||||||
foreach ($studentanswers as $answerid) {
|
foreach ($studentanswers as $answerid) {
|
||||||
if ($answerid == $answer->id) {
|
if ($answerid == $answer->id) {
|
||||||
$result->studentanswer .= '<br />'.format_text($answer->answer, $answer->answerformat, $formattextdefoptions);
|
$result->studentanswer .= '<br />'.format_text($answer->answer, $answer->answerformat, $formattextdefoptions);
|
||||||
|
if (trim(strip_tags($answer->response))) {
|
||||||
|
$responses[$answerid] = format_text($answer->response, $answer->responseformat, $formattextdefoptions);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -182,10 +184,6 @@ class lesson_page_type_multichoice extends lesson_page {
|
||||||
if ($correctanswerid == 0) {
|
if ($correctanswerid == 0) {
|
||||||
$correctanswerid = $answer->id;
|
$correctanswerid = $answer->id;
|
||||||
}
|
}
|
||||||
// ...also save any response from the correct answers...
|
|
||||||
if (trim(strip_tags($answer->response))) {
|
|
||||||
$correctresponse = format_text($answer->response, $answer->responseformat, $formattextdefoptions);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// save the first jumpto page id, may be needed!...
|
// save the first jumpto page id, may be needed!...
|
||||||
if (!isset($wrongpageid)) {
|
if (!isset($wrongpageid)) {
|
||||||
|
@ -196,10 +194,6 @@ class lesson_page_type_multichoice extends lesson_page {
|
||||||
if ($wronganswerid == 0) {
|
if ($wronganswerid == 0) {
|
||||||
$wronganswerid = $answer->id;
|
$wronganswerid = $answer->id;
|
||||||
}
|
}
|
||||||
// ...and from the incorrect ones, don't know which to use at this stage
|
|
||||||
if (trim(strip_tags($answer->response))) {
|
|
||||||
$wrongresponse = format_text($answer->response, $answer->responseformat, $formattextdefoptions);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -220,10 +214,6 @@ class lesson_page_type_multichoice extends lesson_page {
|
||||||
if ($correctanswerid == 0) {
|
if ($correctanswerid == 0) {
|
||||||
$correctanswerid = $answer->id;
|
$correctanswerid = $answer->id;
|
||||||
}
|
}
|
||||||
// ...also save any response from the correct answers...
|
|
||||||
if (trim(strip_tags($answer->response))) {
|
|
||||||
$correctresponse = format_text($answer->response, $answer->responseformat, $formattextdefoptions);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// save the first jumpto page id, may be needed!...
|
// save the first jumpto page id, may be needed!...
|
||||||
if (!isset($wrongpageid)) {
|
if (!isset($wrongpageid)) {
|
||||||
|
@ -234,20 +224,16 @@ class lesson_page_type_multichoice extends lesson_page {
|
||||||
if ($wronganswerid == 0) {
|
if ($wronganswerid == 0) {
|
||||||
$wronganswerid = $answer->id;
|
$wronganswerid = $answer->id;
|
||||||
}
|
}
|
||||||
// ...and from the incorrect ones, don't know which to use at this stage
|
|
||||||
if (trim(strip_tags($answer->response))) {
|
|
||||||
$wrongresponse = format_text($answer->response, $answer->responseformat, $formattextdefoptions);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((count($studentanswers) == $ncorrect) and ($nhits == $ncorrect)) {
|
if ((count($studentanswers) == $ncorrect) and ($nhits == $ncorrect)) {
|
||||||
$result->correctanswer = true;
|
$result->correctanswer = true;
|
||||||
$result->response = $correctresponse;
|
$result->response = implode('<br />', $responses);
|
||||||
$result->newpageid = $correctpageid;
|
$result->newpageid = $correctpageid;
|
||||||
$result->answerid = $correctanswerid;
|
$result->answerid = $correctanswerid;
|
||||||
} else {
|
} else {
|
||||||
$result->response = $wrongresponse;
|
$result->response = implode('<br />', $responses);
|
||||||
$result->newpageid = $wrongpageid;
|
$result->newpageid = $wrongpageid;
|
||||||
$result->answerid = $wronganswerid;
|
$result->answerid = $wronganswerid;
|
||||||
}
|
}
|
||||||
|
|
|
@ -143,6 +143,29 @@ M.mod_quiz.nav.init = function(Y) {
|
||||||
|
|
||||||
var form = Y.one('#responseform');
|
var form = Y.one('#responseform');
|
||||||
if (form) {
|
if (form) {
|
||||||
|
function find_enabled_submit() {
|
||||||
|
// This is rather inelegant, but the CSS3 selector
|
||||||
|
// return form.one('input[type=submit]:enabled');
|
||||||
|
// does not work in IE7, 8 or 9 for me.
|
||||||
|
var enabledsubmit = null;
|
||||||
|
form.all('input[type=submit]').each(function(submit) {
|
||||||
|
if (!enabledsubmit && !submit.get('disabled')) {
|
||||||
|
enabledsubmit = submit;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return enabledsubmit;
|
||||||
|
}
|
||||||
|
|
||||||
|
function nav_to_page(pageno) {
|
||||||
|
Y.one('#followingpage').set('value', pageno);
|
||||||
|
|
||||||
|
// Automatically submit the form. We do it this strange way because just
|
||||||
|
// calling form.submit() does not run the form's submit event handlers.
|
||||||
|
var submit = find_enabled_submit();
|
||||||
|
submit.set('name', '');
|
||||||
|
submit.getDOMNode().click();
|
||||||
|
};
|
||||||
|
|
||||||
Y.delegate('click', function(e) {
|
Y.delegate('click', function(e) {
|
||||||
if (this.hasClass('thispage')) {
|
if (this.hasClass('thispage')) {
|
||||||
return;
|
return;
|
||||||
|
@ -157,22 +180,20 @@ M.mod_quiz.nav.init = function(Y) {
|
||||||
} else {
|
} else {
|
||||||
pageno = 0;
|
pageno = 0;
|
||||||
}
|
}
|
||||||
Y.one('#followingpage').set('value', pageno);
|
|
||||||
|
|
||||||
var questionidmatch = this.get('href').match(/#q(\d+)/);
|
var questionidmatch = this.get('href').match(/#q(\d+)/);
|
||||||
if (questionidmatch) {
|
if (questionidmatch) {
|
||||||
form.set('action', form.get('action') + '#q' + questionidmatch[1]);
|
form.set('action', form.get('action') + '#q' + questionidmatch[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
form.submit();
|
nav_to_page(pageno);
|
||||||
}, document.body, '.qnbutton');
|
}, document.body, '.qnbutton');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Y.one('a.endtestlink')) {
|
if (Y.one('a.endtestlink')) {
|
||||||
Y.on('click', function(e) {
|
Y.on('click', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
Y.one('#followingpage').set('value', -1);
|
nav_to_page(-1);
|
||||||
Y.one('#responseform').submit();
|
|
||||||
}, 'a.endtestlink');
|
}, 'a.endtestlink');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,8 @@ require_login($course->id, true, $cm);
|
||||||
|
|
||||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||||
require_capability('mod/wiki:managewiki', $context);
|
require_capability('mod/wiki:managewiki', $context);
|
||||||
add_to_log($course->id, "wiki", "admin", "admin.php?id=$cm->id", "$wiki->id");
|
|
||||||
|
add_to_log($course->id, "wiki", "admin", "admin.php?pageid=".$page->id, $page->id, $cm->id);
|
||||||
|
|
||||||
//Delete page if a page ID to delete was supplied
|
//Delete page if a page ID to delete was supplied
|
||||||
if (!empty($delete) && confirm_sesskey()) {
|
if (!empty($delete) && confirm_sesskey()) {
|
||||||
|
|
|
@ -59,7 +59,7 @@ $course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST)
|
||||||
|
|
||||||
require_login($course->id, true, $cm);
|
require_login($course->id, true, $cm);
|
||||||
|
|
||||||
add_to_log($course->id, 'wiki', 'comments', 'comments.php?id=' . $cm->id, $wiki->id);
|
add_to_log($course->id, 'wiki', 'comments', "comments.php?pageid=".$pageid, $pageid, $cm->id);
|
||||||
|
|
||||||
/// Print the page header
|
/// Print the page header
|
||||||
$wikipage = new page_wiki_comments($wiki, $subwiki, $cm);
|
$wikipage = new page_wiki_comments($wiki, $subwiki, $cm);
|
||||||
|
|
|
@ -66,8 +66,6 @@ $course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST)
|
||||||
|
|
||||||
require_login($course->id, true, $cm);
|
require_login($course->id, true, $cm);
|
||||||
|
|
||||||
add_to_log($course->id, 'createpage', 'createpage', 'view.php?id=' . $cm->id, $wiki->id);
|
|
||||||
|
|
||||||
$wikipage = new page_wiki_create($wiki, $subwiki, $cm);
|
$wikipage = new page_wiki_create($wiki, $subwiki, $cm);
|
||||||
|
|
||||||
if (!empty($swid)) {
|
if (!empty($swid)) {
|
||||||
|
@ -80,22 +78,25 @@ if (!empty($swid)) {
|
||||||
$wikipage->set_uid($uid);
|
$wikipage->set_uid($uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($title)) {
|
if (empty($title)) {
|
||||||
$wikipage->set_title($title);
|
$title = get_string('newpage', 'wiki');
|
||||||
} else {
|
|
||||||
$wikipage->set_title(get_string('newpage', 'wiki'));
|
|
||||||
}
|
}
|
||||||
|
$wikipage->set_title($title);
|
||||||
|
|
||||||
// set page action, and initialise moodle form
|
// set page action, and initialise moodle form
|
||||||
$wikipage->set_action($action);
|
$wikipage->set_action($action);
|
||||||
|
|
||||||
switch ($action) {
|
switch ($action) {
|
||||||
case 'create':
|
case 'create':
|
||||||
$wikipage->create_page($title);
|
$newpageid = $wikipage->create_page($title);
|
||||||
|
add_to_log($course->id, 'wiki', 'add page', "view.php?pageid=".$newpageid, $newpageid, $cm->id);
|
||||||
|
redirect($CFG->wwwroot . '/mod/wiki/edit.php?pageid='.$newpageid);
|
||||||
break;
|
break;
|
||||||
case 'new':
|
case 'new':
|
||||||
if ((int)$wiki->forceformat == 1 && !empty($title)) {
|
if ((int)$wiki->forceformat == 1 && !empty($title)) {
|
||||||
$wikipage->create_page($title);
|
$newpageid = $wikipage->create_page($title);
|
||||||
|
add_to_log($course->id, 'wiki', 'add page', "view.php?pageid=".$newpageid, $newpageid, $cm->id);
|
||||||
|
redirect($CFG->wwwroot . '/mod/wiki/edit.php?pageid='.$newpageid);
|
||||||
} else {
|
} else {
|
||||||
// create link from moodle navigation block without pagetitle
|
// create link from moodle navigation block without pagetitle
|
||||||
$wikipage->print_header();
|
$wikipage->print_header();
|
||||||
|
|
|
@ -192,7 +192,7 @@ function ewiki_database_moodle($action, &$args, $sw1, $sw2) {
|
||||||
array("flags","meta","lastmodified");
|
array("flags","meta","lastmodified");
|
||||||
*/
|
*/
|
||||||
case "GETALL":
|
case "GETALL":
|
||||||
switch ($DB->get_db_family()) {
|
switch ($DB->get_dbfamily()) {
|
||||||
case 'postgres':
|
case 'postgres':
|
||||||
// All but the latest version eliminated by DISTINCT
|
// All but the latest version eliminated by DISTINCT
|
||||||
// ON (pagename)
|
// ON (pagename)
|
||||||
|
|
|
@ -67,13 +67,14 @@ if ($compare >= $comparewith) {
|
||||||
}
|
}
|
||||||
|
|
||||||
require_login($course->id, true, $cm);
|
require_login($course->id, true, $cm);
|
||||||
add_to_log($course->id, "wiki", "diff", "diff.php?id=$cm->id", "$wiki->id");
|
|
||||||
|
|
||||||
$wikipage = new page_wiki_diff($wiki, $subwiki, $cm);
|
$wikipage = new page_wiki_diff($wiki, $subwiki, $cm);
|
||||||
|
|
||||||
$wikipage->set_page($page);
|
$wikipage->set_page($page);
|
||||||
$wikipage->set_comparison($compare, $comparewith);
|
$wikipage->set_comparison($compare, $comparewith);
|
||||||
|
|
||||||
|
add_to_log($course->id, "wiki", "diff", "diff.php?pageid=".$pageid."&comparewith=".$comparewith."&compare=".$compare, $pageid, $cm->id);
|
||||||
|
|
||||||
$wikipage->print_header();
|
$wikipage->print_header();
|
||||||
|
|
||||||
$wikipage->print_content();
|
$wikipage->print_content();
|
||||||
|
|
|
@ -77,8 +77,6 @@ require_login($course, true, $cm);
|
||||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||||
require_capability('mod/wiki:editpage', $context);
|
require_capability('mod/wiki:editpage', $context);
|
||||||
|
|
||||||
add_to_log($course->id, 'wiki', 'edit', "edit.php?id=$cm->id", "$wiki->id");
|
|
||||||
|
|
||||||
if ($option == get_string('save', 'wiki')) {
|
if ($option == get_string('save', 'wiki')) {
|
||||||
if (!confirm_sesskey()) {
|
if (!confirm_sesskey()) {
|
||||||
print_error(get_string('invalidsesskey', 'wiki'));
|
print_error(get_string('invalidsesskey', 'wiki'));
|
||||||
|
@ -87,6 +85,7 @@ if ($option == get_string('save', 'wiki')) {
|
||||||
$wikipage->set_page($page);
|
$wikipage->set_page($page);
|
||||||
$wikipage->set_newcontent($newcontent);
|
$wikipage->set_newcontent($newcontent);
|
||||||
$wikipage->set_upload(true);
|
$wikipage->set_upload(true);
|
||||||
|
add_to_log($course->id, 'wiki', 'edit', "view.php?pageid=".$pageid, $pageid, $cm->id);
|
||||||
} else {
|
} else {
|
||||||
if ($option == get_string('preview')) {
|
if ($option == get_string('preview')) {
|
||||||
if (!confirm_sesskey()) {
|
if (!confirm_sesskey()) {
|
||||||
|
|
|
@ -61,7 +61,7 @@ $course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST)
|
||||||
require_login($course->id, true, $cm);
|
require_login($course->id, true, $cm);
|
||||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||||
require_capability('mod/wiki:viewpage', $context);
|
require_capability('mod/wiki:viewpage', $context);
|
||||||
add_to_log($course->id, 'wiki', 'history', 'history.php?id=' . $cm->id, $wiki->id);
|
add_to_log($course->id, 'wiki', 'history', "history.php?pageid=".$pageid, $pageid, $cm->id);
|
||||||
|
|
||||||
/// Print the page header
|
/// Print the page header
|
||||||
$wikipage = new page_wiki_history($wiki, $subwiki, $cm);
|
$wikipage = new page_wiki_history($wiki, $subwiki, $cm);
|
||||||
|
|
|
@ -45,7 +45,7 @@ require_login($course->id, true);
|
||||||
$PAGE->set_pagelayout('incourse');
|
$PAGE->set_pagelayout('incourse');
|
||||||
$context = get_context_instance(CONTEXT_COURSE, $course->id);
|
$context = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||||
|
|
||||||
add_to_log($course->id, 'wiki', 'view all', "index.php?id=$course->id", "");
|
add_to_log($course->id, 'wiki', 'view', "index.php?id=".$id, "");
|
||||||
|
|
||||||
/// Get all required stringswiki
|
/// Get all required stringswiki
|
||||||
$strwikis = get_string("modulenameplural", "wiki");
|
$strwikis = get_string("modulenameplural", "wiki");
|
||||||
|
|
|
@ -94,12 +94,12 @@ if ($action == 'delete') {
|
||||||
|
|
||||||
if ($action == 'edit') {
|
if ($action == 'edit') {
|
||||||
$comm->set_action($action, $id, $content);
|
$comm->set_action($action, $id, $content);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$action = 'add';
|
$action = 'add';
|
||||||
$comm->set_action($action, 0, $content);
|
$comm->set_action($action, 0, $content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
add_to_log($course->id, 'wiki', 'comment', "comments.php?pageid=".$pageid, $pageid, $cm->id);
|
||||||
|
|
||||||
$comm->print_header();
|
$comm->print_header();
|
||||||
$comm->print_content();
|
$comm->print_content();
|
||||||
|
|
|
@ -71,8 +71,6 @@ require_login($course->id, false, $cm);
|
||||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||||
require_capability('mod/wiki:editpage', $context);
|
require_capability('mod/wiki:editpage', $context);
|
||||||
|
|
||||||
//add_to_log($course->id, "wiki", "lock", "lock.php?id=$cm->id", "$wiki->id");
|
|
||||||
|
|
||||||
$wikipage = new page_wiki_lock($wiki, $subwiki, $cm);
|
$wikipage = new page_wiki_lock($wiki, $subwiki, $cm);
|
||||||
$wikipage->set_page($page);
|
$wikipage->set_page($page);
|
||||||
|
|
||||||
|
|
|
@ -56,13 +56,11 @@ if (!$wiki = wiki_get_wiki($subwiki->wikiid)) {
|
||||||
require_login($course->id, true, $cm);
|
require_login($course->id, true, $cm);
|
||||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||||
require_capability('mod/wiki:viewpage', $context);
|
require_capability('mod/wiki:viewpage', $context);
|
||||||
add_to_log($course->id, "wiki", "map", "map.php?id=$cm->id", "$wiki->id");
|
|
||||||
|
|
||||||
/// Print page header
|
|
||||||
|
|
||||||
/// Finish the page
|
|
||||||
$wikipage = new page_wiki_map($wiki, $subwiki, $cm);
|
$wikipage = new page_wiki_map($wiki, $subwiki, $cm);
|
||||||
|
add_to_log($course->id, "wiki", "map", "map.php?pageid=".$pageid, $pageid, $cm->id);
|
||||||
|
|
||||||
|
// Print page header
|
||||||
$wikipage->set_view($option);
|
$wikipage->set_view($option);
|
||||||
$wikipage->set_page($page);
|
$wikipage->set_page($page);
|
||||||
$wikipage->print_header();
|
$wikipage->print_header();
|
||||||
|
|
|
@ -67,8 +67,6 @@ require_login($course->id, true, $cm);
|
||||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||||
require_capability('mod/wiki:overridelock', $context);
|
require_capability('mod/wiki:overridelock', $context);
|
||||||
|
|
||||||
add_to_log($course->id, "wiki", "overridelocks", "overridelocks.php?id=$cm->id", "$wiki->id");
|
|
||||||
|
|
||||||
if (!confirm_sesskey()) {
|
if (!confirm_sesskey()) {
|
||||||
print_error(get_string('invalidsesskey', 'wiki'));
|
print_error(get_string('invalidsesskey', 'wiki'));
|
||||||
}
|
}
|
||||||
|
@ -79,6 +77,7 @@ $wikipage->set_page($page);
|
||||||
if (!empty($section)) {
|
if (!empty($section)) {
|
||||||
$wikipage->set_section($sectioncontent, $section);
|
$wikipage->set_section($sectioncontent, $section);
|
||||||
}
|
}
|
||||||
|
add_to_log($course->id, "wiki", "overridelocks", "view.php?pageid=".$pageid, $pageid, $cm->id);
|
||||||
|
|
||||||
$wikipage->print_header();
|
$wikipage->print_header();
|
||||||
|
|
||||||
|
|
|
@ -935,11 +935,14 @@ class page_wiki_create extends page_wiki {
|
||||||
$this->subwiki = wiki_get_subwiki($swid);
|
$this->subwiki = wiki_get_subwiki($swid);
|
||||||
}
|
}
|
||||||
if ($data) {
|
if ($data) {
|
||||||
|
$this->set_title($data->pagetitle);
|
||||||
$id = wiki_create_page($this->subwiki->id, $data->pagetitle, $data->pageformat, $USER->id);
|
$id = wiki_create_page($this->subwiki->id, $data->pagetitle, $data->pageformat, $USER->id);
|
||||||
} else {
|
} else {
|
||||||
|
$this->set_title($pagetitle);
|
||||||
$id = wiki_create_page($this->subwiki->id, $pagetitle, $PAGE->activityrecord->defaultformat, $USER->id);
|
$id = wiki_create_page($this->subwiki->id, $pagetitle, $PAGE->activityrecord->defaultformat, $USER->id);
|
||||||
}
|
}
|
||||||
redirect($CFG->wwwroot . '/mod/wiki/edit.php?pageid=' . $id);
|
$this->page = $id;
|
||||||
|
return $id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,11 +56,10 @@ require_login($course->id, true, $cm);
|
||||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||||
require_capability('mod/wiki:viewpage', $context);
|
require_capability('mod/wiki:viewpage', $context);
|
||||||
|
|
||||||
add_to_log($course->id, "wiki", "view", "prettyview.php?pageid=$pageid", "$wiki->id");
|
|
||||||
|
|
||||||
$wikipage = new page_wiki_prettyview($wiki, $subwiki, $cm);
|
$wikipage = new page_wiki_prettyview($wiki, $subwiki, $cm);
|
||||||
|
|
||||||
$wikipage->set_page($page);
|
$wikipage->set_page($page);
|
||||||
|
add_to_log($course->id, "wiki", "view", "prettyview.php?pageid=".$pageid, $pageid, $cm->id);
|
||||||
|
|
||||||
$wikipage->print_header();
|
$wikipage->print_header();
|
||||||
$wikipage->print_content();
|
$wikipage->print_content();
|
||||||
|
|
|
@ -60,8 +60,6 @@ $course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST)
|
||||||
|
|
||||||
require_login($course->id, true, $cm);
|
require_login($course->id, true, $cm);
|
||||||
|
|
||||||
add_to_log($course->id, "restore", "restore", "view.php?id=$cm->id", "$wiki->id");
|
|
||||||
|
|
||||||
if ($confirm) {
|
if ($confirm) {
|
||||||
if (!confirm_sesskey()) {
|
if (!confirm_sesskey()) {
|
||||||
print_error(get_string('invalidsesskey', 'wiki'));
|
print_error(get_string('invalidsesskey', 'wiki'));
|
||||||
|
@ -77,6 +75,7 @@ if ($confirm) {
|
||||||
$wikipage->set_versionid($versionid);
|
$wikipage->set_versionid($versionid);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
add_to_log($course->id, "wiki", "restore", "view.php?pageid=".$pageid, $pageid, $cm->id);
|
||||||
|
|
||||||
$wikipage->print_header();
|
$wikipage->print_header();
|
||||||
$wikipage->print_content();
|
$wikipage->print_content();
|
||||||
|
|
|
@ -269,8 +269,6 @@ require_login($course, true, $cm);
|
||||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||||
require_capability('mod/wiki:viewpage', $context);
|
require_capability('mod/wiki:viewpage', $context);
|
||||||
|
|
||||||
add_to_log($course->id, 'wiki', 'view', 'view.php?id=' . $cm->id, $wiki->id);
|
|
||||||
|
|
||||||
// Update 'viewed' state if required by completion system
|
// Update 'viewed' state if required by completion system
|
||||||
require_once($CFG->libdir . '/completionlib.php');
|
require_once($CFG->libdir . '/completionlib.php');
|
||||||
$completion = new completion_info($course);
|
$completion = new completion_info($course);
|
||||||
|
@ -294,6 +292,14 @@ if ($id) {
|
||||||
$wikipage->set_gid($currentgroup);
|
$wikipage->set_gid($currentgroup);
|
||||||
$wikipage->set_page($page);
|
$wikipage->set_page($page);
|
||||||
|
|
||||||
|
if($pageid) {
|
||||||
|
add_to_log($course->id, 'wiki', 'view', "view.php?pageid=".$pageid, $pageid, $cm->id);
|
||||||
|
} else if($id) {
|
||||||
|
add_to_log($course->id, 'wiki', 'view', "view.php?id=".$id, $id, $cm->id);
|
||||||
|
} else if($wid && $title) {
|
||||||
|
add_to_log($course->id, 'wiki', 'view', "view.php?wid=".$wid."&title=".$title, $wid, $cm->id);
|
||||||
|
}
|
||||||
|
|
||||||
$wikipage->print_header();
|
$wikipage->print_header();
|
||||||
$wikipage->print_content();
|
$wikipage->print_content();
|
||||||
|
|
||||||
|
|
|
@ -59,14 +59,15 @@ if (!$cm = get_coursemodule_from_instance('wiki', $wiki->id)) {
|
||||||
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
|
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
|
||||||
|
|
||||||
require_login($course->id, true, $cm);
|
require_login($course->id, true, $cm);
|
||||||
add_to_log($course->id, "wiki", "history", "history.php?id=$cm->id", "$wiki->id");
|
|
||||||
|
|
||||||
/// Print the page header
|
|
||||||
$wikipage = new page_wiki_viewversion($wiki, $subwiki, $cm);
|
$wikipage = new page_wiki_viewversion($wiki, $subwiki, $cm);
|
||||||
|
|
||||||
$wikipage->set_page($page);
|
$wikipage->set_page($page);
|
||||||
$wikipage->set_versionid($versionid);
|
$wikipage->set_versionid($versionid);
|
||||||
|
|
||||||
|
add_to_log($course->id, "wiki", "history", "viewversion.php?pageid=".$pageid."&versionid=".$versionid, $pageid, $cm->id);
|
||||||
|
|
||||||
|
// Print the page header
|
||||||
$wikipage->print_header();
|
$wikipage->print_header();
|
||||||
$wikipage->print_content();
|
$wikipage->print_content();
|
||||||
|
|
||||||
|
|
|
@ -1430,9 +1430,7 @@ class question_bank_view {
|
||||||
if ($question->id == $this->lastchangedid) {
|
if ($question->id == $this->lastchangedid) {
|
||||||
$classes[] ='highlight';
|
$classes[] ='highlight';
|
||||||
}
|
}
|
||||||
if (!empty($this->extrarows)) {
|
|
||||||
$classes[] = 'r' . ($rowcount % 2);
|
$classes[] = 'r' . ($rowcount % 2);
|
||||||
}
|
|
||||||
return $classes;
|
return $classes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -884,10 +884,10 @@ class question_attempt {
|
||||||
case self::PARAM_MARK:
|
case self::PARAM_MARK:
|
||||||
// Special case to work around PARAM_NUMBER converting '' to 0.
|
// Special case to work around PARAM_NUMBER converting '' to 0.
|
||||||
$mark = $this->get_submitted_var($name, PARAM_RAW_TRIMMED, $postdata);
|
$mark = $this->get_submitted_var($name, PARAM_RAW_TRIMMED, $postdata);
|
||||||
if ($mark === '') {
|
if ($mark === '' || is_null($mark)) {
|
||||||
return $mark;
|
return $mark;
|
||||||
} else {
|
} else {
|
||||||
return $this->get_submitted_var($name, PARAM_NUMBER, $postdata);
|
return clean_param(str_replace(',', '.', $mark), PARAM_NUMBER);
|
||||||
}
|
}
|
||||||
|
|
||||||
case self::PARAM_FILES:
|
case self::PARAM_FILES:
|
||||||
|
|
|
@ -123,6 +123,16 @@ class question_attempt_test extends UnitTestCase {
|
||||||
'name', question_attempt::PARAM_MARK, array('name' => '123')));
|
'name', question_attempt::PARAM_MARK, array('name' => '123')));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function test_get_submitted_var_param_mark_number_uk_decimal() {
|
||||||
|
$this->assertIdentical(123.45, $this->qa->get_submitted_var(
|
||||||
|
'name', question_attempt::PARAM_MARK, array('name' => '123.45')));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_get_submitted_var_param_mark_number_eu_decimal() {
|
||||||
|
$this->assertIdentical(123.45, $this->qa->get_submitted_var(
|
||||||
|
'name', question_attempt::PARAM_MARK, array('name' => '123,45')));
|
||||||
|
}
|
||||||
|
|
||||||
public function test_get_submitted_var_param_mark_invalid() {
|
public function test_get_submitted_var_param_mark_invalid() {
|
||||||
$this->assertIdentical(0.0, $this->qa->get_submitted_var(
|
$this->assertIdentical(0.0, $this->qa->get_submitted_var(
|
||||||
'name', question_attempt::PARAM_MARK, array('name' => 'frog')));
|
'name', question_attempt::PARAM_MARK, array('name' => 'frog')));
|
||||||
|
|
|
@ -44,7 +44,7 @@ question_bank = {
|
||||||
question_bank.firstcheckbox = document.getElementById(firstcbid);
|
question_bank.firstcheckbox = document.getElementById(firstcbid);
|
||||||
|
|
||||||
// Add the event handler.
|
// Add the event handler.
|
||||||
YAHOO.util.Event.addListener(question_bank.headercheckbox, 'change', question_bank.header_checkbox_click);
|
YAHOO.util.Event.addListener(question_bank.headercheckbox, 'click', question_bank.header_checkbox_click);
|
||||||
},
|
},
|
||||||
|
|
||||||
header_checkbox_click: function() {
|
header_checkbox_click: function() {
|
||||||
|
|
|
@ -149,7 +149,11 @@ M.core_filepicker.init = function(Y, options) {
|
||||||
// error checking
|
// error checking
|
||||||
if (data && data.error) {
|
if (data && data.error) {
|
||||||
scope.print_msg(data.error, 'error');
|
scope.print_msg(data.error, 'error');
|
||||||
scope.list();
|
if (args.onerror) {
|
||||||
|
args.onerror(id,data,p);
|
||||||
|
} else {
|
||||||
|
Y.one(panel_id).set('innerHTML', '');
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
} else if (data && data.event) {
|
} else if (data && data.event) {
|
||||||
switch (data.event) {
|
switch (data.event) {
|
||||||
|
@ -678,6 +682,9 @@ M.core_filepicker.init = function(Y, options) {
|
||||||
client_id: client_id,
|
client_id: client_id,
|
||||||
repository_id: repository_id,
|
repository_id: repository_id,
|
||||||
'params': params,
|
'params': params,
|
||||||
|
onerror: function(id, obj, args) {
|
||||||
|
scope.view_files();
|
||||||
|
},
|
||||||
callback: function(id, obj, args) {
|
callback: function(id, obj, args) {
|
||||||
if (scope.options.editor_target && scope.options.env=='editor') {
|
if (scope.options.editor_target && scope.options.env=='editor') {
|
||||||
scope.options.editor_target.value=obj.url;
|
scope.options.editor_target.value=obj.url;
|
||||||
|
@ -1188,6 +1195,9 @@ M.core_filepicker.init = function(Y, options) {
|
||||||
params: {'savepath':scope.options.savepath},
|
params: {'savepath':scope.options.savepath},
|
||||||
repository_id: scope.active_repo.id,
|
repository_id: scope.active_repo.id,
|
||||||
form: {id: id, upload:true},
|
form: {id: id, upload:true},
|
||||||
|
onerror: function(id, o, args) {
|
||||||
|
scope.create_upload_form(data);
|
||||||
|
},
|
||||||
callback: function(id, o, args) {
|
callback: function(id, o, args) {
|
||||||
if (scope.options.editor_target&&scope.options.env=='editor') {
|
if (scope.options.editor_target&&scope.options.env=='editor') {
|
||||||
scope.options.editor_target.value=o.url;
|
scope.options.editor_target.value=o.url;
|
||||||
|
@ -1370,15 +1380,21 @@ M.core_filepicker.init = function(Y, options) {
|
||||||
var r = this.active_repo;
|
var r = this.active_repo;
|
||||||
var str = '';
|
var str = '';
|
||||||
var action = '';
|
var action = '';
|
||||||
if(r.pages > 1) {
|
var lastpage = r.pages;
|
||||||
|
var lastpagetext = r.pages;
|
||||||
|
if (r.pages == -1) {
|
||||||
|
lastpage = r.page + 1;
|
||||||
|
lastpagetext = M.str.moodle.next;
|
||||||
|
}
|
||||||
|
if (lastpage > 1) {
|
||||||
str += '<div class="fp-paging" id="paging-'+html_id+'-'+client_id+'">';
|
str += '<div class="fp-paging" id="paging-'+html_id+'-'+client_id+'">';
|
||||||
str += this.get_page_button(1)+'1</a> ';
|
str += this.get_page_button(1)+'1</a> ';
|
||||||
|
|
||||||
var span = 5;
|
var span = 5;
|
||||||
var ex = (span-1)/2;
|
var ex = (span-1)/2;
|
||||||
|
|
||||||
if (r.page+ex>=r.pages) {
|
if (r.page+ex>=lastpage) {
|
||||||
var max = r.pages;
|
var max = lastpage;
|
||||||
} else {
|
} else {
|
||||||
if (r.page<span) {
|
if (r.page<span) {
|
||||||
var max = span;
|
var max = span;
|
||||||
|
@ -1405,11 +1421,11 @@ M.core_filepicker.init = function(Y, options) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// won't display upper boundary
|
// won't display upper boundary
|
||||||
if (max==r.pages) {
|
if (max==lastpage) {
|
||||||
str += this.get_page_button(r.pages)+r.pages+'</a>';
|
str += this.get_page_button(lastpage)+lastpagetext+'</a>';
|
||||||
} else {
|
} else {
|
||||||
str += this.get_page_button(max)+max+'</a>';
|
str += this.get_page_button(max)+max+'</a>';
|
||||||
str += ' ... '+this.get_page_button(r.pages)+r.pages+'</a>';
|
str += ' ... '+this.get_page_button(lastpage)+lastpagetext+'</a>';
|
||||||
}
|
}
|
||||||
str += '</div>';
|
str += '</div>';
|
||||||
}
|
}
|
||||||
|
|
|
@ -206,9 +206,23 @@ case 'sign':
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!empty($list['page'])) {
|
if (!empty($list['page'])) {
|
||||||
// TODO: need a better solution
|
// TODO MDL-28482: need a better solution
|
||||||
$pagingurl = new moodle_url("$CFG->httpswwwroot/repository/filepicker.php?action=list&itemid=$itemid&ctx_id=$contextid&repo_id=$repo_id&course=$courseid");
|
// paging_bar is not a good option because it starts page numbering from 0 and
|
||||||
echo $OUTPUT->paging_bar($list['total'], $list['page'] - 1, $list['perpage'], $pagingurl);
|
// repositories number pages starting from 1.
|
||||||
|
$pagingurl = new moodle_url("$CFG->httpswwwroot/repository/filepicker.php?action=list&itemid=$itemid&ctx_id=$contextid&repo_id=$repo_id&course=$courseid&sesskey=". sesskey());
|
||||||
|
if (!isset($list['perpage']) && !isset($list['total'])) {
|
||||||
|
$list['perpage'] = 10; // instead of setting perpage&total we use number of pages, the result is the same
|
||||||
|
}
|
||||||
|
if (empty($list['total'])) {
|
||||||
|
if ($list['pages'] == -1) {
|
||||||
|
$total = ($list['page'] + 2) * $list['perpage'];
|
||||||
|
} else {
|
||||||
|
$total = $list['pages'] * $list['perpage'];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$total = $list['total'];
|
||||||
|
}
|
||||||
|
echo $OUTPUT->paging_bar($total, $list['page'], $list['perpage'], $pagingurl);
|
||||||
}
|
}
|
||||||
echo '<table>';
|
echo '<table>';
|
||||||
foreach ($list['list'] as $item) {
|
foreach ($list['list'] as $item) {
|
||||||
|
|
|
@ -66,7 +66,7 @@ if (empty($_POST) && !empty($action)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!confirm_sesskey()) {
|
if (!confirm_sesskey()) {
|
||||||
$err->error = get_string('invalidsesskey');
|
$err->error = get_string('invalidsesskey', 'error');
|
||||||
die(json_encode($err));
|
die(json_encode($err));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,17 +31,41 @@ require_once('wikimedia.php');
|
||||||
|
|
||||||
class repository_wikimedia extends repository {
|
class repository_wikimedia extends repository {
|
||||||
public function __construct($repositoryid, $context = SYSCONTEXTID, $options = array()) {
|
public function __construct($repositoryid, $context = SYSCONTEXTID, $options = array()) {
|
||||||
|
global $SESSION;
|
||||||
parent::__construct($repositoryid, $context, $options);
|
parent::__construct($repositoryid, $context, $options);
|
||||||
$this->keyword = optional_param('wikimedia_keyword', '', PARAM_RAW);
|
$this->keyword = optional_param('wikimedia_keyword', '', PARAM_RAW);
|
||||||
if (empty($this->keyword)) {
|
if (empty($this->keyword)) {
|
||||||
$this->keyword = optional_param('s', '', PARAM_RAW);
|
$this->keyword = optional_param('s', '', PARAM_RAW);
|
||||||
}
|
}
|
||||||
|
$sess_keyword = 'wikimedia_'.$this->id.'_keyword';
|
||||||
|
if (empty($this->keyword) && optional_param('page', '', PARAM_RAW)) {
|
||||||
|
// This is the request of another page for the last search, retrieve the cached keyword
|
||||||
|
if (isset($SESSION->{$sess_keyword})) {
|
||||||
|
$this->keyword = $SESSION->{$sess_keyword};
|
||||||
|
}
|
||||||
|
} else if (!empty($this->keyword)) {
|
||||||
|
// save the search keyword in the session so we can retrieve it later
|
||||||
|
$SESSION->{$sess_keyword} = $this->keyword;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public function get_listing($path = '', $page = '') {
|
public function get_listing($path = '', $page = '') {
|
||||||
$client = new wikimedia;
|
$client = new wikimedia;
|
||||||
$list = array();
|
$list = array();
|
||||||
$list['list'] = $client->search_images($this->keyword);
|
$list['page'] = (int)$page;
|
||||||
|
if ($list['page'] < 1) {
|
||||||
|
$list['page'] = 1;
|
||||||
|
}
|
||||||
|
$list['list'] = $client->search_images($this->keyword, $list['page'] - 1);
|
||||||
$list['nologin'] = true;
|
$list['nologin'] = true;
|
||||||
|
$list['norefresh'] = true;
|
||||||
|
$list['nosearch'] = true;
|
||||||
|
if (!empty($list['list'])) {
|
||||||
|
$list['pages'] = -1; // means we don't know exactly how many pages there are but we can always jump to the next page
|
||||||
|
} else if ($list['page'] > 1) {
|
||||||
|
$list['pages'] = $list['page']; // no images available on this page, this is the last page
|
||||||
|
} else {
|
||||||
|
$list['pages'] = 0; // no paging
|
||||||
|
}
|
||||||
return $list;
|
return $list;
|
||||||
}
|
}
|
||||||
// login
|
// login
|
||||||
|
@ -57,10 +81,24 @@ class repository_wikimedia extends repository {
|
||||||
$keyword->type = 'text';
|
$keyword->type = 'text';
|
||||||
$keyword->name = 'wikimedia_keyword';
|
$keyword->name = 'wikimedia_keyword';
|
||||||
$keyword->value = '';
|
$keyword->value = '';
|
||||||
|
if ($this->options['ajax']) {
|
||||||
$form = array();
|
$form = array();
|
||||||
$form['login'] = array($keyword);
|
$form['login'] = array($keyword);
|
||||||
|
$form['nologin'] = true;
|
||||||
|
$form['norefresh'] = true;
|
||||||
|
$form['nosearch'] = true;
|
||||||
|
$form['allowcaching'] = true; // indicates that login form can be cached in filepicker.js
|
||||||
return $form;
|
return $form;
|
||||||
|
} else {
|
||||||
|
echo <<<EOD
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td>{$keyword->label}</td><td><input name="{$keyword->name}" type="text" /></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<input type="submit" />
|
||||||
|
EOD;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//search
|
//search
|
||||||
// if this plugin support global search, if this function return
|
// if this plugin support global search, if this function return
|
||||||
|
|
|
@ -141,13 +141,14 @@ class wikimedia {
|
||||||
* @param string $keyword
|
* @param string $keyword
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function search_images($keyword) {
|
public function search_images($keyword, $page = 0) {
|
||||||
$files_array = array();
|
$files_array = array();
|
||||||
$this->_param['action'] = 'query';
|
$this->_param['action'] = 'query';
|
||||||
$this->_param['generator'] = 'search';
|
$this->_param['generator'] = 'search';
|
||||||
$this->_param['gsrsearch'] = $keyword;
|
$this->_param['gsrsearch'] = $keyword;
|
||||||
$this->_param['gsrnamespace'] = WIKIMEDIA_FILE_NS;
|
$this->_param['gsrnamespace'] = WIKIMEDIA_FILE_NS;
|
||||||
$this->_param['gsrlimit'] = WIKIMEDIA_THUMBS_PER_PAGE;
|
$this->_param['gsrlimit'] = WIKIMEDIA_THUMBS_PER_PAGE;
|
||||||
|
$this->_param['gsroffset'] = $page * WIKIMEDIA_THUMBS_PER_PAGE;
|
||||||
$this->_param['prop'] = 'imageinfo';
|
$this->_param['prop'] = 'imageinfo';
|
||||||
$this->_param['iiprop'] = 'url|dimensions|mime';
|
$this->_param['iiprop'] = 'url|dimensions|mime';
|
||||||
$this->_param['iiurlwidth'] = WIKIMEDIA_IMAGE_SIDE_LENGTH;
|
$this->_param['iiurlwidth'] = WIKIMEDIA_IMAGE_SIDE_LENGTH;
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class repository_youtube extends repository {
|
class repository_youtube extends repository {
|
||||||
|
/** @var int maximum number of thumbs per page */
|
||||||
|
const YOUTUBE_THUMBS_PER_PAGE = 27;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Youtube plugin constructor
|
* Youtube plugin constructor
|
||||||
|
@ -35,9 +37,6 @@ class repository_youtube extends repository {
|
||||||
* @param array $options
|
* @param array $options
|
||||||
*/
|
*/
|
||||||
public function __construct($repositoryid, $context = SYSCONTEXTID, $options = array()) {
|
public function __construct($repositoryid, $context = SYSCONTEXTID, $options = array()) {
|
||||||
$this->start =1;
|
|
||||||
$this->max = 27;
|
|
||||||
$this->sort = optional_param('youtube_sort', 'relevance', PARAM_TEXT);
|
|
||||||
parent::__construct($repositoryid, $context, $options);
|
parent::__construct($repositoryid, $context, $options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,11 +49,40 @@ class repository_youtube extends repository {
|
||||||
* @param string $search_text
|
* @param string $search_text
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function search($search_text) {
|
public function search($search_text, $page) {
|
||||||
|
global $SESSION;
|
||||||
|
$sort = optional_param('youtube_sort', '', PARAM_TEXT);
|
||||||
|
$sess_keyword = 'youtube_'.$this->id.'_keyword';
|
||||||
|
$sess_sort = 'youtube_'.$this->id.'_sort';
|
||||||
|
|
||||||
|
// This is the request of another page for the last search, retrieve the cached keyword and sort
|
||||||
|
if ($page && !$search_text && isset($SESSION->{$sess_keyword})) {
|
||||||
|
$search_text = $SESSION->{$sess_keyword};
|
||||||
|
}
|
||||||
|
if ($page && !$sort && isset($SESSION->{$sess_sort})) {
|
||||||
|
$sort = $SESSION->{$sess_sort};
|
||||||
|
}
|
||||||
|
if (!$sort) {
|
||||||
|
$sort = 'relevance'; // default
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save this search in session
|
||||||
|
$SESSION->{$sess_keyword} = $search_text;
|
||||||
|
$SESSION->{$sess_sort} = $sort;
|
||||||
|
|
||||||
$this->keyword = $search_text;
|
$this->keyword = $search_text;
|
||||||
$ret = array();
|
$ret = array();
|
||||||
$ret['nologin'] = true;
|
$ret['nologin'] = true;
|
||||||
$ret['list'] = $this->_get_collection($search_text, $this->start, $this->max, $this->sort);
|
$ret['page'] = (int)$page;
|
||||||
|
if ($ret['page'] < 1) {
|
||||||
|
$ret['page'] = 1;
|
||||||
|
}
|
||||||
|
$start = ($ret['page'] - 1) * self::YOUTUBE_THUMBS_PER_PAGE + 1;
|
||||||
|
$max = self::YOUTUBE_THUMBS_PER_PAGE;
|
||||||
|
$ret['list'] = $this->_get_collection($search_text, $start, $max, $sort);
|
||||||
|
$ret['norefresh'] = true;
|
||||||
|
$ret['nosearch'] = true;
|
||||||
|
$ret['pages'] = -1;
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,6 +170,7 @@ class repository_youtube extends repository {
|
||||||
$ret['login'] = array($search, $sort);
|
$ret['login'] = array($search, $sort);
|
||||||
$ret['login_btn_label'] = get_string('search');
|
$ret['login_btn_label'] = get_string('search');
|
||||||
$ret['login_btn_action'] = 'search';
|
$ret['login_btn_action'] = 'search';
|
||||||
|
$ret['allowcaching'] = true; // indicates that login form can be cached in filepicker.js
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -123,3 +123,6 @@
|
||||||
|
|
||||||
#page-course-index.dir-rtl .category .image {padding-left: 5px; padding-right: 0px;}
|
#page-course-index.dir-rtl .category .image {padding-left: 5px; padding-right: 0px;}
|
||||||
#page-course-index.dir-rtl .indentation {padding-left: 0px;padding-right: 30px;}
|
#page-course-index.dir-rtl .indentation {padding-left: 0px;padding-right: 30px;}
|
||||||
|
|
||||||
|
table.category_subcategories {margin-bottom:1em;}
|
||||||
|
table.category_subcategories td {white-space: nowrap;}
|
|
@ -23,7 +23,7 @@ if ($hascustommenu) {
|
||||||
if (!empty($PAGE->theme->settings->tagline)) {
|
if (!empty($PAGE->theme->settings->tagline)) {
|
||||||
$tagline = $PAGE->theme->settings->tagline;
|
$tagline = $PAGE->theme->settings->tagline;
|
||||||
} else {
|
} else {
|
||||||
$tagline = "Another Moodle Theme";
|
$tagline = '<!-- There was no custom tagline set -->';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($PAGE->theme->settings->footertext)) {
|
if (!empty($PAGE->theme->settings->footertext)) {
|
||||||
|
|
|
@ -13,12 +13,11 @@ $previewconfig = NULL;
|
||||||
$setting = new admin_setting_configcolourpicker($name, $title, $description, $default, $previewconfig);
|
$setting = new admin_setting_configcolourpicker($name, $title, $description, $default, $previewconfig);
|
||||||
$settings->add($setting);
|
$settings->add($setting);
|
||||||
|
|
||||||
|
|
||||||
// Tag line setting
|
// Tag line setting
|
||||||
$name = 'theme_fusion/tagline';
|
$name = 'theme_fusion/tagline';
|
||||||
$title = get_string('tagline','theme_fusion');
|
$title = get_string('tagline','theme_fusion');
|
||||||
$description = get_string('taglinedesc', 'theme_fusion');
|
$description = get_string('taglinedesc', 'theme_fusion');
|
||||||
$setting = new admin_setting_configtextarea($name, $title, $description, '');
|
$setting = new admin_setting_configtext($name, $title, $description, '');
|
||||||
$settings->add($setting);
|
$settings->add($setting);
|
||||||
|
|
||||||
// Foot note setting
|
// Foot note setting
|
||||||
|
|
|
@ -30,10 +30,10 @@
|
||||||
defined('MOODLE_INTERNAL') || die();
|
defined('MOODLE_INTERNAL') || die();
|
||||||
|
|
||||||
|
|
||||||
$version = 2011120502.01; // 20111205 = branching date YYYYMMDD - do not modify!
|
$version = 2011120502.02; // 20111205 = branching date YYYYMMDD - do not modify!
|
||||||
// RR = release increments - 00 in DEV branches
|
// RR = release increments - 00 in DEV branches
|
||||||
// .XX = incremental changes
|
// .XX = incremental changes
|
||||||
|
|
||||||
$release = '2.2.2+ (Build: 20120315)'; // Human-friendly version name
|
$release = '2.2.2+ (Build: 20120323)'; // Human-friendly version name
|
||||||
|
|
||||||
$maturity = MATURITY_STABLE; // this version's maturity level
|
$maturity = MATURITY_STABLE; // this version's maturity level
|
||||||
|
|