コード例 #1
0
ファイル: lib.php プロジェクト: shaamimahmed/tsugi
function gradeShowInfo($row)
{
    echo '<p><a href="grades.php">Back to All Grades</a>' . "</p><p>\n";
    echo "User Name: " . htmlent_utf8($row['displayname']) . "<br/>\n";
    echo "User Email: " . htmlent_utf8($row['email']) . "<br/>\n";
    echo "Last Submision: " . htmlent_utf8($row['updated_at']) . "<br/>\n";
    echo "Score: " . htmlent_utf8($row['grade']) . "<br/>\n";
    echo "</p>\n";
}
コード例 #2
0
ファイル: util.php プロジェクト: shaamimahmed/tsugi
function var_dump_pre($variable, $print = true)
{
    ob_start();
    var_dump($variable);
    $result = ob_get_clean();
    if ($print) {
        print htmlent_utf8($result);
    }
    return $result;
}
コード例 #3
0
ファイル: fileitem_json.php プロジェクト: amoskarugaba/sakai
<form method="post">
Service URL: <input type="text" name="content_item_return_url" size="120" value="<?php 
echo htmlentities($result_url);
?>
"/></br>
OAuth Consumer Key: <input type="text" name="oauth_consumer_key" size="80" value="<?php 
echo htmlentities($oauth_consumer_key);
?>
"/></br>
OAuth Consumer Secret: <input type="text" name="secret" size="80" value="<?php 
echo htmlentities($oauth_consumer_secret);
?>
"/></br>
<br/>
Content URL to send: </br>
<input type="text" name="content_url" 
size="80" value="<?php 
echo htmlent_utf8($content_url);
?>
"/>
</p><p>
Opaque Data: </br>
<textarea name="data" rows=5 cols=80>
<?php 
echo htmlent_utf8($data);
?>
</textarea>
</p><p>
<input type='submit' name='send' value="Send Content Response">
</form>
コード例 #4
0
ファイル: lms_lib.php プロジェクト: shaamimahmed/tsugi
function success_out($output)
{
    echo '<span style="color:green"><strong>' . htmlent_utf8($output) . "</strong></span><br/>\n";
    flush();
}
コード例 #5
0
ファイル: a02.php プロジェクト: ixtel/tsugi
<?php

