/** * Silently check if this is a launch and if so, handle it */ public static function launchCheck() { if (!LTI::isRequest()) { return false; } $session_id = self::setupSession(); if ($session_id === false) { return false; } // Redirect back to ourselves... $url = curPageURL(); $query = false; if (isset($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0) { $query = true; $url .= '?' . $_SERVER['QUERY_STRING']; } $location = addSession($url); session_write_close(); // To avoid any race conditions... if (headers_sent()) { echo '<p><a href="' . $url . '">Click to continue</a></p>'; } else { header('Location: ' . $location); } exit; }
/** * Silently check if this is a launch and if so, handle it and redirect * back to ourselves */ public static function launchCheck($needed = self::ALL) { $needed = self::patchNeeded($needed); if (!LTI::isRequest()) { return false; } $session_id = self::setupSession($needed); if ($session_id === false) { return false; } // Redirect back to ourselves... $url = self::curPageUrl(); $location = addSession($url); session_write_close(); // To avoid any race conditions... if (headers_sent()) { echo '<p><a href="' . $url . '">Click to continue</a></p>'; } else { header('Location: ' . $location); } exit; }
require_once "../pdo.php"; require_once $CFG->dirroot . '/lib/lms_lib.php'; require_once 'tp_messages.php'; use Tsugi\Util\LTI; use Tsugi\Util\Net; session_start(); header('Content-Type: text/html; charset=utf-8'); if (!isset($_SESSION['lti2post'])) { die_with_error_log("Missing LTI 2.0 post data"); } error_log("Session in lti2 " . session_id()); if (!isset($_SESSION['id'])) { if (isset($_REQUEST['login_done'])) { die_with_error_log("LTI 2 login failed."); } $_SESSION['login_return'] = addSession(getCurrentFileUrl(__FILE__) . "?login_done=true"); header("Location: " . getLoginUrl()); return; } // See if this person is allowed to register a tool $row = $PDOX->rowDie("SELECT request_id, user_id, admin, state, lti\n FROM {$CFG->dbprefix}key_request\n WHERE user_id = :UID LIMIT 1", array(":UID" => $_SESSION['id'])); if ($row === false) { $_SESSION['error'] = 'You have not requested a key for this service.'; header('Location: ' . $CFG->wwwroot); return; } if ($row['state'] == 0) { $_SESSION['error'] = 'Your key has not yet been approved. ' . $row['admin']; header('Location: ' . $CFG->wwwroot); return; }
</p> <iframe id="my_iframe" width="98%" height="600px" style="border: 1px black solid"> </iframe> </div> <?php $OUTPUT->footerStart(); ?> <script type="text/javascript"> $UPDATE_INTERVAL = false; function updateNumbers() { window.console && console.log('Calling updateNumbers'); $.ajaxSetup({ cache: false }); // For IE... $.getJSON('<?php echo addSession($CFG->wwwroot . '/mod/peer-grade/maintcount.php'); ?> ', function(data) { if ( $UPDATE_INTERVAL === false ) $UPDATE_INTERVAL = setInterval(updateNumbers,10000); window.console && console.log(data); $('#totspinner').hide(); oldtotal = $('#total').text(); $('#total').text(data.total); if ( oldtotal.length > 1 && oldtotal != data.total ) $('#totspinner').show(); }); } updateNumbers(); </script> <?php $OUTPUT->footerEnd();
$retval = LTIX::gradeSend($gradetosend, false, $debug_log); $_SESSION['debug_log'] = $debug_log; if ($retval === true) { $_SESSION['success'] = "Grade {$gradetosend} sent to server."; } else { if (is_string($retval)) { $_SESSION['error'] = "Grade not sent: " . $retval; } else { echo "<pre>\n"; var_dump($retval); echo "</pre>\n"; die; } } // Redirect to ourself header('Location: ' . addSession('index.php')); return; } // Start of the output $OUTPUT->header(); $OUTPUT->bodyStart(); $OUTPUT->flashMessages(); echo "<h1>Grade Test Harness</h1>\n"; $OUTPUT->welcomeUserCourse(); ?> <form method="post"> Enter grade: <input type="number" name="grade" step="0.01" min="0" max="1.0"><br/> <input type="submit" name="send" value="Send grade"> </form> <?php
$("#success").html(sprintf(I18N.lost,data.displayname)); } $("#rpsform input").attr("disabled", false); leaders(); // Immediately update the leaderboard }); } var OLD_TIMEOUT = false; function leaders() { if ( OLD_TIMEOUT ) { clearTimeout(OLD_TIMEOUT); OLD_TIMEOUT = false; } window.console && console.log('Updating leaders...'); $.getJSON('<?php echo addSession('stats.php'); ?> ', function(data) { window.console && console.log(data); $("#leaders").html(""); $("#leaders").append("<ol>\n"); for (var i = 0; i < data.length; i++) { entry = data[i]; $("#leaders").append("<li>"+entry.name+' ('+entry.games+') score='+entry.score+"</li>\n"); console.log(data[i]); } $("#leaders").append("</ol>\n"); OLD_TIMEOUT = setTimeout('leaders()', 20000); }); }
/** * Redirect to a local URL, adding session if necessary * * Note that this is only needed for AJAX and header() calls * as <form> and <a href tags are properly handled already * by the PHP built-in "don't use cookies for session" support. */ function doRedirect($location) { if (headers_sent()) { echo '<a href="' . htmlentities($location) . '">Continue</a>' . "\n"; } else { if (ini_get('session.use_cookies') == 0) { $location = addSession($location); } header("Location: {$location}"); } }
/* $qj = json_encode($questions); echo("<pre>\n"); var_dump($attempt); var_dump($errors); echo(htmlent_utf8(jsonIndent($qj))); echo("</pre>\n"); */ $OUTPUT->footerStart(); require_once 'templates.php'; ?> <script> TEMPLATES = []; $(document).ready(function(){ $.getJSON('<?php echo addSession('quiz.php'); ?> ', function(quiz) { window.console && console.log(quiz); for(var i=0; i<quiz.questions.length; i++) { question = quiz.questions[i]; type = question.type; console.log(type); if ( TEMPLATES[type] ) { template = TEMPLATES[type]; } else { source = $('#'+type).html(); if ( source == undefined ) { window.console && console.log("Did not find template for question type="+type); continue; }
function showSubmission($LTI, $assn_json, $submit_json) { echo '<div style="padding:5px">'; $blob_ids = $submit_json->blob_ids; $urls = isset($submit_json->urls) ? $submit_json->urls : array(); $blobno = 0; $urlno = 0; foreach ($assn_json->parts as $part) { if ($part->type == "image") { // This test triggeres when an assignment is reconfigured // and old submissions have too few blobs if ($blobno >= count($blob_ids)) { continue; } $blob_id = $blob_ids[$blobno++]; if (is_array($blob_id)) { $blob_id = $blob_id[0]; } $url = getAccessUrlForBlob($blob_id); $title = 'Student image'; if (isset($part->title) && strlen($part->title) > 0) { $title = $part->title; } echo ' <a href="#" onclick="$(\'#myModal_' . $blobno . '\').modal();"'; echo 'alt="' . htmlent_utf8($title) . '" title="' . htmlent_utf8($title) . '">'; echo '<img src="' . addSession($url) . '" width="240"></a>' . "\n"; ?> <div class="modal fade" id="myModal_<?php echo $blobno; ?> "> <div class="modal-dialog modal-lg"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h4 class="modal-title"><?php echo htmlent_utf8($title); ?> </h4> </div> <div class="modal-body"> <img src="<?php echo addSession($url); ?> " style="width:100%"> </div> </div><!-- /.modal-content --> </div><!-- /.modal-dialog --> </div><!-- /.modal --> <?php } else { if ($part->type == "url") { $url = $urls[$urlno++]; echo '<p><a href="' . safe_href($url) . '" target="_blank">'; echo htmlentities(safe_href($url)) . '</a> (Will launch in new window)</p>' . "\n"; } } } echo "<br/> <br/>\n"; if ($blobno > 0) { echo "<p>Click on each image to see a larger view of the image.</p>\n"; } if (strlen($submit_json->notes) > 1) { echo "<p>Notes: " . htmlent_utf8($submit_json->notes) . "</p>\n"; } echo '<div style="padding:3px">'; }
; var grade = 1.0 - <?php echo $dueDate->penalty; ?> ; if ( oldgrade > grade ) grade = oldgrade; // Never go down window.console && console.log("Sending grade="+grade); if ( window.CM_EDITOR !== false ) window.CM_EDITOR.save(); var code = document.getElementById("code").value; var toSend = { grade : grade, code : code }; $.ajax({ type: "POST", url: "<?php echo addSession('sendgrade.php'); ?> ", dataType: "json", beforeSend: function (request) { request.setRequestHeader("X-CSRF-Token", CSRF_TOKEN); }, data: toSend }).done( function (data) { window.console && console.log("Grade response received..."); window.console && console.log(data); $("#spinner").hide(); if ( data.status == "success") { $("#gradegood").show(); $('#curgrade').text('1');
$_SESSION['error'] = 'Bad value for id'; header('Location: error.php'); return; } $sql = sprintf("SELECT name,lkey,image,email FROM LTI_Users WHERE id=%s AND key_id=%s", $db->quote($_SESSION['user_id']), $CFG->localkeyid); $q = $db->query($sql); $user = $q->fetch(); if (!$course) { $_SESSION['error'] = 'Bad value for id'; header('Location: error.php'); return; } $sql = sprintf("SELECT role_id FROM LTI_Members WHERE user_id=%s AND course_id=%s", $db->quote($_SESSION['user_id']), $db->quote($course['id'])); $q = $db->query($sql); if ($q) { $member = $q->fetch(); } $_SESSION['_context_consumer_key'] = $CFG->localkey; $_SESSION['_context_consumer_id'] = $CFG->localkeyid; $_SESSION['_lti_context'] = array('oauth_consumer_key' => 'local', 'resource_link_id' => 'rlid-1234', 'resource_link_title' => 'This Week', 'resource_link_description' => 'Please complete this', 'user_id' => $user['lkey'], 'roles' => $member['roleid'] == 0 ? 'Instructor' : 'Learner', 'lis_person_name_full' => $user['name'], 'lis_person_contact_email_primary' => $user['email'], 'lis_person_sourcedid' => 'localhost.edu::' . $user['id'], 'context_id' => $course['lkey'], 'context_title' => $course['name'], 'context_label' => $course['lkey'], 'tool_consumer_info_product_family_code' => 'ims', 'tool_consumer_info_version' => '1.1', 'tool_consumer_instance_guid' => 'www.imsglobal.org', 'tool_consumer_instance_description' => 'University of Localhost (LMSng)'); /* echo("<pre>\n"); print_r($course); print_r($user); print_r($member); print_r($_SESSION); echo("</pre>\n"); */ // Do this by hand to switch away from cookie based sessions. $location = addSession('mod/response/index.php'); doRedirect($location);
} echo "</table>\n"; echo "</div>\n"; } if ($grades_given === false || count($grades_given) < 1) { echo "<p>Nothing has been graded {$user_display} yet.</p>"; } else { echo "<p>Grades Given{$user_display}:</p>"; echo '<div style="margin:3px;">'; echo '<table border="1" class="table table-hover table-condensed table-responsive">'; echo "\n<tr><th>User</th><th>Email</th><th>Points</th>\n <th>Comments</th><th>Action</th></tr>\n"; foreach ($grades_given as $grade) { echo "<tr>\n <td>" . htmlent_utf8($grade['displayname']) . "</td>\n <td>" . htmlent_utf8($grade['email']) . "</td>\n <td>" . $grade['points'] . "</td><td>" . htmlent_utf8($grade['note']) . "</td>" . '<td> <form method="post"><input type="hidden" name="grade_id" value="' . $grade['grade_id'] . '"> <input type="hidden" name="user_id" value="' . $user_id . '"> <input type="submit" name="deleteGrade" value="delete" class="btn btn-danger"></form></td>' . "\n</tr>\n"; } echo "</table>\n"; echo "</div>\n"; } ?> <form method="post"> <br/> <input type="submit" name="doDone" class="btn btn-success" onclick="location='<?php echo addSession('admin.php'); ?> '; return false;" value="Done"> </form> <?php $OUTPUT->footer();
$post_data = json_encode(array('error' => $post_data), JSON_FORCE_OBJECT); echo $post_data; } break; case 'add_attendance': if (isset($_GET['session_id']) && $_GET['session_id'] != "" && isset($_GET['status_set']) && $_GET['status_set'] != "" && isset($_GET['taken_by']) && $_GET['taken_by'] != "" && isset($_GET['data']) && $_GET['data'] != "" && isset($_GET['time']) && $_GET['time'] != "") { addAttendance($conn, $_GET['session_id'], $_GET['status_set'], $_GET['taken_by'], $_GET['time'], $_GET['data']); } else { $post_data = array('message' => 'missing parameters', 'comment' => 'require param [session_id,status_set,taken_by,time,data]'); $post_data = json_encode(array('error' => $post_data), JSON_FORCE_OBJECT); echo $post_data; } break; case 'add_session': if (isset($_GET['attendance_id']) && $_GET['attendance_id'] != "" && isset($_GET['session_date']) && $_GET['session_date'] != "" && isset($_GET['duration']) && $_GET['duration'] != "" && isset($_GET['time_modified']) && $_GET['time_modified'] != "" && isset($_GET['description']) && $_GET['description'] != "") { addSession($conn, $_GET['attendance_id'], $_GET['session_date'], $_GET['duration'], $_GET['time_modified'], $_GET['description']); } else { $post_data = array('message' => 'missing parameters', 'comment' => 'require param [attendance_id,session_date,duration,time_modified,description]'); $post_data = json_encode(array('error' => $post_data), JSON_FORCE_OBJECT); echo $post_data; } break; case 'update_attendance': if (isset($_GET['session_id']) && $_GET['session_id'] != "" && isset($_GET['taken_by']) && $_GET['taken_by'] != "" && isset($_GET['time']) && $_GET['time'] != "" && isset($_GET['data']) && $_GET['data'] != "") { updateAttendance($conn, $_GET['session_id'], $_GET['taken_by'], $_GET['time'], $_GET['data']); } else { $post_data = array('message' => 'missing parameters', 'comment' => 'require param [session_id,taken_by,time,data]'); $post_data = json_encode(array('error' => $post_data), JSON_FORCE_OBJECT); echo $post_data; } break;
<link href="calendarmap.css" rel="stylesheet" /> <script type="text/javascript" src="bootstrap.min.js"></script> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"></script> </head> <body> <div class="calendar-map" id="calendar_div"></div> <script> var attend_url = '<?php echo addSession("checking.php"); ?> '; var global_db_calendar_url = '<?php echo addSession("db_calendar.php"); ?> '; </script> <script type="text/javascript" src="calendarmap.js?x=<?php echo time(); ?> "></script> <!--End of Calendar HeatMap--> <?php // Finish the body (including loading JavaScript for JQUery and Bootstrap) // And put out the common footer material $OUTPUT->footer();
require_once $CFG->dirroot . '/lib/lms_lib.php'; require_once 'tp_messages.php'; use Tsugi\Util\LTI; use Tsugi\Util\Net; session_start(); header('Content-Type: text/html; charset=utf-8'); if (!isset($_SESSION['lti2post'])) { die_with_error_log("Missing LTI 2.0 post data"); } error_log("Session in lti2 " . session_id()); if (!isset($_SESSION['id'])) { if (isset($_REQUEST['login_done'])) { die_with_error_log("LTI 2 login failed."); } error_log('Redirecting user to login.'); $_SESSION['login_return'] = addSession($CFG->wwwroot . "/lti/lti2.php?login_done=true"); header("Location: " . getLoginUrl()); return; } // See if this person is allowed to register a tool $row = $PDOX->rowDie("SELECT request_id, user_id, admin, state, lti\n FROM {$CFG->dbprefix}key_request\n WHERE user_id = :UID LIMIT 1", array(":UID" => $_SESSION['id'])); if ($row === false) { $_SESSION['error'] = 'You have not requested a key for this service.'; header('Location: ' . $CFG->wwwroot); return; } if ($row['state'] == 0) { $_SESSION['error'] = 'Your key has not yet been approved. ' . $row['admin']; header('Location: ' . $CFG->wwwroot); return; }
" name="user_id"> <input type="hidden" value="" id="flag_grade_id" name="grade_id"> <textarea rows="5" cols="60" name="note"></textarea><br/> <input type="submit" name="doFlag" onclick="return confirm('Are you sure you want to bring this peer-grade entry to the attention of the instructor?');" value="Submit To Instructor" class="btn btn-primary"> <input type="submit" name="doCancel" onclick="$('#flagform').toggle(); return false;" value="Cancel Flag" class="btn btn-default"> </form> <p> <div id="gradeinfo">Calculating grade....</div> </p> <script type="text/javascript"> function gradeLoad() { window.console && console.log('Loading and updating your grade...'); $.getJSON('<?php echo addSession('update_grade.php'); ?> ', function(data) { window.console && console.log(data); if ( data.grade ) { $("#gradeinfo").html('Your current grade is '+data.grade*100.0+'%'); } else { $("#gradeinfo").html('You do not have a grade.'); window.console && console.log('Take a screen shot of the console output and send to support...'); } }); } </script> <?php $OUTPUT->footerStart(); ?>
<?php $OUTPUT->footerStart(); ?> <script type="text/javascript"> $(document).ready(function() { initialize_map(); $('#prefs_save').click(function(event) { $('#spinner').show(); var form = $('#prefs_form'); var allow_name = form.find('input[name="allow_name"]').is(':checked') ? 1 : 0 ; var allow_first = form.find('input[name="allow_first"]').is(':checked') ? 1 : 0 ; var allow_email = form.find('input[name="allow_email"]').is(':checked') ? 1 : 0 ; window.console && console.log('Sending POST'); $.post( '<?php echo addSession('update.php'); ?> ', { 'allow_name': allow_name, 'allow_first': allow_first, 'allow_email': allow_email }, function( data ) { window.console && console.log(data); $('#spinner').hide(); $('#prefs').modal('hide'); } ).error( function() { window.console && console.log('POST returned error'); $('#spinner').hide(); $('#save_fail').show(); }); return false; });
<script type="text/javascript" src="bootstrap.min.js"></script> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"></script> </head> <body> <div class="calendar-map" id="calendar_div"></div> <script> <?php if (isset($_GET['check'])) { echo 'var student_dataurl = "' . addSession('db_check_student.php?check=' . $_GET['check']) . '";'; } else { echo 'var student_dataurl = "' . addSession('db_check_student.php') . '";'; } ?> </script> <script type="text/javascript" src="check.js?x=<?php echo time(); ?> "></script> <!--End of Calendar HeatMap--> <?php echo "<br><br>"; if (isset($_GET["date"])) { $check_date = $_GET["date"];
function gradeit() { $("#check").hide(); $("#spinner").show(); var oldgrade = <?php echo($row && isset($row['grade']) ? $row['grade'] : '0.0'); ?>; var grade = 1.0 - <?php echo( $dueDate->penalty); ?>; if ( oldgrade > grade ) grade = oldgrade; // Never go down window.console && console.log("Sending grade="+grade); if ( window.CM_EDITOR !== false ) window.CM_EDITOR.save(); var code = document.getElementById("code").value; var toSend = { grade : grade, code : code }; $.ajax({ type: "POST", url: "<?php echo addSession('sendgrade.php'); ?>", dataType: "json", beforeSend: function (request) { request.setRequestHeader("X-CSRF-Token", CSRF_TOKEN); }, data: toSend }).done( function (data) { window.console && console.log("Grade response received..."); window.console && console.log(data); $("#spinner").hide(); if ( data.status == "success") { $("#gradegood").show(); $('#curgrade').text('1'); } else { $("#gradebad").show();
points for full credit)<br/> <?php } ?> Comments:<br/> <textarea rows="5" cols="60" name="note"></textarea><br/> <input type="submit" value="Grade" class="btn btn-primary"> <?php if ($assn_json->flag) { ?> <input type="submit" name="showFlag" onclick="$('#flagform').toggle(); return false;" value="Flag" class="btn btn-danger"> <?php } ?> <input type="submit" name="doCancel" onclick="location='<?php echo addSession($url_goback); ?> '; return false;" value="Cancel" class="btn btn-default"> </form> <?php if ($assn_json->flag) { ?> <form method="post" id="flagform" style="display:none"> <p>Please be considerate when flagging an item. Only use flagging when instructor attention is needed.</p> <input type="hidden" value="<?php echo $submit_id; ?> " name="submit_id"> <input type="hidden" value="<?php echo $user_id;
</p> <iframe id="my_iframe" width="98%" height="600px" style="border: 1px black solid"> </iframe> </div> <?php $OUTPUT->footerStart(); ?> <script type="text/javascript"> $UPDATE_INTERVAL = false; function updateNumbers() { window.console && console.log('Calling updateNumbers'); $.ajaxSetup({ cache: false }); // For IE... $.getJSON('<?php echo addSession($CFG->wwwroot . '/mod/grades/maintcount.php?link_id=' . $link_id); ?> ', function(data) { if ( $UPDATE_INTERVAL === false ) $UPDATE_INTERVAL = setInterval(updateNumbers,10000); window.console && console.log(data); $('#totspinner').hide(); $('#retspinner').hide(); $('#misspinner').hide(); oldtotal = $('#total').text(); window.console.log("old="+oldtotal); $('#total').text(data.total); if ( oldtotal.length > 1 && oldtotal != data.total ) $('#totspinner').show(); oldtoretrieve = $('#toretrieve').text(); $('#toretrieve').text(data.toretrieve); if ( oldtoretrieve.length > 1 && oldtoretrieve != data.toretrieve ) $('#retspinner').show();
</textarea><br/> <input type="submit" name="deleteSubmit" value="Complete Delete" class="btn btn-danger"> <input type="submit" name="doCancel" value="Cancel Delete" class="btn btn-normal" onclick="location=\'' . addSession('student.php?user_id=' . $user_id) . '\'; return false;"> </form>'; } else { echo '<p><a href="student.php?delete=yes&user_id=' . $user_id . '">Delete this submission and grades (allows student to resubmit)</a></p>' . "\n"; } echo "<p>Computed grade: " . $computed_grade . "<br/>\n"; if (isset($_GET['resend'])) { echo '<form method="post"> <input type="hidden" name="user_id" value="' . $user_id . '"> <input type="submit" name="resendSubmit" value="Resend the Grade" class="btn btn-warning"> <input type="submit" name="doCancel" value="Cancel Resend" class="btn btn-normal" onclick="location=\'' . addSession('student.php?user_id=' . $user_id) . '\'; return false;"> </form>'; } else { echo '<p><a href="student.php?resend=yes&user_id=' . $user_id . '"> Resend computed grade to the LMS</a></p>'; } if ($user_display !== false) { $user_display = " by " . $user_display; } if ($our_flags !== false && count($our_flags) > 0) { echo "<p style=\"color:red\">This entry {$user_display} has the following flags:</p>\n"; echo '<div style="margin:3px;">'; echo '<table border="1" class="table table-hover table-condensed table-responsive"><tr>'; echo "\n<th>Flagged By</th><th>Email</th><th>Comment</th><th>Time</th><th>Action</th></tr>"; foreach ($our_flags as $flag) { echo "\n<tr>";
?> <a href="index.php?viewall=yes" class="btn btn-default">Class Summary</a> <a href="index.php" class="btn btn-default">My Grades</a> <?php if ($links !== false && count($links) > 0) { ?> <div class="btn-group"> <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"> Activities <span class="caret"></span> </button> <ul class="dropdown-menu"> <?php foreach ($links as $link) { echo '<li><a href="#" onclick="window.location=\''; echo addSession('index.php?link_id=' . $link['link_id']) . '\';">'; echo htmlent_utf8($link['title']); echo "</a></li>\n"; } ?> </ul> </div> <?php } ?> <p></p> <?php } echo "<p>Class: " . $CONTEXT->title . "</p>\n"; if ($user_sql !== false) { if ($user_info !== false) {
function showSubmission($LTI, $assn_json, $submit_json, $assn_id, $user_id) { global $CFG, $PDOX; echo '<div style="padding:5px">'; $blob_ids = $submit_json->blob_ids; $urls = isset($submit_json->urls) ? $submit_json->urls : array(); $codes = isset($submit_json->codes) ? $submit_json->codes : array(); $blobno = 0; $urlno = 0; $codeno = 0; foreach ($assn_json->parts as $part) { if ($part->type == "image") { // This test triggers when an assignment is reconfigured // and old submissions have too few blobs if ($blobno >= count($blob_ids)) { continue; } $blob_id = $blob_ids[$blobno++]; if (is_array($blob_id)) { $blob_id = $blob_id[0]; } $url = getAccessUrlForBlob($blob_id); $title = 'Student image'; if (isset($part->title) && strlen($part->title) > 0) { $title = $part->title; } echo ' <a href="#" onclick="$(\'#myModal_' . $blobno . '\').modal();"'; echo 'alt="' . htmlent_utf8($title) . '" title="' . htmlent_utf8($title) . '">'; echo '<img src="' . addSession($url) . '" width="240"></a>' . "\n"; ?> <div class="modal fade" id="myModal_<?php echo $blobno; ?> "> <div class="modal-dialog modal-lg"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h4 class="modal-title"><?php echo htmlent_utf8($title); ?> </h4> </div> <div class="modal-body"> <img src="<?php echo addSession($url); ?> " style="width:100%"> </div> </div><!-- /.modal-content --> </div><!-- /.modal-dialog --> </div><!-- /.modal --> <?php } else { if ($part->type == "url") { $url = $urls[$urlno++]; echo '<p><a href="' . safe_href($url) . '" target="_blank">'; echo htmlentities(safe_href($url)) . '</a> (Will launch in new window)</p>' . "\n"; } else { if ($part->type == "code") { $code_id = $codes[$codeno++]; $row = $PDOX->rowDie("\n SELECT data FROM {$CFG->dbprefix}peer_text \n WHERE text_id = :TID AND user_id = :UID AND assn_id = :AID", array(":TID" => $code_id, ":AID" => $assn_id, ":UID" => $user_id)); if ($row === FALSE || strlen($row['data']) < 1) { echo "<p>No Code Found</p>\n"; } else { echo '<p>Code: <a href="#" onclick="$(\'#myModal_code_' . $codeno . '\').modal();">'; echo htmlent_utf8($part->title) . "</a> (click to view)</p>\n"; ?> <div class="modal fade" id="myModal_code_<?php echo $codeno; ?> "> <div class="modal-dialog modal-lg"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h4 class="modal-title"><?php echo htmlent_utf8($part->title); ?> </h4> </div> <div class="modal-body"> <!-- Don't indent or inadvertently add a newline once the pre starts --> <pre class="line-numbers"><code class="language-<?php echo $part->language; ?> "><?php echo htmlentities($row['data']); ?> </code> </pre> </div> </div><!-- /.modal-content --> </div><!-- /.modal-dialog --> </div><!-- /.modal --> <?php } } } } } echo "<br/> <br/>\n"; if ($blobno > 0) { echo "<p>Click on each image to see a larger view of the image.</p>\n"; } if (strlen($submit_json->notes) > 1) { echo "<p>Notes: " . htmlent_utf8($submit_json->notes) . "</p>\n"; } echo '<div style="padding:3px">'; }
<?php require_once 'config.php'; require_once 'pdo.php'; require_once 'lib/lms_lib.php'; use Tsugi\Core\LTIX; $session_id = LTIX::setupSession(); // See if we have a custom assignment setting. if (!isset($_POST['custom_assn'])) { require "lti/noredir.php"; return; } else { $url = $_POST['custom_assn']; $_SESSION['assn'] = $_POST['custom_assn']; } // Send us to where we are going next... $query = false; if (isset($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0) { $query = true; $url .= '?' . $_SERVER['QUERY_STRING']; } $location = addSession($url); session_write_close(); // To avoid any race conditions... if (headers_sent()) { echo '<p><a href="' . $url . '">Click to continue</a></p>'; } else { header('Location: ' . $location); }
function addChoice($choice, $PDOX, $p, $LINK, $USER) { $PDOX->queryDie("INSERT INTO {$p}clicker\n (link_id, user_id, guess, attend, ipaddr, count)\n VALUES ( :LI, :UI, :GU, NOW(), :IP, 1)\n ON DUPLICATE KEY UPDATE guess = :GU, ipaddr = :IP, count = count + 1", array(':LI' => $LINK->id, ':UI' => $USER->id, ':GU' => $choice, ':IP' => $_SERVER["REMOTE_ADDR"])); $_SESSION['success'] = 'Guess Recorded'; header('Location: ' . addSession('index.php')); }
require_once "../../config.php"; require_once $CFG->dirroot . "/pdo.php"; require_once $CFG->dirroot . "/lib/lms_lib.php"; require_once "peer_util.php"; use Tsugi\Core\LTIX; // Sanity checks $LTI = LTIX::requireData(); if (!$USER->instructor) { die("Instructor only"); } if (isset($_POST['doClear'])) { session_unset(); die('session unset'); } $OUTPUT->header(); $OUTPUT->bodyStart(); $OUTPUT->flashMessages(); $OUTPUT->welcomeUserCourse(); $OUTPUT->togglePre("Session data", safe_var_dump($_SESSION)); ?> <form method="post"> <input type="submit" name="doExit" onclick="location='<?php echo addSession('index.php'); ?> '; return false;" value="Exit"> <input type="submit" name="doClear" value="Clear Session (will log out out)"> </form> <?php flush(); $OUTPUT->footer();
///entrer les données dans la base //1 s'il manque des dates if (TRUE == $resultat < $nbre_dates) { $_SESSION['sauvegarde'] = $_POST; header('Location: ./index.php?a=31&m=' . $m . '&idsession=' . $idsession . '&mesno=45'); exit; } else { if (!$nom | !$nbre_dates | !$nbplace) { $mess = getError(4); //autres champs manquants } else { //Insertion des données switch ($m) { case 1: // ajout planification d'une session $idsession = addSession($dates, $nom, $nbplace, $nbre_dates, $anim, $salle, $tarif); if (FALSE == $idsession) { header("Location: ./index.php?a=37&mesno=0"); } else { for ($i = 0; $i < $nbre_dates; $i++) { insertDateSessions($idsession, $arraydate[$i], 0); } header("Location: ./index.php?a=37"); } break; case 2: // modifie programmation session //recuperation des dates pour modification/suppression if (FALSE == modifSession($idsession, $dates, $nom, $nbplace, $nbre_dates, $anim, $salle, $tarif)) { header("Location: ./index.php?a=37&mesno=0"); } else {