/** * Show content */ function showContent() { global $tpl, $ilTabs, $ScormCloudService; global $ilias; $userId = $ilias->account->getId(); $pkgId = $this->object->getId(); $reg = ilObjScormCloudReg::getRegistration($pkgId, $userId); if ($reg == null) { $reg = new ilObjScormCloudReg($pkgId, $userId); $reg->doCreate(); } $regService = $ScormCloudService->getRegistrationService(); if ($_GET['refreshRegStatus'] == "true") { $regStatus = $regService->GetRegistrationResult($reg->getPK(), 0, 'xml'); $statusXml = simplexml_load_string($regStatus); $reg->setCompletion($statusXml->registrationreport->complete); $reg->setSatisfaction($statusXml->registrationreport->success); $reg->setTotalTime($statusXml->registrationreport->totaltime); $scoreString = $statusXml->registrationreport->score; if ($scoreString == "unknown") { $score = SCORE_UNKNOWN; } else { $score = (double) $scoreString * 100; } $reg->setScore($score); $reg->setLastAccess(ilUtil::now()); $reg->setAttemptCount($reg->getAttemptCount() + 1); $reg->setVersion($this->object->getVersion()); $reg->doUpdate(); } $ilTabs->activateTab("content"); $userId = $ilias->account->getId(); $pkgId = $this->object->getId(); if (!$reg->getExistsOnCloud()) { $firstName = $ilias->account->getFirstName(); $lastName = $ilias->account->getLastName(); if (empty($firstName)) { $firstName = "UNKNOWN"; } if (empty($lastName)) { $lastName = "UNKNOWN"; } $regService->CreateRegistration($reg->getPK(), $pkgId, $userId, $firstName, $lastName); $reg->setExistsOnCloud(true); $reg->doUpdate(); } if (!$reg->getExistsOnCloud()) { // error! } if (!empty($_SERVER['HTTPS'])) { $currentUrl = "https://"; } else { $currentUrl = "http://"; } if ($reg->getSatisfaction() == "unknown") { $status = $reg->getCompletion(); } else { $status = $reg->getSatisfaction(); } $currentUrl .= $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]; $returnUrl = $currentUrl . "&refreshRegStatus=true"; $launchHref = $regService->GetLaunchUrl($reg->getPK(), $returnUrl); $launchButton = "<button style='cursor: hand; font-size: 110%; width: 125px' type='button' onclick='window.location=\"" . $launchHref . "\";'> Launch </button>"; $launchString .= "<div style='margin: 10px; width: 100%; text-align: center'" . $launchButton . "</div>"; $tableHeader = '<table style="width: 100%" class="fullwidth">' . '<tr class="tbltitle">' . '<td class="std" style="border: none; font-size: 90%">' . $this->object->getDescription() . "</td>" . '<td align="right" style="border: none">' . $launchButton . '</td>'; '</tr></table>'; $launchString = "<table cellspacing=0 cellpadding=0 style='width: 100%; margin: 20px; margin-top: 10px'>" . "<tr><td><strong>Status: </strong>" . ucfirst($status) . "</td><td ><strong>Score</strong>: " . ($reg->getScore() == SCORE_UNKNOWN ? "Unknown" : ucfirst($reg->getScore())) . "</td><td ><strong>Total Time</strong>: " . $this->formatSeconds($reg->getTotalTime()) . "</td></tr>" . "<tr><td><strong>Attempts: </strong>" . $reg->getAttemptCount() . "</td><td><strong>Last Access: </strong>" . $reg->getLastAccess() . "</td><td> </td></tr>" . "</table>"; //$this->showHistoryReport($reg->getPK()); // '<td class="std">'.$reg->getLastAccess().'</td>'. // '<td class="std">'.$reg->getAttemptCount().'</td>'. // $tpl->setContent($tableHeader . $launchString . $this->getTrackingReportHtml($reg->getPK(), $this->object->getLearnersSeeRptDetails(), false)); // $tpl->addJavaScript("./Customizing/global/plugins/Services/Repository/RepositoryObject/ScormCloud/tracking/jquery.js"); // $tpl->addJavaScript("./Customizing/global/plugins/Services/Repository/RepositoryObject/ScormCloud/tracking/LaunchHistoryControlResources/scripts/LaunchHistoryReport.js"); // $tpl->setContent($this->showHistoryReport($reg->getPK())); }