<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>untitled</title> </head> <body> <?php require_once "config.php"; require_once '../ScormEngineService.php'; global $CFG; $ServiceUrl = $CFG->scormcloudurl; $AppId = $CFG->scormcloudappid; $SecretKey = $CFG->scormcloudsecretkey; $Origin = $CFG->scormcloudorigin; $ScormService = new ScormEngineService($ServiceUrl, $AppId, $SecretKey, $Origin); $courseService = $ScormService->getCourseService(); //$importurl = $CFG->wwwroot."/ImportFinish.php"; $courseListUrl = $CFG->wwwroot . "/CourseListSample.php"; //$cloudUploadLink = $uploadService->GetUploadUrl($importurl) $courseId = uniqid(); $cloudUploadLink = $courseService->GetImportCourseUrl($courseId, $courseListUrl); ?> <form action="<?php echo $cloudUploadLink; ?> " method="post" enctype="multipart/form-data"> <label for="file">Filename:</label>
require_once '../ServiceRequest.php'; require_once '../CourseData.php'; require_once '../UploadService.php'; require_once 'config.php'; global $CFG; $ServiceUrl = $CFG->scormcloudurl; $AppId = $CFG->scormcloudappid; $SecretKey = $CFG->scormcloudsecretkey; if ($_FILES["file"]["error"] > 0) { echo "Error: " . $_FILES["file"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br />"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; echo "Size: " . $_FILES["file"]["size"] / 1024 . " Kb<br />"; echo "Stored in: " . $_FILES["file"]["tmp_name"]; $ScormService = new ScormEngineService($ServiceUrl, $AppId, $SecretKey); $courseService = $ScormService->getCourseService(); $uploadService = $ScormService->getUploadService(); $courseId = uniqid(); echo '$courseId=' . $courseId . '<br>'; // Where the file is going to be placed $target_path = "uploads/"; /* Add the original filename to our target path. Result is "uploads/filename.extension" */ $target_path = $target_path . basename($_FILES['file']['name']); $tempFile = $_FILES["file"]["tmp_name"]; move_uploaded_file($_FILES['file']['tmp_name'], $target_path); $absoluteFilePathToZip = $target_path; //now upload the file and save the resulting location $location = $uploadService->UploadFile($absoluteFilePathToZip, null); //next import the course you just uploaded
* notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL Rustici Software, LLC BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ require_once '../ScormEngineService.php'; require_once 'config.php'; global $CFG; $ServiceUrl = $CFG->scormcloudurl; $AppId = $CFG->scormcloudappid; $SecretKey = $CFG->scormcloudsecretkey; $Origin = $CFG->scormcloudorigin; $ScormService = new ScormEngineService($ServiceUrl, $AppId, $SecretKey, $Origin); $lrsAccountService = $ScormService->getLrsAccountService(); $accountKey = $_GET['accountKey']; //echo gettype($courseService); $lrsAccountService->deleteActivityProvider($accountKey); //echo 'Course '.$courseid.' deleted'; header('Location: ' . $CFG->wwwroot . '/ActivityProviderListSample.php');
* * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL Rustici Software, LLC BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ require_once '../ScormEngineService.php'; require_once 'config.php'; global $CFG; ini_set('display_errors', 'On'); $ServiceUrl = $CFG->scormcloudurl; $AppId = $CFG->scormcloudappid; $SecretKey = $CFG->scormcloudsecretkey; $Origin = $CFG->scormcloudorigin; $ScormService = new ScormEngineService($ServiceUrl, $AppId, $SecretKey, $Origin); $taggingService = $ScormService->getTaggingService(); $regId = $_GET['regId']; $tags = $_GET['tags']; $taggingService->AddRegistrationTag($regId, $tags);
</head> <body> <h2>Activity Provider List Sample</h2> <?php require_once '../ScormEngineService.php'; require_once 'config.php'; global $CFG; $ServiceUrl = $CFG->scormcloudurl; $AppId = $CFG->scormcloudappid; $SecretKey = $CFG->scormcloudsecretkey; $Origin = $CFG->scormcloudorigin; write_log('Creating ScormEngineService'); $ScormService = new ScormEngineService($ServiceUrl, $AppId, $SecretKey, $Origin); write_log('ScormEngineService Created'); write_log('Creating lrsAccountService'); $lrsAccountService = $ScormService->getLrsAccountService(); write_log('lrsAccountService Created'); if (isset($_POST['submit'])) { $url = $_REQUEST['callbackurl']; $lrsAccountService->setAppLrsAuthCallbackUrl($url); echo 'Succes!'; } echo '<form action="ActivityProviderListSample.php" method="POST">'; ?> <h3>Set Auth CallBack Url</h3> URL: <input type="text" name="callbackurl" /><br/> <input type="submit" name="submit" value="Submit" /> </form>
</head> <body> <?php require_once '../ScormEngineService.php'; require_once '../ServiceRequest.php'; require_once '../ApplicationData.php'; require_once 'config.php'; global $CFG; $ServiceUrl = $CFG->scormcloudurl; $AppId = $CFG->scormcloudappid; $SecretKey = $CFG->scormcloudsecretkey; $Origin = $CFG->scormcloudorigin; $AppManagerId = $CFG->scormcloudappmanagerid; $ManagerSecretKey = $CFG->scormcloudmanagersecretkey; $ScormService = new ScormEngineService($ServiceUrl, $AppId, $SecretKey, $Origin, null, $AppManagerId, $ManagerSecretKey); $appService = $ScormService->getApplicationService(); $allResults = $appService->GetAppList(); echo '<form action="CreateApplicationSample.php" method="GET">'; ?> <h3>Create New Application</h3> Name: <input type="text" name="name" /><br/> <?php ?> <input type="submit" name="submit" value="Submit" /> </form> <br/><br/> <?php echo '<table border="1" cellpadding="5">'; echo '<tr><td>App Id</td><td>Name</td><td>Create Date</td></tr>'; foreach ($allResults as $result) {
<body> <a href="CourseListSample.php">Course List</a> <h2>Invitation Info</h2> <br/><br/> <?php require_once '../ScormEngineService.php'; require_once '../ServiceRequest.php'; require_once 'config.php'; global $CFG; $ServiceUrl = $CFG->scormcloudurl; $AppId = $CFG->scormcloudappid; $SecretKey = $CFG->scormcloudsecretkey; $Origin = $CFG->scormcloudorigin; $invId = $_GET['invid']; $ScormService = new ScormEngineService($ServiceUrl, $AppId, $SecretKey, $Origin); $invService = $ScormService->getInvitationService(); $response = $invService->GetInvitationInfo($invId, 'true'); $status = $invService->GetInvitationStatus($invId); $xml = simplexml_load_string($status); $strStatus = $xml->status; ?> <h2>Status: <?php echo $strStatus; ?> </h2> <textarea style="height:600px;width:1000px;"><?php echo $response; ?> </textarea>
</head> <body> <a href="CourseListSample.php">Course List</a> <br/><br/> <?php require_once '../ScormEngineService.php'; require_once '../ServiceRequest.php'; require_once '../CourseData.php'; require_once 'config.php'; global $CFG; $ServiceUrl = $CFG->scormcloudurl; $AppId = $CFG->scormcloudappid; $SecretKey = $CFG->scormcloudsecretkey; $Origin = $CFG->scormcloudorigin; $ScormService = new ScormEngineService($ServiceUrl, $AppId, $SecretKey, $Origin); $courseService = $ScormService->getCourseService(); $dispatchService = $ScormService->getDispatchService(); //echo '<pre>'; // print_r ($attributes); // echo '</pre>'; echo '<form action="CreateDestinationSample.php" method="GET">'; ?> <h3>Create New Destination</h3> Name: <input type="text" name="destname" /><br/> Tags:<input type="text" name="desttags" /><br/> <input type="submit" name="submit" value="Submit" /> </form> <br/><br/> <?php
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL Rustici Software, LLC BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ require_once '../ScormEngineService.php'; require_once 'config.php'; global $CFG; $ServiceUrl = $CFG->scormcloudurl; $AppId = $CFG->scormcloudappid; $SecretKey = $CFG->scormcloudsecretkey; $Origin = $CFG->scormcloudorigin; $ScormService = new ScormEngineService($ServiceUrl, $AppId, $SecretKey, $Origin); $regService = $ScormService->getRegistrationService(); $regId = uniqid(rand(), true); $courseId = $_GET['courseid']; $learnerId = $_GET['learnerid']; $learnerFirstName = $_GET['learnerfirstname']; $learnerLastName = $_GET['learnerlastname']; //echo $regId . '<br>'; //echo $courseId . '<br>'; //echo $learnerId . '<br>'; //echo $learnerFirstName . '<br>'; //echo $learnerLastName . '<br>'; //CreateRegistration($registrationId, $courseId, $learnerId, $learnerFirstName, $learnerLastName) $regService->CreateRegistration($regId, $courseId, $learnerId, $learnerFirstName, $learnerLastName); header('Location: ' . $CFG->wwwroot . '/RegistrationListSample.php?courseid=' . $courseId);
<body> <a href="CourseListSample.php">Course List</a> <br/><br/> <?php require_once '../ScormEngineService.php'; require_once '../ServiceRequest.php'; require_once '../CourseData.php'; require_once 'config.php'; global $CFG; $ServiceUrl = $CFG->scormcloudurl; $AppId = $CFG->scormcloudappid; $SecretKey = $CFG->scormcloudsecretkey; $Origin = $CFG->scormcloudorigin; $courseid = $_GET['courseid']; $ScormService = new ScormEngineService($ServiceUrl, $AppId, $SecretKey, $Origin); $regService = $ScormService->getRegistrationService(); if (isset($courseid)) { $allResults = $regService->GetRegistrationList($courseid, null); } else { $allResults = $regService->GetRegistrationList(null, null); } echo '<form action="CreateRegistrationSample.php" method="GET">'; ?> <h3>Create New Registration</h3> Email: <input type="text" name="learnerid" /><br/> First Name:<input type="text" name="learnerfirstname" /><br/> Last Name:<input type="text" name="learnerlastname" /><br/> <?php if (isset($courseid)) { echo '<input type="hidden" name="courseid" value="' . $courseid . '"/>';
* * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL Rustici Software, LLC BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ require_once '../ScormEngineService.php'; require_once 'config.php'; global $CFG; $ServiceUrl = $CFG->scormcloudurl; $AppId = $CFG->scormcloudappid; $SecretKey = $CFG->scormcloudsecretkey; $Origin = $CFG->scormcloudorigin; $ScormService = new ScormEngineService($ServiceUrl, $AppId, $SecretKey, $Origin); $dispService = $ScormService->getDispatchService(); $destname = $_GET['destname']; $desttags = $_GET['desttags']; $dispService->CreateDestination($destname, $desttags); header('Location: ' . $CFG->wwwroot . '/DispatchListSample.php');
</head> <body> <h2>Course List Sample</h2> <?php require_once '../ScormEngineService.php'; require_once 'config.php'; global $CFG; $ServiceUrl = $CFG->scormcloudurl; $AppId = $CFG->scormcloudappid; $SecretKey = $CFG->scormcloudsecretkey; $Origin = $CFG->scormcloudorigin; write_log('Creating ScormEngineService'); $ScormService = new ScormEngineService($ServiceUrl, $AppId, $SecretKey, $Origin); write_log('ScormEngineService Created'); $debugService = $ScormService->getdebugService(); if ($debugService->CloudPing()) { echo "<p style='color:green'>CloudPing call was successful.</p>"; } else { echo "<p style='color:red'>CloudPing call was not successful.</p>"; } if ($debugService->CloudAuthPing()) { echo "<p style='color:green'>CloudAuthPing call was successful.</p>"; } else { echo "<p style='color:red'>CloudAuthPing call was not successful.</p>"; } echo "<br/><br/>"; echo '<a href="ImportSample.php">Import New Package</a>'; echo "<br/><br/>";
public static function getRegistrationResult($idRegistration) { $app = \Slim\Slim::getInstance(); try { $scormcloudorigin = ScormEngineUtilities::getCanonicalOriginString("IgnitorLabs", "Ignitor Portal", "Version 2.0"); $ScormService = new ScormEngineService(ScormCloudAPIController::$scromCloudUrl, ScormCloudAPIController::$scromCloudAppId, ScormCloudAPIController::$scormCloudSecretKey, ScormCloudAPIController::$scormcloudorigin, null, ScormCloudAPIController::$scromCloudMgmtAppId, ScormCloudAPIController::$scormCloudMgmtSecretKey); $registrationService = $ScormService->getRegistrationService(); if ($registrationService->Exists($idRegistration)) { $regResult = $registrationService->GetRegistrationResult($idRegistration, 2, 1); $json_result = json_encode(simplexml_load_string($regResult), JSON_PRETTY_PRINT); $data = array("action" => "get", "type" => "scorm-cloud", "source" => "api", "source_version" => "1.0", "description" => $json_result, "ip" => $_SERVER['REMOTE_ADDR'], "browser_type" => $_SERVER['HTTP_USER_AGENT'], "referral" => $_SERVER['HTTP_REFERER'], "auth_token" => $app->request->headers->get('X_Authorization')); $log = Log::create($data); $log->save(); $app->redirect(ScormCloudAPIController::$websiteLink . "/library"); // return "<html><head><script type=\"text/javascript\">window.location=\"" . ScormCloudAPIController::$websiteLink . "/library\"</script></head><body></body></html>"; } else { return json_encode("failure"); } } catch (Exception $e) { $app->halt("400", json_encode($e->getMessage())); return json_encode("failure"); } }
<?php /** * Sets up the javascript-driven registration details report * * @author John Hayden <*****@*****.**> */ include_once "SCORM_CLOUD_API/ScormEngineService.php"; $regId = $_GET['regId']; $regId = "200-6"; $ScormService = new ScormEngineService("http://dev.cloud.scorm.com/EngineWebServices", "john", "32wE8eRYmMKy5Rcl171ZrR3lSIj2a4QyZXbwWZE7"); $sr = $ScormService->CreateNewRequest(); $parameterMap = array('regid' => $regId); $parameterMap['resultsformat'] = "full"; $parameterMap['format'] = "json"; $parameterMap['jsoncallback'] = "getRegistrationResultCallback"; $sr->setMethodParams($parameterMap); $dataUrl = $sr->ConstructUrl("rustici.registration.getRegistrationResult"); ?> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="regreport.js"></script> <style type="text/css"> .activityTitle { color: blue; font-size: 110% } .dataValue {font-weight: bold } #report li {list-style: none; padding: 1px } #report ul { margin-top: 0; margin-bottom: 0px; font-size: 10pt; } </style> <div id="report" dataUrl="<? print($dataUrl); ?>"/>