global $CFG, $OUTPUT, $SESSION, $PAGE, $DB, $COURSE, $USER; // Check if the user accessing the page is instructor. if (!G\isteacher($USER->id)) { redirect(new moodle_url('/local/gas/index.php')); } $PAGE->set_pagelayout('report'); $id = optional_param('id', 0, PARAM_INT); // List id. require_login(1, false); // Use course 1 because this has nothing to do with an actual course, just like course 1. $context = context_system::instance(); $pagetitle = get_string('pluginname', 'local_gas'); $pageheading = get_string('pluginname', 'local_gas'); echo local_gas_page('/index.php?id=' . $id, $pagetitle, $pageheading, $context); // Code for manualy activing a link in navigator. G\makenavigatorlinkactive($PAGE, "courseAssessment"); echo $OUTPUT->header(); $initjs = "var formSubmitting = false;\n var changesHappened = false;\n var setFormSubmitting = function () {\n formSubmitting = true;\n };\n var setChanges = function () {\n changesHappened = true;\n };\n window.onload = function () {\n window.addEventListener('beforeunload', function (e) {\n if (formSubmitting || !changesHappened) {\n return undefined;\n }\n var confirmationMessage = 'It looks like you have been editing something. '\n + 'If you leave before saving, your changes will be lost.';\n (e || window.event).returnValue = confirmationMessage;\n return confirmationMessage;\n });\n };\n\n function RefreshChart() {\n var d = [];\n var d2 = [];\n d.push(d2);"; $labels = G\getattributes(current_language(), time()); for ($i = 1; $i <= count($labels); $i++) { $labelname = $labels[$i - 1]->name; $labelid = $labels[$i - 1]->attribute_id; $initjs .= "d[0].push({axis: '{$labelname}', value: \$('#aveOf{$labelid}').val() });"; } $initjs .= " RadarChart.drawChart(d, []);\n }\n \$(document).ready(function () {\n \$('#myTabs a').click(function (e) {\n e.preventDefault()\n \$(this).tab('show')\n });\n \$('.rangeInput').keyup(function( event ) {\n id = this.id.substring(10);\n val = \$(this).val();\n if(val > 0 && val < 6)\n highLightDescription('descriptionRow'+id+val);\n });\n \$('.rangeInput').mouseup(function( event ) {\n id = this.id.substring(10);\n val = \$(this).val();\n if(val > 0 && val < 6)\n highLightDescription('descriptionRow'+id , val);\n });\n RefreshChart();\n \$('.rangeInput').keyup(function (event) {\n RefreshChart();\n });\n \$('.rangeInput').mouseup(function (event) {\n RefreshChart();\n });\n });\n var w = 200, h = 200;\n\n var mycfg = {\n w: w,\n h: h,\n maxValue: 5,\n levels: 5,\n ExtraWidthX: 150\n };\n function ShowDes(val1, val2, num) {\n for (var i = 0; i < num; i++) {\n document.getElementById('attDes' + val1 + i).style.display = 'none';\n }\n document.getElementById('attDes' + val1 + val2).style.display = 'table';\n }\n function highLightDescription(id, val) {\n newId = id + val;\n \$('[class^=' + id + ']').removeClass('info');\n \$('.' + newId).addClass('info');\n }"; echo html_writer::script($initjs); // Print_object($USER);. $cyear = date("Y"); $csem = G\semofdate(date("d"), date("m")); // Getting all courses this users in enrolled in as instructor. $courses = G\coursesas($USER->id, "teacher");
$displaypage = function () { // CHECK And PREPARE DATA. global $OUTPUT, $PAGE, $DB, $COURSE, $USER; if (!has_capability('local/gas:administrator', context_course::instance($COURSE->id))) { redirect(new moodle_url('/local/gas/index.php')); } $id = optional_param('id', 0, PARAM_INT); // List id. require_login(1, false); // Use course 1 because this has nothing to do with an actual course, just like course 1. $context = context_system::instance(); $pagetitle = get_string('pluginname', 'local_gas'); $pageheading = get_string('pluginname', 'local_gas'); local_gas_page('/index.php?id=' . $id, $pagetitle, $pageheading, $context); // This part added as the highlighting of the navigators was not working. G\makenavigatorlinkactive($PAGE, "attributeManagement"); echo $OUTPUT->header(); $initjs = "function ShowSubInfo(val1) {\n if (document.getElementById('SubInfo' + val1).style.display == 'none') {\n document.getElementById('SubInfo' + val1).style.display = 'table';\n }\n else {\n document.getElementById('SubInfo' + val1).style.display = 'none';\n }\n }\n function ShowSubs(val1) {\n if (document.getElementById('Subs' + val1).style.display == 'none') {\n document.getElementById('Subs' + val1).style.display = 'table';\n }\n else {\n document.getElementById('Subs' + val1).style.display = 'none';\n }\n }\n function ShowAddSubAtt(val1) {\n if (document.getElementById('AddSubAttAdd' + val1).style.display == 'none') {\n document.getElementById('AddSubAttAdd' + val1).style.display = 'inline';\n }\n else {\n document.getElementById('AddSubAttAdd' + val1).style.display = 'none';\n }\n }"; echo html_writer::script($initjs); ?> <div class='block_course_overview block'> <div class="header"> <div class="title"> <h2><i class='fa fa-magic'></i><?php echo " " . get_string('attributeManagement', 'local_gas'); ?> </h2> </div> </div> <div class='content'> <div>
global $CFG, $OUTPUT, $SESSION, $PAGE, $DB, $COURSE, $USER; // Check if the user accessing this page is student. if (!G\isstudent($USER->id)) { redirect(new moodle_url('/local/gas/index.php')); } $PAGE->set_pagelayout('report'); $id = optional_param('id', 0, PARAM_INT); // List id. require_login(1, false); // Use course 1 because this has nothing to do with an actual course, just like course 1. $context = context_system::instance(); $pagetitle = get_string('pluginname', 'local_gas'); $pageheading = get_string('pluginname', 'local_gas'); echo local_gas_page('/index.php?id=' . $id, $pagetitle, $pageheading, $context); // This part added as the highlighting of the navigators was not working. G\makenavigatorlinkactive($PAGE, "assessment"); echo $OUTPUT->header(); // NextCourse: function to change the course in "Contributed Courses" Coloumn // HighlightDescription: highliting the value description based on the range input. $initjs = " var formSubmitting = false;\n var changesHappened = false;\n var setFormSubmitting = function () {\n formSubmitting = true;\n };\n var setChanges = function () {\n changesHappened = true;\n };\n window.onload = function () {\n window.addEventListener('beforeunload', function (e) {\n if (formSubmitting || !changesHappened) {\n return undefined;\n }\n var confirmationMessage = 'It looks like you have been editing something. '\n + 'If you leave before saving, your changes will be lost.';\n\n (e || window.event).returnValue = confirmationMessage; //Gecko + IE\n return confirmationMessage; //Gecko + Webkit, Safari, Chrome etc.\n });\n };\n function ShowDes(val1, val2, num) {\n for (var i = 0; i < num; i++) {\n document.getElementById('attDes' + val1 + i).style.display = 'none';\n }\n document.getElementById('attDes' + val1 + val2).style.display = 'table';\n }\n function highLightDescription(id, val) {\n\n newId = id + val;\n \$('[class^=' + id + ']').removeClass('info');\n \$('.' + newId).addClass('info');\n }\n \$(document).ready(function () {\n\n \$('#myTabs a').click(function (e) {\n e.preventDefault()\n \$(this).tab('show')\n });\n\n \$('.rangeInput').keyup(function( event ) {\n id = this.id.substring(10);\n val = \$(this).val();\n if(val > 0 && val < 6)\n highLightDescription('descriptionRow'+id+val);\n });\n\n \$('.rangeInput').mouseup(function( event ) {\n id = this.id.substring(10);\n val = \$(this).val();\n if(val > 0 && val < 6)\n highLightDescription('descriptionRow'+id , val);\n });\n });\n\n function nextCourse(id, counter, max){\n if(counter == 1){\n var option1={direction: 'right'};\n var option2={direction: 'left'};\n }\n if(counter == -1){\n var option1={direction: 'left'};\n var option2={direction: 'right'};\n }\n currentID = parseInt(\$('.'+id+':visible').attr('id'));\n nextID = (parseInt(currentID) + counter + max)%max;\n \$('#'+id+currentID).toggle('slide', option1, 300);\n setTimeout(function(){\n \$('#'+id+nextID).toggle('slide', option2, 300);\n }, 300);\n }"; echo html_writer::script($initjs); $act = optional_param("action", null, PARAM_TEXT); $currentsem = G\semofdate(date("d"), date("m")); $datasaved = false; // If the form submited to save an assessment. if ($act == "assessment") { $studentid = $USER->id; // Variable storing the amount of time user spent on assessment. $timetaken = time() - optional_param("AssStartTime", null, PARAM_INT); // Creating a row in assessment table. $assid = G\newassessment($studentid, time(), $timetaken, $currentsem, "Student");