// Sanity checks
$LTI = LTIX::requireData();
$p = $CFG->dbprefix;
$OUTPUT->header();
$OUTPUT->bodyStart();
$OUTPUT->flashMessages();
$OUTPUT->welcomeUserCourse();
if (!$USER->instructor) {
    echo "<p>This tool must be launched by the instructor</p>";
    $OUTPUT->footer();
    exit;
}
// See https://canvas.instructure.com/doc/api/file.link_selection_tools.html
// Needed return values
$content_return_types = LTIX::postGet("ext_content_return_types", false);
$content_return_url = LTIX::postGet("ext_content_return_url", false);
if (strlen($content_return_url) < 1) {
    lmsDie("Missing ext_content_return_url");
}
if (strpos($content_return_types, "lti_launch_url") === false) {
    lmsDie("This tool requires ext_content_return_types=lti_launch_url");
}
// Scan the tools folders for registration settings
$tools = findFiles("register.php", "../");
if (count($tools) < 1) {
    lmsDie("No register.php files found...<br/>\n");
}
echo "<ul>\n";
$toolcount = 0;
foreach ($tools as $tool) {
    $path = str_replace("../", "", $tool);
示例#2
0
     if ($fa_icon) {
         echo '<i class="fa ' . $fa_icon . ' fa-3x" style="color: #1894C7; float:right; margin: 2px"></i>';
     }
     echo '<center>';
     echo "<h1>" . htmlent_utf8($title) . "</h1>\n";
     echo "<p>" . htmlent_utf8($text) . "</p>\n";
     $script = isset($REGISTER_LTI2['script']) ? $REGISTER_LTI2['script'] : "index.php";
     $path = $CFG->wwwroot . '/' . str_replace("register.php", $script, $path);
     // Title is for the href and text is for display
     $json = LTI::getLtiLinkJSON($path, $title, $title, false, $fa_icon);
     $retval = json_encode($json);
     $parms = array();
     $parms["lti_message_type"] = "ContentItemSelection";
     $parms["lti_version"] = "LTI-1p0";
     $parms["content_items"] = $retval;
     $data = LTIX::postGet('data');
     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>";
示例#3
0
文件: LTIX.php 项目: na1iu/tsugi
 /**
  * Send a Caliper Body to the correct URL using the key and secret
  *
  * This is not yet a standard or production - it uses the Canvas 
  * extension only.
  * 
  */
 public static function caliperSend($caliperBody, $content_type = 'application/json', &$debug_log = false)
 {
     $caliperURL = LTIX::postGet('custom_sub_canvas_caliper_url');
     if (strlen($caliperURL) == 0) {
         if (is_array($debug_log)) {
             $debug_log[] = array('custom_sub_canvas_caliper_url not found in launch data');
         }
         return false;
     }
     $key_key = self::sessionGet('key_key');
     $secret = self::sessionGet('secret');
     $retval = LTI::sendJSONBody("POST", $caliperBody, $content_type, $caliperURL, $key_key, $secret, $debug_log);
     return $retval;
 }
示例#4
0
文件: Output.php 项目: csev/tsugi-php
    /**
     * Emit the HTML for the header.
     */
    function header($headCSS = false)
    {
        global $HEAD_CONTENT_SENT, $CFG, $RUNNING_IN_TOOL;
        global $CFG;
        if ($HEAD_CONTENT_SENT === true) {
            return;
        }
        header('Content-Type: text/html; charset=utf-8');
        ?>
<!DOCTYPE html>
    <html>
      <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title><?php 
        echo $CFG->servicename;
        if (isset($CFG->context_title)) {
            echo ' - ' . $CFG->context_title;
        }
        ?>
</title>
        <!-- Le styles -->
        <link href="<?php 
        echo $CFG->staticroot;
        ?>
/bootstrap-3.1.1/css/<?php 
        if (isset($CFG->bootswatch)) {
            echo 'bootswatch/' . $CFG->bootswatch . '/';
        }
        ?>
bootstrap.min.css" rel="stylesheet">

        <link href="<?php 
        echo $CFG->staticroot;
        ?>
/js/jquery-ui-1.11.4/jquery-ui.min.css" rel="stylesheet">
        <link href="<?php 
        echo $CFG->staticroot;
        ?>
/font-awesome-4.4.0/css/font-awesome.min.css" rel="stylesheet">
        <script src="<?php 
        echo $CFG->staticroot;
        ?>
/js/tsugiscripts_head.js"></script>

    <style>
    body {
      padding-top: 10px;
      padding-bottom: 10px;
    }
    .navbar {
      margin-bottom: 20px;
    }
    .container_iframe {
        margin-left: 10px;
        margin-right: 10px;
    }
    </style>
<?php 
        // https://lefkomedia.com/adding-external-link-indicator-with-css/
        if ($CFG->google_translate) {
            ?>
<style>
a[target="_blank"]:after {
    font-family: "FontAwesome";
    content: " \f08e";
}
.goog-te-banner-frame.skiptranslate {
    display: none !important;
    } 
body {
    top: 0px !important; 
    }
</style>
<?php 
        }
        ?>

        <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
        <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
        <!--[if lt IE 9]>
          <script src="<?php 
        echo $CFG->vendorstatic;
        ?>
/js/html5shiv/html5shiv.js"></script>
          <script src="<?php 
        echo $CFG->vendorstatic;
        ?>
/js/respond/respond.min.js"></script>
        <![endif]-->

    <?php 
        if (isset($_SESSION['CSRF_TOKEN'])) {
            echo '<script type="text/javascript">CSRF_TOKEN = "' . $_SESSION['CSRF_TOKEN'] . '";</script>' . "\n";
        } else {
            echo '<script type="text/javascript">CSRF_TOKEN = "TODORemoveThis";</script>' . "\n";
        }
        // Set the containing frame id is we have one
        $element_id = LTIX::postGet('ext_lti_element_id', false);
        if ($element_id) {
            echo '<script type="text/javascript">LTI_PARENT_IFRAME_ID = "' . $element_id . '";</script>' . "\n";
        }
        if (isset($_SESSION['APP_HEADER'])) {
            echo $_SESSION['APP_HEADER'];
        }
        $HEAD_CONTENT_SENT = true;
    }