ÿØÿà 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-Ї Ç public_html/lms.smk-almanshuriyah.sch.id/mod/lesson/backup/moodle2/restore_lesson_stepslib.php000064400000032441152267156000031166 0ustar00home/smkb8269. /** * @package mod_lesson * @subpackage backup-moodle2 * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ /** * Define all the restore steps that will be used by the restore_lesson_activity_task */ /** * Structure step to restore one lesson activity */ class restore_lesson_activity_structure_step extends restore_activity_structure_step { // Store the answers as they're received but only process them at the // end of the lesson protected $answers = array(); protected function define_structure() { $paths = array(); $userinfo = $this->get_setting_value('userinfo'); $paths[] = new restore_path_element('lesson', '/activity/lesson'); $paths[] = new restore_path_element('lesson_page', '/activity/lesson/pages/page'); $paths[] = new restore_path_element('lesson_answer', '/activity/lesson/pages/page/answers/answer'); $paths[] = new restore_path_element('lesson_override', '/activity/lesson/overrides/override'); if ($userinfo) { $paths[] = new restore_path_element('lesson_attempt', '/activity/lesson/pages/page/answers/answer/attempts/attempt'); $paths[] = new restore_path_element('lesson_grade', '/activity/lesson/grades/grade'); $paths[] = new restore_path_element('lesson_branch', '/activity/lesson/pages/page/branches/branch'); $paths[] = new restore_path_element('lesson_highscore', '/activity/lesson/highscores/highscore'); $paths[] = new restore_path_element('lesson_timer', '/activity/lesson/timers/timer'); } // Return the paths wrapped into standard activity structure return $this->prepare_activity_structure($paths); } protected function process_lesson($data) { global $DB; $data = (object)$data; $oldid = $data->id; $data->course = $this->get_courseid(); // Any changes to the list of dates that needs to be rolled should be same during course restore and course reset. // See MDL-9367. $data->available = $this->apply_date_offset($data->available); $data->deadline = $this->apply_date_offset($data->deadline); // The lesson->highscore code was removed in MDL-49581. // Remove it if found in the backup file. if (isset($data->showhighscores)) { unset($data->showhighscores); } if (isset($data->highscores)) { unset($data->highscores); } // Supply items that maybe missing from previous versions. if (!isset($data->completionendreached)) { $data->completionendreached = 0; } if (!isset($data->completiontimespent)) { $data->completiontimespent = 0; } if (!isset($data->intro)) { $data->intro = ''; $data->introformat = FORMAT_HTML; } // Compatibility with old backups with maxtime and timed fields. if (!isset($data->timelimit)) { if (isset($data->timed) && isset($data->maxtime) && $data->timed) { $data->timelimit = 60 * $data->maxtime; } else { $data->timelimit = 0; } } // insert the lesson record $newitemid = $DB->insert_record('lesson', $data); // immediately after inserting "activity" record, call this $this->apply_activity_instance($newitemid); } protected function process_lesson_page($data) { global $DB; $data = (object)$data; $oldid = $data->id; $data->lessonid = $this->get_new_parentid('lesson'); // We'll remap all the prevpageid and nextpageid at the end, once all pages have been created $newitemid = $DB->insert_record('lesson_pages', $data); $this->set_mapping('lesson_page', $oldid, $newitemid, true); // Has related fileareas } protected function process_lesson_answer($data) { global $DB; $data = (object)$data; $data->lessonid = $this->get_new_parentid('lesson'); $data->pageid = $this->get_new_parentid('lesson_page'); $data->answer = $data->answer_text; // Set a dummy mapping to get the old ID so that it can be used by get_old_parentid when // processing attempts. It will be corrected in after_execute $this->set_mapping('lesson_answer', $data->id, 0, true); // Has related fileareas. // Answers need to be processed in order, so we store them in an // instance variable and insert them in the after_execute stage $this->answers[$data->id] = $data; } protected function process_lesson_attempt($data) { global $DB; $data = (object)$data; $oldid = $data->id; $data->lessonid = $this->get_new_parentid('lesson'); $data->pageid = $this->get_new_parentid('lesson_page'); // We use the old answerid here as the answer isn't created until after_execute $data->answerid = $this->get_old_parentid('lesson_answer'); $data->userid = $this->get_mappingid('user', $data->userid); $newitemid = $DB->insert_record('lesson_attempts', $data); $this->set_mapping('lesson_attempt', $oldid, $newitemid, true); // Has related fileareas. } protected function process_lesson_grade($data) { global $DB; $data = (object)$data; $oldid = $data->id; $data->lessonid = $this->get_new_parentid('lesson'); $data->userid = $this->get_mappingid('user', $data->userid); $newitemid = $DB->insert_record('lesson_grades', $data); $this->set_mapping('lesson_grade', $oldid, $newitemid); } protected function process_lesson_branch($data) { global $DB; $data = (object)$data; $oldid = $data->id; $data->lessonid = $this->get_new_parentid('lesson'); $data->pageid = $this->get_new_parentid('lesson_page'); $data->userid = $this->get_mappingid('user', $data->userid); $newitemid = $DB->insert_record('lesson_branch', $data); } protected function process_lesson_highscore($data) { // Do not process any high score data. // high scores were removed in Moodle 3.0 See MDL-49581. } protected function process_lesson_timer($data) { global $DB; $data = (object)$data; $oldid = $data->id; $data->lessonid = $this->get_new_parentid('lesson'); $data->userid = $this->get_mappingid('user', $data->userid); // Supply item that maybe missing from previous versions. if (!isset($data->completed)) { $data->completed = 0; } $newitemid = $DB->insert_record('lesson_timer', $data); } /** * Process a lesson override restore * @param object $data The data in object form * @return void */ protected function process_lesson_override($data) { global $DB; $data = (object)$data; $oldid = $data->id; // Based on userinfo, we'll restore user overides or no. $userinfo = $this->get_setting_value('userinfo'); // Skip user overrides if we are not restoring userinfo. if (!$userinfo && !is_null($data->userid)) { return; } $data->lessonid = $this->get_new_parentid('lesson'); if (!is_null($data->userid)) { $data->userid = $this->get_mappingid('user', $data->userid); } if (!is_null($data->groupid)) { $data->groupid = $this->get_mappingid('group', $data->groupid); } // Skip if there is no user and no group data. if (empty($data->userid) && empty($data->groupid)) { return; } $data->available = $this->apply_date_offset($data->available); $data->deadline = $this->apply_date_offset($data->deadline); $newitemid = $DB->insert_record('lesson_overrides', $data); // Add mapping, restore of logs needs it. $this->set_mapping('lesson_override', $oldid, $newitemid); } protected function after_execute() { global $DB; // Answers must be sorted by id to ensure that they're shown correctly ksort($this->answers); foreach ($this->answers as $answer) { $newitemid = $DB->insert_record('lesson_answers', $answer); $this->set_mapping('lesson_answer', $answer->id, $newitemid, true); // Update the lesson attempts to use the newly created answerid $DB->set_field('lesson_attempts', 'answerid', $newitemid, array( 'lessonid' => $answer->lessonid, 'pageid' => $answer->pageid, 'answerid' => $answer->id)); } // Add lesson files, no need to match by itemname (just internally handled context). $this->add_related_files('mod_lesson', 'intro', null); $this->add_related_files('mod_lesson', 'mediafile', null); // Add lesson page files, by lesson_page itemname $this->add_related_files('mod_lesson', 'page_contents', 'lesson_page'); $this->add_related_files('mod_lesson', 'page_answers', 'lesson_answer'); $this->add_related_files('mod_lesson', 'page_responses', 'lesson_answer'); $this->add_related_files('mod_lesson', 'essay_responses', 'lesson_attempt'); $this->add_related_files('mod_lesson', 'essay_answers', 'lesson_attempt'); // Remap all the restored prevpageid and nextpageid now that we have all the pages and their mappings $rs = $DB->get_recordset('lesson_pages', array('lessonid' => $this->task->get_activityid()), '', 'id, prevpageid, nextpageid'); foreach ($rs as $page) { $page->prevpageid = (empty($page->prevpageid)) ? 0 : $this->get_mappingid('lesson_page', $page->prevpageid); $page->nextpageid = (empty($page->nextpageid)) ? 0 : $this->get_mappingid('lesson_page', $page->nextpageid); $DB->update_record('lesson_pages', $page); } $rs->close(); // Remap all the restored 'jumpto' fields now that we have all the pages and their mappings $rs = $DB->get_recordset('lesson_answers', array('lessonid' => $this->task->get_activityid()), '', 'id, jumpto'); foreach ($rs as $answer) { if ($answer->jumpto > 0) { $answer->jumpto = $this->get_mappingid('lesson_page', $answer->jumpto); $DB->update_record('lesson_answers', $answer); } } $rs->close(); // Remap all the restored 'nextpageid' fields now that we have all the pages and their mappings. $rs = $DB->get_recordset('lesson_branch', array('lessonid' => $this->task->get_activityid()), '', 'id, nextpageid'); foreach ($rs as $answer) { if ($answer->nextpageid > 0) { $answer->nextpageid = $this->get_mappingid('lesson_page', $answer->nextpageid); $DB->update_record('lesson_branch', $answer); } } $rs->close(); // Replay the upgrade step 2015030301 // to clean lesson answers that should be plain text. // 1 = LESSON_PAGE_SHORTANSWER, 8 = LESSON_PAGE_NUMERICAL, 20 = LESSON_PAGE_BRANCHTABLE. $sql = 'SELECT a.* FROM {lesson_answers} a JOIN {lesson_pages} p ON p.id = a.pageid WHERE a.answerformat <> :format AND a.lessonid = :lessonid AND p.qtype IN (1, 8, 20)'; $badanswers = $DB->get_recordset_sql($sql, array('lessonid' => $this->task->get_activityid(), 'format' => FORMAT_MOODLE)); foreach ($badanswers as $badanswer) { // Strip tags from answer text and convert back the format to FORMAT_MOODLE. $badanswer->answer = strip_tags($badanswer->answer); $badanswer->answerformat = FORMAT_MOODLE; $DB->update_record('lesson_answers', $badanswer); } $badanswers->close(); // Replay the upgrade step 2015032700. // Delete any orphaned lesson_branch record. if ($DB->get_dbfamily() === 'mysql') { $sql = "DELETE {lesson_branch} FROM {lesson_branch} LEFT JOIN {lesson_pages} ON {lesson_branch}.pageid = {lesson_pages}.id WHERE {lesson_pages}.id IS NULL"; } else { $sql = "DELETE FROM {lesson_branch} WHERE NOT EXISTS ( SELECT 'x' FROM {lesson_pages} WHERE {lesson_branch}.pageid = {lesson_pages}.id)"; } $DB->execute($sql); } }