ÿØÿà 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\E\>%% dictionary/dictionary_format.phpnu['; echo ''; echo ''; glossary_print_entry_approval($cm, $entry, $mode); echo '
'; glossary_print_entry_concept($entry); echo '
'; glossary_print_entry_definition($entry, $glossary, $cm); glossary_print_entry_attachment($entry, $cm, 'html'); if (core_tag_tag::is_enabled('mod_glossary', 'glossary_entries')) { echo $OUTPUT->tag_list(core_tag_tag::get_item_tags('mod_glossary', 'glossary_entries', $entry->id), null, 'glossary-tags'); } echo ''; echo ''; glossary_print_entry_lower_section($course, $cm, $glossary, $entry, $mode, $hook, $printicons, $aliases); echo ''; echo ''; echo "\n"; } function glossary_print_entry_dictionary($course, $cm, $glossary, $entry, $mode='', $hook='', $printicons=1) { //The print view for this format is exactly the normal view, so we use it //Take out autolinking in definitions in print view $entry->definition = ''.$entry->definition.''; //Call to view function (without icons, ratings and aliases) and return its result return glossary_show_entry_dictionary($course, $cm, $glossary, $entry, $mode, $hook, false, false, false); } PK\t)TEMPLATE/TEMPLATE_format.phpnu[get_record('user', array('id'=>$entry->userid)); $strby = get_string('writtenby', 'glossary'); if ($entry) { echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo "
'; //Use this function to show author's image //Comments: Configuration not supported echo $OUTPUT->user_picture($user, array('courseid'=>$course->id)); //Line separator to show this template fine. :-) echo '
'; //Use this code to show author's name //Comments: Configuration not supported $fullname = fullname($user); $by = new stdClass(); $by->name = ''.$fullname.''; $by->date = userdate($entry->timemodified); echo ''.get_string('bynameondate', 'forum', $by).'' . '
'; //Use this code to show modification date //Comments: Configuration not supported echo get_string('lastedited').': '. userdate($entry->timemodified) . '
'; //Use this function to show the approval button. It'll be shown if necessary //Comments: You can configure this parameters: //----Define where to show the approval button $approvalalign = 'right'; //Values: left, center and right (default right) //----Define if the approval button must be showed into a 100% width table $approvalinsidetable = true; //Values: true, false (default true) //Call the function glossary_print_entry_approval($cm, $entry, $mode, $approvalalign, $approvalinsidetable); //Line separator to show this template fine. :-) echo '
'; echo '
'; //Line separator to show this template fine. :-) echo "
\n"; echo '
'; //Use this function to print the concept in a heading

//Comments: Configuration not supported glossary_print_entry_concept($entry); //Line separator not normally needed now. //echo "
\n"; //Use this function to show the definition //Comments: Configuration not supported glossary_print_entry_definition($entry, $glossary, $cm); // Use this function to show the attachment. It'll be shown if necessary. glossary_print_entry_attachment($entry, $cm, 'html'); //Line separator to show this template fine. :-) echo "
\n"; //Use this function to show aliases, editing icons and ratings (all know as the 'lower section') //Comments: You can configure this parameters: //----Define when to show the aliases popup // use it only if you are really sure! //$aliases = true; //Values: true, false (Default: true) //----Uncoment this line to avoid editing icons being showed // use it only if you are really sure! //$printicons = false; glossary_print_entry_lower_section($course, $cm, $glossary, $entry, $mode, $hook, $printicons, $aliases); echo '

\n"; } else { echo '
'; print_string('noentry', 'glossary'); echo '
'; } } function glossary_print_entry_TEMPLATE($course, $cm, $glossary, $entry, $mode='', $hook='', $printicons=1) { //The print view for this format is exactly the normal view, so we use it //Anyway, you can modify this to use your own print format!! //Take out autolinking in definitions in print view $entry->definition = ''.$entry->definition.''; //Call to view function (without icons, ratings and aliases) and return its result return glossary_show_entry_TEMPLATE($course, $cm, $glossary, $entry, $mode, $hook, false, false, false); } PK\](.fullwithoutauthor/fullwithoutauthor_format.phpnu['; echo ''; echo ''; echo '
'; glossary_print_entry_concept($entry); echo '
'; echo '('.get_string('lastedited').': '. userdate($entry->timemodified).')'; echo ''; echo ''; glossary_print_entry_approval($cm, $entry, $mode); echo ''; echo ''; echo ''; echo ''; glossary_print_entry_definition($entry, $glossary, $cm); glossary_print_entry_attachment($entry, $cm, 'html'); if (core_tag_tag::is_enabled('mod_glossary', 'glossary_entries')) { echo $OUTPUT->tag_list( core_tag_tag::get_item_tags('mod_glossary', 'glossary_entries', $entry->id), null, 'glossary-tags'); } echo ''; echo ''; glossary_print_entry_lower_section($course, $cm, $glossary, $entry, $mode, $hook, $printicons, $aliases); echo ' '; echo ''; echo "\n"; } else { echo '
'; print_string('noentry', 'glossary'); echo '
'; } } function glossary_print_entry_fullwithoutauthor($course, $cm, $glossary, $entry, $mode="", $hook="", $printicons=1) { //The print view for this format is exactly the normal view, so we use it //Take out autolinking in definitions un print view $entry->definition = ''.$entry->definition.''; //Call to view function (without icons, ratings and aliases) and return its result return glossary_show_entry_fullwithoutauthor($course, $cm, $glossary, $entry, $mode, $hook, false, false, false); } PK\lS S entrylist/entrylist_format.phpnu['; echo ''; echo ''; if ($entry) { glossary_print_entry_approval($cm, $entry, $mode); $anchortagcontents = glossary_print_entry_concept($entry, true); $link = new moodle_url('/mod/glossary/showentry.php', array('courseid' => $course->id, 'eid' => $entry->id, 'displayformat' => 'dictionary')); $anchor = html_writer::link($link, $anchortagcontents); echo "
$anchor
"; echo ''; if ($printicons) { glossary_print_entry_icons($course, $cm, $glossary, $entry, $mode, $hook,'print'); } if (!empty($entry->rating)) { echo '
'; echo ''; $return = glossary_print_entry_ratings($course, $entry); echo ''; } echo '
'; } else { echo '
'; print_string('noentry', 'glossary'); echo '
'; } echo ''; echo ""; echo "
\n"; return $return; } function glossary_print_entry_entrylist($course, $cm, $glossary, $entry, $mode='', $hook='', $printicons=1) { //Take out autolinking in definitions un print view // TODO use tags MDL-15555. $entry->definition = ''.$entry->definition.''; echo html_writer::start_tag('table', array('class' => 'glossarypost entrylist mod-glossary-entrylist')); echo html_writer::start_tag('tr'); echo html_writer::start_tag('td', array('class' => 'entry mod-glossary-entry')); echo html_writer::start_tag('div', array('class' => 'mod-glossary-concept')); glossary_print_entry_concept($entry); echo html_writer::end_tag('div'); echo html_writer::start_tag('div', array('class' => 'mod-glossary-definition')); glossary_print_entry_definition($entry, $glossary, $cm); echo html_writer::end_tag('div'); echo html_writer::start_tag('div', array('class' => 'mod-glossary-lower-section')); glossary_print_entry_lower_section($course, $cm, $glossary, $entry, $mode, $hook, false, false); echo html_writer::end_tag('div'); echo html_writer::end_tag('td'); echo html_writer::end_tag('tr'); echo html_writer::end_tag('table'); } PK\ $encyclopedia/encyclopedia_format.phpnu[get_record('user', array('id'=>$entry->userid)); $strby = get_string('writtenby', 'glossary'); if ($entry) { echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo "
'; echo $OUTPUT->user_picture($user, array('courseid'=>$course->id)); echo ''; echo '
'; glossary_print_entry_concept($entry); echo '
'; $fullname = fullname($user); $by = new stdClass(); $by->name = ''.$fullname.''; $by->date = userdate($entry->timemodified); echo ''.get_string('bynameondate', 'forum', $by).''; echo '
'; glossary_print_entry_approval($cm, $entry, $mode); echo '
 '; glossary_print_entry_definition($entry, $glossary, $cm); glossary_print_entry_attachment($entry, $cm, null); if (core_tag_tag::is_enabled('mod_glossary', 'glossary_entries')) { echo $OUTPUT->tag_list( core_tag_tag::get_item_tags('mod_glossary', 'glossary_entries', $entry->id), null, 'glossary-tags'); } if ($printicons or $aliases) { echo '
'; glossary_print_entry_lower_section($course, $cm, $glossary, $entry,$mode,$hook,$printicons,$aliases); echo ' '; } echo '
\n"; } else { echo '
'; print_string('noentry', 'glossary'); echo '
'; } } function glossary_print_entry_encyclopedia($course, $cm, $glossary, $entry, $mode='', $hook='', $printicons=1) { //The print view for this format is exactly the normal view, so we use it //Take out autolinking in definitions un print view $entry->definition = ''.$entry->definition.''; //Call to view function (without icons, ratings and aliases) and return its result return glossary_show_entry_encyclopedia($course, $cm, $glossary, $entry, $mode, $hook, false, false); } PK\2aHH continuous/continuous_format.phpnu['; echo ''; echo ''; glossary_print_entry_approval($cm, $entry, $mode); echo '
'; glossary_print_entry_concept($entry); echo '
'; glossary_print_entry_definition($entry, $glossary, $cm); glossary_print_entry_attachment($entry, $cm, 'html'); if (core_tag_tag::is_enabled('mod_glossary', 'glossary_entries')) { echo $OUTPUT->tag_list(core_tag_tag::get_item_tags( 'mod_glossary', 'glossary_entries', $entry->id), null, 'glossary-tags'); } $entry->alias = ''; echo ''; echo ''; glossary_print_entry_lower_section($course, $cm, $glossary, $entry, $mode, $hook, $printicons, $aliases, false); echo ''; echo ''; echo "\n"; } function glossary_print_entry_continuous($course, $cm, $glossary, $entry, $mode='', $hook='', $printicons=1) { //The print view for this format is exactly the normal view, so we use it //Take out autolinking in definitions un print view $entry->definition = ''.$entry->definition.''; //Call to view function (without icons, ratings and aliases) and return its result glossary_show_entry_continuous($course, $cm, $glossary, $entry, $mode, $hook, false, false, false); } PK\bfaq/faq_format.phpnu['; echo ''; echo ''; $entry->course = $course->id; echo '
' . get_string('question','glossary') . ': '; glossary_print_entry_concept($entry); echo '
'; echo '('.get_string('lastedited').': '. userdate($entry->timemodified).')'; echo ''; echo ''; glossary_print_entry_approval($cm, $entry, $mode); echo ''; echo ''; echo "\n"; echo ''; echo ''.get_string('answer','glossary').': '; glossary_print_entry_definition($entry, $glossary, $cm); glossary_print_entry_attachment($entry, $cm, 'html'); if (core_tag_tag::is_enabled('mod_glossary', 'glossary_entries')) { echo $OUTPUT->tag_list( core_tag_tag::get_item_tags('mod_glossary', 'glossary_entries', $entry->id), null, 'glossary-tags'); } echo ''; echo ''; glossary_print_entry_lower_section($course, $cm, $glossary, $entry, $mode, $hook, $printicons, $aliases); echo ''; } else { echo '
'; print_string('noentry', 'glossary'); echo '
'; } } function glossary_print_entry_faq($course, $cm, $glossary, $entry, $mode='', $hook='', $printicons=1) { //The print view for this format is exactly the normal view, so we use it //Take out autolinking in definitions un print view $entry->definition = ''.$entry->definition.''; //Call to view function (without icons, ratings and aliases) and return its result return glossary_show_entry_faq($course, $cm, $glossary, $entry, $mode, $hook, false, false, false); } PK\e8 (fullwithauthor/fullwithauthor_format.phpnu[get_record('user', array('id'=>$entry->userid)); $strby = get_string('writtenby', 'glossary'); if ($entry) { echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo "
'; echo $OUTPUT->user_picture($user, array('courseid'=>$course->id)); echo ''; echo '
'; glossary_print_entry_concept($entry); echo '
'; $fullname = fullname($user); $by = new stdClass(); $by->name = ''.$fullname.''; $by->date = userdate($entry->timemodified); echo ''.get_string('bynameondate', 'forum', $by).''; echo '
'; glossary_print_entry_approval($cm, $entry, $mode); echo '
 '; glossary_print_entry_definition($entry, $glossary, $cm); glossary_print_entry_attachment($entry, $cm, 'html'); if (core_tag_tag::is_enabled('mod_glossary', 'glossary_entries')) { echo $OUTPUT->tag_list( core_tag_tag::get_item_tags('mod_glossary', 'glossary_entries', $entry->id), null, 'glossary-tags'); } echo '
 '; glossary_print_entry_lower_section($course, $cm, $glossary, $entry, $mode, $hook, $printicons, $aliases); echo ' '; echo '
\n"; } else { echo '
'; print_string('noentry', 'glossary'); echo '
'; } } function glossary_print_entry_fullwithauthor($course, $cm, $glossary, $entry, $mode="", $hook="", $printicons=1) { //The print view for this format is exactly the normal view, so we use it //Take out autolinking in definitions un print view $entry->definition = ''.$entry->definition.''; //Call to view function (without icons, ratings and aliases) and return its result return glossary_show_entry_fullwithauthor($course, $cm, $glossary, $entry, $mode, $hook, false, false, false); } PK\[>> README.txtnu[GLOSSARY FORMAT PLUGINS ----------------------- Starting with Moodle 1.4, the glossary module supports a plugin architecture to create your own formats. This plugin system allows you to "invent" your own presentations for your glossary data. :-) To facilitate the creation process a TEMPLATE format has been created. You should use it as the base for your own modifications (this requires some basic PHP skills). The template includes all the available data. Please, follow these STEPS: 1.-Think of an English word (or short phrase) to define your format. For further reference in this document, we call it "THENAME". 2.-Duplicate the TEMPLATE directory (under mod/glossary/formats/TEMPLATE). 3.-Rename it to THENAME 4.-Go into the THENAME directory and rename the TEMPLATE_format.php file to THENAME_format.php 5.-Edit the THENAME_format.php file. Change every ocurrence of TEMPLATE to THENAME. 6.-Login into Moodle. Go to any glossary in your site. 7.-Edit (configure) your glossary. In the Format popup you'll see a new entry. It will be showed as "displayformatTHENAME". Select it and view your glossary. 8.-Edit the THENAME_format.php. Make your format modifications and reload your web page to see them in your glossary. This file has been commented to make things easier to understand (further suggestions welcome!) 9.-If you want to translate your THENAME format name to some nice name to be showed in the Format popup, simply, edit your lang/XX/glossary.php file (where XX is your language) and create a new displayformatTHENAME string. 10.-Enjoy!! (and don't forget to send your amazing glossary formats to the Glossary forum on http://moodle.org. They will be welcome!! ;-) To talk about Glossary formats, go to: http://moodle.org/mod/forum/view.php?id=742 Eloy (stronk7) 08/02/2004 (MM/DD/YYYY) :-D PKf\"+'SSleap2a/lib.phpnu[. /** * This file contains the LEAP2a writer used by portfolio_format_leap2a * * @package core_portfolio * @copyright 2009 Penny Leach (penny@liip.ch), Martin Dougiamas * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * */ defined('MOODLE_INTERNAL') || die(); /** * Object to encapsulate the writing of leap2a. * * Should be used like: * $writer = portfolio_format_leap2a::leap2a_writer($USER); * $entry = new portfolio_format_leap2a_entry('forumpost6', $title, 'leap2', 'somecontent') * $entry->add_link('something', 'has_part')->add_link('somethingelse', 'has_part'); * .. etc * $writer->add_entry($entry); * $xmlstr = $writer->to_xml(); * * @todo MDL-31287 - find a way to ensure that all referenced files are included * @package core_portfolio * @category portfolio * @copyright 2009 Penny Leach * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class portfolio_format_leap2a_writer { /** @var DomDocument the domdocument object used to create elements */ private $dom; /** @var DOMElement the top level feed element */ private $feed; /** @var stdClass the user exporting data */ private $user; /** @var array the entries for the feed - keyed on id */ private $entries = array(); /** * Constructor - usually generated from portfolio_format_leap2a::leap2a_writer($USER); * * @todo MDL-31302 - add exporter and format * @param stdclass $user the user exporting (almost always $USER) */ public function __construct(stdclass $user) { // todo something else - exporter, format, etc global $CFG; $this->user = $user; $id = $CFG->wwwroot . '/portfolio/export/leap2a/' . $this->user->id . '/' . time(); $this->dom = new DomDocument('1.0', 'utf-8'); $this->feed = $this->dom->createElement('feed'); $this->feed->setAttribute('xmlns', 'http://www.w3.org/2005/Atom'); $this->feed->setAttribute('xmlns:rdf', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'); $this->feed->setAttribute('xmlns:leap2', 'http://terms.leapspecs.org/'); $this->feed->setAttribute('xmlns:categories', 'http://wiki.leapspecs.org/2A/categories'); $this->feed->setAttribute('xmlns:portfolio', $id); // This is just a ns for ids of elements for convenience. $this->dom->appendChild($this->feed); $this->feed->appendChild($this->dom->createElement('id', $id)); $this->feed->appendChild($this->dom->createElement('title', get_string('leap2a_feedtitle', 'portfolio', fullname($this->user)))); $this->feed->appendChild($this->dom->createElement('leap2:version', 'http://www.leapspecs.org/2010-07/2A/')); $generator = $this->dom->createElement('generator', 'Moodle'); $generator->setAttribute('uri', $CFG->wwwroot); $generator->setAttribute('version', $CFG->version); $this->feed->appendChild($generator); $author = $this->dom->createElement('author'); $author->appendChild($this->dom->createElement('name', fullname($this->user))); $author->appendChild($this->dom->createElement('email', $this->user->email)); $author->appendChild($this->dom->CreateElement('uri', $CFG->wwwroot . '/user/view.php?id=' . $this->user->id)); $this->feed->appendChild($author); // header done, we can start appending entry elements now } /** * Adds a entry to the feed ready to be exported * * @param portfolio_format_leap2a_entry $entry new feed entry to add * @return portfolio_format_leap2a_entry */ public function add_entry(portfolio_format_leap2a_entry $entry) { if (array_key_exists($entry->id, $this->entries)) { if (!($entry instanceof portfolio_format_leap2a_file)) { throw new portfolio_format_leap2a_exception('leap2a_entryalreadyexists', 'portfolio', '', $entry->id); } } $this->entries[$entry->id] = $entry; return $entry; } /** * Select an entry that has previously been added into the feed * * @param portfolio_format_leap2a_entry|string $selectionentry the entry to make a selection (id or entry object) * @param array $ids array of ids this selection includes * @param string $selectiontype for selection type, see: http://wiki.cetis.ac.uk/2009-03/LEAP2A_categories/selection_type */ public function make_selection($selectionentry, $ids, $selectiontype) { $selectionid = null; if ($selectionentry instanceof portfolio_format_leap2a_entry) { $selectionid = $selectionentry->id; } else if (is_string($selectionentry)) { $selectionid = $selectionentry; } if (!array_key_exists($selectionid, $this->entries)) { throw new portfolio_format_leap2a_exception('leap2a_invalidentryid', 'portfolio', '', $selectionid); } foreach ($ids as $entryid) { if (!array_key_exists($entryid, $this->entries)) { throw new portfolio_format_leap2a_exception('leap2a_invalidentryid', 'portfolio', '', $entryid); } $this->entries[$selectionid]->add_link($entryid, 'has_part'); $this->entries[$entryid]->add_link($selectionid, 'is_part_of'); } $this->entries[$selectionid]->add_category($selectiontype, 'selection_type'); if ($this->entries[$selectionid]->type != 'selection') { debugging(get_string('leap2a_overwritingselection', 'portfolio', $this->entries[$selectionid]->type)); $this->entries[$selectionid]->type = 'selection'; } } /** * Helper function to link some stored_files into the feed and link them to a particular entry * * @param portfolio_format_leap2a_entry $entry feed object * @param array $files array of stored_files to link */ public function link_files($entry, $files) { foreach ($files as $file) { $fileentry = new portfolio_format_leap2a_file($file->get_filename(), $file); $this->add_entry($fileentry); $entry->add_link($fileentry, 'related'); $fileentry->add_link($entry, 'related'); } } /** * Validate the feed and all entries */ private function validate() { foreach ($this->entries as $entry) { // first call the entry's own validation method // which will throw an exception if there's anything wrong $entry->validate(); // now make sure that all links are in place foreach ($entry->links as $linkedid => $rel) { // the linked to entry exists if (!array_key_exists($linkedid, $this->entries)) { $a = (object)array('rel' => $rel->type, 'to' => $linkedid, 'from' => $entry->id); throw new portfolio_format_leap2a_exception('leap2a_nonexistantlink', 'portfolio', '', $a); } // and contains a link back to us if (!array_key_exists($entry->id, $this->entries[$linkedid]->links)) { } // we could later check that the reltypes were properly inverse, but nevermind for now. } } } /** * Return the entire feed as a string. * Then, it calls for validation * * @return string feeds' content in xml */ public function to_xml() { $this->validate(); foreach ($this->entries as $entry) { $entry->id = 'portfolio:' . $entry->id; $this->feed->appendChild($entry->to_dom($this->dom, $this->user)); } return $this->dom->saveXML(); } } /** * This class represents a single leap2a entry. * * You can create these directly and then add them to the main leap feed object * * @package core_portfolio * @category portfolio * @copyright 2009 Penny Leach * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class portfolio_format_leap2a_entry { /** @var string entry id - something like forumpost6, must be unique to the feed */ public $id; /** @var string title of the entry */ public $title; /** @var string leap2a entry type */ public $type; /** @var string optional author (only if different to feed author) */ public $author; /** @var string summary - for split long content */ public $summary; /** @var mixed main content of the entry. can be html,text,or xhtml. for a stored_file, use portfolio_format_leap2a_file **/ public $content; /** @var int updated date - unix timestamp */ public $updated; /** @var int published date (ctime) - unix timestamp */ public $published; /** @var array the required fields for a leap2a entry */ private $requiredfields = array( 'id', 'title', 'type'); /** @var array extra fields which usually should be set (except author) but are not required */ private $optionalfields = array('author', 'updated', 'published', 'content', 'summary'); /** @var array links from this entry to other entries */ public $links = array(); /** @var array attachments to this entry */ public $attachments = array(); /** @var array categories for this entry */ private $categories = array(); /** * Constructor. All arguments are required (and will be validated) * http://wiki.cetis.ac.uk/2009-03/LEAP2A_types * * @param string $id unique id of this entry. * could be something like forumpost6 for example. * This must be unique to the entire feed. * @param string $title title of the entry. This is pure atom. * @param string $type the leap type of this entry. * @param mixed $content the content of the entry. string (xhtml/html/text) */ public function __construct($id, $title, $type, $content=null) { $this->id = $id; $this->title = $title; $this->type = $type; $this->content = $this->__set('content', $content); } /** * Override __set to do proper dispatching for different things. * Only allows the optional and required leap2a entry fields to be set * * @param string $field property's name * @param mixed $value property's value * @return mixed */ public function __set($field, $value) { // detect the case where content is being set to be a file directly if ($field == 'content' && $value instanceof stored_file) { throw new portfolio_format_leap2a_exception('leap2a_filecontent', 'portfolio'); } if (in_array($field, $this->requiredfields) || in_array($field, $this->optionalfields)) { return $this->{$field} = $value; } throw new portfolio_format_leap2a_exception('leap2a_invalidentryfield', 'portfolio', '', $field); } /** * Validate this entry. * At the moment this just makes sure required fields exist * but it could also check things against a list, for example * * @todo MDL-31303 - add category with a scheme 'selection_type' */ public function validate() { foreach ($this->requiredfields as $key) { if (empty($this->{$key})) { throw new portfolio_format_leap2a_exception('leap2a_missingfield', 'portfolio', '', $key); } } if ($this->type == 'selection') { if (count($this->links) == 0) { throw new portfolio_format_leap2a_exception('leap2a_emptyselection', 'portfolio'); } //TODO make sure we have a category with a scheme 'selection_type' } } /** * Add a link from this entry to another one. * These will be collated at the end of the export (during to_xml) * and validated at that point. This function does no validation * {@link http://wiki.cetis.ac.uk/2009-03/LEAP2A_relationships} * * @param portfolio_format_leap2a_entry|string $otherentry portfolio_format_leap2a_entry or its id * @param string $reltype (no leap2: ns required) * @param string $displayorder (optional) * @return portfolio_format_leap2a_entry the current entry object. This is so that these calls can be chained * eg $entry->add_link('something6', 'has_part')->add_link('something7', * 'has_part'); */ public function add_link($otherentry, $reltype, $displayorder=null) { if ($otherentry instanceof portfolio_format_leap2a_entry) { $otherentry = $otherentry->id; } if ($otherentry == $this->id) { throw new portfolio_format_leap2a_exception('leap2a_selflink', 'portfolio', '', (object)array('rel' => $reltype, 'id' => $this->id)); } // add on the leap2: ns if required if (!in_array($reltype, array('related', 'alternate', 'enclosure'))) { $reltype = 'leap2:' . $reltype; } $this->links[$otherentry] = (object)array('rel' => $reltype, 'order' => $displayorder); return $this; } /** * Add a category to this entry * {@link http://wiki.cetis.ac.uk/2009-03/LEAP2A_categories} * "tags" should just pass a term here and no scheme or label. * They will be automatically normalised if they have spaces. * * @param string $term eg 'Offline' * @param string $scheme (optional) eg resource_type * @param string $label (optional) eg File */ public function add_category($term, $scheme=null, $label=null) { // "normalise" terms and set their label if they have spaces // see http://wiki.cetis.ac.uk/2009-03/LEAP2A_categories#Plain_tags for more information if (empty($scheme) && strpos($term, ' ') !== false) { $label = $term; $term = str_replace(' ', '-', $term); } $this->categories[] = (object)array( 'term' => $term, 'scheme' => $scheme, 'label' => $label, ); } /** * Create an entry element and append all the children * And return it rather than adding it to the dom. * This is handled by the main writer object. * * @param DomDocument $dom use this to create elements * @param stdClass $feedauthor object of author(user) info * @return DOMDocument */ public function to_dom(DomDocument $dom, $feedauthor) { $entry = $dom->createElement('entry'); $entry->appendChild($dom->createElement('id', $this->id)); $entry->appendChild($dom->createElement('title', $this->title)); if ($this->author && $this->author->id != $feedauthor->id) { $author = $dom->createElement('author'); $author->appendChild($dom->createElement('name', fullname($this->author))); $entry->appendChild($author); } // selectively add uncomplicated optional elements foreach (array('updated', 'published') as $field) { if ($this->{$field}) { $date = date(DATE_ATOM, $this->{$field}); $entry->appendChild($dom->createElement($field, $date)); } } if (empty($this->content)) { $entry->appendChild($dom->createElement('content')); } else { $content = $this->create_xhtmlish_element($dom, 'content', $this->content); $entry->appendChild($content); } if (!empty($this->summary)) { $summary = $this->create_xhtmlish_element($dom, 'summary', $this->summary); $entry->appendChild($summary); } $type = $dom->createElement('rdf:type'); $type->setAttribute('rdf:resource', 'leap2:' . $this->type); $entry->appendChild($type); foreach ($this->links as $otherentry => $l) { $link = $dom->createElement('link'); $link->setAttribute('rel', $l->rel); $link->setAttribute('href', 'portfolio:' . $otherentry); if ($l->order) { $link->setAttribute('leap2:display_order', $l->order); } $entry->appendChild($link); } $this->add_extra_links($dom, $entry); // hook for subclass foreach ($this->categories as $category) { $cat = $dom->createElement('category'); $cat->setAttribute('term', $category->term); if ($category->scheme) { $cat->setAttribute('scheme', 'categories:' .$category->scheme . '#'); } if ($category->label && $category->label != $category->term) { $cat->setAttribute('label', $category->label); } $entry->appendChild($cat); } return $entry; } /** * Try to load whatever is in $content into xhtml and add it to the dom. * Failing that, load the html, escape it, and set it as the body of the tag. * Either way it sets the type attribute of the top level element. * Moodle should always provide xhtml content, but user-defined content can't be trusted * * @todo MDL-31304 - convert to xml * @param DomDocument $dom the dom doc to use * @param string $tagname usually 'content' or 'summary' * @param string $content the content to use, either xhtml or html. * @return DomDocument */ private function create_xhtmlish_element(DomDocument $dom, $tagname, $content) { $topel = $dom->createElement($tagname); $maybexml = true; if (strpos($content, '<') === false && strpos($content, '>') === false) { $maybexml = false; } // try to load content as xml $tmp = new DomDocument(); if ($maybexml && @$tmp->loadXML('
' . $content . '
')) { $topel->setAttribute('type', 'xhtml'); $content = $dom->importNode($tmp->documentElement, true); $content->setAttribute('xmlns', 'http://www.w3.org/1999/xhtml'); $topel->appendChild($content); // if that fails, it could still be html } else if ($maybexml && @$tmp->loadHTML($content)) { $topel->setAttribute('type', 'html'); $topel->nodeValue = $content; // TODO figure out how to convert this to xml // TODO because we end up with wrapped around it // which is annoying // either we already know it's text from the first check // or nothing else has worked anyway } else { $topel->nodeValue = $content; $topel->setAttribute('type', 'text'); return $topel; } return $topel; } /** * Hook function for subclasses to add extra links (like for files) * * @param DomDocument $dom feed object * @param DomDocument $entry feed added link */ protected function add_extra_links($dom, $entry) {} } /** * Subclass of entry, purely for dealing with files * * @package core_portfolio * @category portfolio * @copyright 2009 Penny Leach * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class portfolio_format_leap2a_file extends portfolio_format_leap2a_entry { /** @var file_stored for the dealing file */ protected $referencedfile; /** * Overridden constructor to set up the file. * * @param string $title title of the entry * @param stored_file $file file storage instance */ public function __construct($title, stored_file $file) { $id = portfolio_format_leap2a::file_id_prefix() . $file->get_id(); parent::__construct($id, $title, 'resource'); $this->referencedfile = $file; $this->published = $this->referencedfile->get_timecreated(); $this->updated = $this->referencedfile->get_timemodified(); $this->add_category('offline', 'resource_type'); } /** * Implement the hook to add extra links to attach the file in an enclosure * * @param DomDocument $dom feed object * @param DomDocument $entry feed added link */ protected function add_extra_links($dom, $entry) { $link = $dom->createElement('link'); $link->setAttribute('rel', 'enclosure'); $link->setAttribute('href', portfolio_format_leap2a::get_file_directory() . $this->referencedfile->get_filename()); $link->setAttribute('length', $this->referencedfile->get_filesize()); $link->setAttribute('type', $this->referencedfile->get_mimetype()); $entry->appendChild($link); } } PK\E\>%% dictionary/dictionary_format.phpnu[PK\t)uTEMPLATE/TEMPLATE_format.phpnu[PK\](.Gfullwithoutauthor/fullwithoutauthor_format.phpnu[PK\lS S ) entrylist/entrylist_format.phpnu[PK\ $*encyclopedia/encyclopedia_format.phpnu[PK\2aHH 5continuous/continuous_format.phpnu[PK\b~<faq/faq_format.phpnu[PK\e8 (lEfullwithauthor/fullwithauthor_format.phpnu[PK\[>> PREADME.txtnu[PKf\"+'SSWleap2a/lib.phpnu[PK