/** * This function print statistic about a user for a scorm organization * @param int $idscorm_organization id of the organization * @param int $idUser id of the user * @return string to output **/ function scorm_userstat($idscorm_organization, $idUser, $idReference = NULL, $mvc = false) { require_once dirname(__FILE__) . '/scorm_items_track.php'; require_once dirname(__FILE__) . '/CPManagerDb.php'; require_once dirname(__FILE__) . '/RendererBase.php'; // get idscorm_package $query = "SELECT idscorm_package, org_identifier " . " FROM %lms_scorm_organizations" . " WHERE idscorm_organization = '" . $idscorm_organization . "'"; $rs = sql_query($query) or communicationError("3"); list($idscorm_package, $org_identifier) = sql_fetch_row($rs); $it = new Scorm_ItemsTrack($GLOBALS['dbConn'], $GLOBALS['prefix_lms']); $org_info = $it->getItemsInfo($idReference, NULL, $idscorm_organization); $output = ""; $str = "<br />" . (!$mvc ? "<div class=\"std_block\">" : ""); if ($mvc) { $output .= $str; } else { $GLOBALS['page']->add($str, 'content'); } $cpm = new CPManagerDb(); $cpm->Open($idReference, $idscorm_package, $GLOBALS['dbConn'], $GLOBALS['prefix_lms']); $cpm->ParseManifest(); $rb = new RendererDefaultImplementation(); $rb->imgPrefix = getPathImage() . 'treeview/'; $rb->imgOptions = 'width="24" height="24"'; $rb->showlinks = FALSE; $rb->showit = TRUE; $rb->itemtrack = $it; $rb->idUser = $idUser; $rb->resBase = ""; if (function_exists('cbMakeReportLink')) { $rb->linkCustomCallBack = 'cbMakeReportLink'; } //$rb->renderStatusCallBack = "renderStatus"; $str = $cpm->RenderOrganization($org_identifier, $rb); if ($mvc) { $output .= $str; } else { $GLOBALS['page']->add($str, 'content'); } if (!$mvc) { $GLOBALS['page']->add("</div>", 'content'); } if ($mvc) { return $output; } }
} if ($playertemplate != '') { if (!file_exists(getPathTemplate() . 'player_scorm/' . $playertemplate . '/def_style.css')) { $playertemplate = 'default'; } } else { $playertemplate = 'default'; } $idscorm_organization = $idResource; $idUser = (int) getLogUserId(); /*Start database connection***********************************************/ /* get scorm version */ $scormVersion = getScormVersion('idscorm_organization', $idscorm_organization); /* get object title */ list($lo_title) = sql_fetch_row(sql_query("SELECT title" . " FROM " . $GLOBALS['prefix_lms'] . "_organization" . " WHERE idResource = '{$idResource}'" . " AND objectType = 'scormorg'")); $itemtrack = new Scorm_ItemsTrack(null, $GLOBALS['prefix_lms']); $rsItemTrack = $itemtrack->getItemTrack($idUser, $idReference, NULL, $idscorm_organization); if ($rsItemTrack === FALSE) { // The first time for this user in this organization $itemtrack->createItemsTrack($idUser, $idReference, $idscorm_organization); // Now should be present $rsItemTrack = $itemtrack->getItemTrack($idUser, $idReference, NULL, $idscorm_organization); } $arrItemTrack = mysql_fetch_assoc($rsItemTrack); // with id_item_track of organization|user|reference create an entry in commontrack table require_once _lms_ . '/class.module/track.object.php'; require_once _lms_ . '/class.module/track.scorm.php'; $track_so = new Track_ScormOrg($arrItemTrack['idscorm_item_track'], false, false, NULL, $environment); if ($track_so->idReference === NULL) { $track_so->createTrack($idReference, $arrItemTrack['idscorm_item_track'], $idUser, date("Y-m-d H:i:s"), 'ab-initio', 'scormorg'); }
function SetValue($idUser, $idReference, $idscorm_item, $param, $value) { soap__dbgOut("+SetValue( {$idUser}, {$idReference}, {$idscorm_item}, {$param}, {$value})"); $dbconn = $GLOBALS['dbConn']; // get item_track $itemtrack = new Scorm_ItemsTrack($dbconn, $GLOBALS['prefix_lms']); $rs = $itemtrack->getItemTrack($idUser, $idReference, $idscorm_item); $arrItemTrackData = mysql_fetch_assoc($rs); // get tracking soap__dbgOut("before: Scorm_Tracking(NULL, NULL, {$arrItemTrackData['idscorm_tracking']}, NULL, {$dbconn}, FALSE, FALSE);"); $trackobj = new Scorm_Tracking(NULL, NULL, $arrItemTrackData['idscorm_tracking'], NULL, $dbconn, FALSE, FALSE); soap__dbgOut("after: Scorm_Tracking(NULL, NULL, {$arrItemTrackData['idscorm_tracking']}, NULL, {$dbconn}, FALSE, FALSE);"); if ($trackobj->setParam($param, $value) === false) { soap__dbgOut("Scorm_Tracking setParam({$param}, {$value}) return false"); soap__dbgOut("Scorm_Tracking error: " . $trackobj->getErrorCode() . "\n" . $trackobj->getErrorText()); $status = "error"; $error = $trackobj->getErrorCode(); $errorString = $trackobj->getErrorText(); } else { soap__dbgOut("Scorm_Tracking setParam({$param}, {$value}) return true"); $status = "success"; $error = ""; $errorString = ""; } $arr_result = array(new SOAP_Value('status', 'string', $status), new SOAP_Value('error', 'string', $error), new SOAP_Value('errorString', 'string', $errorString)); soap__dbgOut("-SetValue return {$status}"); return $arr_result; }
\t} \t// --> \t</script> </head> _TEXTEND; echo '<body id="page_head" class="' . ($playertemplate != '' ? $playertemplate . '_back' : 'standard_back') . '" onload="Initialize()">'; echo "<div id=\"headnav\">\n" . "\t<div>\n" . "\t\t<div id=\"prevblocklink\" style=\"display:block; float: left;\">\n" . "\t\t\t<A id=\"prevsco\" href=\"#\" onClick=\"navPrev(); return false;\"><img class=\"imgnav\" id=\"imgprev\" src=\"" . $imagesPath . "bt_sx.png\" alt=\"Back\" /></A>\n" . "\t\t\t<span id=\"prevlink\"></span>" . "\t\t</div>\n" . "\t\t<div id=\"nextblocklink\" style=\"display:block; float: left;\">\n" . "\t\t\t<A id=\"nextsco\" href=\"#\" onClick=\"navNext(); return false;\"><img class=\"imgnav\" id=\"imgnext\" src=\"" . $imagesPath . "bt_dx.png\" alt=\"Next\" /></A>\n" . "\t\t\t<span id=\"nextlink\"></span>\n" . "\t\t</div>\n" . "\t\t<script type=\"text/javascript\">\n" . "\t\t<!--\n" . "\t\t\tif(window.top.isShowTree()) {\n" . "\t\t\t\tdocument.write('<a id=\"hidetree\" style=\"display:inline\" href=\"#\" onClick=\"hideTree(); return false;\"><img class=\"imgnav\" src=\"" . $imagesPath . "hide_tree.png\" alt=\"Hide Tree\" /></a>');\n" . "\t\t\t\tdocument.write('<a id=\"showtree\" style=\"display:none\" href=\"#\" onClick=\"showTree(); return false;\"><img class=\"imgnav\" src=\"" . $imagesPath . "show_tree.png\" alt=\"Show Tree\" /></a>');\n" . "\t\t\t} else {\n" . "\t\t\t\tdocument.write('<a id=\"hidetree\" style=\"display:none\" href=\"#\" onClick=\"hideTree(); return false;\"><img class=\"imgnav\" src=\"" . $imagesPath . "hide_tree.png\" alt=\"Hide Tree\" /></a>');\n" . "\t\t\t\tdocument.write('<a id=\"showtree\" style=\"display:inline\" href=\"#\" onClick=\"showTree(); return false;\"><img class=\"imgnav\" src=\"" . $imagesPath . "show_tree.png\" alt=\"Show Tree\" /></a>');\n" . "\t\t\t}\n" . "\t\t-->\n" . "\t\t</script>\n" . "\t</div>\n" . "</div>\n"; /*echo '<div id="headerLogo">'; echo '<img src="'.$imagesPath.'logo.jpg" alt="logo spaghettilearning scorm" />'; echo '</div>';*/ //echo '<div class="header">'."\n" // ."\t".'<img class="immagineSx logo_sx" src="'.getPathImage().'scorm/logo.png" alt="Left logo" />'."\n"; //echo "<img id=\"immagineSx\" src=\"../../templates/".$_SESSION["sesTemplate"]."/images/scorm/logo.png\" alt=\"Logo\" />\n"; // statistics echo '<div id="statistics">'; $itemtrack = new Scorm_ItemsTrack($dbconn, $GLOBALS['prefix_lms']); $rs = $itemtrack->getItemTrack(sl_sal_getUserId(), $idReference, NULL, $idscorm_organization); if ($rs === FALSE) { echo "Lesson never initiated"; } else { $report = mysql_fetch_assoc($rs); echo Lang::t('_PROGRESS', 'scorm') . " " . $report['nDescendantCompleted'] . "/" . $report['nDescendant'] . "<br />"; $widthMax = 220; $widthOne = ($widthMax - $report['nDescendant']) / $report['nDescendant']; $posRel = 2; echo '<div class="scorm_progressbarstat">'; //echo "<div >"; for ($nRep = 0; $nRep < $report['nDescendantCompleted']; $nRep++, $posRel += $widthOne + 1) { echo "<div class=\"scorm_complete\" style=\"width: " . $widthOne . "px; left:" . $posRel . "px; top: 2px;\"></div>"; //echo "<div class=\"scorm_complete\" style=\"width: ".$widthOne."%;\" > </div>"; }