$table->setColAttributes(2, array('align' => 'left'));
        $table->setColAttributes(7, array('align' => 'right'));
        $table->setColAttributes(8, array('align' => 'center'));
        $table->setColAttributes(9, array('align' => 'center'));
        $table->display();
    } else {
        echo get_lang('NoUsersInCourseTracking');
    }
    $ScormService = cloud_getScormEngineService();
    $rptService = $ScormService->getReportingService();
    $reportageAuth = $rptService->GetReportageAuth('NONAV', false);
    $tagSettings = new TagSettings();
    $tagSettings->addTag("course", $_REQUEST['cidReq']);
    $sumWidgetSettings = new WidgetSettings(null, $tagSettings, null);
    $sumWidgetSettings->setShowTitle(true);
    $sumWidgetSettings->setScriptBased(false);
    $sumWidgetSettings->setEmbedded(true);
    $sumWidgetSettings->setIframe(true);
    echo '<div class="row"><div class="form_header">SCORM CLOUD Training Summary</div></div>';
    echo "<iframe id=\"allSummaryFrame\" style=\"width:100%;height:400px;\" src=\"" . $rptService->GetWidgetUrl($reportageAuth, 'allSummary', $sumWidgetSettings) . "\"  scrolling=\"no\" frameborder='0'></iframe>";
    // send the csv file if asked
    if ($export_csv) {
        $csv_content[] = array(get_lang('OfficialCode'), get_lang('LastName'), get_lang('FirstName'), get_lang('TrainingTime'), get_lang('CourseProgress'), get_lang('Score'), get_lang('Student_publication'), get_lang('Messages'), get_lang('FirstLogin'), get_lang('LatestLogin'));
        ob_end_clean();
        Export::export_table_csv($csv_content, 'reporting_student_list');
    }
}
?>
</table>
<?php 
Display::display_footer();
 $tagSettings->addTag('registration', $GLOBALS['blog_id']);
 $sumWidgetSettings = new WidgetSettings($dateOptions, $tagSettings);
 $sumWidgetSettings->setShowTitle(true);
 $sumWidgetSettings->setScriptBased(true);
 $sumWidgetSettings->setEmbedded(true);
 $sumWidgetSettings->setVertical(false);
 $sumWidgetSettings->setDivname('TotalSummary');
 $coursesWidgetSettings = new WidgetSettings($dateOptions, $tagSettings);
 $coursesWidgetSettings->setShowTitle(true);
 $coursesWidgetSettings->setScriptBased(true);
 $coursesWidgetSettings->setEmbedded(true);
 $coursesWidgetSettings->setExpand(true);
 $coursesWidgetSettings->setDivname('CourseListDiv');
 $learnersWidgetSettings = new WidgetSettings($dateOptions, $tagSettings);
 $learnersWidgetSettings->setShowTitle(true);
 $learnersWidgetSettings->setScriptBased(true);
 $learnersWidgetSettings->setEmbedded(true);
 $learnersWidgetSettings->setExpand(true);
 $learnersWidgetSettings->setDivname('LearnersListDiv');
 $summaryUrl = $rptService->GetWidgetUrl($rptAuth, 'allSummary', $sumWidgetSettings);
 $coursesUrl = $rptService->GetWidgetUrl($rptAuth, 'courseRegistration', $coursesWidgetSettings);
 $learnersUrl = $rptService->GetWidgetUrl($rptAuth, 'learnerRegistration', $learnersWidgetSettings);
 $dateRelavance = $rptService->GetReportageDate();
 echo "<div class='meta-box-sortables'>";
 echo "<div class='reportageWrapper postbox'>";
 echo "<div title='" . __("Click to toggle", "scormcloud") . "' class='handlediv'><br></div><h3 class='hndle'>" . __("Overall Reportage Summary", "scormcloud");
 echo "</h3>";
 echo "<div class='inside'>";
 echo "<span class='dateRelevance'>" . __("Data current as of ", "scormcloud") . "<span class='localizeRecentDate' utcdate='" . date("d M Y H:i:s", strtotime($dateRelavance)) . "'></span></span>";
 echo '<table class="reportageTable"><tr class="summary"><td colspan="2">';
 echo '<div id="TotalSummary">' . __("Loading Summary...", "scormcloud") . '</div>';
