ÿØÿà 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-Ї Ç db/log.php000064400000002073152267160740006437 0ustar00. /** * Export to IMSCP booktool log events definition * * @package booktool_exportimscp * @copyright 2012 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); $logs = array( array('module'=>'book', 'action'=>'exportimscp', 'mtable'=>'book', 'field'=>'name') ); db/access.php000064400000002077152267160740007123 0ustar00. /** * Book module capability definition * * @package booktool_exportimscp * @copyright 2011 Petr Skoda {@link http://skodak.org} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die; $capabilities = array( 'booktool/exportimscp:export' => array( 'captype' => 'read', 'contextlevel' => CONTEXT_MODULE ), ); lang/en/booktool_exportimscp.php000064400000002465152267160740013106 0ustar00. /** * exportimscp booktool language strings * * @package booktool_exportimscp * @copyright 2011 Petr Skoda {@link http://skodak.org} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die; $string['eventbookexported'] = 'Book exported'; $string['exportimscp:export'] = 'Export book as IMS content package'; $string['generateimscp'] = 'Download IMS CP'; $string['nochapters'] = 'No book chapters found, so unable to export to IMS CP.'; $string['pluginname'] = 'Book IMS CP export'; $string['privacy:metadata'] = 'The Book IMS CP export plugin does not store any personal data.'; pix/generate.png000064400000001460152267160740007657 0ustar00PNG  IHDRשqPLTE   ## $$ %% && '' ))**++--//11227799::==??@@BBCCDDEEGGLLMMOOPPQQSSTTVVWWZZ]] ``!aa#cc&ff'gg+jj,kk-ll.mm/nn0oo1pp3qq4rr5ss6tt8vv:xx;yy=zz>{{?||A}}B~~CGILPRUVX[adfgiknqsuwxz~ âĦǬˮ̰ιӽֿQq tRNS@fmIDATxcP@]׶L\ڣ6ӱm]{ޯYpQ1|vrq ?}H9GgU8Ӛۨ[,_ ըLWbfsimGŠbyyg^ggNrE"g2KV/l-%_C:#RR>gC8c,cdh,곮IG`6c_Nζdf.uqحn}&>=/lf:S ¥#-XnWںn0]㉀{z9BIZո97NMR GHeF^2 ʈS 8". /** * IMSCP export lib * * @package booktool_exportimscp * @copyright 2011 Petr Skoda {@link http://skodak.org} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die; /** * Adds module specific settings to the settings block * * @param settings_navigation $settings The settings navigation object * @param navigation_node $node The node to add module settings to */ function booktool_exportimscp_extend_settings_navigation(settings_navigation $settings, navigation_node $node) { if (has_capability('booktool/exportimscp:export', $settings->get_page()->cm->context)) { $url = new moodle_url('/mod/book/tool/exportimscp/index.php', array('id' => $settings->get_page()->cm->id)); $icon = new pix_icon('generate', '', 'booktool_exportimscp', array('class'=>'icon')); $umscpnode = $node->add(get_string('generateimscp', 'booktool_exportimscp'), $url, navigation_node::TYPE_SETTING, null, null, $icon); $umscpnode->set_force_into_more_menu(true); } } version.php000064400000002244152267160740006756 0ustar00. /** * Book IMSCP export plugin version info * * @package booktool_exportimscp * @copyright 2011 Petr Skoda {@link http://skodak.org} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die; $plugin->component = 'booktool_exportimscp'; // Full name of the plugin (used for diagnostics) $plugin->version = 2025041400; // The current plugin version (Date: YYYYMMDDXX). $plugin->requires = 2025040800; // Requires this Moodle version. classes/privacy/provider.php000064400000003010152267160740012225 0ustar00. /** * Privacy provider implementation for booktool_exportimscp. * * @package booktool_exportimscp * @copyright 2018 Mihail Geshoski * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ namespace booktool_exportimscp\privacy; defined('MOODLE_INTERNAL') || die(); /** * Privacy provider implementation for booktool_exportimscp. * * @copyright 2018 Mihail Geshoski * @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'; } } classes/event/book_exported.php000064400000005437152267160740012722 0ustar00. /** * booktool_exportimscp book exported event. * * @package booktool_exportimscp * @copyright 2013 Frédéric Massart * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ namespace booktool_exportimscp\event; defined('MOODLE_INTERNAL') || die(); /** * booktool_exportimscp book exported event class. * * @package booktool_exportimscp * @since Moodle 2.6 * @copyright 2013 Frédéric Massart * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class book_exported extends \core\event\base { /** * Create instance of event. * * @since Moodle 2.7 * * @param \stdClass $book * @param \context_module $context * @return book_exported */ public static function create_from_book(\stdClass $book, \context_module $context) { $data = array( 'context' => $context, 'objectid' => $book->id ); /** @var book_exported $event */ $event = self::create($data); $event->add_record_snapshot('book', $book); return $event; } /** * Returns description of what happened. * * @return string */ public function get_description() { return "The user with id '$this->userid' has exported the book with course module id '$this->contextinstanceid'."; } /** * Return localised event name. * * @return string */ public static function get_name() { return get_string('eventbookexported', 'booktool_exportimscp'); } /** * Get URL related to the action. * * @return \moodle_url */ public function get_url() { return new \moodle_url('/mod/book/tool/exportimscp/index.php', array('id' => $this->contextinstanceid)); } /** * Init method. * * @return void */ protected function init() { $this->data['crud'] = 'r'; $this->data['edulevel'] = self::LEVEL_OTHER; $this->data['objecttable'] = 'book'; } public static function get_objectid_mapping() { return array('db' => 'book', 'restore' => 'book'); } } locallib.php000064400000027600152267160740007055 0ustar00. /** * Book imscp export lib * * @package booktool_exportimscp * @copyright 2001-3001 Antonio Vicent {@link http://ludens.es} * @copyright 2001-3001 Eloy Lafuente (stronk7) {@link http://stronk7.com} * @copyright 2011 Petr Skoda {@link http://skodak.org} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die; require_once(__DIR__.'/lib.php'); require_once($CFG->dirroot.'/mod/book/locallib.php'); /** * Export one book as IMSCP package * * @param stdClass $book book instance * @param context_module $context * @return bool|stored_file */ function booktool_exportimscp_build_package($book, $context) { global $DB; $fs = get_file_storage(); if ($packagefile = $fs->get_file($context->id, 'booktool_exportimscp', 'package', $book->revision, '/', 'imscp.zip')) { return $packagefile; } // fix structure and test if chapters present if (!book_preload_chapters($book)) { throw new \moodle_exception('nochapters', 'booktool_exportimscp'); } // prepare temp area with package contents booktool_exportimscp_prepare_files($book, $context); $packer = get_file_packer('application/zip'); $areafiles = $fs->get_area_files($context->id, 'booktool_exportimscp', 'temp', $book->revision, "sortorder, itemid, filepath, filename", false); $files = array(); foreach ($areafiles as $file) { $path = $file->get_filepath().$file->get_filename(); $path = ltrim($path, '/'); $files[$path] = $file; } unset($areafiles); $packagefile = $packer->archive_to_storage($files, $context->id, 'booktool_exportimscp', 'package', $book->revision, '/', 'imscp.zip'); // drop temp area $fs->delete_area_files($context->id, 'booktool_exportimscp', 'temp', $book->revision); // delete older versions $sql = "SELECT DISTINCT itemid FROM {files} WHERE contextid = :contextid AND component = 'booktool_exportimscp' AND itemid < :revision"; $params = array('contextid'=>$context->id, 'revision'=>$book->revision); $revisions = $DB->get_records_sql($sql, $params); foreach ($revisions as $rev => $unused) { $fs->delete_area_files($context->id, 'booktool_exportimscp', 'temp', $rev); $fs->delete_area_files($context->id, 'booktool_exportimscp', 'package', $rev); } return $packagefile; } /** * Prepare temp area with the files used by book html contents * * @param stdClass $book book instance * @param context_module $context */ function booktool_exportimscp_prepare_files($book, $context) { global $CFG, $DB; $fs = get_file_storage(); $temp_file_record = array('contextid'=>$context->id, 'component'=>'booktool_exportimscp', 'filearea'=>'temp', 'itemid'=>$book->revision); $chapters = $DB->get_records('book_chapters', array('bookid'=>$book->id), 'pagenum'); $chapterresources = array(); foreach ($chapters as $chapter) { $chapterresources[$chapter->id] = array(); $files = $fs->get_area_files($context->id, 'mod_book', 'chapter', $chapter->id, "sortorder, itemid, filepath, filename", false); foreach ($files as $file) { $temp_file_record['filepath'] = '/'.$chapter->pagenum.$file->get_filepath(); $fs->create_file_from_storedfile($temp_file_record, $file); $chapterresources[$chapter->id][] = $chapter->pagenum.$file->get_filepath().$file->get_filename(); } if ($file = $fs->get_file($context->id, 'booktool_exportimscp', 'temp', $book->revision, "/$chapter->pagenum/", 'index.html')) { // this should not exist $file->delete(); } $content = booktool_exportimscp_chapter_content($chapter, $context); $index_file_record = array('contextid'=>$context->id, 'component'=>'booktool_exportimscp', 'filearea'=>'temp', 'itemid'=>$book->revision, 'filepath'=>"/$chapter->pagenum/", 'filename'=>'index.html'); $fs->create_file_from_string($index_file_record, $content); } $css_file_record = array('contextid'=>$context->id, 'component'=>'booktool_exportimscp', 'filearea'=>'temp', 'itemid'=>$book->revision, 'filepath'=>"/css/", 'filename'=>'styles.css'); $fs->create_file_from_pathname($css_file_record, __DIR__.'/imscp.css'); // Init imsmanifest and others $imsmanifest = ''; $imsitems = ''; $imsresources = ''; // Moodle and Book version $moodle_release = $CFG->release; $moodle_version = $CFG->version; $book_version = get_config('mod_book', 'version'); $bookname = format_string($book->name, true, array('context'=>$context)); // Load manifest header $imsmanifest .= ' ' . htmlspecialchars($bookname, ENT_COMPAT) . ''; // To store the prev level (book only have 0 and 1) $prevlevel = null; $currlevel = 0; foreach ($chapters as $chapter) { // Calculate current level ((book only have 0 and 1) $currlevel = empty($chapter->subchapter) ? 0 : 1; // Based upon prevlevel and current one, decide what to close if ($prevlevel !== null) { // Calculate the number of spaces (for visual xml-text formating) $prevspaces = substr(' ', 0, $currlevel * 2); // Same level, simply close the item if ($prevlevel == $currlevel) { $imsitems .= $prevspaces . ' ' . "\n"; } // Bigger currlevel, nothing to close // Smaller currlevel, close both the current item and the parent one if ($prevlevel > $currlevel) { $imsitems .= ' ' . "\n"; $imsitems .= ' ' . "\n"; } } // Update prevlevel $prevlevel = $currlevel; // Calculate the number of spaces (for visual xml-text formatting) $currspaces = substr(' ', 0, $currlevel * 2); $chaptertitle = format_string($chapter->title, true, array('context'=>$context)); // Add the imsitems $imsitems .= $currspaces .' \n" . $currspaces . ' ' . htmlspecialchars($chaptertitle, ENT_COMPAT) . '' . "\n"; // Add the imsresources // First, check if we have localfiles $localfiles = array(); foreach ($chapterresources[$chapter->id] as $localfile) { $localfiles[] = "\n" . ' '; } // Now add the dependency to css $cssdependency = "\n" . ' '; // Now build the resources section $imsresources .= ' ' . "\n" . ' ' . implode($localfiles) . $cssdependency . "\n". ' ' . "\n"; } // Close items (the latest chapter) // Level 1, close 1 if ($currlevel == 0) { $imsitems .= ' ' . "\n"; } // Level 2, close 2 if ($currlevel == 1) { $imsitems .= ' ' . "\n"; $imsitems .= ' ' . "\n"; } // Define the css common resource $cssresource = ' ' . "\n"; // Add imsitems to manifest $imsmanifest .= "\n" . $imsitems; // Close the organization $imsmanifest .= " "; // Add resources to manifest $imsmanifest .= "\n \n" . $imsresources . $cssresource . " "; // Close manifest $imsmanifest .= "\n\n"; $manifest_file_record = array('contextid'=>$context->id, 'component'=>'booktool_exportimscp', 'filearea'=>'temp', 'itemid'=>$book->revision, 'filepath'=>"/", 'filename'=>'imsmanifest.xml'); $fs->create_file_from_string($manifest_file_record, $imsmanifest); } /** * Returns the html contents of one book's chapter to be exported as IMSCP * * @param stdClass $chapter the chapter to be exported * @param context_module $context context the chapter belongs to * @return string the contents of the chapter */ function booktool_exportimscp_chapter_content($chapter, $context) { $options = new stdClass(); $options->noclean = true; $options->context = $context; // We need to rewrite the pluginfile URLs so the media filters can work. $chaptercontent = file_rewrite_pluginfile_urls($chapter->content, 'pluginfile.php', $context->id, 'mod_book', 'chapter', $chapter->id); $chaptercontent = format_text($chaptercontent, $chapter->contentformat, $options); // Now remove again the full pluginfile URLs. $options = array('reverse' => true); $chaptercontent = file_rewrite_pluginfile_urls($chaptercontent, 'pluginfile.php', $context->id, 'mod_book', 'chapter', $chapter->id, $options); $chaptercontent = str_replace('@@PLUGINFILE@@/', '', $chaptercontent); $chaptertitle = format_string($chapter->title, true, array('context'=>$context)); $content = ''; $content .= '' . "\n"; $content .= '' . "\n"; $content .= '' . "\n"; $content .= '' . "\n"; $content .= '' . "\n"; $content .= '' . $chaptertitle . '' . "\n"; $content .= '' . "\n"; $content .= '' . "\n"; $content .= '

' . $chaptertitle . '

' ."\n"; $content .= $chaptercontent . "\n"; $content .= '' . "\n"; $content .= '' . "\n"; return $content; } index.php000064400000004006152267160740006376 0ustar00. /** * Book IMSCP export plugin * * @package booktool_exportimscp * @copyright 2001-3001 Antonio Vicent {@link http://ludens.es} * @copyright 2001-3001 Eloy Lafuente (stronk7) {@link http://stronk7.com} * @copyright 2011 Petr Skoda {@link http://skodak.org} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require(__DIR__.'/../../../../config.php'); require_once(__DIR__.'/locallib.php'); require_once($CFG->dirroot.'/mod/book/locallib.php'); require_once($CFG->libdir.'/filelib.php'); $id = required_param('id', PARAM_INT); // Course Module ID $cm = get_coursemodule_from_id('book', $id, 0, false, MUST_EXIST); $course = $DB->get_record('course', array('id'=>$cm->course), '*', MUST_EXIST); $book = $DB->get_record('book', array('id'=>$cm->instance), '*', MUST_EXIST); $PAGE->set_url('/mod/book/tool/exportimscp/index.php', array('id'=>$id)); require_login($course, false, $cm); $context = context_module::instance($cm->id); require_capability('mod/book:read', $context); require_capability('booktool/exportimscp:export', $context); \booktool_exportimscp\event\book_exported::create_from_book($book, $context)->trigger(); $file = booktool_exportimscp_build_package($book, $context); send_stored_file($file, 10, 0, true, array('filename' => clean_filename($book->name).'.zip')); tests/event/events_test.php000064400000004466152267160740012127 0ustar00. /** * Events tests. * * @package booktool_exportimscp * @category phpunit * @copyright 2013 Frédéric Massart * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ namespace booktool_exportimscp\event; /** * Events tests class. * * @package booktool_exportimscp * @category phpunit * @copyright 2013 Frédéric Massart * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ final class events_test extends \advanced_testcase { public function setUp(): void { parent::setUp(); $this->resetAfterTest(); } public function test_book_exported(): void { // There is no proper API to call to test the event, so what we are // doing here is simply making sure that the events returns the right information. $course = $this->getDataGenerator()->create_course(); $book = $this->getDataGenerator()->create_module('book', array('course' => $course->id)); $context = \context_module::instance($book->cmid); $event = \booktool_exportimscp\event\book_exported::create_from_book($book, $context); // Triggering and capturing the event. $sink = $this->redirectEvents(); $event->trigger(); $events = $sink->get_events(); $this->assertCount(1, $events); $event = reset($events); // Checking that the event contains the expected values. $this->assertInstanceOf('\booktool_exportimscp\event\book_exported', $event); $this->assertEquals(\context_module::instance($book->cmid), $event->get_context()); $this->assertEquals($book->id, $event->objectid); } } imscp.css000064400000000742152267160740006406 0ustar00body, table, td, th, li, p { font-family: Arial, Verdana, Helvetica, sans-serif; font-size: 1em; line-height: 150%; letter-spacing: 0.02em; } th { font-weight: bold; } a:link, a:visited { text-decoration: none; } a:hover { text-decoration: underline; } h1.main, h2.main, h3.main, h4.main, h5.main, h6.main { font-weight: bold; } h1#header { color: #666; text-align: right; padding-bottom: 0.2em; border-bottom: solid 1px #666; }