function JLMS_showCEOPage($option) { $db =& JFactory::getDbo(); $user = JLMSFactory::getUser(); $my_id = $user->get('id'); $JLMS_CONFIG =& JLMSFactory::getConfig(); $JLMS_SESSION =& JLMSFactory::getSession(); $my_learners = array(); $my_learners_1 = array(); $my_learners_2 = array(); $query = "SELECT a.*" . "\n, b.username, b.name, b.email" . "\n, d.course_name, d.id as course_id" . "\n FROM #__users as b, #__lms_user_parents as a" . "\n, #__lms_users_in_groups as c" . "\n, #__lms_courses as d" . "\n WHERE 1" . "\n AND a.user_id = b.id" . "\n AND a.user_id = c.user_id" . "\n AND c.course_id = d.id" . "\n AND a.parent_id = '" . $my_id . "'" . "\n ORDER BY b.username, b.name, d.course_name"; $db->SetQuery($query); $my_learners_1 = $db->LoadObjectList(); // echo $query; // echo '<pre>'; // print_r($my_learners_1); // echo '</pre>'; $query = "SELECT a.*" . "\n, b.username, b.name, b.email" . "\n, d.course_name, d.id as course_id" . "\n FROM #__users as b, #__lms_users_in_global_groups as a" . "\n, #__lms_users_in_groups as c" . "\n, #__lms_courses as d" . "\n, #__lms_user_assign_groups as e" . "\n WHERE 1" . "\n AND a.user_id = b.id" . "\n AND a.user_id = c.user_id" . "\n AND c.course_id = d.id" . "\n AND e.group_id = a.group_id" . "\n AND e.user_id = '" . $my_id . "'" . "\n ORDER BY b.username, b.name, d.course_name"; $db->SetQuery($query); $my_learners_2 = $db->LoadObjectList(); // echo $query; // echo '<pre>'; // print_r($my_learners_2); // echo '</pre>'; $exist_lrn_ids = array(); $i = 0; foreach ($my_learners_2 as $my_lrn_2) { $my_learners[] = $my_lrn_2; $exist_lrn_ids[] = $my_lrn_2->user_id; } foreach ($my_learners_1 as $my_lrn_1) { if (!in_array($my_lrn_1->user_id, $exist_lrn_ids)) { $my_learners[] = $my_lrn_1; $exist_lrn_ids[] = $my_lrn_1->user_id; } } // echo '<pre>'; // print_r($my_learners); // echo '</pre>'; $lists = array(); JLMS_ShowHeading($JLMS_CONFIG->get('jlms_heading'), false); //get list of all courses IDs $courses_ids = array(); $user_ids = array(); foreach ($my_learners as $my_learner) { if ($my_learner->course_id) { if (!in_array($my_learner->course_id, $courses_ids)) { $courses_ids[] = $my_learner->course_id; } } if ($my_learner->user_id) { if (!in_array($my_learner->user_id, $user_ids)) { $user_ids[] = $my_learner->user_id; } } } if (count($courses_ids) && count($user_ids)) { //check if any user has completed any course $user_ids_str = implode(',', $user_ids); $query = "SELECT * FROM #__lms_certificate_users WHERE user_id IN ({$user_ids_str}) AND crt_option = 1"; $db->SetQuery($query); $certificate_users = $db->LoadObjectList(); if (count($certificate_users)) { //check if courses have certificates enabled and configured $courses_ids_str = implode(',', $courses_ids); $query = "SELECT * FROM #__lms_certificates WHERE course_id IN ({$courses_ids_str}) AND crtf_type = 1"; $db->SetQuery($query); $courses_certificates = $db->LoadObjectList(); //populate list of CEO users with course completion information for ($i = 0, $n = count($my_learners); $i < $n; $i++) { $my_learners[$i]->course_completion = 0; foreach ($certificate_users as $certificate_user) { if ($certificate_user->user_id == $my_learners[$i]->user_id && $certificate_user->course_id == $my_learners[$i]->course_id) { $my_learners[$i]->course_completion = 1; foreach ($courses_certificates as $course_certificate) { if ($course_certificate->course_id == $certificate_user->course_id) { $my_learners[$i]->course_completion = 2; break; } } break; } } } } } joomla_lms_html::showCEO_page($option, $lists, $my_learners); }
function showpageTracking($id, $option, &$rows, &$lists) { $JLMS_CONFIG =& JLMSFactory::getConfig(); $JLMS_SESSION =& JLMSFactory::getSession(); $Itemid = $JLMS_CONFIG->get('Itemid'); global $my; JLMS_TMPL::OpenMT(); $hparams = array(); $page_13_stats_shown = false; $page_12_stats_shown = false; $page_14_stats_shown = false; if ($lists['page'] == 12) { $hparams['second_tb_header'] = _JLMS_TRACKING_DOCUMENTS_STATISTICS; } elseif ($lists['page'] == 13) { $hparams['second_tb_header'] = _JLMS_TRACKING_LPATHS_STATISTICS; } elseif ($lists['page'] == 14) { $hparams['second_tb_header'] = _JLMS_TRACKING_LATEST_COURSE_ACTIVITIES_REPORT; } else { $hparams['second_tb_header'] = _JLMS_TRACK_TITLE_ACCESS . JLMS_TRACKING_getTitle($lists['page']); } $toolbar = array(); $toolbar[] = array('btn_type' => 'back', 'btn_js' => sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=tracking&id={$id}")); JLMS_TMPL::ShowHeader('tracking', _JLMS_TRACK_TITLE, $hparams, $toolbar); JLMS_TMPL::OpenTS(); ?> <form action="<?php echo sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}"); ?> " method="post" name="adminForm"> <table width="100%" cellpadding="0" cellspacing="0" border="0" class="jlms_table_no_borders"> <tr> <td align="right" style="text-align:right "> <div align="right" style="white-space:nowrap "> <?php if ($lists['page'] == 12 || $lists['page'] == 13 || $lists['page'] == 14) { //only group and user filters if (isset($lists['filter_lpath']) && $lists['page'] == 13) { echo $lists['filter_lpath'] . '<br />'; } if (isset($lists['filter2'])) { echo $lists['filter2'] . '<br />'; } if (isset($lists['filter3'])) { echo $lists['filter3'] . '<br />'; } echo $lists['filter_stu'] . '<br />'; } else { echo $lists['filter_pages'] . $lists['filter'] . $lists['filter_month'] . $lists['filter_day']; ?> <br /> <?php /*if(isset($lists['filter_lpath'])){ echo $lists['filter_lpath'].'<br />'; }*/ if (isset($lists['filter2'])) { echo $lists['filter2'] . '<br />'; } if (isset($lists['filter3'])) { echo $lists['filter3'] . '<br />'; } echo $lists['filter_stu'] . '<br />'; } ?> </div> </td> </tr> </table> <?php if ($lists['page'] == 12 || $lists['page'] == 13 || $lists['page'] == 14) { //do nothing } else { //show hits statistics ?> <?php $link = "index.php?option={$option}&Itemid={$Itemid}&task=tracking&id={$id}"; ?> <table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php echo JLMSCSS::_('jlmslist'); ?> "> <tr> <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> "><?php echo _JLMS_TRACK_TBL_H_STU; ?> </<?php echo JLMSCSS::tableheadertag(); ?> > <?php $rr = array(); if ($lists['is_day']) { foreach ($lists['months'] as $ma) { echo '<' . JLMSCSS::tableheadertag() . ' class="' . JLMSCSS::_('sectiontableheader') . '" align="center">' . JLMS_dateToDisplay(mktime(0, 0, 0, $ma->month, $ma->day, $ma->year), true) . '</' . JLMSCSS::tableheadertag() . '>'; $rr[] = $ma->month; } } else { foreach ($lists['months'] as $ma) { echo '<' . JLMSCSS::tableheadertag() . ' class="' . JLMSCSS::_('sectiontableheader') . '" align="center">' . month_lang(strftime('%m', mktime(0, 0, 0, $ma->month + 1, 0, 0)), 0, 2) . ', ' . $ma->year . '</' . JLMSCSS::tableheadertag() . '>'; $rr[] = $ma->month; } } ?> </tr> <?php $k = 1; $i = 0; $total_counts = array(); for ($j = 0; $j < count($lists['months']); $j++) { $total_counts[$j] = 0; } while ($i < count($rows)) { $row = $rows[$i]; $link = ''; $link = "index.php?option={$option}&Itemid={$Itemid}&task=tracking&id={$id}&filter_stu=" . $row->user_id . "&page=" . $lists['page']; ?> <tr class="<?php echo JLMSCSS::_('sectiontableentry' . $k); ?> "> <td align="left" valign="middle" style="vertical-align:middle "> <a href="<?php echo sefRelToAbs($link); ?> " title="<?php echo _JLMS_VIEW_DETAILS; ?> "> <?php echo $row->username; ?> </a> </td> <?php #$j = $lists['month']-1; $e = 0; $user = $rows[$i]->user_id; #$month = $rows[$i]->month; #$year = $rows[$i]->year; do { if ($lists['is_day']) { while (($lists['months'][$e]->day != $rows[$i]->day || $lists['months'][$e]->month != $rows[$i]->month || $lists['months'][$e]->year != $rows[$i]->year) && $e < count($lists['months'])) { echo '<td align="center">0</td>'; $e++; } if ($rows[$i]->user_id == $user && $rows[$i]->day == $lists['months'][$e]->day && $rows[$i]->month == $lists['months'][$e]->month && $rows[$i]->year == $lists['months'][$e]->year) { echo '<td align="center">' . $rows[$i]->count_hits . '</td>'; $total_counts[$e] = $total_counts[$e] + $rows[$i]->count_hits; } } else { while (($lists['months'][$e]->month != $rows[$i]->month || $lists['months'][$e]->year != $rows[$i]->year) && $e < count($lists['months'])) { echo '<td align="center">0</td>'; $e++; } if ($rows[$i]->user_id == $user && $rows[$i]->month == $lists['months'][$e]->month && $rows[$i]->year == $lists['months'][$e]->year) { echo '<td align="center">' . $rows[$i]->count_hits . '</td>'; $total_counts[$e] = $total_counts[$e] + $rows[$i]->count_hits; } } #$j ++; $e++; $i++; } while ($i < count($rows) && $rows[$i]->user_id == $user); while ($e < count($lists['months'])) { echo '<td align="center">0</td>'; $e++; } if (isset($rows[$i]->user_id) && $rows[$i]->user_id != $user) { $i--; } ?> </tr> <?php $k = 3 - $k; $i++; } ?> <tr class="<?php echo JLMSCSS::_('sectiontableentry' . $k); ?> "> <td align="left" valign="middle" style="vertical-align:middle "><?php echo _JLMS_TOTAL; ?> </td> <?php for ($j = 0; $j < count($lists['months']); $j++) { echo '<td align="center"><strong>' . $total_counts[$j] . '</strong></td>'; } ?> </tr> </table> <br /><br /> <?php } ?> <?php if ($lists['page'] == 14 && isset($lists['page14_stats']) && !empty($lists['page14_stats'])) { $page_14_stats_shown = true; ?> <script type="text/javascript"> function submitbutton(pressbutton){ var form = document.adminForm; form.view.value = pressbutton; form.submit(); } </script> <table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php echo JLMSCSS::_('jlmslist'); ?> "> <tr> <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " width="20">#</<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> "> <?php echo _JLMS_TRACK_TBL_H_STU; ?> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> "> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> "> <?php echo _JLMS_TRACK_TBL_H_ACTIVITY; ?> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> "> <?php echo _JLMS_TRACK_TBL_H_TIME; ?> </<?php echo JLMSCSS::tableheadertag(); ?> > </tr> <?php $limit = intval(mosGetParam($_GET, 'limit', $JLMS_SESSION->get('list_limit', $JLMS_CONFIG->getCfg('list_limit')))); $JLMS_SESSION->set('list_limit', $limit); $limitstart = intval(mosGetParam($_GET, 'limitstart', 0)); $total = count($lists['page14_stats']); require_once _JOOMLMS_FRONT_HOME . DS . "includes" . DS . "classes" . DS . "lms.pagination.php"; $pageNav = new JLMSPageNav($total, $limitstart, $limit); $k = 1; $count_activities = 0; $items_counter = 0; foreach ($lists['page14_stats'] as $latest_activity) { if ($count_activities >= $pageNav->limitstart && $count_activities < $pageNav->limitstart + $pageNav->limit) { echo '<tr class="' . JLMSCSS::_('sectiontableentry' . $k) . '">'; echo '<td>'; echo $pageNav->limitstart + $items_counter + 1; echo '</td>'; echo '<td>' . $latest_activity->user . '</td>'; echo '<td width="16"><img src="' . $JLMS_CONFIG->get('live_site') . '/components/com_joomla_lms/lms_images/' . $latest_activity->icon . '" alt="i" width="16" height="16" border="0" /></td>'; echo '<td>' . $latest_activity->activity . '</td>'; echo '<td>' . JLMS_dateToDisplay($latest_activity->time, true, $JLMS_CONFIG->get('offset') * 60 * 60, ' H:i:s') . '</td>'; echo '</tr>'; $k = 3 - $k; $items_counter++; } $count_activities++; } ?> <tr> <td colspan="5" align="center"class="<?php echo JLMSCSS::_('jlmslist-footer_td'); ?> "> <div align="center"> <?php $link = "index.php?option={$option}&Itemid={$Itemid}&task=tracking&id={$id}&page=14"; echo $pageNav->writePagesLinks($link); ?> </div> </td> </tr> </table> <table width="100%" cellpadding="0" cellspacing="0" class="jlms_table_no_borders"> <tr> <td align="center"> <?php $controls = array(); $controls[] = array('href' => "javascript:submitbutton('csv');", 'title' => 'CSV', 'img' => 'csv'); $controls[] = array('href' => "javascript:submitbutton('xls');", 'title' => 'XLS', 'img' => 'xls'); JLMS_TMPL::ShowControlsFooterC($controls, '', false, false, _JLMS_EXPORT_TO . ':'); ?> </td> </tr> </table> <?php } elseif ($lists['page'] == 14 && !$page_14_stats_shown) { echo '<div class="joomlalms_user_message">' . _JLMS_TRACKING_NO_STATISTICS . '</div>'; } elseif ($lists['page'] == 12 && $lists['filter_stu_val'] && isset($lists['page12_stats']) && !empty($lists['page12_stats'])) { $page_12_stats_shown = true; $max_tree_width = 0; if (isset($lists['page12_stats'][0])) { $max_tree_width = $lists['page12_stats'][0]->tree_max_width; } ?> <table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php echo JLMSCSS::_('jlmslist'); ?> "> <tr> <<?php echo JLMSCSS::tableheadertag(); ?> width="<?php echo 16 * ($max_tree_width + 1); ?> " class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " colspan="<?php echo $max_tree_width + 1; ?> "> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " width="45%"><?php echo _JLMS_TRACK_TBL_DOC_NAME; ?> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " align="center"><?php echo _JLMS_TRACK_TBL_DOC_DOWNS; ?> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " align="center"><?php echo _JLMS_TRACK_TBL_DOC_LAST; ?> </<?php echo JLMSCSS::tableheadertag(); ?> > </tr> <?php $k = 1; $tree_modes = array(); for ($i = 0, $n = count($lists['page12_stats']); $i < $n; $i++) { $row_doc = $lists['page12_stats'][$i]; $max_tree_width = $row_doc->tree_max_width; ?> <tr class="<?php echo JLMSCSS::_('sectiontableentry' . $k); ?> "> <?php $add_img = ''; if ($row_doc->tree_mode_num) { $g = 0; $tree_modes[$row_doc->tree_mode_num - 1] = $row_doc->tree_mode; while ($g < $row_doc->tree_mode_num - 1) { $pref = ''; if (isset($tree_modes[$g]) && $tree_modes[$g] == 2) { $pref = 'empty_'; } $add_img .= "<td width='16' valign='middle'><img src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/treeview/" . $pref . "line.png\" width='16' height='16' /></td>"; $g++; } $add_img .= "<td width='16' valign='middle'><img src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/treeview/sub" . $row_doc->tree_mode . ".png\" width='16' height='16' /></td>"; $max_tree_width = $max_tree_width - $g - 1; } echo $add_img; ?> <td align="center" valign="middle" style="vertical-align:middle " width='16'> <?php if ($row_doc->folder_flag == 1) { echo "<span style='alignment:center; font-weight:bold; vertical-align:middle;'><img class='JLMS_png' src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/folder.png\" width='16' height='16' alt='Folder' /></span>"; } else { echo "<span style='alignment:center; font-weight:bold; vertical-align:middle;'><img class='JLMS_png' src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/files/" . $row_doc->file_icon . ".png\" width='16' height='16' alt='File' /></span>"; } ?> </td> <td align="left" valign="middle" <?php if ($max_tree_width > 0) { echo "colspan='" . ($max_tree_width + 1) . "'"; } ?> width="35%"> <?php if ($row_doc->folder_flag || !$row_doc->folder_flag && !$row_doc->file_id) { echo '<strong>' . $row_doc->doc_name . '</strong>'; } else { echo $row_doc->doc_name; } ?> </td> <td valign="middle" align="center"> <?php echo $row_doc->downloads; ?> </td> <td valign="middle" align="center"> <?php echo JLMS_dateToDisplay($row_doc->last_access, false, $JLMS_CONFIG->get('offset') * 60 * 60, ' H:i:s'); ?> </td> </tr> <?php $k = 3 - $k; } ?> </table> <?php } elseif ($lists['page'] == 12 && !$lists['filter_stu_val'] && isset($lists['page12_stats']) && !empty($lists['page12_stats'])) { $page_12_stats_shown = true; $max_tree_width = 0; if (isset($lists['page12_stats'][0])) { $max_tree_width = $lists['page12_stats'][0]->tree_max_width; } ?> <script language="javascript" type="text/javascript"> <!--//--><![CDATA[//><!-- var block_stats = 0; var tID = ''; var url_prefix = '<?php echo $JLMS_CONFIG->get('live_site') . "/index.php?tmpl=component&option={$option}&Itemid={$Itemid}&id={$id}"; ?> '; function jlms_MakeRequest(url) { var http_request = false; if (window.ActiveXObject) { // IE try { http_request = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { http_request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } else if (window.XMLHttpRequest) { // Mozilla, Safari,... http_request = new XMLHttpRequest(); if (http_request.overrideMimeType) { http_request.overrideMimeType('text/xml'); } } if (!http_request) { return false; } http_request.onreadystatechange = function() { jlms_AnalizeRequest(http_request); }; http_request.open('GET', url_prefix + url, true); http_request.send(null); } function jlms_AnalizeRequest(http_request) { if (http_request.readyState == 4) { if ((http_request.status == 200)) { block_stats = 0; if(http_request.responseXML.documentElement == null){ try { http_request.responseXML.loadXML(http_request.responseText) } catch (e) { /*alert("Can't load");*/ } } response = http_request.responseXML.documentElement; var task = response.getElementsByTagName('task')[0].firstChild.data; switch (task) { case 'doc_xml': var response_data = response.getElementsByTagName('stats_table')[0].firstChild.data; var sec_indx = gl_el.parentNode.sectionRowIndex; var table = gl_el.parentNode.parentNode; var row = table.insertRow(sec_indx + 1); var cell1 = document.createElement("td"); cell1.align = 'left'; cell1.colSpan = "<?php echo $max_tree_width + 5; ?> "; cell1.style.padding = '0px'; cell1.style.margin = '0px'; cell1.innerHTML = response_data; row.appendChild(cell1); gl_el.innerHTML = "<img class='JLMS_png' src='<?php echo $JLMS_CONFIG->get('live_site'); ?> /components/com_joomla_lms/lms_images/toolbar/btn_accept.png' width='16' height='16' alt=\"done\" title=\"done\" />"; break; } } else { } } } var gl_el = ''; function jlms_RequestDOCS_stats( doc_id, element ) { if (block_stats == 0) { block_stats = 1; gl_el = element.parentNode; jlms_MakeRequest('&task=get_docs_stats&doc_id='+doc_id+'&colspan=<?php echo $max_tree_width + 2; ?> '); gl_el.innerHTML = "<img src='<?php echo $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('ajax_settings_small_indicator'); ?> ' width='16' height='16' alt=\"loading\" title=\"loading\" />"; } } JLMS_preloadImages('<?php echo $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('ajax_settings_small_indicator'); ?> ', '<?php echo $JLMS_CONFIG->get('live_site'); ?> /components/com_joomla_lms/lms_images/toolbar/btn_accept.png'); //--><!]]> </script> <table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php echo JLMSCSS::_('jlmslist'); ?> "> <tr> <<?php echo JLMSCSS::tableheadertag(); ?> width="16" class="<?php echo JLMSCSS::_('sectiontableheader'); ?> "> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> width="<?php echo 16 * ($max_tree_width + 1); ?> " class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " colspan="<?php echo $max_tree_width + 1; ?> "> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " width="45%"><?php echo _JLMS_TRACK_TBL_DOC_NAME; ?> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " width="100" align="center"><?php echo _JLMS_TRACK_TBL_DOC_DOWNS; ?> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " width="100" align="center"><?php echo _JLMS_TRACK_TBL_DOC_LAST; ?> </<?php echo JLMSCSS::tableheadertag(); ?> > </tr> <?php $k = 1; $tree_modes = array(); for ($i = 0, $n = count($lists['page12_stats']); $i < $n; $i++) { $row_doc = $lists['page12_stats'][$i]; $max_tree_width = $row_doc->tree_max_width; ?> <tr class="<?php echo JLMSCSS::_('sectiontableentry' . $k); ?> "> <td valign="middle" align="center"> <?php if ($row_doc->folder_flag != 1) { ?> <span style="alignment:center; vertical-align:middle; cursor:pointer" onclick="jlms_RequestDOCS_stats(<?php echo $row_doc->id; ?> , this);"> <img class='JLMS_png' src="<?php echo $JLMS_CONFIG->get('live_site'); ?> /components/com_joomla_lms/lms_images/toolbar/btn_pending_cur.png" width='16' height='16' alt="<?php echo _JLMS_TRACK_VIEW_DETAILS; ?> " title="<?php echo _JLMS_TRACK_VIEW_DETAILS; ?> " /> </span> <?php } else { echo ' '; } ?> </td> <?php $add_img = ''; if ($row_doc->tree_mode_num) { $g = 0; $tree_modes[$row_doc->tree_mode_num - 1] = $row_doc->tree_mode; while ($g < $row_doc->tree_mode_num - 1) { $pref = ''; if (isset($tree_modes[$g]) && $tree_modes[$g] == 2) { $pref = 'empty_'; } $add_img .= "<td width='16' valign='middle'><img src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/treeview/" . $pref . "line.png\" width='16' height='16' alt='line' /></td>"; $g++; } $add_img .= "<td width='16' valign='middle'><img src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/treeview/sub" . $row_doc->tree_mode . ".png\" width='16' height='16' alt='sub' /></td>"; $max_tree_width = $max_tree_width - $g - 1; } echo $add_img; ?> <td align="center" valign="middle" style="vertical-align:middle " width='16'> <?php if ($row_doc->folder_flag == 1) { echo "<span style='alignment:center; font-weight:bold; vertical-align:middle;'><img class='JLMS_png' src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/folder.png\" width='16' height='16' alt='Folder' /></span>"; } else { echo "<span style='alignment:center; font-weight:bold; vertical-align:middle;'><img class='JLMS_png' src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/files/" . $row_doc->file_icon . ".png\" width='16' height='16' alt='File' /></span>"; } ?> </td> <td align="left" valign="middle" <?php if ($max_tree_width > 0) { echo "colspan='" . ($max_tree_width + 1) . "'"; } ?> width="35%"> <?php if ($row_doc->folder_flag || !$row_doc->folder_flag && !$row_doc->file_id) { echo '<strong>' . $row_doc->doc_name . '</strong>'; } else { echo $row_doc->doc_name; } ?> </td> <td valign="middle" align="center"> <?php echo $row_doc->downloads; ?> </td> <td valign="middle" align="center"> <?php echo JLMS_dateToDisplay($row_doc->last_access, false, $JLMS_CONFIG->get('offset') * 60 * 60, ' H:i:s'); ?> </td> </tr> <?php $k = 3 - $k; } ?> </table> <?php } elseif ($lists['page'] == 12 && !$page_12_stats_shown) { echo '<div class="joomlalms_user_message">' . _JLMS_TRACKING_NO_STATISTICS . '</div>'; } elseif ($lists['page'] == 13 && $lists['filter_stu_val'] && isset($lists['page13_stats']) && !empty($lists['page13_stats'])) { $page_13_stats_shown = true; ?> <script language="javascript" type="text/javascript"> <!--//--><![CDATA[//><!-- function submitbutton(pressbutton){ var form = document.adminForm; form.view.value = pressbutton; form.submit(); } var block_stats = 0; var tID = ''; var url_prefix = '<?php echo $JLMS_CONFIG->get('live_site') . "/index.php?tmpl=component&option={$option}&Itemid={$Itemid}&id={$id}"; ?> '; function jlms_MakeRequest(url) { var http_request = false; if (window.XMLHttpRequest) { // Mozilla, Safari,... http_request = new XMLHttpRequest(); if (http_request.overrideMimeType) { http_request.overrideMimeType('text/xml'); } } else if (window.ActiveXObject) { // IE try { http_request = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { http_request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } if (!http_request) { return false; } http_request.onreadystatechange = function() { jlms_AnalizeRequest(http_request); }; http_request.open('GET', url_prefix + url, true); http_request.send(null); } function jlms_AnalizeRequest(http_request) { if (http_request.readyState == 4) { if ((http_request.status == 200)) { block_stats = 0; if(http_request.responseXML.documentElement == null){ try { http_request.responseXML.loadXML(http_request.responseText) } catch (e) { /*alert("Can't load");*/ } } response = http_request.responseXML.documentElement; var task = response.getElementsByTagName('task')[0].firstChild.data; switch (task) { case 'lpath_xml': var response_data = response.getElementsByTagName('stats_table')[0].firstChild.data; if (response_data && response_data != '' && response_data != ' ') { var sec_indx = gl_el.parentNode.sectionRowIndex; var table = gl_el.parentNode.parentNode; var row = table.insertRow(sec_indx + 1); var cell1 = document.createElement("td"); cell1.align = 'left'; cell1.colSpan = "3"; cell1.style.padding = '0px'; cell1.style.margin = '0px'; cell1.innerHTML = response_data; row.appendChild(cell1); } gl_el.innerHTML = "<img class='JLMS_png' src='<?php echo $JLMS_CONFIG->get('live_site'); ?> /components/com_joomla_lms/lms_images/toolbar/btn_accept.png' width='16' height='16' alt=\"done\" title=\"done\" />"; break; case 'scorm_progress_xml': var response_data = response.getElementsByTagName('stats_table')[0].firstChild.data; var res_user = response.getElementsByTagName('user_id')[0].firstChild.data; var res_lpsc = response.getElementsByTagName('lpath_id')[0].firstChild.data; if (response_data && response_data != '' && response_data != ' ') { gl_el_res = document.getElementById('sc_progress_td_'+res_user+'_'+res_lpsc); if (gl_el_res) { gl_el_res.innerHTML = response_data; } } break; } } else { } } } var gl_el = ''; function jlms_RequestLP_stats( lp_id, element ) { if (block_stats == 0) { block_stats = 1; gl_el = element.parentNode; jlms_MakeRequest('&task=get_lp_stats&lpath_id='+lp_id); gl_el.innerHTML = "<img src='<?php echo $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('ajax_settings_small_indicator'); ?> ' width='16' height='16' alt=\"loading\" title=\"loading\" />"; } } function ChangeScormProgress( user_id, sc_id, new_stat, element) { if (block_stats == 0) { block_stats = 1; gl_el = document.getElementById('sc_progress_td_'+user_id+'_'+sc_id); jlms_MakeRequest('&task=get_lp_stats&mode=scormstatus&user_id='+user_id+'&nstat='+new_stat+'&lpath_id='+sc_id); gl_el.innerHTML = "<img src='<?php echo $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('ajax_settings_small_indicator'); ?> ' width='16' height='16' alt=\"loading\" title=\"loading\" />"; } } JLMS_preloadImages('<?php echo $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('ajax_settings_small_indicator'); ?> ', '<?php echo $JLMS_CONFIG->get('live_site'); ?> /components/com_joomla_lms/lms_images/toolbar/btn_accept.png', '<?php echo $JLMS_CONFIG->get('live_site'); ?> /components/com_joomla_lms/lms_images/toolbar/btn_cancel.png'); //--><!]]> </script> <table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php echo JLMSCSS::_('jlmslist'); ?> "> <tr> <<?php echo JLMSCSS::tableheadertag(); ?> width="16" class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " align="center"> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> "><?php echo _JLMS_LPATH_TBL_HEAD_NAME; ?> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " width="1" colspan="3"> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " align="center"><?php echo _JLMS_LPATH_TBL_TIME_SPENT; ?> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " align="center"><?php echo _JLMS_LPATH_TBL_STARTING; ?> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " align="center"><?php echo _JLMS_LPATH_TBL_ENDING; ?> </<?php echo JLMSCSS::tableheadertag(); ?> > </tr> <?php $k = 1; for ($i = 0, $n = count($lists['page13_stats']); $i < $n; $i++) { $row_path = $lists['page13_stats'][$i]; $icon_img = "toolbar/tlb_lpath"; $icon_alt = "learnpath"; if ($row_path->item_id) { $icon_img = "toolbar/tlb_scorm"; $icon_alt = "scorm"; } ?> <tr class="<?php echo JLMSCSS::_('sectiontableentry' . $k); ?> "> <td valign="middle" align="center"> </td> <td valign="middle" align="left"> <?php if ($lists['f_lpath']) { echo JLMS_tracking_html::Echo_userinfo($row_path->u_name, $row_path->username, $row_path->email, 'javascript:void(0);'); } else { echo $row_path->lpath_name; } ?> </td> <?php if ($lists['f_lpath']) { ?> <td width="1%" style="white-space: nowrap;"><?php echo JLMS_getLpathProgress($row_path, $row_path->user_id ? $row_path->user_id : 0); ?> </td> <?php } else { ?> <td width="1%" style="white-space: nowrap;"><?php echo JLMS_getLpathProgress($row_path, $lists['filter_stu_val']); ?> </td> <?php } ?> <?php $r_img = 'btn_cancel'; $r_sta = _JLMS_LPATH_STU_LPSTATUS_NOTCOMPLETED; $time_spent = $row_path->time_spent; $r_start = '-'; $r_end = '-'; $new_s_status = '1'; if (!$row_path->item_id) { if (isset($row_path->r_status) && $row_path->r_status == 1) { $r_img = 'btn_accept'; $r_sta = _JLMS_LPATH_STU_LPSTATUS_COMPLETED; $r_start = isset($row_path->r_start) && $row_path->r_start ? JLMS_dateToDisplay($row_path->r_start, false, $JLMS_CONFIG->get('offset') * 60 * 60, '\\<\\b\\r \\/>H:i:s') : '-'; $r_end = isset($row_path->r_start) && $row_path->r_start ? JLMS_dateToDisplay($row_path->r_end, false, $JLMS_CONFIG->get('offset') * 60 * 60, '\\<\\b\\r \\/>H:i:s') : '-'; } elseif (isset($row_path->r_status) && $row_path->r_status == 0) { $r_img = 'btn_pending_cur'; $r_start = isset($row_path->r_start) && $row_path->r_start ? JLMS_dateToDisplay($row_path->r_start, false, $JLMS_CONFIG->get('offset') * 60 * 60, '\\<\\b\\r \\/>H:i:s') : '-'; } } else { if (isset($row_path->s_status) && $row_path->s_status == 1) { $r_img = 'btn_accept'; $r_sta = _JLMS_LPATH_STU_LPSTATUS_COMPLETED; $r_start = '-'; $r_end = '-'; $new_s_status = '0'; } if ($row_path->lp_type == 1 || $row_path->lp_type == 2) { $r_end = isset($row_path->r_end) && $row_path->r_end ? JLMS_dateToDisplay($row_path->r_end, true, $JLMS_CONFIG->get('offset') * 60 * 60, '\\<\\b\\r \\/>H:i:s') : '-'; $r_start = isset($row_path->r_start) && $row_path->r_start ? JLMS_dateToDisplay($row_path->r_start, true, $JLMS_CONFIG->get('offset') * 60 * 60, '\\<\\b\\r \\/>H:i:s') : '-'; } } ?> <?php if ($row_path->item_id) { ?> <td valign="middle" align="center" width="16" id="sc_progress_td_<?php echo $lists['filter_stu_val'] . "_" . $row_path->item_id; ?> "> <a class="jlms_img_link" id="sc_progress_a_<?php echo $lists['filter_stu_val'] . "_" . $row_path->item_id; ?> " href="javascript:ChangeScormProgress(<?php echo $lists['filter_stu_val']; ?> ,<?php echo $row_path->item_id; ?> ,<?php echo $new_s_status; ?> ,this);"><img id="sc_progress_img_<?php echo $lists['filter_stu_val'] . "_" . $row_path->item_id; ?> " align="absmiddle" class="JLMS_png" src="<?php echo $JLMS_CONFIG->get('live_site'); ?> /components/com_joomla_lms/lms_images/toolbar/<?php echo $r_img; ?> .png" width="16" height="16" border="0" alt="<?php echo $r_sta; ?> " title="<?php echo $r_sta; ?> " /></a> <?php } else { ?> <td valign="middle" align="center" width="16"> <img class='JLMS_png' src='<?php echo $JLMS_CONFIG->get('live_site'); ?> /components/com_joomla_lms/lms_images/toolbar/<?php echo $r_img; ?> .png' width='16' height='16' alt="<?php echo $r_sta; ?> " title="<?php echo $r_sta; ?> " /> <?php } ?> </td> <td valign="middle" align="center" nowrap="nowrap"> <?php echo $row_path->item_id ? isset($row_path->s_score) ? $row_path->s_score . _JLMS_GB_POINTS : ' ' : ' '; ?> </td> <td valign="middle" align="center" nowrap="nowrap"><?php echo $time_spent; ?> </td> <td valign="middle" align="center" nowrap="nowrap"><?php echo $r_start; ?> </td> <td valign="middle" align="center" nowrap="nowrap"><?php echo $r_end; ?> </td> </tr> <?php $k = 3 - $k; } ?> </table> <table width="100%" cellpadding="0" cellspacing="0" class="jlms_table_no_borders"> <tr> <td align="center"> <?php $controls = array(); $controls[] = array('href' => "javascript:submitbutton('csv');", 'title' => 'CSV', 'img' => 'csv'); $controls[] = array('href' => "javascript:submitbutton('xls');", 'title' => 'XLS', 'img' => 'xls'); JLMS_TMPL::ShowControlsFooterC($controls, '', false, false, _JLMS_EXPORT_TO . ':'); ?> </td> </tr> </table> <?php } elseif ($lists['page'] == 13 && !$lists['filter_stu_val'] && isset($lists['page13_stats']) && !empty($lists['page13_stats'])) { $page_13_stats_shown = true; ?> <script language="javascript" type="text/javascript"> <!--//--><![CDATA[//><!-- var block_stats = 0; var tID = ''; var url_prefix = '<?php echo $JLMS_CONFIG->get('live_site') . "/index.php?tmpl=component&option={$option}&Itemid={$Itemid}&id={$id}"; ?> '; function jlms_MakeRequest(url) { var http_request = false; if (window.XMLHttpRequest) { // Mozilla, Safari,... http_request = new XMLHttpRequest(); if (http_request.overrideMimeType) { http_request.overrideMimeType('text/xml'); } } else if (window.ActiveXObject) { // IE try { http_request = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { http_request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } if (!http_request) { return false; } http_request.onreadystatechange = function() { jlms_AnalizeRequest(http_request); }; http_request.open('GET', url_prefix + url, true); http_request.send(null); } function jlms_AnalizeRequest(http_request) { if (http_request.readyState == 4) { if ((http_request.status == 200)) { block_stats = 0; if(http_request.responseXML.documentElement == null){ try { http_request.responseXML.loadXML(http_request.responseText) } catch (e) { /*alert("Can't load");*/ } } response = http_request.responseXML.documentElement; var task = response.getElementsByTagName('task')[0].firstChild.data; switch (task) { case 'lpath_xml': var response_data = response.getElementsByTagName('stats_table')[0].firstChild.data; if (response_data && response_data != '' && response_data != ' ') { var sec_indx = gl_el.parentNode.sectionRowIndex; var table = gl_el.parentNode.parentNode; var row = table.insertRow(sec_indx + 1); var cell1 = document.createElement("td"); cell1.align = 'left'; cell1.colSpan = "3"; cell1.style.padding = '0px'; cell1.style.margin = '0px'; cell1.innerHTML = response_data; row.appendChild(cell1); } gl_el.innerHTML = "<img class='JLMS_png' src='<?php echo $JLMS_CONFIG->get('live_site'); ?> /components/com_joomla_lms/lms_images/toolbar/btn_accept.png' width='16' height='16' alt=\"done\" title=\"done\" />"; break; case 'scorm_progress_xml': var response_data = response.getElementsByTagName('stats_table')[0].firstChild.data; var res_user = response.getElementsByTagName('user_id')[0].firstChild.data; var res_lpsc = response.getElementsByTagName('lpath_id')[0].firstChild.data; if (response_data && response_data != '' && response_data != ' ') { gl_el_res = document.getElementById('sc_progress_td_'+res_user+'_'+res_lpsc); if (gl_el_res) { gl_el_res.innerHTML = response_data; } } break; } } else { } } } var gl_el = ''; function jlms_RequestLP_stats( lp_id, element ) { if (block_stats == 0) { block_stats = 1; gl_el = element.parentNode; jlms_MakeRequest('&task=get_lp_stats&lpath_id='+lp_id); gl_el.innerHTML = "<img src='<?php echo $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('ajax_settings_small_indicator'); ?> ' width='16' height='16' alt=\"loading\" title=\"loading\" />"; } } function ChangeScormProgress( user_id, sc_id, new_stat, element) { if (block_stats == 0) { block_stats = 1; gl_el = document.getElementById('sc_progress_td_'+user_id+'_'+sc_id); jlms_MakeRequest('&task=get_lp_stats&mode=scormstatus&user_id='+user_id+'&nstat='+new_stat+'&lpath_id='+sc_id); gl_el.innerHTML = "<img src='<?php echo $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('ajax_settings_small_indicator'); ?> ' width='16' height='16' alt=\"loading\" title=\"loading\" />"; } } JLMS_preloadImages('<?php echo $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('ajax_settings_small_indicator'); ?> ', '<?php echo $JLMS_CONFIG->get('live_site'); ?> /components/com_joomla_lms/lms_images/toolbar/btn_accept.png'); //--><!]]> </script> <table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php echo JLMSCSS::_('jlmslist'); ?> "> <tr> <<?php echo JLMSCSS::tableheadertag(); ?> width="16" class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " align="center"> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> width="16" class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " align="center"> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " width="100%"><?php echo _JLMS_LPATH_TBL_HEAD_NAME; ?> </<?php echo JLMSCSS::tableheadertag(); ?> > </tr> <?php $k = 1; for ($i = 0, $n = count($lists['page13_stats']); $i < $n; $i++) { $row_path = $lists['page13_stats'][$i]; $icon_img = "toolbar/tlb_lpath"; $icon_alt = "learnpath"; if ($row_path->item_id) { $icon_img = "toolbar/tlb_scorm"; $icon_alt = "scorm"; } ?> <tr class="<?php echo JLMSCSS::_('sectiontableentry' . $k); ?> "> <td valign="middle" align="center"> <?php if (!isset($row_path->is_link)) { ?> <span style="alignment:center; vertical-align:middle; cursor:pointer" onclick="jlms_RequestLP_stats(<?php echo $row_path->id; ?> , this);"> <img class='JLMS_png' src="<?php echo $JLMS_CONFIG->get('live_site'); ?> /components/com_joomla_lms/lms_images/toolbar/btn_pending_cur.png" width='16' height='16' alt="<?php echo _JLMS_TRACK_VIEW_DETAILS; ?> " title="<?php echo _JLMS_TRACK_VIEW_DETAILS; ?> " /> </span> <?php } ?> </td> <td valign="middle" align="center"> <span style="alignment:center; vertical-align:middle"> <img class='JLMS_png' src="<?php echo $JLMS_CONFIG->get('live_site'); ?> /components/com_joomla_lms/lms_images/<?php echo $icon_img; ?> .png" width='16' height='16' alt="<?php echo $icon_alt; ?> " /> </span> </td> <td valign="middle" align="left"> <?php echo $row_path->lpath_name; ?> </td> </tr> <?php $k = 3 - $k; } ?> </table> <?php } elseif ($lists['page'] == 13 && !$page_13_stats_shown) { echo '<div class="joomlalms_user_message">' . _JLMS_TRACKING_NO_STATISTICS . '</div>'; } elseif ($lists['page'] == 5 && $lists['filter_stu_val'] && isset($lists['page5_stats'])) { ?> <br /><br /> <table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php echo JLMSCSS::_('jlmslist'); ?> "> <tr> <<?php echo JLMSCSS::tableheadertag(); ?> width="20" class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " align="center">#</<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " width="30%"><?php echo _JLMS_HW_TBL_HEAD_HW; ?> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> "><?php echo _JLMS_HW_TBL_HEAD_DATE; ?> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> "><?php echo _JLMS_HW_TBL_HEAD_ENDDATE; ?> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " width="1"> </<?php echo JLMSCSS::tableheadertag(); ?> > </tr> <?php $k = 1; for ($i = 0, $n = count($lists['page5_stats']); $i < $n; $i++) { $row_hw = $lists['page5_stats'][$i]; $alt = $row_hw->hw_status ? _JLMS_HW_STATUS_COMPLETED : _JLMS_HW_STATUS_INCOMPLETED; $image = $row_hw->hw_status ? 'btn_accept.png' : 'btn_cancel.png'; ?> <tr class="<?php echo JLMSCSS::_('sectiontableentry' . $k); ?> "> <td align="center"><?php echo $i + 1; ?> </td> <td align="left" valign="middle" style="vertical-align:middle "> <?php echo $row_hw->hw_name; ?> </td> <td valign="middle" style="vertical-align:middle "> <?php echo $row_hw->post_date; ?> </td> <td valign="middle" style="vertical-align:middle "> <?php echo $row_hw->end_date; ?> </td> <td align="left" valign="middle" style="vertical-align:middle; text-align:left; white-space:nowrap " nowrap="nowrap"> <?php echo '<img align="absmiddle" class="JLMS_png" src="' . $JLMS_CONFIG->get('live_site') . '/components/com_joomla_lms/lms_images/toolbar/' . $image . '" width="16" height="16" border="0" alt="' . $alt . '" />'; if ($row_hw->hw_status) { echo ' ' . JLMS_dateToDisplay($row_hw->hw_date, false, $JLMS_CONFIG->get('offset') * 60 * 60, ' H:i:s'); } ?> </td> </tr> <?php $k = 3 - $k; } ?> </table> <?php } elseif ($lists['page'] == 11 && $lists['filter_stu_val'] && isset($lists['page11_stats']) && !empty($lists['page11_stats'])) { ?> <br /><br /> <table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php echo JLMSCSS::_('jlmslist'); ?> "> <tr> <<?php echo JLMSCSS::tableheadertag(); ?> width="16" class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " align="center"> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> "><?php echo _JLMS_LPATH_TBL_HEAD_NAME; ?> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> "> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " width="1" colspan="2"> </<?php echo JLMSCSS::tableheadertag(); ?> > </tr> <?php $k = 1; for ($i = 0, $n = count($lists['page11_stats']); $i < $n; $i++) { $row_path = $lists['page11_stats'][$i]; $icon_img = "toolbar/tlb_lpath"; $icon_alt = "learnpath"; if ($row_path->c_id) { $icon_img = "toolbar/tlb_scorm"; $icon_alt = "scorm"; } ?> <tr class="<?php echo JLMSCSS::_('sectiontableentry' . $k); ?> "> <td valign="middle" align="center"> <span style="alignment:center; vertical-align:middle"> <img class='JLMS_png' src="<?php echo $JLMS_CONFIG->get('live_site'); ?> /components/com_joomla_lms/lms_images/<?php echo $icon_img; ?> .png" width='16' height='16' alt="<?php echo $icon_alt; ?> " /> </span> </td> <td valign="middle" align="left"> <?php echo $row_path->c_title; ?> </td> <?php $r_img = 'btn_cancel'; $r_sta = _JLMS_LPATH_STU_LPSTATUS_NOTCOMPLETED; $r_start = '-'; $r_end = '-'; if (!$row_path->c_id) { if (isset($row_path->published) && $row_path->published == 1) { $r_img = 'btn_accept'; $r_sta = _JLMS_LPATH_STU_LPSTATUS_COMPLETED; $r_start = $row_path->r_start ? JLMS_dateToDisplay($row_path->r_start, false, $JLMS_CONFIG->get('offset') * 60 * 60, '\\<\\b\\r \\/>H:i:s') : '-'; $r_end = $row_path->r_start ? JLMS_dateToDisplay($row_path->r_end, false, $JLMS_CONFIG->get('offset') * 60 * 60, '\\<\\b\\r \\/>H:i:s') : '-'; } elseif (isset($row_path->published) && $row_path->published == 0) { $r_img = 'btn_pending_cur'; $r_start = $row_path->r_start ? JLMS_dateToDisplay($row_path->r_start, false, $JLMS_CONFIG->get('offset') * 60 * 60, '\\<\\b\\r \\/>H:i:s') : '-'; } } else { if (isset($row_path->published) && $row_path->published == 1) { $r_img = 'btn_accept'; $r_sta = _JLMS_LPATH_STU_LPSTATUS_COMPLETED; $r_start = '-'; $r_end = '-'; } } ?> <td valign="middle" align="center"> <a style="border:0px;" href="<?php echo sefRelToAbs("index.php?option=" . $option . "&task=quizzes&id=" . $id . "&page=reports&quiz_id=" . $row_path->c_id . ""); ?> "><img class='JLMS_png' src="<?php echo $JLMS_CONFIG->get('live_site'); ?> /components/com_joomla_lms/lms_images/toolbar/btn_pending_cur.png" width='16' height='16' alt="<?php echo 'Report'; ?> " title="<?php echo 'Report'; ?> " border="0" /></a> </td> <td valign="middle" align="center" width="16"> <img class='JLMS_png' src="<?php echo $JLMS_CONFIG->get('live_site'); ?> /components/com_joomla_lms/lms_images/toolbar/<?php echo $r_img; ?> .png" width='16' height='16' alt="<?php echo $r_sta; ?> " title="<?php echo $r_sta; ?> " /> </td> <td valign="middle" align="center" nowrap="nowrap"> <?php echo $row_path->c_id ? isset($row_path->s_score) ? $row_path->s_score . _JLMS_GB_POINTS : ' ' : ' '; ?> </td> </tr> <?php $k = 3 - $k; } ?> </table> <?php } elseif ($lists['page'] == 11 && !$lists['filter_stu_val'] && isset($lists['page11_stats']) && !empty($lists['page11_stats'])) { ?> <script language="javascript" type="text/javascript"> <!--//--><![CDATA[//><!-- var block_stats = 0; var tID = ''; var url_prefix = '<?php echo $JLMS_CONFIG->get('live_site') . "/index.php?tmpl=component&option={$option}&Itemid={$Itemid}&id={$id}"; ?> '; function jlms_MakeRequest(url) { var http_request = false; if (window.XMLHttpRequest) { // Mozilla, Safari,... http_request = new XMLHttpRequest(); if (http_request.overrideMimeType) { http_request.overrideMimeType('text/xml'); } } else if (window.ActiveXObject) { // IE try { http_request = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { http_request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } if (!http_request) { return false; } http_request.onreadystatechange = function() { jlms_AnalizeRequest(http_request); }; http_request.open('GET', url_prefix + url, true); http_request.send(null); } function jlms_AnalizeRequest(http_request) { if (http_request.readyState == 4) { if ((http_request.status == 200)) { block_stats = 0; if(http_request.responseXML.documentElement == null){ try { http_request.responseXML.loadXML(http_request.responseText) } catch (e) { /*alert("Can't load");*/ } } response = http_request.responseXML.documentElement; var task = response.getElementsByTagName('task')[0].firstChild.data; switch (task) { case 'lpath_xml': var response_data = response.getElementsByTagName('stats_table')[0].firstChild.data; if (response_data && response_data != '' && response_data != ' ') { var sec_indx = gl_el.parentNode.sectionRowIndex; var table = gl_el.parentNode.parentNode; var row = table.insertRow(sec_indx + 1); var cell1 = document.createElement("td"); cell1.align = 'left'; cell1.colSpan = "4"; cell1.style.padding = '0px'; cell1.style.margin = '0px'; cell1.innerHTML = response_data; row.appendChild(cell1); } gl_el.innerHTML = "<img class='JLMS_png' src='<?php echo $JLMS_CONFIG->get('live_site'); ?> /components/com_joomla_lms/lms_images/toolbar/btn_accept.png' width='16' height='16' alt=\"done\" title=\"done\" />"; break; case 'scorm_progress_xml': var response_data = response.getElementsByTagName('stats_table')[0].firstChild.data; var res_user = response.getElementsByTagName('user_id')[0].firstChild.data; var res_lpsc = response.getElementsByTagName('quiz_id')[0].firstChild.data; if (response_data && response_data != '' && response_data != ' ') { gl_el_res = document.getElementById('quizid_'+res_lpsc); if (gl_el_res) { gl_el_res.innerHTML = response_data; } } break; } } else { } } } var gl_el = ''; function jlms_RequestQuiz_stats( lp_id, element ) { if (block_stats == 0) { block_stats = 1; gl_el = element.parentNode; jlms_MakeRequest('&task=get_quiz_stats&quiz_id='+lp_id); gl_el.innerHTML = "<img src='<?php echo $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('ajax_settings_small_indicator'); ?> ' width='16' height='16' alt=\"loading\" title=\"loading\" />"; } } JLMS_preloadImages('<?php echo $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('ajax_settings_small_indicator'); ?> ', '<?php echo $JLMS_CONFIG->get('live_site'); ?> /components/com_joomla_lms/lms_images/toolbar/btn_accept.png', 'components/com_joomla_lms/lms_images/toolbar/btn_cancel.png'); //--><!]]> </script> <table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php echo JLMSCSS::_('jlmslist'); ?> "> <tr> <<?php echo JLMSCSS::tableheadertag(); ?> width="16" class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " align="center"> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> width="16" class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " align="center"> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " ><?php echo _JLMS_LPATH_TBL_HEAD_NAME; ?> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> "> </<?php echo JLMSCSS::tableheadertag(); ?> > </tr> <?php $k = 1; for ($i = 0, $n = count($lists['page11_stats']); $i < $n; $i++) { $row_path = $lists['page11_stats'][$i]; $icon_img = "toolbar/tlb_lpath"; $icon_alt = "learnpath"; if ($row_path->c_id) { $icon_img = "toolbar/tlb_quiz"; $icon_alt = "scorm"; } ?> <tr class="<?php echo JLMSCSS::_('sectiontableentry' . $k); ?> "> <td valign="middle" align="center"> <span style="alignment:center; vertical-align:middle; cursor:pointer" onclick="jlms_RequestQuiz_stats(<?php echo $row_path->c_id; ?> , this);"> <img class='JLMS_png' src="<?php echo $JLMS_CONFIG->get('live_site'); ?> /components/com_joomla_lms/lms_images/toolbar/btn_pending_cur.png" width='16' height='16' alt="<?php echo _JLMS_TRACK_VIEW_DETAILS; ?> " title="<?php echo _JLMS_TRACK_VIEW_DETAILS; ?> " /> </span> </td> <td valign="middle" align="center"> <span style="alignment:center; vertical-align:middle"> <img class='JLMS_png' src="<?php echo $JLMS_CONFIG->get('live_site'); ?> /components/com_joomla_lms/lms_images/<?php echo $icon_img; ?> .png" width='16' height='16' alt="<?php echo $icon_alt; ?> " /> </span> </td> <td valign="middle" align="left"> <?php echo $row_path->c_title; ?> </td> <td valign="middle" align="center"> <a class="jlms_img_link" style="border:0px;" href="<?php echo sefRelToAbs("index.php?option=" . $option . "&task=quizzes&id=" . $id . "&page=reports&quiz_id=" . $row_path->c_id . ""); ?> "><img class='JLMS_png' src="<?php echo $JLMS_CONFIG->get('live_site'); ?> /components/com_joomla_lms/lms_images/toolbar/btn_pending_cur.png" width='16' height='16' alt="<?php echo 'Report'; ?> " title="<?php echo 'Report'; ?> " border="0" /></a> </td> </tr> <?php $k = 3 - $k; } ?> </table> <?php } ?> <input type="hidden" name="option" value="<?php echo $option; ?> " /> <input type="hidden" name="Itemid" value="<?php echo $Itemid; ?> " /> <input type="hidden" name="task" value="tracking" /> <input type="hidden" name="id" value="<?php echo $id; ?> " /> <input type="hidden" name="page" value="<?php echo $lists['page']; ?> " /> <input type="hidden" name="view" value="" /> </form> <?php JLMS_TMPL::CloseTS(); JLMS_TMPL::CloseMT(); }
function JLMS_statsHW($id, $option) { $JLMS_CONFIG =& JLMSFactory::getConfig(); $JLMS_SESSION =& JLMSFactory::getSession(); $Itemid = $JLMS_CONFIG->get('Itemid'); $db =& JFactory::getDbo(); $user = JLMSFactory::getUser(); $my_id = $user->get('id'); $JLMS_ACL =& JLMSFactory::getACL(); $course_id = intval(mosGetParam($_REQUEST, 'course_id', 0)); $hw_id = intval(mosGetParam($_REQUEST, 'hw_id', 0)); $id = $hw_id ? $hw_id : $id; $usertype = JLMS_GetUserType($my_id, $course_id); // if ( $course_id && ($usertype == 1 || $usertype == 6) && ($id && (JLMS_GetHWCourse($id) == $course_id)) ) { if ($course_id && ($JLMS_ACL->CheckPermissions('homework', 'view_stats') && !$JLMS_ACL->isStaff() || $JLMS_ACL->CheckPermissions('homework', 'view_stats') && $JLMS_ACL->isStaff()) && ($id && JLMS_GetHWCourse($id) == $course_id)) { $limit = intval(mosGetParam($_GET, 'limit', $JLMS_SESSION->get('list_limit', $JLMS_CONFIG->get('list_limit')))); $JLMS_SESSION->set('list_limit', $limit); if ($usertype == 1 || $JLMS_ACL->isStaff()) { $filt_hw = intval(mosGetParam($_GET, 'filt_hw', $JLMS_SESSION->get('filt_hw', 2))); $filt_group = intval(mosGetParam($_GET, 'filt_group', $JLMS_SESSION->get('filt_group', 0))); $filt_subgroup = intval(mosGetParam($_GET, 'filt_subgroup', $JLMS_SESSION->get('filt_subgroup', 0))); $filter_stu = intval(mosGetParam($_REQUEST, 'filter_stu', $JLMS_SESSION->get('filter_stu_h', 0))); if ($JLMS_ACL->isStaff()) { $filt_group = 0; $filt_subgroup = 0; $filter_stu = 0; } } else { $filt_hw = 0; $filt_group = 0; $filt_subgroup = 0; $filter_stu = 0; } $JLMS_SESSION->set('filt_hw', $filt_hw); if ($filt_group != $JLMS_SESSION->get('filt_group', 0)) { $filter_stu = 0; } if (!$filt_group) { $filt_subgroup = 0; } $JLMS_SESSION->set('filt_group', $filt_group); $JLMS_SESSION->set('filt_subgroup', $filt_subgroup); $JLMS_SESSION->set('filter_stu_h', $filter_stu); $limitstart = intval(mosGetParam($_GET, 'limitstart', $JLMS_SESSION->get('limitstart_hw', 0))); $JLMS_SESSION->set('limitstart_hw', $limitstart); $query = "SELECT * FROM #__lms_homework WHERE id = '" . $id . "'" . ($JLMS_ACL->CheckPermissions('homework', 'view_all') ? '' : "\n AND published = 1"); $db->SetQuery($query); $hw_info = $db->LoadObjectList(); $members = "'0'"; $groups_where_admin_manager = "'0'"; //TODO: where is _role_type == 5 for assistants ??? //TODO: where is CEO? they are limited to assigned groups !!! //if($JLMS_ACL->_role_type == 2 || $JLMS_ACL->_role_type == 4 || $JLMS_ACL->_role_type == 5) { // teacher or admin if ($JLMS_ACL->CheckPermissions('advanced', 'assigned_groups_only')) { // limited stats for organization admins/teachers $groups_where_admin_manager = JLMS_ACL_HELPER::GetAssignedGroups($my_id, $course_id); if (count($groups_where_admin_manager)) { if (JLMS_ACL_HELPER::GetCountAssignedGroups($my_id, $course_id) == 1) { $filt_group = $groups_where_admin_manager[0]; if ($JLMS_ACL->isStaff()) { $filt_group = 0; } } } if (count($groups_where_admin_manager)) { $groups_where_admin_manager = implode(',', $groups_where_admin_manager); if ($groups_where_admin_manager != '') { $query = "SELECT user_id FROM #__lms_users_in_global_groups WHERE (group_id IN ({$groups_where_admin_manager}) OR subgroup1_id IN ({$groups_where_admin_manager})) AND user_id > 0" . ($filt_group ? "\n AND group_id = '" . $filt_group . "'" : '') . ($filt_subgroup ? "\n AND subgroup1_id = '" . $filt_subgroup . "'" : ''); $db->setQuery($query); $members = $db->loadResultArray(); //$members = implode(',', $members); //if($members == '') { // $members = "'0'"; //} } $users_where_ceo_parent = array(); if ($JLMS_ACL->_role_type == 3) { $query = "SELECT user_id FROM `#__lms_user_parents` WHERE parent_id = '" . $my_id . "'"; $db->setQuery($query); $users_where_ceo_parent = $db->loadResultArray(); //$members = array_merge($members, $users_where_ceo_parent); } if ($members != "'0'" && count($users_where_ceo_parent)) { $members = array_merge($members, $users_where_ceo_parent); } elseif (count($users_where_ceo_parent)) { $members = $users_where_ceo_parent; } $members = implode(',', $members); if ($members == '') { $members = "'0'"; } } else { $groups_where_admin_manager = "'0'"; } } //} if ($JLMS_ACL->isStaff() && $JLMS_ACL->CheckPermissions('homework', 'view_stats')) { //ceo $staff_learners = $JLMS_ACL->_role_type == 3 && isset($JLMS_ACL->_staff_learners) ? $JLMS_ACL->_staff_learners : array(); $str_staff_learners = implode(",", $staff_learners); //NOTE: $filt_group is always == 0 for Staffs, also they don't have a filter by group - therefore we can use the same query for both 'global' and 'local' groups modes //if($JLMS_CONFIG->get('use_global_groups', 1)){ $query = "SELECT count(u.id)" . "\n FROM (#__users as u, #__lms_homework as d) LEFT JOIN #__lms_homework_results as c ON c.hw_id = d.id AND c.user_id = u.id, #__lms_users_in_groups as a" . ($filt_group ? "\n, #__lms_users_in_global_groups as uigg, #__lms_usergroups AS b" : '') . "\n WHERE d.id = '" . $id . "' AND a.user_id = u.id AND a.course_id = " . $course_id . "\n AND u.id IN (" . $str_staff_learners . ")" . ($filt_group ? "\n AND uigg.group_id = '" . $filt_group . "' AND a.group_id = uigg.group_id AND b.id = uigg.group_id AND b.course_id = 0" : '') . ($filter_stu ? "\n AND u.id = '" . $filter_stu . "'" : '') . ($filt_hw ? $filt_hw == 2 ? "\n AND c.hw_status = 1" : ($filt_hw == 1 ? " AND (c.hw_status IS NULL OR c.hw_status <> 1)" : "") : '') . ($JLMS_ACL->CheckPermissions('homework', 'view_all') ? '' : "\n AND d.published = 1"); /*} else { $query = "SELECT count(u.id)" . "\n FROM #__lms_homework as d, #__users as u, #__lms_user_parents as p, #__lms_homework_results as c, #__lms_users_in_groups as a" . "\n WHERE d.id = '".$id."' AND c.hw_id = d.id AND c.user_id = u.id AND u.id = p.user_id AND p.parent_id = '".$my_id."' AND a.user_id = u.id AND a.course_id = ".$course_id . ($filt_group ? ("\n AND a.group_id = '".$filt_group."'") : '') . ($filter_stu ? ("\n AND u.id = '".$filter_stu."'") : '') . ($filt_hw ? ( ($filt_hw == 2) ? "\n AND c.hw_status = 1" : (($filt_hw == 1)?" AND (c.hw_status IS NULL OR c.hw_status <> 1)":"")) : '') . (($JLMS_ACL->CheckPermissions('homework', 'view_all')) ? '' : "\n AND d.published = 1") ; }*/ } elseif ($JLMS_ACL->CheckPermissions('homework', 'view_stats')) { //teacher or admin if ($JLMS_CONFIG->get('use_global_groups', 1)) { $query = "SELECT count(u.id)" . "\n FROM (#__users as u, #__lms_homework as d) LEFT JOIN #__lms_homework_results as c ON c.hw_id = d.id AND c.user_id = u.id, #__lms_users_in_groups as a " . ($filt_group ? "\n, #__lms_users_in_global_groups as uigg, #__lms_usergroups AS b" : '') . "\n WHERE d.id = '" . $id . "' AND a.user_id = u.id AND a.course_id = " . $course_id . ($filt_group ? "\n AND uigg.group_id = '" . $filt_group . "' AND a.group_id = uigg.group_id AND b.id = uigg.group_id AND b.course_id = 0" : '') . ($filter_stu ? "\n AND u.id = '" . $filter_stu . "'" : '') . ($filt_hw ? $filt_hw == 2 ? "\n AND c.hw_status = 1" : ($filt_hw == 1 ? " AND (c.hw_status IS NULL OR c.hw_status <> 1)" : "") : '') . ($JLMS_ACL->CheckPermissions('advanced', 'assigned_groups_only') ? "\n AND u.id IN ({$members})" : '') . ($JLMS_ACL->CheckPermissions('homework', 'view_all') ? '' : "\n AND d.published = 1"); } else { //TODO: fix this query ! $query = "SELECT count(u.id)" . "\n FROM #__lms_homework as d, #__users as u, #__lms_homework_results as c, #__lms_users_in_groups as a" . "\n WHERE d.id = '" . $id . "' AND c.hw_id = d.id AND c.user_id = u.id AND a.user_id = u.id AND a.course_id = " . $course_id . ($filt_group ? "\n AND a.group_id = '" . $filt_group . "'" : '') . ($filter_stu ? "\n AND u.id = '" . $filter_stu . "'" : '') . ($filt_hw ? $filt_hw == 2 ? "\n AND c.hw_status = 1" : ($filt_hw == 1 ? " AND (c.hw_status IS NULL OR c.hw_status <> 1)" : "") : '') . ($JLMS_ACL->CheckPermissions('homework', 'view_all') ? '' : "\n AND d.published = 1"); } } else { $query = ''; } $db->SetQuery($query); $total = $db->LoadResult(); require_once _JOOMLMS_FRONT_HOME . DS . "includes" . DS . "classes" . DS . "lms.pagination.php"; $pageNav = new JLMSPageNav($total, $limitstart, $limit); if ($JLMS_ACL->isStaff() && $JLMS_ACL->CheckPermissions('homework', 'view_stats')) { // ceo //NOTE: $filt_group is always == 0 for Staffs, also they don't have a filter by group - therefore we can use the same query for both 'global' and 'local' groups modes //if($JLMS_CONFIG->get('use_global_groups', 1)){ $staff_learners = $JLMS_ACL->_role_type == 3 && isset($JLMS_ACL->_staff_learners) ? $JLMS_ACL->_staff_learners : array(); $str_staff_learners = implode(",", $staff_learners); $query = "SELECT u.id AS user_id, u.username, u.name, u.email, c.hw_status, c.hw_date, c.grade, d.graded_activity" . ($filt_group ? ", b.ug_name" : '') . "\n FROM (#__lms_homework as d, #__users as u) LEFT JOIN #__lms_homework_results as c ON c.hw_id = d.id AND c.user_id = u.id, #__lms_users_in_groups as a" . ($filt_group ? "\n, #__lms_users_in_global_groups as uigg, #__lms_usergroups AS b" : '') . "\n WHERE d.id = '" . $id . "' AND a.user_id = u.id AND a.course_id = " . $course_id . "\n AND u.id IN (" . $str_staff_learners . ")" . ($filt_group ? "\n AND uigg.group_id = '" . $filt_group . "' AND a.group_id = uigg.group_id AND b.id = uigg.group_id AND b.course_id = 0" : '') . ($filter_stu ? "\n AND u.id = '" . $filter_stu . "'" : '') . ($filt_hw ? $filt_hw == 2 ? "\n AND c.hw_status = 1" : ($filt_hw == 1 ? " AND (c.hw_status IS NULL OR c.hw_status <> 1)" : "") : '') . ($JLMS_ACL->CheckPermissions('homework', 'view_all') ? '' : "\n AND d.published = 1") . "\n LIMIT {$pageNav->limitstart}, {$pageNav->limit}"; /*} else { $query = "SELECT u.id AS user_id, u.username, u.name, u.email, c.hw_status, c.hw_date, c.grade, d.graded_activity" . ($filt_group ? (", b.ug_name") : '') . "\n FROM #__lms_homework as d, #__users as u, #__lms_user_parents as p, #__lms_homework_results as c, #__lms_users_in_groups as a, #__lms_usergroups AS b" . "\n WHERE d.id = '".$id."' AND c.hw_id = d.id AND c.user_id = u.id AND u.id = p.user_id AND p.parent_id = '".$my_id."' AND a.user_id = u.id AND b.id = a.group_id AND a.course_id = ".$course_id . ($filt_group ? ("\n AND a.group_id = '".$filt_group."'") : '') . ($filter_stu ? ("\n AND u.id = '".$filter_stu."'") : '') . ($filt_hw ? ( ($filt_hw == 2) ? "\n AND c.hw_status = 1" : (($filt_hw == 1)?" AND (c.hw_status IS NULL OR c.hw_status <> 1)":"")) : '') . (($JLMS_ACL->CheckPermissions('homework', 'view_all')) ? '' : "\n AND d.published = 1") . "\n LIMIT $pageNav->limitstart, $pageNav->limit"; ; }*/ } elseif ($JLMS_ACL->CheckPermissions('homework', 'view_stats')) { //teacher or admin or assistant if ($JLMS_CONFIG->get('use_global_groups', 1)) { $query = "SELECT u.id AS user_id, u.username, u.name, u.email, c.hw_status, c.hw_date, c.grade, d.graded_activity" . ($filt_group ? ", b.ug_name" : '') . "\n FROM (#__lms_homework as d, #__users as u) LEFT JOIN #__lms_homework_results as c ON c.hw_id = d.id AND c.user_id = u.id, #__lms_users_in_groups as a" . ($filt_group ? "\n, #__lms_users_in_global_groups as uigg, #__lms_usergroups AS b" : '') . "\n WHERE d.id = '" . $id . "' AND a.user_id = u.id AND a.course_id=" . $course_id . ($filt_group ? "\n AND uigg.group_id = '" . $filt_group . "' AND a.group_id = uigg.group_id AND b.id = uigg.group_id AND b.course_id = 0" : '') . ($filter_stu ? "\n AND u.id = '" . $filter_stu . "'" : '') . ($filt_hw ? $filt_hw == 2 ? "\n AND c.hw_status = 1" : ($filt_hw == 1 ? " AND (c.hw_status IS NULL OR c.hw_status <> 1)" : "") : '') . ($JLMS_ACL->CheckPermissions('advanced', 'assigned_groups_only') ? "\n AND u.id IN ({$members})" : '') . ($JLMS_ACL->CheckPermissions('homework', 'view_all') ? '' : "\n AND d.published = 1") . "\n LIMIT {$pageNav->limitstart}, {$pageNav->limit}"; } else { $query = "SELECT u.id AS user_id, u.username, u.name, u.email, c.hw_status, c.hw_date, c.grade, d.graded_activity" . ($filt_group ? ", b.ug_name" : '') . "\n FROM #__lms_homework as d, #__users as u, #__lms_homework_results as c, #__lms_users_in_groups as a" . ($filt_group ? ", " . "\n #__lms_usergroups AS b" : '') . "\n WHERE d.id = '" . $id . "' AND c.hw_id = d.id AND c.user_id = u.id AND a.user_id = u.id " . ($filt_group ? "\n AND b.id = a.group_id " : '') . "\n AND a.course_id = " . $course_id . ($filt_group ? "\n AND a.group_id = '" . $filt_group . "'" : '') . ($filter_stu ? "\n AND u.id = '" . $filter_stu . "'" : '') . ($filt_hw ? $filt_hw == 2 ? "\n AND c.hw_status = 1" : ($filt_hw == 1 ? " AND (c.hw_status IS NULL OR c.hw_status <> 1)" : "") : '') . ($JLMS_ACL->CheckPermissions('homework', 'view_all') ? '' : "\n AND d.published = 1") . "\n LIMIT {$pageNav->limitstart}, {$pageNav->limit}"; } } else { $query = ''; } $db->SetQuery($query); $hw_stats = $db->LoadObjectList(); if (!$filt_group) { if ($JLMS_CONFIG->get('use_global_groups', 1)) { $query = "SELECT ug.ug_name, uig.user_id \n\t\t\t\t\t\t\t\tFROM #__lms_users_in_global_groups AS uigg, #__lms_users_in_groups AS uig, #__lms_usergroups AS ug \n\t\t\t\t\t\t\t\tWHERE uigg.group_id = ug.id AND uig.group_id = uigg.group_id AND uig.course_id = " . $course_id . ($JLMS_ACL->CheckPermissions('advanced', 'assigned_groups_only') ? "\n AND uig.group_id IN ({$groups_where_admin_manager})" : ''); } else { $query = "SELECT ug.ug_name, uig.user_id \n\t\t\t\t\t\t\t\tFROM #__lms_users_in_groups AS uig, #__lms_usergroups AS ug \n\t\t\t\t\t\t\t\tWHERE uig.group_id = ug.id AND uig.course_id = " . $course_id; } $db->setQuery($query); $ug_names = $db->LoadObjectList(); for ($i = 0; $i < count($hw_stats); $i++) { $hw_stats[$i]->ug_name = ''; foreach ($ug_names as $ug_name) { if ($ug_name->user_id == $hw_stats[$i]->user_id) { if ($hw_stats[$i]->ug_name) { $hw_stats[$i]->ug_name .= ', ' . $ug_name->ug_name; } else { $hw_stats[$i]->ug_name = $ug_name->ug_name; } } } } } $lists = array(); $f_items = array(); $f_items[] = mosHTML::makeOption(0, _JLMS_HW_FILTER_ALL_RESULTS); $f_items[] = mosHTML::makeOption(2, _JLMS_HW_STATUS_COMPLETED); $f_items[] = mosHTML::makeOption(1, _JLMS_HW_STATUS_INCOMPLETE); $link = "index.php?option={$option}&Itemid={$Itemid}&task=hw_stats&course_id={$course_id}&id={$id}"; $link = $link . "&filt_hw='+this.options[selectedIndex].value+'"; $link = sefRelToAbs($link); $link = str_replace('%5C%27', "'", $link); $link = str_replace('%5B', "[", $link); $link = str_replace('%5D', "]", $link); $link = str_replace('%20', "+", $link); $link = str_replace("\\\\\\", "", $link); $link = str_replace('%27', "'", $link); $lists['filter'] = mosHTML::selectList($f_items, 'filt_hw', 'class="inputbox" size="1" onchange="document.location.href=\'' . $link . '\';"', 'value', 'text', $filt_hw); $g_items = array(); $g_items[] = mosHTML::makeOption(0, _JLMS_HW_FILTER_ALL_GROUPS); if ($JLMS_CONFIG->get('use_global_groups', 1)) { if ($JLMS_ACL->_role_type == 2 || $JLMS_ACL->_role_type == 4) { $query = "SELECT distinct a.id as value, a.ug_name as text" . "\n FROM #__lms_usergroups as a" . "\n WHERE a.course_id = 0" . "\n AND a.parent_id = 0" . ($JLMS_ACL->CheckPermissions('advanced', 'assigned_groups_only') ? "\n AND a.id IN ({$groups_where_admin_manager})" : '') . "\n ORDER BY a.ug_name"; } else { //TODO: bug! CEO cann't see all the groups available in the system $query = "SELECT distinct a.id as value, a.ug_name as text" . "\n FROM #__lms_usergroups as a" . "\n WHERE a.course_id = 0" . "\n AND a.parent_id = 0" . "\n ORDER BY a.ug_name"; } } else { $query = "SELECT distinct a.id as value, a.ug_name as text FROM #__lms_usergroups as a, #__lms_users_in_groups as b" . "\n WHERE a.course_id = '" . $course_id . "' AND b.group_id = a.id ORDER BY a.ug_name"; } $db->SetQuery($query); $groups = $db->LoadObjectList(); $g_items = array_merge($g_items, $groups); $link = "index.php?option={$option}&Itemid={$Itemid}&task=hw_stats&course_id={$course_id}&id={$id}"; $link = $link . "&filt_group='+this.options[selectedIndex].value+'"; $link = sefRelToAbs($link); $link = str_replace('%5C%27', "'", $link); $link = str_replace('%5B', "[", $link); $link = str_replace('%5D', "]", $link); $link = str_replace('%20', "+", $link); $link = str_replace("\\\\\\", "", $link); $link = str_replace('%27', "'", $link); $lists['filter2'] = mosHTML::selectList($g_items, 'filt_group', 'class="inputbox" style="width:250px;" size="1" onchange="document.location.href=\'' . $link . '\';"', 'value', 'text', $filt_group); if ($filt_group) { $g_items = array(); $g_items[] = mosHTML::makeOption(0, _JLMS_FILTER_ALL_SUBGROUPS); if (($JLMS_ACL->_role_type == 2 || $JLMS_ACL->_role_type == 4) && $JLMS_CONFIG->get('use_global_groups', 1)) { $query = "SELECT distinct a.id as value, a.ug_name as text" . "\n FROM #__lms_usergroups as a" . "\n WHERE a.course_id = 0" . "\n AND a.parent_id = {$filt_group}" . ($JLMS_ACL->CheckPermissions('advanced', 'assigned_groups_only') ? "\n AND a.parent_id IN ({$groups_where_admin_manager})" : '') . "\n ORDER BY a.ug_name"; $db->SetQuery($query); $sbugroups = $db->LoadObjectList(); if (count($sbugroups)) { $g_items = array_merge($g_items, $sbugroups); $link = "index.php?option={$option}&Itemid={$Itemid}&task=hw_stats&course_id={$course_id}&id={$id}"; $link = $link . "&filt_group=" . $filt_group . "&filt_subgroup='+this.options[selectedIndex].value+'"; $link = sefRelToAbs($link); $link = str_replace('%5C%27', "'", $link); $link = str_replace('%5B', "[", $link); $link = str_replace('%5D', "]", $link); $link = str_replace('%20', "+", $link); $link = str_replace("\\\\\\", "", $link); $link = str_replace('%27', "'", $link); $lists['filter3'] = mosHTML::selectList($g_items, 'filt_subgroup', 'class="inputbox" style="width:250px;" size="1" onchange="document.location.href=\'' . $link . '\';"', 'value', 'text', $filt_subgroup); } } } $r = new stdClass(); $r->id = 0; $r->username = _JLMS_SB_ALL_USERS; $r->name = ''; $r->email = ''; $r->ug_name = ''; $students[] = $r; $students = array_merge($students, JLMS_getCourseStudentsList2($course_id, $filt_group)); // $students = array_merge($students, JLMS_getCourseStudentsList($course_id, $filt_group)); $link = "index.php?option={$option}&Itemid={$Itemid}&task=hw_stats&course_id={$course_id}&id={$id}"; $link = $link . "&filter_stu='+this.options[selectedIndex].value+'"; $link = sefRelToAbs($link); $link = str_replace('%5C%27', "'", $link); $link = str_replace('%5B', "[", $link); $link = str_replace('%5D', "]", $link); $link = str_replace('%20', "+", $link); $link = str_replace("\\\\\\", "", $link); $link = str_replace('%27', "'", $link); $lists['filter_stu'] = mosHTML::selectList($students, 'filter_stu', 'class="inputbox" style="width:250px;" size="1" onchange="document.location.href=\'' . $link . '\';"', 'id', 'username', $filter_stu); $lms_titles_cache =& JLMSFactory::getTitles(); $lms_titles_cache->setArray('users', $hw_stats, 'user_id', 'username'); JLMS_homework_html::statsHW($hw_stats, $hw_info[0], $option, $course_id, $pageNav, $lists, $JLMS_ACL->CheckPermissions('homework', 'view_stats')); } else { JLMSRedirect(sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=homework&id={$course_id}")); } }