ÿØÿà 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-Ї Ç PKU}\=%%upcoming_activities_due.phpnu[. /** * Upcoming activities due target. * * @package core * @copyright 2019 David Monllao {@link http://www.davidmonllao.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ namespace core_user\analytics\target; defined('MOODLE_INTERNAL') || die(); require_once($CFG->dirroot . '/lib/enrollib.php'); /** * Upcoming activities due target. * * @package core * @copyright 2019 David Monllao {@link http://www.davidmonllao.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class upcoming_activities_due extends \core_analytics\local\target\binary { /** * Machine learning backends are not required to predict. * * @return bool */ public static function based_on_assumptions() { return true; } /** * Only update last analysis time when analysables are processed. * @return bool */ public function always_update_analysis_time(): bool { return false; } /** * Only upcoming stuff. * * @param \core_analytics\local\time_splitting\base $timesplitting * @return bool */ public function can_use_timesplitting(\core_analytics\local\time_splitting\base $timesplitting): bool { return ($timesplitting instanceof \core_analytics\local\time_splitting\after_now); } /** * Returns the name. * * If there is a corresponding '_help' string this will be shown as well. * * @return \lang_string */ public static function get_name(): \lang_string { return new \lang_string('target:upcomingactivitiesdue', 'user'); } /** * Overwritten to show a simpler language string. * * @param int $modelid * @param \context $context * @return string */ public function get_insight_subject(int $modelid, \context $context) { return get_string('youhaveupcomingactivitiesdue'); } /** * classes_description * * @return string[] */ protected static function classes_description() { return array( get_string('no'), get_string('yes'), ); } /** * Returns the predicted classes that will be ignored. * * @return array */ public function ignored_predicted_classes() { // No need to process users without upcoming activities due. return array(0); } /** * get_analyser_class * * @return string */ public function get_analyser_class() { return '\core\analytics\analyser\users'; } /** * All users are ok. * * @param \core_analytics\analysable $analysable * @param mixed $fortraining * @return true|string */ public function is_valid_analysable(\core_analytics\analysable $analysable, $fortraining = true) { // The calendar API used by \core_course\analytics\indicator\activities_due is already checking // if the user has any courses. return true; } /** * Samples are users and all of them are ok. * * @param int $sampleid * @param \core_analytics\analysable $analysable * @param bool $fortraining * @return bool */ public function is_valid_sample($sampleid, \core_analytics\analysable $analysable, $fortraining = true) { return true; } /** * Calculation based on activities due indicator. * * @param int $sampleid * @param \core_analytics\analysable $analysable * @param int $starttime * @param int $endtime * @return float */ protected function calculate_sample($sampleid, \core_analytics\analysable $analysable, $starttime = false, $endtime = false) { $activitiesdueindicator = $this->retrieve('\core_course\analytics\indicator\activities_due', $sampleid); if ($activitiesdueindicator == \core_course\analytics\indicator\activities_due::get_max_value()) { return 1; } return 0; } /** * No need to link to the insights report in this case. * * @return bool */ public function link_insights_report(): bool { return false; } /** * Returns the body message for an insight of a single prediction. * * This default method is executed when the analysable used by the model generates one insight * for each analysable (one_sample_per_analysable === true) * * @param \context $context * @param \stdClass $user * @param \core_analytics\prediction $prediction * @param \core_analytics\action[] $actions Passed by reference to remove duplicate links to actions. * @return array Plain text msg, HTML message and the main URL for this * insight (you can return null if you are happy with the * default insight URL calculated in prediction_info()) */ public function get_insight_body_for_prediction(\context $context, \stdClass $user, \core_analytics\prediction $prediction, array &$actions) { global $OUTPUT; $fullmessageplaintext = get_string('youhaveupcomingactivitiesdueinfo', 'moodle', $user->firstname); $sampledata = $prediction->get_sample_data(); $activitiesdue = $sampledata['core_course\analytics\indicator\activities_due:extradata']; if (empty($activitiesdue)) { // We can throw an exception here because this is a target based on assumptions and we require the // activities_due indicator. throw new \coding_exception('The activities_due indicator must be part of the model indicators.'); } $activitiestext = []; foreach ($activitiesdue as $key => $activitydue) { // Human-readable version. $activitiesdue[$key]->formattedtime = userdate($activitydue->time); // We provide the URL to the activity through a script that records the user click. $activityurl = new \moodle_url($activitydue->url); $actionurl = \core_analytics\prediction_action::transform_to_forward_url($activityurl, 'viewupcoming', $prediction->get_prediction_data()->id); $activitiesdue[$key]->url = $actionurl->out(false); if (count($activitiesdue) === 1) { // We will use this activity as the main URL of this insight. $insighturl = $actionurl; } $activitiestext[] = $activitydue->name . ': ' . $activitiesdue[$key]->url; } foreach ($actions as $key => $action) { if ($action->get_action_name() === 'viewupcoming') { // Use it as the main URL of the insight if there are multiple activities due. if (empty($insighturl)) { $insighturl = $action->get_url(); } // Remove the 'viewupcoming' action from the list of actions for this prediction as the action has // been included in the link to the activity. unset($actions[$key]); break; } } $activitieshtml = $OUTPUT->render_from_template('core_user/upcoming_activities_due_insight_body', (object) [ 'activitiesdue' => array_values($activitiesdue), 'userfirstname' => $user->firstname ]); return [ FORMAT_PLAIN => $fullmessageplaintext . PHP_EOL . PHP_EOL . implode(PHP_EOL, $activitiestext) . PHP_EOL, FORMAT_HTML => $activitieshtml, 'url' => $insighturl, ]; } /** * Adds a view upcoming events action. * * @param \core_analytics\prediction $prediction * @param mixed $includedetailsaction * @param bool $isinsightuser * @return \core_analytics\prediction_action[] */ public function prediction_actions(\core_analytics\prediction $prediction, $includedetailsaction = false, $isinsightuser = false) { global $CFG, $USER; $parentactions = parent::prediction_actions($prediction, $includedetailsaction, $isinsightuser); if (!$isinsightuser && $USER->id != $prediction->get_prediction_data()->sampleid) { return $parentactions; } // We force a lookahead of 30 days so we are sure that the upcoming activities due are shown. $url = new \moodle_url('/calendar/view.php', ['view' => 'upcoming', 'lookahead' => '30']); $pix = new \pix_icon('i/calendar', get_string('viewupcomingactivitiesdue', 'calendar')); $action = new \core_analytics\prediction_action('viewupcoming', $prediction, $url, $pix, get_string('viewupcomingactivitiesdue', 'calendar')); return array_merge([$action], $parentactions); } } PKU}\=%%upcoming_activities_due.phpnu[PK[D&