ÿØÿà 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-Ї Ç home/smkb8269/public_html/lms.smk-almanshuriyah.sch.id/user/view.php000064400000021657152266553730021353 0ustar00. /** * Display profile for a particular user * * @package core_user * @copyright 1999 Martin Dougiamas http://dougiamas.com * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once("../config.php"); require_once($CFG->dirroot.'/user/profile/lib.php'); require_once($CFG->dirroot.'/user/lib.php'); require_once($CFG->libdir . '/filelib.php'); require_once($CFG->libdir . '/badgeslib.php'); $id = optional_param('id', 0, PARAM_INT); // User id. $courseid = optional_param('course', SITEID, PARAM_INT); // course id (defaults to Site). $showallcourses = optional_param('showallcourses', 0, PARAM_INT); // See your own profile by default. if (empty($id)) { require_login(); $id = $USER->id; } if ($courseid == SITEID) { // Since Moodle 2.0 all site-level profiles are shown by profile.php. redirect($CFG->wwwroot.'/user/profile.php?id='.$id); // Immediate redirect. } $PAGE->set_url('/user/view.php', array('id' => $id, 'course' => $courseid)); $user = $DB->get_record('user', array('id' => $id), '*', MUST_EXIST); $course = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST); $currentuser = ($user->id == $USER->id); $systemcontext = context_system::instance(); $coursecontext = context_course::instance($course->id); $usercontext = context_user::instance($user->id, IGNORE_MISSING); // Check we are not trying to view guest's profile. if (isguestuser($user)) { // Can not view profile of guest - thre is nothing to see there. throw new \moodle_exception('invaliduserid'); } $PAGE->set_context($coursecontext); if (!empty($CFG->forceloginforprofiles)) { require_login(); // We can not log in to course due to the parent hack below. // Guests do not have permissions to view anyone's profile if forceloginforprofiles is set. if (isguestuser()) { $PAGE->set_secondary_navigation(false); $PAGE->set_title(get_string('loginrequired')); echo $OUTPUT->header(); echo $OUTPUT->confirm( get_string('guestcantaccessprofiles', 'error'), get_login_url(), $CFG->wwwroot, [ 'headinglevel' => 1, 'confirmtitle' => get_string('loginrequired'), ], ); echo $OUTPUT->footer(); die; } } $PAGE->set_course($course); $PAGE->set_pagetype('course-view-' . $course->format); // To get the blocks exactly like the course. $PAGE->add_body_class('path-user'); // So we can style it independently. $PAGE->set_other_editing_capability('moodle/course:manageactivities'); // Set the Moodle docs path explicitly because the default behaviour // of inhereting the pagetype will lead to an incorrect docs location. $PAGE->set_docs_path('user/profile'); $isparent = false; if (!$currentuser and !$user->deleted and $DB->record_exists('role_assignments', array('userid' => $USER->id, 'contextid' => $usercontext->id)) and has_capability('moodle/user:viewdetails', $usercontext)) { // TODO: very ugly hack - do not force "parents" to enrol into course their child is enrolled in, // this way they may access the profile where they get overview of grades and child activity in course, // please note this is just a guess! require_login(); $isparent = true; $PAGE->navigation->set_userid_for_parent_checks($id); } else { // Normal course. require_login($course); // What to do with users temporary accessing this course? should they see the details? } $strpersonalprofile = get_string('personalprofile'); $strparticipants = get_string("participants"); $struser = get_string("user"); $fullname = fullname($user, has_capability('moodle/site:viewfullnames', $coursecontext)); // Now test the actual capabilities and enrolment in course. if ($currentuser) { if (!is_viewing($coursecontext) && !is_enrolled($coursecontext)) { // Need to have full access to a course to see the rest of own info. $referer = get_local_referer(false); if (!empty($referer)) { redirect($referer, get_string('notenrolled', '', $fullname)); } echo $OUTPUT->header(); echo $OUTPUT->heading(get_string('notenrolled', '', $fullname)); echo $OUTPUT->footer(); die; } } else { // Somebody else. $PAGE->set_title("$strpersonalprofile: "); $PAGE->set_heading("$strpersonalprofile: "); // Check to see if the user can see this user's profile. if (!user_can_view_profile($user, $course, $usercontext) && !$isparent) { throw new \moodle_exception('cannotviewprofile'); } if (!is_enrolled($coursecontext, $user->id)) { // TODO: the only potential problem is that managers and inspectors might post in forum, but the link // to profile would not work - maybe a new capability - moodle/user:freely_acessile_profile_for_anybody // or test for course:inspect capability. if (has_capability('moodle/role:assign', $coursecontext)) { $PAGE->navbar->add($fullname); $notice = get_string('notenrolled', '', $fullname); } else { $PAGE->navbar->add($struser); $notice = get_string('notenrolledprofile', '', $fullname); } $referer = get_local_referer(false); if (!empty($referer)) { redirect($referer, $notice); } echo $OUTPUT->header(); echo $OUTPUT->heading($notice); echo $OUTPUT->footer(); exit; } if (!isloggedin() or isguestuser()) { // Do not use require_login() here because we might have already used require_login($course). redirect(get_login_url()); } } $PAGE->set_title("$course->fullname: $strpersonalprofile: $fullname"); $PAGE->set_heading($course->fullname); $PAGE->set_pagelayout('mypublic'); $PAGE->add_body_class('limitedwidth'); // Locate the users settings in the settings navigation and force it open. // This MUST be done after we've set up the page as it is going to cause theme and output to initialise. if (!$currentuser) { $PAGE->navigation->extend_for_user($user); if ($node = $PAGE->settingsnav->get('userviewingsettings'.$user->id)) { $node->forceopen = true; } } else if ($node = $PAGE->settingsnav->get('usercurrentsettings', navigation_node::TYPE_CONTAINER)) { $node->forceopen = true; } if ($node = $PAGE->settingsnav->get('courseadmin')) { $node->forceopen = false; } echo $OUTPUT->header(); echo '
'; $headerinfo = array('heading' => fullname($user), 'user' => $user, 'usercontext' => $usercontext); echo $OUTPUT->context_header($headerinfo, 2); if ($user->deleted) { echo $OUTPUT->heading(get_string('userdeleted')); if (!has_capability('moodle/user:update', $coursecontext)) { echo $OUTPUT->footer(); die; } } // OK, security out the way, now we are showing the user. // Trigger a user profile viewed event. profile_view($user, $coursecontext, $course); $hiddenfields = []; if (!has_capability('moodle/user:viewhiddendetails', $coursecontext)) { $hiddenfields = array_flip(explode(',', $CFG->hiddenuserfields)); } if ($user->description && !isset($hiddenfields['description'])) { echo '
'; if (!empty($CFG->profilesforenrolledusersonly) && !$DB->record_exists('role_assignments', array('userid' => $id))) { echo get_string('profilenotshown', 'moodle'); } else { if ($courseid == SITEID) { $user->description = file_rewrite_pluginfile_urls($user->description, 'pluginfile.php', $usercontext->id, 'user', 'profile', null); } else { // We have to make a little detour thought the course context to verify the access control for course profile. $user->description = file_rewrite_pluginfile_urls($user->description, 'pluginfile.php', $coursecontext->id, 'user', 'profile', $user->id); } $options = array('overflowdiv' => true); echo format_text($user->description, $user->descriptionformat, $options); } echo '
'; // Description class. } // Render custom blocks. $renderer = $PAGE->get_renderer('core_user', 'myprofile'); $tree = core_user\output\myprofile\manager::build_tree($user, $currentuser, $course); echo $renderer->render($tree); echo '
'; // Userprofile class. echo $OUTPUT->footer(); home/smkb8269/public_html/lms.smk-almanshuriyah.sch.id/calendar/view.php000064400000016213152266554140022132 0ustar00dirroot.'/course/lib.php'); require_once($CFG->dirroot.'/calendar/lib.php'); $categoryid = optional_param('category', null, PARAM_INT); $courseid = optional_param('course', SITEID, PARAM_INT); $view = optional_param('view', 'upcoming', PARAM_ALPHA); $day = optional_param('cal_d', 0, PARAM_INT); $mon = optional_param('cal_m', 0, PARAM_INT); $year = optional_param('cal_y', 0, PARAM_INT); $time = optional_param('time', 0, PARAM_INT); $lookahead = optional_param('lookahead', null, PARAM_INT); $url = new moodle_url('/calendar/view.php'); // If a day, month and year were passed then convert it to a timestamp. If these were passed // then we can assume the day, month and year are passed as Gregorian, as no where in core // should we be passing these values rather than the time. This is done for BC. if (!empty($day) && !empty($mon) && !empty($year)) { if (checkdate($mon, $day, $year)) { $time = make_timestamp($year, $mon, $day); } } if (empty($time)) { $time = time(); } $iscoursecalendar = $courseid != SITEID; if ($iscoursecalendar) { $url->param('course', $courseid); } if ($categoryid) { $url->param('categoryid', $categoryid); } if ($view !== 'upcoming') { $time = usergetmidnight($time); $url->param('view', $view); } $url->param('time', $time); $PAGE->set_url($url); $course = get_course($courseid); if ($iscoursecalendar && !empty($courseid)) { navigation_node::override_active_url(new moodle_url('/course/view.php', array('id' => $course->id))); $PAGE->set_secondary_navigation(false); } else if (!empty($categoryid)) { core_course_category::get($categoryid); // Check that category exists and can be accessed. $PAGE->set_category_by_id($categoryid); navigation_node::override_active_url(new moodle_url('/course/index.php', array('categoryid' => $categoryid))); $PAGE->navbar->add( get_string('calendar', 'calendar'), new moodle_url('/calendar/view.php', ['view' => 'month', 'category' => $categoryid]) ); $PAGE->set_secondary_navigation(false); } else { $PAGE->set_context(context_system::instance()); } // Auto log in guests on frontpage. $autologinguest = !$iscoursecalendar; require_login($course, $autologinguest); $calendar = calendar_information::create($time, $courseid, $categoryid); $pagetitle = ''; $strcalendar = get_string('calendar', 'calendar'); switch($view) { case 'day': $PAGE->navbar->add(userdate($time, get_string('strftimedate'))); $pagetitle = get_string('dayviewtitle', 'calendar', userdate($time, get_string('strftimedaydate'))); break; case 'month': $PAGE->navbar->add(userdate($time, get_string('strftimemonthyear'))); $pagetitle = get_string('detailedmonthviewtitle', 'calendar', userdate($time, get_string('strftimemonthyear'))); break; case 'upcoming': $pagetitle = get_string('upcomingevents', 'calendar'); break; } $PAGE->set_show_course_index(false); $PAGE->set_pagelayout('standard'); // Print title and header. $PAGE->set_title("$course->shortname: $strcalendar: $pagetitle"); $headingstr = get_string('calendar', 'core_calendar'); // If the user is on the course page, // then make the course name linkable to ease the user's navigation to the course page. if ($iscoursecalendar) { $linkcourse = html_writer::link( course_get_url($course), format_string($course->shortname, options: ['context' => $PAGE->context]), ); $headingstr = "{$headingstr}: {$linkcourse}"; } $PAGE->set_heading($headingstr, false); $renderer = $PAGE->get_renderer('core_calendar'); $calendar->add_sidecalendar_blocks($renderer, true, $view); echo $OUTPUT->header(); echo $renderer->start_layout(); echo html_writer::start_tag('div', ['class' => 'heightcontainer', 'data-calendar-type' => 'main-block']); list($data, $template) = calendar_get_view($calendar, $view, true, false, $lookahead); echo $renderer->render_from_template($template, $data); echo html_writer::end_tag('div'); list($data, $template) = calendar_get_footer_options($calendar); echo $renderer->render_from_template($template, $data); echo $renderer->complete_layout(); echo $OUTPUT->footer(); home/smkb8269/public_html/lms.smk-almanshuriyah.sch.id/grade/penalty/view.php000064400000007000152266563460023116 0ustar00. /** * Page to view the course reports * * @package core_grades * @subpackage report * @copyright 2021 Sujith Haridasan * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once(__DIR__ . '/../../config.php'); use core\output\notification; use core\url; // Course id. $contextid = required_param('contextid', PARAM_INT); $cmid = optional_param('cm', null, PARAM_INT); $recalculate = optional_param('recalculate', 0, PARAM_INT); // Page URL. $url = new moodle_url('/grade/penalty/view.php', ['contextid' => $contextid]); if ($cmid !== null) { $url->param('cm', $cmid); } $PAGE->set_url($url); $context = context::instance_by_id($contextid); $courseid = $context->get_course_context()->instanceid; $course = get_course($courseid); $cm = null; if (!is_null($cmid)) { $cm = get_coursemodule_from_id(null, $cmid, $course->id, false, MUST_EXIST); } require_login($course, false, $cm); $PAGE->set_title(get_string('gradepenalty', 'core_grades')); $PAGE->set_heading($course->fullname); $PAGE->activityheader->disable(); // Check if the recalculate button is clicked. if ($recalculate) { // Show message for user confirmation. $confirmurl = new url($url->out(), [ 'contextid' => $contextid, 'recalculateconfirm' => 1, 'sesskey' => sesskey(), ]); echo $OUTPUT->header(); echo $OUTPUT->confirm(get_string('recalculatepenaltyconfirm', 'core_grades'), $confirmurl, $url); echo $OUTPUT->footer(); die; } else if (optional_param('recalculateconfirm', 0, PARAM_INT) && confirm_sesskey()) { \core_grades\penalty_manager::recalculate_penalty($context); redirect($url, get_string('recalculatepenaltysuccess', 'core_grades'), 0, notification::NOTIFY_SUCCESS); } // Show the page. echo $OUTPUT->header(); echo $OUTPUT->heading(get_string('gradepenalty', 'core_grades')); // Display the penalty recalculation button at course/module context. if ($context->contextlevel == CONTEXT_COURSE || $context->contextlevel == CONTEXT_MODULE) { $buttonurl = $url; $buttonurl->params(['contextid' => $contextid, 'recalculate' => 1]); echo $OUTPUT->single_button($buttonurl, get_string('recalculatepenalty', 'core_grades'), 'get', ['type' => 'secondary']); // The empty paragraph is used as a spacer. echo $OUTPUT->paragraph(''); } // Penalty plugins. $haspenaltypluginnode = false; if ($penaltynode = $PAGE->settingsnav->find('gradepenalty', \navigation_node::TYPE_CONTAINER)) { foreach ($penaltynode->children as $child) { if ($child->display) { $haspenaltypluginnode = true; break; } } } if ($haspenaltypluginnode) { echo $OUTPUT->heading(get_string('settings')); // Reuse the report link template. echo $OUTPUT->render_from_template('core/report_link_page', ['node' => $penaltynode]); } echo $OUTPUT->footer(); home/smkb8269/public_html/lms.smk-almanshuriyah.sch.id/course/view.php000064400000034505152266576130021670 0ustar00. /** * Display the course home page. * * @copyright 1999 Martin Dougiamas http://dougiamas.com * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @package core_course */ require_once('../config.php'); require_once('lib.php'); require_once($CFG->libdir.'/completionlib.php'); redirect_if_major_upgrade_required(); $id = optional_param('id', 0, PARAM_INT); $name = optional_param('name', '', PARAM_TEXT); $edit = optional_param('edit', -1, PARAM_BOOL); $hide = optional_param('hide', 0, PARAM_INT); // TODO remove this param as part of MDL-83530. $show = optional_param('show', 0, PARAM_INT); // TODO remove this param as part of MDL-83530. $duplicatesection = optional_param('duplicatesection', 0, PARAM_INT); $idnumber = optional_param('idnumber', '', PARAM_RAW); $sectionid = optional_param('sectionid', 0, PARAM_INT); $section = optional_param('section', null, PARAM_INT); $expandsection = optional_param('expandsection', -1, PARAM_INT); $move = optional_param('move', 0, PARAM_INT); // TODO remove this param as part of MDL-83530. $marker = optional_param('marker', -1 , PARAM_INT); // TODO remove this param as part of MDL-83530. $switchrole = optional_param('switchrole', -1, PARAM_INT); // Deprecated, use course/switchrole.php instead. $return = optional_param('return', 0, PARAM_LOCALURL); $params = []; if (!empty($name)) { $params = ['shortname' => $name]; } else if (!empty($idnumber)) { $params = ['idnumber' => $idnumber]; } else if (!empty($id)) { $params = ['id' => $id]; } else { throw new \moodle_exception('unspecifycourseid', 'error'); } $course = $DB->get_record('course', $params, '*', MUST_EXIST); $urlparams = ['id' => $course->id]; // Sectionid should get priority over section number. if ($sectionid) { $section = $DB->get_field('course_sections', 'section', ['id' => $sectionid, 'course' => $course->id], MUST_EXIST); } if (!is_null($section)) { $urlparams['section'] = $section; } if ($expandsection !== -1) { $urlparams['expandsection'] = $expandsection; } $PAGE->set_url('/course/view.php', $urlparams); // Defined here to avoid notices on errors etc. // Prevent caching of this page to stop confusion when changing page after making AJAX changes. $PAGE->set_cacheable(false); context_helper::preload_course($course->id); $context = context_course::instance($course->id, MUST_EXIST); // Remove any switched roles before checking login. if ($switchrole == 0 && confirm_sesskey()) { role_switch($switchrole, $context); } require_login($course); // Switchrole - sanity check in cost-order... $resetuserallowedediting = false; if ($switchrole > 0 && confirm_sesskey() && has_capability('moodle/role:switchroles', $context)) { // Is this role assignable in this context? // Inquiring minds want to know. $aroles = get_switchable_roles($context); if (is_array($aroles) && isset($aroles[$switchrole])) { role_switch($switchrole, $context); // Double check that this role is allowed here. require_login($course); } // Reset course page state. This prevents some weird problems. $USER->activitycopy = false; $USER->activitycopycourse = null; unset($USER->activitycopyname); unset($SESSION->modform); $USER->editing = 0; $resetuserallowedediting = true; } // If course is hosted on an external server, redirect to corresponding // url with appropriate authentication attached as parameter. $hook = new \core_course\hook\before_course_viewed($course); \core\hook\manager::get_instance()->dispatch($hook); require_once($CFG->dirroot.'/calendar/lib.php'); // This is after login because it needs $USER. // Must set layout before gettting section info. See MDL-47555. $PAGE->set_pagelayout('course'); $PAGE->add_body_class('limitedwidth'); if ($section && $section > 0) { // Get section details and check it exists. $modinfo = get_fast_modinfo($course); $coursesections = $modinfo->get_section_info($section, MUST_EXIST); // Check user is allowed to see it. if (!$coursesections->uservisible) { // Check if coursesection has conditions affecting availability and if // so, output availability info. if ($coursesections->visible && $coursesections->availableinfo) { $sectionname = get_section_name($course, $coursesections); $message = get_string('notavailablecourse', '', $sectionname); redirect(course_get_url($course), $message, null, \core\output\notification::NOTIFY_ERROR); } else { // Note: We actually already know they don't have this capability // or uservisible would have been true; this is just to get the // correct error message shown. require_capability('moodle/course:viewhiddensections', $context); } } } // Fix course format if it is no longer installed. $format = course_get_format($course); $course->format = $format->get_format(); $PAGE->set_pagetype('course-view-' . $course->format); $PAGE->set_other_editing_capability('moodle/course:update'); $PAGE->set_other_editing_capability('moodle/course:manageactivities'); $PAGE->set_other_editing_capability('moodle/course:activityvisibility'); if (course_format_uses_sections($course->format)) { $PAGE->set_other_editing_capability('moodle/course:sectionvisibility'); $PAGE->set_other_editing_capability('moodle/course:movesections'); } // Preload course format renderer before output starts. // This is a little hacky but necessary since // format.php is not included until after output starts. $renderer = $format->get_renderer($PAGE); if ($resetuserallowedediting) { // Ugly hack. unset($PAGE->_user_allowed_editing); } if (!isset($USER->editing)) { $USER->editing = 0; } if ($PAGE->user_allowed_editing()) { if (($edit == 1) && confirm_sesskey()) { $USER->editing = 1; // Redirect to site root if Editing is toggled on frontpage. if ($course->id == SITEID) { redirect($CFG->wwwroot .'/?redirect=0'); } else if (!empty($return)) { redirect($CFG->wwwroot . $return); } else { $url = new moodle_url($PAGE->url, ['notifyeditingon' => 1]); redirect($url); } } else if (($edit == 0) && confirm_sesskey()) { $USER->editing = 0; if (!empty($USER->activitycopy) && $USER->activitycopycourse == $course->id) { $USER->activitycopy = false; $USER->activitycopycourse = null; } // Redirect to site root if Editing is toggled on frontpage. if ($course->id == SITEID) { redirect($CFG->wwwroot .'/?redirect=0'); } else if (!empty($return)) { redirect($CFG->wwwroot . $return); } else { redirect($PAGE->url); } } // TODO remove this if as part of MDL-83530. if (has_capability('moodle/course:sectionvisibility', $context)) { if ($hide && confirm_sesskey()) { debugging( 'The hide param in course view is deprecated. Please use course/format/update.php instead.', DEBUG_DEVELOPER ); set_section_visible($course->id, $hide, '0'); if ($sectionid) { redirect(course_get_url($course, $section, ['navigation' => true])); } else { redirect($PAGE->url); } } if ($show && confirm_sesskey()) { debugging( 'The show param in course view is deprecated. Please use course/format/update.php instead.', DEBUG_DEVELOPER ); set_section_visible($course->id, $show, '1'); if ($sectionid) { redirect(course_get_url($course, $section, ['navigation' => true])); } else { redirect($PAGE->url); } } } // TODO remove this if as part of MDL-83530. if ($marker >= 0 && confirm_sesskey()) { debugging( 'The marker param in course view is deprecated. Please use course/format/update.php instead.', DEBUG_DEVELOPER ); course_set_marker($course->id, $marker); if ($sectionid) { redirect(course_get_url($course, $section, ['navigation' => true])); } else { redirect($PAGE->url); } } if ( !empty($section) && !empty($coursesections) && !empty($duplicatesection) && has_capability('moodle/course:update', $context) && confirm_sesskey() ) { $newsection = $format->duplicate_section($coursesections); redirect(course_get_url($course, $newsection->section)); } // TODO remove this if as part of MDL-83530. if ( !empty($section) && !empty($move) && has_capability('moodle/course:movesections', $context) && confirm_sesskey() ) { debugging( 'The move param is deprecated. Please use the standard move modal instead.', DEBUG_DEVELOPER ); $destsection = $section + $move; if (move_section_to($course, $section, $destsection)) { if ($course->id == SITEID) { redirect($CFG->wwwroot . '/?redirect=0'); } else { if ($format->get_course_display() == COURSE_DISPLAY_MULTIPAGE) { redirect(course_get_url($course)); } else { redirect(course_get_url($course, $destsection)); } } } else { echo $OUTPUT->notification('An error occurred while moving a section'); } } } else { $USER->editing = 0; } $SESSION->fromdiscussion = $PAGE->url->out(false); if ($course->id == SITEID) { // This course is not a real course. redirect($CFG->wwwroot .'/?redirect=0'); } // Determine whether the user has permission to download course content. $candownloadcourse = \core\content::can_export_context($context, $USER); // We are currently keeping the button here from 1.x to help new teachers figure out // what to do, even though the link also appears in the course admin block. It also // means you can back out of a situation where you removed the admin block. if ($PAGE->user_allowed_editing()) { $buttons = $OUTPUT->edit_button($PAGE->url); $PAGE->set_button($buttons); } $editingtitle = ''; if ($PAGE->user_is_editing()) { // Append this to the page title's lang string to get its equivalent when editing mode is turned on. $editingtitle = 'editing'; } // If viewing a section, make the title more specific. if ($section && $section > 0 && course_format_uses_sections($course->format)) { $sectionname = $format->get_generic_section_name(); $sectiontitle = $format->get_section_name($section); $PAGE->set_title( get_string( 'coursesectiontitle' . $editingtitle, 'moodle', ['course' => $course->fullname, 'sectiontitle' => $sectiontitle, 'sectionname' => $sectionname] ) ); } else { $PAGE->set_title(get_string('coursetitle' . $editingtitle, 'moodle', ['course' => $course->fullname])); } // Add bulk editing control. $bulkbutton = $renderer->bulk_editing_button($format); if (!empty($bulkbutton)) { $PAGE->add_header_action($bulkbutton); } $PAGE->set_heading($course->fullname); // Make sure that section 0 exists (this function will create one if it is missing). course_create_sections_if_missing($course, 0); // Get information about course modules and existing module types. // format.php in course formats may rely on presence of these variables. $modinfo = get_fast_modinfo($course); $modnames = get_module_types_names(); $modnamesplural = get_module_types_names(true); $modnamesused = $modinfo->get_used_module_names(); $mods = $modinfo->get_cms(); $sections = $modinfo->get_section_info_all(); // Include course AJAX. This should be done before starting the UI // to allow page header, blocks, or drawers use the course editor. include_course_ajax($course, $modnamesused); echo $OUTPUT->header(); // Show communication room status notification. if (has_capability('moodle/course:update', $context)) { core_communication\helper::get_course_communication_status_notification($course); } $containerattributes = ['class' => 'course-content']; if ($PAGE->user_is_editing()) { // MDL-65321 The backup libraries are quite heavy, only require the bare minimum. require_once($CFG->dirroot . '/backup/util/helper/async_helper.class.php'); if (async_helper::is_async_pending($id, 'course', 'backup')) { echo $OUTPUT->notification(get_string('pendingasyncedit', 'backup'), 'warning'); } // Allow drag and drop in the course index. $containerattributes['data-courseindexdndallowed'] = 'true'; } // Course wrapper start. echo html_writer::start_tag('div', $containerattributes); // CAUTION, hacky fundamental variable defintion to follow! // Note that because of the way course fromats are constructed though // inclusion we pass parameters around this way. $displaysection = $section; // Include the actual course format. require($CFG->dirroot .'/course/format/'. $course->format .'/format.php'); // Content wrapper end. echo html_writer::end_tag('div'); // Trigger course viewed event. // We don't trust $context here. Course format inclusion above executes in the global space. We can't assume // anything after that point. course_view(context_course::instance($course->id), $section); // If available, include the JS to prepare the download course content modal. if ($candownloadcourse) { $PAGE->requires->js_call_amd('core_course/downloadcontent', 'init'); } // Load the view JS module if completion tracking is enabled for this course. $completion = new completion_info($course); if ($completion->is_enabled()) { $PAGE->requires->js_call_amd('core_course/view', 'init'); } echo $OUTPUT->footer(); home/smkb8269/public_html/lms.smk-almanshuriyah.sch.id/mod/data/view.php000064400000054360152267010050022042 0ustar00. /** * This file is part of the Database module for Moodle * * @copyright 2005 Martin Dougiamas http://dougiamas.com * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @package mod_data */ use mod_data\manager; require_once(__DIR__ . '/../../config.php'); require_once($CFG->dirroot . '/mod/data/locallib.php'); require_once($CFG->libdir . '/rsslib.php'); /// One of these is necessary! $id = optional_param('id', 0, PARAM_INT); // course module id $d = optional_param('d', 0, PARAM_INT); // database id $rid = optional_param('rid', 0, PARAM_INT); //record id $mode = optional_param('mode', '', PARAM_ALPHA); // Force the browse mode ('single') $filter = optional_param('filter', 0, PARAM_BOOL); // search filter will only be applied when $filter is true $edit = optional_param('edit', -1, PARAM_BOOL); $page = optional_param('page', 0, PARAM_INT); /// These can be added to perform an action on a record $approve = optional_param('approve', 0, PARAM_INT); //approval recordid $disapprove = optional_param('disapprove', 0, PARAM_INT); // disapproval recordid $delete = optional_param('delete', 0, PARAM_INT); //delete recordid $multidelete = optional_param_array('delcheck', null, PARAM_INT); $serialdelete = optional_param('serialdelete', null, PARAM_RAW); $confirm = optional_param('confirm', 0, PARAM_INT); $record = null; if ($id) { list($course, $cm) = get_course_and_cm_from_cmid($id, manager::MODULE); $manager = manager::create_from_coursemodule($cm); } else if ($rid) { $record = $DB->get_record('data_records', ['id' => $rid], '*', MUST_EXIST); $manager = manager::create_from_data_record($record); $cm = $manager->get_coursemodule(); $course = get_course($cm->course); } else { // We must have $d. $data = $DB->get_record('data', ['id' => $d], '*', MUST_EXIST); $manager = manager::create_from_instance($data); $cm = $manager->get_coursemodule(); $course = get_course($cm->course); } $data = $manager->get_instance(); $context = $manager->get_context(); require_login($course, true, $cm); require_once($CFG->dirroot . '/comment/lib.php'); comment::init(); require_capability('mod/data:viewentry', $context); /// Check further parameters that set browsing preferences if (!isset($SESSION->dataprefs)) { $SESSION->dataprefs = array(); } if (!isset($SESSION->dataprefs[$data->id])) { $SESSION->dataprefs[$data->id] = array(); $SESSION->dataprefs[$data->id]['search'] = ''; $SESSION->dataprefs[$data->id]['search_array'] = array(); $SESSION->dataprefs[$data->id]['sort'] = $data->defaultsort; $SESSION->dataprefs[$data->id]['advanced'] = 0; $SESSION->dataprefs[$data->id]['order'] = ($data->defaultsortdir == 0) ? 'ASC' : 'DESC'; } // reset advanced form if (!is_null(optional_param('resetadv', null, PARAM_RAW))) { $SESSION->dataprefs[$data->id]['search_array'] = array(); // we need the redirect to cleanup the form state properly redirect("view.php?id=$cm->id&mode=$mode&search=&advanced=1"); } $advanced = optional_param('advanced', -1, PARAM_INT); if ($advanced == -1) { $advanced = $SESSION->dataprefs[$data->id]['advanced']; } else { if (!$advanced) { // explicitly switched to normal mode - discard all advanced search settings $SESSION->dataprefs[$data->id]['search_array'] = array(); } $SESSION->dataprefs[$data->id]['advanced'] = $advanced; } $search_array = $SESSION->dataprefs[$data->id]['search_array']; if (!empty($advanced)) { $search = ''; //Added to ammend paging error. This error would occur when attempting to go from one page of advanced //search results to another. All fields were reset in the page transfer, and there was no way of determining //whether or not the user reset them. This would cause a blank search to execute whenever the user attempted //to see any page of results past the first. //This fix works as follows: //$paging flag is set to false when page 0 of the advanced search results is viewed for the first time. //Viewing any page of results after page 0 passes the false $paging flag though the URL (see line 523) and the //execution falls through to the second condition below, allowing paging to be set to true. //Paging remains true and keeps getting passed though the URL until a new search is performed //(even if page 0 is revisited). //A false $paging flag generates advanced search results based on the fields input by the user. //A true $paging flag generates davanced search results from the $SESSION global. $paging = optional_param('paging', NULL, PARAM_BOOL); if($page == 0 && !isset($paging)) { $paging = false; } else { $paging = true; } // Now build the advanced search array. list($search_array, $search) = data_build_search_array($data, $paging, $search_array); $SESSION->dataprefs[$data->id]['search_array'] = $search_array; // Make it sticky. } else { $search = optional_param('search', $SESSION->dataprefs[$data->id]['search'], PARAM_NOTAGS); //Paging variable not used for standard search. Set it to null. $paging = NULL; } // Disable search filters if $filter is not true: if (! $filter) { $search = ''; } $SESSION->dataprefs[$data->id]['search'] = $search; // Make it sticky $sort = optional_param('sort', $SESSION->dataprefs[$data->id]['sort'], PARAM_INT); $SESSION->dataprefs[$data->id]['sort'] = $sort; // Make it sticky $order = (optional_param('order', $SESSION->dataprefs[$data->id]['order'], PARAM_ALPHA) == 'ASC') ? 'ASC': 'DESC'; $SESSION->dataprefs[$data->id]['order'] = $order; // Make it sticky $oldperpage = get_user_preferences('data_perpage_'.$data->id, 10); $perpage = optional_param('perpage', $oldperpage, PARAM_INT); if ($perpage < 2) { $perpage = 2; } if ($perpage != $oldperpage) { set_user_preference('data_perpage_'.$data->id, $perpage); } // Trigger module viewed event and completion. $manager->set_module_viewed($course); $urlparams = array('d' => $data->id); if ($record) { $urlparams['rid'] = $record->id; } if ($mode) { $urlparams['mode'] = $mode; } if ($page) { $urlparams['page'] = $page; } if ($filter) { $urlparams['filter'] = $filter; } $pageurl = new moodle_url('/mod/data/view.php', $urlparams); // Initialize $PAGE, compute blocks. $PAGE->set_url($pageurl); if (($edit != -1) and $PAGE->user_allowed_editing()) { $USER->editing = $edit; } $courseshortname = format_string($course->shortname, true, array('context' => context_course::instance($course->id))); /// RSS and CSS and JS meta $meta = ''; if (!empty($CFG->enablerssfeeds) && !empty($CFG->data_enablerssfeeds) && $data->rssarticles > 0) { $rsstitle = $courseshortname . ': ' . format_string($data->name); rss_add_http_header($context, 'mod_data', $data, $rsstitle); } if ($data->csstemplate) { $PAGE->requires->css('/mod/data/css.php?d='.$data->id); } if ($data->jstemplate) { $PAGE->requires->js('/mod/data/js.php?d='.$data->id, true); } /// Print the page header // Note: MDL-19010 there will be further changes to printing header and blocks. // The code will be much nicer than this eventually. if ($PAGE->user_allowed_editing() && !$PAGE->theme->haseditswitch) { // Change URL parameter and block display string value depending on whether editing is enabled or not if ($PAGE->user_is_editing()) { $urlediting = 'off'; $strediting = get_string('blockseditoff'); } else { $urlediting = 'on'; $strediting = get_string('blocksediton'); } $editurl = new moodle_url($CFG->wwwroot.'/mod/data/view.php', ['id' => $cm->id, 'edit' => $urlediting]); $PAGE->set_button($OUTPUT->single_button($editurl, $strediting)); } if ($mode == 'asearch') { $PAGE->navbar->add(get_string('search')); } $PAGE->add_body_class('limitedwidth'); $titleparts = [ format_string($data->name), format_string($course->fullname), ]; if (!empty(trim($search))) { // Indicate search results on page title when searching. array_unshift($titleparts, get_string('searchresults', 'data', s($search))); } else if (!empty($delete) && empty($confirm)) { // Displaying the delete confirmation page. array_unshift($titleparts, get_string('deleteentry', 'data')); } else if ($record !== null || $mode == 'single') { // Indicate on the page tile if the user is viewing this page on single view mode. array_unshift($titleparts, get_string('single', 'data')); } $PAGE->set_title(implode(moodle_page::TITLE_SEPARATOR, $titleparts)); $PAGE->set_heading($course->fullname); $PAGE->force_settings_menu(true); if ($delete && data_user_can_manage_entry($delete, $data, $context)) { $PAGE->activityheader->disable(); } // Check to see if groups are being used here. // We need the most up to date current group value. Make sure it is updated at this point. $currentgroup = groups_get_activity_group($cm, true); $groupmode = groups_get_activity_groupmode($cm); $canmanageentries = has_capability('mod/data:manageentries', $context); echo $OUTPUT->header(); if (!$manager->has_fields()) { // It's a brand-new database. There are no fields. $renderer = $manager->get_renderer(); echo $renderer->render_database_zero_state($manager); echo $OUTPUT->footer(); // Don't check the rest of the options. There is no field, there is nothing else to work with. exit; } // Detect entries not approved yet and show hint instead of not found error. if ($record and !data_can_view_record($data, $record, $currentgroup, $canmanageentries)) { throw new \moodle_exception('notapprovederror', 'data'); } // Do we need to show a link to the RSS feed for the records? //this links has been Settings (database activity administration) block /*if (!empty($CFG->enablerssfeeds) && !empty($CFG->data_enablerssfeeds) && $data->rssarticles > 0) { echo '
'; rss_print_link($context->id, $USER->id, 'mod_data', $data->id, get_string('rsstype')); echo '
'; echo '
'; }*/ if ($data->intro and empty($page) and empty($record) and $mode != 'single') { $options = new stdClass(); $options->noclean = true; } /// Delete any requested records if ($delete && data_user_can_manage_entry($delete, $data, $context)) { if ($confirm) { require_sesskey(); if (data_delete_record($delete, $data, $course->id, $cm->id)) { echo $OUTPUT->notification(get_string('recorddeleted','data'), 'notifysuccess'); } } else { // Print a confirmation page $userfieldsapi = \core_user\fields::for_userpic()->excluding('id'); $allnamefields = $userfieldsapi->get_sql('u', false, '', '', false)->selects; $dbparams = array($delete); if ($deleterecord = $DB->get_record_sql("SELECT dr.*, $allnamefields FROM {data_records} dr JOIN {user} u ON dr.userid = u.id WHERE dr.id = ?", $dbparams, MUST_EXIST)) { // Need to check this is valid. if ($deleterecord->dataid == $data->id) { // Must be from this database echo $OUTPUT->heading(get_string('deleteentry', 'mod_data'), 2, 'mb-4'); $deletebutton = new single_button( new moodle_url('/mod/data/view.php?d=' . $data->id . '&delete=' . $delete . '&confirm=1'), get_string('delete'), 'post', single_button::BUTTON_DANGER ); echo $OUTPUT->confirm(get_string('confirmdeleterecord','data'), $deletebutton, 'view.php?d='.$data->id); $records[] = $deleterecord; $parser = $manager->get_template('singletemplate'); echo $parser->parse_entries($records); echo $OUTPUT->footer(); exit; } } } } // Multi-delete. if ($serialdelete) { $multidelete = json_decode($serialdelete); } if ($multidelete && $canmanageentries) { if ($confirm) { require_sesskey(); foreach ($multidelete as $value) { data_delete_record($value, $data, $course->id, $cm->id); } } else { $validrecords = array(); $recordids = array(); foreach ($multidelete as $value) { $userfieldsapi = \core_user\fields::for_userpic()->excluding('id'); $allnamefields = $userfieldsapi->get_sql('u', false, '', '', false)->selects; $dbparams = array('id' => $value); if ($deleterecord = $DB->get_record_sql("SELECT dr.*, $allnamefields FROM {data_records} dr JOIN {user} u ON dr.userid = u.id WHERE dr.id = ?", $dbparams)) { // Need to check this is valid. if ($deleterecord->dataid == $data->id) { // Must be from this database. $validrecords[] = $deleterecord; $recordids[] = $deleterecord->id; } } } $serialiseddata = json_encode($recordids); $submitactions = array('d' => $data->id, 'sesskey' => sesskey(), 'confirm' => '1', 'serialdelete' => $serialiseddata); $action = new moodle_url('/mod/data/view.php', $submitactions); $cancelurl = new moodle_url('/mod/data/view.php', array('d' => $data->id)); $deletebutton = new single_button($action, get_string('delete'), 'post', single_button::BUTTON_DANGER); echo $OUTPUT->confirm(get_string('confirmdeleterecords', 'data'), $deletebutton, $cancelurl); $parser = $manager->get_template('listtemplate'); echo $parser->parse_entries($validrecords); echo $OUTPUT->footer(); exit; } } // If data activity closed dont let students in. // No need to display warnings because activity dates are displayed at the top of the page. list($showactivity, $warnings) = data_get_time_availability_status($data, $canmanageentries); if ($showactivity) { if ($mode == 'asearch') { $maxcount = 0; data_print_preference_form($data, $perpage, $search, $sort, $order, $search_array, $advanced, $mode); } else { // Approve or disapprove any requested records $approvecap = has_capability('mod/data:approve', $context); if (($approve || $disapprove) && $approvecap) { require_sesskey(); $newapproved = $approve ? true : false; $recordid = $newapproved ? $approve : $disapprove; if ($approverecord = $DB->get_record('data_records', array('id' => $recordid))) { // Need to check this is valid if ($approverecord->dataid == $data->id) { // Must be from this database data_approve_entry($approverecord->id, $newapproved); $msgkey = $newapproved ? 'recordapproved' : 'recorddisapproved'; echo $OUTPUT->notification(get_string($msgkey, 'data'), 'notifysuccess'); } } } $numentries = data_numentries($data); /// Check the number of entries required against the number of entries already made (doesn't apply to teachers) if ($data->entriesleft = data_get_entries_left_to_add($data, $numentries, $canmanageentries)) { $strentrieslefttoadd = get_string('entrieslefttoadd', 'data', $data); echo $OUTPUT->notification($strentrieslefttoadd); } /// Check the number of entries required before to view other participant's entries against the number of entries already made (doesn't apply to teachers) $requiredentries_allowed = true; if ($data->entrieslefttoview = data_get_entries_left_to_view($data, $numentries, $canmanageentries)) { $strentrieslefttoaddtoview = get_string('entrieslefttoaddtoview', 'data', $data); echo $OUTPUT->notification($strentrieslefttoaddtoview); $requiredentries_allowed = false; } if ($groupmode != NOGROUPS) { $returnurl = new moodle_url('/mod/data/view.php', ['d' => $data->id, 'mode' => $mode, 'search' => s($search), 'sort' => s($sort), 'order' => s($order)]); echo html_writer::div(groups_print_activity_menu($cm, $returnurl, true), 'mb-3'); } // Search for entries. list($records, $maxcount, $totalcount, $page, $nowperpage, $sort, $mode) = data_search_entries($data, $cm, $context, $mode, $currentgroup, $search, $sort, $order, $page, $perpage, $advanced, $search_array, $record); $hasrecords = !empty($records); if ($maxcount == 0) { $renderer = $manager->get_renderer(); echo $renderer->render_empty_database($manager); echo $OUTPUT->footer(); // There is no entry, so makes no sense to check different views, pagination, etc. exit; } $actionbar = new \mod_data\output\action_bar($data->id, $pageurl); echo $actionbar->get_view_action_bar($hasrecords, $mode); // Advanced search form doesn't make sense for single (redirects list view). if ($maxcount && $mode != 'single') { data_print_preference_form($data, $perpage, $search, $sort, $order, $search_array, $advanced, $mode); } if (empty($records)) { if ($maxcount){ $a = new stdClass(); $a->max = $maxcount; $a->reseturl = "view.php?id=$cm->id&mode=$mode&search=&advanced=0"; echo $OUTPUT->box_start(); echo get_string('foundnorecords', 'data', $a); echo $OUTPUT->box_end(); } else { echo $OUTPUT->box_start(); echo get_string('norecords', 'data'); echo $OUTPUT->box_end(); } } else { // We have some records to print. $formurl = new moodle_url('/mod/data/view.php', ['d' => $data->id, 'sesskey' => sesskey()]); echo html_writer::start_tag('form', ['action' => $formurl, 'method' => 'post']); if ($maxcount != $totalcount) { $a = new stdClass(); $a->num = $totalcount; $a->max = $maxcount; $a->reseturl = "view.php?id=$cm->id&mode=$mode&search=&advanced=0"; echo $OUTPUT->box_start(); echo get_string('foundrecords', 'data', $a); echo $OUTPUT->box_end(); } if ($mode == 'single') { // Single template $baseurl = '/mod/data/view.php'; $baseurlparams = ['d' => $data->id, 'mode' => 'single']; if (!empty($search)) { $baseurlparams['filter'] = 1; } if (!empty($page)) { $baseurlparams['page'] = $page; } $baseurl = new moodle_url($baseurl, $baseurlparams); echo $OUTPUT->box_start('', 'data-singleview-content'); require_once($CFG->dirroot.'/rating/lib.php'); if ($data->assessed != RATING_AGGREGATE_NONE) { $ratingoptions = new stdClass; $ratingoptions->context = $context; $ratingoptions->component = 'mod_data'; $ratingoptions->ratingarea = 'entry'; $ratingoptions->items = $records; $ratingoptions->aggregate = $data->assessed;//the aggregation method $ratingoptions->scaleid = $data->scale; $ratingoptions->userid = $USER->id; $ratingoptions->returnurl = $baseurl->out(); $ratingoptions->assesstimestart = $data->assesstimestart; $ratingoptions->assesstimefinish = $data->assesstimefinish; $rm = new rating_manager(); $records = $rm->get_ratings($ratingoptions); } $options = [ 'search' => $search, 'page' => $page, 'baseurl' => $baseurl, ]; $parser = $manager->get_template('singletemplate', $options); echo $parser->parse_entries($records); echo $OUTPUT->box_end(); } else { // List template. $baseurl = '/mod/data/view.php'; $baseurlparams = ['d' => $data->id, 'advanced' => $advanced, 'paging' => $paging]; if (!empty($search)) { $baseurlparams['filter'] = 1; } $baseurl = new moodle_url($baseurl, $baseurlparams); echo $OUTPUT->box_start('', 'data-listview-content'); echo $data->listtemplateheader; $options = [ 'search' => $search, 'page' => $page, 'baseurl' => $baseurl, ]; $parser = $manager->get_template('listtemplate', $options); echo $parser->parse_entries($records); echo $data->listtemplatefooter; echo $OUTPUT->box_end(); } $stickyfooter = new mod_data\output\view_footer( $manager, $totalcount, $page, $nowperpage, $baseurl, $parser ); echo $OUTPUT->render($stickyfooter); echo html_writer::end_tag('form'); } } $search = trim($search); if (empty($records)) { $records = array(); } } echo $OUTPUT->footer(); home/smkb8269/public_html/lms.smk-almanshuriyah.sch.id/mod/subsection/view.php000064400000003111152267014450023303 0ustar00. /** * Prints an instance of mod_subsection. * * @package mod_subsection * @copyright 2023 Amaia Anabitarte * @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ use mod_subsection\manager; use core_courseformat\formatactions; require(__DIR__.'/../../config.php'); require_once(__DIR__.'/lib.php'); // Course module id. $id = required_param('id', PARAM_INT); $cm = get_coursemodule_from_id('subsection', $id, 0, false, MUST_EXIST); $manager = manager::create_from_coursemodule($cm); $course = $DB->get_record('course', ['id' => $cm->course], '*', MUST_EXIST); $moduleinstance = $manager->get_instance(); require_login($course, true, $cm); $modulecontext = $manager->get_context(); $manager->set_module_viewed($course); $delegatesection = $manager->get_delegated_section_info(); redirect(new moodle_url('/course/section.php', ['id' => $delegatesection->id])); home/smkb8269/public_html/lms.smk-almanshuriyah.sch.id/mod/workshop/view.php000064400000010622152267043170023007 0ustar00. /** * Prints a particular instance of workshop * * You can have a rather longer description of the file as well, * if you like, and it can span multiple lines. * * @package mod_workshop * @copyright 2009 David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require(__DIR__.'/../../config.php'); require_once(__DIR__.'/locallib.php'); $id = optional_param('id', 0, PARAM_INT); // course_module ID, or $w = optional_param('w', 0, PARAM_INT); // workshop instance ID $editmode = optional_param('editmode', null, PARAM_BOOL); $page = optional_param('page', 0, PARAM_INT); $perpage = optional_param('perpage', null, PARAM_INT); $sortby = optional_param('sortby', 'lastname', PARAM_ALPHA); $sorthow = optional_param('sorthow', 'ASC', PARAM_ALPHA); $eval = optional_param('eval', null, PARAM_PLUGIN); if ($id) { $cm = get_coursemodule_from_id('workshop', $id, 0, false, MUST_EXIST); $course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST); $workshoprecord = $DB->get_record('workshop', array('id' => $cm->instance), '*', MUST_EXIST); } else { $workshoprecord = $DB->get_record('workshop', array('id' => $w), '*', MUST_EXIST); $course = $DB->get_record('course', array('id' => $workshoprecord->course), '*', MUST_EXIST); $cm = get_coursemodule_from_instance('workshop', $workshoprecord->id, $course->id, false, MUST_EXIST); } require_login($course, true, $cm); require_capability('mod/workshop:view', $PAGE->context); $workshop = new workshop($workshoprecord, $cm, $course); $PAGE->set_url($workshop->view_url()); // Mark viewed. $workshop->set_module_viewed(); // If the phase is to be switched, do it asap. This just has to happen after triggering // the event so that the scheduled allocator had a chance to allocate submissions. if ($workshop->phase == workshop::PHASE_SUBMISSION and $workshop->phaseswitchassessment and $workshop->submissionend > 0 and $workshop->submissionend < time()) { $workshop->switch_phase(workshop::PHASE_ASSESSMENT); // Disable the automatic switching now so that it is not executed again by accident // if the teacher changes the phase back to the submission one. $DB->set_field('workshop', 'phaseswitchassessment', 0, array('id' => $workshop->id)); $workshop->phaseswitchassessment = 0; } if (!is_null($editmode) && $PAGE->user_allowed_editing()) { $USER->editing = $editmode; } $workshop->init_initial_bar(); $userplan = new workshop_user_plan($workshop, $USER->id); foreach ($userplan->phases as $phase) { if ($phase->active) { $currentphasetitle = $phase->title; } } $PAGE->set_title($workshop->name . " (" . $currentphasetitle . ")"); $PAGE->set_heading($course->fullname); if ($perpage and $perpage > 0 and $perpage <= 1000) { require_sesskey(); set_user_preference('workshop_perpage', $perpage); redirect($PAGE->url); } if ($eval) { require_sesskey(); require_capability('mod/workshop:overridegrades', $workshop->context); $workshop->set_grading_evaluation_method($eval); redirect($PAGE->url); } $heading = $OUTPUT->heading_with_help(format_string($workshop->name), 'userplan', 'workshop'); $heading = preg_replace('/]*>([.\s\S]*)<\/h2>/', '$1', $heading); $PAGE->activityheader->set_attrs([ 'title' => $PAGE->activityheader->is_title_allowed() ? $heading : "", 'description' => '' ]); $output = $PAGE->get_renderer('mod_workshop'); // Output starts here. echo $output->header(); echo $output->view_page($workshop, $userplan, $currentphasetitle, $page, $sortby, $sorthow); $PAGE->requires->js_call_amd('mod_workshop/workshopview', 'init'); echo $output->footer(); home/smkb8269/public_html/lms.smk-almanshuriyah.sch.id/mod/wiki/view.php000064400000024230152267057630022104 0ustar00. /** * This file contains all necessary code to view a wiki page * * @package mod_wiki * @copyright 2009 Marc Alier, Jordi Piguillem marc.alier@upc.edu * @copyright 2009 Universitat Politecnica de Catalunya http://www.upc.edu * * @author Jordi Piguillem * @author Marc Alier * @author David Jimenez * @author Josep Arus * @author Kenneth Riba * * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once('../../config.php'); require_once($CFG->dirroot . '/mod/wiki/lib.php'); require_once($CFG->dirroot . '/mod/wiki/locallib.php'); require_once($CFG->dirroot . '/mod/wiki/pagelib.php'); $id = optional_param('id', 0, PARAM_INT); // Course Module ID $pageid = optional_param('pageid', 0, PARAM_INT); // Page ID $wid = optional_param('wid', 0, PARAM_INT); // Wiki ID $title = optional_param('title', '', PARAM_TEXT); // Page Title $currentgroup = optional_param('group', 0, PARAM_INT); // Group ID $userid = optional_param('uid', 0, PARAM_INT); // User ID $groupanduser = optional_param('groupanduser', 0, PARAM_TEXT); $edit = optional_param('edit', -1, PARAM_BOOL); $action = optional_param('action', '', PARAM_ALPHA); $swid = optional_param('swid', 0, PARAM_INT); // Subwiki ID $PAGE->force_settings_menu(); $PAGE->add_body_class('limitedwidth'); /* * Case 0: * * User that comes from a course. First wiki page must be shown * * URL params: id -> course module id * */ if ($id) { // Cheacking course module instance if (!$cm = get_coursemodule_from_id('wiki', $id)) { throw new \moodle_exception('invalidcoursemodule'); } // Checking course instance $course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST); require_course_login($course, true, $cm); // Checking wiki instance if (!$wiki = wiki_get_wiki($cm->instance)) { throw new \moodle_exception('incorrectwikiid', 'wiki'); } $PAGE->set_cm($cm); // Getting the subwiki corresponding to that wiki, group and user. // // Also setting the page if it exists or getting the first page title form // that wiki // Getting current group id $currentgroup = groups_get_activity_group($cm); // Getting current user id if ($wiki->wikimode == 'individual') { $userid = $USER->id; } else { $userid = 0; } // Getting subwiki. If it does not exists, redirecting to create page if (!$subwiki = wiki_get_subwiki_by_group($wiki->id, $currentgroup, $userid)) { $params = array('wid' => $wiki->id, 'group' => $currentgroup, 'uid' => $userid, 'title' => $wiki->firstpagetitle); $url = new moodle_url('/mod/wiki/create.php', $params); redirect($url); } // Getting first page. If it does not exists, redirecting to create page if (!$page = wiki_get_first_page($subwiki->id, $wiki)) { $params = array('swid'=>$subwiki->id, 'title'=>$wiki->firstpagetitle); $url = new moodle_url('/mod/wiki/create.php', $params); redirect($url); } /* * Case 1: * * A user wants to see a page. * * URL Params: pageid -> page id * */ } elseif ($pageid) { // Checking page instance if (!$page = wiki_get_page($pageid)) { throw new \moodle_exception('incorrectpageid', 'wiki'); } // Checking subwiki if (!$subwiki = wiki_get_subwiki($page->subwikiid)) { throw new \moodle_exception('incorrectsubwikiid', 'wiki'); } // Checking wiki instance of that subwiki if (!$wiki = wiki_get_wiki($subwiki->wikiid)) { throw new \moodle_exception('incorrectwikiid', 'wiki'); } // Checking course module instance if (!$cm = get_coursemodule_from_instance("wiki", $subwiki->wikiid)) { throw new \moodle_exception('invalidcoursemodule'); } $currentgroup = $subwiki->groupid; // Checking course instance $course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST); require_course_login($course, true, $cm); /* * Case 2: * * Trying to read a page from another group or user * * Page can exists or not. * * If it exists, page must be shown * * If it does not exists, system must ask for its creation * * URL params: wid -> subwiki id (required) * title -> a page title (required) * group -> group id (optional) * uid -> user id (optional) * groupanduser -> (optional) */ } elseif ($wid && $title) { // Setting wiki instance if (!$wiki = wiki_get_wiki($wid)) { throw new \moodle_exception('incorrectwikiid', 'wiki'); } // Checking course module if (!$cm = get_coursemodule_from_instance("wiki", $wiki->id)) { throw new \moodle_exception('invalidcoursemodule'); } // Checking course instance $course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST); require_course_login($course, true, $cm); $groupmode = groups_get_activity_groupmode($cm); // This is where people will land when they change groups using the drop-down selector. // Set the activity group so tabs and content are shown correctly. $currentgroup = groups_get_activity_group($cm, true); if ($wiki->wikimode == 'individual' && ($groupmode == SEPARATEGROUPS || $groupmode == VISIBLEGROUPS)) { list($gid, $uid) = explode('-', $groupanduser); } else if ($wiki->wikimode == 'individual') { $gid = 0; $uid = $userid; } else if ($groupmode == NOGROUPS) { $gid = 0; $uid = 0; } else { $gid = $currentgroup; $uid = 0; } // Getting subwiki instance. If it does not exists, redirect to create page if (!$subwiki = wiki_get_subwiki_by_group($wiki->id, $gid, $uid)) { $context = context_module::instance($cm->id); $modeanduser = $wiki->wikimode == 'individual' && $uid != $USER->id; $modeandgroupmember = $wiki->wikimode == 'collaborative' && !groups_is_member($gid); $manage = has_capability('mod/wiki:managewiki', $context); $edit = has_capability('mod/wiki:editpage', $context); $manageandedit = $manage && $edit; if ($groupmode == VISIBLEGROUPS and ($modeanduser || $modeandgroupmember) and !$manageandedit) { throw new \moodle_exception('nocontent', 'wiki'); } $params = array('wid' => $wiki->id, 'group' => $gid, 'uid' => $uid, 'title' => $title); $url = new moodle_url('/mod/wiki/create.php', $params); redirect($url); } // Checking is there is a page with this title. If it does not exists, redirect to first page if (!$page = wiki_get_page_by_title($subwiki->id, $title)) { $params = array('wid' => $wiki->id, 'group' => $gid, 'uid' => $uid, 'title' => $wiki->firstpagetitle); // Check to see if the first page has been created if (!wiki_get_page_by_title($subwiki->id, $wiki->firstpagetitle)) { $url = new moodle_url('/mod/wiki/create.php', $params); } else { $url = new moodle_url('/mod/wiki/view.php', $params); } redirect($url); } // /* // * Case 3: // * // * A user switches group when is 'reading' a non-existent page. // * // * URL Params: wid -> wiki id // * title -> page title // * currentgroup -> group id // * // */ //} elseif ($wid && $title && $currentgroup) { // // // Checking wiki instance // if (!$wiki = wiki_get_wiki($wid)) { // throw new \moodle_exception('incorrectwikiid', 'wiki'); // } // // // Checking subwiki instance // // @TODO: Fix call to wiki_get_subwiki_by_group // if (!$currentgroup = groups_get_activity_group($cm)){ // $currentgroup = 0; // } // if (!$subwiki = wiki_get_subwiki_by_group($wid, $currentgroup)) { // throw new \moodle_exception('incorrectsubwikiid', 'wiki'); // } // // // Checking page instance // if ($page = wiki_get_page_by_title($subwiki->id, $title)) { // unset($title); // } // // // Checking course instance // $course = $DB->get_record('course', array('id'=>$cm->course), '*', MUST_EXIST); // // // Checking course module instance // if (!$cm = get_coursemodule_from_instance("wiki", $wiki->id, $course->id)) { // throw new \moodle_exception('invalidcoursemodule'); // } // // $subwiki = null; // $page = null; // // /* // * Case 4: // * // * Error. No more options // */ } else { throw new \moodle_exception('invalidparameters', 'wiki'); } if (!wiki_user_can_view($subwiki, $wiki)) { throw new \moodle_exception('cannotviewpage', 'wiki'); } if (($edit != - 1) and $PAGE->user_allowed_editing()) { $USER->editing = $edit; } $wikipage = new page_wiki_view($wiki, $subwiki, $cm); $wikipage->set_gid($currentgroup); $wikipage->set_page($page); $context = context_module::instance($cm->id); if ($pageid) { wiki_page_view($wiki, $page, $course, $cm, $context, null, null, $subwiki); } else if ($id) { wiki_view($wiki, $course, $cm, $context); } else if ($wid && $title) { $other = array( 'title' => $title, 'wid' => $wid, 'group' => $gid, 'groupanduser' => $groupanduser ); wiki_page_view($wiki, $page, $course, $cm, $context, $uid, $other, $subwiki); } $wikipage->print_header(); $wikipage->print_content(); $wikipage->print_footer(); home/smkb8269/public_html/lms.smk-almanshuriyah.sch.id/mod/forum/view.php000064400000024616152267104530022271 0ustar00. /** * Displays the list of discussions in a forum. * * @package mod_forum * @copyright 2019 Andrew Nicols * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ use mod_forum\grades\forum_gradeitem; require_once('../../config.php'); $managerfactory = mod_forum\local\container::get_manager_factory(); $legacydatamapperfactory = mod_forum\local\container::get_legacy_data_mapper_factory(); $vaultfactory = mod_forum\local\container::get_vault_factory(); $forumvault = $vaultfactory->get_forum_vault(); $discussionvault = $vaultfactory->get_discussion_vault(); $postvault = $vaultfactory->get_post_vault(); $discussionlistvault = $vaultfactory->get_discussions_in_forum_vault(); $cmid = optional_param('id', 0, PARAM_INT); $forumid = optional_param('f', 0, PARAM_INT); $mode = optional_param('mode', 0, PARAM_INT); $showall = optional_param('showall', '', PARAM_INT); $pageno = optional_param('page', 0, PARAM_INT); $search = optional_param('search', '', PARAM_CLEAN); $pageno = optional_param('p', $pageno, PARAM_INT); $pagesize = optional_param('s', $CFG->forum_manydiscussions ?? 0, PARAM_INT); $sortorder = optional_param('o', null, PARAM_INT); if (!$cmid && !$forumid) { throw new \moodle_exception('missingparameter'); } if ($cmid) { $forum = $forumvault->get_from_course_module_id($cmid); if (empty($forum)) { throw new \moodle_exception('Unable to find forum with cmid ' . $cmid); } } else { $forum = $forumvault->get_from_id($forumid); if (empty($forum)) { throw new \moodle_exception('Unable to find forum with id ' . $forumid); } } if (!empty($showall)) { // The user wants to see all discussions. $pageno = 0; $pagesize = 0; } $urlfactory = mod_forum\local\container::get_url_factory(); $capabilitymanager = $managerfactory->get_capability_manager($forum); $url = $urlfactory->get_forum_view_url_from_forum($forum); $PAGE->set_url($url); $course = $forum->get_course_record(); $coursemodule = $forum->get_course_module_record(); $cm = \cm_info::create($coursemodule); require_course_login($course, true, $cm); $istypesingle = $forum->get_type() === 'single'; $saveddisplaymode = get_user_preferences('forum_displaymode', $CFG->forum_displaymode); if ($mode) { $displaymode = $mode; } else { $displaymode = $saveddisplaymode; } if (get_user_preferences('forum_useexperimentalui', false)) { if ($displaymode == FORUM_MODE_NESTED) { $displaymode = FORUM_MODE_NESTED_V2; } } else { if ($displaymode == FORUM_MODE_NESTED_V2) { $displaymode = FORUM_MODE_NESTED; } } if ($displaymode != $saveddisplaymode) { set_user_preference('forum_displaymode', $displaymode); } $PAGE->set_context($forum->get_context()); $PAGE->set_title($forum->get_name()); $PAGE->add_body_class('forumtype-' . $forum->get_type()); $PAGE->set_heading($course->fullname); $PAGE->add_header_action(forum_search_form($course, $search)); if ($istypesingle && $displaymode == FORUM_MODE_NESTED_V2) { $PAGE->add_body_class('nested-v2-display-mode reset-style'); $settingstrigger = $OUTPUT->render_from_template('mod_forum/settings_drawer_trigger', null); $PAGE->add_header_action($settingstrigger); } if (empty($cm->visible) && !has_capability('moodle/course:viewhiddenactivities', $forum->get_context())) { redirect( $urlfactory->get_course_url_from_forum($forum), get_string('activityiscurrentlyhidden'), null, \core\output\notification::NOTIFY_WARNING ); } if (!$capabilitymanager->can_view_discussions($USER)) { redirect( $urlfactory->get_course_url_from_forum($forum), get_string('noviewdiscussionspermission', 'forum'), null, \core\output\notification::NOTIFY_WARNING ); } // Mark viewed and trigger the course_module_viewed event. $forumdatamapper = $legacydatamapperfactory->get_forum_data_mapper(); $forumrecord = $forumdatamapper->to_legacy_object($forum); $PAGE->set_activity_record($forumrecord); forum_view( $forumrecord, $forum->get_course_record(), $forum->get_course_module_record(), $forum->get_context() ); // Return here if we post or set subscription etc. $SESSION->fromdiscussion = qualified_me(); if (!empty($CFG->enablerssfeeds) && !empty($CFG->forum_enablerssfeeds) && $forum->get_rss_type() && $forum->get_rss_articles()) { require_once("{$CFG->libdir}/rsslib.php"); $rsstitle = format_string($course->shortname, true, [ 'context' => context_course::instance($course->id), ]) . ': ' . format_string($forum->get_name()); rss_add_http_header($forum->get_context(), 'mod_forum', $forumrecord, $rsstitle); } $activityheader = $PAGE->activityheader; $pageheader = []; if ($activityheader->is_title_allowed()) { $pageheader['title'] = format_string($forum->get_name()); } // Fetch the current groupid. $groupid = groups_get_activity_group($cm, true) ?: null; if ($istypesingle || empty($forum->get_intro())) { $pageheader['description'] = ''; } $activityheader->set_attrs($pageheader); echo $OUTPUT->header(); $rendererfactory = mod_forum\local\container::get_renderer_factory(); // The elements for view action are rendered and added to the page. echo forum_activity_actionbar($forum, $groupid, $course, $search); if ($sortorder) { set_user_preference('forum_discussionlistsortorder', $sortorder); } $sortorder = get_user_preferences('forum_discussionlistsortorder', $discussionlistvault::SORTORDER_LASTPOST_DESC); switch ($forum->get_type()) { case 'single': $forumgradeitem = forum_gradeitem::load_from_forum_entity($forum); if ($capabilitymanager->can_grade($USER)) { if ($forumgradeitem->is_grading_enabled()) { $groupid = groups_get_activity_group($cm, true) ?: null; $gradeobj = (object) [ 'contextid' => $forum->get_context()->id, 'cmid' => $forum->get_course_module_record()->id, 'name' => format_string($forum->get_name()), 'courseid' => $course->id, 'coursename' => format_string($course->shortname), 'experimentaldisplaymode' => $displaymode == FORUM_MODE_NESTED_V2, 'groupid' => $groupid, 'gradingcomponent' => $forumgradeitem->get_grading_component_name(), 'gradingcomponentsubtype' => $forumgradeitem->get_grading_component_subtype(), 'sendstudentnotifications' => $forum->should_notify_students_default_when_grade_for_forum(), 'gradeonlyactiveusers' => $forumgradeitem->should_grade_only_active_users(), ]; echo $OUTPUT->render_from_template('mod_forum/grades/grade_button', $gradeobj); } } else { if ($forumgradeitem->is_grading_enabled()) { $groupid = groups_get_activity_group($cm, true) ?: null; $gradeobj = (object) [ 'contextid' => $forum->get_context()->id, 'cmid' => $forum->get_course_module_record()->id, 'name' => format_string($forum->get_name()), 'courseid' => $course->id, 'coursename' => format_string($course->shortname), 'groupid' => $groupid, 'userid' => $USER->id, 'gradingcomponent' => $forumgradeitem->get_grading_component_name(), 'gradingcomponentsubtype' => $forumgradeitem->get_grading_component_subtype(), ]; echo $OUTPUT->render_from_template('mod_forum/grades/view_grade_button', $gradeobj); } } $discussion = $discussionvault->get_last_discussion_in_forum($forum); $discussioncount = $discussionvault->get_count_discussions_in_forum($forum); $hasmultiplediscussions = $discussioncount > 1; $discussionsrenderer = $rendererfactory->get_single_discussion_list_renderer($forum, $discussion, $hasmultiplediscussions, $displaymode); $post = $postvault->get_from_id($discussion->get_first_post_id()); $orderpostsby = $displaymode == FORUM_MODE_FLATNEWEST ? 'created DESC' : 'created ASC'; $replies = $postvault->get_replies_to_post( $USER, $post, $capabilitymanager->can_view_any_private_reply($USER), $orderpostsby ); echo $discussionsrenderer->render($USER, $post, $replies); if (!$CFG->forum_usermarksread && forum_tp_is_tracked($forumrecord, $USER)) { $postids = array_map(function($post) { return $post->get_id(); }, array_merge([$post], array_values($replies))); forum_tp_mark_posts_read($USER, $postids); } break; case 'blog': $discussionsrenderer = $rendererfactory->get_blog_discussion_list_renderer($forum); // Blog forums always show discussions newest first. echo $discussionsrenderer->render($USER, $cm, $groupid, $discussionlistvault::SORTORDER_CREATED_DESC, $pageno, $pagesize, null, false); if (!$CFG->forum_usermarksread && forum_tp_is_tracked($forumrecord, $USER)) { $discussions = mod_forum_get_discussion_summaries($forum, $USER, $groupid, null, $pageno, $pagesize); $firstpostids = array_map(function($discussion) { return $discussion->get_first_post()->get_id(); }, array_values($discussions)); forum_tp_mark_posts_read($USER, $firstpostids); } break; default: $discussionsrenderer = $rendererfactory->get_discussion_list_renderer($forum); echo $discussionsrenderer->render($USER, $cm, $groupid, $sortorder, $pageno, $pagesize, $displaymode, false); } echo $OUTPUT->footer(); home/smkb8269/public_html/lms.smk-almanshuriyah.sch.id/mod/choice/view.php000064400000023272152267105340022370 0ustar00libdir . '/completionlib.php'); $id = required_param('id', PARAM_INT); // Course Module ID $action = optional_param('action', '', PARAM_ALPHANUMEXT); $attemptids = optional_param_array('attemptid', array(), PARAM_INT); // Get array of responses to delete or modify. $userids = optional_param_array('userid', array(), PARAM_INT); // Get array of users whose choices need to be modified. $notify = optional_param('notify', '', PARAM_ALPHA); $url = new moodle_url('/mod/choice/view.php', array('id'=>$id)); if ($action !== '') { $url->param('action', $action); } $PAGE->set_url($url); if (! $cm = get_coursemodule_from_id('choice', $id)) { throw new \moodle_exception('invalidcoursemodule'); } $cm = cm_info::create($cm); if (! $course = $DB->get_record("course", array("id" => $cm->course))) { throw new \moodle_exception('coursemisconf'); } require_course_login($course, false, $cm); if (!$choice = choice_get_choice($cm->instance)) { throw new \moodle_exception('invalidcoursemodule'); } $strchoice = get_string('modulename', 'choice'); $strchoices = get_string('modulenameplural', 'choice'); $context = context_module::instance($cm->id); list($choiceavailable, $warnings) = choice_get_availability_status($choice); if ($action == 'delchoice' and confirm_sesskey() and is_enrolled($context, NULL, 'mod/choice:choose') and $choice->allowupdate and $choiceavailable) { $answercount = $DB->count_records('choice_answers', array('choiceid' => $choice->id, 'userid' => $USER->id)); if ($answercount > 0) { $choiceanswers = $DB->get_records('choice_answers', array('choiceid' => $choice->id, 'userid' => $USER->id), '', 'id'); $todelete = array_keys($choiceanswers); choice_delete_responses($todelete, $choice, $cm, $course); redirect("view.php?id=$cm->id"); } } $PAGE->set_title($choice->name); $PAGE->set_heading($course->fullname); /// Submit any new data if there is any if (data_submitted() && !empty($action) && confirm_sesskey()) { $timenow = time(); if (has_capability('mod/choice:deleteresponses', $context)) { if ($action === 'delete') { // Some responses need to be deleted. choice_delete_responses($attemptids, $choice, $cm, $course); redirect("view.php?id=$cm->id"); } if (preg_match('/^choose_(\d+)$/', $action, $actionmatch)) { // Modify responses of other users. $newoptionid = (int)$actionmatch[1]; choice_modify_responses($userids, $attemptids, $newoptionid, $choice, $cm, $course); redirect("view.php?id=$cm->id"); } } // Redirection after all POSTs breaks block editing, we need to be more specific! if ($choice->allowmultiple) { $answer = optional_param_array('answer', array(), PARAM_INT); } else { $answer = optional_param('answer', '', PARAM_INT); } if (!$choiceavailable) { $reason = current(array_keys($warnings)); throw new moodle_exception($reason, 'choice', '', $warnings[$reason]); } if ($answer && is_enrolled($context, null, 'mod/choice:choose')) { choice_user_submit_response($answer, $choice, $USER->id, $course, $cm); redirect(new moodle_url('/mod/choice/view.php', array('id' => $cm->id, 'notify' => 'choicesaved', 'sesskey' => sesskey()))); } else if (empty($answer) and $action === 'makechoice') { // We cannot use the 'makechoice' alone because there might be some legacy renderers without it, // outdated renderers will not get the 'mustchoose' message - bad luck. redirect(new moodle_url('/mod/choice/view.php', array('id' => $cm->id, 'notify' => 'mustchooseone', 'sesskey' => sesskey()))); } } // Completion and trigger events. choice_view($choice, $course, $cm, $context); $PAGE->add_body_class('limitedwidth'); echo $OUTPUT->header(); if ($notify and confirm_sesskey()) { if ($notify === 'choicesaved') { echo $OUTPUT->notification(get_string('choicesaved', 'choice'), 'notifysuccess'); } else if ($notify === 'mustchooseone') { echo $OUTPUT->notification(get_string('mustchooseone', 'choice'), 'notifyproblem'); } } /// Display the choice and possibly results $eventdata = array(); $eventdata['objectid'] = $choice->id; $eventdata['context'] = $context; /// Check to see if groups are being used in this choice $groupmode = groups_get_activity_groupmode($cm); // Check if we want to include responses from inactive users. $onlyactive = $choice->includeinactive ? false : true; $allresponses = choice_get_response_data($choice, $cm, $groupmode, $onlyactive); // Big function, approx 6 SQL calls per user. if (has_capability('mod/choice:readresponses', $context) && !$PAGE->has_secondary_navigation()) { choice_show_reportlink($allresponses, $cm); } echo '
'; $timenow = time(); $current = choice_get_my_response($choice); //if user has already made a selection, and they are not allowed to update it or if choice is not open, show their selected answer. if (isloggedin() && (!empty($current)) && (empty($choice->allowupdate) || ($timenow > $choice->timeclose)) ) { $choicetexts = array(); foreach ($current as $c) { $choicetexts[] = format_string(choice_get_option_text($choice, $c->optionid)); } echo $OUTPUT->box(get_string("yourselection", "choice") . ": " . implode('; ', $choicetexts), 'generalbox', 'yourselection'); } /// Print the form $choiceopen = true; if ((!empty($choice->timeopen)) && ($choice->timeopen > $timenow)) { if ($choice->showpreview) { echo $OUTPUT->box(get_string('previewing', 'choice'), 'generalbox alert'); } else { echo $OUTPUT->footer(); exit; } } else if ((!empty($choice->timeclose)) && ($timenow > $choice->timeclose)) { $choiceopen = false; } if ( (!$current or $choice->allowupdate) and $choiceopen and is_enrolled($context, NULL, 'mod/choice:choose')) { // Show information on how the results will be published to students. $publishinfo = null; switch ($choice->showresults) { case CHOICE_SHOWRESULTS_NOT: $publishinfo = get_string('publishinfonever', 'choice'); break; case CHOICE_SHOWRESULTS_AFTER_ANSWER: if ($choice->publish == CHOICE_PUBLISH_ANONYMOUS) { $publishinfo = get_string('publishinfoanonafter', 'choice'); } else { $publishinfo = get_string('publishinfofullafter', 'choice'); } break; case CHOICE_SHOWRESULTS_AFTER_CLOSE: if ($choice->publish == CHOICE_PUBLISH_ANONYMOUS) { $publishinfo = get_string('publishinfoanonclose', 'choice'); } else { $publishinfo = get_string('publishinfofullclose', 'choice'); } break; default: // No need to inform the user in the case of CHOICE_SHOWRESULTS_ALWAYS since it's already obvious that the results are // being published. break; } // Show info if necessary. if (!empty($publishinfo)) { echo $OUTPUT->notification($publishinfo, 'info'); } // They haven't made their choice yet or updates allowed and choice is open. $options = choice_prepare_options($choice, $USER, $cm, $allresponses); $renderer = $PAGE->get_renderer('mod_choice'); echo $renderer->display_options($options, $cm->id, $choice->display, $choice->allowmultiple); $choiceformshown = true; } else { $choiceformshown = false; } if (!$choiceformshown) { $sitecontext = context_system::instance(); if (isguestuser()) { // Guest account echo $OUTPUT->confirm(get_string('noguestchoose', 'choice').'