require_once "webauto.php";
use Goutte\Client;
line_out("Grading PHP-Intro Assignment 2");
$url = getUrl('http://csevumich.byethost18.com/howdy.php');
if ($url === false) {
    return;
}
$grade = 0;
error_log("ASSN02 " . $url);
line_out("Retrieving " . htmlent_utf8($url) . "...");
flush();
// http://symfony.com/doc/current/components/dom_crawler.html
$client = new Client();
$crawler = $client->request('GET', $url);
$html = $crawler->html();
$OUTPUT->togglePre("Show retrieved page", $html);
line_out("Searching for h1 tag...");
$passed = 0;
$titlefound = false;
try {
    $h1 = $crawler->filter('h1')->text();
    line_out("Found h1 tag...");
} catch (Exception $ex) {
    error_out("Did not find h1 tag");
    $h1 = "";
}
if (stripos($h1, 'Hello') !== false) {
    success_out("Found 'Hello' in the h1 tag");
    $passed += 1;
コード例 #6
0
ファイル: CrudForm.php プロジェクト: shaamimahmed/tsugi
 /**
  *  Generate the HTML for an update form.
  *
  * Here is a sample call:
  *
  *     $from_location = "keys.php";
  *     $fields = array("key_key", "key_sha256", "secret", "created_at", "updated_at");
  *     $current = getCurrentFileUrl(__FILE__);
  *     $retval = CrudForm::updateForm($row, $fields, $current, $from_location, true, true);
  *
  * @param $row The existing data for the fields.
  * @param $fields An array of fields to be shown.
  * @param $current The URL of the current HTML page.
  * @param $from_location A URL to jump to when the user presses 'Cancel'.
  * @param $allow_edit True/false as to whether to show an Edit button
  * @param $allow_delete True/false as to whether to show a Delete button
  * @param $extra_buttons An array of additional buttons to show
  */
 public static function updateForm($row, $fields, $current, $from_location, $allow_edit = false, $allow_delete = false, $extra_buttons = false)
 {
     $key = $fields['0'];
     if (!isset($_REQUEST[$key])) {
         return "Required {$key}= parameter";
     }
     $key_value = $_REQUEST[$key] + 0;
     $do_edit = isset($_REQUEST['edit']) && $_REQUEST['edit'] == 'yes';
     echo '<form method="post">' . "\n";
     echo '<a href="' . $from_location . '" class="btn btn-default">' . _m('Exit') . '</a>' . "\n";
     if ($allow_edit) {
         if ($do_edit) {
             echo '<input type="submit" name="doUpdate" class="btn btn-normal" value="' . _m("Update") . '">' . "\n";
             echo '<a href="' . $current . '?' . $key . '=' . $key_value . '" class="btn btn-success">' . _m("Cancel Edit") . '</a>' . "\n";
         } else {
             echo '<a href="' . $current . '?' . $key . '=' . $key_value . '&edit=yes" class="btn btn-warning">' . _m("Edit") . '</a>' . "\n";
         }
     }
     if (is_array($extra_buttons)) {
         foreach ($extra_buttons as $button_text => $button_url) {
             echo '<a href="' . $button_url . '" class="btn btn-success">' . _m($button_text) . '</a>' . "\n";
         }
     }
     if ($allow_delete) {
         echo '<input type="hidden" name="' . $key . '" value="' . $key_value . '">' . "\n";
         echo '<input type="submit" name="doDelete" class="btn btn-danger" value="' . _m("Delete") . '"';
         echo " onclick=\"return confirm('Are you sure you want to delete this record?');\">\n";
     }
     echo "<p>\n";
     for ($i = 0; $i < count($fields); $i++) {
         $field = $fields[$i];
         $value = $row[$field];
         if (!$do_edit) {
             echo '<p><strong>' . self::fieldToTitle($field) . "</strong></p>\n";
             if (strpos($field, "secret") !== false) {
                 echo "<p onclick=\"\$('#stars_{$i}').toggle();\$('#text_{$i}').toggle();\">\n";
                 echo "<span id=\"stars_{$i}\">***********</span>\n";
                 echo "<span style=\"display: none;\" id=\"text_{$i}\">" . htmlent_utf8($value) . '</span>';
                 echo "\n</p>\n";
             } else {
                 echo "<p>" . htmlent_utf8($value) . "</p>\n";
             }
             continue;
         }
         if ($i == 0 && strpos($field, "_id") !== false) {
             echo '<input type="hidden" name="' . $field . '" value="' . htmlent_utf8($value) . '">' . "\n";
             continue;
         }
         // Don't allow explicit updating of these fields
         if (strpos($field, "_at") > 0) {
             continue;
         }
         echo '<div class="form-group">' . "\n";
         echo '<label for="' . $field . '">' . self::fieldToTitle($field) . "<br/>\n";
         if (isset($_POST[$field])) {
             $value = $_POST[$field];
         }
         if (strpos($field, "secret") !== false) {
             echo '<input id="' . $field . '" type="password" size="80" name="' . $field . '" value="' . htmlent_utf8($value) . '"';
             echo "onclick=\"if ( \$(this).attr('type') == 'text' ) \$(this).attr('type','password'); else \$(this).attr('type','text'); return false;\">\n";
         } else {
             if (strlen($value) > 60) {
                 echo '<textarea rows="10" cols="70" id="' . $field . '" name="' . $field . '">' . htmlent_utf8($value) . '</textarea>' . "\n";
             } else {
                 echo '<input type="text" size="80" id="' . $field . '" name="' . $field . '" value="' . htmlent_utf8($value) . '">' . "\n";
             }
         }
         echo "</label>\n</div>";
     }
     echo '</form>' . "\n";
     return true;
 }
コード例 #7
0
ファイル: index.php プロジェクト: shaamimahmed/tsugi
require_once $CFG->dirroot . "/pdo.php";
require_once $CFG->dirroot . "/lib/lms_lib.php";
use Tsugi\Core\LTIX;
// Sanity checks
$LTI = LTIX::requireData();
$p = $CFG->dbprefix;
// The reset operation is a normal POST - not AJAX
if ($USER->instructor && isset($_POST['reset'])) {
    $PDOX->queryDie("DELETE FROM {$p}rps WHERE link_id = :LI", array(':LI' => $LINK->id));
    header('Location: ' . addSession('index.php'));
    return;
}
?>
<html><head><title><?php 
_e("Playing Rock Paper Scissors in");
echo htmlent_utf8($CONTEXT->title);
?>
</title>
<script type="text/javascript"
src="<?php 
echo $CFG->staticroot;
?>
/static/js/jquery-1.10.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
  window.console && console.log('Hello JQuery..');
  $("#rock").click( function() { play(0); } ) ;
  $("#paper").click( function() { play(1); } ) ;
  $("#scissors").click( function() { play(2); } ) ;
});
コード例 #8
0
ファイル: profile.php プロジェクト: shaamimahmed/tsugi
</p>
  <div class="control-group pull-right hidden-phone">
      <button type="submit" style="margin-top: 40px" class="btn btn-primary">Save Profile Data</button>
  </div>

  <div id="map_canvas" style="margin: 10px; width:400px; max-width: 100%; height:400px"></div>

  <div id="latlong" style="display:none" class="control-group">
    <p>Latitude: <input size="30" type="text" id="latbox" name="lat" class="disabled"
    <?php 
    echo ' value="' . htmlent_utf8($lat) . '" ';
    ?>
    ></p>
    <p>Longitude: <input size="30" type="text" id="lngbox" name="lng" class="disabled"
    <?php 
    echo ' value="' . htmlent_utf8($lng) . '" ';
    ?>
    ></p>
  </div>