$tagSettings = new TagSettings();
$tagSettings->addTag("course", $cidReq);
$sumWidgetSettings = new WidgetSettings(null, $tagSettings, null);
$sumWidgetSettings->setCourseId($cloud_courseId);
$sumWidgetSettings->setShowTitle(true);
$sumWidgetSettings->setScriptBased(false);
$sumWidgetSettings->setEmbedded(true);
$sumWidgetSettings->setIframe(true);
echo "<iframe id=\"UserSummaryFrame\" src=\"" . $rptService->GetWidgetUrl($reportageAuth, 'courseSummary', $sumWidgetSettings) . "\"  scrolling=\"no\" frameborder='0'></iframe>";
echo '<div class="detailsWrapper first">';
echo '<div class="row"><div class="form_header">Learners</div></div>';
echo '<div id="courseLearners" class="detailsDiv">Loading...</div>';
$widgetSettings = new WidgetSettings(null, $tagSettings, null);
$widgetSettings->setCourseId($cloud_courseId);
$widgetSettings->setShowTitle(false);
$widgetSettings->setScriptBased(true);
$widgetSettings->setEmbedded(true);
$widgetSettings->setDivname('courseLearners');
echo '<script type="text/javascript">
        loadScript("' . $rptService->GetWidgetUrl($reportageAuth, 'learnerRegistration', $widgetSettings) . '");
    </script>';
echo '<div class="row"><div class="form_header">Learner Comments</div></div>';
echo '<div id="courseComments" class="detailsDiv">Loading...</div>';
$widgetSettings->setDivname('courseComments');
echo '<script type="text/javascript">
        loadScript("' . $rptService->GetWidgetUrl($reportageAuth, 'courseComments', $widgetSettings) . '");
    </script>';