'.get_string('liketologin'), get_login_url(), new moodle_url('/course/view.php', array('id'=>$course->id))); } else if (!is_enrolled($context)) { // Only people enrolled can make a choice $SESSION->wantsurl = qualified_me(); $SESSION->enrolcancel = get_local_referer(false); $coursecontext = context_course::instance($course->id); $courseshortname = format_string($course->shortname, true, array('context' => $coursecontext)); echo $OUTPUT->box_start('generalbox', 'notice'); echo '

'. get_string('notenrolledchoose', 'choice') .'

'; echo $OUTPUT->container_start('continuebutton'); echo $OUTPUT->single_button(new moodle_url('/enrol/index.php?', array('id'=>$course->id)), get_string('enrolme', 'core_enrol', $courseshortname)); echo $OUTPUT->container_end(); echo $OUTPUT->box_end(); } } // print the results at the bottom of the screen if (choice_can_view_results($choice, $current, $choiceopen)) { $results = prepare_choice_show_results($choice, $course, $cm, $allresponses); $renderer = $PAGE->get_renderer('mod_choice'); if ($results->publish) { // If set to publish full results, display a heading for the responses section. echo html_writer::tag('h3', format_string(get_string("responses", "choice")), ['class' => 'mt-4']); } if ($groupmode) { // If group mode is enabled, display the groups selector. groups_get_activity_group($cm, true); $groupsactivitymenu = groups_print_activity_menu($cm, new moodle_url('/mod/choice/view.php', ['id' => $id]), true); echo html_writer::div($groupsactivitymenu, 'mt-3 mb-1'); } $resultstable = $renderer->display_result($results); echo $OUTPUT->box($resultstable); } else if (!$choiceformshown) { echo $OUTPUT->box(get_string('noresultsviewable', 'choice')); } echo $OUTPUT->footer(); home/smkb8269/public_html/lms.smk-almanshuriyah.sch.id/mod/lesson/view.php000064400000026352152267106760022452 0ustar00. /** * This page prints a particular instance of lesson * * @package mod_lesson * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or late **/ define('NO_OUTPUT_BUFFERING', true); require_once(__DIR__ . '/../../config.php'); require_once($CFG->dirroot.'/mod/lesson/locallib.php'); require_once($CFG->libdir . '/grade/constants.php'); $id = required_param('id', PARAM_INT); // Course Module ID $pageid = optional_param('pageid', null, PARAM_INT); // Lesson Page ID $edit = optional_param('edit', -1, PARAM_BOOL); $userpassword = optional_param('userpassword','',PARAM_RAW); $backtocourse = optional_param('backtocourse', false, PARAM_RAW); $cm = get_coursemodule_from_id('lesson', $id, 0, false, MUST_EXIST); $course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST); $lesson = new lesson($DB->get_record('lesson', array('id' => $cm->instance), '*', MUST_EXIST), $cm, $course); require_login($course, false, $cm); if ($backtocourse) { redirect(new moodle_url('/course/view.php', array('id'=>$course->id))); } // Apply overrides. $lesson->update_effective_access($USER->id); $url = new moodle_url('/mod/lesson/view.php', array('id'=>$id)); if ($pageid !== null) { $url->param('pageid', $pageid); } $PAGE->set_url($url); $PAGE->force_settings_menu(); $PAGE->add_body_class('limitedwidth'); $context = $lesson->context; $canmanage = $lesson->can_manage(); $lessonoutput = $PAGE->get_renderer('mod_lesson'); $editbuttons = new \mod_lesson\output\edit_action_buttons($lesson); $reviewmode = $lesson->is_in_review_mode(); if ($lesson->usepassword && !empty($userpassword)) { require_sesskey(); } // Check these for students only TODO: Find a better method for doing this! if ($timerestriction = $lesson->get_time_restriction_status()) { // Deadline restrictions. echo $lessonoutput->header($lesson, $cm, '', false, null, get_string('notavailable')); echo $lessonoutput->render($editbuttons); // No need to display warnings because activity dates are displayed at the top of the page. echo $lessonoutput->lesson_inaccessible(''); echo $lessonoutput->footer(); exit(); } else if ($passwordrestriction = $lesson->get_password_restriction_status($userpassword)) { // Password protected lesson code. echo $lessonoutput->header($lesson, $cm, '', false, null, get_string('passwordprotectedlesson', 'lesson', format_string($lesson->name))); echo $lessonoutput->render($editbuttons); echo $lessonoutput->login_prompt($lesson, $userpassword !== ''); echo $lessonoutput->footer(); exit(); } else if ($dependenciesrestriction = $lesson->get_dependencies_restriction_status()) { // Check for dependencies. echo $lessonoutput->header($lesson, $cm, '', false, null, get_string('completethefollowingconditions', 'lesson', format_string($lesson->name))); echo $lessonoutput->render($editbuttons); echo $lessonoutput->dependancy_errors($dependenciesrestriction->dependentlesson, $dependenciesrestriction->errors); echo $lessonoutput->footer(); exit(); } // This is called if a student leaves during a lesson. if ($pageid == LESSON_UNSEENBRANCHPAGE) { $pageid = lesson_unseen_question_jump($lesson, $USER->id, $pageid); } // To avoid multiple calls, store the magic property firstpage. $lessonfirstpage = $lesson->firstpage; $lessonfirstpageid = $lessonfirstpage ? $lessonfirstpage->id : false; // display individual pages and their sets of answers // if pageid is EOL then the end of the lesson has been reached // for flow, changed to simple echo for flow styles, michaelp, moved lesson name and page title down $attemptflag = false; if (empty($pageid)) { // make sure there are pages to view if (!$lessonfirstpageid) { if (!$canmanage) { $lesson->add_message(get_string('lessonnotready2', 'lesson')); // a nice message to the student } else { if (!$DB->count_records('lesson_pages', array('lessonid'=>$lesson->id))) { redirect("$CFG->wwwroot/mod/lesson/edit.php?id=$cm->id"); // no pages - redirect to add pages } else { $lesson->add_message(get_string('lessonpagelinkingbroken', 'lesson')); // ok, bad mojo } } } // if no pageid given see if the lesson has been started $retries = $lesson->count_user_retries($USER->id); if ($retries > 0) { $attemptflag = true; } if (isset($USER->modattempts[$lesson->id])) { unset($USER->modattempts[$lesson->id]); // if no pageid, then student is NOT reviewing } $lastpageseen = $lesson->get_last_page_seen($retries); // Check if the lesson was attempted in an external device like the mobile app. // This check makes sense only when the lesson allows offline attempts. if ($lesson->allowofflineattempts && $timers = $lesson->get_user_timers($USER->id, 'starttime DESC', '*', 0, 1)) { $timer = current($timers); if (!empty($timer->timemodifiedoffline)) { $lasttime = format_time(time() - $timer->timemodifiedoffline); $lesson->add_message(get_string('offlinedatamessage', 'lesson', $lasttime), 'warning'); } } // Check to see if end of lesson was reached. if (($lastpageseen !== false && ($lastpageseen != LESSON_EOL))) { // End not reached. Check if the user left. if ($lesson->left_during_timed_session($retries)) { echo $lessonoutput->header($lesson, $cm, '', false, null, get_string('leftduringtimedsession', 'lesson')); echo $lessonoutput->render($editbuttons); if ($lesson->timelimit) { if ($lesson->retake) { $continuelink = new single_button(new moodle_url('/mod/lesson/view.php', array('id' => $cm->id, 'pageid' => $lesson->firstpageid, 'startlastseen' => 'no')), get_string('continue', 'lesson'), 'get'); echo html_writer::div($lessonoutput->message(get_string('leftduringtimed', 'lesson'), $continuelink), 'center leftduring'); } else { $courselink = new single_button(new moodle_url('/course/view.php', array('id' => $PAGE->course->id)), get_string('returntocourse', 'lesson'), 'get'); echo html_writer::div($lessonoutput->message(get_string('leftduringtimednoretake', 'lesson'), $courselink), 'center leftduring'); } } else { echo $lessonoutput->continue_links($lesson, $lastpageseen); } echo $lessonoutput->footer(); exit(); } } if ($attemptflag) { if (!$lesson->retake) { echo $lessonoutput->header($lesson, $cm, 'view', '', null, get_string("noretake", "lesson")); echo $lessonoutput->render($editbuttons); $courselink = new single_button(new moodle_url('/course/view.php', array('id'=>$PAGE->course->id)), get_string('returntocourse', 'lesson'), 'get'); echo $lessonoutput->message(get_string("noretake", "lesson"), $courselink); echo $lessonoutput->footer(); exit(); } } // start at the first page if (!$pageid = $lessonfirstpageid) { echo $lessonoutput->header($lesson, $cm, 'view', '', null); echo $lessonoutput->render($editbuttons); // Lesson currently has no content. A message for display has been prepared and will be displayed by the header method // of the lesson renderer. echo $lessonoutput->footer(); exit(); } /// This is the code for starting a timed test if(!isset($USER->startlesson[$lesson->id]) && !$canmanage) { $lesson->start_timer(); } } $currenttab = 'view'; $extraeditbuttons = false; $lessonpageid = null; $timer = null; if ($pageid != LESSON_EOL) { $lesson->set_module_viewed(); $timer = null; // This is the code updates the lessontime for a timed test. $startlastseen = optional_param('startlastseen', '', PARAM_ALPHA); // Check to see if the user can see the left menu. if (!$canmanage) { $lesson->displayleft = lesson_displayleftif($lesson); $continue = ($startlastseen !== ''); $restart = ($continue && $startlastseen == 'yes'); $timer = $lesson->update_timer($continue, $restart); // Check time limit. if (!$lesson->check_time($timer)) { redirect(new moodle_url('/mod/lesson/view.php', array('id' => $cm->id, 'pageid' => LESSON_EOL, 'outoftime' => 'normal'))); die; // Shouldn't be reached, but make sure. } } list($newpageid, $page, $lessoncontent) = $lesson->prepare_page_and_contents($pageid, $lessonoutput, $reviewmode); if (($edit != -1) && $PAGE->user_allowed_editing()) { $USER->editing = $edit; } $PAGE->set_subpage($page->id); $currenttab = 'view'; $extraeditbuttons = true; $lessonpageid = $page->id; $extrapagetitle = $page->title; lesson_add_fake_blocks($PAGE, $cm, $lesson, $timer); echo $lessonoutput->header($lesson, $cm, $currenttab, $extraeditbuttons, $lessonpageid, $extrapagetitle); $editbuttons->set_currentpage($lessonpageid); echo $lessonoutput->render($editbuttons); if ($attemptflag) { // Get correct heading level for the attempts heading. $headinglevel = $PAGE->activityheader->get_heading_level(); echo $OUTPUT->heading(get_string('attempt', 'lesson', $retries), $headinglevel); } // This calculates and prints the ongoing score. if ($lesson->ongoing && !empty($pageid) && !$reviewmode) { echo $lessonoutput->ongoing_score($lesson); } if ($lesson->displayleft) { echo ''; } echo $lessoncontent; echo $lessonoutput->progress_bar($lesson); echo $lessonoutput->footer(); } else { // End of lesson reached work out grade. // Used to check to see if the student ran out of time. $outoftime = optional_param('outoftime', '', PARAM_ALPHA); $data = $lesson->process_eol_page($outoftime); $lessoncontent = $lessonoutput->display_eol_page($lesson, $data); lesson_add_fake_blocks($PAGE, $cm, $lesson, $timer); echo $lessonoutput->header($lesson, $cm, $currenttab, $extraeditbuttons, $lessonpageid, get_string("congratulations", "lesson")); $editbuttons->set_currentpage($lessonpageid); echo $lessonoutput->render($editbuttons); echo $lessoncontent; echo $lessonoutput->footer(); } home/smkb8269/public_html/lms.smk-almanshuriyah.sch.id/mod/resource/view.php000064400000007714152267107010022764 0ustar00. /** * Resource module version information * * @package mod_resource * @copyright 2009 Petr Skoda {@link http://skodak.org} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require('../../config.php'); require_once($CFG->dirroot.'/mod/resource/lib.php'); require_once($CFG->dirroot.'/mod/resource/locallib.php'); require_once($CFG->libdir.'/completionlib.php'); $id = optional_param('id', 0, PARAM_INT); // Course Module ID $r = optional_param('r', 0, PARAM_INT); // Resource instance ID $redirect = optional_param('redirect', 0, PARAM_BOOL); $forceview = optional_param('forceview', 0, PARAM_BOOL); if ($r) { if (!$resource = $DB->get_record('resource', array('id'=>$r))) { resource_redirect_if_migrated($r, 0); throw new \moodle_exception('invalidaccessparameter'); } $cm = get_coursemodule_from_instance('resource', $resource->id, $resource->course, false, MUST_EXIST); } else { if (!$cm = get_coursemodule_from_id('resource', $id)) { resource_redirect_if_migrated(0, $id); throw new \moodle_exception('invalidcoursemodule'); } $resource = $DB->get_record('resource', array('id'=>$cm->instance), '*', MUST_EXIST); } $course = $DB->get_record('course', array('id'=>$cm->course), '*', MUST_EXIST); require_course_login($course, true, $cm); $context = context_module::instance($cm->id); require_capability('mod/resource:view', $context); // Completion and trigger events. resource_view($resource, $course, $cm, $context); $PAGE->set_url('/mod/resource/view.php', array('id' => $cm->id)); if ($resource->tobemigrated) { resource_print_tobemigrated($resource, $cm, $course); die; } $fs = get_file_storage(); $files = $fs->get_area_files($context->id, 'mod_resource', 'content', 0, 'sortorder DESC, id ASC', false); // TODO: this is not very efficient!! if (count($files) < 1) { resource_print_filenotfound($resource, $cm, $course); die; } else { $file = reset($files); unset($files); } $resource->mainfile = $file->get_filename(); $displaytype = resource_get_final_display_type($resource); if ($displaytype == RESOURCELIB_DISPLAY_OPEN || $displaytype == RESOURCELIB_DISPLAY_DOWNLOAD) { $redirect = true; } // Don't redirect teachers, otherwise they can not access course or module settings. if ($redirect && !course_get_format($course)->has_view_page() && (has_capability('moodle/course:manageactivities', $context) || has_capability('moodle/course:update', context_course::instance($course->id)))) { $redirect = false; } if ($redirect && !$forceview) { // coming from course page or url index page // this redirect trick solves caching problems when tracking views ;-) $path = '/'.$context->id.'/mod_resource/content/'.$resource->revision.$file->get_filepath().$file->get_filename(); $fullurl = moodle_url::make_file_url('/pluginfile.php', $path, $displaytype == RESOURCELIB_DISPLAY_DOWNLOAD); redirect($fullurl); } switch ($displaytype) { case RESOURCELIB_DISPLAY_EMBED: resource_display_embed($resource, $cm, $course, $file); break; case RESOURCELIB_DISPLAY_FRAME: resource_display_frame($resource, $cm, $course, $file); break; default: resource_print_workaround($resource, $cm, $course, $file); break; } home/smkb8269/public_html/lms.smk-almanshuriyah.sch.id/mod/imscp/view.php000064400000005341152267107110022243 0ustar00. /** * IMS CP module main user interface * * @package mod_imscp * @copyright 2009 Petr Skoda {@link http://skodak.org} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require('../../config.php'); require_once($CFG->dirroot . '/mod/imscp/lib.php'); require_once("$CFG->dirroot/mod/imscp/locallib.php"); require_once($CFG->libdir . '/completionlib.php'); $id = optional_param('id', 0, PARAM_INT); // Course module id. $i = optional_param('i', 0, PARAM_INT); // IMS CP instance id. if ($i) { // Two ways to specify the module. $imscp = $DB->get_record('imscp', array('id' => $i), '*', MUST_EXIST); $cm = get_coursemodule_from_instance('imscp', $imscp->id, $imscp->course, false, MUST_EXIST); } else { $cm = get_coursemodule_from_id('imscp', $id, 0, false, MUST_EXIST); $imscp = $DB->get_record('imscp', array('id' => $cm->instance), '*', MUST_EXIST); } $course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST); require_course_login($course, true, $cm); $context = context_module::instance($cm->id); require_capability('mod/imscp:view', $context); // Completion and trigger events. imscp_view($imscp, $course, $cm, $context); $PAGE->set_url('/mod/imscp/view.php', array('id' => $cm->id)); $PAGE->requires->js('/mod/imscp/dummyapi.js', true); $PAGE->requires->string_for_js('navigation', 'imscp'); $PAGE->requires->string_for_js('toc', 'imscp'); $PAGE->requires->string_for_js('hide', 'moodle'); $PAGE->requires->string_for_js('show', 'moodle'); // TODO: find some better way to disable blocks and minimise footer - pagetype just for this does not seem like a good solution. // $PAGE->set_pagelayout('maxcontent'); ? $PAGE->set_title($course->shortname.': '.$imscp->name); $PAGE->set_heading($course->fullname); $PAGE->set_activity_record($imscp); // Verify imsmanifest was parsed properly. if (!$imscp->structure) { redirect(course_get_url($course->id, $cm->section), get_string('deploymenterror', 'imscp')); } echo $OUTPUT->header(); imscp_print_content($imscp, $cm, $course); echo $OUTPUT->footer(); home/smkb8269/public_html/lms.smk-almanshuriyah.sch.id/mod/page/view.php000064400000007307152267107120022051 0ustar00. /** * Page module version information * * @package mod_page * @copyright 2009 Petr Skoda (http://skodak.org) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require('../../config.php'); require_once($CFG->dirroot.'/mod/page/lib.php'); require_once($CFG->dirroot.'/mod/page/locallib.php'); require_once($CFG->libdir.'/completionlib.php'); $id = optional_param('id', 0, PARAM_INT); // Course Module ID $p = optional_param('p', 0, PARAM_INT); // Page instance ID $inpopup = optional_param('inpopup', 0, PARAM_BOOL); if ($p) { if (!$page = $DB->get_record('page', array('id'=>$p))) { throw new \moodle_exception('invalidaccessparameter'); } $cm = get_coursemodule_from_instance('page', $page->id, $page->course, false, MUST_EXIST); } else { if (!$cm = get_coursemodule_from_id('page', $id)) { throw new \moodle_exception('invalidcoursemodule'); } $page = $DB->get_record('page', array('id'=>$cm->instance), '*', MUST_EXIST); } $course = $DB->get_record('course', array('id'=>$cm->course), '*', MUST_EXIST); require_course_login($course, true, $cm); $context = context_module::instance($cm->id); require_capability('mod/page:view', $context); // Completion and trigger events. page_view($page, $course, $cm, $context); $PAGE->set_url('/mod/page/view.php', array('id' => $cm->id)); $options = empty($page->displayoptions) ? [] : (array) unserialize_array($page->displayoptions); $printintro = !empty($options['printintro']); $activityheader = ['hidecompletion' => false]; if (!$printintro) { $activityheader['description'] = ''; } if ($inpopup and $page->display == RESOURCELIB_DISPLAY_POPUP) { $PAGE->set_pagelayout('popup'); $PAGE->set_title($course->shortname.': '.$page->name); $PAGE->set_heading($course->fullname); $PAGE->set_activity_record($page); // Manually populate module intro, which would otherwise not be shown in the popup. if ($printintro) { $activityheader['description'] = format_module_intro('page', $page, $cm->id); } } else { $PAGE->add_body_class('limitedwidth'); $PAGE->set_title($course->shortname.': '.$page->name); $PAGE->set_heading($course->fullname); $PAGE->set_activity_record($page); if (!$PAGE->activityheader->is_title_allowed()) { $activityheader['title'] = ""; } } $PAGE->activityheader->set_attrs($activityheader); echo $OUTPUT->header(); $content = file_rewrite_pluginfile_urls($page->content, 'pluginfile.php', $context->id, 'mod_page', 'content', $page->revision); $formatoptions = new stdClass; $formatoptions->noclean = true; $formatoptions->overflowdiv = true; $formatoptions->context = $context; $content = format_text($content, $page->contentformat, $formatoptions); echo $OUTPUT->box($content, "generalbox center clearfix"); if (!isset($options['printlastmodified']) || !empty($options['printlastmodified'])) { $strlastmodified = get_string("lastmodified"); echo html_writer::div("$strlastmodified: " . userdate($page->timemodified), 'modified'); } echo $OUTPUT->footer(); home/smkb8269/public_html/lms.smk-almanshuriyah.sch.id/mod/folder/view.php000064400000005306152267112230022403 0ustar00. /** * Folder module main user interface * * @package mod_folder * @copyright 2009 Petr Skoda {@link http://skodak.org} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require('../../config.php'); require_once("$CFG->dirroot/mod/folder/locallib.php"); require_once("$CFG->dirroot/repository/lib.php"); require_once($CFG->libdir . '/completionlib.php'); $id = optional_param('id', 0, PARAM_INT); // Course module ID $f = optional_param('f', 0, PARAM_INT); // Folder instance id if ($f) { // Two ways to specify the module $folder = $DB->get_record('folder', array('id'=>$f), '*', MUST_EXIST); $cm = get_coursemodule_from_instance('folder', $folder->id, $folder->course, true, MUST_EXIST); } else { $cm = get_coursemodule_from_id('folder', $id, 0, true, MUST_EXIST); $folder = $DB->get_record('folder', array('id'=>$cm->instance), '*', MUST_EXIST); } $course = $DB->get_record('course', array('id'=>$cm->course), '*', MUST_EXIST); require_course_login($course, true, $cm); $context = context_module::instance($cm->id); require_capability('mod/folder:view', $context); if ($folder->display == FOLDER_DISPLAY_INLINE) { redirect(course_get_url($folder->course, $cm->sectionnum)); } $params = array( 'context' => $context, 'objectid' => $folder->id ); $event = \mod_folder\event\course_module_viewed::create($params); $event->add_record_snapshot('course_modules', $cm); $event->add_record_snapshot('course', $course); $event->add_record_snapshot('folder', $folder); $event->trigger(); // Update 'viewed' state if required by completion system $completion = new completion_info($course); $completion->set_module_viewed($cm); $PAGE->set_url('/mod/folder/view.php', array('id' => $cm->id)); $PAGE->set_title($course->shortname.': '.$folder->name); $PAGE->set_heading($course->fullname); $PAGE->set_activity_record($folder); $PAGE->add_body_class('limitedwidth'); $output = $PAGE->get_renderer('mod_folder'); echo $output->header(); echo $output->display_folder($folder); echo $output->footer(); home/smkb8269/public_html/lms.smk-almanshuriyah.sch.id/mod/h5pactivity/view.php000064400000007376152267113740023421 0ustar00. /** * Prints an instance of mod_h5pactivity. * * @package mod_h5pactivity * @copyright 2020 Ferran Recio * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ use mod_h5pactivity\local\manager; use core_h5p\factory; use core_h5p\player; use core_h5p\helper; require(__DIR__.'/../../config.php'); require_once(__DIR__.'/lib.php'); $id = required_param('id', PARAM_INT); list ($course, $cm) = get_course_and_cm_from_cmid($id, 'h5pactivity'); require_login($course, true, $cm); $manager = manager::create_from_coursemodule($cm); $moduleinstance = $manager->get_instance(); $context = $manager->get_context(); // Trigger module viewed event and completion. $manager->set_module_viewed($course); // Convert display options to a valid object. $factory = new factory(); $core = $factory->get_core(); $config = core_h5p\helper::decode_display_options($core, $moduleinstance->displayoptions); // Instantiate player. $fs = get_file_storage(); $files = $fs->get_area_files($context->id, 'mod_h5pactivity', 'package', 0, 'id', false); $file = reset($files); $fileurl = moodle_url::make_pluginfile_url($file->get_contextid(), $file->get_component(), $file->get_filearea(), $file->get_itemid(), $file->get_filepath(), $file->get_filename(), false); $PAGE->set_url('/mod/h5pactivity/view.php', ['id' => $cm->id]); $shortname = format_string($course->shortname, true, ['context' => $context]); $pagetitle = strip_tags($shortname.': '.format_string($moduleinstance->name)); $PAGE->set_title(format_string($pagetitle)); $PAGE->set_heading(format_string($course->fullname)); $PAGE->set_context($context); echo $OUTPUT->header(); $instance = $manager->get_instance(); // Only non-guest users without permission to submit can see the warning messages (typically a teacher or a content creator). if (!$manager->can_submit() && !isguestuser()) { // Show preview mode message. $message = get_string('previewmode', 'mod_h5pactivity'); echo $OUTPUT->notification($message, \core\output\notification::NOTIFY_INFO, false); // If tracking is disabled, show a warning. if (!$manager->is_tracking_enabled()) { if (has_capability('moodle/course:manageactivities', $context)) { $url = new moodle_url('/course/modedit.php', ['update' => $cm->id]); $message = get_string('trackingdisabled_enable', 'mod_h5pactivity', $url->out()); } else { $message = get_string('trackingdisabled', 'mod_h5pactivity'); } echo $OUTPUT->notification($message, \core\output\notification::NOTIFY_WARNING); } } $extraactions = []; if ($manager->can_view_all_attempts() && $manager->is_tracking_enabled()) { $extraactions[] = new action_link( new moodle_url('/mod/h5pactivity/report.php', ['id' => $cm->id]), get_string('viewattempts', 'mod_h5pactivity', $manager->count_attempts()), null, null, new pix_icon('i/chartbar', '', 'core') ); } echo player::display($fileurl, $config, true, 'mod_h5pactivity', true, $extraactions); echo $OUTPUT->footer(); home/smkb8269/public_html/lms.smk-almanshuriyah.sch.id/mod/scorm/view.php000064400000016705152267117430022267 0ustar00. require_once("../../config.php"); require_once($CFG->dirroot.'/mod/scorm/lib.php'); require_once($CFG->dirroot.'/mod/scorm/locallib.php'); require_once($CFG->dirroot.'/course/lib.php'); $id = optional_param('id', '', PARAM_INT); // Course Module ID, or $a = optional_param('a', '', PARAM_INT); // scorm ID $organization = optional_param('organization', '', PARAM_INT); // organization ID. $action = optional_param('action', '', PARAM_ALPHA); $preventskip = optional_param('preventskip', '', PARAM_INT); // Prevent Skip view, set by javascript redirects. if (!empty($id)) { if (! $cm = get_coursemodule_from_id('scorm', $id, 0, true)) { throw new \moodle_exception('invalidcoursemodule'); } if (! $course = $DB->get_record("course", array("id" => $cm->course))) { throw new \moodle_exception('coursemisconf'); } if (! $scorm = $DB->get_record("scorm", array("id" => $cm->instance))) { throw new \moodle_exception('invalidcoursemodule'); } } else if (!empty($a)) { if (! $scorm = $DB->get_record("scorm", array("id" => $a))) { throw new \moodle_exception('invalidcoursemodule'); } if (! $course = $DB->get_record("course", array("id" => $scorm->course))) { throw new \moodle_exception('coursemisconf'); } if (! $cm = get_coursemodule_from_instance("scorm", $scorm->id, $course->id, true)) { throw new \moodle_exception('invalidcoursemodule'); } } else { throw new \moodle_exception('missingparameter'); } $url = new moodle_url('/mod/scorm/view.php', array('id' => $cm->id)); if ($organization !== '') { $url->param('organization', $organization); } $PAGE->set_url($url); $forcejs = get_config('scorm', 'forcejavascript'); if (!empty($forcejs)) { $PAGE->add_body_class('forcejavascript'); } require_login($course, false, $cm); $context = context_course::instance($course->id); $contextmodule = context_module::instance($cm->id); $launch = false; // Does this automatically trigger a launch based on skipview. if (!empty($scorm->popup)) { $scoid = 0; $orgidentifier = ''; $result = scorm_get_toc($USER, $scorm, $cm->id, TOCFULLURL); // Set last incomplete sco to launch first. if (!empty($result->sco->id)) { $sco = $result->sco; } else { $sco = scorm_get_sco($scorm->launch, SCO_ONLY); } if (!empty($sco)) { $scoid = $sco->id; if (($sco->organization == '') && ($sco->launch == '')) { $orgidentifier = $sco->identifier; } else { $orgidentifier = $sco->organization; } } if (empty($preventskip) && $scorm->skipview >= SCORM_SKIPVIEW_FIRST && has_capability('mod/scorm:skipview', $contextmodule) && !has_capability('mod/scorm:viewreport', $contextmodule)) { // Don't skip users with the capability to view reports. // Do we launch immediately and redirect the parent back ? if ($scorm->skipview == SCORM_SKIPVIEW_ALWAYS || !scorm_has_tracks($scorm->id, $USER->id)) { $launch = true; } } // Redirect back to the section with one section per page ? $courseformat = course_get_format($course)->get_course(); if ($courseformat->format == 'singleactivity') { $courseurl = $url->out(false, array('preventskip' => '1')); } else { $courseurl = course_get_url($course, $cm->sectionnum)->out(false); } $PAGE->requires->data_for_js('scormplayerdata', Array('launch' => $launch, 'currentorg' => $orgidentifier, 'sco' => $scoid, 'scorm' => $scorm->id, 'courseurl' => $courseurl, 'cwidth' => $scorm->width, 'cheight' => $scorm->height, 'popupoptions' => $scorm->options), true); $PAGE->requires->string_for_js('popupsblocked', 'scorm'); $PAGE->requires->string_for_js('popuplaunched', 'scorm'); $PAGE->requires->js('/mod/scorm/view.js', true); } if (isset($SESSION->scorm)) { unset($SESSION->scorm); } $strscorms = get_string("modulenameplural", "scorm"); $strscorm = get_string("modulename", "scorm"); $shortname = format_string($course->shortname, true, array('context' => $context)); $pagetitle = strip_tags($shortname.': '.format_string($scorm->name)); // Trigger module viewed event. scorm_view($scorm, $course, $cm, $contextmodule); if (empty($preventskip) && empty($launch) && (has_capability('mod/scorm:skipview', $contextmodule))) { scorm_simple_play($scorm, $USER, $contextmodule, $cm->id); } // Print the page header. $PAGE->set_title($pagetitle); $PAGE->set_heading($course->fullname); // Let the module handle the display. if (!empty($action) && $action == 'delete' && confirm_sesskey() && has_capability('mod/scorm:deleteownresponses', $contextmodule)) { $PAGE->activityheader->disable(); } else { $PAGE->activityheader->set_description(''); } echo $OUTPUT->header(); if (!empty($action) && confirm_sesskey() && has_capability('mod/scorm:deleteownresponses', $contextmodule)) { if ($action == 'delete') { $confirmurl = new moodle_url($PAGE->url, array('action' => 'deleteconfirm')); echo $OUTPUT->confirm(get_string('deleteuserattemptcheck', 'scorm'), $confirmurl, $PAGE->url); echo $OUTPUT->footer(); exit; } else if ($action == 'deleteconfirm') { // Delete this users attempts. scorm_delete_tracks($scorm->id, null, $USER->id); scorm_update_grades($scorm, $USER->id, true); echo $OUTPUT->notification(get_string('scormresponsedeleted', 'scorm'), 'notifysuccess'); } } // Print the main part of the page. $attemptstatus = ''; if (empty($launch) && ($scorm->displayattemptstatus == SCORM_DISPLAY_ATTEMPTSTATUS_ALL || $scorm->displayattemptstatus == SCORM_DISPLAY_ATTEMPTSTATUS_ENTRY)) { $attemptstatus = scorm_get_attempt_status($USER, $scorm, $cm); } echo $OUTPUT->box(format_module_intro('scorm', $scorm, $cm->id), '', 'intro'); // Check if SCORM available. No need to display warnings because activity dates are displayed at the top of the page. list($available, $warnings) = scorm_get_availability_status($scorm); if ($available && empty($launch)) { scorm_print_launch($USER, $scorm, 'view.php?id='.$cm->id, $cm); } echo $OUTPUT->box($attemptstatus); if (!empty($forcejs)) { $message = $OUTPUT->box(get_string("forcejavascriptmessage", "scorm"), "forcejavascriptmessage"); echo html_writer::tag('noscript', $message); } if (!empty($scorm->popup)) { $PAGE->requires->js_init_call('M.mod_scormform.init'); } echo $OUTPUT->footer(); home/smkb8269/public_html/lms.smk-almanshuriyah.sch.id/mod/quiz/view.php000064400000026764152267117440022143 0ustar00. /** * This page is the entry page into the quiz UI. Displays information about the * quiz to students and teachers, and lets students see their previous attempts. * * @package mod_quiz * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ use core\output\notification; use mod_quiz\access_manager; use mod_quiz\output\list_of_attempts; use mod_quiz\output\renderer; use mod_quiz\output\view_page; use mod_quiz\quiz_attempt; use mod_quiz\quiz_settings; require_once(__DIR__ . '/../../config.php'); require_once($CFG->libdir.'/gradelib.php'); require_once($CFG->dirroot.'/mod/quiz/locallib.php'); require_once($CFG->libdir . '/completionlib.php'); require_once($CFG->dirroot . '/course/format/lib.php'); $id = optional_param('id', 0, PARAM_INT); // Course Module ID, or ... $q = optional_param('q', 0, PARAM_INT); // Quiz ID. if ($id) { $quizobj = quiz_settings::create_for_cmid($id, $USER->id); } else { $quizobj = quiz_settings::create($q, $USER->id); } $quiz = $quizobj->get_quiz(); $cm = $quizobj->get_cm(); $course = $quizobj->get_course(); // Check login and get context. require_login($course, false, $cm); $context = $quizobj->get_context(); require_capability('mod/quiz:view', $context); // Cache some other capabilities we use several times. $canattempt = has_capability('mod/quiz:attempt', $context); $canreviewmine = has_capability('mod/quiz:reviewmyattempts', $context); $canpreview = has_capability('mod/quiz:preview', $context); // Create an object to manage all the other (non-roles) access rules. $timenow = time(); $accessmanager = new access_manager($quizobj, $timenow, has_capability('mod/quiz:ignoretimelimits', $context, null, false)); // Trigger course_module_viewed event and completion. quiz_view($quiz, $course, $cm, $context); // Initialize $PAGE, compute blocks. $PAGE->set_url('/mod/quiz/view.php', ['id' => $cm->id]); // On the quiz view page, the browser back/forwards buttons should force a reload. $PAGE->set_cacheable(false); // Create view object which collects all the information the renderer will need. $viewobj = new view_page(); $viewobj->accessmanager = $accessmanager; $viewobj->canreviewmine = $canreviewmine || $canpreview; // Get this user's attempts. $attempts = quiz_get_user_attempts($quiz->id, $USER->id, 'finished', true); $lastfinishedattempt = end($attempts); $unfinished = false; $unfinishedattemptid = null; if ($unfinishedattempt = quiz_get_user_attempt_unfinished($quiz->id, $USER->id)) { $attempts[] = $unfinishedattempt; // If the attempt is now overdue, deal with that - and pass isonline = false. // We want the student notified in this case. $quizobj->create_attempt_object($unfinishedattempt)->handle_if_time_expired(time(), false); $unfinished = $unfinishedattempt->state == quiz_attempt::IN_PROGRESS || $unfinishedattempt->state == quiz_attempt::OVERDUE; if (!$unfinished) { $lastfinishedattempt = $unfinishedattempt; } $unfinishedattemptid = $unfinishedattempt->id; $unfinishedattempt = null; // To make it clear we do not use this again. } $numattempts = count($attempts); $gradeitemmarks = $quizobj->get_grade_calculator()->compute_grade_item_totals_for_attempts( array_column($attempts, 'uniqueid')); $viewobj->attempts = $attempts; $viewobj->attemptobjs = []; foreach ($attempts as $attempt) { $attemptobj = new quiz_attempt($attempt, $quiz, $cm, $course, false); $attemptobj->set_grade_item_totals($gradeitemmarks[$attempt->uniqueid]); $viewobj->attemptobjs[] = $attemptobj; } $viewobj->attemptslist = new list_of_attempts($timenow); foreach (array_reverse($viewobj->attemptobjs) as $attemptobj) { $viewobj->attemptslist->add_attempt($attemptobj); } // Work out the final grade, checking whether it was overridden in the gradebook. // First, get an initial grade to display. if (!$canpreview) { $mygrade = quiz_get_best_grade($quiz, $USER->id); } else if ($lastfinishedattempt) { // Users who can preview the quiz don't get a proper grade, so work out a // plausible value to display instead, so the page looks right. $mygrade = quiz_rescale_grade($lastfinishedattempt->sumgrades, $quiz, false); } else { $mygrade = null; } // Now, check the grade in the gradebook, if there is one. $mygradeoverridden = false; $gradebookfeedback = ''; $gradeitem = grade_item::fetch([ 'itemtype' => 'mod', 'itemmodule' => 'quiz', 'iteminstance' => $quiz->id, 'itemnumber' => 0, 'courseid' => $course->id, ]); // If there's a grade item grade, then get that grade for this user. // Users who can preview the quiz (eg teachers) won't have a proper grade, // so no point getting their grades here. if (!$canpreview && $gradeitem) { $grade = $gradeitem->get_grade($USER->id, false); $mygrade = $grade->finalgrade; // Use this grade to display in the view page. if ($grade->overridden) { if ($gradeitem->needsupdate) { // It is Error, but let's be consistent with the old code. $mygrade = 0; } $mygradeoverridden = true; } if (!empty($grade->feedback)) { $gradebookfeedback = $grade->feedback; } } $title = $course->shortname . ': ' . format_string($quiz->name); $PAGE->set_title($title); $PAGE->set_heading($course->fullname); if (html_is_blank($quiz->intro)) { $PAGE->activityheader->set_description(''); } $PAGE->add_body_class('limitedwidth'); /** @var renderer $output */ $output = $PAGE->get_renderer('mod_quiz'); // Print overall stats and table with existing attempts. if ($attempts) { // Work out which columns we need, taking account what data is available in each attempt. list($someoptions, $alloptions) = quiz_get_combined_reviewoptions($quiz, $attempts); $viewobj->attemptcolumn = $quiz->attempts != 1; $viewobj->gradecolumn = $someoptions->marks >= question_display_options::MARK_AND_MAX && quiz_has_grades($quiz); $viewobj->markcolumn = $viewobj->gradecolumn && ($quiz->grade != $quiz->sumgrades); $viewobj->overallstats = $lastfinishedattempt && $alloptions->marks >= question_display_options::MARK_AND_MAX; $viewobj->feedbackcolumn = quiz_has_feedback($quiz) && $alloptions->overallfeedback; } $viewobj->timenow = $timenow; $viewobj->numattempts = $numattempts; $viewobj->mygrade = $mygrade; $viewobj->moreattempts = $unfinished || !$accessmanager->is_finished($numattempts, $lastfinishedattempt); $viewobj->mygradeoverridden = $mygradeoverridden; $viewobj->gradebookfeedback = $gradebookfeedback; $viewobj->lastfinishedattempt = $lastfinishedattempt; $viewobj->canedit = has_capability('mod/quiz:manage', $context); $viewobj->editurl = new moodle_url('/mod/quiz/edit.php', ['cmid' => $cm->id]); $viewobj->backtocourseurl = new moodle_url('/course/view.php', ['id' => $course->id]); $viewobj->startattempturl = $quizobj->start_attempt_url(); if ($accessmanager->is_preflight_check_required($unfinishedattemptid)) { $viewobj->preflightcheckform = $accessmanager->get_preflight_check_form( $viewobj->startattempturl, $unfinishedattemptid); } $viewobj->popuprequired = $accessmanager->attempt_must_be_in_popup(); $viewobj->popupoptions = $accessmanager->get_popup_options(); // Display information about this quiz. $viewobj->infomessages = $viewobj->accessmanager->describe_rules(); if ($quiz->attempts != 1) { $viewobj->infomessages[] = get_string('gradingmethod', 'quiz', quiz_get_grading_option_name($quiz->grademethod)); } // Inform user of the grade to pass if non-zero. if ($gradeitem && grade_floats_different($gradeitem->gradepass, 0)) { $a = new stdClass(); $a->grade = quiz_format_grade($quiz, $gradeitem->gradepass); $a->maxgrade = quiz_format_grade($quiz, $quiz->grade); $viewobj->infomessages[] = get_string('gradetopassoutof', 'quiz', $a); } // Determine whether a start attempt button should be displayed. $viewobj->quizhasquestions = $quizobj->has_questions(); $viewobj->preventmessages = []; if (!$viewobj->quizhasquestions) { $viewobj->buttontext = ''; } else { if ($unfinished) { if ($canpreview) { $viewobj->buttontext = get_string('continuepreview', 'quiz'); } else if ($canattempt) { $viewobj->buttontext = get_string('continueattemptquiz', 'quiz'); } } else { if ($canpreview) { $viewobj->buttontext = get_string('previewquizstart', 'quiz'); } else if ($canattempt) { $viewobj->preventmessages = $viewobj->accessmanager->prevent_new_attempt( $viewobj->numattempts, $viewobj->lastfinishedattempt); if ($viewobj->preventmessages) { $viewobj->buttontext = ''; } else if ($viewobj->numattempts == 0) { $viewobj->buttontext = get_string('attemptquiz', 'quiz'); } else { $viewobj->buttontext = get_string('reattemptquiz', 'quiz'); } } } // Users who can preview the quiz should be able to see all messages for not being able to access the quiz. if ($canpreview) { $viewobj->preventmessages = $viewobj->accessmanager->prevent_access(); } else if ($viewobj->buttontext) { // If, so far, we think a button should be printed, so check if they will be allowed to access it. if (!$viewobj->moreattempts) { $viewobj->buttontext = ''; } else if ($canattempt) { $viewobj->preventmessages = $viewobj->accessmanager->prevent_access(); if ($viewobj->preventmessages) { $viewobj->buttontext = ''; } } } // If the quiz has any invalid questions, we cannot attempt it. if (in_array('missingtype', $quizobj->get_all_question_types_used())) { $viewobj->preventmessages[] = $OUTPUT->notification( get_string('quizinvalidquestions', 'mod_quiz'), notification::NOTIFY_ERROR, false); $viewobj->buttontext = ''; } } $viewobj->showbacktocourse = ($viewobj->buttontext === '' && course_get_format($course)->has_view_page()); echo $OUTPUT->header(); if (!empty($gradinginfo->errors)) { foreach ($gradinginfo->errors as $error) { $errortext = new notification($error, notification::NOTIFY_ERROR); echo $OUTPUT->render($errortext); } } if (isguestuser()) { // Guests can't do a quiz, so offer them a choice of logging in or going back. echo $output->view_page_guest($course, $quiz, $cm, $context, $viewobj->infomessages, $viewobj); } else if (!isguestuser() && !($canattempt || $canpreview || $viewobj->canreviewmine)) { // If they are not enrolled in this course in a good enough role, tell them to enrol. echo $output->view_page_notenrolled($course, $quiz, $cm, $context, $viewobj->infomessages, $viewobj); } else { echo $output->view_page($course, $quiz, $cm, $context, $viewobj); } echo $OUTPUT->footer(); home/smkb8269/public_html/lms.smk-almanshuriyah.sch.id/mod/glossary/view.php000064400000042667152267120360023011 0ustar00libdir . '/completionlib.php'); require_once("$CFG->libdir/rsslib.php"); $id = optional_param('id', 0, PARAM_INT); // Course Module ID $g = optional_param('g', 0, PARAM_INT); // Glossary ID $tab = optional_param('tab', GLOSSARY_NO_VIEW, PARAM_ALPHA); // browsing entries by categories? $displayformat = optional_param('displayformat',-1, PARAM_INT); // override of the glossary display format $mode = optional_param('mode', '', PARAM_ALPHA); // term entry cat date letter search author approval $hook = optional_param('hook', '', PARAM_CLEAN); // the term, entry, cat, etc... to look for based on mode $fullsearch = optional_param('fullsearch', 0,PARAM_INT); // full search (concept and definition) when searching? $sortkey = optional_param('sortkey', '', PARAM_ALPHA);// Sorted view: CREATION | UPDATE | FIRSTNAME | LASTNAME... $sortorder = optional_param('sortorder', 'ASC', PARAM_ALPHA); // it defines the order of the sorting (ASC or DESC) $offset = optional_param('offset', 0,PARAM_INT); // entries to bypass (for paging purposes) $page = optional_param('page', 0,PARAM_INT); // Page to show (for paging purposes) $show = optional_param('show', '', PARAM_ALPHA); // [ concept | alias ] => mode=term hook=$show if (!empty($id)) { if (! $cm = get_coursemodule_from_id('glossary', $id)) { throw new \moodle_exception('invalidcoursemodule'); } if (! $course = $DB->get_record("course", array("id"=>$cm->course))) { throw new \moodle_exception('coursemisconf'); } if (! $glossary = $DB->get_record("glossary", array("id"=>$cm->instance))) { throw new \moodle_exception('invalidid', 'glossary'); } } else if (!empty($g)) { if (! $glossary = $DB->get_record("glossary", array("id"=>$g))) { throw new \moodle_exception('invalidid', 'glossary'); } if (! $course = $DB->get_record("course", array("id"=>$glossary->course))) { throw new \moodle_exception('invalidcourseid'); } if (!$cm = get_coursemodule_from_instance("glossary", $glossary->id, $course->id)) { throw new \moodle_exception('invalidcoursemodule'); } $id = $cm->id; } else { throw new \moodle_exception('invalidid', 'glossary'); } $cm = cm_info::create($cm); require_course_login($course->id, true, $cm); $context = context_module::instance($cm->id); require_capability('mod/glossary:view', $context); $hassecondary = $PAGE->has_secondary_navigation(); // Prepare format_string/text options $fmtoptions = array( 'context' => $context); require_once($CFG->dirroot . '/comment/lib.php'); comment::init(); /// redirecting if adding a new entry if ($tab == GLOSSARY_ADDENTRY_VIEW ) { redirect("edit.php?cmid=$cm->id&mode=$mode"); } /// setting the defaut number of entries per page if not set if ( !$entriesbypage = $glossary->entbypage ) { $entriesbypage = $CFG->glossary_entbypage; } // If we have received a page, recalculate offset and page size. $pagelimit = $entriesbypage; if ($page > 0 && $offset == 0) { $offset = $page * $entriesbypage; } else if ($page < 0) { $offset = 0; $pagelimit = 0; } /// setting the default values for the display mode of the current glossary /// only if the glossary is viewed by the first time if ( $dp = $DB->get_record('glossary_formats', array('name'=>$glossary->displayformat)) ) { /// Based on format->defaultmode, we build the defaulttab to be showed sometimes $showtabs = glossary_get_visible_tabs($dp); switch ($dp->defaultmode) { case 'cat': $defaulttab = GLOSSARY_CATEGORY_VIEW; // Handle defaultmode if 'category' tab is disabled. Fallback to 'standard' tab. if (!in_array(GLOSSARY_CATEGORY, $showtabs)) { $defaulttab = GLOSSARY_STANDARD_VIEW; } break; case 'date': $defaulttab = GLOSSARY_DATE_VIEW; // Handle defaultmode if 'date' tab is disabled. Fallback to 'standard' tab. if (!in_array(GLOSSARY_DATE, $showtabs)) { $defaulttab = GLOSSARY_STANDARD_VIEW; } break; case 'author': $defaulttab = GLOSSARY_AUTHOR_VIEW; // Handle defaultmode if 'author' tab is disabled. Fallback to 'standard' tab. if (!in_array(GLOSSARY_AUTHOR, $showtabs)) { $defaulttab = GLOSSARY_STANDARD_VIEW; } break; default: $defaulttab = GLOSSARY_STANDARD_VIEW; } /// Fetch the rest of variables $printpivot = $dp->showgroup; if ( $mode == '' and $hook == '' and $show == '') { $mode = $dp->defaultmode; $hook = $dp->defaulthook; $sortkey = $dp->sortkey; $sortorder = $dp->sortorder; } } else { $defaulttab = GLOSSARY_STANDARD_VIEW; $showtabs = array($defaulttab); $printpivot = 1; if ( $mode == '' and $hook == '' and $show == '') { $mode = 'letter'; $hook = 'ALL'; } } if ( $displayformat == -1 ) { $displayformat = $glossary->displayformat; } if ( $show ) { $mode = 'term'; $hook = $show; $show = ''; } /// stablishing flag variables if ( $sortorder = strtolower($sortorder) ) { if ($sortorder != 'asc' and $sortorder != 'desc') { $sortorder = ''; } } if ( $sortkey = strtoupper($sortkey) ) { if ($sortkey != 'CREATION' and $sortkey != 'UPDATE' and $sortkey != 'FIRSTNAME' and $sortkey != 'LASTNAME' ) { $sortkey = ''; } } switch ( $mode = strtolower($mode) ) { case 'search': /// looking for terms containing certain word(s) $tab = GLOSSARY_STANDARD_VIEW; //Clean a bit the search string $hook = trim(strip_tags($hook)); break; case 'entry': /// Looking for a certain entry id $tab = GLOSSARY_STANDARD_VIEW; if ( $dp = $DB->get_record("glossary_formats", array("name"=>$glossary->displayformat)) ) { $displayformat = $dp->popupformatname; } break; case 'cat': /// Looking for a certain cat $tab = GLOSSARY_CATEGORY_VIEW; // Validation - we don't want to display 'category' tab if it is disabled. if (!in_array(GLOSSARY_CATEGORY, $showtabs)) { $tab = GLOSSARY_STANDARD_VIEW; } if ( $hook > 0 ) { $category = $DB->get_record("glossary_categories", array("id"=>$hook)); } break; case 'approval': /// Looking for entries waiting for approval $tab = GLOSSARY_APPROVAL_VIEW; // Override the display format with the approvaldisplayformat if ($glossary->approvaldisplayformat !== 'default' && ($df = $DB->get_record("glossary_formats", array("name" => $glossary->approvaldisplayformat)))) { $displayformat = $df->popupformatname; } if ( !$hook and !$sortkey and !$sortorder) { $hook = 'ALL'; } break; case 'term': /// Looking for entries that include certain term in its concept, definition or aliases $tab = GLOSSARY_STANDARD_VIEW; break; case 'date': $tab = GLOSSARY_DATE_VIEW; // Validation - we dont want to display 'date' tab if it is disabled. if (!in_array(GLOSSARY_DATE, $showtabs)) { $tab = GLOSSARY_STANDARD_VIEW; } if ( !$sortkey ) { $sortkey = 'UPDATE'; } if ( !$sortorder ) { $sortorder = 'desc'; } break; case 'author': /// Looking for entries, browsed by author $tab = GLOSSARY_AUTHOR_VIEW; // Validation - we dont want to display 'author' tab if it is disabled. if (!in_array(GLOSSARY_AUTHOR, $showtabs)) { $tab = GLOSSARY_STANDARD_VIEW; } if ( !$hook ) { $hook = 'ALL'; } if ( !$sortkey ) { $sortkey = 'FIRSTNAME'; } if ( !$sortorder ) { $sortorder = 'asc'; } break; case 'letter': /// Looking for entries that begin with a certain letter, ALL or SPECIAL characters default: $tab = GLOSSARY_STANDARD_VIEW; if ( !$hook ) { $hook = 'ALL'; } break; } switch ( $tab ) { case GLOSSARY_IMPORT_VIEW: case GLOSSARY_EXPORT_VIEW: case GLOSSARY_APPROVAL_VIEW: $showcommonelements = 0; break; default: $showcommonelements = 1; break; } // Trigger module viewed event. glossary_view($glossary, $course, $cm, $context, $mode); /// Printing the heading $strglossaries = get_string("modulenameplural", "glossary"); $strglossary = get_string("modulename", "glossary"); $strallcategories = get_string("allcategories", "glossary"); $straddentry = get_string("addentry", "glossary"); $strnoentries = get_string("noentries", "glossary"); $strsearchindefinition = get_string("searchindefinition", "glossary"); $strsearch = get_string("search"); $strwaitingapproval = get_string('pendingapproval', 'glossary'); /// If we are in approval mode, prit special header $PAGE->set_title($glossary->name); $PAGE->set_heading($course->fullname); $url = new moodle_url('/mod/glossary/view.php', array('id'=>$cm->id)); if (isset($mode) && $mode) { $url->param('mode', $mode); } $PAGE->set_url($url); $renderer = $PAGE->get_renderer('mod_glossary'); $actionbar = new \mod_glossary\output\standard_action_bar($cm, $glossary, $dp, $mode, $hook, $sortkey, $sortorder, $offset, $pagelimit, $fullsearch, $tab, $defaulttab); $PAGE->force_settings_menu(); if (!empty($CFG->enablerssfeeds) && !empty($CFG->glossary_enablerssfeeds) && $glossary->rsstype && $glossary->rssarticles) { $rsstitle = format_string($course->shortname, true, array('context' => context_course::instance($course->id))) . ': '. format_string($glossary->name); rss_add_http_header($context, 'mod_glossary', $glossary, $rsstitle); } if ($tab == GLOSSARY_APPROVAL_VIEW) { require_capability('mod/glossary:approve', $context); } $hassecondary = $PAGE->has_secondary_navigation(); if ($tab == GLOSSARY_APPROVAL_VIEW && !$hassecondary && $PAGE->activityheader->is_title_allowed()) { $PAGE->activityheader->set_title( $OUTPUT->heading($strwaitingapproval) . $OUTPUT->heading(format_string($glossary->name)) ); } if ($tab == GLOSSARY_APPROVAL_VIEW || !($glossary->intro && $showcommonelements)) { $PAGE->activityheader->set_description(''); } echo $OUTPUT->header(); if ($showcommonelements) { echo $renderer->main_action_bar($actionbar); } /// All this depends if whe have $showcommonelements if ($showcommonelements) { /// To calculate available options $availableoptions = ''; /// Decide about to print the import link /*if (has_capability('mod/glossary:import', $context)) { $availableoptions = '' . '' . get_string('importentries', 'glossary') . '' . ''; } /// Decide about to print the export link if (has_capability('mod/glossary:export', $context)) { if ($availableoptions) { $availableoptions .= ' / '; } $availableoptions .='' . '' . get_string('exportentries', 'glossary') . '' . ''; }*/ /// Decide about to print the approval link if (has_capability('mod/glossary:approve', $context) && !$hassecondary) { /// Check we have pending entries if ($hiddenentries = $DB->count_records('glossary_entries', array('glossaryid'=>$glossary->id, 'approved'=>0))) { if ($availableoptions) { $availableoptions .= '
'; } $availableoptions .='' . '' . $strwaitingapproval . ' ('.$hiddenentries.')' . ''; } } /// Start to print glossary controls // print_box_start('glossarycontrol clearfix'); echo '
'; echo $availableoptions; /// End glossary controls // print_box_end(); /// glossarycontrol echo '

'; // print_box(' ', 'clearer'); } require("tabs.php"); require("sql.php"); /// printing the entries $entriesshown = 0; $currentpivot = ''; $paging = NULL; if ($allentries) { //Decide if we must show the ALL link in the pagebar $specialtext = ''; if ($glossary->showall) { $specialtext = get_string("allentries","glossary"); } //Build paging bar $baseurl = new moodle_url('/mod/glossary/view.php', ['id' => $id, 'mode' => $mode, 'hook' => $hook, 'sortkey' => $sortkey, 'sortorder' => $sortorder, 'fullsearch' => $fullsearch]); $paging = glossary_get_paging_bar($count, $page, $entriesbypage, $baseurl->out() . '&', 9999, 10, '  ', $specialtext, -1); echo '
'; echo $paging; echo '
'; //load ratings require_once($CFG->dirroot.'/rating/lib.php'); if ($glossary->assessed != RATING_AGGREGATE_NONE) { $ratingoptions = new stdClass; $ratingoptions->context = $context; $ratingoptions->component = 'mod_glossary'; $ratingoptions->ratingarea = 'entry'; $ratingoptions->items = $allentries; $ratingoptions->aggregate = $glossary->assessed;//the aggregation method $ratingoptions->scaleid = $glossary->scale; $ratingoptions->userid = $USER->id; $ratingoptions->returnurl = $CFG->wwwroot.'/mod/glossary/view.php?id='.$cm->id; $ratingoptions->assesstimestart = $glossary->assesstimestart; $ratingoptions->assesstimefinish = $glossary->assesstimefinish; $rm = new rating_manager(); $allentries = $rm->get_ratings($ratingoptions); } foreach ($allentries as $entry) { // Setting the pivot for the current entry if ($printpivot) { $pivot = format_string($entry->{$pivotkey}, false, ["context" => $context]); $upperpivot = core_text::strtoupper($pivot); $pivottoshow = core_text::strtoupper(format_string($pivot, true, $fmtoptions)); // Reduce pivot to 1cc if necessary. if (!$fullpivot) { $upperpivot = core_text::substr($upperpivot, 0, 1); $pivottoshow = core_text::substr($pivottoshow, 0, 1); } // If there's a group break. if ($currentpivot != $upperpivot) { $currentpivot = $upperpivot; // print the group break if apply echo '
'; echo ''; echo ''; if ($userispivot) { // printing the user icon if defined (only when browsing authors) echo '
'; $user = mod_glossary_entry_query_builder::get_user_from_record($entry); echo $OUTPUT->user_picture($user, array('courseid'=>$course->id)); $pivottoshow = fullname($user, has_capability('moodle/site:viewfullnames', context_course::instance($course->id))); } else { echo ''; } echo $OUTPUT->heading($pivottoshow, 3); echo "
\n"; } } /// highlight the term if necessary if ($mode == 'search') { //We have to strip any word starting by + and take out words starting by - //to make highlight works properly $searchterms = explode(' ', $hook); // Search for words independently foreach ($searchterms as $key => $searchterm) { if (preg_match('/^\-/',$searchterm)) { unset($searchterms[$key]); } else { $searchterms[$key] = preg_replace('/^\+/','',$searchterm); } //Avoid highlight of <2 len strings. It's a well known hilight limitation. if (strlen($searchterm) < 2) { unset($searchterms[$key]); } } $strippedsearch = implode(' ', $searchterms); // Rebuild the string $entry->highlight = $strippedsearch; } /// and finally print the entry. glossary_print_entry($course, $cm, $glossary, $entry, $mode, $hook,1,$displayformat); $entriesshown++; } // The all entries value may be a recordset or an array. if ($allentries instanceof moodle_recordset) { $allentries->close(); } } if ( !$entriesshown ) { echo $OUTPUT->box(get_string("noentries","glossary"), "generalbox boxaligncenter boxwidthwide"); } if (!empty($formsent)) { // close the form properly if used echo ""; echo ""; } if ( $paging ) { echo '
'; echo '
'; echo $paging; echo '
'; } echo '
'; /// Finish the page echo $OUTPUT->footer(); home/smkb8269/public_html/lms.smk-almanshuriyah.sch.id/mod/book/view.php000064400000013452152267157700022076 0ustar00. /** * Book view page * * @package mod_book * @copyright 2004-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__.'/lib.php'); require_once(__DIR__.'/locallib.php'); require_once($CFG->libdir.'/completionlib.php'); $id = optional_param('id', 0, PARAM_INT); // Course Module ID $bid = optional_param('b', 0, PARAM_INT); // Book id $chapterid = optional_param('chapterid', 0, PARAM_INT); // Chapter ID $edit = optional_param('edit', -1, PARAM_BOOL); // Edit mode // ========================================================================= // security checks START - teachers edit; students view // ========================================================================= if ($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); } else { $book = $DB->get_record('book', array('id'=>$bid), '*', MUST_EXIST); $cm = get_coursemodule_from_instance('book', $book->id, 0, false, MUST_EXIST); $course = $DB->get_record('course', array('id'=>$cm->course), '*', MUST_EXIST); $id = $cm->id; } require_course_login($course, true, $cm); $context = context_module::instance($cm->id); require_capability('mod/book:read', $context); $allowedit = has_capability('mod/book:edit', $context); $viewhidden = has_capability('mod/book:viewhiddenchapters', $context); if ($allowedit) { if ($edit != -1 and confirm_sesskey()) { $USER->editing = $edit; } else { if (isset($USER->editing)) { $edit = $USER->editing; } else { $edit = 0; } } } else { $edit = 0; } // read chapters $chapters = book_preload_chapters($book); if ($allowedit and !$chapters) { redirect('edit.php?cmid='.$cm->id); // No chapters - add new one. } // Check chapterid and read chapter data if ($chapterid == '0') { // Go to first chapter if no given. // Trigger course module viewed event. book_view($book, null, false, $course, $cm, $context); foreach ($chapters as $ch) { if ($edit || ($ch->hidden && $viewhidden)) { $chapterid = $ch->id; break; } if (!$ch->hidden) { $chapterid = $ch->id; break; } } } // Prepare header. $pagetitle = $book->name; if ($chapter = $DB->get_record('book_chapters', ['id' => $chapterid, 'bookid' => $book->id])) { $pagetitle .= ": {$chapter->title}"; } $PAGE->set_other_editing_capability('mod/book:edit'); $PAGE->set_title($pagetitle); $PAGE->set_heading($course->fullname); $PAGE->add_body_class('limitedwidth'); // No content in the book. if (!$chapterid) { $PAGE->set_url('/mod/book/view.php', array('id' => $id)); echo $OUTPUT->header(); echo $OUTPUT->notification(get_string('nocontent', 'mod_book'), 'info', false); } else { $PAGE->set_url('/mod/book/view.php', ['id' => $id, 'chapterid' => $chapterid]); // The chapter doesnt exist or it is hidden for students. if (!$chapter or ($chapter->hidden and !$viewhidden)) { $courseurl = new moodle_url('/course/view.php', ['id' => $course->id]); throw new moodle_exception('errorchapter', 'mod_book', $courseurl); } // Add the Book TOC block. book_add_fake_block($chapters, $chapter, $book, $cm, $edit); book_view($book, $chapter, \mod_book\helper::is_last_visible_chapter($chapter->id, $chapters), $course, $cm, $context); echo $OUTPUT->header(); $renderer = $PAGE->get_renderer('mod_book'); $actionmenu = new \mod_book\output\main_action_menu($cm->id, $chapters, $chapter, $book); $renderedmenu = $renderer->render($actionmenu); echo html_writer::div($renderedmenu, '', ['id' => 'mod_book-chaptersnavigation']); // The chapter itself. $hidden = $chapter->hidden ? ' dimmed_text' : null; echo $OUTPUT->box_start('generalbox book_content' . $hidden, 'mod_book-chapter'); if (!$book->customtitles) { if (!$chapter->subchapter) { $currtitle = book_get_chapter_title($chapter->id, $chapters, $book, $context); echo $OUTPUT->heading($currtitle, 3); } else { $currtitle = book_get_chapter_title($chapters[$chapter->id]->parent, $chapters, $book, $context); $currsubtitle = book_get_chapter_title($chapter->id, $chapters, $book, $context); echo $OUTPUT->heading($currtitle, 3); echo $OUTPUT->heading($currsubtitle, 4); } } $chaptertext = file_rewrite_pluginfile_urls($chapter->content, 'pluginfile.php', $context->id, 'mod_book', 'chapter', $chapter->id); echo format_text($chaptertext, $chapter->contentformat, ['noclean' => true, 'overflowdiv' => true, 'context' => $context]); echo $OUTPUT->box_end(); if (core_tag_tag::is_enabled('mod_book', 'book_chapters')) { echo $OUTPUT->tag_list(core_tag_tag::get_item_tags('mod_book', 'book_chapters', $chapter->id), null, 'book-tags'); } } echo $OUTPUT->footer();