ÿØÿà JFIF    ÿÛ „  ( %"1!%)+...383,7(-.+  -+++--++++---+-+-----+---------------+---+-++7-----ÿÀ  ß â" ÿÄ     ÿÄ H    !1AQaq"‘¡2B±ÁÑð#R“Ò Tbr‚²á3csƒ’ÂñDS¢³$CÿÄ   ÿÄ %  !1AQa"23‘ÿÚ   ? ôÿ ¨pŸªáÿ —åYõõ\?àÒü©ŠÄï¨pŸªáÿ —åYõõ\?àÓü©ŠÄá 0Ÿªáÿ Ÿå[úƒ ú®ði~TÁbqÐ8OÕpÿ ƒOò¤Oè`–RÂáœá™êi€ßÉ< FtŸI“öÌ8úDf´°å}“¾œ6  öFá°y¥jñÇh†ˆ¢ã/ÃÐ:ªcÈ "Y¡ðÑl>ÿ ”ÏËte:qž\oäŠe÷󲍷˜HT4&ÿ ÓÐü6ö®¿øþßèô Ÿ•7Ñi’•j|“ñì>b…þS?*Óôÿ ÓÐü*h¥£ír¶ü UãS炟[AÐaè[ûª•õ&õj?†Éö+EzP—WeÒírJFt ‘BŒ†Ï‡%#tE Øz ¥OÛ«!1›üä±Í™%ºÍãö]°î(–:@<‹ŒÊö×òÆt¦ãº+‡¦%ÌÁ²h´OƒJŒtMÜ>ÀÜÊw3Y´•牋4ǍýʏTì>œú=Íwhyë,¾Ôò×õ¿ßÊa»«þˆѪQ|%6ž™A õ%:øj<>É—ÿ Å_ˆCbõ¥š±ý¯Ýƒï…¶|RëócÍf溪“t.СøTÿ *Ä¿-{†çàczůŽ_–^XþŒ±miB[X±d 1,é”zEù»& î9gœf™9Ð'.;—™i}!ôšåîqêÛ٤ёý£½ÆA–àôe"A$˝Úsäÿ ÷Û #°xŸëí(l »ý3—¥5m! rt`†0~'j2(]S¦¦kv,ÚÇ l¦øJA£Šƒ J3E8ÙiŽ:cÉžúeZ°€¯\®kÖ(79«Ž:¯X”¾³Š&¡* ….‰Ž(ÜíŸ2¥ª‡×Hi²TF¤ò[¨íÈRëÉ䢍mgÑ.Ÿ<öäS0í„ǹÁU´f#Vß;Õ–…P@3ío<ä-±»Ž.L|kªÀê›fÂ6@»eu‚|ÓaÞÆŸ…¨ááå>åŠ?cKü6ùTÍÆ”†sĤÚ;H2RÚ†õ\Ö·Ÿn'¾ ñ#ºI¤Å´%çÁ­‚â7›‹qT3Iï¨ÖÚ5I7Ë!ÅOóŸ¶øÝñØôת¦$Tcö‘[«Ö³šÒ';Aþ ¸èíg A2Z"i¸vdÄ÷.iõ®§)¿]¤À†–‡É&ä{V¶iŽ”.Ó×Õÿ û?h¬Mt–íª[ÿ Ñÿ ÌV(í}=ibÔ¡›¥¢±b Lô¥‡piη_Z<‡z§èŒ)iÖwiÇ 2hÙ3·=’d÷8éŽ1¦¸c¤µ€7›7Ø ð\á)} ¹fËí›pAÃL%âc2 í§æQz¿;T8sæ°qø)QFMð‰XŒÂ±N¢aF¨…8¯!U  Z©RÊ ÖPVÄÀÍin™Ì-GˆªÅËŠ›•zË}º±ŽÍFò¹}Uw×#ä5B¤{î}Ð<ÙD é©¤&‡ïDbàÁôMÁ.. /** * This file contains the core_userfeedback class * * @package core * @copyright 2020 Shamim Rezaie * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); /** * This Class contains helper functions for user feedback functionality. * * @copyright 2020 Shamim Rezaie * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class core_userfeedback { /** * @var int Ask user to give feedback a few days after each major upgrade. */ public const REMIND_AFTER_UPGRADE = 1; /** * @var int Ask user to give feedback periodically. */ public const REMIND_PERIODICALLY = 2; /** * @var int Do not ask user to give feedback. */ public const REMIND_NEVER = 3; /** * Displays the feedback reminder block. */ public static function print_reminder_block(): void { global $PAGE; static $jscalled = false; $actions = [ [ 'title' => get_string('calltofeedback_give'), 'url' => static::make_link()->out(false), 'data' => [ 'action' => 'give', 'record' => 1, 'hide' => 1, ], 'newwindow' => true, ], [ 'title' => get_string('calltofeedback_remind'), 'url' => '#', 'data' => [ 'action' => 'remind', 'record' => 1, 'hide' => 1, ], ], ]; $icon = [ 'pix' => 'i/bullhorn', 'component' => 'core' ]; \core\notification::add_call_to_action($icon, get_string('calltofeedback'), $actions, 'core/userfeedback'); if (!$jscalled) { $jscalled = true; // Calling the following more than once will register event listeners twice. $PAGE->requires->js_call_amd('core/userfeedback', 'registerEventListeners'); } } /** * Indicates whether the feedback reminder block should be shown or not. * * @return bool */ public static function should_display_reminder(): bool { global $CFG; if (static::can_give_feedback()) { $give = get_user_preferences('core_userfeedback_give'); $remind = get_user_preferences('core_userfeedback_remind'); $lastactiontime = max($give ?: 0, $remind ?: 0); switch ($CFG->userfeedback_nextreminder) { case static::REMIND_AFTER_UPGRADE: $lastupgrade = static::last_major_upgrade_time(); if ($lastupgrade >= $lastactiontime) { return $lastupgrade + ($CFG->userfeedback_remindafter * DAYSECS) < time(); } break; case static::REMIND_PERIODICALLY: return $lastactiontime + ($CFG->userfeedback_remindafter * DAYSECS) < time(); break; } } return false; } /** * Prepare and return the URL of the feedback site * * @return moodle_url */ public static function make_link(): moodle_url { global $CFG, $PAGE; $baseurl = $CFG->userfeedback_url ?? 'https://feedback.moodle.org/lms'; $lang = clean_param(current_language(), PARAM_LANG); // Avoid breaking WS because of incorrect package langs. $moodleurl = $CFG->wwwroot; $moodleversion = $CFG->release; $theme = $PAGE->theme->name; $themeversion = get_config('theme_'.$theme, 'version'); $url = new moodle_url($baseurl, [ 'lang' => $lang, 'moodle_url' => $moodleurl, 'moodle_version' => $moodleversion, 'theme' => $theme, 'theme_version' => $themeversion, 'newtest' => 'Y', // Respondents might be using the same device/browser to fill out the survey. // The newtest param resets the session. ]); return $url; } /** * Whether the current can give feedback. * * @return bool */ public static function can_give_feedback(): bool { global $CFG; return !empty($CFG->enableuserfeedback) && isloggedin() && !isguestuser(); } /** * Returns the last major upgrade time * * @return int */ private static function last_major_upgrade_time(): int { global $DB; $targetversioncast = $DB->sql_cast_char2real('targetversion'); $versioncast = $DB->sql_cast_char2real('version'); // A time difference more than 3 months has to be a core upgrade. // Also, passing IGNORE_MULTIPLE because we are only interested in the first field and LIMIT is not cross-DB. $time = $DB->get_field_sql("SELECT timemodified FROM {upgrade_log} WHERE plugin = 'core' AND $targetversioncast - $versioncast > 30000 ORDER BY timemodified DESC", null, IGNORE_MULTIPLE); return (int)$time; } }