* @ingroup Extensions
 * @version 0.1
 * @author Charles Severance based on for from Antoni Bertran and Jose Diago
 */
$going2MW = false;
// BLTI integration
require_once 'IMSBasicLTI/ims-blti/blti.php';
if (!is_basic_lti_request()) {
    return;
}
//Let's get the user's data
$context = new BLTI("secret", false, false);
if ($context->valid) {
    $agentCourse = $context->getCourseName();
    $agentUserName = $context->getUserShortName();
    $agentEmail = $context->getUserEmail();
    $agentFullName = $context->getUserName();
    $going2MW = true;
    session_start();
    $_SESSION['BLTIclassroom'] = $agentCourse;
} else {
    echo 'Error validating: ' . $context->message;
}
$context = null;
if ($going2MW) {
    $myURI = $_SERVER['REQUEST_URI'];
    $newURI = str_replace("extensions/Redirect2CourseBLTI.php", "index.php", $myURI);
    $newParameters = "title=Category:{$agentCourse}&BLTIusername={$agentUserName}&BLTIemail={$agentEmail}&BLTIfullname={$agentFullName}&BLTI=yes";
    $newURI = $newURI . "?" . $newParameters;
    header("Location: {$newURI}");
}
Esempio n. 2
0
 $description = $_REQUEST['description'];
 $idvalue = $_REQUEST['id'];
 if ($title && $description) {
     if ($idvalue) {
         $sql = 'UPDATE ads SET ' . "title='" . mysql_real_escape_string($title) . "', " . "description='" . mysql_real_escape_string($description) . "', " . "updated_at= NOW() " . "WHERE id=" . "'" . mysql_real_escape_string($idvalue) . "' AND " . $authzsql;
         $result = mysql_query($sql);
         $retval = mysql_affected_rows();
         if ($retval != 1) {
             $message = "Error, unable to update ad.";
             $action = 'edit';
         } else {
             $message = "Updated record for '" . $title . "' id=" . $idvalue;
             $action = 'main';
         }
     } else {
         $sql = 'INSERT INTO ads ' . '( title, description, course_key, user_key, user_name, user_image, created_at, updated_at ) ' . ' VALUES ( ' . "'" . mysql_real_escape_string($title) . "', " . "'" . mysql_real_escape_string($description) . "', " . "'" . mysql_real_escape_string($context->getCourseKey()) . "', " . "'" . mysql_real_escape_string($context->getUserKey()) . "', " . "'" . mysql_real_escape_string($context->getUserName()) . "', " . "'" . mysql_real_escape_string($context->getUserImage()) . "', " . " NOW(), NOW() ) ";
         $result = mysql_query($sql);
         $retval = mysql_affected_rows();
         if ($retval != 1) {
             $message = "Error, unable to insert ad.";
             $action = 'add';
         } else {
             $idvalue = mysql_insert_id();
             $message = "Inserted ad '" . $name . "' id=" . $idvalue;
             $action = 'main';
             $context->redirect();
         }
     }
 } else {
     $message = "Error, please specify all data.";
     $action = 'add';
    <div id="page-wrapper">
      <header class="header-footer">
        <p id="header-image">
          <img src="images/harvard_shield.png" alt="Harvard University" />
        </p>
        <h2>
          A Very Basic LTI Tool
        </h2>
      </header>
       
      <div id="page-content">
<?php 
if ($context->valid) {
    ?>
        <h2>Hello, <?php 
    echo $context->getUserName();
    ?>
!</h2>
        <p id="image-wrapper">
          <img src="<?php 
    echo $context->getUserImage();
    ?>
" alt="<?php 
    echo $context->getUserName();
    ?>
" />
        </p>
        <p class="clearme">
        </p>
<?php 
    if ($_POST['launch_presentation_return_url']) {