ÿØÿà 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-Ї Ç PKP\* styles.cssnu[.block_blog_tags .s20 { font-size: 1.5em; font-weight: bold; } .block_blog_tags .s19 { font-size: 1.5em; } .block_blog_tags .s18 { font-size: 1.4em; font-weight: bold; } .block_blog_tags .s17 { font-size: 1.4em; } .block_blog_tags .s16 { font-size: 1.3em; font-weight: bold; } .block_blog_tags .s15 { font-size: 1.3em; } .block_blog_tags .s14 { font-size: 1.2em; font-weight: bold; } .block_blog_tags .s13 { font-size: 1.2em; } .block_blog_tags .s12, .block_blog_tags .s11 { font-size: 1.1em; font-weight: bold; } .block_blog_tags .s10, .block_blog_tags .s9 { font-size: 1.1em; } .block_blog_tags .s8, .block_blog_tags .s7 { font-size: 1em; font-weight: bold; } .block_blog_tags .s6, .block_blog_tags .s5 { font-size: 1em; } .block_blog_tags .s4, .block_blog_tags .s3 { font-size: 0.9em; font-weight: bold; } .block_blog_tags .s2, .block_blog_tags .s1 { font-size: 0.9em; }PKP\    db/access.phpnu[. /** * Blog tags block caps. * * @package block_blog_tags * @copyright Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); $capabilities = array( 'block/blog_tags:addinstance' => array( 'riskbitmask' => RISK_SPAM | RISK_XSS, 'captype' => 'write', 'contextlevel' => CONTEXT_BLOCK, 'archetypes' => array( 'editingteacher' => CAP_ALLOW, 'manager' => CAP_ALLOW ), 'clonepermissionsfrom' => 'moodle/site:manageblocks' ), ); PKP\lang/en/block_blog_tags.phpnu[. /** * Strings for component 'block_blog_tags', language 'en', branch 'MOODLE_20_STABLE' * * @package block_blog_tags * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ $string['blog_tags:addinstance'] = 'Add a new blog tags block'; $string['pluginname'] = 'Blog tags'; $string['configtitle'] = 'Blog tags block title'; $string['privacy:metadata'] = 'The Blog tags block only shows data stored in other locations.'; PKP\& edit_form.phpnu[. /** * Form for editing Blog tags block instances. * * @package block_blog_tags * @copyright 2009 Tim Hunt * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ /** * Form for editing Blog tags block instances. * * @copyright 2009 Tim Hunt * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class block_blog_tags_edit_form extends block_edit_form { protected function specific_definition($mform) { // Fields for editing HTML block title and contents. $mform->addElement('header', 'configheader', get_string('blocksettings', 'block')); $mform->addElement('text', 'config_title', get_string('configtitle', 'block_blog_tags')); $mform->setDefault('config_title', get_string('blogtags', 'blog')); $mform->setType('config_title', PARAM_TEXT); $numberoftags = array(); for($i = 1; $i <= 50; $i++) { $numberoftags[$i] = $i; } $mform->addElement('select', 'config_numberoftags', get_string('numberoftags', 'blog'), $numberoftags); $mform->setDefault('config_numberoftags', BLOCK_BLOG_TAGS_DEFAULTNUMBEROFTAGS); $timewithin = array( 10 => get_string('numdays', '', 10), 30 => get_string('numdays', '', 30), 60 => get_string('numdays', '', 60), 90 => get_string('numdays', '', 90), 120 => get_string('numdays', '', 120), 240 => get_string('numdays', '', 240), 365 => get_string('numdays', '', 365), ); $mform->addElement('select', 'config_timewithin', get_string('timewithin', 'blog'), $timewithin); $mform->setDefault('config_timewithin', BLOCK_BLOG_TAGS_DEFAULTTIMEWITHIN); $sort = array( 'name' => get_string('tagtext', 'blog'), 'id' => get_string('tagdatelastused', 'blog'), ); $mform->addElement('select', 'config_sort', get_string('tagsort', 'blog'), $sort); $mform->setDefault('config_sort', BLOCK_BLOG_TAGS_DEFAULTSORT); } } PKP\n! version.phpnu[. /** * Version details * * @package block_blog_tags * @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_blog_tags'; // Full name of the plugin (used for diagnostics) PKP\(`!`!block_blog_tags.phpnu[. /** * Blog tags block. * * @package block_blog_tags * @copyright 2006 Shane Elliott * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); define('BLOCK_BLOG_TAGS_DEFAULTTIMEWITHIN', 90); define('BLOCK_BLOG_TAGS_DEFAULTNUMBEROFTAGS', 20); define('BLOCK_BLOG_TAGS_DEFAULTSORT', 'name'); class block_blog_tags extends block_base { function init() { $this->title = get_string('pluginname', 'block_blog_tags'); } function instance_allow_multiple() { return true; } function has_config() { return false; } function applicable_formats() { return array('all' => true, 'my' => false, 'tag' => false); } function instance_allow_config() { return true; } function specialization() { // load userdefined title and make sure it's never empty if (empty($this->config->title)) { $this->title = get_string('pluginname', 'block_blog_tags'); } else { $this->title = $this->config->title; } } function get_content() { global $CFG, $SITE, $USER, $DB, $OUTPUT; if ($this->content !== NULL) { return $this->content; } // make sure blog and tags are actually enabled if (empty($CFG->bloglevel)) { $this->content = new stdClass(); $this->content->text = ''; if ($this->page->user_is_editing()) { $this->content->text = get_string('blogdisable', 'blog'); } return $this->content; } else if (!core_tag_tag::is_enabled('core', 'post')) { $this->content = new stdClass(); $this->content->text = ''; if ($this->page->user_is_editing()) { $this->content->text = get_string('tagsaredisabled', 'tag'); } return $this->content; } else if ($CFG->bloglevel < BLOG_GLOBAL_LEVEL and (!isloggedin() or isguestuser())) { $this->content = new stdClass(); $this->content->text = ''; return $this->content; } // require the libs and do the work require_once($CFG->dirroot .'/blog/lib.php'); if (empty($this->config)) { $this->config = new stdClass(); } if (empty($this->config->timewithin)) { $this->config->timewithin = BLOCK_BLOG_TAGS_DEFAULTTIMEWITHIN; } if (empty($this->config->numberoftags)) { $this->config->numberoftags = BLOCK_BLOG_TAGS_DEFAULTNUMBEROFTAGS; } if (empty($this->config->sort)) { $this->config->sort = BLOCK_BLOG_TAGS_DEFAULTSORT; } $this->content = new stdClass(); $this->content->text = ''; $this->content->footer = ''; /// Get a list of tags $timewithin = time() - $this->config->timewithin * 24 * 60 * 60; /// convert to seconds $context = $this->page->context; // admins should be able to read all tags $type = ''; if (!has_capability('moodle/user:readuserblogs', context_system::instance())) { $type = " AND (p.publishstate = 'site' or p.publishstate='public')"; } $sql = "SELECT t.id, t.isstandard, t.rawname, t.name, COUNT(DISTINCT ti.id) AS ct FROM {tag} t, {tag_instance} ti, {post} p, {blog_association} ba WHERE t.id = ti.tagid AND p.id = ti.itemid $type AND ti.itemtype = 'post' AND ti.component = 'core' AND ti.timemodified > $timewithin"; if ($context->contextlevel == CONTEXT_MODULE) { $sql .= " AND ba.contextid = $context->id AND p.id = ba.blogid "; } else if ($context->contextlevel == CONTEXT_COURSE) { $sql .= " AND ba.contextid = $context->id AND p.id = ba.blogid "; } $sql .= " GROUP BY t.id, t.isstandard, t.name, t.rawname ORDER BY ct DESC, t.name ASC"; if ($tags = $DB->get_records_sql($sql, null, 0, $this->config->numberoftags)) { /// There are 2 things to do: /// 1. tags with the same count should have the same size class /// 2. however many tags we have should be spread evenly over the /// 20 size classes $totaltags = count($tags); $currenttag = 0; $size = 20; $lasttagct = -1; $etags = array(); foreach ($tags as $tag) { $currenttag++; if ($currenttag == 1) { $lasttagct = $tag->ct; $size = 20; } else if ($tag->ct != $lasttagct) { $lasttagct = $tag->ct; $size = 20 - ( (int)((($currenttag - 1) / $totaltags) * 20) ); } $tag->class = ($tag->isstandard ? "standardtag " : "") . "s$size"; $etags[] = $tag; } /// Now we sort the tag display order $CFG->tagsort = $this->config->sort; usort($etags, "block_blog_tags_sort"); /// Finally we create the output /// Accessibility: markup as a list. $this->content->text .= "\n\n"; } return $this->content; } /** * 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() { // Return all settings for all users since it is safe (no private keys, etc..). $configs = !empty($this->config) ? $this->config : new stdClass(); return (object) [ 'instance' => $configs, 'plugin' => new stdClass(), ]; } /** * This block shouldn't be added to a page if the blogs and the tags advanced features are disabled. * * @param moodle_page $page * @return bool */ public function can_block_be_added(moodle_page $page): bool { global $CFG; return $CFG->enableblogs && $CFG->usetags; } } function block_blog_tags_sort($a, $b) { global $CFG; if (empty($CFG->tagsort)) { return 0; } else { $tagsort = $CFG->tagsort; } if (is_numeric($a->$tagsort)) { return (($a->$tagsort == $b->$tagsort) ? 0 : ($a->$tagsort > $b->$tagsort)) ? 1 : -1; } elseif (is_string($a->$tagsort)) { return strcmp($a->$tagsort, $b->$tagsort); //TODO: this is not compatible with UTF-8!! } else { return 0; } } PKP\dclasses/privacy/provider.phpnu[. /** * Privacy Subsystem implementation for block_blog_tags. * * @package block_blog_tags * @copyright 2018 Zig Tan * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ namespace block_blog_tags\privacy; defined('MOODLE_INTERNAL') || die(); /** * Privacy Subsystem for block_blog_tags 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'; } } PKP\Ka tests/blog_tags_test.phpnu[. namespace block_blog_tags; use advanced_testcase; use block_blog_tags; use context_course; /** * PHPUnit block_blog_tags tests * * @package block_blog_tags * @category test * @copyright 2021 Sara Arjona (sara@moodle.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @coversDefaultClass \block_blog_tags */ final class blog_tags_test extends advanced_testcase { public static function setUpBeforeClass(): void { require_once(__DIR__ . '/../../moodleblock.class.php'); require_once(__DIR__ . '/../block_blog_tags.php'); parent::setUpBeforeClass(); } /** * Test the behaviour of can_block_be_added() method. * * @covers ::can_block_be_added */ public function test_can_block_be_added(): void { $this->resetAfterTest(); $this->setAdminUser(); // Create a course and prepare the page where the block will be added. $course = $this->getDataGenerator()->create_course(); $page = new \moodle_page(); $page->set_context(context_course::instance($course->id)); $page->set_pagelayout('course'); $block = new block_blog_tags(); // If blogs and tags advanced features are enabled, the method should return true. set_config('enableblogs', true); set_config('usetags', true); $this->assertTrue($block->can_block_be_added($page)); // However, if any of these advanced features is disabled, the method should return false. set_config('enableblogs', false); $this->assertFalse($block->can_block_be_added($page)); set_config('enableblogs', true); set_config('usetags', false); $this->assertFalse($block->can_block_be_added($page)); set_config('enableblogs', false); $this->assertFalse($block->can_block_be_added($page)); } } PKP\Q/ / tests/behat/blogtag.featurenu[@block @block_blog_tag @core_blog @core_tag Feature: Adding blog tag block In order to search blog post by tag As a user I need to be able to use block blog tag @javascript Scenario: Adding block blog tag to the course Given the following "users" exist: | username | firstname | lastname | email | | teacher1 | Teacher | 1 | teacher1@example.com | | student1 | Student | 1 | student1@example.com | And the following "courses" exist: | fullname | shortname | | Course 1 | c1 | And the following "tags" exist: | name | isstandard | | Neverusedtag | 1 | And the following "course enrolments" exist: | user | course | role | | teacher1 | c1 | editingteacher | | student1 | c1 | student | When I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on And I add the "Blog tags" block And the following config values are set as admin: | unaddableblocks | | theme_boost| # TODO MDL-57120 site "Blogs" link not accessible without navigation block. And I add the "Navigation" block if not present And I navigate to course participants And I click on "Course blogs" "link" in the "Navigation" "block" And I follow "Blog about this Course" And I set the following fields to these values: | Entry title | Blog post from teacher | | Blog entry body | Teacher blog post content | | Tags | Cats, dogs | And I press "Save changes" And I log out And I log in as "student1" And I am on "Course 1" course homepage And I navigate to course participants And I click on "Course blogs" "link" in the "Navigation" "block" And I follow "Blog about this Course" And I set the following fields to these values: | Entry title | Blog post from student | | Blog entry body | Student blog post content | | Tags | dogs, mice | And I press "Save changes" And I follow "c1" Then I should see "Cats" in the "Blog tags" "block" And I should see "dogs" in the "Blog tags" "block" And I should see "mice" in the "Blog tags" "block" And I click on "Cats" "link" in the "Blog tags" "block" And I should see "Blog post from teacher" And I should see "Teacher blog post content" And I log out PKP\* styles.cssnu[PKP\    db/access.phpnu[PKP\N lang/en/block_blog_tags.phpnu[PKP\& Oedit_form.phpnu[PKP\n! Iversion.phpnu[PKP\(`!`!#block_blog_tags.phpnu[PKP\d?classes/privacy/provider.phpnu[PKP\Ka Etests/blog_tags_test.phpnu[PKP\Q/ / QPtests/behat/blogtag.featurenu[PK Z