mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
Merge branch 'wip-mdl-19430' of git://github.com/rajeshtaneja/moodle
This commit is contained in:
commit
4c21d0da95
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
@ -18,124 +17,107 @@
|
||||
/**
|
||||
* Course overview block
|
||||
*
|
||||
* Currently, just a copy-and-paste from the old My Moodle.
|
||||
*
|
||||
* @package blocks
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @package block_course_overview
|
||||
* @copyright 1999 onwards Martin Dougiamas (http://dougiamas.com)
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
require_once($CFG->dirroot.'/blocks/course_overview/locallib.php');
|
||||
/**
|
||||
* Course overview block
|
||||
*
|
||||
* @copyright 1999 onwards Martin Dougiamas (http://dougiamas.com)
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
require_once($CFG->dirroot.'/lib/weblib.php');
|
||||
require_once($CFG->dirroot . '/lib/formslib.php');
|
||||
|
||||
class block_course_overview extends block_base {
|
||||
/**
|
||||
* block initializations
|
||||
* Block initialization
|
||||
*/
|
||||
public function init() {
|
||||
$this->title = get_string('pluginname', 'block_course_overview');
|
||||
}
|
||||
|
||||
/**
|
||||
* block contents
|
||||
* Return contents of course_overview block
|
||||
*
|
||||
* @return object
|
||||
* @return stdClass contents of block
|
||||
*/
|
||||
public function get_content() {
|
||||
global $USER, $CFG;
|
||||
global $USER, $CFG, $DB;
|
||||
require_once($CFG->dirroot.'/user/profile/lib.php');
|
||||
|
||||
if($this->content !== NULL) {
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
$config = get_config('block_course_overview');
|
||||
|
||||
$this->content = new stdClass();
|
||||
$this->content->text = '';
|
||||
$this->content->footer = '';
|
||||
|
||||
$content = array();
|
||||
|
||||
// limits the number of courses showing up
|
||||
$courses_limit = 21;
|
||||
// FIXME: this should be a block setting, rather than a global setting
|
||||
if (isset($CFG->mycoursesperpage)) {
|
||||
$courses_limit = $CFG->mycoursesperpage;
|
||||
$updatemynumber = optional_param('mynumber', -1, PARAM_INT);
|
||||
if ($updatemynumber >= 0) {
|
||||
block_course_overview_update_mynumber($updatemynumber);
|
||||
}
|
||||
|
||||
$morecourses = false;
|
||||
if ($courses_limit > 0) {
|
||||
$courses_limit = $courses_limit + 1;
|
||||
profile_load_custom_fields($USER);
|
||||
list($sortedcourses, $sitecourses, $totalcourses) = block_course_overview_get_sorted_courses();
|
||||
$overviews = block_course_overview_get_overviews($sitecourses);
|
||||
|
||||
$renderer = $this->page->get_renderer('block_course_overview');
|
||||
if (!empty($config->showwelcomearea)) {
|
||||
require_once($CFG->dirroot.'/message/lib.php');
|
||||
$msgcount = message_count_unread_messages();
|
||||
$this->content->text = $renderer->welcome_area($msgcount);
|
||||
}
|
||||
|
||||
$courses = enrol_get_my_courses('id, shortname, modinfo', 'visible DESC,sortorder ASC', $courses_limit);
|
||||
$site = get_site();
|
||||
$course = $site; //just in case we need the old global $course hack
|
||||
|
||||
if (is_enabled_auth('mnet')) {
|
||||
$remote_courses = get_my_remotecourses();
|
||||
}
|
||||
if (empty($remote_courses)) {
|
||||
$remote_courses = array();
|
||||
// Number of sites to display.
|
||||
if ($this->page->user_is_editing() && empty($config->forcedefaultmaxcourses)) {
|
||||
$this->content->text .= $renderer->editing_bar_head($totalcourses);
|
||||
}
|
||||
|
||||
if (($courses_limit > 0) && (count($courses)+count($remote_courses) >= $courses_limit)) {
|
||||
// get rid of any remote courses that are above the limit
|
||||
$remote_courses = array_slice($remote_courses, 0, $courses_limit - count($courses), true);
|
||||
if (count($courses) >= $courses_limit) {
|
||||
//remove the 'marker' course that we retrieve just to see if we have more than $courses_limit
|
||||
array_pop($courses);
|
||||
}
|
||||
$morecourses = true;
|
||||
}
|
||||
|
||||
|
||||
if (array_key_exists($site->id,$courses)) {
|
||||
unset($courses[$site->id]);
|
||||
}
|
||||
|
||||
foreach ($courses as $c) {
|
||||
if (isset($USER->lastcourseaccess[$c->id])) {
|
||||
$courses[$c->id]->lastaccess = $USER->lastcourseaccess[$c->id];
|
||||
} else {
|
||||
$courses[$c->id]->lastaccess = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($courses) && empty($remote_courses)) {
|
||||
$content[] = get_string('nocourses','my');
|
||||
if (empty($sortedcourses)) {
|
||||
$this->content->text .= get_string('nocourses','my');
|
||||
} else {
|
||||
ob_start();
|
||||
|
||||
require_once $CFG->dirroot."/course/lib.php";
|
||||
print_overview($courses, $remote_courses);
|
||||
|
||||
$content[] = ob_get_contents();
|
||||
ob_end_clean();
|
||||
// For each course, build category cache.
|
||||
$this->content->text .= $renderer->course_overview($sortedcourses, $overviews);
|
||||
$this->content->text .= $renderer->hidden_courses($totalcourses - count($sortedcourses));
|
||||
if ($this->page->user_is_editing() && ajaxenabled()) {
|
||||
$this->page->requires->js_init_call('M.block_course_overview.add_handles');
|
||||
}
|
||||
}
|
||||
|
||||
// if more than 20 courses
|
||||
if ($morecourses) {
|
||||
$content[] = '<br />...';
|
||||
}
|
||||
|
||||
$this->content->text = implode($content);
|
||||
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
/**
|
||||
* allow the block to have a configuration page
|
||||
* Allow the block to have a configuration page
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function has_config() {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* locations where block can be displayed
|
||||
* Locations where block can be displayed
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function applicable_formats() {
|
||||
return array('my-index'=>true);
|
||||
return array('my-index' => true);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
/**
|
||||
* Sets block header to be hidden or visible
|
||||
*
|
||||
* @return bool if true then header will be visible.
|
||||
*/
|
||||
public function hide_header() {
|
||||
// Hide header if welcome area is show.
|
||||
$config = get_config('block_course_overview');
|
||||
return !empty($config->showwelcomearea);
|
||||
}
|
||||
}
|
@ -1,2 +1,53 @@
|
||||
<?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/>.
|
||||
|
||||
/**
|
||||
* Lang strings for course_overview block
|
||||
*
|
||||
* @package block_course_overview
|
||||
* @copyright 2012 Adam Olley <adam.olley@netspot.com.au>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
$string['pluginname'] = 'Course overview';
|
||||
$string['activityoverview'] = 'You have {$a}s that need attention';
|
||||
$string['alwaysshowall'] = 'Always Show All';
|
||||
$string['collapseall'] = 'Collapse All Course Lists';
|
||||
$string['configotherexpanded'] = 'If enabled, Other Courses will be expanded by default unless overriden by user preferences.';
|
||||
$string['configpreservestates'] = 'If enabled, the collapsed/expanded states set by the user are stored and used on each load.';
|
||||
$string['defaultmaxcourses'] = 'Default maximum courses';
|
||||
$string['defaultmaxcoursesdesc'] = 'Maximum courses which should be displayed on course overview block, 0 will show all courses';
|
||||
$string['expandall'] = 'Expand All Course Lists';
|
||||
$string['forcedefaultmaxcourses'] = 'Force maximum courses';
|
||||
$string['forcedefaultmaxcoursesdesc'] = 'If set then user will not be able to change his/her personal setting';
|
||||
$string['hiddencoursecount'] = 'You have {$a} hidden course';
|
||||
$string['hiddencoursecountplural'] = 'You have {$a} hidden courses';
|
||||
$string['movecoursehere'] = 'Move course here';
|
||||
$string['numtodisplay'] = 'Number of courses to display: ';
|
||||
$string['otherexpanded'] = 'Other Courses Expanded';
|
||||
$string['preservestates'] = 'Preserve Expanded States';
|
||||
$string['message'] = 'message';
|
||||
$string['messages'] = 'messages';
|
||||
$string['shortnameprefix'] = 'Includes {$a}';
|
||||
$string['shortnamesufixsingular'] = ' (and {$a} other)';
|
||||
$string['shortnamesufixprural'] = ' (and {$a} others)';
|
||||
$string['showchildren'] = 'Show Children';
|
||||
$string['showchildrendesc'] = 'Should child courses be listed underneath the main course title?';
|
||||
$string['showwelcomearea'] = 'Show welcome area';
|
||||
$string['showwelcomeareadesc'] = 'Show the welcome area above the course list?';
|
||||
$string['view_edit_profile'] = '(View and edit your profile.)';
|
||||
$string['welcome'] = 'Welcome {$a}';
|
||||
$string['youhavemessages'] = 'You have {$a} unread ';
|
||||
$string['youhavenomessages'] = 'You have no unread ';
|
193
blocks/course_overview/locallib.php
Normal file
193
blocks/course_overview/locallib.php
Normal file
@ -0,0 +1,193 @@
|
||||
<?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/>.
|
||||
|
||||
/**
|
||||
* Helper functions for course_overview block
|
||||
*
|
||||
* @package block_course_overview
|
||||
* @copyright 2012 Adam Olley <adam.olley@netspot.com.au>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
/**
|
||||
* Display overview for courses
|
||||
*
|
||||
* @param array $courses courses for which overview needs to be shown
|
||||
* @return array html overview
|
||||
*/
|
||||
function block_course_overview_get_overviews($courses) {
|
||||
$htmlarray = array();
|
||||
if ($modules = get_plugin_list_with_function('mod', 'print_overview')) {
|
||||
foreach ($modules as $fname) {
|
||||
$fname($courses,$htmlarray);
|
||||
}
|
||||
}
|
||||
return $htmlarray;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets user preference for maximum courses to be displayed in course_overview block
|
||||
*
|
||||
* @param int $number maximum courses which should be visible
|
||||
*/
|
||||
function block_course_overview_update_mynumber($number) {
|
||||
set_user_preference('course_overview_number_of_courses', $number);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets user course sorting preference in course_overview block
|
||||
*
|
||||
* @param array $sortorder sort order of course
|
||||
*/
|
||||
function block_course_overview_update_myorder($sortorder) {
|
||||
set_user_preference('course_overview_course_order', serialize($sortorder));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns shortname of activities in course
|
||||
*
|
||||
* @param int $courseid id of course for which activity shortname is needed
|
||||
* @return string|bool list of child shortname
|
||||
*/
|
||||
function block_course_overview_get_child_shortnames($courseid) {
|
||||
global $DB;
|
||||
$ctxselect = context_helper::get_preload_record_columns_sql('ctx');
|
||||
$sql = "SELECT c.id, c.shortname, $ctxselect
|
||||
FROM {enrol} e
|
||||
JOIN {course} c ON (c.id = e.customint1)
|
||||
JOIN {context} ctx ON (ctx.instanceid = e.customint1)
|
||||
WHERE e.courseid = :courseid AND e.enrol = :method AND ctx.contextlevel = :contextlevel ORDER BY e.sortorder";
|
||||
$params = array('method' => 'meta', 'courseid' => $courseid, 'contextlevel' => CONTEXT_COURSE);
|
||||
|
||||
if ($results = $DB->get_records_sql($sql, $params)) {
|
||||
$shortnames = array();
|
||||
// Preload the context we will need it to format the category name shortly.
|
||||
foreach ($results as $res) {
|
||||
context_helper::preload_from_record($res);
|
||||
$context = context_course::instance($res->id);
|
||||
$shortnames[] = format_string($res->shortname, true, $context);
|
||||
}
|
||||
$total = count($shortnames);
|
||||
$suffix = '';
|
||||
if ($total > 10) {
|
||||
$shortnames = array_slice($shortnames, 0, 10);
|
||||
$diff = $total - count($shortnames);
|
||||
if ($diff > 1) {
|
||||
$suffix = get_string('shortnamesufixprural', 'block_course_overview', $diff);
|
||||
} else {
|
||||
$suffix = get_string('shortnamesufixsingular', 'block_course_overview', $diff);
|
||||
}
|
||||
}
|
||||
$shortnames = get_string('shortnameprefix', 'block_course_overview', implode('; ', $shortnames));
|
||||
$shortnames .= $suffix;
|
||||
}
|
||||
|
||||
return isset($shortnames) ? $shortnames : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns maximum number of courses which will be displayed in course_overview block
|
||||
*
|
||||
* @return int maximum number of courses
|
||||
*/
|
||||
function block_course_overview_get_max_user_courses() {
|
||||
// Get block configuration
|
||||
$config = get_config('block_course_overview');
|
||||
$limit = $config->defaultmaxcourses;
|
||||
|
||||
// If max course is not set then try get user preference
|
||||
if (empty($config->forcedefaultmaxcourses)) {
|
||||
$limit = get_user_preferences('course_overview_number_of_courses', $limit);
|
||||
}
|
||||
return $limit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return sorted list of user courses
|
||||
*
|
||||
* @return array list of sorted courses and count of courses.
|
||||
*/
|
||||
function block_course_overview_get_sorted_courses() {
|
||||
global $USER;
|
||||
|
||||
$limit = block_course_overview_get_max_user_courses();
|
||||
|
||||
$courses = enrol_get_my_courses('id, shortname, fullname, modinfo');
|
||||
$site = get_site();
|
||||
|
||||
if (array_key_exists($site->id,$courses)) {
|
||||
unset($courses[$site->id]);
|
||||
}
|
||||
|
||||
foreach ($courses as $c) {
|
||||
if (isset($USER->lastcourseaccess[$c->id])) {
|
||||
$courses[$c->id]->lastaccess = $USER->lastcourseaccess[$c->id];
|
||||
} else {
|
||||
$courses[$c->id]->lastaccess = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Get remote courses.
|
||||
$remotecourses = array();
|
||||
if (is_enabled_auth('mnet')) {
|
||||
$remotecourses = get_my_remotecourses();
|
||||
}
|
||||
// Remote courses will have -ve remoteid as key, so it can be differentiated from normal courses
|
||||
foreach ($remotecourses as $id => $val) {
|
||||
$remoteid = $val->remoteid * -1;
|
||||
$val->id = $remoteid;
|
||||
$courses[$remoteid] = $val;
|
||||
}
|
||||
|
||||
$order = array();
|
||||
if (!is_null($usersortorder = get_user_preferences('course_overview_course_order'))) {
|
||||
$order = unserialize($usersortorder);
|
||||
}
|
||||
|
||||
$sortedcourses = array();
|
||||
$counter = 0;
|
||||
// Get courses in sort order into list.
|
||||
foreach ($order as $key => $cid) {
|
||||
if (($counter >= $limit) && ($limit != 0)) {
|
||||
break;
|
||||
}
|
||||
|
||||
// Make sure user is still enroled.
|
||||
if (isset($courses[$cid])) {
|
||||
$sortedcourses[$cid] = $courses[$cid];
|
||||
$counter++;
|
||||
}
|
||||
}
|
||||
// Append unsorted courses if limit allows
|
||||
foreach ($courses as $c) {
|
||||
if (($limit != 0) && ($counter >= $limit)) {
|
||||
break;
|
||||
}
|
||||
if (!in_array($c->id, $order)) {
|
||||
$sortedcourses[$c->id] = $c;
|
||||
$counter++;
|
||||
}
|
||||
}
|
||||
|
||||
// From list extract site courses for overview
|
||||
$sitecourses = array();
|
||||
foreach ($sortedcourses as $key => $course) {
|
||||
if ($course->id > 0) {
|
||||
$sitecourses[$key] = $course;
|
||||
}
|
||||
}
|
||||
return array($sortedcourses, $sitecourses, count($courses));
|
||||
}
|
226
blocks/course_overview/module.js
Normal file
226
blocks/course_overview/module.js
Normal file
@ -0,0 +1,226 @@
|
||||
M.block_course_overview = {}
|
||||
|
||||
M.block_course_overview.add_handles = function(Y) {
|
||||
M.block_course_overview.Y = Y;
|
||||
YUI().use('dd-constrain', 'dd-proxy', 'dd-drop', 'dd-plugin', function(Y) {
|
||||
//Static Vars
|
||||
var goingUp = false, lastY = 0;
|
||||
|
||||
var list = Y.Node.all('#course_list .coursebox');
|
||||
list.each(function(v, k) {
|
||||
var dd = new Y.DD.Drag({
|
||||
node: v,
|
||||
target: {
|
||||
padding: '0 0 0 20'
|
||||
}
|
||||
}).plug(Y.Plugin.DDProxy, {
|
||||
moveOnEnd: false
|
||||
}).plug(Y.Plugin.DDConstrained, {
|
||||
constrain2node: '#course_list'
|
||||
});
|
||||
dd.addHandle('.course_title .move');
|
||||
});
|
||||
|
||||
var drops = Y.Node.all('#coursebox');
|
||||
drops.each(function(v, k) {
|
||||
var tar = new Y.DD.Drop({
|
||||
node: v
|
||||
});
|
||||
});
|
||||
|
||||
Y.DD.DDM.on('drag:start', function(e) {
|
||||
//Get our drag object
|
||||
var drag = e.target;
|
||||
//Set some styles here
|
||||
drag.get('node').setStyle('opacity', '.25');
|
||||
drag.get('dragNode').addClass('block_course_overview');
|
||||
drag.get('dragNode').set('innerHTML', drag.get('node').get('innerHTML'));
|
||||
drag.get('dragNode').setStyles({
|
||||
opacity: '.5',
|
||||
borderColor: drag.get('node').getStyle('borderColor'),
|
||||
backgroundColor: drag.get('node').getStyle('backgroundColor')
|
||||
});
|
||||
});
|
||||
|
||||
Y.DD.DDM.on('drag:end', function(e) {
|
||||
var drag = e.target;
|
||||
//Put our styles back
|
||||
drag.get('node').setStyles({
|
||||
visibility: '',
|
||||
opacity: '1'
|
||||
});
|
||||
M.block_course_overview.save(Y);
|
||||
});
|
||||
|
||||
Y.DD.DDM.on('drag:drag', function(e) {
|
||||
//Get the last y point
|
||||
var y = e.target.lastXY[1];
|
||||
//is it greater than the lastY var?
|
||||
if (y < lastY) {
|
||||
//We are going up
|
||||
goingUp = true;
|
||||
} else {
|
||||
//We are going down.
|
||||
goingUp = false;
|
||||
}
|
||||
//Cache for next check
|
||||
lastY = y;
|
||||
});
|
||||
|
||||
Y.DD.DDM.on('drop:over', function(e) {
|
||||
//Get a reference to our drag and drop nodes
|
||||
var drag = e.drag.get('node'),
|
||||
drop = e.drop.get('node');
|
||||
|
||||
//Are we dropping on a li node?
|
||||
if (drop.hasClass('coursebox')) {
|
||||
//Are we not going up?
|
||||
if (!goingUp) {
|
||||
drop = drop.get('nextSibling');
|
||||
}
|
||||
//Add the node to this list
|
||||
e.drop.get('node').get('parentNode').insertBefore(drag, drop);
|
||||
//Resize this nodes shim, so we can drop on it later.
|
||||
e.drop.sizeShim();
|
||||
}
|
||||
});
|
||||
|
||||
Y.DD.DDM.on('drag:drophit', function(e) {
|
||||
var drop = e.drop.get('node'),
|
||||
drag = e.drag.get('node');
|
||||
|
||||
//if we are not on an li, we must have been dropped on a ul
|
||||
if (!drop.hasClass('coursebox')) {
|
||||
if (!drop.contains(drag)) {
|
||||
drop.appendChild(drag);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
M.block_course_overview.save = function() {
|
||||
var Y = M.block_course_overview.Y;
|
||||
var sortorder = Y.one('#course_list').get('children').getAttribute('id');
|
||||
for (var i = 0; i < sortorder.length; i++) {
|
||||
sortorder[i] = sortorder[i].substring(7);
|
||||
}
|
||||
var params = {
|
||||
sesskey : M.cfg.sesskey,
|
||||
sortorder : sortorder
|
||||
};
|
||||
Y.io(M.cfg.wwwroot+'/blocks/course_overview/save.php', {
|
||||
method: 'POST',
|
||||
data: build_querystring(params),
|
||||
context: this
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Init a collapsible region, see print_collapsible_region in weblib.php
|
||||
* @param {YUI} Y YUI3 instance with all libraries loaded
|
||||
* @param {String} id the HTML id for the div.
|
||||
* @param {String} userpref the user preference that records the state of this box. false if none.
|
||||
* @param {String} strtooltip
|
||||
*/
|
||||
M.block_course_overview.collapsible = function(Y, id, userpref, strtooltip) {
|
||||
if (userpref) {
|
||||
M.block_course_overview.userpref = true;
|
||||
}
|
||||
Y.use('anim', function(Y) {
|
||||
new M.block_course_overview.CollapsibleRegion(Y, id, userpref, strtooltip);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Object to handle a collapsible region : instantiate and forget styled object
|
||||
*
|
||||
* @class
|
||||
* @constructor
|
||||
* @param {YUI} Y YUI3 instance with all libraries loaded
|
||||
* @param {String} id The HTML id for the div.
|
||||
* @param {String} userpref The user preference that records the state of this box. false if none.
|
||||
* @param {String} strtooltip
|
||||
*/
|
||||
M.block_course_overview.CollapsibleRegion = function(Y, id, userpref, strtooltip) {
|
||||
// Record the pref name
|
||||
this.userpref = userpref;
|
||||
|
||||
// Find the divs in the document.
|
||||
this.div = Y.one('#'+id);
|
||||
|
||||
// Get the caption for the collapsible region
|
||||
var caption = this.div.one('#'+id + '_caption');
|
||||
caption.setAttribute('title', strtooltip);
|
||||
|
||||
// Create a link
|
||||
var a = Y.Node.create('<a href="#"></a>');
|
||||
// Create a local scoped lamba function to move nodes to a new link
|
||||
var movenode = function(node){
|
||||
node.remove();
|
||||
a.append(node);
|
||||
};
|
||||
// Apply the lamba function on each of the captions child nodes
|
||||
caption.get('children').each(movenode, this);
|
||||
caption.prepend(a);
|
||||
|
||||
// Get the height of the div at this point before we shrink it if required
|
||||
var height = this.div.get('offsetHeight');
|
||||
if (this.div.hasClass('collapsed')) {
|
||||
// Shrink the div as it is collapsed by default
|
||||
this.div.setStyle('height', caption.get('offsetHeight')+'px');
|
||||
}
|
||||
|
||||
// Create the animation.
|
||||
var animation = new Y.Anim({
|
||||
node: this.div,
|
||||
duration: 0.3,
|
||||
easing: Y.Easing.easeBoth,
|
||||
to: {height:caption.get('offsetHeight')},
|
||||
from: {height:height}
|
||||
});
|
||||
|
||||
// Handler for the animation finishing.
|
||||
animation.on('end', function() {
|
||||
this.div.toggleClass('collapsed');
|
||||
}, this);
|
||||
|
||||
// Hook up the event handler.
|
||||
caption.on('click', function(e, animation) {
|
||||
e.preventDefault();
|
||||
// Animate to the appropriate size.
|
||||
if (animation.get('running')) {
|
||||
animation.stop();
|
||||
}
|
||||
animation.set('reverse', this.div.hasClass('collapsed'));
|
||||
// Update the user preference.
|
||||
if (this.userpref) {
|
||||
M.util.set_user_preference(this.userpref, !this.div.hasClass('collapsed'));
|
||||
}
|
||||
animation.run();
|
||||
}, this, animation);
|
||||
};
|
||||
|
||||
M.block_course_overview.userpref = false;
|
||||
|
||||
/**
|
||||
* The user preference that stores the state of this box.
|
||||
* @property userpref
|
||||
* @type String
|
||||
*/
|
||||
M.block_course_overview.CollapsibleRegion.prototype.userpref = null;
|
||||
|
||||
/**
|
||||
* The key divs that make up this
|
||||
* @property div
|
||||
* @type Y.Node
|
||||
*/
|
||||
M.block_course_overview.CollapsibleRegion.prototype.div = null;
|
||||
|
||||
/**
|
||||
* The key divs that make up this
|
||||
* @property icon
|
||||
* @type Y.Node
|
||||
*/
|
||||
M.block_course_overview.CollapsibleRegion.prototype.icon = null;
|
||||
|
73
blocks/course_overview/move.php
Normal file
73
blocks/course_overview/move.php
Normal file
@ -0,0 +1,73 @@
|
||||
<?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/>.
|
||||
|
||||
/**
|
||||
* Move/order course functionality for course_overview block.
|
||||
*
|
||||
* @package block_course_overview
|
||||
* @copyright 2012 Adam Olley <adam.olley@netspot.com.au>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
require_once(dirname(__FILE__) . '/../../config.php');
|
||||
require_once(dirname(__FILE__) . '/locallib.php');
|
||||
|
||||
require_sesskey();
|
||||
require_login();
|
||||
|
||||
$source = required_param('source', PARAM_INT);
|
||||
$move = required_param('move', PARAM_INT);
|
||||
|
||||
list($courses_sorted, $sitecourses, $coursecount) = block_course_overview_get_sorted_courses();
|
||||
$sortorder = array_keys($courses_sorted);
|
||||
// Now resort based on new weight for chosen course.
|
||||
$neworder = array();
|
||||
|
||||
$sourcekey = array_search($source, $sortorder);
|
||||
if ($sourcekey === false) {
|
||||
print_error("invalidcourseid", null, null, $source);
|
||||
}
|
||||
|
||||
$destination = $sourcekey + $move;
|
||||
if ($destination < 0) {
|
||||
print_error("listcantmoveup");
|
||||
} else if ($destination >= count($courses_sorted)) {
|
||||
print_error("listcantmovedown");
|
||||
}
|
||||
|
||||
// Create neworder list for courses.
|
||||
unset($sortorder[$sourcekey]);
|
||||
if ($move == -1) {
|
||||
if ($destination > 0) {
|
||||
$neworder = array_slice($sortorder, 0, $destination, true);
|
||||
}
|
||||
$neworder[] = $source;
|
||||
$remaningcourses = array_slice($sortorder, $destination);
|
||||
foreach ($remaningcourses as $courseid) {
|
||||
$neworder[] = $courseid;
|
||||
}
|
||||
} else if (($move == 1)) {
|
||||
$neworder = array_slice($sortorder, 0, $destination);
|
||||
$neworder[] = $source;
|
||||
if (($destination) < count($courses_sorted)) {
|
||||
$remaningcourses = array_slice($sortorder, $destination);
|
||||
foreach ($remaningcourses as $courseid) {
|
||||
$neworder[] = $courseid;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
block_course_overview_update_myorder($neworder);
|
||||
redirect(new moodle_url('/my/index.php'));
|
303
blocks/course_overview/renderer.php
Normal file
303
blocks/course_overview/renderer.php
Normal file
@ -0,0 +1,303 @@
|
||||
<?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/>.
|
||||
|
||||
/**
|
||||
* course_overview block rendrer
|
||||
*
|
||||
* @package block_course_overview
|
||||
* @copyright 2012 Adam Olley <adam.olley@netspot.com.au>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
/**
|
||||
* Course_overview block rendrer
|
||||
*
|
||||
* @copyright 2012 Adam Olley <adam.olley@netspot.com.au>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class block_course_overview_renderer extends plugin_renderer_base {
|
||||
|
||||
/**
|
||||
* Construct contents of course_overview block
|
||||
*
|
||||
* @param array $courses list of courses in sorted order
|
||||
* @param array $overviews list of course overviews
|
||||
* @return string html to be displayed in course_overview block
|
||||
*/
|
||||
public function course_overview($courses, $overviews) {
|
||||
$html = '';
|
||||
$config = get_config('block_course_overview');
|
||||
|
||||
$html .= html_writer::start_tag('div', array('id' => 'course_list'));
|
||||
$courseordernumber = 0;
|
||||
$maxcourses = count($courses);
|
||||
// Intialize string/icon etc if user is editing.
|
||||
$url = null;
|
||||
$moveicon = null;
|
||||
$moveup[] = null;
|
||||
$movedown[] = null;
|
||||
if ($this->page->user_is_editing()) {
|
||||
if (ajaxenabled()) {
|
||||
$moveicon = html_writer::tag('div',
|
||||
html_writer::empty_tag('img',
|
||||
array('src' => $this->pix_url('i/move_2d')->out(false),
|
||||
'alt' => get_string('move'), 'class' => 'cursor',
|
||||
'title' => get_string('move'))
|
||||
), array('class' => 'move')
|
||||
);
|
||||
} else {
|
||||
$url = new moodle_url('/blocks/course_overview/move.php', array('sesskey' => sesskey()));
|
||||
$moveup['str'] = get_string('moveup');
|
||||
$moveup['icon'] = $this->pix_url('t/up');
|
||||
$movedown['str'] = get_string('movedown');
|
||||
$movedown['icon'] = $this->pix_url('t/down');
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($courses as $key => $course) {
|
||||
$html .= $this->output->box_start('coursebox', "course-{$course->id}");
|
||||
$html .= html_writer::start_tag('div', array('class' => 'course_title'));
|
||||
// Ajax enabled then add moveicon html
|
||||
if (!is_null($moveicon)) {
|
||||
$html .= $moveicon;
|
||||
} else if (!is_null($url)) {
|
||||
// Add course id to move link
|
||||
$url->param('source', $course->id);
|
||||
$html .= html_writer::start_tag('div', array('class' => 'moveicons'));
|
||||
// Add an arrow to move course up.
|
||||
if ($courseordernumber > 0) {
|
||||
$url->param('move', -1);
|
||||
$html .= html_writer::link($url,
|
||||
html_writer::empty_tag('img', array('src' => $moveup['icon'],
|
||||
'class' => 'up', 'alt' => $moveup['str'])),
|
||||
array('title' => $moveup['str'], 'class' => 'moveup'));
|
||||
} else {
|
||||
// Add a spacer to keep keep down arrow icons at right position.
|
||||
$html .= html_writer::empty_tag('img', array('src' => $this->pix_url('t/spacer'),
|
||||
'class' => 'moveup spacer'));
|
||||
}
|
||||
// Add an arrow to move course down.
|
||||
if ($courseordernumber <= $maxcourses-2) {
|
||||
$url->param('move', 1);
|
||||
$html .= html_writer::link($url, html_writer::empty_tag('img',
|
||||
array('src' => $movedown['icon'], 'class' => 'down', 'alt' => $movedown['str'])),
|
||||
array('title' => $movedown['str'], 'class' => 'movedown'));
|
||||
}
|
||||
$html .= html_writer::end_tag('div');
|
||||
}
|
||||
|
||||
$attributes = array('title' => s($course->fullname));
|
||||
if ($course->id > 0) {
|
||||
$link = html_writer::link(new moodle_url('/course/view.php', array('id' => $course->id)), format_string($course->shortname, true, $course->id), $attributes);
|
||||
$html .= $this->output->heading($link, 2, 'title');
|
||||
} else {
|
||||
$html .= $this->output->heading(html_writer::link(
|
||||
new moodle_url('/auth/mnet/jump.php', array('hostid' => $course->hostid, 'wantsurl' => '/course/view.php?id='.$course->remoteid)),
|
||||
format_string($course->shortname, true, $course->id), $attributes) . ' (' . format_string($course->hostname) . ')', 2, 'title');
|
||||
}
|
||||
$html .= $this->output->box('', 'flush');
|
||||
$html .= html_writer::end_tag('div');
|
||||
|
||||
if (!empty($config->showchildren) && ($course->id > 0)) {
|
||||
// List children here.
|
||||
if ($children = block_course_overview_get_child_shortnames($course->id)) {
|
||||
$html .= html_writer::tag('span', $children, array('class' => 'coursechildren'));
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($overviews[$course->id])) {
|
||||
$html .= $this->activity_display($course->id, $overviews[$course->id]);
|
||||
}
|
||||
|
||||
$html .= $this->output->box('', 'flush');
|
||||
$html .= $this->output->box_end();
|
||||
$courseordernumber++;
|
||||
}
|
||||
$html .= html_writer::end_tag('div');
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Coustuct activities overview for a course
|
||||
*
|
||||
* @param int $cid course id
|
||||
* @param array $overview overview of activities in course
|
||||
* @return string html of activities overview
|
||||
*/
|
||||
protected function activity_display($cid, $overview) {
|
||||
$output = html_writer::start_tag('div', array('class' => 'activity_info'));
|
||||
foreach (array_keys($overview) as $module) {
|
||||
$output .= html_writer::start_tag('div', array('class' => 'activity_overview'));
|
||||
$url = new moodle_url("/mod/$module/index.php", array('id' => $cid));
|
||||
$modulename = get_string('modulename', $module);
|
||||
$icontext = html_writer::link($url, $this->output->pix_icon('icon', $modulename, 'mod_'.$module, array('class'=>'icon')).' ');
|
||||
if (get_string_manager()->string_exists("activityoverview", $module)) {
|
||||
$icontext .= get_string("activityoverview", $module);
|
||||
} else {
|
||||
$icontext .= get_string("activityoverview", 'block_course_overview', $modulename);
|
||||
}
|
||||
|
||||
// Add collapsible region with overview text in it.
|
||||
$output .= $this->collapsible_region($overview[$module], '', 'region_'.$cid.'_'.$module, $icontext, '', true);
|
||||
|
||||
$output .= html_writer::end_tag('div');
|
||||
}
|
||||
$output .= html_writer::end_tag('div');
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs header in editing mode
|
||||
*
|
||||
* @param int $max maximum number of courses
|
||||
* @return string html of header bar.
|
||||
*/
|
||||
public function editing_bar_head($max = 0) {
|
||||
$output = $this->output->box_start('notice');
|
||||
|
||||
$options = array('0' => get_string('alwaysshowall', 'block_course_overview'));
|
||||
for ($i = 1; $i <= $max; $i++) {
|
||||
$options[$i] = $i;
|
||||
}
|
||||
$url = new moodle_url('/my/index.php');
|
||||
$select = new single_select($url, 'mynumber', $options, block_course_overview_get_max_user_courses(), array());
|
||||
$select->set_label(get_string('numtodisplay', 'block_course_overview'));
|
||||
$output .= $this->output->render($select);
|
||||
|
||||
$output .= $this->output->box_end();
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show hidden courses count
|
||||
*
|
||||
* @param int $total count of hidden courses
|
||||
* @return string html
|
||||
*/
|
||||
public function hidden_courses($total) {
|
||||
if ($total <= 0) {
|
||||
return;
|
||||
}
|
||||
$output = $this->output->box_start('notice');
|
||||
$plural = $total > 1 ? 'plural' : '';
|
||||
$output .= get_string('hiddencoursecount'.$plural, 'block_course_overview', $total);
|
||||
$output .= $this->output->box_end();
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates collapsable region
|
||||
*
|
||||
* @param string $contents existing contents
|
||||
* @param string $classes class names added to the div that is output.
|
||||
* @param string $id id added to the div that is output. Must not be blank.
|
||||
* @param string $caption text displayed at the top. Clicking on this will cause the region to expand or contract.
|
||||
* @param string $userpref the name of the user preference that stores the user's preferred default state.
|
||||
* (May be blank if you do not wish the state to be persisted.
|
||||
* @param bool $default Initial collapsed state to use if the user_preference it not set.
|
||||
* @return bool if true, return the HTML as a string, rather than printing it.
|
||||
*/
|
||||
protected function collapsible_region($contents, $classes, $id, $caption, $userpref = '', $default = false) {
|
||||
$output = $this->collapsible_region_start($classes, $id, $caption, $userpref, $default);
|
||||
$output .= $contents;
|
||||
$output .= $this->collapsible_region_end();
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Print (or return) the start of a collapsible region, that has a caption that can
|
||||
* be clicked to expand or collapse the region. If JavaScript is off, then the region
|
||||
* will always be expanded.
|
||||
*
|
||||
* @param string $classes class names added to the div that is output.
|
||||
* @param string $id id added to the div that is output. Must not be blank.
|
||||
* @param string $caption text displayed at the top. Clicking on this will cause the region to expand or contract.
|
||||
* @param string $userpref the name of the user preference that stores the user's preferred default state.
|
||||
* (May be blank if you do not wish the state to be persisted.
|
||||
* @param bool $default Initial collapsed state to use if the user_preference it not set.
|
||||
* @return bool if true, return the HTML as a string, rather than printing it.
|
||||
*/
|
||||
protected function collapsible_region_start($classes, $id, $caption, $userpref = '', $default = false) {
|
||||
// Work out the initial state.
|
||||
if (!empty($userpref) and is_string($userpref)) {
|
||||
user_preference_allow_ajax_update($userpref, PARAM_BOOL);
|
||||
$collapsed = get_user_preferences($userpref, $default);
|
||||
} else {
|
||||
$collapsed = $default;
|
||||
$userpref = false;
|
||||
}
|
||||
|
||||
if ($collapsed) {
|
||||
$classes .= ' collapsed';
|
||||
}
|
||||
|
||||
$output = '';
|
||||
$output .= '<div id="' . $id . '" class="collapsibleregion ' . $classes . '">';
|
||||
$output .= '<div id="' . $id . '_sizer">';
|
||||
$output .= '<div id="' . $id . '_caption" class="collapsibleregioncaption">';
|
||||
$output .= $caption . ' ';
|
||||
$output .= '</div><div id="' . $id . '_inner" class="collapsibleregioninner">';
|
||||
$this->page->requires->js_init_call('M.block_course_overview.collapsible', array($id, $userpref, get_string('clicktohideshow')));
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Close a region started with print_collapsible_region_start.
|
||||
*
|
||||
* @return string return the HTML as a string, rather than printing it.
|
||||
*/
|
||||
protected function collapsible_region_end() {
|
||||
$output = '</div></div></div>';
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cretes html for welcome area
|
||||
*
|
||||
* @param int $msgcount number of messages
|
||||
* @return string html string for welcome area.
|
||||
*/
|
||||
public function welcome_area($msgcount) {
|
||||
global $USER;
|
||||
$output = $this->output->box_start('welcome_area');
|
||||
|
||||
$picture = $this->output->user_picture($USER, array('size' => 75, 'class' => 'welcome_userpicture'));
|
||||
$output .= html_writer::tag('div', $picture, array('class' => 'profilepicture'));
|
||||
|
||||
$output .= $this->output->box_start('welcome_message');
|
||||
$output .= $this->output->heading(get_string('welcome', 'block_course_overview', $USER->firstname));
|
||||
|
||||
$plural = 's';
|
||||
if ($msgcount > 0) {
|
||||
$output .= get_string('youhavemessages', 'block_course_overview', $msgcount);
|
||||
} else {
|
||||
$output .= get_string('youhavenomessages', 'block_course_overview');
|
||||
if ($msgcount == 1) {
|
||||
$plural = '';
|
||||
}
|
||||
}
|
||||
$output .= html_writer::link(new moodle_url('/message/index.php'), get_string('message'.$plural, 'block_course_overview'));
|
||||
$output .= $this->output->box_end();
|
||||
$output .= $this->output->box('', 'flush');
|
||||
$output .= $this->output->box_end();
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
34
blocks/course_overview/save.php
Normal file
34
blocks/course_overview/save.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?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/>.
|
||||
|
||||
/**
|
||||
* Save course order in course_overview block
|
||||
*
|
||||
* @package block_course_overview
|
||||
* @copyright 2012 Adam Olley <adam.olley@netspot.com.au>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define('AJAX_SCRIPT', true);
|
||||
|
||||
require_once(dirname(__FILE__) . '/../../config.php');
|
||||
require_once(dirname(__FILE__) . '/locallib.php');
|
||||
|
||||
require_sesskey();
|
||||
require_login();
|
||||
|
||||
$sortorder = required_param_array('sortorder', PARAM_INT);
|
||||
|
||||
block_course_overview_update_myorder($sortorder);
|
35
blocks/course_overview/settings.php
Normal file
35
blocks/course_overview/settings.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?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/>.
|
||||
|
||||
/**
|
||||
* course_overview block settings
|
||||
*
|
||||
* @package block_course_overview
|
||||
* @copyright 2012 Adam Olley <adam.olley@netspot.com.au>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
if ($ADMIN->fulltree) {
|
||||
$settings->add(new admin_setting_configtext('block_course_overview/defaultmaxcourses', get_string('defaultmaxcourses', 'block_course_overview'),
|
||||
get_string('defaultmaxcoursesdesc', 'block_course_overview'), 10, PARAM_INT));
|
||||
$settings->add(new admin_setting_configcheckbox('block_course_overview/forcedefaultmaxcourses', get_string('forcedefaultmaxcourses', 'block_course_overview'),
|
||||
get_string('forcedefaultmaxcoursesdesc', 'block_course_overview'), 1, PARAM_INT));
|
||||
$settings->add(new admin_setting_configcheckbox('block_course_overview/showchildren', get_string('showchildren', 'block_course_overview'),
|
||||
get_string('showchildrendesc', 'block_course_overview'), 1, PARAM_INT));
|
||||
$settings->add(new admin_setting_configcheckbox('block_course_overview/showwelcomearea', get_string('showwelcomearea', 'block_course_overview'),
|
||||
get_string('showwelcomeareadesc', 'block_course_overview'), 1, PARAM_INT));
|
||||
}
|
94
blocks/course_overview/styles.css
Normal file
94
blocks/course_overview/styles.css
Normal file
@ -0,0 +1,94 @@
|
||||
.block_course_overview .coursechildren {
|
||||
font-weight: normal;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.block_course_overview .content {
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
.block_course_overview .coursebox {
|
||||
padding: 15px 0px 10px 10px;
|
||||
width: 98%;
|
||||
}
|
||||
|
||||
.block_course_overview .profilepicture {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.block_course_overview .welcome_area {
|
||||
width: 100%;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
|
||||
.block_course_overview .welcome_message {
|
||||
float: left;
|
||||
padding: 10px;
|
||||
vertical-align: middle;
|
||||
border-collapse: separate;
|
||||
clear: none;
|
||||
}
|
||||
|
||||
.block_course_overview .content h2.title {
|
||||
float: left;
|
||||
margin-bottom: 0;
|
||||
margin-top: 0;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.block_course_overview .course_title {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.editing .block_course_overview .coursebox .cursor {
|
||||
cursor: move;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
|
||||
.editing .block_course_overview .move {
|
||||
float: left;
|
||||
padding: 2px 10px 0px 0px;
|
||||
}
|
||||
|
||||
.editing .block_course_overview .moveicons {
|
||||
display: block;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.editing .block_course_overview .moveup {
|
||||
padding-right: 5px;
|
||||
}
|
||||
|
||||
.editing .block_course_overview .spacer {
|
||||
float: left;
|
||||
width: 14px;
|
||||
}
|
||||
|
||||
.block_course_overview #course_list {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.block_course_overview div.flush {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.block_course_overview .activity_info {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.block_course_overview .activity_overview {
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
.block_course_overview .singleselect {
|
||||
text-align: left;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.block_course_overview .coursemovetarget {
|
||||
display: block;
|
||||
height: 1em;
|
||||
margin-bottom: 1em;
|
||||
border-width: 2px;
|
||||
border-style: dashed;
|
||||
}
|
@ -17,14 +17,13 @@
|
||||
/**
|
||||
* Version details
|
||||
*
|
||||
* @package block
|
||||
* @subpackage course_overview
|
||||
* @package block_course_overview
|
||||
* @copyright 1999 onwards Martin Dougiamas (http://dougiamas.com)
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2012061700; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->version = 2012062800; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2012061700; // Requires this Moodle version
|
||||
$plugin->component = 'block_course_overview'; // Full name of the plugin (used for diagnostics)
|
||||
$plugin->component = 'block_course_overview'; // Full name of the plugin (used for diagnostics)
|
@ -22,6 +22,7 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['activityoverview'] = 'You have assignments that need attention';
|
||||
$string['addsubmission'] = 'Add submission';
|
||||
$string['allowsubmissions'] = 'Allow the user to continue making submissions to this assignment.';
|
||||
$string['allowsubmissionsshort'] = 'Allow submission changes';
|
||||
|
@ -23,6 +23,7 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['activityoverview'] = 'You have assignments that need attention';
|
||||
$string['allowdeleting'] = 'Allow deleting';
|
||||
$string['allowdeleting_help'] = 'If enabled, students may delete uploaded files at any time before submitting for grading.';
|
||||
$string['allowmaxfiles'] = 'Maximum number of uploaded files';
|
||||
|
@ -23,6 +23,7 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['activityoverview'] = 'You have upcoming chat';
|
||||
$string['ajax'] = 'Version using Ajax';
|
||||
$string['autoscroll'] = 'Auto scroll';
|
||||
$string['beep'] = 'beep';
|
||||
|
@ -23,6 +23,7 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['activityoverview'] = 'There are new forum posts';
|
||||
$string['addanewdiscussion'] = 'Add a new discussion topic';
|
||||
$string['addanewquestion'] = 'Add a new question';
|
||||
$string['addanewtopic'] = 'Add a new topic';
|
||||
|
@ -25,6 +25,7 @@
|
||||
|
||||
$string['accessnoticesheader'] = 'You can preview this quiz, but if this were a real attempt, you would be blocked because:';
|
||||
$string['action'] = 'Action';
|
||||
$string['activityoverview'] = 'You have quizzes that are due';
|
||||
$string['adaptive'] = 'Adaptive mode';
|
||||
$string['adaptive_help'] = 'If enabled, multiple responses to a question are allowed within the same attempt at the quiz. So for example if a response is marked as incorrect, the student will be allowed to try again immediately. However, depending on the "Apply penalties" setting, a penalty will usually be subtracted for each wrong attempt.';
|
||||
$string['addaquestion'] = 'Add a question ...';
|
||||
|
Loading…
x
Reference in New Issue
Block a user