<?php
//  essential functions
require "subs.php";

//  read database login information and connect
require "../config/database.php";
include_once '../config/properties.php';
dbConnect();

// read scorm_id from the GET parameters
$scorm_id = $_REQUEST['scorm_id'];
$contentdtl_id = $_REQUEST['contentdtl_id'];
$path = $_REQUEST['path'];
$oid = $_REQUEST['oid'];
$id = $_REQUEST['uid'];
$end_date = $_REQUEST['end_date'];
$rslt = $_REQUEST['rslt'];

$result = mysqli_query($link, "select launch_page,title from scorm where scorm_id='" . $scorm_id . "'");
if (mysqli_num_rows($result) > 0) {
    $row = mysqli_fetch_array($result);
    $s_path = ADMIN_HTTP_PATH . $properties['jdbc.content_folder'] . '/';
    $s_path .= $path;
    $s_path .= $row['launch_page'];
}
?>
<html>
    <head>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link rel="shortcut icon" href="../images/icon_header.png" />
        <title>K-nest LMS &#8211;</title>
        <script>
            window.onload = function () {
                var oFrame = document.getElementById("myFrame");
                oFrame.contentWindow.document.onclick = function () {
                    window.parent.scormclick();
                };
                oFrame.contentWindow.document.onmousemove = function () {
                    window.parent.scormclick();
                };
            };
        </script>
    </head> 
    <frameset style="align-items: center;" frameborder="0" framespacing="0" border="0" rows="0%,*" cols="*" onbeforeunload="API.LMSFinish('');" onunload="API.LMSFinish('');">
        <frame src="api.php?scorm_id=<?php print $scorm_id; ?>&contentdtl_id=<?php print $contentdtl_id; ?>&oid=<?php print $oid; ?>&uid=<?php print $id; ?>&end_date=<?php print $end_date; ?>&rslt=<?php print $rslt; ?>" name="API" noresize/>
        <frame id="myFrame" src="<?php print $s_path ?>" name="course" scrolling="no" noresize="noresize" align="middle"/>
    </frameset>
    <!--    <body style="align-items: center;" onbeforeunload="API.LMSFinish('');" onunload="API.LMSFinish('');">    
            <iframe id="api_page" src="api.php?scorm_id=<?php print $scorm_id; ?>&contentdtl_id=<?php print $contentdtl_id; ?>&oid=<?php print $oid; ?>&uid=<?php print $id; ?>&end_date=<?php print $end_date; ?>&rslt=<?php print $rslt; ?>" name="API" height="0" width="0" style="border:none"></iframe>
            <iframe id="myFrame" src="<?php print $s_path ?>" name="course" scrolling="no" align="middle" name="myFrame" height="100%" width="100%" style="border:none"></iframe>      
        </body>-->
</html>
