Esempio n. 1
0
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">&times;</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">&times;</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/>&nbsp;<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">';
}
Esempio n. 2
0
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">&times;</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/>&nbsp;<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">';
}
Esempio n. 3
0
<?php

require_once "../../config.php";
require_once $CFG->dirroot . "/pdo.php";
require_once $CFG->dirroot . "/lib/lms_lib.php";
require_once $CFG->dirroot . "/core/gradebook/lib.php";
session_start();
// Get the user's grade data also checks session
$row = gradeLoad($_REQUEST['user_id']);
// View
$OUTPUT->header();
$OUTPUT->bodyStart();
$OUTPUT->flashMessages();
// Show the basic info for this user
gradeShowInfo($row);
// Unique detail
echo "<p>Submitted URL:</p>\n";
$json = json_decode($row['json']);
if (is_object($json) && isset($json->url)) {
    echo "<p><a href=\"" . safe_href($json->url) . "\" target=\"_new\">";
    echo htmlent_utf8($json->url);
    echo "</a></p>\n";
}
$OUTPUT->footer();