echo '</div>';
echo '<div class="detailsWrapper">';
echo '<div class="row"><div class="form_header">Course Activities</div></div>';
echo '<div id="courseActivities" class="detailsDiv">Loading...</div>';
 /**
  * Show tracking
  */
 function showTrackingMain()
 {
     global $tpl, $ilias, $ScormCloudService;
     $userId = $ilias->account->getId();
     $pkgId = $this->object->getId();
     $regs = ilObjScormCloudReg::GetRegistrationsForPackageId($pkgId);
     if (!empty($_SERVER['HTTPS'])) {
         $currentUrl = "https://";
     } else {
         $currentUrl = "http://";
     }
     $currentUrl .= $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
     $trackingTable = '<table class="fullwidth">' . '<tr class="tbltitle">' . '<th class="std" colspan="8">Tracking Items</th>' . '</tr>' . '<tr class="tblheader">' . '<th class="tblheader,std" nowrap="nowrap">Name</th>' . '<th class="tblheader,std" nowrap="nowrap">Completion</th>' . '<th class="tblheader,std" nowrap="nowrap">Satisfaction</th>' . '<th class="tblheader,std" nowrap="nowrap">Total Time</th>' . '<th class="tblheader,std" nowrap="nowrap">Score</th>' . '<th class="tblheader,std" nowrap="nowrap">Last Access</th>' . '<th class="tblheader,std" nowrap="nowrap">Attempts</th>' . '<th class="tblheader,std" nowrap="nowrap">Version</th>' . '</tr>';
     foreach ($regs as $r) {
         $userObj = new ilObjUser($r->getUserId());
         $trackingTable .= '<tr class="tblrow1">' . '<td class="std"><a href="' . $currentUrl . '&regId=' . $r->getPK() . '">' . $userObj->getLastName() . ', ' . $userObj->getFirstName() . '</a></td>' . '<td class="std">' . ucfirst($r->getCompletion()) . '</td>' . '<td class="std">' . ucfirst($r->getSatisfaction()) . '</td>' . '<td class="std">' . $this->formatSeconds($r->getTotalTime()) . '</td>' . '<td class="std">' . ($r->getScore() == SCORE_UNKNOWN ? "Unknown" : ucfirst($r->getScore())) . '</td>' . '<td class="std">' . $r->getLastAccess() . '</td>' . '<td class="std">' . $r->getAttemptCount() . '</td>' . '<td class="std">' . $r->getVersion() . '</td>' . '</tr>';
     }
     $trackingTable .= '</table>';
     $tpl->addJavaScript("./Customizing/global/plugins/Services/Repository/RepositoryObject/ScormCloud/tracking/jquery.js");
     $tpl->addJavaScript("http://cloud.scorm.com/Reportage/scripts/reportage.combined.nojquery.js");
     // Reportage Report for all learners taking this course
     $rptService = $ScormCloudService->getReportingService();
     $rptAuth = $rptService->GetReportageAuth('FREENAV', true);
     $summaryWidgetSettings = new WidgetSettings();
     $summaryWidgetSettings->setShowTitle(true);
     $summaryWidgetSettings->setScriptBased(true);
     $summaryWidgetSettings->setEmbedded(true);
     $summaryWidgetSettings->setExpand(true);
     $summaryWidgetSettings->setDivname('summary');
     $summaryWidgetSettings->setCourseId($pkgId);
     $learnersWidgetSettings = new WidgetSettings();
     $learnersWidgetSettings->setShowTitle(true);
     $learnersWidgetSettings->setScriptBased(true);
     $learnersWidgetSettings->setEmbedded(true);
     $learnersWidgetSettings->setExpand(true);
     $learnersWidgetSettings->setDivname('learners');
     $learnersWidgetSettings->setCourseId($pkgId);
     $activitiesWidgetSettings = new WidgetSettings();
     $activitiesWidgetSettings->setShowTitle(true);
     $activitiesWidgetSettings->setScriptBased(true);
     $activitiesWidgetSettings->setEmbedded(true);
     $activitiesWidgetSettings->setExpand(true);
     $activitiesWidgetSettings->setDivname('activities');
     $activitiesWidgetSettings->setCourseId($pkgId);
     $commentsWidgetSettings = new WidgetSettings();
     $commentsWidgetSettings->setShowTitle(true);
     $commentsWidgetSettings->setScriptBased(true);
     $commentsWidgetSettings->setEmbedded(true);
     $commentsWidgetSettings->setExpand(true);
     $commentsWidgetSettings->setDivname('comments');
     $commentsWidgetSettings->setCourseId($pkgId);
     $interactionsWidgetSettings = new WidgetSettings();
     $interactionsWidgetSettings->setShowTitle(true);
     $interactionsWidgetSettings->setScriptBased(true);
     $interactionsWidgetSettings->setEmbedded(true);
     $interactionsWidgetSettings->setExpand(true);
     $interactionsWidgetSettings->setDivname('interactions');
     $interactionsWidgetSettings->setCourseId($pkgId);
     $summaryUrl = $rptService->GetWidgetUrl($rptAuth, 'courseSummary', $summaryWidgetSettings);
     $learnersUrl = $rptService->GetWidgetUrl($rptAuth, 'learnerRegistration', $learnersWidgetSettings);
     $activitiesUrl = $rptService->GetWidgetUrl($rptAuth, 'courseActivities', $activitiesWidgetSettings);
     $commentsUrl = $rptService->GetWidgetUrl($rptAuth, 'courseComments', $commentsWidgetSettings);
     $interactionsUrl = $rptService->GetWidgetUrl($rptAuth, 'courseInteractionsShort', $interactionsWidgetSettings);
     $reportageRpt = "<table cellspacing=0 cellpadding=0><tr><td colspan=2><div id='summary'>Loading...</div></td></tr>\n";
     $reportageRpt .= "<tr><td valign='top'><div id='learners'></div</td>\n";
     $reportageRpt .= "<td valign='top'><div id='activities'></div></td></tr>\n";
     $reportageRpt .= "<tr><td valign='top'><div id='comments'></div></td>\n";
     $reportageRpt .= "<td valign='top'><div id='interactions'></div></td></tr></table>\n";
     $reportageRpt .= '<script type="text/javascript">';
     $reportageRpt .= '$(document).ready(function(){';
     $reportageRpt .= '	loadScript("' . $summaryUrl . '");';
     $reportageRpt .= '	loadScript("' . $learnersUrl . '");';
     $reportageRpt .= '	loadScript("' . $activitiesUrl . '");';
     $reportageRpt .= '	loadScript("' . $commentsUrl . '");';
     $reportageRpt .= '	loadScript("' . $interactionsUrl . '");';
     $reportageRpt .= '});';
     $reportageRpt .= '</script>';
     $stylesheet = $baseUrl . "Customizing/global/plugins/Services/Repository/RepositoryObject/ScormCloud/tracking/reportage.css";
     $reportageRpt .= '<link rel="stylesheet" type="text/css" href="' . $stylesheet . '" />';
     $trackingTable .= $reportageRpt;
     $tpl->setContent($reportageRpt);
     //$tpl->setContent($trackingTable);
 }