<p>
If you don't even want to reveal your country, put yourself
in Greenland in the middle of a glacier. One person put their location
in the middle of a bar.  :)
</p>
<?php 
}
?>
</form>
<?php 
// After jquery gets loaded at the *very* end...
コード例 #9
0
ファイル: index.php プロジェクト: shaamimahmed/tsugi
// View
$OUTPUT->header();
$OUTPUT->bodyStart();
$OUTPUT->flashMessages();
$OUTPUT->welcomeUserCourse();
$foldername = getFolderName();
if (!file_exists($foldername)) {
    mkdir($foldername);
}
$stmt = $PDOX->prepare("SELECT file_id, file_name FROM {$p}sample_blob\n        WHERE context_id = :CI");
$stmt->execute(array(":CI" => $CONTEXT->id));
$count = 0;
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
    $id = $row['file_id'];
    $fn = $row['file_name'];
    echo '<li><a href="blob_serve.php?id=' . $id . '" target="_new">' . htmlent_utf8($fn) . '</a>';
    if ($USER->instructor) {
        echo ' (<a href="blob_delete.php?id=' . $id . '">Delete</a>)';
    }
    echo '</li>';
    $count++;
}
if ($count == 0) {
    echo "<p>No Files Found</p>\n";
}
echo "</ul>\n";
if ($USER->instructor) {
    ?>
<h4>Upload file (max <?php 
    echo maxUpload();
    ?>
コード例 #10
0
ファイル: index.php プロジェクト: shaamimahmed/tsugi
        <form id="prefs_form">
            <?php 
    if ($firstname === false) {
        ?>
                <input type="checkbox" name="allow_first" style="display:hidden">
            <?php 
    } else {
        ?>
                <input type="checkbox" name="allow_first" <?php 
        if ($row['first'] == 1) {
            echo "checked";
        }
        ?>
            >
            Share your first name (<?php 
        echo htmlent_utf8($firstname);
        ?>
) on the map<br/>
            <?php 
    }
    ?>
            <input type="checkbox" name="allow_name" <?php 
    if (!isset($USER->displayname)) {
        echo ' style="display:hidden"';
    } else {
        if ($row['name'] == 1) {
            echo "checked";
        }
    }
    ?>
            >
コード例 #11
0
ファイル: index.php プロジェクト: shaamimahmed/tsugi
            echo "<th>Action</th>";
        }
        echo "</tr>\n";
        $max_points = false;
        foreach ($our_grades as $grade) {
            if ($assn_json->peerpoints > 0) {
                if ($max_points === false) {
                    $max_points = $grade['points'];
                }
                $show = $grade['points'];
                if ($show < $max_points) {
                    $show = '';
                }
                echo "<tr><td>" . $show . "</td>";
            }
            echo "<td>" . htmlent_utf8($grade['note']) . "</td>\n";
            if ($assn_json->flag) {
                echo '<td><form><input type="submit" name="showFlag" value="Flag"' . 'onclick="$(\'#flag_grade_id\').val(\'' . $grade['grade_id'] . '\'); $(\'#flagform\').toggle(); return false;" class="btn btn-danger">' . '</form></td>';
            }
            echo "</tr>\n";
        }
        echo "</table>\n";
        if ($max_points !== false) {
            echo "<p>Your overall score from your peers: {$max_points} </p>\n";
        }
    }
}
$OUTPUT->exitButton();
?>
<form method="post" id="flagform" style="display:none">
<p>&nbsp;</p>
コード例 #12
0
ファイル: grade-detail.php プロジェクト: shaamimahmed/tsugi
<?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>Submission:</p>\n";
$json = json_decode($row['json']);
if (is_object($json) && isset($json->code)) {
    echo "<pre>\n";
    echo htmlent_utf8($json->code);
    echo "\n";
    echo "</pre>\n";
}
$OUTPUT->footer();
コード例 #13
0
ファイル: settings_json.php プロジェクト: amoskarugaba/sakai
                    $debugin = get_body_sent_debug();
                    $debugout = get_body_received_debug();
                } else {
                    if (isset($_REQUEST['set_proxy'])) {
                        $postBody = true;
                        $response = sendOAuthBody("PUT", $proxy_url, $oauth_consumer_key, $oauth_consumer_secret, $content_type, $settings);
                        $debugin = get_body_sent_debug();
                        $debugout = get_body_received_debug();
                    } else {
                        exit;
                    }
                }
            }
        }
    }
}
global $LastOAuthBodyBaseString;
$lbs = $LastOAuthBodyBaseString;
ltiUtilTogglePre("Sent Headers", $debugin);
if ($postBody !== false) {
    ltiUtilTogglePre("Our Body Data", indent($settings));
}
ltiUtilTogglePre("Our Base String", $lbs);
ltiUtilTogglePre("Results and Headers", $debugout);
if (strlen($response) < 1) {
    echo "<p>HTTP Response Body empty.</p>\n";
} else {
    echo "<br/><b>Returned data:</b>\n<pre>\n";
    echo htmlent_utf8(indent($response));
    echo "\n</pre>\n";
}
コード例 #14
0
ファイル: index.php プロジェクト: shaamimahmed/tsugi
        if ($data) {
            $parms['data'] = $data;
        }
        $parms = LTIX::signParameters($parms, $result_url, "POST", "Install Tool");
        $endform = '<a href="index.php" class="btn btn-warning">Back to Store</a>';
        $content = LTI::postLaunchHTML($parms, $result_url, true, false, $endform);
        echo $content;
    } else {
        echo '<div style="border: 2px, solid, red;" class="card">';
        if ($fa_icon) {
            echo '<a href="index.php?install=' . urlencode($tool) . '">';
            echo '<i class="fa ' . $fa_icon . ' fa-2x" style="color: #1894C7; float:right; margin: 2px"></i>';
            echo '</a>';
        }
        echo '<p><strong>' . htmlent_utf8($title) . "</strong></p>";
        echo '<p>' . htmlent_utf8($text) . "</p>\n";
        echo '<center><a href="index.php?install=' . urlencode($tool) . '" class="btn btn-default" role="button">Details</a></center>';
        echo "</div>\n";
    }
    $toolcount++;
}
echo "</div>\n";
if ($toolcount < 1) {
    lmsDie("No tools to register..");
}
$OUTPUT->footerStart();
// https://github.com/LinZap/jquery.waterfall
if (!$install) {
    ?>
<script type="text/javascript" src="static/waterfall-light.js"></script>
<script>
コード例 #15
0
ファイル: content_json.php プロジェクト: philsawa/sakai
?>
</head>
<body style="font-family:sans-serif; background-color:#add8e6">
<p><b>Calling IMS LTI Content Item Service</b></p>
<?php 
?>
<p>
<form method="post">
Service URL: <input type="text" name="url" size="120" value="<?php 
echo htmlentities($result_url);
?>
"/></br>
OAuth Consumer Key: <input type="text" name="key" size="80" value="<?php 
echo htmlentities($oauth_consumer_key);
?>
"/></br>
OAuth Consumer Secret: <input type="text" name="secret" size="80" value="<?php 
echo htmlentities($oauth_consumer_secret);
?>
"/></br>
</p><p>
Content URL to send: </br>
<input type="text" name="content_url" 
size="80" value="<?php 
echo htmlent_utf8($content_url);
?>
"/>
</p><p>
<input type='submit' name='send' value="Send Content Response">
</form>
コード例 #16
0
ファイル: Output.php プロジェクト: JANQLIANGTSAI/tsugi
 /**
  * Welcome the user to the course
  */
 function welcomeUserCourse()
 {
     global $USER, $CONTEXT;
     if (isset($USER->displayname)) {
         if (isset($CONTEXT->title)) {
             printf(_m("<p>Welcome %s from %s"), htmlent_utf8($USER->displayname), htmlent_utf8($CONTEXT->title));
         } else {
             printf(_m("<p>Welcome %s"), htmlent_utf8($USER->displayname));
         }
     } else {
         if (isset($CONTEXT->title)) {
             printf(_m("<p>Welcome from %s"), htmlent_utf8($CONTEXT->title));
         } else {
             printf(_m("<p>Welcome "));
         }
     }
     if ($USER->instructor) {
         echo " " . _m("(Instructor)");
     }
     echo "</p>\n";
 }
コード例 #17
0
ファイル: convert.php プロジェクト: shaamimahmed/tsugi
<a href="http://www.imsglobal.org/question/" target="_blank">QTI 1.2.1</a>.
</p><p>
This is still a <a href="https://github.com/csev/gift2qti" target="_blank">work in progress</a>
and currently only supports single-answer multiple-choice, true/false, and essay questions.
The sample text below has some GIFT formats that this tool does not yet support so some of the questions
below will not be converted.  Feel free to send me a Pull request on gitHub :).
</p>
<form method="post" action="process.php" target="working" style="margin:20px;">
<p style="float:right">
<input type="submit" name="submit" class="btn btn-primary" value="Convert GIFT to QTI"
onclick="$('#myModal').modal('show');"></p>
<p>Quiz Title: <input type="text" name="title" size="60" value="Converted using GIFT2QTI"/></p>
<p>Quiz File Name (no suffix): <input type="text" name="name" size="30"/> (optional)</p>
<textarea rows="30" style="width: 98%" name="text">
<?php 
echo htmlent_utf8($text);
?>
</textarea>
<p><input type="checkbox" name="bypass" value="bypass">
Do not validate the XML</p>
</form>
<p>If you want to add this tool to the <b>Settings -&gt; Import Content</b>
in the Canvas LMS use this URL:
<a href="<?php 
echo $config_url;
?>
" target="_blank"><?php 
echo $config_url;
?>
</a>
</p>
コード例 #18
0
ファイル: tp.php プロジェクト: kingmook/sakai
togglePre("Registration Response", htmlent_utf8(json_indent($response)));
$tc_half_shared_secret = false;
if ($last_http_response == 201 || $last_http_response == 200) {
    if ($oauth_splitsecret && $tp_half_shared_secret) {
        $responseObject = json_decode($response);
        if (isset($responseObject->tc_half_shared_secret)) {
            $tc_half_shared_secret = $responseObject->tc_half_shared_secret;
            echo "<p>tc_half_shared_secret: " . $tc_half_shared_secret . "</p>\n";
            if (strlen($tc_half_shared_secret) != 128) {
                echo '<p style="color: red">Warning secret length of ' . strlen($tc_half_shared_secret) . " should be 128</p>\n";
            }
            $split_secret = $tc_half_shared_secret . $tp_half_shared_secret;
            $_SESSION['split_secret'] = $split_secret;
            echo "<p>Split Secret: " . $split_secret . "</p>\n";
        } else {
            echo "<p>Error: Tool Consumer did not provide oauth_splitsecret</p>\n";
        }
    }
    echo '<p><a href="' . $launch_presentation_return_url . '">Continue to launch_presentation_url</a></p>' . "\n";
    exit;
}
echo "Registration failed, http code=" . $last_http_response . "\n";
// Check to see if they slid us the base string...
$responseObject = json_decode($response);
if ($responseObject != null) {
    $base_string = $responseObject->base_string;
    if (strlen($base_string) > 0 && strlen($LastOAuthBodyBaseString) > 0 && $base_string != $LastOAuthBodyBaseString) {
        $compare = compare_base_strings($LastOAuthBodyBaseString, $base_string);
        togglePre("Compare Base Strings (ours first)", htmlent_utf8($compare));
    }
}
コード例 #19
0
ファイル: a03.php プロジェクト: shaamimahmed/tsugi
    }
    // High guess
    $u = $url . "?guess=" . rand(45, 2000);
    line_out("Retrieving " . htmlent_utf8($u));
    $crawler = $client->request('GET', $u);
    $html = $crawler->html();
    $OUTPUT->togglePre("Show retrieved page", $html);
    line_out("Looking for 'Your guess is too high'");
    if (stripos($html, 'Your guess is too high') > 0) {
        $passed++;
    } else {
        error_out("Not found");
    }
    // Good guess
    $u = $url . "?guess=42";
    line_out("Retrieving " . htmlent_utf8($u));
    $crawler = $client->request('GET', $u);
    $html = $crawler->html();
    $OUTPUT->togglePre("Show retrieved page", $html);
    line_out("Looking for 'Congratulations - You are right'");
    if (stripos($html, 'congratulations') > 0) {
        $passed++;
    } else {
        error_out("Not found");
    }
} catch (Exception $ex) {
    error_out("The autograder did not find something it was looking for in your HTML - test ended.");
    error_log($ex->getMessage());
    error_log($ex->getTraceAsString());
    $detail = "This indicates the source code line where the test stopped.\n" . "It may not make any sense without looking at the source code for the test.\n" . 'Caught exception: ' . $ex->getMessage() . "\n" . $ex->getTraceAsString() . "\n";
    $OUTPUT->togglePre("Internal error detail.", $detail);
コード例 #20
0
ファイル: peer_util.php プロジェクト: ixtel/tsugi
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">';
}
コード例 #21
0
ファイル: index.php プロジェクト: ixtel/tsugi
  <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) {
        echo "<p>Results for " . $user_info['displayname'] . "</p>\n";
コード例 #22
0
ファイル: index.php プロジェクト: shaamimahmed/tsugi
$OUTPUT->welcomeUserCourse();
if ($USER->instructor) {
    echo "<p>Press the settings button in the upper left to change the settings.</p>\n";
}
// Load the old values for the settings
$sk = Settings::linkGet('sample_key');
echo "<p>The currentsetting for sample_key is: <b>" . htmlent_utf8($sk) . "</b></p>\n";
$mk = Settings::linkGet('manual_key');
echo "<p>The currentsetting for manual_key is: <b>" . htmlent_utf8($mk) . "</b></p>\n";
// Lets show how to set a setting in our own code
if ($USER->instructor) {
    ?>
<form method="post">
Enter value for 'manual_key' setting:
<input type="text" name="manual_key" size="40" value="<?php 
    echo htmlent_utf8($mk);
    ?>
"><br/>
<input type="submit" name="send" value="Update 'manual_key' setting">
</form>
<hr/>
<?php 
}
if (isset($_SESSION['debug_log']) && count($_SESSION['debug_log']) > 0) {
    echo "<p>Debug output from setting send:</p>\n";
    $OUTPUT->dumpDebugArray($_SESSION['debug_log']);
}
unset($_SESSION['debug_log']);
echo "\n<hr/>\n<pre>Global Tsugi Objects:\n\n";
var_dump($USER);
var_dump($CONTEXT);
コード例 #23
0
      <lticm:property name="url"><?php 
echo $CFG->wwwroot;
?>
/mod/store/index.php?type=homework_submission</lticm:property>
    </lticm:options>
    <lticm:options name="editor_button">
      <lticm:property name="message_type">ContentItemSelectionRequest</lticm:property>
      <lticm:property name="url"><?php 
echo $CFG->wwwroot;
?>
/mod/store/index.php?type=editor_button</lticm:property>
    </lticm:options>
    <lticm:property name="selection_height">500</lticm:property>
    <lticm:property name="selection_width">500</lticm:property>
    <lticm:property name="text"><?php 
echo htmlent_utf8(strip_tags($CFG->servicename));
?>
</lticm:property>
  </blti:extensions>
</cartridge_basiclti_link><?php 
/*
Best documentation on how it works is here:

https://www.eduappcenter.com/docs/extensions/content

I believe you already have a canvas account and you can install 
a tool in any course you have or create. If you want to be able 
to see it in action, you can install this tool:

http://lti-tool-provider.herokuapp.com/
コード例 #24
0
ファイル: index.php プロジェクト: JANQLIANGTSAI/tsugi
    SettingsForm::dueDate();
    SettingsForm::done();
    SettingsForm::end();

} // end isInstructor() 
?>

<div class="modal fade" id="info">
  <div class="modal-dialog">
    <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
if ( isset($LINK->title) ) {
    echo(htmlent_utf8($LINK->title));
} else {
    $OUTPUT->welcomeUserCourse();
}
?></h4>
      </div>
      <div class="modal-body">
<?php if ( $EX === false ) { ?>
        <p>This is an open-ended space for you to write and execute Python programs.
        This page does not check our output and it does not send a grade back.  It is
        here as a place for you to develop small programs and test things out.
        </p>
<?php if ( $LINK->result_id !== false ) { ?>
        <p>
        Whatever code you type will be saved and restored when you come back to this
        page.</p>
コード例 #25
0
ファイル: SettingsForm.php プロジェクト: csev/tsugi-php
    /**
     * Emit the text and form fields to support due dates
     */
    public static function dueDate()
    {
        global $USER;
        $due = Settings::linkGet('due', '');
        $timezone = Settings::linkGet('timezone', 'Pacific/Honolulu');
        $time = Settings::linkGet('penalty_time', 86400);
        $cost = Settings::linkGet('penalty_cost', 0.2);
        if (!$USER->instructor) {
            if (strlen($due) < 1) {
                echo "<p>There is currently no due date/time for this assignment.</p>\n";
                return;
            }
            $dueDate = self::getDueDate();
            echo "<p>Due date: " . htmlent_utf8($due) . "</p>\n";
            echo "<p>" . $dueDate->penaltyinfo . "</p>\n";
            if ($dueDate->message) {
                echo '<p style="color:red;">' . $dueDate->message . '</p>' . "\n";
            }
            return;
        }
        ?>
        <label for="due">
            Please enter a due date in ISO 8601 format (2015-01-30T20:30) or leave blank for no due date.
            You can leave off the time to allow the assignment to be turned in any time during the day.<br/>
        <input type="text" class="form-control" value="<?php 
        echo htmlspec_utf8($due);
        ?>
" name="due"></label>
        <label for="timezone">
            Please enter a valid PHP Time Zone like 'Pacific/Honolulu' (default).  If you are
            teaching in many time zones around the world, 'Pacific/Honolulu' is a good time
            zone to choose - this is why it is the default.<br/>
        <input type="text" class="form-control" value="<?php 
        echo htmlspec_utf8($timezone);
        ?>
" name="timezone"></label>
            <p>The next two fields determine the "overall penalty" for being late.  We define a time period
            (in seconds) and a fractional penalty per time period.  The penalty is assessed for each
            full or partial time period past the due date.  For example to deduct 20% per day, you would
            set the period to be 86400 (24*60*60) and the penalty to be 0.2.
            </p>
        <label for="penalty_time">Please enter the penalty time period in seconds.<br/>
        <input type="text" class="form-control" value="<?php 
        echo htmlspec_utf8($time);
        ?>
" name="penalty_time"></label>
        <label for="penalty_cost">Please enter the penalty deduction as a decimal between 0.0 and 1.0.<br/>
        <input type="text" class="form-control" value="<?php 
        echo htmlspec_utf8($cost);
        ?>
" name="penalty_cost"></label>
<?php 
    }
コード例 #26
0
ファイル: setup.php プロジェクト: 4sp1r3/tsugi
function echo_log($msg)
{
    echo htmlent_utf8($msg);
    error_log(str_replace("\n", " ", $msg));
}
コード例 #27
0
ファイル: tool.php プロジェクト: ja-sakai-demo/sakai
    }
    print "<pre>\n";
    print "Context Information:\n\n";
    print htmlent_utf8($context->dump());
    print "</pre>\n";
} else {
    print "<p style=\"color:red\">Could not establish context: " . $context->message . "<p>\n";
}
print "<p>Base String:<br/>\n";
print htmlent_utf8($context->basestring);
print "<br/></p>\n";
echo '<a href="basecheck.php?b=' . urlencode($context->basestring) . '" target="_blank">Compare This Base String</a><br/>';
print "<br/></p>\n";
print "<pre>\n";
print "Raw POST Parameters:\n\n";
ksort($_POST);
foreach ($_POST as $key => $value) {
    if (get_magic_quotes_gpc()) {
        $value = stripslashes($value);
    }
    print htmlent_utf8($key) . "=" . htmlent_utf8($value) . " (" . mb_detect_encoding($value) . ")\n";
}
print "\nRaw GET Parameters:\n\n";
ksort($_GET);
foreach ($_GET as $key => $value) {
    if (get_magic_quotes_gpc()) {
        $value = stripslashes($value);
    }
    print htmlent_utf8($key) . "=" . htmlent_utf8($value) . " (" . mb_detect_encoding($value) . ")\n";
}
print "</pre>";
コード例 #28
0
echo "<ul>\n";
$toolcount = 0;
foreach ($tools as $tool) {
    $path = str_replace("../", "", $tool);
    // echo("Checking $path ...<br/>\n");
    unset($REGISTER_LTI2);
    require $tool;
    if (isset($REGISTER_LTI2) && is_array($REGISTER_LTI2)) {
        if (isset($REGISTER_LTI2['name']) && isset($REGISTER_LTI2['short_name']) && isset($REGISTER_LTI2['description'])) {
        } else {
            lmsDie("Missing required name, short_name, and description in " . $tool);
        }
        $script = isset($REGISTER_LTI2['script']) ? $REGISTER_LTI2['script'] : "index.php";
        $path = "/" . str_replace("register.php", $script, $path);
        $url = $content_return_url;
        $url .= strpos($url, '?') ? '&' : '?';
        $url .= 'return_type=lti_launch_url&url=';
        $url .= urlencode($CFG->wwwroot . $path);
        $url .= "&title=" . urlencode($REGISTER_LTI2['name']);
        $url .= "&text=" . urlencode($REGISTER_LTI2['name']);
        $url .= "&description=" . urlencode($REGISTER_LTI2['description']);
        echo '<li><a href="' . $url;
        echo '">Select Tool: ' . htmlent_utf8($REGISTER_LTI2['name']) . "</a><br/>";
        echo htmlent_utf8($REGISTER_LTI2['description']) . "</li>\n";
        $toolcount++;
    }
}
echo "</ul>\n";
if ($toolcount < 1) {
    lmsDie("No tools to register..");
}
コード例 #29
0
ファイル: lti_util.php プロジェクト: philsawa/sakai
 function redirect($url = false)
 {
     if ($url === false) {
         $host = $_SERVER['HTTP_HOST'];
         $uri = $_SERVER['PHP_SELF'];
         $location = $_SERVER['HTTPS'] ? 'https://' : 'http://';
         $location = $location . $host . $uri;
     } else {
         $location = $url;
     }
     if (headers_sent()) {
         echo '<a href="' . htmlent_utf8($location) . '">Continue</a>' . "\n";
     } else {
         $location = htmlent_utf8($this->addSession($location));
         header("Location: {$location}");
     }
 }
