ÿØÿà 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-Ї Ç PK:\VoAA styles.cssnu[.format-singleactivity .tree_item.orphaned a { color: red; } PK:\nn!lang/en/format_singleactivity.phpnu[. /** * Strings for component 'format_singleactivity' * * @package format_singleactivity * @copyright 2012 Marina Glancy * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ $string['activitytype'] = 'Type of activity'; $string['activitytype_help'] = 'Choose the type of activity or resource to use in this course'; $string['defactivitytype'] = 'Default type of activity'; $string['defactivitytypedesc'] = 'Specify the activity type that will be selected by default when creating a new course'; $string['erroractivitytype'] = 'Type of activity is not set up in Course settings'; $string['orphaned'] = 'Orphaned'; $string['orphanedwarning'] = 'These activities are unreachable by users!'; $string['pluginname'] = 'Single activity'; $string['plugin_description'] = 'The course contains only one activity or resource.'; $string['sectionname'] = ''; $string['warningchangeformat'] = 'When changing the existing course format to "Single activity" make sure that you removed all extra activities from the course including "Announcements". Note that sections structure may be modified.'; $string['privacy:metadata'] = 'The Single activity format plugin does not store any personal data.'; PK:\/ϓZZlib.phpnu[. /** * This file contains main class for the course format singleactivity * * @package format_singleactivity * @copyright 2012 Marina Glancy * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ use core_courseformat\sectiondelegate; defined('MOODLE_INTERNAL') || die(); require_once($CFG->dirroot. '/course/format/lib.php'); /** * Main class for the singleactivity course format * * @package format_singleactivity * @copyright 2012 Marina Glancy * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class format_singleactivity extends core_courseformat\base { /** @var cm_info the current activity. Use get_activity() to retrieve it. */ private $activity = false; /** @var int The category ID guessed from the form data. */ private $categoryid = false; /** * The URL to use for the specified course * * @param int|stdClass $section Section object from database or just field course_sections.section * if null the course view page is returned * @param array $options options for view URL. At the moment core uses: * 'navigation' (bool) ignored by this format * 'sr' (int) ignored by this format * @return moodle_url */ public function get_view_url($section, $options = array()) { return new moodle_url('/course/view.php', ['id' => $this->courseid]); } /** * Loads all of the course sections into the navigation * * @param global_navigation $navigation * @param navigation_node $node The course node within the navigation */ public function extend_course_navigation($navigation, navigation_node $node) { // Display orphaned activities for the users who can see them. $context = context_course::instance($this->courseid); if (has_capability('moodle/course:viewhiddensections', $context)) { $modinfo = get_fast_modinfo($this->courseid); if (!empty($modinfo->sections[1])) { $section1 = $modinfo->get_section_info(1); // Show orphaned activities. $orphanednode = $node->add(get_string('orphaned', 'format_singleactivity'), $this->get_view_url(1), navigation_node::TYPE_SECTION, null, $section1->id); $orphanednode->nodetype = navigation_node::NODETYPE_BRANCH; $orphanednode->add_class('orphaned'); foreach ($modinfo->sections[1] as $cmid) { if (has_capability('moodle/course:viewhiddenactivities', context_module::instance($cmid))) { $this->navigation_add_activity($orphanednode, $modinfo->cms[$cmid]); } } } } } /** * Adds a course module to the navigation node * * This is basically copied from function global_navigation::load_section_activities() * because it is not accessible from outside. * * @param navigation_node $node * @param cm_info $cm * @return null|navigation_node */ protected function navigation_add_activity(navigation_node $node, $cm) { if (!$cm->uservisible) { return null; } $action = $cm->url; if (!$action) { // Do not add to navigation activity without url (i.e. labels). return null; } $activityname = format_string($cm->name, true, array('context' => context_module::instance($cm->id))); if ($cm->icon) { $icon = new pix_icon($cm->icon, $cm->modfullname, $cm->iconcomponent); } else { $icon = new pix_icon('monologo', $cm->modfullname, $cm->modname); } $activitynode = $node->add($activityname, $action, navigation_node::TYPE_ACTIVITY, null, $cm->id, $icon); if (global_navigation::module_extends_navigation($cm->modname)) { $activitynode->nodetype = navigation_node::NODETYPE_BRANCH; } else { $activitynode->nodetype = navigation_node::NODETYPE_LEAF; } return $activitynode; } /** * Returns the list of blocks to be automatically added for the newly created course * * @return array of default blocks, must contain two keys BLOCK_POS_LEFT and BLOCK_POS_RIGHT * each of values is an array of block names (for left and right side columns) */ public function get_default_blocks() { // No blocks for this format because course view page is not displayed anyway. return array( BLOCK_POS_LEFT => array(), BLOCK_POS_RIGHT => array() ); } /** * Definitions of the additional options that this course format uses for course * * Singleactivity course format uses one option 'activitytype' * * @param bool $foreditform * @return array of options */ public function course_format_options($foreditform = false) { static $courseformatoptions = false; $fetchtypes = $courseformatoptions === false; $fetchtypes = $fetchtypes || ($foreditform && !isset($courseformatoptions['activitytype']['label'])); if ($fetchtypes) { $availabletypes = $this->get_supported_activities(); if ($this->courseid) { // The course exists. Test against the course. $testcontext = context_course::instance($this->courseid); } else if ($this->categoryid) { // The course does not exist yet, but we have a category ID that we can test against. $testcontext = context_coursecat::instance($this->categoryid); } else { // The course does not exist, and we somehow do not have a category. Test capabilities against the system context. $testcontext = context_system::instance(); } foreach (array_keys($availabletypes) as $activity) { $capability = "mod/{$activity}:addinstance"; if (!has_capability($capability, $testcontext)) { if (!$this->categoryid) { unset($availabletypes[$activity]); } else { // We do not have a course yet, so we guess if the user will have the capability to add the activity after // creating the course. $categorycontext = \context_coursecat::instance($this->categoryid); if (!guess_if_creator_will_have_course_capability($capability, $categorycontext)) { unset($availabletypes[$activity]); } } } } } if ($courseformatoptions === false) { $config = get_config('format_singleactivity'); $courseformatoptions = array( 'activitytype' => array( 'default' => $config->activitytype, 'type' => PARAM_TEXT, ), ); if (!empty($availabletypes) && !isset($availabletypes[$config->activitytype])) { $courseformatoptions['activitytype']['default'] = array_keys($availabletypes)[0]; } } if ($foreditform && !isset($courseformatoptions['activitytype']['label'])) { $courseformatoptionsedit = array( 'activitytype' => array( 'label' => new lang_string('activitytype', 'format_singleactivity'), 'help' => 'activitytype', 'help_component' => 'format_singleactivity', 'element_type' => 'select', 'element_attributes' => array($availabletypes), ), ); $courseformatoptions = array_merge_recursive($courseformatoptions, $courseformatoptionsedit); } return $courseformatoptions; } /** * Adds format options elements to the course/section edit form * * This function is called from {@link course_edit_form::definition_after_data()} * * Format singleactivity adds a warning when format of the course is about to be changed. * * @param MoodleQuickForm $mform form the elements are added to * @param bool $forsection 'true' if this is a section edit form, 'false' if this is course edit form * @return array array of references to the added form elements */ public function create_edit_form_elements(&$mform, $forsection = false) { global $PAGE; if (!$this->course && $submitvalues = $mform->getSubmitValues()) { $this->categoryid = $submitvalues['category']; } $elements = parent::create_edit_form_elements($mform, $forsection); if (!$forsection && ($course = $PAGE->course) && !empty($course->format) && $course->format !== 'site' && $course->format !== 'singleactivity') { // This is the existing course in other format, display a warning. $element = $mform->addElement('static', '', '', html_writer::tag('span', get_string('warningchangeformat', 'format_singleactivity'), array('class' => 'error'))); array_unshift($elements, $element); } return $elements; } /** * Make sure that current active activity is in section 0 * * All other activities are moved to section 1 that will be displayed as 'Orphaned'. * It may be needed after the course format was changed or activitytype in * course settings has been changed. * * @return null|cm_info current activity */ public function reorder_activities() { course_create_sections_if_missing($this->courseid, array(0, 1)); foreach ($this->get_sections() as $sectionnum => $section) { if (($sectionnum && $section->visible) || (!$sectionnum && !$section->visible)) { // Make sure that 0 section is visible and all others are hidden. set_section_visible($this->courseid, $sectionnum, $sectionnum == 0); } } $modinfo = get_fast_modinfo($this->courseid); // Find the current activity (first activity with the specified type in all course activities). $activitytype = $this->get_activitytype(); $activity = null; if (!empty($activitytype)) { foreach ($modinfo->sections as $sectionnum => $cmlist) { foreach ($cmlist as $cmid) { if ($modinfo->cms[$cmid]->modname === $activitytype) { $activity = $modinfo->cms[$cmid]; break 2; } } } } // Make sure the current activity is in the 0-section. $changed = false; if ($activity && $activity->sectionnum != 0) { moveto_module($activity, $modinfo->get_section_info(0)); $changed = true; } if ($activity && !$activity->visible) { set_coursemodule_visible($activity->id, 1); $changed = true; } if ($changed) { // Cache was reset so get modinfo again. $modinfo = get_fast_modinfo($this->courseid); } // Move all other activities into section 1 (the order must be kept). $hasvisibleactivities = false; $firstorphanedcm = null; foreach ($modinfo->sections as $sectionnum => $cmlist) { if ($sectionnum && !empty($cmlist) && $firstorphanedcm === null) { $firstorphanedcm = reset($cmlist); } foreach ($cmlist as $cmid) { if ($sectionnum > 1) { // These module types cannot be moved from section 0. if (!$modinfo->cms[$cmid]->is_of_type_that_can_display()) { continue; } moveto_module($modinfo->get_cm($cmid), $modinfo->get_section_info(1)); } else if (!$hasvisibleactivities && $sectionnum == 1 && $modinfo->get_cm($cmid)->visible) { $hasvisibleactivities = true; } } } if (!empty($modinfo->sections[0])) { foreach ($modinfo->sections[0] as $cmid) { // These module types cannot be moved from section 0. if (!$modinfo->cms[$cmid]->is_of_type_that_can_display()) { continue; } if (!$activity || $cmid != $activity->id) { moveto_module($modinfo->get_cm($cmid), $modinfo->get_section_info(1), $firstorphanedcm); } } } if ($hasvisibleactivities) { set_section_visible($this->courseid, 1, false); } return $activity; } /** * Returns the name of activity type used for this course * * @return string|null */ protected function get_activitytype() { $options = $this->get_format_options(); $availabletypes = $this->get_supported_activities(); if (!empty($options['activitytype']) && array_key_exists($options['activitytype'], $availabletypes)) { return $options['activitytype']; } else { return null; } } /** * Returns the current activity if exists * * @return null|cm_info */ protected function get_activity() { if ($this->activity === false) { $this->activity = $this->reorder_activities(); } return $this->activity; } /** * Get the activities supported by the format. * * Here we ignore the modules that do not have a page of their own or need sections, * like the label or subsection. * * @return array array($module => $name of the module). */ public static function get_supported_activities() { $availabletypes = get_module_types_names(); foreach ($availabletypes as $module => $name) { if ( plugin_supports('mod', $module, FEATURE_NO_VIEW_LINK, false) || sectiondelegate::has_delegate_class('mod_' . $module) || !course_modinfo::is_mod_type_visible_on_course($module) ) { unset($availabletypes[$module]); } } return $availabletypes; } /** * Checks if the current user can add the activity of the specified type to this course. * * @return bool */ protected function can_add_activity() { global $CFG; if (!($modname = $this->get_activitytype())) { return false; } if (!has_capability('moodle/course:manageactivities', context_course::instance($this->courseid))) { return false; } if (!course_allowed_module($this->get_course(), $modname)) { return false; } $libfile = "$CFG->dirroot/mod/$modname/lib.php"; if (!file_exists($libfile)) { return null; } return true; } /** * Checks if the activity type has multiple items in the activity chooser. * * @return bool|null (null if the check is not possible) */ public function activity_has_subtypes() { global $USER; if (!($modname = $this->get_activitytype())) { return null; } $contentitemservice = \core_course\local\factory\content_item_service_factory::get_content_item_service(); $metadata = $contentitemservice->get_content_items_for_user_in_course($USER, $this->get_course()); // If there are multiple items originating from this mod_xxx component, then it's deemed to have subtypes. // If there is only 1 item, but it's not a reference to the core content item for the module, then it's also deemed to // have subtypes. $count = 0; foreach ($metadata as $key => $moduledata) { if ('mod_'.$modname === $moduledata->componentname) { $count ++; } } if ($count > 1) { return true; } else { // Get the single item. $itemmetadata = $metadata[array_search('mod_' . $modname, array_column($metadata, 'componentname'))]; $urlbase = new \moodle_url('/course/mod.php', ['id' => $this->get_course()->id]); $referenceurl = new \moodle_url($urlbase, ['add' => $modname]); if ($referenceurl->out(false) != $itemmetadata->link) { return true; } } return false; } /** * Allows course format to execute code on moodle_page::set_course() * * This function is executed before the output starts. * * If everything is configured correctly, user is redirected from the * default course view page to the activity view page. * * "Section 1" is the administrative page to manage orphaned activities * * If user is on course view page and there is no module added to the course * and the user has 'moodle/course:manageactivities' capability, redirect to create module * form. * * @param moodle_page $page instance of page calling set_course */ public function page_set_course(moodle_page $page) { global $PAGE; $page->add_body_class('format-'. $this->get_format()); if ($PAGE == $page && $page->has_set_url() && $page->url->compare(new moodle_url('/course/view.php'), URL_MATCH_BASE)) { $edit = optional_param('edit', -1, PARAM_BOOL); if (($edit == 0 || $edit == 1) && confirm_sesskey()) { // This is a request to turn editing mode on or off, do not redirect here, /course/view.php will do redirection. return; } $cm = $this->get_activity(); $cursection = optional_param('section', null, PARAM_INT); if (!empty($cursection) && has_capability('moodle/course:viewhiddensections', context_course::instance($this->courseid))) { // Display orphaned activities (course view page, section 1). return; } if (!$this->get_activitytype()) { if (has_capability('moodle/course:update', context_course::instance($this->courseid))) { // Teacher is redirected to edit course page. $url = new moodle_url('/course/edit.php', array('id' => $this->courseid)); redirect($url, get_string('erroractivitytype', 'format_singleactivity')); } else { // Student sees an empty course page. return; } } if ($cm === null) { if ($this->can_add_activity()) { // This is a user who has capability to create an activity. if ($this->activity_has_subtypes()) { // Activity has multiple items in the activity chooser, it can not be added automatically. if (optional_param('addactivity', 0, PARAM_INT)) { return; } else { $url = new moodle_url('/course/view.php', array('id' => $this->courseid, 'addactivity' => 1)); redirect($url); } } // Redirect to the add activity form. $url = new moodle_url('/course/mod.php', array('id' => $this->courseid, 'section' => 0, 'sesskey' => sesskey(), 'add' => $this->get_activitytype())); redirect($url); } else { // Student views an empty course page. return; } } else if (!$cm->uservisible || !$cm->url) { // Activity is set but not visible to current user or does not have url. // Display course page (either empty or with availability restriction info). return; } else { // Everything is set up and accessible, redirect to the activity page! redirect($cm->url); } } } /** * Allows course format to execute code on moodle_page::set_cm() * * If we are inside the main module for this course, remove extra node level * from navigation: substitute course node with activity node, move all children * * @param moodle_page $page instance of page calling set_cm */ public function page_set_cm(moodle_page $page) { global $PAGE; parent::page_set_cm($page); if ($PAGE == $page && ($cm = $this->get_activity()) && $cm->uservisible && ($cm->id === $page->cm->id) && ($activitynode = $page->navigation->find($cm->id, navigation_node::TYPE_ACTIVITY)) && ($node = $page->navigation->find($page->course->id, navigation_node::TYPE_COURSE))) { // Substitute course node with activity node, move all children. $node->action = $activitynode->action; $node->type = $activitynode->type; $node->id = $activitynode->id; $node->key = $activitynode->key; $node->isactive = $node->isactive || $activitynode->isactive; $node->icon = null; if ($activitynode->children->count()) { foreach ($activitynode->children as &$child) { $child->remove(); $node->add_node($child); } } else { $node->search_for_active_node(); } $activitynode->remove(); } } /** * Returns true if the course has a front page. * * @return boolean false */ public function has_view_page() { return false; } /** * Return the plugin configs for external functions. * * @return array the list of configuration settings * @since Moodle 3.5 */ public function get_config_for_external() { // Return everything (nothing to hide). return $this->get_format_options(); } } PK:\1W version.phpnu[. /** * Version details * * @package format_singleactivity * @copyright 2012 Marina Glancy * @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 = 'format_singleactivity'; // Full name of the plugin (used for diagnostics) PK:\wȒ**settingslib.phpnu[. /** * Settings class for format_singleactivity * * @package format_singleactivity * @copyright 2013 Marina Glancy * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die; /** * Admin settings class for the format singleactivity activitytype choice * * @package format_singleactivity * @copyright 2013 Marina Glancy * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class format_singleactivity_admin_setting_activitytype extends admin_setting_configselect { /** * This function may be used in ancestors for lazy loading of choices * * Override this method if loading of choices is expensive, such * as when it requires multiple db requests. * * @return bool true if loaded, false if error */ public function load_choices() { global $CFG; require_once($CFG->dirroot. '/course/format/singleactivity/lib.php'); if (is_array($this->choices)) { return true; } $this->choices = format_singleactivity::get_supported_activities(); return true; } } PK:\3֗jclasses/privacy/provider.phpnu[. /** * Privacy Subsystem implementation for format_singleactivity. * * @package format_singleactivity * @copyright 2018 Carlos Escobedo * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ namespace format_singleactivity\privacy; defined('MOODLE_INTERNAL') || die(); /** * Privacy Subsystem for format_singleactivity implementing null_provider. * * @copyright 2018 Carlos Escobedo * @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'; } }PK:\ classes/output/renderer.phpnu[. namespace format_singleactivity\output; use core_courseformat\output\section_renderer; /** * Renderer for outputting the singleactivity course format. * * @package format_singleactivity * @copyright 2013 Marina Glancy * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class renderer extends section_renderer { /** * Displays the activities list in cases when course view page is not * redirected to the activity page. * * @param stdClass $course record from table course * @param bool $orphaned if false displays the main activity (if present) * if true displays all other activities */ public function display($course, $orphaned) { $format = course_get_format($course); $modinfo = $format->get_modinfo(); $cmlistclass = $format->get_output_classname('content\\section\\cmlist'); $output = ''; if ($orphaned) { if (!empty($modinfo->sections[1])) { $output .= $this->output->heading(get_string('orphaned', 'format_singleactivity'), 3, 'sectionname'); $output .= $this->output->box(get_string('orphanedwarning', 'format_singleactivity')); $section = $modinfo->get_section_info(1); $output .= $this->render(new $cmlistclass($format, $section)); } } else { $section = $modinfo->get_section_info(0); $output .= $this->render(new $cmlistclass($format, $section)); if (empty($modinfo->sections[0]) && course_get_format($course)->activity_has_subtypes()) { // Course format was unable to automatically redirect to add module page. $output .= $this->course_section_add_cm_control($course, 0, 0); } } return $output; } } PK:\&h! ! $tests/format_singleactivity_test.phpnu[. namespace format_singleactivity; /** * Single activity course format related unit tests. * * @package format_singleactivity * @copyright 2023 Sara Arjona * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @covers \format_singleactivity */ final class format_singleactivity_test extends \advanced_testcase { /** * Test for get_view_url(). * * @covers ::get_view_url */ public function test_get_view_url(): void { global $CFG; $this->resetAfterTest(); // Generate a course with two sections (0 and 1) and two modules. $generator = $this->getDataGenerator(); $course1 = $generator->create_course(['format' => 'singleactivity']); course_create_sections_if_missing($course1, [0, 1]); $data = (object)['id' => $course1->id]; $format = course_get_format($course1); $format->update_course_format_options($data); // In page. $this->assertNotEmpty($format->get_view_url(null)); $this->assertNotEmpty($format->get_view_url(0)); $this->assertNotEmpty($format->get_view_url(1)); // Navigation. $this->assertStringContainsString('course/view.php', $format->get_view_url(0)); $this->assertStringContainsString('course/view.php', $format->get_view_url(1)); $this->assertStringContainsString('course/view.php', $format->get_view_url(0, ['navigation' => 1])); $this->assertStringContainsString('course/view.php', $format->get_view_url(1, ['navigation' => 1])); $this->assertStringContainsString('course/view.php', $format->get_view_url(0, ['sr' => 1])); $this->assertStringContainsString('course/view.php', $format->get_view_url(1, ['sr' => 1])); $this->assertStringContainsString('course/view.php', $format->get_view_url(0, ['sr' => 0])); $this->assertStringContainsString('course/view.php', $format->get_view_url(1, ['sr' => 0])); } /** * Test get_required_jsfiles(). * * @covers ::get_required_jsfiles */ public function test_get_required_jsfiles(): void { $this->resetAfterTest(); $generator = $this->getDataGenerator(); $course = $generator->create_course(['format' => 'singleactivity']); $format = course_get_format($course); $this->assertEmpty($format->get_required_jsfiles()); } } PK:\f[['tests/behat/activity_navigation.featurenu[@format @format_singleactivity Feature: Activity navigation in a single activity course In order to quickly switch to another activity in a single activity course with multiple (hidden) activities As a teacher I need to use the activity navigation controls in activities Background: Given the following "users" exist: | username | firstname | lastname | email | | teacher1 | Teacher | 1 | teacher1@example.com | | student1 | Student | 1 | student1@example.com | | student2 | Student | 2 | student2@example.com | And the following "courses" exist: | fullname | shortname | format | activitytype | | Course 1 | C1 | singleactivity | forum | And the following "course enrolments" exist: | user | course | role | | student1 | C1 | student | | teacher1 | C1 | editingteacher | And the following "activities" exist: | activity | name | intro | course | idnumber | section | | assign | Assignment 1 | Test assignment description | C1 | assign1 | 0 | | lesson | Lesson 1 | Test lesson description | C1 | lesson1 | 0 | | forum | Forum 1 | Test forum description | C1 | forum1 | 0 | Scenario: Step through hidden activities in the course as a teacher. Given I log in as "teacher1" When I am on "Course 1" course homepage # The first activity (Forum 1) won't have the previous activity link. Then "#prev-activity-link" "css_element" should not exist And I should see "Assignment 1 (hidden)" in the "#next-activity-link" "css_element" And I follow "Assignment 1 (hidden)" And I should see "Forum 1" in the "#prev-activity-link" "css_element" And I should see "Lesson 1 (hidden)" in the "#next-activity-link" "css_element" And I follow "Lesson 1 (hidden)" And I should see "Assignment 1 (hidden)" in the "#prev-activity-link" "css_element" And "#next-activity-link" "css_element" should not exist Scenario: Jump to a hidden activity as a teacher Given I log in as "teacher1" When I am on "Course 1" course homepage Then "Jump to..." "field" should exist # The current activity (Forum 1) will not be listed. And the "Jump to..." select box should not contain "Forum 1" # Check drop down menu contents. And the "Jump to..." select box should contain "Assignment 1 (hidden)" And the "Jump to..." select box should contain "Lesson 1 (hidden)" # Jump to a hidden activity somewhere in the middle. When I select "Assignment 1 (hidden)" from the "Jump to..." singleselect Then I should see "Assignment 1" And I should see "Forum 1" in the "#prev-activity-link" "css_element" And I should see "Lesson 1 (hidden)" in the "#next-activity-link" "css_element" # Jump to the first activity. And I select "Forum 1" from the "Jump to..." singleselect And I should see "Assignment 1 (hidden)" in the "#next-activity-link" "css_element" But "#prev-activity-link" "css_element" should not exist # Jump to the last activity. And I select "Lesson 1 (hidden)" from the "Jump to..." singleselect And I should see "Assignment 1 (hidden)" in the "#prev-activity-link" "css_element" But "#next-activity-link" "css_element" should not exist Scenario: The activity navigation controls are not available as a student. Given I log in as "student1" And I am on "Course 1" course homepage # The first activity won't have the previous activity link. Then "#prev-activity-link" "css_element" should not exist And "#next-activity-link" "css_element" should not exist And "Jump to..." "field" should not exist Scenario: The activity navigation asks for login to guest user Given I log in as "guest" When I am on "Course 1" course homepage Then I should see "Guests cannot access this course. Please log in" Scenario: The activity navigation asks for login to not enrolled user Given I log in as "student2" When I am on "Course 1" course homepage Then I should see "You cannot enrol yourself in this course" Scenario: The single activity course format supports multilang course names Given the "multilang" filter is "on" And the "multilang" filter applies to "content and headings" When I am on the "Course 1" "course editing" page logged in as "teacher1" And I expand all fieldsets And I set the field "Course full name" in the "General" "fieldset" to "KursCourse 1" And I click on "Save and display" "button" Then I should see "Course 1" in the ".page-header-headings" "css_element" And I should not see "KursCourse 1" in the ".page-header-headings" "css_element" PK:\a LL!tests/behat/create_course.featurenu[@format @format_singleactivity Feature: Courses can be created in Single Activity mode In order to create a single activity course As a manager I need to create courses and set default values on them Scenario: Create a course as a custom course creator Given the following "users" exist: | username | firstname | lastname | email | | kevin | Kevin | the | kevin@example.com | And the following "roles" exist: | shortname | name | archetype | | creator | Creator | | And the following "system role assigns" exist: | user | role | contextlevel | | kevin | creator | System | And the following "role capability" exists: | role | creator | | moodle/course:create | allow | | moodle/course:update | allow | | moodle/course:manageactivities | allow | | moodle/course:viewparticipants | allow | | moodle/role:assign | allow | When I log in as "kevin" And I am on site homepage And I press "Add a new course" And I set the following fields to these values: | Course full name | My first course | | Course short name | myfirstcourse | | Format | Single activity | And I press "Update format" Then I should see "Quiz" in the "Type of activity" "field" And I should see "Forum" in the "Type of activity" "field" # Check that not all the activity types are in the dropdown. And I should not see "Text and media" in the "Type of activity" "field" And I should not see "Subsection" in the "Type of activity" "field" And I should not see "Question bank" in the "Type of activity" "field" And I set the field "Type of activity" to "Quiz" And I press "Save and display" And I should see "New Quiz" PK:\ujj&tests/behat/edit_format_course.featurenu[@format @format_singleactivity Feature: Edit format course to Single Activity format In order to set the format course to single activity course As a teacher I need to edit the course settings and see the dropdown type activity Scenario: Edit a format course as a teacher Given the following "users" exist: | username | firstname | lastname | email | | teacher1 | Teacher | 1 | teacher1@example.com | And the following "courses" exist: | fullname | shortname | summary | format | | Course 1 | C1 |

Course summary

| topics | And the following "course enrolments" exist: | user | course | role | | teacher1 | C1 | editingteacher | And I log in as "teacher1" And I am on "Course 1" course homepage When I navigate to "Settings" in current page administration And I set the following fields to these values: | Course full name | My first course | | Course short name | myfirstcourse | | Format | Single activity | And I press "Update format" Then I should see "Forum" in the "Type of activity" "field" # Check that not all the activity types are in the dropdown. And I should not see "Text and media" in the "Type of activity" "field" And I should not see "Subsection" in the "Type of activity" "field" And I press "Save and display" And I should see "New Forum" PK:\J~c format.phpnu[. /** * format.php - course format featuring single activity included from view.php * * if we are not redirected before this point this means we want to * either manage orphaned activities - i.e. display section 1, * or the activity is not setup, does not have url or is not accessible at the * moment * * @package format_singleactivity * @copyright 2012 Marina Glancy * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ $courserenderer = $PAGE->get_renderer('format_singleactivity'); echo $courserenderer->display($course, $section != 0); PK:\xZ   settings.phpnu[. /** * Settings for format_singleactivity * * @package format_singleactivity * @copyright 2012 Marina Glancy * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die; require_once($CFG->dirroot. '/course/format/singleactivity/settingslib.php'); if ($ADMIN->fulltree) { $settings->add(new format_singleactivity_admin_setting_activitytype('format_singleactivity/activitytype', new lang_string('defactivitytype', 'format_singleactivity'), new lang_string('defactivitytypedesc', 'format_singleactivity'), 'forum', null)); } PK:\VoAA styles.cssnu[PK:\nn!{lang/en/format_singleactivity.phpnu[PK:\/ϓZZ:lib.phpnu[PK:\1W cversion.phpnu[PK:\wȒ**gsettingslib.phpnu[PK:\3֗j=oclasses/privacy/provider.phpnu[PK:\ uclasses/output/renderer.phpnu[PK:\&h! ! $tests/format_singleactivity_test.phpnu[PK:\f[[';tests/behat/activity_navigation.featurenu[PK:\a LL!tests/behat/create_course.featurenu[PK:\ujj&tests/behat/edit_format_course.featurenu[PK:\J~c Jformat.phpnu[PK:\xZ   vsettings.phpnu[PK kҷ