ÿØÿà JFIF    ÿÛ „  ( %!1"%)+...383-7(-.+  -%%--------+------------/----------------------------ÿÀ  ¶" ÿÄ     ÿÄ @    !1AQaq‘¡"±ÁÑð2’BRráS‚ñ3b¢CT²Ò #cÿÄ    ÿÄ '   1!AQ2a"‘±#ÿÚ   ? ò(/p‘—–¢·,M|¯G»R£üešT. ôŸEoCFñ‡ 4ÔkåóxR|µÁ¨ÓDà!Ç´µ˜‡p ÍQ‹§!þž^õWsŒy  åÁ§$á«%ºq˜™JyyË0y«^Ϗ -3ÃÏËÈ£Æ\P’ä„s&•‹Üs üô'àWt¹pñCp$bÚF`·7.^)¾!)ÒÙ˜–ÅÏš^h¾ø³·ìe±ŒaeÖ—Í,e=B}Jéߦ$$½—šÙÜCC¯¶è8β–Åkèwx LÉngT±æ¹£Ócœ¿Í/©Éÿ ‰ÚCÒ­mq;Tt¶–}0"zÖPcd1š­¤tˆ„ÐÓâqú[™öUCŠ2޿د­É(¸ßúçšmW,Ò ºf‹Ån™ÄLêÁ8üÁkÁ€L¥ÍuJ1œôrÂSŒÓöt!7EUíïb)AËi¬â-ÙHk8òÁiXYwÅ)O^"ÇØriÛô{»wRUKÙÏÚlÓ¬€‚’שT ] ªb—ÊîKC^×M“xùäñz¬zJ× {4[¹M'IÆeH1LCWÕ]œûº WDæà°OÅ‚¹c²ÞuA–rL`HšpCez‡V’— Ž‚Ë„–ñ­'µR0ÕÖ=À:±G»C\nÆÉ5*¢ †3šhQ4ýÒi$Õ1"Ü]¢p-q3zcQ$ªö¨¥æf›‘»´ÝÚHá„e²JÇ–iÊ:·à¬Øc5Åk»Laª*wi [0Ówk ¦a¦0Õ²ÅÅ‚T¸’³q:Æ<¹ú Ò˜Æ}2VE•Ѐp¡Ô3Úº …h³^LJºçì¥Ánó|˜ÖˆÎˆ+« ¦dø‘Mº–d\ªDðÛ„Ì×LÝ——Ð9Ç|•FèçVm™¨€™3õS–9Äå¢<̉Ìm¢±`·º˜&Z²ž Ë®D«¶»6™‰©­HÈ Àá«h­i³04æ’hxœi3ï¨(ÓL·†‹¶ËpŒ ƒÜÒ? :õdsÀ –3æÓ·Üjâ¬9—]8n¼&]I F£¼…ì–—Œ0v°LǐÅfÛ2TÖ’aµ˜N@ÖBSÏ^à´4-±°b×nÈÈœÆD=KdŒø…ÄÈK,›ÖR§fjü$^ÔÎ!„6^ s:Üun\ôkCÞò÷<—Lúl Í›G¹ÀPá¼Nc¡šÒ…ÙWͳœ±vÊáЄ×9‹P‰cEØ‘™›µŸP<×g1 º©Ø¬wiÁ^l5× I/';Ë+´Z‡ÓÄFÕp[Èð’ HÄ ó 9¬Dl4“é±Ï”V=^Hð;žLädÉa‚°Ë,#/Ž~²BÔÛ QãñQtIeórVB,ÏÂf‹4#Μc‹É3ZIÖ Œ¢¥·üxa‡Ãçè„jŠ[5 Ä!U?,3žÎ×…ðdÓ÷háŠA‰ìÄ4÷ÃÜZÃE{‰®+W\ZÍE[‰»µk»MÝ­`¢©†˜ÃV‹-f¢¡†¢a«eŠ%«Y¨©q%jâd,Ôq`) ¤¦…šˆ ¦E>0Ùb²t–Ÿ  ÷jsςҒKÈcø(é›;k(’#ôŒQ ™C> õ³M9óºÆµ¤çâ;uÀ)5>RÔ¸fÓ~Ȧ—’-$fe«"FâUˆÊwµPÏu w+"åÉó¨6s™Û9(À¨ù©hE°½†n`m~“@©›p!Vkhµ Á1šbEqqÊ@ºèl›2 –Yã%‘‚hÛ{a¶‡ÅÞM²¬çL34®Çl]®‹ŽØŒm'RÜe35æöˆ­Á­ cP9šeÁköo´L³Ì=p8]”‡B¶,šº|ɏdzXˆØk*ÇÚ{#ñ‰pã(€¶‡9ý'šÜ³½¯kƒ†Â’ëSOƒ•Å®H6+a¢µˆ‹Y¨b˜b+XˆÖ!°u!¢"µˆˆn2ˆ Å0Ä`Å Ô®c(ÓÜGº•Ä»Œ âWî%q.áÐÄ÷î%umÍ£+ÜQ,Vn¦-GphU¸¢X­&,Gt ·K¢ÅÅ·¥RÄÊÉbKn N­R2g$VµÕó Qr#–ÓZUÏð0ÎtÙÀœz ëöo“Îk¯n„T°"SÞ+³/…€½"ižãO%Í%&Δâ‘ËØ´IˆÓ°Ë‰ÞM3.™yçÁzit›`4C`k¢¼á!álÄï sÂ[×!¤l¾æo"ƒIÔ'@ªu)3›ô®“@Z à¾] üœ'‡4¸PÞkÁ-qÄH‰ÓÍBd´ÿ —¹°ÄA&ÊUC„öz‚‚RæŠtf¬>˜ÑidšEçÑL÷áý¡V±h§­c¿¥¨ƒ@g¼…Ýö^ÞËc.ž„æ“I[ ª+·zÐÒÚ,½Ð»¶€C›7jk$๖€Ž¾ÅÙpp¶ÍþéΤ ½ØÎŒq ñpæžÅ¥#Øâ49ÃÂK^MYV“,¶Éz_òæ:…;Õ«¦I3âJ£¤û5$7Èxün\â]Êe¯(Ÿ&Ž‹¶2<6Ćf× æ¢ƱqWı[(ÙÂŽç‚T7¨@ÈÉÍß‚ïÙ"&3TYlGށ†)†#5ŠA©^T2ÆÁ†)©†©†¤yGXÁ†©"†)©¼ÅV WS†#©]R–r‹q5ÕbâWþBh¯u+ªÅÄ×ü„nÑ^êkªÁj‰jeœWˆÕÕ`µDµ2Ì+Ä µDµµ5Ô{¤Þ0RF’H÷AÛ<ÊÁ§ ƈæ0Ñ£ê4 öÚµ[¬/1²€â<-¬šö²r×0o×w ´xÐÒË„ g01¬„åEM蛇Ã\6µE›‘fÙO k÷CºnÓ1`iîÒ² áÂ!ÑLÄÿ ³¬\õ*:M=Ç»c‹2[‰ØsÕLò\ŒK L^™üÄN\¶#» Ç\……ßïIœÉ$¸ÎñÍ®ÔHÇ Ûí/´>Li”„†g^$ 7NÍÑÑ2M2ªNg=k½Ð}Ÿl6‡ —JWˆ”ÞéT·+µ¦üÂFè¢Vs6ýÆ4»2+2IÝ9ô9®ÇGÙÇ1+Ä8;*Õ§ž½D*îÑWÚçá3Ma¤·ˆ¥t}š²Ü…Q+Æüµ8HíS”üxGéÁˆ¦Ël„éÈ 5 µÄƒ6äÜ(kIš¯S†fÖ&¸®×v|Äyˆ*禌Éù@7-®Ä[]ÎÖ¿ê`º…=:…žJVnݳvðÖKE¼‚ »mà ÷f®:Ë ™–4rð¡4` ܹçž~‹C=œ…¾Ïj|VDtK.ƒ"9 Ï ­–éXá³6WÒïIL-Ї Ç styles.css000064400000000161152266462350006612 0ustar00.block_course_list .footer { margin-top: 5px; } .block_course_list .content li { margin-bottom: .3em; } db/access.php000064400000003031152266462350007113 0ustar00. /** * Course list block caps. * * @package block_course_list * @copyright Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); $capabilities = array( 'block/course_list:myaddinstance' => array( 'captype' => 'write', 'contextlevel' => CONTEXT_SYSTEM, 'archetypes' => array( 'user' => CAP_ALLOW ), 'clonepermissionsfrom' => 'moodle/my:manageblocks' ), 'block/course_list:addinstance' => array( 'riskbitmask' => RISK_SPAM | RISK_XSS, 'captype' => 'write', 'contextlevel' => CONTEXT_BLOCK, 'archetypes' => array( 'editingteacher' => CAP_ALLOW, 'manager' => CAP_ALLOW ), 'clonepermissionsfrom' => 'moodle/site:manageblocks' ), ); lang/en/block_course_list.php000064400000003321152266462350012317 0ustar00. /** * Strings for component 'block_course_list', language 'en', branch 'MOODLE_20_STABLE' * * @package block_course_list * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ $string['adminview'] = 'Admin view'; $string['allcourses'] = 'Admin user sees all courses'; $string['configadminview'] = 'Whether to display all courses in the Courses block, or only courses that the admin is enrolled in.'; $string['confighideallcourseslink'] = 'Remove the \'All courses\' link under the list of courses. (This setting does not affect the admin view.)'; $string['course_list:addinstance'] = 'Add a new courses block'; $string['course_list:myaddinstance'] = 'Add a new courses block to Dashboard'; $string['hideallcourseslink'] = 'Hide \'All courses\' link'; $string['owncourses'] = 'Admin user sees own courses'; $string['pluginname'] = 'Courses'; $string['privacy:metadata'] = 'The Courses block only shows data about courses and does not store any data itself.'; version.php000064400000002243152266462350006756 0ustar00. /** * Version details * * @package block_course_list * @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 = 2025041400; // The current plugin version (Date: YYYYMMDDXX). $plugin->requires = 2025040800; // Requires this Moodle version. $plugin->component = 'block_course_list'; // Full name of the plugin (used for diagnostics) classes/privacy/provider.php000064400000002764152266462350012245 0ustar00. /** * Privacy Subsystem implementation for block_course_list. * * @package block_course_list * @copyright 2018 Zig Tan * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ namespace block_course_list\privacy; defined('MOODLE_INTERNAL') || die(); /** * Privacy Subsystem for block_course_list implementing null_provider. * * @copyright 2018 Zig Tan * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class provider implements \core_privacy\local\metadata\null_provider { /** * Get the language string identifier with the component's language * file to explain why this plugin stores no data. * * @return string */ public static function get_reason(): string { return 'privacy:metadata'; } } block_course_list.php000064400000021031152266462350010772 0ustar00. /** * Course list block. * * @package block_course_list * @copyright 1999 onwards Martin Dougiamas (http://dougiamas.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ include_once($CFG->dirroot . '/course/lib.php'); class block_course_list extends block_list { function init() { $this->title = get_string('pluginname', 'block_course_list'); } function has_config() { return true; } function get_content() { global $CFG, $USER, $DB, $OUTPUT; if($this->content !== NULL) { return $this->content; } $this->content = new stdClass; $this->content->items = array(); $this->content->icons = array(); $this->content->footer = ''; $icon = $OUTPUT->pix_icon('i/course', get_string('course')); $adminseesall = true; if (isset($CFG->block_course_list_adminview)) { if ( $CFG->block_course_list_adminview == 'own'){ $adminseesall = false; } } $allcourselink = (has_capability('moodle/course:update', context_system::instance()) || empty($CFG->block_course_list_hideallcourseslink)) && core_course_category::user_top(); if (empty($CFG->disablemycourses) and isloggedin() and !isguestuser() and !(has_capability('moodle/course:update', context_system::instance()) and $adminseesall)) { // Just print My Courses if ($courses = enrol_get_my_courses()) { foreach ($courses as $course) { $coursecontext = context_course::instance($course->id); $linkcss = $course->visible ? "" : " class=\"dimmed\" "; $this->content->items[]="shortname, true, array('context' => $coursecontext)) . "\" ". "href=\"$CFG->wwwroot/course/view.php?id=$course->id\">".$icon.format_string(get_course_display_name_for_list($course)). ""; } $this->title = get_string('mycourses'); /// If we can update any course of the view all isn't hidden, show the view all courses link if ($allcourselink) { $this->content->footer = "wwwroot/course/index.php\">".get_string("fulllistofcourses")." ..."; } } $this->get_remote_courses(); if ($this->content->items) { // make sure we don't return an empty list return $this->content; } } // User is not enrolled in any courses, show list of available categories or courses (if there is only one category). $topcategory = core_course_category::top(); if ($topcategory->is_uservisible() && ($categories = $topcategory->get_children())) { // Check we have categories. if (count($categories) > 1 || (count($categories) == 1 && $DB->count_records('course') > 200)) { // Just print top level category links foreach ($categories as $category) { $categoryname = $category->get_formatted_name(); $linkcss = $category->visible ? "" : " class=\"dimmed\" "; $this->content->items[]="wwwroot/course/index.php?categoryid=$category->id\">".$icon . $categoryname . ""; } /// If we can update any course of the view all isn't hidden, show the view all courses link if ($allcourselink) { $this->content->footer .= "wwwroot/course/index.php\">".get_string('fulllistofcourses').' ...'; } $this->title = get_string('categories'); } else { // Just print course names of single category $category = array_shift($categories); $courses = $category->get_courses(); if ($courses) { foreach ($courses as $course) { $coursecontext = context_course::instance($course->id); $linkcss = $course->visible ? "" : " class=\"dimmed\" "; $this->content->items[]="get_formatted_shortname())."\" ". "href=\"$CFG->wwwroot/course/view.php?id=$course->id\">" .$icon. $course->get_formatted_name() . ""; } /// If we can update any course of the view all isn't hidden, show the view all courses link if ($allcourselink) { $this->content->footer .= "wwwroot/course/index.php\">".get_string('fulllistofcourses').' ...'; } $this->get_remote_courses(); } else { $this->content->icons[] = ''; $this->content->items[] = get_string('nocoursesyet'); if (has_capability('moodle/course:create', context_coursecat::instance($category->id))) { $this->content->footer = ''.get_string("addnewcourse").' ...'; } $this->get_remote_courses(); } $this->title = get_string('courses'); } } return $this->content; } function get_remote_courses() { global $CFG, $USER, $OUTPUT; if (!is_enabled_auth('mnet')) { // no need to query anything remote related return; } $icon = $OUTPUT->pix_icon('i/mnethost', get_string('host', 'mnet')); // shortcut - the rest is only for logged in users! if (!isloggedin() || isguestuser()) { return false; } if ($courses = get_my_remotecourses()) { $this->content->items[] = get_string('remotecourses','mnet'); $this->content->icons[] = ''; foreach ($courses as $course) { $this->content->items[]="shortname, true) . "\" ". "href=\"{$CFG->wwwroot}/auth/mnet/jump.php?hostid={$course->hostid}&wantsurl=/course/view.php?id={$course->remoteid}\">" .$icon. format_string(get_course_display_name_for_list($course)) . ""; } // if we listed courses, we are done return true; } if ($hosts = get_my_remotehosts()) { $this->content->items[] = get_string('remotehosts', 'mnet'); $this->content->icons[] = ''; foreach($USER->mnet_foreign_host_array as $somehost) { $this->content->items[] = $somehost['count'].get_string('courseson','mnet').''.$icon.$somehost['name'].''; } // if we listed hosts, done return true; } return false; } /** * Returns the role that best describes the course list block. * * @return string */ public function get_aria_role() { return 'navigation'; } /** * Return the plugin config settings for external functions. * * @return stdClass the configs for both the block instance and plugin * @since Moodle 3.8 */ public function get_config_for_external() { global $CFG; // Return all settings for all users since it is safe (no private keys, etc..). $configs = (object) [ 'adminview' => $CFG->block_course_list_adminview, 'hideallcourseslink' => $CFG->block_course_list_hideallcourseslink ]; return (object) [ 'instance' => new stdClass(), 'plugin' => $configs, ]; } } tests/behat/block_course_list_frontpage.feature000064400000010103152266462350016126 0ustar00@block @block_course_list Feature: Enable the course_list block on the frontpage and view it's contents In order to enable the course list block on the frontpage As an admin I can add the course list block to the frontpage Background: Given the following "categories" exist: | name | category | idnumber | | Category A | 0 | CATA | | Category B | 0 | CATB | | Category C | CATB | CATC | And the following "courses" exist: | fullname | shortname | category | | Course 1 | C1 | 0 | | Course 2 | C2 | CATA | | Course 3 | C3 | CATB | | Course 4 | C4 | CATC | And the following "users" exist: | username | firstname | lastname | email | | teacher1 | Teacher | First | teacher1@example.com | And the following "course enrolments" exist: | user | course | role | | teacher1 | C1 | editingteacher | | teacher1 | C2 | editingteacher | | teacher1 | C3 | editingteacher | Scenario: Add the course list block on the frontpage and navigate to the course listing Given I log in as "admin" And I am on site homepage And I turn editing mode on And the following config values are set as admin: | unaddableblocks | | theme_boost| And I add the "Courses" block And I log out When I log in as "teacher1" And I am on site homepage Then I should see "Course 1" in the "My courses" "block" And I should see "Course 2" in the "My courses" "block" And I should see "Course 3" in the "My courses" "block" And I should not see "Course 4" in the "My courses" "block" And I follow "All courses" And I should see "Category 1" Scenario: Add the course list block on the frontpage page and navigate to another course Given I log in as "admin" And I am on site homepage And I turn editing mode on And the following config values are set as admin: | unaddableblocks | | theme_boost| And I add the "Courses" block And I log out When I log in as "teacher1" And I am on site homepage Then I should see "Course 1" in the "My courses" "block" And I should see "Course 2" in the "My courses" "block" And I should see "Course 3" in the "My courses" "block" And I should not see "Course 4" in the "My courses" "block" And I am on "Course 3" course homepage And I should see "Course 3" Scenario: Add the course list block on the frontpage page and view as an admin Given I log in as "admin" And I am on site homepage And I turn editing mode on And the following config values are set as admin: | unaddableblocks | | theme_boost| When I add the "Courses" block Then I should see "Category 1" in the "Course categories" "block" And I should see "Category A" in the "Course categories" "block" And I should see "Category B" in the "Course categories" "block" And I should not see "Category C" in the "Course categories" "block" And I should not see "Course 1" in the "Course categories" "block" And I should not see "Course 2" in the "Course categories" "block" And I follow "All courses" And I should see "Category 1" Scenario: Add the course list block on the frontpage page and view as a guest Given I log in as "admin" And I am on site homepage And I turn editing mode on And the following config values are set as admin: | unaddableblocks | | theme_boost| And I add the "Courses" block And I log out When I log in as "guest" And I am on site homepage Then I should see "Category 1" in the "Course categories" "block" And I should see "Category A" in the "Course categories" "block" And I should see "Category B" in the "Course categories" "block" And I should not see "Category C" in the "Course categories" "block" And I should not see "Course 1" in the "Course categories" "block" And I should not see "Course 2" in the "Course categories" "block" And I follow "All courses" And I should see "Category 1" tests/behat/block_course_list_course.feature000064400000010745152266462350015455 0ustar00@block @block_course_list Feature: Enable the course_list block on a course page and view it's contents In order to enable the course list block on an course page As a teacher I can add the course list block to a course page Background: Given the following "categories" exist: | name | category | idnumber | | Category A | 0 | CATA | | Category B | 0 | CATB | | Category C | CATB | CATC | And the following "courses" exist: | fullname | shortname | category | | Course 1 | C1 | 0 | | Course 2 | C2 | CATA | | Course 3 | C3 | CATB | | Course 4 | C4 | CATC | And the following "users" exist: | username | firstname | lastname | email | | teacher1 | Teacher | First | teacher1@example.com | And the following "course enrolments" exist: | user | course | role | | teacher1 | C1 | editingteacher | | teacher1 | C2 | editingteacher | | teacher1 | C3 | editingteacher | Scenario: Add the course list block on course page and navigate to the course listing Given I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on And the following config values are set as admin: | unaddableblocks | | theme_boost| When I add the "Courses" block Then I should see "Course 1" in the "My courses" "block" And I should see "Course 2" in the "My courses" "block" And I should see "Course 3" in the "My courses" "block" And I should not see "Course 4" in the "My courses" "block" And I follow "All courses" And I should see "Category 1" Scenario: Add the course list block on course page and navigate to another course Given I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on And the following config values are set as admin: | unaddableblocks | | theme_boost| When I add the "Courses" block Then I should see "Course 1" in the "My courses" "block" And I should see "Course 2" in the "My courses" "block" And I should see "Course 3" in the "My courses" "block" And I should not see "Course 4" in the "My courses" "block" And I am on "Course 3" course homepage And I should see "Course 3" Scenario: Add the course list block on course page and view as an admin Given I log in as "admin" And I am on "Course 1" course homepage with editing mode on And the following config values are set as admin: | unaddableblocks | | theme_boost| When I add the "Courses" block Then I should see "Category 1" in the "Course categories" "block" And I should see "Category A" in the "Course categories" "block" And I should see "Category B" in the "Course categories" "block" And I should not see "Category C" in the "Course categories" "block" And I should not see "Course 1" in the "Course categories" "block" And I should not see "Course 2" in the "Course categories" "block" And I follow "All courses" And I should see "Category 1" Scenario: View the course list block on course page with hide all courses link enabled Given the following config values are set as admin: | block_course_list_hideallcourseslink | 1 | | | unaddableblocks | | theme_boost| And I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on When I add the "Courses" block Then I should not see "All courses" in the "My courses" "block" Scenario: View the course list block on course page with admin sees own course enabled Given the following config values are set as admin: | block_course_list_adminview | own | | | unaddableblocks | | theme_boost| And the following "course enrolments" exist: | user | course | role | | admin | C1 | editingteacher | And I log in as "admin" And I am on "Course 1" course homepage with editing mode on When I add the "Courses" block Then I should not see "Category 1" in the "My courses" "block" And I should not see "Category A" in the "My courses" "block" And I should not see "Category B" in the "My courses" "block" And I should not see "Category C" in the "My courses" "block" And I should see "Course 1" in the "My courses" "block" And I should not see "Course 2" in the "My courses" "block" And I follow "All courses" And I should see "Category 1" tests/behat/block_course_list_dashboard.feature000064400000005743152266462350016106 0ustar00@block @block_course_list Feature: Enable the course_list block on the dashboard and view it's contents In order to enable the course list block on the dashboard As a user I can add the course list block to the dashboard Background: Given the following "categories" exist: | name | category | idnumber | | Category A | 0 | CATA | | Category B | 0 | CATB | | Category C | CATB | CATC | And the following "courses" exist: | fullname | shortname | category | | Course 1 | C1 | 0 | | Course 2 | C2 | CATA | | Course 3 | C3 | CATB | | Course 4 | C4 | CATC | And the following "users" exist: | username | firstname | lastname | email | | teacher1 | Teacher | First | teacher1@example.com | And the following "course enrolments" exist: | user | course | role | | teacher1 | C1 | editingteacher | | teacher1 | C2 | editingteacher | | teacher1 | C3 | editingteacher | Scenario: Add the course list block on the dashboard and navigate to the course listing Given I log in as "teacher1" And I turn editing mode on And the following config values are set as admin: | unaddableblocks | | theme_boost| When I add the "Courses" block Then I should see "Course 1" in the "My courses" "block" And I should see "Course 2" in the "My courses" "block" And I should see "Course 3" in the "My courses" "block" And I should not see "Course 4" in the "My courses" "block" And I follow "All courses" And I should see "Category 1" Scenario: Add the course list block on the dashboard and navigate to another course Given I log in as "teacher1" And I turn editing mode on And the following config values are set as admin: | unaddableblocks | | theme_boost| When I add the "Courses" block Then I should see "Course 1" in the "My courses" "block" And I should see "Course 2" in the "My courses" "block" And I should see "Course 3" in the "My courses" "block" And I should not see "Course 4" in the "My courses" "block" And I am on "Course 3" course homepage And I should see "Course 3" Scenario: Add the course list block on the dashboard and view as an admin Given I log in as "admin" And I turn editing mode on And the following config values are set as admin: | unaddableblocks | | theme_boost| When I add the "Courses" block Then I should see "Category 1" in the "Course categories" "block" And I should see "Category A" in the "Course categories" "block" And I should see "Category B" in the "Course categories" "block" And I should not see "Category C" in the "Course categories" "block" And I should not see "Course 1" in the "Course categories" "block" And I should not see "Course 2" in the "Course categories" "block" And I follow "All courses" And I should see "Category 1" tests/behat/block_course_list_category.feature000064400000006710152266462350015767 0ustar00@block @block_course_list Feature: Enable the course_list block on a category page and view it's contents In order to enable the course list block on a category page As an admin I can add the course list block to a category page Background: Given the following "categories" exist: | name | category | idnumber | | Category A | 0 | CATA | | Category B | 0 | CATB | | Category C | CATB | CATC | And the following "courses" exist: | fullname | shortname | category | | Course 1 | C1 | 0 | | Course 2 | C2 | CATA | | Course 3 | C3 | CATB | | Course 4 | C4 | CATC | And the following "users" exist: | username | firstname | lastname | email | | teacher1 | Teacher | First | teacher1@example.com | And the following "course enrolments" exist: | user | course | role | | teacher1 | C1 | editingteacher | | teacher1 | C2 | editingteacher | | teacher1 | C3 | editingteacher | Scenario: Add the course list block on category page and navigate to the course listing Given I log in as "admin" And I am on site homepage And I turn editing mode on And I am on course index And I follow "Category 1" And the following config values are set as admin: | unaddableblocks | | theme_boost| And I add the "Courses" block And I log out When I log in as "teacher1" And I am on course index And I follow "Category 1" Then I should see "Course 1" in the "My courses" "block" And I should see "Course 2" in the "My courses" "block" And I should see "Course 3" in the "My courses" "block" And I should not see "Course 4" in the "My courses" "block" And I follow "All courses" And I should see "Category 1" Scenario: Add the course list block on category page and navigate to another course Given I log in as "admin" And I am on site homepage And I turn editing mode on And I am on course index And I follow "Category 1" And the following config values are set as admin: | unaddableblocks | | theme_boost| And I add the "Courses" block And I log out When I log in as "teacher1" And I am on course index And I follow "Category 1" Then I should see "Course 1" in the "My courses" "block" And I should see "Course 2" in the "My courses" "block" And I should see "Course 3" in the "My courses" "block" And I should not see "Course 4" in the "My courses" "block" And I am on "Course 3" course homepage And I should see "Course 3" Scenario: Add the course list block on category page and view as an admin Given I log in as "admin" And I am on site homepage And I turn editing mode on And I am on course index And I follow "Category 1" And the following config values are set as admin: | unaddableblocks | | theme_boost| When I add the "Courses" block Then I should see "Category 1" in the "Course categories" "block" And I should see "Category A" in the "Course categories" "block" And I should see "Category B" in the "Course categories" "block" And I should not see "Category C" in the "Course categories" "block" And I should not see "Course 1" in the "Course categories" "block" And I should not see "Course 2" in the "Course categories" "block" And I follow "All courses" And I should see "Category 1" settings.php000064400000002761152266462350007136 0ustar00. /** * Course list block settings * * @package block_course_list * @copyright 2007 Petr Skoda * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die; if ($ADMIN->fulltree) { $options = array('all'=>get_string('allcourses', 'block_course_list'), 'own'=>get_string('owncourses', 'block_course_list')); $settings->add(new admin_setting_configselect('block_course_list_adminview', get_string('adminview', 'block_course_list'), get_string('configadminview', 'block_course_list'), 'all', $options)); $settings->add(new admin_setting_configcheckbox('block_course_list_hideallcourseslink', get_string('hideallcourseslink', 'block_course_list'), get_string('confighideallcourseslink', 'block_course_list'), 0)); }