コード例 #30
0
ファイル: Table.php プロジェクト: ixtel/tsugi
    public static function pagedTable($rows, $searchfields = array(), $orderfields = false, $view = false, $params = false)
    {
        if ($params === false) {
            $params = $_GET;
        }
        if ($orderfields === false) {
            $orderfields = $searchfields;
        }
        $page_start = isset($params['page_start']) ? $params['page_start'] + 0 : 0;
        if ($page_start < 0) {
            $page_start = 0;
        }
        $page_length = isset($params['page_length']) ? $params['page_length'] + 0 : self::$DEFAULT_PAGE_LENGTH;
        if ($page_length < 0) {
            $page_length = 0;
        }
        $search = '';
        if (isset($params['search_text'])) {
            $search = $params['search_text'];
        }
        $count = count($rows);
        $have_more = false;
        if ($count > $page_length) {
            $have_more = true;
            $count = $page_length;
        }
        echo '<div style="float:right">';
        if ($page_start > 0) {
            echo '<form style="display: inline">';
            echo '<input type="submit" value="Back" class="btn btn-default">';
            $page_back = $page_start - $page_length;
            if ($page_back < 0) {
                $page_back = 0;
            }
            Table::doForm($params, array('page_start' => $page_back));
            echo "</form>\n";
        }
        if ($have_more) {
            echo '<form style="display: inline">';
            echo '<input type="submit" value="Next" class="btn btn-default"> ';
            $page_next = $page_start + $page_length;
            Table::doForm($params, array('page_start' => $page_next));
            echo "</form>\n";
        }
        echo "</div>\n";
        echo '<form>';
        echo '<input type="text" id="paged_search_box" value="' . htmlent_utf8($search) . '" name="search_text">';
        Table::doForm($params, array('search_text' => false, 'page_start' => false));
        ?>
    <input type="submit" value="Search" class="btn btn-default">
    <input type="submit" value="Clear Search" class="btn btn-default"
    onclick="document.getElementById('paged_search_box').value = '';"
    >
    </form>
    <?php 
        if ($count < 1) {
            echo "<p>Nothing to display.</p>\n";
            return;
        }
        // print_r($orderfields);
        // echo("<hr>\n");
        // print_r($rows[0]);
        ?>

    <div style="padding:3px;">
    <table border="1" class="table table-hover table-condensed table-responsive">
    <tr>
    <?php 
        $first = true;
        $thispage = basename($_SERVER['PHP_SELF']);
        if ($view === false) {
            $view = $thispage;
        }
        foreach ($rows as $row) {
            $count--;
            if ($count < 0) {
                break;
            }
            if ($first) {
                echo "\n<tr>\n";
                $desc = isset($params['desc']) ? $params['desc'] + 0 : 0;
                $order_by = isset($params['order_by']) ? $params['order_by'] : '';
                foreach ($row as $k => $v) {
                    if (strpos($k, "_") === 0) {
                        continue;
                    }
                    if ($view !== false && strpos($k, "_id") !== false && is_numeric($v)) {
                        continue;
                    }
                    if (!Table::matchColumns($k, $orderfields)) {
                        echo "<th>" . CrudForm::fieldToTitle($k) . "</th>\n";
                        continue;
                    }
                    $override = array('order_by' => $k, 'desc' => 0, 'page_start' => false);
                    $d = $desc;
                    $color = "black";
                    if ($k == $order_by || $order_by == '' && $k == 'id') {
                        $d = ($desc + 1) % 2;
                        $override['desc'] = $d;
                        $color = $d == 1 ? 'green' : 'red';
                    }
                    $stuff = Table::doUrl($params, $override);
                    echo '<th>';
                    echo ' <a href="' . $thispage;
                    if (strlen($stuff) > 0) {
                        echo "?";
                        echo $stuff;
                    }
                    echo '" style="color: ' . $color . '">';
                    echo ucwords(str_replace('_', ' ', $k));
                    echo "</a></th>\n";
                }
                echo "</tr>\n";
            }
            $first = false;
            $link_name = false;
            echo "<tr>\n";
            foreach ($row as $k => $v) {
                if (strpos($k, "_") === 0) {
                    continue;
                }
                if ($view !== false && strpos($k, "_id") !== false && is_numeric($v)) {
                    $link_name = $k;
                    $link_val = $v;
                    continue;
                }
                echo "<td>";
                if ($link_name !== false) {
                    echo '<a href="' . $view . '?' . $link_name . "=" . $link_val . '">';
                    if (strlen($v) < 1) {
                        $v = $link_name . ':' . $link_val;
                    }
                }
                echo htmlent_utf8($v);
                if ($link_name !== false) {
                    echo '</a>';
                }
                $link_name = false;
                echo "</td>\n";
            }
            echo "</tr>\n";
        }
        echo "</table>\n";
        echo "</div>\n";
    }