function calendar($value, $name, $id, $format = null, $attribs = null, $type = 'selectlist') { global $JLMS_CONFIG; JHTML::_('behavior.calendar'); //load the calendar behavior if (is_null($format)) { $format = '%Y-%m-%d'; } $suffix = ''; $jsSuffix = ''; $showsTime = false; if (strpos($format, '%H') !== false) { $suffix = ' H:i'; $jsSuffix = ' %H:%M'; $showsTime = true; } $value = JLMS_dateToDisplay($value, $is_time = false, $offset = 0, $suffix); $jsFormat = strtr(JLMS_dateGetFormat(2), array('d' => '%d', 'm' => '%m', 'Y' => '%Y')) . $jsSuffix; switch ($type) { case 'statictext': JLMS_HTMLCalendar::_dateLoadJSFramework($jsFormat, false, $showsTime); echo '<div style="white-space: nowrap;"><span style="vertical-align:middle" onclick="jlms_showCalendar' . JLMS_HTMLCalendar::getKey($jsFormat) . '(\'' . $id . '_date\', \'' . $name . '\');"><img src="' . $JLMS_CONFIG->get('live_site') . '/components/com_joomla_lms/lms_images/agenda/ag_date.png" width="16" height="16" alt="calendar" border="0" style="cursor:pointer " class="JLMS_png" /></span> <input class="inputbox" style="text-align:center; background:transparent; border:0px solid; font-size:12px; font-weight:bold; line-height:14px;" type="text" name="' . $name . '_date" id="' . $id . '_date" size="9" maxlength="10" value="' . $value . '" /></div>'; break; default: JLMS_HTMLCalendar::_dateLoadJSFramework($jsFormat, true, $showsTime); echo JLMS_HTMLCalendar::_dateGenerateSelectLists($name, $value, $format); echo '<span style="vertical-align:middle" onclick="jlms_showCalendar' . JLMS_HTMLCalendar::getKey($jsFormat) . '(\'' . $id . '_date\', \'' . $name . '\');"><img src="' . $JLMS_CONFIG->get('live_site') . '/components/com_joomla_lms/lms_images/agenda/ag_date.png" width="16" height="16" alt="calendar" border="0" style="cursor:pointer " class="JLMS_png" /></span> <input class="inputbox" style="visibility:hidden" type="text" name="' . $name . '_date" id="' . $id . '_date" size="1" maxlength="10" value="' . $value . '" />'; break; } }
function showCourseLPaths($course_id, $option, &$lpaths) { global $Itemid, $my, $JLMS_DB, $JLMS_CONFIG; $JLMS_ACL =& JLMSFactory::getACL(); ?> <script language="javascript" type="text/javascript"> <!-- function submitbutton(pressbutton) { var form = document.adminForm; if ( ((pressbutton == 'edit_lpath') || (pressbutton == 'lpath_delete') ) && (form.boxchecked.value == "0")) { alert('<?php echo _JLMS_ALERT_SELECT_ITEM; ?> '); } else { if( pressbutton == 'lpath_delete' ) { if (confirm('<?php echo _JLMS_ALERT_DELETE_ITEM; ?> ')) { form.task.value = pressbutton; form.submit(); } } else { form.task.value = pressbutton; form.submit(); } } } function submitbutton_order(pressbutton, item_id) { var form = document.adminForm; if ((pressbutton == 'lpath_orderup') || (pressbutton == 'lpath_orderdown')){ if (item_id) { form.task.value = pressbutton; form.row_id.value = item_id; form.submit(); } } } function submitbutton_change(pressbutton, state) { var form = document.adminForm; if (pressbutton == 'change_lpath'){ if (form.boxchecked.value == 0 || form.boxchecked.value == "0") { alert('<?php echo _JLMS_ALERT_SELECT_ITEM; ?> '); } else { form.task.value = pressbutton; form.state.value = state; form.submit(); } } } function submitbutton_change2(pressbutton, state, cid_id) { var form = document.adminForm; if (pressbutton == 'change_lpath'){ form.task.value = pressbutton; form.state.value = state; form.cid2.value = cid_id; form.submit(); } } function submitbutton_allorder(n) { var form = document.adminForm; for ( var j = 0; j <= n; j++ ) { box = eval( "document.adminForm.cb" + j ); if ( box ) { if ( box.checked == false ) { box.checked = true; } } } form.task.value = 'lpath_saveorederall'; form.submit(); } //--> </script> <?php JLMS_TMPL::OpenMT(); $hparams = array(); JLMS_TMPL::ShowHeader('lpath', _JLMS_LPATH_TITLE, $hparams); JLMS_TMPL::OpenTS(); //temporary check for number of items $num_items = 0; $there_were_squeezeboxes = false; for ($i = 0, $n = count($lpaths); $i < $n; $i++) { $row_path = $lpaths[$i]; $is_hidden = false; if ($row_path->item_id) { $tmp_params = new JLMSParameters($row_path->lp_params); if ($tmp_params->get('hide_in_list', 0) == 1) { $is_hidden = true; } } if ($JLMS_ACL->CheckPermissions('lpaths', 'manage')) { $task = 'compose_lpath'; $title = _JLMS_LPATH_LINK_TITLE_COMPOSE; } elseif ($JLMS_ACL->CheckPermissions('lpaths', 'view')) { $task = 'show_lpath'; $title = _JLMS_LPATH_LINK_TITLE_VIEW; if ($is_hidden) { continue; } } if (isset($row_path->is_hidden) && $row_path->is_hidden && !$JLMS_ACL->CheckPermissions('lpaths', 'view_all')) { continue; } $num_items++; } ?> <form action="<?php echo $JLMS_CONFIG->getCfg('live_site') . "/index.php?option={$option}&Itemid={$Itemid}"; ?> " method="post" name="adminForm"> <?php if ($num_items) { ?> <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 if ($JLMS_ACL->CheckPermissions('lpaths', 'manage') || $JLMS_ACL->CheckPermissions('lpaths', 'publish')) { ?> <<?php echo JLMSCSS::tableheadertag(); ?> width="25" class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " align="center"><input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count($lpaths); ?> );" /></<?php echo JLMSCSS::tableheadertag(); ?> > <?php } ?> <<?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'); ?> "><?php echo _JLMS_LPATH_TBL_HEAD_NAME; ?> </<?php echo JLMSCSS::tableheadertag(); ?> > <?php if ($JLMS_ACL->CheckPermissions('lpaths', 'publish')) { ?> <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " width="1"> </<?php echo JLMSCSS::tableheadertag(); ?> > <?php } ?> <?php if ($JLMS_ACL->CheckPermissions('lpaths', 'order')) { ?> <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " width="1"> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " width="1"> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " width="1"><?php echo _JLMS_REORDER; ?> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " width="1"><a class="jlms_img_link" href="javascript:submitbutton_allorder(<?php echo count($lpaths) - 1; ?> )"><img width="16" height="16" border="0" title="<?php echo _JLMS_SAVEORDER; ?> " alt="<?php echo _JLMS_SAVEORDER; ?> " src="<?php echo $JLMS_CONFIG->get('live_site'); ?> /components/com_joomla_lms/lms_images/filesave.png"/></a></<?php echo JLMSCSS::tableheadertag(); ?> > <?php } ?> <?php if ($JLMS_ACL->CheckPermissions('lpaths', 'manage')) { ?> <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " width="1"> </<?php echo JLMSCSS::tableheadertag(); ?> > <?php } ?> <?php if (!$JLMS_ACL->CheckPermissions('lpaths', 'manage')) { ?> <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " width="1"> </<?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(); ?> > <?php } ?> <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> "><?php echo _JLMS_LPATH_TBL_HEAD_DESCR; ?> </<?php echo JLMSCSS::tableheadertag(); ?> > </tr> <?php $k = 1; $i_counter = 0; for ($i = 0, $n = count($lpaths); $i < $n; $i++) { $row_path = $lpaths[$i]; $is_hidden = false; $is_squeezebox = false; if ($row_path->item_id) { $tmp_params = new JLMSParameters($row_path->lp_params); if ($tmp_params->get('hide_in_list', 0) == 1) { $is_hidden = true; } if (isset($row_path->scorm_params)) { $tmp_params2 = new JLMSParameters($row_path->scorm_params); if ($tmp_params2->get('scorm_layout', 0) == 1) { $is_squeezebox = true; $there_were_squeezeboxes = true; } } } $manage_item = false; if ($JLMS_ACL->CheckPermissions('lpaths', 'manage')) { $manage_item = true; } if ($JLMS_ACL->CheckPermissions('lpaths', 'only_own_items') && $row_path->owner_id != $my->id) { $manage_item = false; } elseif ($JLMS_ACL->CheckPermissions('lpaths', 'only_own_role') && $JLMS_ACL->GetRole() != $JLMS_ACL->UserSystemRole($JLMS_DB, $row_path->owner_id)) { $manage_item = false; } if ($manage_item) { $task = 'compose_lpath'; $title = _JLMS_LPATH_LINK_TITLE_COMPOSE; } elseif ($JLMS_ACL->CheckPermissions('lpaths', 'view')) { $task = 'show_lpath'; $title = _JLMS_LPATH_LINK_TITLE_VIEW; if ($is_hidden && !$JLMS_ACL->CheckPermissions('lpaths', 'view_all')) { continue; } } if (isset($row_path->is_hidden) && $row_path->is_hidden && !$JLMS_ACL->CheckPermissions('lpaths', 'view_all')) { continue; } $link = "index.php?option=" . $option . "&Itemid=" . $Itemid . "&task=" . $task . "&course_id=" . $course_id . "&id=" . $row_path->id; // sefRelToAbs() - est' nige $icon_img = "toolbar/tlb_lpath"; $icon_alt = "learnpath"; if ($row_path->item_id) { $title = _JLMS_LPATH_LINK_TITLE_SCORM; //$link = "index.php?option=".$option."&Itemid=".$Itemid."&task=player_scorm&course_id=".$course_id."&id=".$row_path->item_id."&lp_type=".$row_path->lp_type; $link = "index.php?option=" . $option . "&Itemid=" . $Itemid . "&task=show_lpath&course_id=" . $course_id . "&id=" . $row_path->id; //."&lp_type=".$row_path->lp_type; $icon_img = "toolbar/tlb_scorm"; $icon_alt = "scorm"; } $checked = mosHTML::idBox($i_counter, $row_path->id); $alt = $row_path->published ? $is_hidden ? _JLMS_STATUS_PUBLISHED_AND_HIDDEN : _JLMS_LPATH_STATUS_PUB : _JLMS_LPATH_STATUS_UNPUB; $image = $row_path->published ? $is_hidden ? 'btn_publish_hidden.png' : 'btn_accept.png' : 'btn_cancel.png'; $state = $row_path->published ? 0 : 1; $released_info_txt = ''; if ($row_path->is_time_related) { $released_info_txt = _JLMS_WILL_BE_RELEASED_IN; $showperiod = $row_path->show_period; $ost1 = $showperiod % (24 * 60); $sp_days = ($showperiod - $ost1) / (24 * 60); $ost2 = $showperiod % 60; $sp_hours = ($ost1 - $ost2) / 60; $sp_mins = $ost2; $release_time_info = false; if ($sp_days) { $released_info_txt .= ' ' . $sp_days . ' ' . _JLMS_RELEASED_IN_DAYS; $release_time_info = true; } if ($sp_hours) { $released_info_txt .= ' ' . $sp_hours . ' ' . _JLMS_RELEASED_IN_HOURS; $release_time_info = true; } if ($sp_mins) { $released_info_txt .= ' ' . $sp_mins . ' ' . _JLMS_RELEASED_IN_MINUTES; $release_time_info = true; } if ($release_time_info) { $released_info_txt .= ' ' . _JLMS_RELEASED_AFTER_ENROLLMENT; } if ($image == 'btn_accept.png') { $image = 'btn_publish_wait.png'; } } $publish_icon = ' '; if ($JLMS_ACL->CheckPermissions('lpaths', 'publish')) { /*$publish_icon = '<a href="javascript:submitbutton_change2(\'change_lpath\','.$state.','.$row_path->id.')" title="'.$alt.'">'; $publish_icon .= '<img 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.'" />'; $publish_icon .= '</a>';*/ $title_tt = $alt; $content_tt = $released_info_txt; if (isset($row_path->is_prereqs) && $row_path->is_prereqs) { if ($content_tt) { $content_tt .= '<br />'; } $content_tt .= _JLMS_STATUS_CONFIGURED_PREREQUISITES; } $name_tt = '<img 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 . '" />'; $link_tt = 'javascript:submitbutton_change2(\'change_lpath\',' . $state . ',' . $row_path->id . ')'; $publish_icon = JLMS_toolTip($title_tt, $content_tt, $name_tt, $link_tt); } if ($JLMS_ACL->CheckPermissions('lpaths', 'only_own_items') && $row_path->owner_id != $my->id) { $checked = ' '; $publish_icon = ' '; } elseif ($JLMS_ACL->CheckPermissions('lpaths', 'only_own_role') && $JLMS_ACL->GetRole() != $JLMS_ACL->UserSystemRole($JLMS_DB, $row_path->owner_id)) { $checked = ' '; $publish_icon = ' '; } ?> <tr class="<?php echo JLMSCSS::_('sectiontableentry' . $k); ?> "> <td valign="middle" align="center"><?php echo $i_counter + 1; ?> </td> <?php if ($JLMS_ACL->CheckPermissions('lpaths', 'manage') || $JLMS_ACL->CheckPermissions('lpaths', 'publish')) { ?> <td valign="middle" align="center"><?php if (!isset($row_path->is_link)) { echo $checked; } ?> </td> <?php } ?> <td valign="middle" align="center"> <span style="vertical-align:middle; text-align:center"> <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 if (isset($row_path->is_link) && $row_path->is_link) { echo $row_path->lpath_name; } elseif ($is_squeezebox) { $x_size = 0; $y_size = 0; if (isset($row_path->scorm_width)) { $x_size = $row_path->scorm_width; if ($x_size == 100) { //settings from 1.0.6 version (means 100% width) $x_size = 0; } } if (isset($row_path->scorm_height)) { $y_size = $row_path->scorm_height; } ?> <a href="<?php echo sefRelToAbs($link); ?> " class="scorm_modal" rel="{handler:'iframe', size:{x:<?php echo $x_size; ?> ,y:<?php echo $y_size; ?> }}" title="<?php echo str_replace('"', '"', $row_path->lpath_name); ?> "> <?php echo $row_path->lpath_name; ?> </a> <?php } else { ?> <a href="<?php echo sefRelToAbs($link); ?> " title="<?php echo str_replace('"', '"', $row_path->lpath_name); ?> "> <?php echo $row_path->lpath_name; ?> </a> <?php } ?> <?php if ($JLMS_CONFIG->get('show_lpaths_authors', 0)) { ?> <br /> <span class="small"><?php echo _JLMS_HOME_AUTHOR . " " . $row_path->author_name; ?> </span> <?php } ?> </td> <?php if ($JLMS_ACL->CheckPermissions('lpaths', 'publish')) { ?> <td valign="middle"> <?php echo $publish_icon; ?> </td> <?php } ?> <?php if ($JLMS_ACL->CheckPermissions('lpaths', 'order')) { ?> <td valign="middle"><?php echo JLMS_orderUpIcon($i_counter, $row_path->id, true, 'lpath_orderup'); ?> </td> <td valign="middle"><?php echo JLMS_orderDownIcon($i_counter, $n, $row_path->id, true, 'lpath_orderdown'); ?> </td> <td colspan="2"> <input type="text" name="order[]" size="5" value="<?php echo $row_path->ordering; ?> " class="inputbox" style="text-align: center" /> </td> <?php } ?> <?php if ($JLMS_ACL->CheckPermissions('lpaths', 'manage')) { ?> <td valign="middle"> <?php if ($manage_item && ($row_path->item_id && $row_path->lp_type != 2 || !$row_path->item_id)) { $download_message = _JLMS_LPATH_LINK_TITLE_DOWN_SCORM; if (!$row_path->item_id) { $download_message = _JLMS_LPATH_EXPORT_LP; } ?> <a class="jlms_img_link" href="<?php echo sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=download_scorm&course_id={$course_id}&id={$row_path->id}"); ?> " title="<?php echo $download_message; ?> "><img class='JLMS_png' src="<?php echo $JLMS_CONFIG->get('live_site'); ?> /components/com_joomla_lms/lms_images/toolbar/btn_export.png" border="0" width="16" height="16" alt="<?php echo $download_message; ?> " title="<?php echo $download_message; ?> " /></a> <?php } else { echo ' '; } ?> </td> <?php } ?> <?php if (!$JLMS_ACL->CheckPermissions('lpaths', 'manage')) { $r_img = 'btn_cancel'; $r_sta = _JLMS_LPATH_STU_LPSTATUS_NOTCOMPLETED; $r_start = '-'; $r_end = '-'; 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; if ($row_path->r_start) { $r_start = JLMS_dateToDisplay($row_path->r_start, false, $JLMS_CONFIG->get('offset') * 60 * 60, '\\<\\b\\r \\/>H:i:s'); } if ($row_path->r_end) { $r_end = 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'; if ($row_path->r_start) { $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 = '-'; } if ($row_path->lp_type == 1 || $row_path->lp_type == 2) { if (isset($row_path->r_end) && $row_path->r_end) { $r_end = JLMS_dateToDisplay($row_path->r_end, true, $JLMS_CONFIG->get('offset') * 60 * 60, '\\<\\b\\r \\/>H:i:s'); } if (isset($row_path->r_start) && $row_path->r_start) { $r_start = JLMS_dateToDisplay($row_path->r_start, true, $JLMS_CONFIG->get('offset') * 60 * 60, '\\<\\b\\r \\/>H:i:s'); } } } ?> <td valign="middle" align="center" width="16"> <?php //Show Status Lapths/Scorms //by Max - 25.02.2011 joomla_lms_html::ShowStatusAs($row_path); ?> </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> <?php } ?> <td valign="middle"><?php echo $row_path->lpath_shortdescription ? $row_path->lpath_shortdescription : ' '; ?> </td> </tr> <?php $k = 3 - $k; $i_counter++; } ?> </table> <?php } else { echo '<div class="joomlalms_user_message">' . _JLMS_NO_ITEMS_HERE . '</div>'; } if ($there_were_squeezeboxes) { JLMS_initialize_SqueezeBox(); } ?> <input type="hidden" name="option" value="<?php echo $option; ?> " /> <input type="hidden" name="Itemid" value="<?php echo $Itemid; ?> " /> <input type="hidden" name="task" value="learnpaths" /> <input type="hidden" name="id" value="<?php echo $course_id; ?> " /> <input type="hidden" name="boxchecked" value="0" /> <input type="hidden" name="row_id" value="0" /> <input type="hidden" name="state" value="0" /> <input type="hidden" name="cid2" value="0" /> </form> <?php JLMS_TMPL::CloseTS(); if ($JLMS_ACL->CheckPermissions('lpaths', 'manage') || $JLMS_ACL->CheckPermissions('lpaths', 'publish')) { $link_new = JLMSRoute::_("index.php?option=" . $option . "&Itemid=" . $Itemid . "&task=new_lpath&id=" . $course_id); $link_new_scorm = JLMSRoute::_("index.php?option=" . $option . "&Itemid=" . $Itemid . "&task=new_lpath_scorm&id=" . $course_id); $link_new_scormlib = JLMSRoute::_("index.php?option={$option}&Itemid={$Itemid}&task=new_scorm_from_library&id=" . $course_id); $controls = array(); if ($JLMS_ACL->CheckPermissions('lpaths', 'publish')) { $controls[] = array('href' => "javascript:submitbutton_change('change_lpath',1);", 'title' => _JLMS_LPATH_SET_PUB, 'img' => 'publish'); $controls[] = array('href' => "javascript:submitbutton_change('change_lpath',0);", 'title' => _JLMS_LPATH_SET_UNPUB, 'img' => 'unpublish'); if ($JLMS_ACL->CheckPermissions('lpaths', 'manage')) { $controls[] = array('href' => 'spacer'); } } if ($JLMS_ACL->CheckPermissions('lpaths', 'manage')) { $controls[] = array('href' => ampReplace($link_new), 'onclick' => "", 'title' => _JLMS_LPATH_DO_NEW_LP, 'img' => 'add_lpath'); //TODO: translate 'Import SCORM package' $controls[] = array('href' => ampReplace($link_new_scorm), 'onclick' => "", 'title' => _JLMS_LPATH_IMPORT_SCORM, 'img' => 'add_scorm'); $controls[] = array('href' => $link_new_scormlib, 'title' => _JLMS_SCORM_ADD_A_SCORM_PACKAGE_FROM_THE_LIBRARY, 'img' => 'add_library'); $controls[] = array('href' => 'spacer'); $controls[] = array('href' => "javascript:submitbutton('lpath_delete');", 'title' => _JLMS_LPATH_DO_DEL_LP, 'img' => 'delete'); $controls[] = array('href' => "javascript:submitbutton('edit_lpath');", 'title' => _JLMS_LPATH_DO_EDIT_LP, 'img' => 'edit'); } JLMS_TMPL::ShowControlsFooter($controls); } JLMS_TMPL::CloseMT(); }
function echoMyNotices($option, $Itemid, $my_notices) { global $Itemid, $JLMS_CONFIG; $link_base = 'index.php?option=com_joomla_lms&Itemid=' . $Itemid; $link_notices = $link_base; $link_notices .= '&task=view_all_notices'; ?> <table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php echo JLMSCSS::_('jlmslist', 'jlms_homepage_list'); ?> " style="margin-top:0; margin-bottom:0;"> <tr><<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " colspan="2" align="center" style="text-align:center"><?php echo _JLMS_HOME_NOTICES; ?> </<?php echo JLMSCSS::tableheadertag(); ?> ></tr> <?php $k = 1; foreach ($my_notices as $m_n) { $link = $link_base; if ($m_n->doc_id) { $link .= '&task=' . $m_n->task . '&course_id=' . $m_n->course_id . '&id=' . $m_n->doc_id . ''; } else { $link .= '&task=' . $m_n->task . '&id=' . $m_n->course_id . ''; } ?> <tr class="<?php echo JLMSCSS::_('sectiontableentry' . $k); ?> "> <td valign="top" width="16" style="padding-top: 5px;"> <img class='JLMS_png' src="<?php echo $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/toolbar/btn_notice.png"; ?> " width="16" height="16" border="0" alt="dropbox" /> </td> <td> <div class="notes_head"> on <?php echo JLMS_dateToDisplay($m_n->data, false, 0, " H:m:s"); ?> </div> <div class="clr"></div> <div class="notes_foot"> <?php if (!$m_n->course_id && !$m_n->doc_id) { if (strlen($m_n->notice) > 100) { echo substr($m_n->notice, 0, 100) . ' ...'; } else { echo substr($m_n->notice, 0, 100); } } else { ?> <a href="<?php echo ampReplace(sefRelToAbs($link)); ?> " title="<?php echo substr($m_n->notice, 0, 30); ?> "> <?php if (strlen($m_n->notice) > 100) { echo substr($m_n->notice, 0, 100) . ' ...'; } else { echo substr($m_n->notice, 0, 100); } ?> </a> <?php } ?> </div> </td> </tr> <?php $k = 3 - $k; } ?> <tr> <td colspan="2" align="right" class="<?php echo JLMSCSS::_('jlmslist-footer_td'); ?> "> <a href="<?php echo sefRelToAbs($link_notices); ?> " title="view all notices" style="font-size: 9px;"> view all notes </a> </td> </tr> </table> <?php }
function generate_html($attempts, $title_report = '') { global $JLMS_CONFIG; ob_start(); JLMS_reporting::addCSSStyles(); ?> <table> <tr class="title_report"> <td> <?php echo $title_report; ?> </td> </tr> <tr> <td> <table class="after_header_info"> <tr> <td class="date_title"> Date: </td> <td class="date_value"> <?php echo date("d F Y"); ?> </td> </tr> </table> <br /> </td> </tr> <tr> <td> <table cellpadding="0" cellspacing=""> <tr> <td colspan="10"> <table width="100%" cellpadding="0" cellspacing="0" border="0" class="hits_data" id="reports_quiz"> <tr> <th class="header_title"> Student Name </th> <th class="header_title"> Username </th> <th class="hit_title"> Quiz </th> <th class="hit_title"> User Score </th> <th class="hit_title"> Total Score </th> <th class="hit_title"> Date/Time </th> <th class="hit_title"> Question </th> <th class="hit_title"> Quiestions Options </th> <th class="hit_title"> User Choice </th> <th class="hit_title"> Right Answer </th> </tr> <?php $k = 2; for ($i = 0; $i < count($attempts); $i++) { $row = $attempts[$i]; $questions = $row->questions; $qi = 0; foreach ($questions as $question) { $answers = $question->question_information['answers']; $data = $question->question_information['data']; $k = 3 - $k; for ($ai = 0; $ai < count($answers); $ai++) { if ($ai) { ?> <tr class="<?php echo 'row_' . $k; ?> "> <td colspan="7"> </td> <?php if (in_array($question->c_type, array(1, 12, 2, 13, 3))) { ?> <td class="hit_value"> <?php echo isset($answers[$ai]->c_choice) ? $answers[$ai]->c_choice : ''; ?> </td> <td class="hit_value"> <?php echo isset($answers[$ai]->sc_id) && $answers[$ai]->sc_id ? 'X' : ''; ?> </td> <td class="hit_value"> <?php echo isset($answers[$ai]->c_right) && $answers[$ai]->c_right ? 'X' : ''; ?> </td> <?php } else { if (in_array($question->c_type, array(4, 5, 11))) { ?> <td class="hit_value"> <?php echo $answers[$ai]->c_left_text; ?> </td> <td class="hit_value"> <?php echo $answers[$ai]->c_sel_text; ?> </td> <td class="hit_value"> <?php echo $answers[$ai]->c_right_text; ?> </td> <?php } else { if (in_array($question->c_type, array(6))) { ?> <td class="hit_value"> </td> <td class="hit_value"> <?php echo $answers[$ai]->c_answer; ?> </td> <td class="hit_value"> </td> <?php } else { if (in_array($question->c_type, array(7))) { ?> <td class="hit_value"> <?php echo $data['c_image']; ?> </td> <td class="hit_value"> <?php echo isset($data['c_right']) && $data['c_right'] ? 'right' : 'wrong'; ?> </td> <td class="hit_value"> </td> <?php } } } } /*else if(in_array($question->c_type, array(8,9))){ ?> <td class="hit_value"> c </td> <td class="hit_value"> c </td> <td class="hit_value"> c </td> <?php }*/ ?> </tr> <?php } else { if (!$ai && !$qi) { ?> <tr class="<?php echo 'row_' . $k; ?> "> <td class="header_value"> <?php echo $row->name; ?> </td> <td class="header_value"> <?php echo $row->username; ?> </td> <td class="hit_value"> <?php echo $row->c_title; ?> </td> <td class="hit_value"> <?php echo $row->c_full_score; ?> </td> <td class="hit_value"> <?php echo $row->c_total_score; ?> </td> <td class="hit_value"> <?php echo JLMS_dateToDisplay($row->c_date_time); ?> </td> <td class="hit_value"> <?php echo $question->c_question; ?> </td> <?php if (in_array($question->c_type, array(1, 12, 2, 13, 3))) { ?> <td class="hit_value"> <?php echo isset($answers[$ai]->c_choice) ? $answers[$ai]->c_choice : ''; ?> </td> <td class="hit_value"> <?php echo isset($answers[$ai]->sc_id) && $answers[$ai]->sc_id ? 'X' : ''; ?> </td> <td class="hit_value"> <?php echo isset($answers[$ai]->c_right) && $answers[$ai]->c_right ? 'X' : ''; ?> </td> <?php } else { if (in_array($question->c_type, array(4, 5, 11))) { ?> <td class="hit_value"> <?php echo $answers[$ai]->c_left_text; ?> </td> <td class="hit_value"> <?php echo $answers[$ai]->c_sel_text; ?> </td> <td class="hit_value"> <?php echo $answers[$ai]->c_right_text; ?> </td> <?php } else { if (in_array($question->c_type, array(6))) { ?> <td class="hit_value"> </td> <td class="hit_value"> <?php echo $answers[$ai]->c_answer; ?> </td> <td class="hit_value"> </td> <?php } else { if (in_array($question->c_type, array(7))) { ?> <td class="hit_value"> <?php echo $data['c_image']; ?> </td> <td class="hit_value"> <?php echo isset($data['c_right']) && $data['c_right'] ? 'right' : 'wrong'; ?> </td> <td class="hit_value"> </td> <?php } } } } /*else if(in_array($question->c_type, array(8,9))){ ?> <td class="hit_value"> z </td> <td class="hit_value"> z </td> <td class="hit_value"> z </td> <?php }*/ ?> </tr> <?php } else { if (!$ai) { ?> <tr class="<?php echo 'row_' . $k; ?> "> <td colspan="6"> </td> <td class="hit_value"> <?php echo $question->c_question; ?> </td> <?php if (in_array($question->c_type, array(1, 12, 2, 13, 3))) { ?> <td class="hit_value"> <?php echo isset($answers[$ai]->c_choice) ? $answers[$ai]->c_choice : ''; ?> </td> <td class="hit_value"> <?php echo isset($answers[$ai]->sc_id) && $answers[$ai]->sc_id ? 'X' : ''; ?> </td> <td class="hit_value"> <?php echo isset($answers[$ai]->c_right) && $answers[$ai]->c_right ? 'X' : ''; ?> </td> <?php } else { if (in_array($question->c_type, array(4, 5, 11))) { ?> <td class="hit_value"> <?php echo $answers[$ai]->c_left_text; ?> </td> <td class="hit_value"> <?php echo $answers[$ai]->c_sel_text; ?> </td> <td class="hit_value"> <?php echo $answers[$ai]->c_right_text; ?> </td> <?php } else { if (in_array($question->c_type, array(6))) { ?> <td class="hit_value"> </td> <td class="hit_value"> <?php echo $answers[$ai]->c_answer; ?> </td> <td class="hit_value"> </td> <?php } else { if (in_array($question->c_type, array(7))) { ?> <td class="hit_value"> <?php echo $data['c_image']; ?> </td> <td class="hit_value"> <?php echo isset($data['c_right']) && $data['c_right'] ? 'right' : 'wrong'; ?> </td> <td class="hit_value"> </td> <?php } else { if (in_array($question->c_type, array(8, 9))) { ?> <td class="hit_value"> </td> <td class="hit_value"> </td> <td class="hit_value"> </td> <?php } } } } } ?> </tr> <?php } } } $k = 3 - $k; } $k = 3 - $k; $qi++; } } ?> </table> </td> </tr> </table> </td> </tr> </table> <?php $html = ob_get_contents(); ob_get_clean(); return $html; }
function JLMS_showLatestForumPosts($option, $Itemid, &$latest_forum_posts, &$lists) { global $JLMS_CONFIG; ob_start(); ?> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td class="sectiontableheader" align="center" colspan="2"> <?php echo _JLMS_HOME_LATEST_FORUM_POSTS_TITLE; ?> </td> </tr> <?php $k = 1; if (count($latest_forum_posts)) { foreach ($latest_forum_posts as $lfpitem) { $subject = $lfpitem->subject; $body = ''; if (isset($lfpitem->posterTime) && $lfpitem->posterTime) { $body = _JLMS_DATE . ' ' . JLMS_dateToDisplay(date("Y-m-d H:i:s", $lfpitem->posterTime)); } $body .= "<br />" . _JLMS_COURSE . ': ' . $lfpitem->course_name; $body .= "<br />" . _JLMS_TOPIC . ': ' . $lfpitem->topic_name; $body .= "<br />" . _JLMS_AUTHOR . ': ' . $lfpitem->poster_name; $in_tag = strlen($lfpitem->body) > 90 ? substr($lfpitem->body, 0, 90) . '...' : $lfpitem->body; $link = 'index.php?option=' . $option . '&task=course_forum'; $link .= isset($lfpitem->course_id) && $lfpitem->course_id ? '&id=' . $lfpitem->course_id : ''; $link .= '&topic_id=' . $lfpitem->ID_TOPIC; $link .= '&message_id=' . $lfpitem->ID_MSG; $link = JRoute::_($link); $img = 'btn_notice.png'; ?> <tr class="sectiontableentry<?php echo $k; ?> "> <td width="16"> <img class="JLMS_png" src="<?php echo $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/toolbar/" . $img; ?> " width='16' height='16' border='0' alt='certificate' /> </td> <td> <?php echo JLMS_toolTip($subject, $body, $in_tag, $link, 1, 120, 'false', 'jlms_ttip_posts'); ?> </td> </tr> <?php $k = 3 - $k; } } else { ?> <tr class="sectiontableentry<?php echo $k; ?> "> <td colspan="2"> <?php echo _JLMS_HOME_LATEST_FORUM_POSTS_NO_ITEMS; ?> </td> </tr> <?php } ?> </table> <?php $ret_str = ob_get_contents(); ob_get_clean(); return $ret_str; }
function jlms_conference_archive($course_id, $option, $records, $pageNav) { global $my, $Itemid, $JLMS_CONFIG, $JLMS_SESSION; //$usertype = $JLMS_CONFIG->get('current_usertype') ; $JLMS_ACL =& JLMSFactory::getACL(); ?> <script type="text/javascript" language="javascript"> <!--//--><![CDATA[//><!-- function submitbutton(pressbutton) { var form = document.adminForm; if ( form.boxchecked.value == "0" ){ alert("<?php echo _JLMS_ALERT_SELECT_ITEM; ?> "); } else { if (pressbutton == 'record_delete'){ if (confirm("<?php echo 'Are you sure?'; ?> ") == true){ form.mode.value = pressbutton; form.submit(); } }else{ form.mode.value = pressbutton; form.submit(); } } } function startAppPlayback(path) { var y= (screen.height/2) - 359; var x= (screen.width/2) - 510 ; window.open(path,'Conference_playback','top='+y+', left='+x+',width=995, height=640, scrollbars=no, status=0, toolbar=no, resizable=yes'); } function submitbutton_change(pressbutton, state) { var form = document.adminForm; if (pressbutton == 'change_record'){ if (form.boxchecked.value == "0") { alert("<?php echo _JLMS_ALERT_SELECT_ITEM; ?> "); } else { form.mode.value = pressbutton; form.state.value = state; form.submit(); } } } function submitbutton_change_record(pressbutton, state, cid_id) { var form = document.adminForm; if (pressbutton == 'change_record'){ form.mode.value = pressbutton; form.state.value = state; form.cid2.value = cid_id; form.submit(); } } //--><!]]> </script> <?php JLMS_TMPL::OpenMT(); $params = array('show_menu' => true); JLMS_TMPL::ShowHeader('conference', _JLMS_HEAD_CONF_STR, $params); JLMS_TMPL::OpenTS(); //'', ' align="right" style="text-align:right " width="100%"'); ?> <table width="100%" cellpadding="0" cellspacing="0" border="0" class="jlms_table_no_borders"> <tr> <td colspan="2"> </td> <td style="text-align:right;"><br /> <?php $toolbar = array(); //$toolbar[] = array('btn_type' => 'edit', 'btn_js' => sefRelToAbs("index.php?option=$option&Itemid=$Itemid&task=conference&id=$course_id&mode=archive") ); $toolbar[] = array('btn_type' => 'back', 'btn_js' => sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=conference&id={$course_id}")); echo JLMS_ShowToolbar($toolbar); ?> </td> </tr> </table> <?php JLMS_TMPL::CloseTS(); 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="<?php echo JLMSCSS::_('jlmslist'); ?> "> <tr> <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " align="left" width="15">#</<?php echo JLMSCSS::tableheadertag(); ?> > <?php if ($JLMS_ACL->CheckPermissions('conference', 'manage')) { ?> <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " align="left" width="10"><input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count($records); ?> );" /></<?php echo JLMSCSS::tableheadertag(); ?> > <?php } ?> <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " width="25%" align="left"><?php echo _JLMS_CONFERENCE_RECORD; ?> </<?php echo JLMSCSS::tableheadertag(); ?> > <?php if ($JLMS_ACL->CheckPermissions('conference', 'manage')) { ?> <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " width="140" align="left"><?php echo _JLMS_CONFERENCE_SESSION; ?> </<?php echo JLMSCSS::tableheadertag(); ?> > <?php } ?> <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " width="110" align="left"><?php echo _JLMS_CONFERENCE_RECORD_START; ?> </<?php echo JLMSCSS::tableheadertag(); ?> > <?php if ($JLMS_ACL->CheckPermissions('conference', 'manage')) { ?> <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " width="50" align="center"> </<?php echo JLMSCSS::tableheadertag(); ?> > <?php } ?> <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> "> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " width="100" align="center" style="text-align:center;"><?php echo _JLMS_CONFERENCE_RECORD_PB; ?> </<?php echo JLMSCSS::tableheadertag(); ?> > </tr> <?php $k = 1; for ($i = 0, $n = count($records); $i < $n; $i++) { $row = $records[$i]; $link = sefRelToAbs("index.php?option=" . $option . "&Itemid=" . $Itemid . "&task=details_course&id=" . $row->id); $checked = mosHTML::idBox($i, $row->id); $overlib_descr = JLMS_txt2overlib($row->description); $overlib_title = "Description"; ?> <tr valign="middle" style="vertical-align:middle" class="<?php echo JLMSCSS::_('sectiontableentry' . $k); ?> "> <td align="left"><?php echo $pageNav->limitstart + $i + 1; ?> </td> <?php if ($JLMS_ACL->CheckPermissions('conference', 'manage')) { ?> <td align="left"><?php echo $checked; ?> </td> <?php } ?> <td align="left"> <?php $inside_tag = $row->record_name ? $row->record_name : "Record"; $link_href = "javascript:startAppPlayback('" . $JLMS_CONFIG->get('live_site') . '/index.php?tmpl=component&option=com_joomla_lms&task=conference&mode=conference_playback&Itemid=' . $Itemid . '&id=' . $course_id . '&name=' . $row->session_name . "');"; echo JLMS_toolTip($overlib_title, $overlib_descr, $inside_tag, $link_href); ?> <br /> <span class="small"><?php echo _JLMS_HOME_AUTHOR . " " . $row->username; ?> </span> </td> <?php if ($JLMS_ACL->CheckPermissions('conference', 'manage')) { ?> <td align="left"> <?php echo $row->session_name; /* <a href="javascript:startAppPlayback('<?php echo sefRelToAbs('index.php?tmpl=component&option=com_joomla_lms&task=conference&mode=conference_playback&Itemid='.$Itemid.'&id='.$course_id.'&name='.$row->record_name );?>');" title="View details"> <?php echo $row->session_name;?> </a> */ ?> </td> <?php } ?> <td align="left"><?php echo JLMS_dateToDisplay($row->start_date); ?> </td> <?php if ($JLMS_ACL->CheckPermissions('conference', 'manage')) { ?> <td align="center" valign="middle"> <?php if ($JLMS_ACL->CheckPermissions('conference', 'manage')) { $alt = $row->published ? _JLMS_STATUS_PUB : _JLMS_STATUS_UNPUB; $image = $row->published ? 'btn_accept.png' : 'btn_cancel.png'; $state = $row->published ? 0 : 1; echo '<a href="javascript:submitbutton_change_record(\'change_record\', ' . $state . ', ' . $row->id . ')" title="' . $alt . '"><img 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 . '" /></a>'; } ?> </td> <?php } ?> <td> </td> <td align="center" valign="middle"> <a href="javascript:startAppPlayback('<?php echo $JLMS_CONFIG->get('live_site') . '/index.php?tmpl=component&option=com_joomla_lms&task=conference&mode=conference_playback&Itemid=' . $Itemid . '&id=' . $course_id . '&name=' . $row->session_name; ?> ');" title="<?php echo _JLMS_CONFERENCE_RECORD_PB; ?> " > <img class="JLMS_png" src="<?php echo $JLMS_CONFIG->get('live_site'); ?> /components/com_joomla_lms/lms_images/toolbar/btn_playback.png" width="16" height="16" border="0" alt="<?php echo _JLMS_CONFERENCE_RECORD_PB; ?> " title="<?php echo _JLMS_CONFERENCE_RECORD_PB; ?> " /> </a> </td> </tr> <?php $k = 3 - $k; } ?> <tr> <td class="<?php echo JLMSCSS::_('jlmslist-footer_td'); ?> " colspan="<?php echo $JLMS_ACL->CheckPermissions('conference', 'manage') ? 8 : 5; ?> " align="center"><div align="center"> <?php if (count($records) == 0) { echo _JLMS_CONFERENCE_NO_RECORD; } else { $link_PN = "index.php?option={$option}&Itemid={$Itemid}&task=conference&mode=archive&course_id=" . $course_id; echo _JLMS_PN_DISPLAY_NUM . $pageNav->getLimitBox($link_PN) . " " . $pageNav->getPagesCounter($link_PN) . '<br />'; echo $pageNav->writePagesLinks($link_PN); } ?> </div></td> </tr> </table> <input type="hidden" name="task" value="conference" /> <input type="hidden" name="mode" value="" /> <input type="hidden" name="boxchecked" value="0" /> <input type="hidden" name="id" value="<?php echo $course_id; ?> " /> <input type="hidden" name="state" value="0" /> <input type="hidden" name="cid2" value="0" /> </form> <?php JLMS_TMPL::CloseTS(); if ($JLMS_ACL->CheckPermissions('conference', 'manage')) { $controls = array(); $controls[] = array('href' => "javascript:submitbutton_change('change_record',1);", 'title' => _JLMS_SET_PUB, 'img' => 'publish'); $controls[] = array('href' => "javascript:submitbutton_change('change_record',0);", 'title' => _JLMS_SET_UNPUB, 'img' => 'unpublish'); $controls[] = array('href' => 'spacer'); $controls[] = array('href' => "javascript:submitbutton('record_delete');", 'title' => _JLMS_DELETE, 'img' => 'delete'); $controls[] = array('href' => "javascript:submitbutton('edit_record');", 'title' => _JLMS_EDIT, 'img' => 'edit'); JLMS_TMPL::ShowControlsFooter($controls, sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=conference&id={$course_id}")); } JLMS_TMPL::CloseMT(); }
function showUsersGlobal($course_id, $group_id, $option, &$rows, &$lists, &$pageNav, $u_search, $view_type = 1) { global $Itemid, $JLMS_CONFIG; $JLMS_ACL =& JLMSFactory::getACL(); ?> <script language="javascript" type="text/javascript"> <!-- function submitbutton(pressbutton) { var form = document.adminForm; if ((pressbutton == 'edit_user' || pressbutton == 'delete_user') && (form.boxchecked.value == "0")){ alert( "<?php echo _JLMS_USER_SELECT_USER; ?> " ); } else { form.task.value = pressbutton; form.submit(); } } //--> </script> <?php JLMS_TMPL::OpenMT(); $hparams = array(); $toolbar = array(); $title = ''; if ($view_type == 1) { $title = ' ' . _JLMS_USERS_TITLE; } elseif ($view_type == 2) { $title = ' ' . _JLMS_USERS_ASSISTS_TITLE; } // $toolbar[] = array('btn_type' => 'back', 'btn_js' => sefRelToAbs("index.php?option=$option&Itemid=$Itemid&task=course_users&id=$course_id")); JLMS_TMPL::ShowHeader('usergroup', $title, $hparams, $toolbar); if ($view_type == 1) { JLMS_TMPL::OpenTS(); echo $lists['groups']; JLMS_TMPL::CloseTS(); } JLMS_TMPL::OpenTS(); $colspan = $view_type == 1 ? 9 : 4; ?> <form action="<?php echo $JLMS_CONFIG->get('live_site') . "/index.php?option=" . $option . "&Itemid=" . $Itemid; ?> " method="post" name="adminForm"> <table width="100%" cellpadding="0" cellspacing="0" border="0" class="jlms_table_no_borders" style="margin-top: 2px;"> <tr> <td> <input type="text" class="inputbox" name="u_search" value="<?php echo $u_search; ?> " /> <input type="button" value="Search" onclick="javascript:submitbutton('course_users');" /> </td> </tr> </table> <table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php echo JLMSCSS::_('jlmslist'); ?> " style="margin-top: 2px;"> <tr> <<?php echo JLMSCSS::tableheadertag(); ?> width="20" class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " align="center">#</<?php echo JLMSCSS::tableheadertag(); ?> > <?php if ($JLMS_ACL->CheckPermissions('users', 'manage')) { ?> <<?php echo JLMSCSS::tableheadertag(); ?> width="20" class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " align="center"><input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count($rows); ?> );" /></<?php echo JLMSCSS::tableheadertag(); ?> > <?php } else { ?> <<?php echo JLMSCSS::tableheadertag(); ?> width="20" class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " align="center"> </<?php echo JLMSCSS::tableheadertag(); ?> > <?php } ?> <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> "><?php echo _JLMS_USERS_TBL_HEAD_USERNAME; ?> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> "><?php echo _JLMS_USERS_TBL_HEAD_USER_ADDINFO; ?> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> "><?php echo _JLMS_USERS_TBL_HEAD_GROUP; ?> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> "><?php echo _JLMS_TBL_HEAD_USERS_ROLE; ?> </<?php echo JLMSCSS::tableheadertag(); ?> > <?php if ($view_type == 1) { ?> <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " colspan="2" align="center"><?php echo _JLMS_USERS_TBL_HEAD_USER_ACC_PERIOD; ?> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> "><?php echo _JLMS_USERS_TBL_HEAD_USER_COMMENT; ?> </<?php echo JLMSCSS::tableheadertag(); ?> > <?php } ?> </tr> <?php $k = 1; for ($i = 0, $n = count($rows); $i < $n; $i++) { $row = $rows[$i]; $link = "index.php?option=" . $option . "&Itemid=" . $Itemid . "&task=view_users&course_id=" . $course_id . "&id=" . $row->id; $checked = mosHTML::idBox($i, $row->id); if (!$JLMS_ACL->CheckPermissions('users', 'manage')) { $checked = ' '; } ?> <tr class="<?php echo JLMSCSS::_('sectiontableentry' . $k); ?> "> <td align="center"><?php echo $pageNav->limitstart + $i + 1; ?> </td> <td><?php echo $checked; ?> </td> <td align="left"> <?php echo $row->username; ?> </td> <td><?php echo $row->name . "(" . $row->email . ")"; ?> </td> <?php if ($view_type == 1) { ?> <td align="center"><?php echo $row->ug_name; ?> </td> <td align="center"><?php echo $row->lms_usertype; ?> </td> <td align="center"><?php echo $row->publish_start ? JLMS_dateToDisplay($row->start_date) : '-'; ?> </td> <td align="center"><?php echo $row->publish_end ? JLMS_dateToDisplay($row->end_date) : '-'; ?> </td> <td><?php echo $row->user_add_comment ? $row->user_add_comment : ' '; ?> </td> <?php } ?> </tr> <?php $k = 3 - $k; } ?> <tr> <td colspan="<?php echo $view_type == 1 ? '9' : '4'; ?> " align="center" class="<?php echo JLMSCSS::_('jlmslist-footer_td'); ?> "> <div align="center" style="white-space: nowrap;"> <?php $link = "index.php?option={$option}&Itemid={$Itemid}&task=course_users&id={$course_id}&group_id={$group_id}"; if ($u_search != '') { $link .= '&u_search=' . $u_search; } echo _PN_DISPLAY_NR . $pageNav->getLimitBox($link) . ' ' . $pageNav->getPagesCounter(); echo '<br />'; echo $pageNav->writePagesLinks($link); ?> </div> </td> </tr> </table> <input type="hidden" name="option" value="<?php echo $option; ?> " /> <input type="hidden" name="Itemid" value="<?php echo $Itemid; ?> " /> <input type="hidden" name="task" value="course_users" /> <input type="hidden" name="group_id" value="<?php echo $group_id; ?> " /> <input type="hidden" name="id" value="<?php echo $course_id; ?> " /> <input type="hidden" name="boxchecked" value="0" /> <input type="hidden" name="row_id" value="0" /> <input type="hidden" name="state" value="0" /> <input type="hidden" name="utype" value="<?php echo $view_type; ?> " /> </form> <?php JLMS_TMPL::CloseTS(); $link_add = $JLMS_CONFIG->get('live_site') . "/index.php?option=" . $option . "&task=add_user&course_id=" . $course_id . "&id=0&Itemid=" . $Itemid . ""; $link_import = $JLMS_CONFIG->get('live_site') . "/index.php?option=" . $option . "&task=import_users_csv&course_id=" . $course_id . "&id=0&Itemid=" . $Itemid . ""; if ($view_type == 2) { $link_add .= '&utype=2'; } $controls = array(); if ($JLMS_ACL->CheckPermissions('users', 'manage_teachers')) { $controls[] = array('href' => "javascript:submitbutton('view_assistants');", 'title' => _JLMS_USER_ASSIST_GROUP_NAME, 'img' => 'editusergroup'); $controls[] = array('href' => 'spacer'); } if ($JLMS_ACL->CheckPermissions('users', 'manage')) { $controls[] = array('href' => $link_add, 'title' => _JLMS_USER_ALT_ADDUSER, 'img' => 'adduser'); $controls[] = array('href' => "javascript:submitbutton('delete_user');", 'title' => _JLMS_USER_ALT_DELUSER, 'img' => 'deluser'); if ($view_type == 1) { $controls[] = array('href' => "javascript:submitbutton('edit_user');", 'title' => _JLMS_USER_ALT_EDITUSER, 'img' => 'edituser'); } if ($JLMS_ACL->CheckPermissions('users', 'import_users')) { $controls[] = array('href' => 'spacer'); $controls[] = array('href' => $link_import, 'title' => _JLMS_USER_IMPORT_TITLE, 'img' => 'csv_import'); } } JLMS_TMPL::ShowControlsFooter($controls, ''); JLMS_TMPL::CloseMT(); }
function show_calendar_day($id, $option, &$rows, $date) { $JLMS_CONFIG =& JLMSFactory::getConfig(); $Itemid = $JLMS_CONFIG->get('Itemid'); $choose_date = JLMS_dateToDisplay(date('Y-m-d', $date)); /*<script type="text/javascript" src="<?php echo $JLMS_CONFIG->get('live_site');?>/includes/js/joomla.javascript.js "></script>*/ ?> <script language="javascript" type="text/javascript"> <!-- function quick_date(){ document.forms.jlms_agenda_form_day.submit(); } //--> </script> <form action="<?php echo sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}"); ?> " method="post" name="jlms_agenda_form_day"> <table cellpadding="0" cellspacing="0" border="0" style="height:16px;" class="jlms_table_no_borders"> <tr> <td valign="middle" align="center" width="18"> <?php echo JLMS_HTML::_('calendar.calendar', $choose_date, 'cal', 'jlms_choose', null, null, 'statictext'); ?> </td><td valign="middle" align="center" width="18"> <span onclick="quick_date()" style=" cursor:pointer" title="<?php echo _JLMS_AGENDA_GO_DATE; ?> "> <img src="<?php echo $JLMS_CONFIG->get('live_site'); ?> /components/com_joomla_lms/lms_images/agenda/loopnone.png" alt="<?php echo _JLMS_AGENDA_GO_DATE; ?> " title="<?php echo _JLMS_AGENDA_GO_DATE; ?> " id="go_date" border="0" width="16" height="16" class="JLMS_png" /> </span> </td> </tr> </table> <input type="hidden" name="option" value="<?php echo $option; ?> " /> <input type="hidden" name="Itemid" value="<?php echo $Itemid; ?> " /> <input type="hidden" name="task" value="agenda" /> <input type="hidden" name="mode" value="view_day" /> <input type="hidden" name="id" value="<?php echo $id; ?> " /> </form> <table cellpadding="0" cellspacing="0" border="0" width="100%"> <tr style="background: url('<?php echo $JLMS_CONFIG->get('live_site'); ?> /components/com_joomla_lms/lms_images/agenda/bg.jpg') #cccccc repeat-x; font-weight:bold; color:white;height:20px " valign="middle"> <td valign="middle" align="center" width="15%"> <a class="jlms_img_link" href="<?php echo sefRelToAbs("index.php?option={$option}&Itemid=" . $Itemid . "&task=agenda&mode=view_day&id=" . $id . "&date=" . JLMS_dateToDisplay(strtotime("-1 day", $date), true)); ?> " title="<?php echo _JLMS_AGENDA_PREVIOUSDAY; ?> "> <img src="<?php echo $JLMS_CONFIG->get('live_site'); ?> /components/com_joomla_lms/lms_images/agenda/ag_previous.png" class="JLMS_png" alt="<?php echo _JLMS_AGENDA_PREVIOUSDAY; ?> " title="<?php echo _JLMS_AGENDA_PREVIOUSDAY; ?> " width="16" height="16" border="0"/> </a> </td> <td align="center" valign="middle" width="70%"> <?php echo day_month_lang(date('w, d m Y', $date), 0, 1, 6, 2); ?> </td> <td valign="middle" align="center" width="15%"> <a class="jlms_img_link" href="<?php echo sefRelToAbs("index.php?option={$option}&Itemid=" . $Itemid . "&task=agenda&mode=view_day&id=" . $id . "&date=" . JLMS_dateToDisplay(strtotime("+1 day", $date), true)); ?> " title="<?php echo _JLMS_AGENDA_NEXTDAY; ?> "> <img src="<?php echo $JLMS_CONFIG->get('live_site'); ?> /components/com_joomla_lms/lms_images/agenda/ag_next.png" class="JLMS_png" alt="<?php echo _JLMS_AGENDA_NEXTDAY; ?> " title="<?php echo _JLMS_AGENDA_NEXTDAY; ?> " width="16" height="16" border="0"/> </a></td> </tr> <?php $k = 0; $z = 0; $ste = 1; while (isset($rows[$k]) && $k < count($rows)) { if (strtotime(date("Y-m-d", $date)) >= strtotime($rows[$k]->start_date) && strtotime(date("Y-m-d", $date)) <= strtotime($rows[$k]->end_date)) { $ste = 3 - $ste; echo "<tr><td id='day" . $k . "' class='sectiontableentry" . $ste . "' colspan='3'>"; $title = $rows[$k]->title; echo "<a href=" . sefRelToAbs('index.php?option=' . $option . '&Itemid=' . $Itemid . '&task=agenda&id=' . $id . '&agenda_id=' . $rows[$k]->agenda_id . '&date=' . date("Y-m", $date) . '#anc' . $rows[$k]->agenda_id) . '-' . date("Y-m", $date) . " >"; echo "<img src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/agenda/ag_upcoming.png\" align='left' border='0' width='16px' height='16px' style='padding-right:5px' class='JLMS_png' />"; echo "<b>" . $title . "</b></a><br />"; echo "</td></tr><tr><td colspan='3'>"; echo $rows[$k]->content; echo "</td></tr>"; $z++; } $k++; } if ($z == 0) { echo "<tr><td style='' colspan='3'>" . _JLMS_AGENDA_NO_ITEMS . "</td></tr>"; } ?> </table> <?php }
function showCourseDocuments($id, $option, &$rows, &$lists, &$possibilities) { $JLMS_CONFIG =& JLMSFactory::getConfig(); $Itemid = $JLMS_CONFIG->get('Itemid'); $db =& JFactory::getDbo(); $user = JLMSFactory::getUser(); $JLMS_ACL =& JLMSFactory::getACL(); $lms_img_path = $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('lms_path_to_images', 'components/com_joomla_lms/lms_images'); $rows_c = $lists['collapsed_folders']; ?> <script language="javascript" type="text/javascript"> <!--//--><![CDATA[//><!-- function submitbutton(pressbutton) { var form = document.adminForm; if ((pressbutton == 'doc_delete') && (form.boxchecked.value == '0')) { alert( "<?php echo _JLMS_ALERT_SELECT_ITEM; ?> " ); } else if((pressbutton == 'doc_delete')){ if(confirm('<?php echo _JLMS_OUTDOCS_JS_CONFIRM_DELETE; ?> ')){ form.task.value = pressbutton; form.submit(); } } else if ((pressbutton == 'edit_doc') && (form.boxchecked.value == '0')) { alert( "<?php echo _JLMS_ALERT_SELECT_ITEM; ?> " ); } else { form.task.value = pressbutton; form.submit(); } } function submitbutton_change(pressbutton, state) { var form = document.adminForm; if (pressbutton == 'change_doc'){ if (form.boxchecked.value == '0') { alert( "<?php echo _JLMS_ALERT_SELECT_ITEM; ?> " ); } else { form.task.value = pressbutton; form.state.value = state; form.submit(); } } } function submitbutton_change2(pressbutton, state, cid_id) { var form = document.adminForm; if (pressbutton == 'change_doc'){ form.task.value = pressbutton; form.state.value = state; form.cid2.value = cid_id; form.submit(); } } function submitbutton_order(pressbutton, item_id) { var form = document.adminForm; if ((pressbutton == 'doc_orderup') || (pressbutton == 'doc_orderdown')){ if (item_id) { form.task.value = pressbutton; form.row_id.value = item_id; form.submit(); } } } function cf_saveorder(){ var form = document.adminForm; form.task.value = 'doc_saveorder'; form.submit(); } var TreeArray1 = new Array(); var TreeArray2 = new Array(); var Is_ex_Array = new Array(); <?php $i = 1; foreach ($rows as $row) { if ($row->p_view) { echo "TreeArray1[" . $i . "] = " . $row->parent_id . ";"; echo "TreeArray2[" . $i . "] = " . $row->id . ";"; if (in_array($row->id, $rows_c)) { echo "Is_ex_Array[" . $i . "] = 0;"; } else { echo "Is_ex_Array[" . $i . "] = 1;"; } $i++; } } ?> function Hide_Folder(fid) { var vis_style = 'hidden'; var dis_style = 'none'; var i = 1; while (i < TreeArray1.length) { if (TreeArray1[i] == fid) { getObj('tree_row_'+TreeArray2[i]).style.visibility = vis_style; getObj('tree_row_'+TreeArray2[i]).style.display = dis_style; Hide_Folder(TreeArray2[i]) } i ++; } } function Show_Folder(fid) { var vis_style = 'visible'; var dis_style = ''; var i = 1; while (i < TreeArray1.length) { if (TreeArray1[i] == fid) { if (getObj('tree_row_'+TreeArray2[i])) { getObj('tree_row_'+TreeArray2[i]).style.display = dis_style; getObj('tree_row_'+TreeArray2[i]).style.visibility = vis_style; } NoChange_Folder(TreeArray2[i]) } i ++; } } function NoChange_Folder(fid) { var vis_style = 'hidden';var dis_style = 'none';var i = 1;var j = 0; while (i < TreeArray2.length) { if ( (TreeArray2[i] == fid) && (Is_ex_Array[i] == 1) ) { vis_style = 'visible'; dis_style = ''; j = 1; } i ++; } i = 1; while (i < TreeArray1.length) { if (TreeArray1[i] == fid) { getObj('tree_row_'+TreeArray2[i]).style.visibility = vis_style; getObj('tree_row_'+TreeArray2[i]).style.display = dis_style; if (j == 1) { NoChange_Folder(TreeArray2[i]); } else { Hide_Folder(TreeArray2[i]); } } i ++; } } function Ex_Folder(fid) { var i = 1; var j = 1; while (i < TreeArray2.length) { if ( (TreeArray2[i] == fid) && (Is_ex_Array[i] == 1) ) { j = 0; } i ++; } if (j == 1) { Show_Folder(fid); if (getObj('tree_img_' + fid).runtimeStyle) { var StStr = getObj('tree_img_' + fid).runtimeStyle.filter; var imgStr = getObj('tree_img_' + fid).outerHTML; imgStr = imgStr.replace('expandall.png','collapseall.png').replace('<?php echo _JLMS_DOCS_EXP_FOLDER; ?> ', '<?php echo _JLMS_DOCS_COLL_FOLDER; ?> '); StStr = StStr.replace('expandall.png','collapseall.png'); getObj('tree_img_' + fid).outerHTML = imgStr; getObj('tree_img_' + fid).runtimeStyle.filter = StStr; } else { getObj('tree_img_' + fid).src = '<?php echo $JLMS_CONFIG->get('live_site'); ?> /components/com_joomla_lms/lms_images/docs/collapseall.png'; getObj('tree_img_' + fid).alt = '<?php echo _JLMS_DOCS_COLLAPSE; ?> '; getObj('tree_img_' + fid).title = '<?php echo _JLMS_DOCS_COLL_FOLDER; ?> '; } } else { Hide_Folder(fid); if (getObj('tree_img_' + fid).runtimeStyle) { var StStr = getObj('tree_img_' + fid).runtimeStyle.filter; var imgStr = getObj('tree_img_' + fid).outerHTML; imgStr = imgStr.replace('collapseall.png','expandall.png').replace('<?php echo _JLMS_DOCS_COLL_FOLDER; ?> ', '<?php echo _JLMS_DOCS_EXP_FOLDER; ?> '); StStr = StStr.replace('collapseall.png','expandall.png'); getObj('tree_img_' + fid).outerHTML = imgStr; getObj('tree_img_' + fid).runtimeStyle.filter = StStr; } else { getObj('tree_img_' + fid).src = '<?php echo $JLMS_CONFIG->get('live_site'); ?> /components/com_joomla_lms/lms_images/docs/expandall.png'; getObj('tree_img_' + fid).alt = '<?php echo _JLMS_DOCS_EXPAND; ?> '; getObj('tree_img_' + fid).title = '<?php echo _JLMS_DOCS_EXP_FOLDER; ?> '; } } i = 1; while (i < TreeArray2.length) { if ( (TreeArray2[i] == fid) ) { if (Is_ex_Array[i] == 1) { Is_ex_Array[i] = 0; } else { Is_ex_Array[i] = 1; } } i ++; } } <?php if ($possibilities->manage && count($rows)) { ?> var docs_save_blocked = false; function Docs_WriteSysMsg(mes) { if (jlms_writetxt('joomlalms_sys_message', mes)) { getObj('joomlalms_sys_message_container').style.display = ''; getObj('joomlalms_sys_message_container').style.visibility = 'visible'; } } function Docs_save_view() { if (!docs_save_blocked) { var prepare_str = ''; Docs_WriteSysMsg("<img src='<?php echo $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('ajax_settings_small_indicator'); ?> ' />"); i = 1; var ps_pref = ''; while (i < TreeArray2.length) { if (Is_ex_Array[i] == 0) { prepare_str = ''+ prepare_str + ps_pref + TreeArray2[i]; ps_pref = '-'; } i ++; } Docs_MakeRequest(prepare_str); } } function Docs_analize_req(http_request) { if (http_request.readyState == 4) { if ((http_request.status == 200)) { 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 mes = response.getElementsByTagName('message')[0].firstChild.data } else { var mes = "Request failed"; } Docs_WriteSysMsg(mes); docs_save_blocked = false; } } function Docs_MakeRequest(req_str) { docs_save_blocked = true; 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() { Docs_analize_req(http_request); }; var lp_url_prefix2 = ''; var post_target = '<?php echo $JLMS_CONFIG->get('ajax_settings_request_safe_path'); ?> '; var url = 'task=documents_view_save&id=<?php echo $id; ?> &folders='+req_str; http_request.open("POST", post_target, true); http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); http_request.setRequestHeader("Content-length", url.length); //http_request.setRequestHeader("Connection", "close"); http_request.send(url); } <?php } ?> JLMS_preloadImages('<?php echo $JLMS_CONFIG->get('live_site'); ?> /components/com_joomla_lms/lms_images/docs/expandall.png','<?php echo $JLMS_CONFIG->get('live_site'); ?> /components/com_joomla_lms/lms_images/docs/collapseall.png'<?php echo ", '" . $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('ajax_settings_small_indicator') . "'"; ?> ); //--><!]]> </script> <?php JLMS_TMPL::OpenMT(); $hparams = array(); $toolbar = array(); if ($JLMS_ACL->CheckPermissions('docs', 'manage') && count($rows)) { // this feature is available only for users who has 'documents' manage permission (for entire tool) $toolbar[] = array('btn_type' => 'save', 'btn_js' => "javascript:Docs_save_view();", 'btn_title' => _JLMS_DOCS_SAVE_VIEW_TITLE); } JLMS_TMPL::ShowHeader('docs', _JLMS_DOCS_COURSE_DOCS, $hparams, $toolbar); $max_tree_width = 0; if (isset($rows[0])) { $max_tree_width = $rows[0]->tree_max_width; } JLMS_TMPL::OpenTS(); ?> <form action="<?php echo $JLMS_CONFIG->get('live_site') . "/index.php?option=" . $option . "&Itemid=" . $Itemid; ?> " method="post" name="adminForm" enctype="multipart/form-data"> <?php if (!empty($rows)) { ?> <table width="100%" cellpadding="0" cellspacing="0" border="0" id="jlms_doc_non_scr" class="<?php echo JLMSCSS::_('jlmslist'); ?> "> <tr> <<?php echo JLMSCSS::tableheadertag(); ?> width="20" class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " align="center">#</<?php echo JLMSCSS::tableheadertag(); ?> > <?php if ($possibilities->manage || $possibilities->publish) { ?> <<?php echo JLMSCSS::tableheadertag(); ?> width="20" class="<?php echo JLMSCSS::_('sectiontableheader'); ?> "><input type="checkbox" value="0" name="fake_checkbox" style="visibility:hidden" /></<?php echo JLMSCSS::tableheadertag(); ?> > <?php } ?> <?php for ($th_i = 0; $th_i < $max_tree_width + 1; $th_i++) { ?> <<?php echo JLMSCSS::tableheadertag(); ?> width="16" class="<?php echo JLMSCSS::_('sectiontableheader'); ?> "> </<?php echo JLMSCSS::tableheadertag(); ?> > <?php } ?> <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " width="45%"><span style="display:block; width:150px; text-align:left;"><?php echo _JLMS_DOCS_TBL_DOCNAME; ?> </span></<?php echo JLMSCSS::tableheadertag(); ?> > <?php if ($possibilities->order) { ?> <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " colspan="2" width="1"> <?php echo JText::_(_JLMS_REORDER); ?> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " width="1"> <?php echo _JLMS_ORDER; ?> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " width="1"> <a href="javascript:saveorder(<?php echo count($rows) - 1; ?> , 'doc_saveorder');"> <img src="<?php echo $lms_img_path; ?> /toolbar/tlb_filesave.png" border="0" width="16" height="16" alt="<?php echo _JLMS_SAVEORDER; ?> " title="<?php echo _JLMS_SAVEORDER; ?> " /> </a> </<?php echo JLMSCSS::tableheadertag(); ?> > <?php } ?> <?php if ($possibilities->manage || $possibilities->publish) { ?> <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " width="1"> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> "><?php echo _JLMS_DOCS_TBL_STARTING; ?> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> "><?php echo _JLMS_DOCS_TBL_ENDING; ?> </<?php echo JLMSCSS::tableheadertag(); ?> > <?php } ?> <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " width="60%"><span style="display:block; width:110px;"><?php echo _JLMS_DOCS_TBL_DESCR; ?> </span></<?php echo JLMSCSS::tableheadertag(); ?> > </tr> <?php $k = 1; $tree_modes = array(); $visible_folder = true; //$next_row_is_visible = true; $vis_mode = 0; $doc_number = 1; for ($i = 0, $n = count($rows); $i < $n; $i++) { $row = $rows[$i]; if ($row->p_view) { // if user can view this item $max_tree_width = $row->tree_max_width; $link = ''; $link_title = ''; if ($row->folder_flag == 2) { $link = sefRelToAbs("index.php?option=" . $option . "&Itemid=" . $Itemid . "&task=docs_view_zip&course_id=" . $id . "&id=" . $row->id); $link_title = _JLMS_T_A_VIEW_ZIP_PACK; } elseif ((!$row->folder_flag || $row->folder_flag == 3) && $row->file_id) { $link = sefRelToAbs("index.php?option=" . $option . "&Itemid=" . $Itemid . "&task=get_document&course_id=" . $id . "&id=" . $row->id); $link_title = _JLMS_DOCS_LINK_DOWNLOAD; } elseif ((!$row->folder_flag || $row->folder_flag == 3) && !$row->file_id) { $link = sefRelToAbs("index.php?option=" . $option . "&Itemid=" . $Itemid . "&task=docs_view_content&course_id=" . $id . "&id=" . $row->id); $link_title = _JLMS_T_A_VIEW_CONTENT; } $time_p = $row->publish_start || $row->publish_end; $alt = $row->published ? $time_p ? _JLMS_STATUS_PUB2 : _JLMS_STATUS_PUB : _JLMS_STATUS_UNPUB; $image = $row->published ? $time_p ? 'btn_publish_wait.png' : 'btn_accept.png' : 'btn_cancel.png'; //($time_p?'btn_unpublish_wait.png':'btn_cancel.png'); $start_date_txt = ''; $end_date_txt = ''; $released_info_txt = ''; if ($row->is_time_related) { $released_info_txt = _JLMS_WILL_BE_RELEASED_IN; $showperiod = $row->show_period; $ost1 = $showperiod % (24 * 60); $sp_days = ($showperiod - $ost1) / (24 * 60); $ost2 = $showperiod % 60; $sp_hours = ($ost1 - $ost2) / 60; $sp_mins = $ost2; $released_info_time = false; if ($sp_days) { $released_info_txt .= ' ' . $sp_days . ' ' . _JLMS_RELEASED_IN_DAYS; $released_info_time = true; } if ($sp_hours) { $released_info_txt .= ' ' . $sp_hours . ' ' . _JLMS_RELEASED_IN_HOURS; $released_info_time = true; } if ($sp_mins) { $released_info_txt .= ' ' . $sp_mins . ' ' . _JLMS_RELEASED_IN_MINUTES; $released_info_time = true; } if ($released_info_time) { $released_info_txt .= ' ' . _JLMS_RELEASED_AFTER_ENROLLMENT; } } if ($time_p) { $is_expired = false; if ($row->publish_end) { $end_date_txt = _JLMS_COURSES_END_DATE . ': ' . $row->end_date; $e_date = strtotime($row->end_date); if ($e_date < time()) { $is_expired = true; } } if ($row->publish_start) { $start_date_txt = _JLMS_COURSES_ST_DATE . ': ' . $row->start_date; } if ($is_expired) { $alt = _JLMS_STATUS_EXPIRED; $image = 'btn_expired.png'; } elseif ($row->publish_start && !$is_expired) { $s_date = strtotime($row->start_date); if ($s_date > time()) { $alt = _JLMS_STATUS_UPCOMING; $image = 'btn_expired.png'; } } } $state = $row->published ? 0 : 1; $checked = mosHTML::idBox($i, $row->id); $manage_item = false; $publish_item = false; if ($row->p_manage) { //JLMS_ACL->CheckPermissions('docs', 'manage')) { $manage_item = true; } if ($row->p_publish) { //$JLMS_ACL->CheckPermissions('docs', 'publish')) { $publish_item = true; } if ($JLMS_ACL->CheckPermissions('docs', 'only_own_items') && $row->owner_id != $user->get('id')) { $manage_item = false; $publish_item = false; } elseif ($JLMS_ACL->CheckPermissions('docs', 'only_own_role') && $JLMS_ACL->GetRole() != $JLMS_ACL->UserSystemRole($db, $row->owner_id)) { $manage_item = false; $publish_item = false; } if (!$publish_item && !$manage_item) { $checked = ' '; } // Collapsed/Expanded view $tree_row_style = ''; $visible_folder = true; //$next_row_is_visible; //$next_row_is_visible = true; if ($vis_mode) { if ($row->tree_mode_num < $vis_mode) { $vis_mode = 0; } } if (in_array($row->id, $rows_c)) { //$next_row_is_visible = false; if ($vis_mode) { if ($row->tree_mode_num < $vis_mode) { $vis_mode = $row->tree_mode_num; } else { $visible_folder = false; } } else { $vis_mode = $row->tree_mode_num + 1; } } elseif ($vis_mode) { if ($row->tree_mode_num >= $vis_mode) { $visible_folder = false; } else { $vis_mode = 0; } } if (!$visible_folder) { $tree_row_style = ' style="visibility:hidden;display:none"'; } ?> <tr id="tree_row_<?php echo $row->id; ?> " class="<?php echo JLMSCSS::_('sectiontableentry' . $k); ?> "<?php echo $tree_row_style; ?> > <td align="center" valign="middle"><?php echo $doc_number; ?> </td> <?php if ($possibilities->manage || $possibilities->publish) { ?> <td valign="middle"><?php echo $row->p_manage || $row->p_publish ? $checked : '<input type="checkbox" value="0" name="fake_checkbox' . $row->id . '" style="visibility:hidden" />'; ?> </td> <?php } ?> <?php $add_img = ''; if ($row->tree_mode_num) { $g = 0; $tree_modes[$row->tree_mode_num - 1] = $row->tree_mode; while ($g < $row->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='" . $pref . "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->tree_mode . ".png\" width='16' height='16' alt='sub" . $row->tree_mode . "' /></td>"; $max_tree_width = $max_tree_width - $g - 1; } echo $add_img; ?> <td align="center" valign="middle" width='16'> <?php if ($row->folder_flag == 1) { $collapse_img = 'collapseall.png'; $collapse_alt = _JLMS_DOCS_COLL_FOLDER; if (in_array($row->id, $rows_c)) { $collapse_img = 'expandall.png'; $collapse_alt = _JLMS_DOCS_EXP_FOLDER; } echo "<a class='jlms_img_link' id='tree_div_" . $row->id . "' style='alignment:center; width:16px; font-weight:bold; cursor:pointer; vertical-align:middle;' onclick='Ex_Folder(" . $row->id . "," . $row->id . ",true)' href='javascript:void(0);'><img class='JLMS_png' id='tree_img_" . $row->id . "' src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/docs/{$collapse_img}\" width='13' height='13' border='0' alt='" . $collapse_alt . "' title='" . $collapse_alt . "' /></a>"; } else { echo "<span style='alignment:center; width:16px; font-weight:bold; vertical-align:middle;'><img class='JLMS_png' src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/files/" . $row->file_icon . ".png\" width='16' height='16' alt='{$row->file_icon}' /></span>"; } ?> </td> <td align="left" valign="middle" <?php if ($max_tree_width > 0) { echo "colspan='" . ($max_tree_width + 1) . "'"; } ?> width="<?php echo $row->tree_mode_num == $row->tree_max_width ? '85' : '45'; ?> %"> <span style='font-weight:bold; vertical-align:middle;'> <?php if ($row->folder_flag == 1) { echo ' <strong>' . $row->doc_name . '</strong>'; } else { if (!isset($row->is_link)) { ?> <a href="<?php echo $link; ?> " title="<?php echo str_replace('"', '"', $row->doc_name); ?> "> <?php echo $row->doc_name; ?> </a> <?php } else { echo $row->doc_name; } } ?> </span> <?php if ($JLMS_CONFIG->get('show_docs_authors', 0) && $row->author_name) { ?> <br /> <span class="small"><?php echo _JLMS_HOME_AUTHOR . " " . $row->author_name; ?> </span> <?php } ?> </td> <?php if ($possibilities->order) { ?> <td valign="middle" style="vertical-align:middle "><?php if ($row->allow_up == 1 && $row->p_order) { echo JLMS_orderUpIcon(1, $row->id, true, 'doc_orderup'); } else { echo ' '; } ?> </td> <td valign="middle" style="vertical-align:middle "><?php if ($row->allow_down == 1 && $row->p_order) { echo JLMS_orderDownIcon(1, 3, $row->id, true, 'doc_orderdown'); } else { echo ' '; } ?> </td> <td valign="middle" align="center" style="vertical-align:middle; text-align: center; " colspan="2"> <input type="text" name="order[]" size="5" value="<?php echo $row->ordering; ?> " class="inputbox" style="text-align: center;" /> </td> <?php } ?> <?php if ($possibilities->manage || $possibilities->publish) { ?> <td valign="middle"> <?php if ($publish_item) { $title = $alt; $content = ''; if ($start_date_txt) { $content .= $start_date_txt . '<br />'; } if ($end_date_txt) { $content .= $end_date_txt . '<br />'; } if ($released_info_txt) { $content .= $released_info_txt . '<br />'; } if ($row->is_time_related) { if ($image == 'btn_accept.png') { $image = 'btn_publish_wait.png'; } } $name = '<img 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 . '" />'; $link = 'javascript:submitbutton_change2(\'change_doc\',' . $state . ',' . $row->id . ')'; echo JLMS_toolTip($title, $content, $name, $link); } else { echo '<img 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 . '" />'; } ?> </td> <td align="center" nowrap='nowrap' valign="middle"><?php echo $row->publish_start ? JLMS_dateToDisplay($row->start_date) : '-'; ?> </td> <td align="center" nowrap='nowrap' valign="middle"><?php echo $row->publish_end ? JLMS_dateToDisplay($row->end_date) : '-'; ?> </td> <?php } ?> <td><?php $doc_descr = strip_tags($row->doc_description); $doc_descr = trim($doc_descr); if (!$row->folder_flag && !$row->file_id) { if (strlen($doc_descr) > 75) { $doc_descr = substr($doc_descr, 0, 75) . "..."; } } echo $doc_descr ? $doc_descr : ' '; ?> </td> </tr> <?php $k = 3 - $k; $doc_number++; } // end "if ($row->p_view)" } ?> </table> <?php } else { echo '<div class="joomlalms_user_message">' . _JLMS_NO_ITEMS_HERE . '</div>'; } ?> <input type="hidden" name="option" value="<?php echo $option; ?> " /> <input type="hidden" name="Itemid" value="<?php echo $Itemid; ?> " /> <input type="hidden" name="task" value="" /> <input type="hidden" name="boxchecked" value="0" /> <input type="hidden" name="id" value="<?php echo $id; ?> " /> <input type="hidden" name="row_id" value="0" /> <input type="hidden" name="state" value="0" /> <input type="hidden" name="cid2" value="0" /> </form> <noscript> <style type="text/css"> #jlms_doc_non_scr tr.sectiontableentry1, #jlms_doc_non_scr tr.sectiontableentry2 { display: table-row !important; visibility:visible !important; } </style> <!--[if IE]> <style type="text/css"> #jlms_doc_non_scr tr.sectiontableentry1, #jlms_doc_non_scr tr.sectiontableentry2 { display: block !important; visibility:visible !important; } </style> <![endif]--> </noscript> <?php JLMS_TMPL::CloseTS(); $controls = array(); if ($possibilities->publish) { $controls[] = array('href' => "javascript:submitbutton_change('change_doc',1);", 'title' => _JLMS_SET_PUB, 'img' => 'publish'); $controls[] = array('href' => "javascript:submitbutton_change('change_doc',0);", 'title' => _JLMS_SET_UNPUB, 'img' => 'unpublish'); if ($possibilities->manage) { $controls[] = array('href' => 'spacer'); } } if ($possibilities->create) { $link_foldernew = ampReplace(sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=new_folder&id={$id}")); $link_filenew = ampReplace(sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=new_document&id={$id}")); $controls[] = array('href' => $link_foldernew, 'title' => _JLMS_DOCS_LNK_NEW_FOLDER, 'img' => 'foldernew'); $controls[] = array('href' => $link_filenew, 'title' => _JLMS_DOCS_LNK_NEW_DOC, 'img' => 'filenew'); } if ($possibilities->manage) { $controls[] = array('href' => "javascript:submitbutton('doc_delete');", 'title' => _JLMS_DELETE, 'img' => 'delete'); $controls[] = array('href' => "javascript:submitbutton('edit_doc');", 'title' => _JLMS_EDIT, 'img' => 'edit'); } if ($JLMS_ACL->CheckPermissions('docs', 'manage')) { $controls[] = array('href' => "javascript:submitbutton('add_doclink');", 'title' => _JLMS_DOCS_ADD_FROM_LIBRARY, 'img' => 'add_library'); } if (count($controls)) { JLMS_TMPL::ShowControlsFooter($controls); } JLMS_TMPL::CloseMT(); }
function showCourseDocuments($option, &$rows, &$lists, $is_teacher) { global $Itemid, $my, $JLMS_CONFIG; $JLMS_ACL =& JLMSFactory::getACL(); $is_teacher = $JLMS_ACL->isTeacher(); $can_do_everything = $JLMS_ACL->CheckPermissions('library', 'only_own_items') ? false : ($is_teacher ? true : false); $rows_c = $lists['collapsed_folders']; ?> <script language="javascript" type="text/javascript"> <!--//--><![CDATA[//><!-- function submitbutton(pressbutton) { var form = document.adminForm; if ((pressbutton == 'outdoc_delete') && (form.boxchecked.value == '0')) { alert( "<?php echo _JLMS_ALERT_SELECT_ITEM; ?> " ); } else if((pressbutton == 'outdoc_delete')){ if(confirm('<?php echo _JLMS_OUTDOCS_JS_CONFIRM_DELETE; ?> ')){ form.task.value = pressbutton; form.submit(); } } else if ((pressbutton == 'edit_outdoc') && (form.boxchecked.value == '0')) { alert( "<?php echo _JLMS_ALERT_SELECT_ITEM; ?> " ); } else { form.task.value = pressbutton; form.submit(); } } function submitbutton_change(pressbutton, state) { var form = document.adminForm; if (pressbutton == 'change_outdoc'){ if (form.boxchecked.value == '0') { alert( "<?php echo _JLMS_ALERT_SELECT_ITEM; ?> " ); } else { form.task.value = pressbutton; form.state.value = state; form.submit(); } } } function submitbutton_change2(pressbutton, state, cid_id) { var form = document.adminForm; if (pressbutton == 'change_outdoc'){ form.task.value = pressbutton; form.state.value = state; form.cid2.value = cid_id; form.submit(); } } function submitbutton_order(pressbutton, item_id) { var form = document.adminForm; if ((pressbutton == 'outdoc_orderup') || (pressbutton == 'outdoc_orderdown')){ if (item_id) { form.task.value = pressbutton; form.row_id.value = item_id; form.submit(); } } } var TreeArray1 = new Array(); var TreeArray2 = new Array(); var Is_ex_Array = new Array(); <?php $i = 1; foreach ($rows as $row) { echo "TreeArray1[" . $i . "] = " . $row->parent_id . ";"; echo "TreeArray2[" . $i . "] = " . $row->id . ";"; if (in_array($row->id, $rows_c)) { echo "Is_ex_Array[" . $i . "] = 0;"; } else { echo "Is_ex_Array[" . $i . "] = 1;"; } $i++; } ?> function Hide_Folder(fid) { var vis_style = 'hidden'; var dis_style = 'none'; var i = 1; while (i < TreeArray1.length) { if (TreeArray1[i] == fid) { getObj('tree_row_'+TreeArray2[i]).style.visibility = vis_style; getObj('tree_row_'+TreeArray2[i]).style.display = dis_style; Hide_Folder(TreeArray2[i]) } i ++; } } function Show_Folder(fid) { var vis_style = 'visible'; var dis_style = ''; var i = 1; while (i < TreeArray1.length) { if (TreeArray1[i] == fid) { if (getObj('tree_row_'+TreeArray2[i])) { getObj('tree_row_'+TreeArray2[i]).style.display = dis_style; getObj('tree_row_'+TreeArray2[i]).style.visibility = vis_style; } NoChange_Folder(TreeArray2[i]) } i ++; } } function NoChange_Folder(fid) { var vis_style = 'hidden';var dis_style = 'none';var i = 1;var j = 0; while (i < TreeArray2.length) { if ( (TreeArray2[i] == fid) && (Is_ex_Array[i] == 1) ) { vis_style = 'visible'; dis_style = ''; j = 1; } i ++; } i = 1; while (i < TreeArray1.length) { if (TreeArray1[i] == fid) { getObj('tree_row_'+TreeArray2[i]).style.visibility = vis_style; getObj('tree_row_'+TreeArray2[i]).style.display = dis_style; if (j == 1) { NoChange_Folder(TreeArray2[i]); } else { Hide_Folder(TreeArray2[i]); } } i ++; } } function Ex_Folder(fid) { var i = 1; var j = 1; while (i < TreeArray2.length) { if ( (TreeArray2[i] == fid) && (Is_ex_Array[i] == 1) ) { j = 0; } i ++; } if (j == 1) { Show_Folder(fid); if (getObj('tree_img_' + fid).runtimeStyle) { var StStr = getObj('tree_img_' + fid).runtimeStyle.filter; var imgStr = getObj('tree_img_' + fid).outerHTML; imgStr = imgStr.replace('expandall.png','collapseall.png').replace('<?php echo _JLMS_DOCS_EXP_FOLDER; ?> ', '<?php echo _JLMS_DOCS_COLL_FOLDER; ?> '); StStr = StStr.replace('expandall.png','collapseall.png'); getObj('tree_img_' + fid).outerHTML = imgStr; getObj('tree_img_' + fid).runtimeStyle.filter = StStr; } else { getObj('tree_img_' + fid).src = '<?php echo $JLMS_CONFIG->get('live_site'); ?> /components/com_joomla_lms/lms_images/docs/collapseall.png'; getObj('tree_img_' + fid).alt = '<?php echo _JLMS_DOCS_COLLAPSE; ?> '; getObj('tree_img_' + fid).title = '<?php echo _JLMS_DOCS_COLL_FOLDER; ?> '; } } else { Hide_Folder(fid); if (getObj('tree_img_' + fid).runtimeStyle) { var StStr = getObj('tree_img_' + fid).runtimeStyle.filter; var imgStr = getObj('tree_img_' + fid).outerHTML; imgStr = imgStr.replace('collapseall.png','expandall.png').replace('<?php echo _JLMS_DOCS_COLL_FOLDER; ?> ', '<?php echo _JLMS_DOCS_EXP_FOLDER; ?> '); StStr = StStr.replace('collapseall.png','expandall.png'); getObj('tree_img_' + fid).outerHTML = imgStr; getObj('tree_img_' + fid).runtimeStyle.filter = StStr; } else { getObj('tree_img_' + fid).src = '<?php echo $JLMS_CONFIG->get('live_site'); ?> /components/com_joomla_lms/lms_images/docs/expandall.png'; getObj('tree_img_' + fid).alt = '<?php echo _JLMS_DOCS_EXPAND; ?> '; getObj('tree_img_' + fid).title = '<?php echo _JLMS_DOCS_EXP_FOLDER; ?> '; } } i = 1; while (i < TreeArray2.length) { if ( (TreeArray2[i] == fid) ) { if (Is_ex_Array[i] == 1) { Is_ex_Array[i] = 0; } else { Is_ex_Array[i] = 1; } } i ++; } } JLMS_preloadImages('<?php echo $JLMS_CONFIG->get('live_site'); ?> /components/com_joomla_lms/lms_images/docs/expandall.png','<?php echo $JLMS_CONFIG->get('live_site'); ?> /components/com_joomla_lms/lms_images/docs/collapseall.png'<?php if ($is_teacher) { echo ", '" . $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('ajax_settings_small_indicator') . "'"; } ?> ); //--><!]]> </script> <?php JLMS_TMPL::OpenMT(); $hparams = array('show_menu' => true, 'simple_menu' => true); $toolbar = array(); JLMS_TMPL::ShowHeader('outdocs', _JLMS_TOOLBAR_LIBRARY, $hparams, $toolbar); $max_tree_width = 0; if (isset($rows[0])) { $max_tree_width = $rows[0]->tree_max_width; } JLMS_TMPL::OpenTS('', ' align="right" style="text-align:right " width="100%"'); $is_teacher = $JLMS_ACL->isTeacher(); ?> <form action="<?php echo $JLMS_CONFIG->get('live_site') . "/index.php?option=" . $option . "&Itemid=" . $Itemid; ?> " method="post" name="adminForm" enctype="multipart/form-data"> <?php if (!empty($rows)) { ?> <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 //if ($JLMS_ACL->CheckPermissions('docs', 'manage')) { ?> <<?php echo JLMSCSS::tableheadertag(); ?> width="20" class="<?php echo JLMSCSS::_('sectiontableheader'); ?> "><input type="checkbox" style="visibility:hidden;" /></<?php echo JLMSCSS::tableheadertag(); ?> > <?php //} ?> <?php for ($th_i = 0; $th_i < $max_tree_width + 1; $th_i++) { ?> <<?php echo JLMSCSS::tableheadertag(); ?> width="1%" class="<?php echo JLMSCSS::_('sectiontableheader'); ?> "><span style="display: block; width: 16px;"> </span></<?php echo JLMSCSS::tableheadertag(); ?> > <?php } ?> <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " width="45%"><span style="display: block; width: 150px; text-align: left;"><?php echo _JLMS_DOCS_TBL_DOCNAME; ?> </span></<?php echo JLMSCSS::tableheadertag(); ?> > <?php //if ($JLMS_ACL->CheckPermissions('docs', 'manage')) { ?> <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " colspan="2"> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " width="1"> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> "><?php echo _JLMS_DOCS_TBL_STARTING; ?> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> "><?php echo _JLMS_DOCS_TBL_ENDING; ?> </<?php echo JLMSCSS::tableheadertag(); ?> > <?php //} ?> <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " width="60%"><?php echo _JLMS_DOCS_TBL_DESCR; ?> </<?php echo JLMSCSS::tableheadertag(); ?> > </tr> <?php $k = 1; $tree_modes = array(); $visible_folder = true; //$next_row_is_visible = true; $vis_mode = 0; for ($i = 0, $n = count($rows); $i < $n; $i++) { $row = $rows[$i]; $max_tree_width = $row->tree_max_width; $link = ''; $link_title = ''; if ($row->folder_flag == 2) { $link = sefRelToAbs("index.php?option=" . $option . "&Itemid=" . $Itemid . "&task=docs_view_zip&id=" . $row->id); $link_title = _JLMS_T_A_VIEW_ZIP_PACK; } elseif (!$row->folder_flag && $row->file_id) { $link = sefRelToAbs("index.php?option=" . $option . "&Itemid=" . $Itemid . "&task=get_outdoc&id=" . $row->id); $link_title = _JLMS_DOCS_LINK_DOWNLOAD; } elseif (!$row->folder_flag && !$row->file_id) { $link = sefRelToAbs("index.php?option=" . $option . "&Itemid=" . $Itemid . "&task=outdocs_view_content&id=" . $row->id); $link_title = _JLMS_T_A_VIEW_CONTENT; } elseif ($row->folder_flag == 3 && $row->file_id) { $link = sefRelToAbs("index.php?option=" . $option . "&Itemid=" . $Itemid . "&task=playerSCORMFiles&id=" . $row->file_id . "&doc_id=" . $row->id); $link_title = _JLMS_T_A_VIEW_CONTENT; } $time_p = $row->publish_start || $row->publish_end; $alt = $row->published ? $time_p ? _JLMS_STATUS_PUB2 : _JLMS_STATUS_PUB : _JLMS_STATUS_UNPUB; $image = $row->published ? $time_p ? 'btn_publish_wait.png' : 'btn_accept.png' : 'btn_cancel.png'; //($time_p?'btn_unpublish_wait.png':'btn_cancel.png'); if ($time_p) { $is_expired = false; if ($row->publish_start) { $s_date = strtotime($row->start_date); if ($s_date > time()) { $is_expired = true; } } if ($row->publish_end && !$is_expired) { $e_date = strtotime($row->end_date); if ($e_date < time()) { $is_expired = true; } } if ($is_expired) { $alt = _JLMS_STATUS_EXPIRED; $image = 'btn_expired.png'; } } $state = $row->published ? 0 : 1; $checked = mosHTML::idBox($i, $row->id); // Collapsed/Expanded view $tree_row_style = ''; $visible_folder = true; //$next_row_is_visible; //$next_row_is_visible = true; if ($vis_mode) { if ($row->tree_mode_num < $vis_mode) { $vis_mode = 0; } } if (in_array($row->id, $rows_c)) { //$next_row_is_visible = false; if ($vis_mode) { if ($row->tree_mode_num < $vis_mode) { $vis_mode = $row->tree_mode_num; } else { $visible_folder = false; } } else { $vis_mode = $row->tree_mode_num + 1; } } elseif ($vis_mode) { if ($row->tree_mode_num >= $vis_mode) { $visible_folder = false; } else { $vis_mode = 0; } } if (!$visible_folder) { $tree_row_style = ' style="visibility:hidden;display:none"'; } ?> <tr id="tree_row_<?php echo $row->id; ?> " class="<?php echo JLMSCSS::_('sectiontableentry' . $k); ?> "<?php echo $tree_row_style; ?> > <td align="center" valign="middle"><?php echo $i + 1; ?> </td> <td valign="middle"><?php if ($my->id == $row->owner_id || $can_do_everything) { echo $checked; } ?> </td> <?php $add_img = ''; if ($row->tree_mode_num) { $g = 0; $tree_modes[$row->tree_mode_num - 1] = $row->tree_mode; while ($g < $row->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='" . $pref . "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->tree_mode . ".png\" width='16' height='16' alt='sub" . $row->tree_mode . "' /></td>"; $max_tree_width = $max_tree_width - $g - 1; } echo $add_img; ?> <td align="center" valign="middle" width='16'> <?php if ($row->folder_flag == 1) { $collapse_img = 'collapseall.png'; $collapse_alt = _JLMS_DOCS_COLL_FOLDER; if (in_array($row->id, $rows_c)) { $collapse_img = 'expandall.png'; $collapse_alt = _JLMS_DOCS_EXP_FOLDER; } echo "<span id='tree_div_" . $row->id . "' style='alignment:center; width:16px; font-weight:bold; cursor:pointer; vertical-align:middle;' onclick='Ex_Folder(" . $row->id . "," . $row->id . ",true)'><img class='JLMS_png' id='tree_img_" . $row->id . "' src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/docs/{$collapse_img}\" width='13' height='13' alt='" . $collapse_alt . "' title='" . $collapse_alt . "' /></span>"; } else { echo "<span style='alignment:center; width:16px; font-weight:bold; vertical-align:middle;'><img class='JLMS_png' src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/files/" . $row->file_icon . ".png\" width='16' height='16' alt='{$row->file_icon}' /></span>"; } ?> </td> <td align="left" valign="middle" <?php if ($max_tree_width > 0) { echo "colspan='" . ($max_tree_width + 1) . "'"; } ?> width="45%"> <span style='font-weight:bold; vertical-align:middle;'> <?php if ($row->folder_flag == 1) { echo ' <strong>' . $row->doc_name . '</strong>'; } else { ?> <?php if ($is_teacher && $row->outdoc_share || !$is_teacher && $row->outdoc_share == 2 || $my->id == $row->owner_id || $can_do_everything) { $add_link_params = ''; if ($row->folder_flag == 3 && isset($row->scorm_params) && $row->scorm_params) { $tmp_params = new JLMSParameters($row->scorm_params); if ($tmp_params->get('scorm_layout', 0) == 1) { $x_size = 0; $y_size = 0; if (isset($row->scorm_width) && $row->scorm_width > 100) { $x_size = $row->scorm_width; } if (isset($row->scorm_height) && $row->scorm_height > 100) { $y_size = $row->scorm_height; } $add_link_params = ' class="scorm_modal" rel="{handler:\'iframe\', size:{x:' . $x_size . ',y:' . $y_size . '}}"'; JLMS_initialize_SqueezeBox(); } } if ($link) { ?> <a href="<?php echo $link; ?> "<?php echo $add_link_params; ?> title="<?php echo str_replace('"', '"', $row->doc_name); ?> "> <?php } ?> <?php } ?> <?php echo $row->doc_name; ?> <?php if ($is_teacher && $row->outdoc_share || !$is_teacher && $row->outdoc_share == 2 || $my->id == $row->owner_id || $can_do_everything) { if ($link) { ?> </a> <?php } ?> <?php } } ?> </span> <?php if ($JLMS_CONFIG->get('show_library_authors', 0) && $row->author_name) { ?> <br /> <span class="small"><?php echo _JLMS_HOME_AUTHOR . " " . $row->author_name; ?> </span> <?php } ?> </td> <?php //if ($JLMS_ACL->CheckPermissions('docs', 'manage')) { ?> <td valign="middle" style="vertical-align:middle "><?php if ($row->allow_up == 1 && ($my->id == $row->owner_id || $can_do_everything)) { echo JLMS_orderUpIcon(1, $row->id, true, 'outdoc_orderup'); } else { echo ' '; } ?> </td> <td valign="middle" style="vertical-align:middle "><?php if ($row->allow_down == 1 && ($my->id == $row->owner_id || $can_do_everything)) { echo JLMS_orderDownIcon(1, 3, $row->id, true, 'outdoc_orderdown'); } else { echo ' '; } ?> </td> <td valign="middle"> <?php if ($my->id == $row->owner_id || $can_do_everything) { echo '<a class="jlms_img_link" href="javascript:submitbutton_change2(\'change_outdoc\',' . $state . ',' . $row->id . ')" title="' . $alt . '">'; echo '<img 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 . '" />'; echo '</a>'; } else { echo ' '; } ?> </td> <td align="center" nowrap='nowrap' valign="middle"><?php echo $row->publish_start ? JLMS_dateToDisplay($row->start_date) : '-'; ?> </td> <td align="center" nowrap='nowrap' valign="middle"><?php echo $row->publish_end ? JLMS_dateToDisplay($row->end_date) : '-'; ?> </td> <?php //} ?> <td><?php $doc_descr = strip_tags($row->doc_description); if (!$row->folder_flag && !$row->file_id) { if (strlen($doc_descr) > 75) { $doc_descr = substr($doc_descr, 0, 75) . "..."; } } echo $doc_descr ? $doc_descr : ' '; ?> </td> </tr> <?php $k = 3 - $k; } ?> </table> <?php } else { echo '<div class="joomlalms_user_message">' . _JLMS_NO_ITEMS_HERE . '</div>'; } ?> <input type="hidden" name="option" value="<?php echo $option; ?> " /> <input type="hidden" name="Itemid" value="<?php echo $Itemid; ?> " /> <input type="hidden" name="task" value="" /> <input type="hidden" name="boxchecked" value="0" /> <input type="hidden" name="row_id" value="0" /> <input type="hidden" name="state" value="0" /> <input type="hidden" name="cid2" value="0" /> </form> <?php JLMS_TMPL::CloseTS(); //if ($JLMS_ACL->CheckPermissions('docs', 'manage')) { if ($is_teacher) { $link_foldernew = ampReplace(sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=new_outfolder")); $link_filenew = ampReplace(sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=new_outdocs")); $link_scormnew = ampReplace(sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=new_scorm")); $controls = array(); $controls[] = array('href' => "javascript:submitbutton_change('change_outdoc',1);", 'title' => _JLMS_SET_PUB, 'img' => 'publish'); $controls[] = array('href' => "javascript:submitbutton_change('change_outdoc',0);", 'title' => _JLMS_SET_UNPUB, 'img' => 'unpublish'); $controls[] = array('href' => 'spacer'); $controls[] = array('href' => $link_foldernew, 'title' => _JLMS_DOCS_LNK_NEW_FOLDER, 'img' => 'foldernew'); $controls[] = array('href' => $link_filenew, 'title' => _JLMS_DOCS_LNK_NEW_DOC, 'img' => 'filenew'); $controls[] = array('href' => "javascript:submitbutton('outdoc_delete');", 'title' => _JLMS_DELETE, 'img' => 'delete'); $controls[] = array('href' => "javascript:submitbutton('edit_outdoc');", 'title' => _JLMS_EDIT, 'img' => 'edit'); $controls[] = array('href' => $link_scormnew, 'title' => _JLMS_DOCS_NEW_SCORM_PACKAGE, 'img' => 'add_scorm'); JLMS_TMPL::ShowControlsFooter($controls); //} } JLMS_TMPL::CloseMT(); }
function showHomeWorks($id, $option, &$rows, &$pageNav, $usertype = 1) { global $JLMS_CONFIG; $Itemid = $JLMS_CONFIG->get('Itemid'); $JLMS_ACL =& JLMSFactory::getACL(); if ($JLMS_ACL->CheckPermissions('homework', 'manage')) { ?> <script language="javascript" type="text/javascript"> <!--//--><![CDATA[//><!-- function submitbutton(pressbutton) { var form = document.adminForm; if ( ((pressbutton == 'hw_delete') || (pressbutton == 'hw_edit')) && (form.boxchecked.value == "0")){ alert("<?php echo _JLMS_ALERT_SELECT_ITEM; ?> "); } else { form.task.value = pressbutton; form.submit(); } } function submitbutton_change2(pressbutton, state, cid_id) { var form = document.adminForm; if (pressbutton == 'hw_publish'){ form.task.value = pressbutton; form.state.value = state; form.cid2.value = cid_id; form.submit(); } } //--><!]]> </script> <?php } JLMS_TMPL::OpenMT(); $hparams = array(); JLMS_TMPL::ShowHeader('homework', _JLMS_HW_TITLE_HW, $hparams); JLMS_TMPL::OpenTS(); ?> <form action="<?php echo sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}"); ?> " method="post" name="adminForm"> <?php if (!empty($rows)) { ?> <?php $hw_colspan = 5; ?> <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 // if ($usertype == 1) { if ($JLMS_ACL->CheckPermissions('homework', 'manage')) { $hw_colspan++; ?> <<?php echo JLMSCSS::tableheadertag(); ?> width="20" class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " align="center"><input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count($rows); ?> );" /></<?php echo JLMSCSS::tableheadertag(); ?> > <?php } ?> <<?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'); ?> " nowrap='nowrap' style="white-space:nowrap"><?php echo _JLMS_HW_TBL_HEAD_DATE; ?> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " nowrap='nowrap' style="white-space:nowrap"><?php echo _JLMS_HW_TBL_HEAD_ENDDATE; ?> </<?php echo JLMSCSS::tableheadertag(); ?> > <?php if ($JLMS_ACL->CheckPermissions('homework', 'manage')) { $hw_colspan++; ?> <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " nowrap='nowrap' style="white-space:nowrap"> </<?php echo JLMSCSS::tableheadertag(); ?> > <?php } ?> <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " width="50%"><?php echo _JLMS_HW_TBL_HEAD_DESCR; ?> </<?php echo JLMSCSS::tableheadertag(); ?> > </tr> <?php $k = 1; for ($i = 0, $n = count($rows); $i < $n; $i++) { $row = $rows[$i]; $link = "index.php?option={$option}&Itemid={$Itemid}&task=hw_stats&course_id={$id}&id={$row->id}"; $alt = $row->published ? _JLMS_STATUS_PUB : _JLMS_STATUS_UNPUB; $image = $row->published ? 'btn_accept.png' : 'btn_cancel.png'; $state = $row->published ? 0 : 1; $tooltip_txt = ''; $tooltip_title = ''; if ($row->is_time_related) { if ($row->published) { $image = 'btn_publish_wait.png'; $tooltip_title = _JLMS_STATUS_PUB; } else { $image = 'btn_unpublish_wait.png'; $tooltip_title = _JLMS_STATUS_UNPUB; } $tooltip_txt = _JLMS_WILL_BE_RELEASED_IN; $showperiod = $row->show_period; $ost1 = $showperiod % (24 * 60); $sp_days = ($showperiod - $ost1) / (24 * 60); $ost2 = $showperiod % 60; $sp_hours = ($ost1 - $ost2) / 60; $sp_mins = $ost2; $release_time_info = false; if ($sp_days) { $tooltip_txt .= ' ' . $sp_days . ' ' . _JLMS_RELEASED_IN_DAYS; $release_time_info = true; } if ($sp_hours) { $tooltip_txt .= ' ' . $sp_hours . ' ' . _JLMS_RELEASED_IN_HOURS; $release_time_info = true; } if ($sp_mins) { $tooltip_txt .= ' ' . $sp_mins . ' ' . _JLMS_RELEASED_IN_MINUTES; $release_time_info = true; } if ($release_time_info) { $tooltip_txt .= ' ' . _JLMS_RELEASED_AFTER_ENROLLMENT; } } $checked = ''; if ($JLMS_ACL->CheckPermissions('homework', 'manage')) { $checked = mosHTML::idBox($i, $row->id, $row->checkedout); } ?> <tr class="<?php echo JLMSCSS::_('sectiontableentry' . $k); ?> "> <td align="center"><?php echo $pageNav->limitstart + $i + 1; ?> </td> <?php if ($JLMS_ACL->CheckPermissions('homework', 'manage')) { echo '<td>' . $checked . '</td>'; } ?> <td align="left" valign="middle" style="vertical-align:middle "> <a href="<?php echo sefRelToAbs($link); ?> " title="<?php echo str_replace('"', ' ', $row->hw_name); ?> "> <?php echo $row->hw_name; ?> </a> </td> <td valign="middle" style="vertical-align:middle" nowrap="nowrap"> <?php echo JLMS_dateToDisplay($row->post_date); ?> </td> <td valign="middle" style="vertical-align:middle" nowrap="nowrap"> <?php echo JLMS_dateToDisplay($row->end_date); ?> </td> <?php if ($JLMS_ACL->CheckPermissions('homework', 'manage')) { ?> <td valign="middle"> <?php if ($row->is_time_related) { $tooltip_link = 'javascript:submitbutton_change2(\'hw_publish\',' . $state . ',' . $row->id . ')'; $tooltip_name = '<img 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 . '" />'; echo JLMS_toolTip($tooltip_title, $tooltip_txt, $tooltip_name, $tooltip_link); } else { echo '<a class="jlms_img_link" href="javascript:submitbutton_change2(\'hw_publish\',' . $state . ',' . $row->id . ')" title="' . $alt . '">'; echo '<img 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 . '" />'; echo '</a>'; } ?> </td> <?php } ?> <td valign="middle" style="vertical-align:middle "><?php echo $row->hw_shortdescription ? $row->hw_shortdescription : ' '; ?> </td> </tr> <?php $k = 3 - $k; } ?> <tr> <td align="center" class="<?php echo JLMSCSS::_('jlmslist-footer_td'); ?> " colspan="<?php echo $hw_colspan; ?> "><div align="center" style="white-space:nowrap;"> <?php $link = "index.php?option={$option}&Itemid={$Itemid}&task=homework&id={$id}"; echo _JLMS_PN_DISPLAY_NUM . $pageNav->getLimitBox($link) . ' ' . $pageNav->getPagesCounter(); echo '<br />'; echo $pageNav->writePagesLinks($link); ?> </div></td> </tr> </table> <?php } else { echo '<div class="joomlalms_user_message">' . _JLMS_NO_ITEMS_HERE . '</div>'; } ?> <input type="hidden" name="option" value="<?php echo $option; ?> " /> <input type="hidden" name="Itemid" value="<?php echo $Itemid; ?> " /> <input type="hidden" name="task" value="homework" /> <input type="hidden" name="boxchecked" value="0" /> <input type="hidden" name="id" value="<?php echo $id; ?> " /> <input type="hidden" name="state" value="0" /> <input type="hidden" name="cid2" value="0" /> </form> <?php JLMS_TMPL::CloseTS(); if ($id && $JLMS_ACL->CheckPermissions('homework', 'manage')) { $link_new = sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=hw_create&id={$id}"); $controls = array(); $controls[] = array('href' => $link_new, 'onclick' => "", 'title' => _JLMS_HW_IMG_NEW_HW, 'img' => 'add'); $controls[] = array('href' => "javascript:submitbutton('hw_delete');", 'title' => _JLMS_HW_IMG_DEL_HW, 'img' => 'delete'); $controls[] = array('href' => "javascript:submitbutton('hw_edit');", 'title' => _JLMS_HW_IMG_EDIT_HW, 'img' => 'edit'); JLMS_TMPL::ShowControlsFooter($controls); } JLMS_TMPL::CloseMT(); }
function JLMS_REP_exportCsv($hits, $tot_hits = array(), $users, $courses, $pageNav, $lists, $levels, $filt_cat, $filt_group, $option, $is_full) { global $JLMS_DB, $JLMS_CONFIG, $JLMS_SESSION, $task; switch ($task) { case 'report_access': $users_str = implode(',', $users); $courses_str = implode(',', $courses); $JLMS_DB->setQuery('SELECT course_name FROM #__lms_courses WHERE id IN(' . $courses_str . ') ORDER BY course_name'); $crs_name = $JLMS_DB->loadResultArray(); $JLMS_DB->setQuery('SELECT * FROM #__lms_courses WHERE id IN(' . $courses_str . ') ORDER BY course_name'); $crs_options = $JLMS_DB->loadObjectList(); $text_to_csv = 'username,name,email,'; $array_zagolovk = array(); foreach ($crs_name as $key => $c_name) { $view_is_course = 1; if ($JLMS_CONFIG->get('flms_integration', 1)) { $params = new JLMSParameters($crs_options[$key]->params); $view_is_course = $params->get('show_in_report', 1); } if ($view_is_course) { $array_zagolovk[] = JLMS_processCSVField($c_name); //echo '<th class="sectiontableheader" style="text-align:center;">'.$c_name.'</th>'; } } $zagolovk = implode(',', $array_zagolovk); if ($zagolovk) { $text_to_csv .= $zagolovk . "\n"; } else { $text_to_csv .= "\n"; } $zzz = 0; foreach ($users as $usr_id) { $JLMS_DB->setQuery('SELECT username,name, email FROM #__users WHERE id =' . $usr_id); $usrname = $JLMS_DB->LoadObject(); $course_hits = 0; $text_to_csv .= $usrname->username . ',' . JLMS_processCSVField($usrname->name) . ',' . $usrname->email . ','; $count = 0; foreach ($courses as $key => $course_id) { $count++; $hit_num = 0; for ($i = 0; $i < count($hits); $i++) { if ($hits[$i]->c_id == $course_id && $hits[$i]->usr_id == $usr_id) { $hit_num = $hits[$i]->hits; break; // by DEN } } $view_is_course = 1; if ($JLMS_CONFIG->get('flms_integration', 1)) { $params = new JLMSParameters($crs_options[$key]->params); $view_is_course = $params->get('show_in_report', 1); } if ($view_is_course) { $text_to_csv .= $hit_num; if ($count != count($courses)) { $text_to_csv .= ','; } } } $text_to_csv .= "\n"; $zzz++; } $text_to_csv .= 'Total,,,'; $results_total_hits = array(); $k = 0; foreach ($courses as $i => $course_id) { foreach ($tot_hits as $j => $hit) { if ($course_id == $hit->c_id) { foreach ($hit as $key => $tmp_hit) { if ($key == 'hits') { $results_total_hits[] = $tmp_hit; $k++; } } } } } $text_to_csv .= implode(",", $results_total_hits); $text_to_csv .= "\n"; break; case 'report_certif': $users_str = implode(',', $users); $courses_str = implode(',', $courses); $query = "SELECT h.user_id as usr_id,h.course_id as c_id FROM #__lms_certificate_users as h LEFT JOIN #__users as u ON h.user_id=u.id LEFT JOIN #__lms_courses as c ON h.course_id = c.id WHERE h.course_id IN (" . $courses_str . ") AND h.user_id IN (" . $users_str . ") ORDER BY h.course_id,h.user_id"; $JLMS_DB->SetQuery($query); $hits = $JLMS_DB->LoadObjectLIST(); $JLMS_DB->setQuery('SELECT course_name FROM #__lms_courses WHERE id IN(' . $courses_str . ') ORDER BY course_name'); $crs_name = $JLMS_DB->loadResultArray(); $JLMS_DB->setQuery('SELECT * FROM #__lms_courses WHERE id IN(' . $courses_str . ') ORDER BY course_name'); $crs_options = $JLMS_DB->loadObjectList(); $text_to_csv = 'username,name,email,'; $array_zagolovk = array(); foreach ($crs_name as $key => $c_name) { $view_is_course = 1; if ($JLMS_CONFIG->get('flms_integration', 1)) { $params = new JLMSParameters($crs_options[$key]->params); $view_is_course = $params->get('show_in_report', 1); } if ($view_is_course) { $array_zagolovk[] = JLMS_processCSVField($c_name); //echo '<th class="sectiontableheader" style="text-align:center;">'.$c_name.'</th>'; } } $zagolovk = implode(',', $array_zagolovk); if ($zagolovk) { $text_to_csv .= $zagolovk . "\n"; } else { $text_to_csv .= "\n"; } $zzz = 0; foreach ($users as $usr_id) { $JLMS_DB->setQuery('SELECT username,name, email FROM #__users WHERE id =' . $usr_id); $usrname = $JLMS_DB->LoadObject(); $course_hits = 0; $text_to_csv .= $usrname->username . ',' . JLMS_processCSVField($usrname->name) . ',' . $usrname->email . ','; $count = 0; foreach ($courses as $key => $course_id) { $count++; $hit_num = _JLMS_NO_ALT_TITLE; for ($i = 0; $i < count($hits); $i++) { if ($hits[$i]->c_id == $course_id && $hits[$i]->usr_id == $usr_id) { $hit_num = _JLMS_YES_ALT_TITLE; break; // by DEN } } $view_is_course = 1; if ($JLMS_CONFIG->get('flms_integration', 1)) { $params = new JLMSParameters($crs_options[$key]->params); $view_is_course = $params->get('show_in_report', 1); } if ($view_is_course) { $text_to_csv .= $hit_num; if ($count != count($courses)) { $text_to_csv .= ','; } } } $text_to_csv .= "\n"; $zzz++; } break; case 'report_scorm': $rows = $courses; $array_zagolovk = array(); $array_zagolovk[] = 'Username'; $array_zagolovk[] = 'Name'; $array_zagolovk[] = 'Email'; $array_zagolovk[] = 'Course Name'; $array_zagolovk[] = 'Course ID'; $array_zagolovk[] = 'Date'; $array_zagolovk[] = 'Score'; $array_zagolovk[] = 'Course Status'; $zagolovk = implode(',', $array_zagolovk); $text_to_csv = ''; if ($zagolovk) { $text_to_csv .= $zagolovk . "\n"; } else { $text_to_csv .= "\n"; } foreach ($rows as $row) { $text = array(); $text[] = $row->username; $text[] = JLMS_processCSVField($row->name); $text[] = $row->email; $text[] = JLMS_processCSVField($row->course_name); $text[] = JLMS_processCSVField($row->lpath_name); if (isset($row->scorm_data) && $row->scorm_data->status) { if ($row->scorm_data->end) { $date_end = date("Y-m-d H:i:s", $row->scorm_data->end); $text[] = JLMS_dateToDisplay($date_end); } else { $text[] = ''; } } else { $text[] = ''; } if (isset($row->scorm_data)) { $text[] = $row->scorm_data->score; } else { $text[] = ''; } if ($row->course_status) { $text[] = 'Completed'; } else { $text[] = 'Incompleted'; } $text_to_csv .= implode(",", $text); $text_to_csv .= "\n"; } break; } global $task; if ($task == 'report_access') { $tmpl_name = 'access_report'; $prefix_title = str_replace("_", " ", $tmpl_name); } else { if ($task == 'report_certif') { $tmpl_name = 'completion_report'; $prefix_title = str_replace("_", " ", $tmpl_name); } else { if ($task == 'report_grade') { $tmpl_name = 'user_report'; $prefix_title = str_replace("_", " ", $tmpl_name); } else { if ($task == 'report_scorm') { $tmpl_name = 'scorm_report'; $prefix_title = str_replace("_", " ", $tmpl_name); } } } } $ug_name = $tmpl_name . '_' . date('dMY'); if (preg_match('/Opera(\\/| )([0-9].[0-9]{1,2})/', $_SERVER['HTTP_USER_AGENT'])) { $UserBrowser = "Opera"; } elseif (preg_match('/MSIE ([0-9].[0-9]{1,2})/', $_SERVER['HTTP_USER_AGENT'])) { $UserBrowser = "IE"; } else { $UserBrowser = ''; } header("Content-type: application/csv"); header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT'); header("Content-Length: " . strlen(trim($text_to_csv))); header('Content-Disposition: attachment; filename="' . $ug_name . '.csv"'); if ($UserBrowser == 'IE') { header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); } else { header('Pragma: no-cache'); } echo $text_to_csv; exit; }
function gbUserPDF($id, $option, &$rows, &$lists) { global $Itemid, $JLMS_CONFIG, $JLMS_DB; $juser = JLMSFactory::getUser(); $JLMS_ACL =& JLMSFactory::getACL(); chdir(JPATH_SITE); if (file_exists(JPATH_SITE . DS . 'components' . DS . 'com_joomla_lms' . DS . 'includes' . DS . 'pdf' . DS . 'lms.pdf.php')) { include JPATH_SITE . DS . 'components' . DS . 'com_joomla_lms' . DS . 'includes' . DS . 'pdf' . DS . 'lms.pdf.php'; } else { die('Unable to print PDF'); } $pdf = new JLMSPDF('P', 'mm', 'A4', true, 'UTF-8', false); //A4 Portrait $pdf->SetMargins(10, 10, 10, true); $pdf->SetDrawColor(0, 0, 0); $header = "<br /><div align=\"center\">" . $JLMS_CONFIG->get('course_name') . "</div>"; $footer = "\n\t\t\t<hr />\n\t\t\t<table>\n\t\t\t <tr>\n\t\t\t <td align=\"left\">" . $JLMS_CONFIG->get('sitename') . ' - ' . $JLMS_CONFIG->get('live_site') . "</td>\n\t\t"; if ($JLMS_CONFIG->get('is_trial')) { $footer .= "<td align=\"center\">Powered by JoomlaLMS (www.joomlalms.com)</td>"; } $footer .= "\n\t\t\t <td align=\"right\">" . date('j F, Y, H:i', time() + $JLMS_CONFIG->get('offset') * 60 * 60) . "</td>\n\t\t\t </tr>\t\t \n\t\t\t</table>\n\t\t"; $pdf->setHeaderFont(array('freesans', '', 6)); $pdf->setHeaderHTML($header); $pdf->setFooterMargin(5); $pdf->setFooterFont(array('freesans', '', 6)); $pdf->setFooterHTML($footer); $pdf->addPage(); $pdf->setFont('freesans'); //choose font $pdf->SetFontSize(8); ob_clean(); ob_start(); ?> <table width="100%"> <tr> <td align="right"> <font size="10"><?php if ($rows[0]->user_certificate) { echo $JLMS_ACL->CheckPermissions('gradebook', 'manage') ? _JLMS_COURSE_COMPLETED_ADMIN : ($juser->get('id') == $rows[0]->user_id ? _JLMS_COURSE_COMPLETED_USER : _JLMS_COURSE_COMPLETED_ADMIN); echo str_repeat(' ', 15); } ?> </font> </td> </tr> </table> <br /> <?php $params_cs = array(); if ($JLMS_ACL->CheckPermissions('gradebook', 'manage') && !empty($lists['enrollment_answers'])) { ?> <table width="100%"> <tr> <td width="50%" valign="top"> <div><strong><font size="10"><?php echo _JLMS_GB_USER_INFORMATION; ?> </font></strong></div> <table width="100%" cellpadding="0" cellspacing="0" border="0" > <tr> <td width="20%" align="left"><strong><?php echo _JLMS_UI_USERNAME; ?> </strong></td> <td align="left"><?php echo $rows[0]->username; ?> </td> </tr> <tr> <td align="left"><strong><?php echo _JLMS_UI_NAME; ?> </strong></td> <td align="left"><?php echo $rows[0]->name; ?> </td> </tr> <tr> <td align="left"><strong><?php echo _JLMS_UI_EMAIL; ?> </strong></td> <td align="left"><?php echo $rows[0]->email; ?> </td> </tr> <tr> <td align="left"><strong><?php echo _JLMS_UI_GROUP; ?> </strong></td> <td align="left"><?php echo $rows[0]->ug_name ? $rows[0]->ug_name : ' '; ?> </td> </tr> </table> </td> <td width="50%" valign="top"> <div><strong><font size="10"><?php echo _JLMS_GB_REG_INFORMATION; ?> </font></strong></div> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <?php foreach ($lists['enrollment_answers'] as $ea) { echo '<tr><td width: "30%"><strong>' . $ea->course_question . '</strong></td><td>' . ($ea->user_answer ? $ea->user_answer : ' ') . '</td></tr>'; } ?> </table> </td> </tr> </table> <?php } else { ?> <table width="100%" cellpadding="0" cellspacing = "0"> <tr><td width="20%" align="left"><strong><?php echo _JLMS_UI_USERNAME; ?> </strong></td><td align="left"><?php echo $rows[0]->username; ?> </td></tr> <tr><td align="left"><strong><?php echo _JLMS_UI_NAME; ?> </strong></td><td align="left"><?php echo $rows[0]->name; ?> </td></tr> <tr><td align="left"><strong><?php echo _JLMS_UI_EMAIL; ?> </strong></td><td align="left"><?php echo $rows[0]->email; ?> </td></tr> <tr><td align="left"><strong><?php echo _JLMS_UI_GROUP; ?> </strong></td><td align="left"><?php echo $rows[0]->ug_name ? $rows[0]->ug_name : ' '; ?> </td></tr> </table> <?php } $html = ob_get_contents(); ob_end_flush(); ob_clean(); $pdf->writeHTML($html, true, false, false, false, ''); $pdf->setY($pdf->GetY() + 20); /** * Certificates MOD - 04.10.2007 (DEN) * We will show the list of all achieved certificates in the User Gradebook */ $query = "SELECT count(*) FROM #__lms_certificates WHERE course_id = '" . $id . "' AND published = 1 AND crtf_type = 1 AND parent_id = 0"; $JLMS_DB->SetQuery($query); $is_course_certificate = $JLMS_DB->loadResult(); if (!empty($lists['user_quiz_certificates']) || isset($rows[0]->user_certificate) && $rows[0]->user_certificate && $is_course_certificate) { $pdf->setFontSize(10); $pdf->setFont('freesansb'); //choose font $pdf->Cell(0, 10, _JLMS_GB_CERTIFICATES, '', 1, 'L'); $pdf->setFont('freesans'); //choose font $pdf->setFontSize(8); ob_clean(); ob_start(); $old_format = $JLMS_CONFIG->get('date_format', 'Y-m-d'); $new_format = $JLMS_CONFIG->get('gradebook_certificate_date', ''); if ($new_format) { $JLMS_CONFIG->set('date_format', $new_format); } echo '<table width="100%" cellpadding="0" cellspacing="0" border="1">'; foreach ($lists['user_quiz_certificates'] as $crtf_row) { ?> <tr> <td width="50%" align="left"> <strong><?php echo $crtf_row->quiz_name; ?> </strong></td> <td align="center"><?php echo JLMS_dateToDisplay($crtf_row->crtf_date); ?> </td> </tr> <?php } if (isset($rows[0]->user_certificate) && $rows[0]->user_certificate && $is_course_certificate) { $cert_user_id = 0; if (isset($lists['user_id']) && $lists['user_id']) { global $my; if ($my->id == $lists['user_id']) { } else { $cert_user_id = $lists['user_id']; } } ?> <tr> <td width="50%" align="left"> <strong><?php echo _JLMS_GB_COURSE_CERTIFICATE; ?> </strong></td> <td align="center"><?php echo JLMS_dateToDisplay($rows[0]->user_certificate_date); ?> </td> </tr> <?php } $JLMS_CONFIG->set('date_format', $old_format); echo '</table>'; $html = ob_get_contents(); ob_end_flush(); ob_clean(); $pdf->writeHTML($html, true, false, false, false, ''); } /* END of Certificates MOD */ if (count($lists['sc_rows'])) { $is_shown = 0; foreach ($lists['sc_rows'] as $sc_row) { if ($sc_row->show_in_gradebook) { $is_shown++; if ($is_shown == 1) { $pdf->setFontSize(10); $pdf->setFont('freesansb'); //choose font $pdf->cell(0, 10, _JLMS_GB_SCORM_RESULTS, '', 1, 'L'); $pdf->setFont('freesans'); //choose font $pdf->setFontSize(8); ob_clean(); ob_start(); echo '<table width="100%" cellpadding="0" cellspacing="0" border="1">'; } $j = 0; while ($j < count($rows[0]->scorm_info)) { if ($rows[0]->scorm_info[$j]->gbi_id == $sc_row->item_id) { if ($rows[0]->scorm_info[$j]->user_status == -1) { ?> <tr> <td width="50%" align="left"> <strong><?php echo $sc_row->lpath_name; ?> </strong></td> <td width="20%" align="center"> - </td> <td width="30%" align="center"> </td> </tr> <?php } else { $status = $rows[0]->scorm_info[$j]->user_status ? _JLMS_GB_SCORM_COMPLETED : _JLMS_GB_SCORM_INCOMPLETED; ?> <tr> <td width="50%" align="left"> <strong><?php echo $sc_row->lpath_name; ?> </strong></td> <td width="20%" align="center"><strong><?php echo $status; ?> </strong></td> <td width="30%" align="center"><b><?php echo $rows[0]->scorm_info[$j]->user_grade . "</b> (" . $rows[0]->scorm_info[$j]->user_pts . _JLMS_GB_POINTS . ")"; ?> </td> </tr> <?php } } $j++; } } } if ($is_shown) { echo '</table>'; $html = ob_get_contents(); ob_end_flush(); ob_clean(); $pdf->writeHTML($html, true, false, false, false, ''); } } if (count($lists['quiz_rows'])) { $pdf->setFontSize(10); $pdf->setFont('freesansb'); //choose font $pdf->cell(0, 10, _JLMS_GB_QUIZ_RESULTS, '', 1, 'L'); $pdf->setFont('freesans'); //choose font $pdf->setFontSize(8); ob_clean(); ob_start(); /*Integration Plugin Percentiles*/ echo '<table width="100%" cellpadding="0" cellspacing="0" border="1">'; foreach ($lists['quiz_rows'] as $quiz_row) { $j = 0; while ($j < count($rows[0]->quiz_info)) { if ($rows[0]->quiz_info[$j]->gbi_id == $quiz_row->c_id) { if ($rows[0]->quiz_info[$j]->user_status == -1) { ?> <tr> <td width="50%" align="left"> <strong><?php echo $quiz_row->c_title; ?> </strong></td> <td width="20%" align="center"> - </td> <td width="30%" align="center"> </td> </tr> <?php } else { $status = $rows[0]->quiz_info[$j]->user_status ? _JLMS_GB_SCORM_COMPLETED : _JLMS_RESULT_FAIL; ?> <tr> <td width="50%" align="left"> <strong><?php echo $quiz_row->c_title; ?> </strong></td> <td width="20%" align="center"><strong><?php echo $status; ?> </strong></td> <td width="30%" align="center"> <?php if ($rows[0]->quiz_info[$j]->user_grade != '-') { echo "<b>" . $rows[0]->quiz_info[$j]->user_grade . "</b> (" . $rows[0]->quiz_info[$j]->user_pts_full . ")"; } else { echo $rows[0]->quiz_info[$j]->user_pts_full; } if (isset($rows[0]->quiz_info[$j]->user_percentile)) { echo ' - ' . $rows[0]->quiz_info[$j]->user_percentile; } ?> </td> </tr> <?php } } $j++; } } echo '</table>'; $html = ob_get_contents(); ob_end_flush(); ob_clean(); $pdf->writeHTML($html, true, false, false, false, ''); } if (count($lists['gb_rows'])) { $pdf->setFontSize(10); $pdf->setFont('freesansb'); //choose font $pdf->cell(0, 10, _JLMS_GB_GBI_RESULTS, '', 1, 'L'); $pdf->setFont('freesans'); //choose font $pdf->setFontSize(8); ob_clean(); ob_start(); echo '<table width="100%" cellpadding="0" cellspacing="0" border="1">'; foreach ($lists['gb_rows'] as $gb_row) { $j = 0; while ($j < count($rows[0]->grade_info)) { if ($rows[0]->grade_info[$j]->gbi_id == $gb_row->id) { ?> <tr> <td width="50%" align="left"> <strong><?php echo $gb_row->gbi_name; ?> </strong></td> <td width="50%" align="center"> <?php echo $rows[0]->grade_info[$j]->user_grade != '-' ? $rows[0]->grade_info[$j]->user_grade : ''; ?> </td> </tr> <?php } $j++; } } echo '</table>'; $html = ob_get_contents(); ob_end_flush(); ob_clean(); $pdf->writeHTML($html, true, false, false, false, ''); } $pdf->Output('gradebook_' . $rows[0]->username . '_course' . $id . '.pdf', 'I'); die; }
function showLPathRow(&$k, $row, $i, $topic_id, $checked = null, $manage = 1, $span = 1) { global $option, $Itemid, $my, $JLMS_DB, $Itemid, $JLMS_CONFIG, $JLMS_SESSION; $usertype = $JLMS_CONFIG->get('current_usertype', 0); $course_id = intval(mosGetParam($_REQUEST, 'id', 0)); $k = 3 - $k; $is_hidden = false; if (isset($row->item_id) && $row->item_id) { $tmp_params = new JLMSParameters($row->lp_params); if ($tmp_params->get('hide_in_list', 0) == 1) { $is_hidden = true; } } if ($usertype == 1) { $task = 'compose_lpath'; $title = _JLMS_LPATH_LINK_TITLE_COMPOSE; } elseif ($usertype == 2) { $task = 'show_lpath'; $title = _JLMS_LPATH_LINK_TITLE_VIEW; if ($is_hidden) { return 0; } } if (isset($row->is_hidden) && $row->is_hidden && $usertype == 2) { return 0; } $link = "index.php?option=" . $option . "&Itemid=" . $Itemid . "&task=" . $task . "&course_id=" . $course_id . "&id=" . $row->id; $icon_img = "toolbar/tlb_lpath"; $icon_alt = "learnpath"; if ($row->item_id) { $title = _JLMS_LPATH_LINK_TITLE_SCORM; //$link = "index.php?option=".$option."&Itemid=".$Itemid."&task=player_scorm&course_id=".$course_id."&id=".$row->item_id."&lp_type=".$row->lp_type; $link = "index.php?option=" . $option . "&Itemid=" . $Itemid . "&task=show_lpath&course_id=" . $course_id . "&id=" . $row->id; //."&lp_type=".$row->lp_type; $icon_img = "toolbar/tlb_scorm"; $icon_alt = _JLMS_TOPIC_SCORM; } $title = $row->lpath_name; if (!$checked && $manage == 1) { $checked = mosHTML::idBox($topic_id * 1000 + $i, $row->link_id); } // 01.12.2007 '$i' chenged to '$topic_id*1000+$i' by DEN - to avoid dublicate id's $alt = $row->published ? _JLMS_LPATH_STATUS_PUB : _JLMS_LPATH_STATUS_UNPUB; $image = $row->published ? $is_hidden ? 'btn_publish_hidden.png' : 'btn_accept.png' : 'btn_cancel.png'; $state = $row->published ? 0 : 1; ?> <tr class="<?php echo JLMSCSS::_('sectiontableentry' . $k); ?> "> <td width='1%' valign="middle" align="center"><?php if ($usertype != 2) { echo $i + 1; } else { echo ' '; } ?> </td> <?php if ($usertype == 1) { ?> <?php if ($checked) { echo "<td width='1%'>"; if (!isset($row->is_link)) { echo $checked; } echo "</td>"; } ?> <?php } ?> <td valign="middle" align="center" width="1%"> <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; ?> " /> </td> <td valign="middle" align="left" colspan="<?php echo $span; ?> "> <?php if (!isset($row->is_link)) { $add_link_params = ''; if (isset($row->scorm_params) && $row->scorm_params) { $tmp_params = new JLMSParameters($row->scorm_params); if ($tmp_params->get('scorm_layout', 0) == 1) { $x_size = 0; $y_size = 0; if (isset($row->scorm_width) && $row->scorm_width > 100) { $x_size = $row->scorm_width; } if (isset($row->scorm_height) && $row->scorm_height > 100) { $y_size = $row->scorm_height; } $add_link_params = ' class="scorm_modal" rel="{handler:\'iframe\', size:{x:' . $x_size . ',y:' . $y_size . '}}"'; JLMS_initialize_SqueezeBox(); } } ?> <a href="<?php echo sefRelToAbs($link); ?> "<?php echo $add_link_params; ?> title="<?php echo $title; ?> "> <?php } ?> <?php echo $row->lpath_name; ?> <?php if (!isset($row->is_link)) { ?> </a> <?php } ?> </td> <?php if ($usertype != 2) { //teacher/admin table handler ?> <?php if ($manage == 1) { ?> <td valign="middle" class="controltd"><?php if ($row->allow_up == 1) { echo JLMS_orderIcon_element($topic_id, $course_id, 'orderup_element', _JLMS_TOPIC_I_MOVEUP, $row->ordering); } else { echo ' '; } ?> </td> <td valign="middle" class="controltd"><?php if ($row->allow_down == 1 && $manage == 1) { echo JLMS_orderIcon_element($topic_id, $course_id, 'orderdown_element', _JLMS_TOPIC_I_MOVEDOWN, $row->ordering); } else { echo ' '; } ?> </td> <?php $state = publishUtility($row->published, $row->show); ?> <td valign="middle" class="controltd"><?php echo JLMS_showHideIcon($row->link_id, $course_id, $topic_id, $state, 'change_element', $option); ?> </td> <?php } ?> <td align="center">-</td> <td align="center">-</td> <?php } else { //user/student table handler $r_img = 'btn_cancel'; $r_sta = _JLMS_LPATH_STU_LPSTATUS_NOTCOMPLETED; $r_start = '-'; $r_end = '-'; if (!$row->item_id) { if (isset($row->r_status) && $row->r_status == 1) { $r_img = 'btn_accept'; $r_sta = _JLMS_LPATH_STU_LPSTATUS_COMPLETED; if ($row->r_start) { $r_start = JLMS_dateToDisplay($row->r_start, false, $JLMS_CONFIG->get('offset') * 60 * 60, '\\<\\b\\r \\/>H:i:s'); } if ($row->r_end) { $r_end = JLMS_dateToDisplay($row->r_end, false, $JLMS_CONFIG->get('offset') * 60 * 60, '\\<\\b\\r \\/>H:i:s'); } } elseif (isset($row->r_status) && $row->r_status == 0) { $r_img = 'btn_pending_cur'; if ($row->r_start) { $r_start = JLMS_dateToDisplay($row->r_start, false, $JLMS_CONFIG->get('offset') * 60 * 60, '\\<\\b\\r \\/>H:i:s'); } } } else { if (isset($row->s_status) && $row->s_status == 1) { $r_img = 'btn_accept'; $r_sta = _JLMS_LPATH_STU_LPSTATUS_COMPLETED; $r_start = '-'; $r_end = '-'; } if ($row->lp_type == 1 || $row->lp_type == 2) { if (isset($row->r_end) && $row->r_end) { $r_end = JLMS_dateToDisplay($row->r_end, true, $JLMS_CONFIG->get('offset') * 60 * 60, '\\<\\b\\r \\/>H:i:s'); } if (isset($row->r_start) && $row->r_start) { $r_start = JLMS_dateToDisplay($row->r_start, true, $JLMS_CONFIG->get('offset') * 60 * 60, '\\<\\b\\r \\/>H:i:s'); } } } ?> <td valign="middle" align="center" width="1%"> <?php //Show Status Lapths/Scorms //by Max - 25.02.2011 joomla_lms_html::ShowStatusAs($row); ?> </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> <?php } ?> <td><?php $descr = strip_tags($row->lpath_shortdescription); if (strlen($descr) > 75) { $descr = substr($descr, 0, 75) . "..."; } echo $descr ? $descr : ' '; ?> </td> </tr> <?php return 1; }
function ShowSub(&$subscription, $pageNav_num, $checked, $price, $show_index = true, $show_itemnum = true, $params = false) { global $JLMS_CONFIG; $for_custom_code = ''; ?> <tr valign="middle" style="vertical-align:middle" class="<?php echo $JLMS_CONFIG->get('visual_set_main_row_class'); ?> "> <?php if ($show_index) { ?> <td width="15" align="center"><?php echo $show_itemnum ? $pageNav_num : ' '; ?> </td> <?php } ?> <td width="20" align="left"> <input type="checkbox" name="jlms_sub[]" value="<?php echo $subscription->id; ?> " <?php echo $checked; ?> /> <input type="hidden" name="jlms_sub_ids[]" value="<?php echo $subscription->id; ?> " /> </td> <td style="font-weight:bold; "><?php echo $subscription->sub_name; ?> </td> <td <?php echo $subscription->account_type == 6 ? 'colspan="2"' : ""; ?> ><?php $for_custom_code = '<input type="hidden" name="jlms_sub_ids[]" value="' . $subscription->id . '" />'; if ($subscription->account_type == 2) { echo _JLMS_SUBSCR_FROM . ' ' . JLMS_dateToDisplay($subscription->start_date) . ' ' . _JLMS_SUBSCR_TO . ' ' . JLMS_dateToDisplay($subscription->end_date); } elseif ($subscription->account_type == 3) { echo _JLMS_SUBSCR_FROM . ' ' . JLMS_dateToDisplay($subscription->start_date) . ' ' . _JLMS_SUBSCR_TO . ' ' . _JLMS_DATE_LIFETIME; } elseif ($subscription->account_type == 4) { echo $subscription->access_days . ' ' . _JLMS_SUBSCR_DAYS_ACCESS; //echo _JLMS_SUBSCR_FROM.' '.JLMS_dateToDisplay(date('Y-m-d')).' '._JLMS_SUBSCR_TO.' '.JLMS_dateToDisplay(date('Y-m-d',strtotime('+'.$subscription->access_days.' day'))); } elseif ($subscription->account_type == 100) { echo $subscription->details . ' credits/courses'; } elseif ($subscription->account_type == 6) { null; } else { echo "-"; } ?> <?php if ($subscription->account_type != 6) { ?> </td> <td align="center"> <?php } ?> <?php echo $price; ?> </td> <?php if (isset($params['showDiscount']) && $params['showDiscount']) { $disc = $subscription->p_coupon_disc + $subscription->p_disc + $subscription->discount; if ($disc > 0) { echo "<td align=\"center\"><font color=\"green\">" . $disc . "%</font></td>"; } else { echo "<td align=\"center\"><font color=\"green\">-</font></td>"; } } if (isset($subscription->tax) && $subscription->tax > 0 && $subscription->tax_type == 1) { echo "<td align=\"center\"><font color=\"red\">" . $subscription->tax . "%</font></td>"; } ?> <?php if (isset($subscription->count_items) && $subscription->count_items && isset($subscription->allow_multiple) && $subscription->allow_multiple) { echo "<td align='center'><input type='text' class='inputbox' style='border: 1px solid #c6c6c6;' name='sub_count[]' size='3' value='" . $subscription->count_items . "' /></td>"; $for_custom_code .= "<input type='hidden' name='sub_count[]' value='" . $subscription->count_items . "' />"; } elseif (isset($subscription->count_items) && $subscription->count_items) { echo "<td align='center'>1<input type='hidden' name='sub_count[]' value='1' /></td>"; $for_custom_code .= "<input type='hidden' name='sub_count[]' value='1' />"; } ?> </tr> <?php $colspan = 3; if (isset($subscription->count_items) && $subscription->count_items) { $colspan++; } if (isset($params['showDiscount']) && $params['showDiscount']) { $colspan++; } if (isset($subscription->tax) && $subscription->tax > 0) { $colspan++; } if (isset($subscription->description) && $subscription->description) { $img1 = "<img src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/treeview/empty_line.png\" width='16' height='16' alt=''/>"; ?> <tr class="<?php echo $JLMS_CONFIG->get('visual_set_child_row_class'); ?> "> <?php if ($show_index) { ?> <td><?php echo $img1; ?> </td> <?php } ?> <td align="center"><?php echo $img1; ?> </td> <td align="left" colspan="<?php echo $colspan; ?> " valign="middle"> <?php echo $subscription->description; ?> </td> </tr> <?php } else { $s = 1; foreach ($subscription->course_names as $course_name) { if ($s != count($subscription->courses)) { $src = $JLMS_CONFIG->get('live_site') . '/components/com_joomla_lms/lms_images/treeview/sub1.png'; } else { $src = $JLMS_CONFIG->get('live_site') . '/components/com_joomla_lms/lms_images/treeview/sub2.png'; } $img1 = "<img src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/treeview/empty_line.png\" width='16' height='16' alt=''/>"; $course_usertype = 0; if (in_array($subscription->courses[$s - 1], $JLMS_CONFIG->get('teacher_in_courses', array(0)))) { $course_usertype = 1; } elseif (in_array($subscription->courses[$s - 1], $JLMS_CONFIG->get('student_in_courses', array(0)))) { $course_usertype = 2; } if ($course_usertype) { $img1 = "<img src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/toolbar/btn_accept.png\" width='16' height='16' alt=''/>"; } ?> <tr class="<?php echo $JLMS_CONFIG->get('visual_set_child_row_class'); ?> "> <?php if ($show_index) { ?> <td><?php echo $img1; ?> </td> <?php } ?> <td align="center"> <?php echo "<img src=\"{$src}\" width='16' height='16' alt=''/>"; ?> </td> <td style="text-indent:16px;" align="left" colspan="<?php echo $colspan; ?> " valign="middle"> <?php echo $course_name; ?> </td> </tr> <?php $s++; } } return $for_custom_code; }
function JLMS_Course_HomePage($course_id, $add_elements_page = false) { global $option, $my, $JLMS_DB, $Itemid, $JLMS_CONFIG, $JLMS_SESSION; //TODO: replace global option declaration $usertype = $JLMS_CONFIG->get('current_usertype', 0); $JLMS_ACL =& JLMSFactory::getACL(); $is_teacher = $JLMS_ACL->isTeacher(); $AND_ST = ""; if (false !== ($enroll_period = JLMS_getEnrolPeriod($my->id, $course_id))) { $AND_ST = " AND IF(is_time_related, (show_period < '" . $enroll_period . "' ), 1) "; } $this->course_id = $course_id; $curr_date = date("Y-m-d"); $is_curtopic = intval(mosgetparam($_REQUEST, 't_id', 0)); //create list of topics if ($usertype == 1) { $published = '1'; } else { $published = "published=1 AND (publish_start=0 OR start_date<='{$curr_date}') AND (publish_end=0 OR end_date>='{$curr_date}')"; } $query = "SELECT * FROM #__lms_topics WHERE course_id={$course_id} " . $AND_ST . " AND {$published} " . ($is_curtopic ? " AND id=" . $is_curtopic : "") . " ORDER BY ordering"; $JLMS_DB->setQuery($query); $this->topics = $JLMS_DB->loadObjectList('id'); //get items of the course //2 - documents if ($add_elements_page) { $rows = array(); $possibilities = new stdClass(); JLMSDocs::FillList($course_id, $rows, $possibilities, false, false); $this->elements[_DOCUMENT_ID] = JLMSDocs::GetItemsbyPermission($rows, 'manage'); } else { $AND_ST_D = ""; if (false !== ($enroll_period = JLMS_getEnrolPeriod($my->id, $course_id))) { $AND_ST_D = " AND IF(a.is_time_related, (a.show_period < '" . $enroll_period . "' ), 1) "; } $query = "SELECT a.*, b.file_name FROM #__lms_documents as a LEFT JOIN #__lms_files as b ON a.file_id = b.id AND a.folder_flag = 0 WHERE a.course_id={$course_id}" . $AND_ST_D; $JLMS_DB->setQuery($query); $this->elements[_DOCUMENT_ID] = $JLMS_DB->loadObjectList('id'); foreach ($this->elements[_DOCUMENT_ID] as $elem) { if ($elem->folder_flag == 3) { $query = "SELECT a.*, b.file_name" . "\n FROM #__lms_outer_documents as a LEFT JOIN #__lms_files as b ON a.file_id = b.id AND a.folder_flag = 0 " . "\n WHERE a.folder_flag = 0 AND a.id = " . $elem->file_id; $JLMS_DB->SetQuery($query); $out_row = $JLMS_DB->LoadObjectList(); if (count($out_row) && isset($out_row[0]->allow_link) && $out_row[0]->allow_link == 1) { $this->elements[_DOCUMENT_ID][$elem->id]->doc_name = $out_row[0]->doc_name; $this->elements[_DOCUMENT_ID][$elem->id]->doc_description = $out_row[0]->doc_description; $this->elements[_DOCUMENT_ID][$elem->id]->file_id = $out_row[0]->file_id; $this->elements[_DOCUMENT_ID][$elem->id]->file_name = $out_row[0]->file_name; } else { unset($this->elements[_DOCUMENT_ID][$elem->id]); } } } $this->elements[_DOCUMENT_ID] = AppendFileIcons_toList($this->elements[_DOCUMENT_ID]); } //get max tree level $this->max_lvl = getDirNesting($this->elements[_DOCUMENT_ID], 0); global $max_lvl; $max_lvl = $this->max_lvl; //3 - links $query = "SELECT * FROM #__lms_links WHERE course_id={$course_id}" . $AND_ST; $JLMS_DB->setQuery($query); $this->elements[_LINK_ID] = $JLMS_DB->loadObjectList('id'); //4 - contents ... er... TODO //5 - quizs $query = "SELECT *, c_id AS id FROM #__lms_quiz_t_quiz WHERE course_id={$course_id}" . $AND_ST; $JLMS_DB->setQuery($query); $this->elements[_QUIZ_ID] = $JLMS_DB->loadObjectList('c_id'); $quizzes_i = array(); foreach ($this->elements[_QUIZ_ID] as $row) { $quizzes_i[] = $row->c_id; } //add results for student if ($usertype == 2 && count($this->elements[_QUIZ_ID])) { $quizzes_r = array(); foreach ($this->elements[_QUIZ_ID] as $row) { $quizzes_r[] = $row->c_id; } $q_items_num = array(); $extra_info_cells = array(); if (!empty($quizzes_r)) { $quizzes_r_cid = implode(',', $quizzes_r); $query = "SELECT * FROM #__lms_quiz_results WHERE quiz_id IN ({$quizzes_r_cid}) AND course_id={$course_id} AND user_id={$my->id} GROUP BY quiz_id"; $JLMS_DB->SetQuery($query); $extra_info_cells = $JLMS_DB->loadObjectList(); } foreach ($this->elements[_QUIZ_ID] as $i => $value) { $this->elements[_QUIZ_ID][$i]->start_date = '-'; $this->elements[_QUIZ_ID][$i]->end_date = '-'; $this->elements[_QUIZ_ID][$i]->status = -1; $this->elements[_QUIZ_ID][$i]->user_passed = -1; $this->elements[_QUIZ_ID][$i]->points = -1; $this->elements[_QUIZ_ID][$i]->user_score = 0; $this->elements[_QUIZ_ID][$i]->quiz_max_score = 0; foreach ($extra_info_cells as $cell) { if ($cell->quiz_id == $this->elements[_QUIZ_ID][$i]->c_id) { $this->elements[_QUIZ_ID][$i]->start_date = JLMS_dateToDisplay($cell->quiz_date, false, $JLMS_CONFIG->get('offset') * 60 * 60 - $cell->user_time, '\\<\\b\\r \\/>H:i:s'); $this->elements[_QUIZ_ID][$i]->end_date = JLMS_dateToDisplay($cell->quiz_date, false, $JLMS_CONFIG->get('offset') * 60 * 60, '\\<\\b\\r \\/>H:i:s'); $this->elements[_QUIZ_ID][$i]->points = $cell->user_score; $this->elements[_QUIZ_ID][$i]->status = $cell->user_passed; $this->elements[_QUIZ_ID][$i]->user_passed = $cell->user_passed; $this->elements[_QUIZ_ID][$i]->user_score = $cell->user_score; $this->elements[_QUIZ_ID][$i]->quiz_max_score = $cell->quiz_max_score; } } } unset($extra_info_cells); require_once _JOOMLMS_FRONT_HOME . DS . "includes" . DS . "lms_certificates.php"; $arr = array(); JLMS_Certificates::JLMS_GB_getUserCertificates($course_id, $my->id, $arr); $arr1 = isset($arr['user_quiz_certificates']) ? $arr['user_quiz_certificates'] : array(); foreach ($this->elements[_QUIZ_ID] as $i => $value) { for ($j = 0; $j < count($arr1); $j++) { if ($arr1[$j]->c_quiz_id == $this->elements[_QUIZ_ID][$i]->c_id) { $this->elements[_QUIZ_ID][$i]->link_certificate = "<a target = \"_blank\" href = \"" . $JLMS_CONFIG->get('live_site') . "/index.php?tmpl=component&option=" . $option . "&no_html=1&task=print_quiz_cert&course_id=" . $course_id . "&stu_quiz_id=" . $arr1[$j]->stu_quiz_id . "&user_unique_id=" . $arr1[$j]->user_unique_id . "\"><img src = \"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/toolbar/btn_certificate.png\" border = \"0\" align=\"top\" alt=\"certificate\"/></a>"; } } } } //6 - scorm ... er... TODO //7 - learning paths $lpaths = array(); if ($course_id && $usertype) { //$JLMS_SESSION->clear('redirect_to_learnpath'); if ($usertype == 1) { $query = "SELECT * FROM #__lms_learn_paths WHERE course_id = '" . $course_id . "'" . $AND_ST . "\n ORDER BY ordering"; } elseif ($usertype == 2) { //$query = "SELECT a.*, b.user_status as r_status, b.start_time as r_start, b.end_time as r_end" //. "\n FROM #__lms_learn_paths as a LEFT JOIN #__lms_learn_path_results as b ON a.id = b.lpath_id AND b.course_id = '".$course_id."' AND b.user_id = '".$my->id."'" $query = "SELECT a.*, '' as r_status, '' as r_start, '' as r_end" . "\n FROM #__lms_learn_paths as a" . "\n WHERE a.course_id = '" . $course_id . "'" . "\n AND a.published = 1" . "\n ORDER BY a.ordering"; } $JLMS_DB->SetQuery($query); $lpaths = $JLMS_DB->LoadObjectList(); if ($usertype == 2) { $user_ids = array(); $user_ids[] = $my->id; require_once _JOOMLMS_FRONT_HOME . "/includes/lms_grades.lib.php"; JLMS_LP_populate_results($course_id, $lpaths, $user_ids); // 13 August 2007 (DEN) Check for prerequisites. // 1. get the list of lpath_ids. $lpath_ids = array(); foreach ($lpaths as $lpath) { $lpath_ids[] = $lpath->id; } if (!empty($lpath_ids)) { $lpath_ids_str = implode(',', $lpath_ids); // 2. get the list of prerequisites // SELECT from two tables (+ #__lms_learn_paths) - because the prereq lpath could be deleted... $query = "SELECT a.* FROM #__lms_learn_path_prerequisites as a, #__lms_learn_paths as b" . "\n WHERE a.lpath_id IN ({$lpath_ids_str}) AND a.req_id = b.id"; $JLMS_DB->SetQuery($query); $prereqs = $JLMS_DB->LoadObjectList(); if (!empty($prereqs)) { // 3. compare lists of prereqs to the lists of lpaths. $i = 0; while ($i < count($lpaths)) { $is_hidden = false; $o = 0; while ($o < count($prereqs)) { if ($prereqs[$o]->lpath_id == $lpaths[$i]->id) { $j = 0; while ($j < count($lpaths)) { if ($lpaths[$j]->id == $prereqs[$o]->req_id) { if (!$lpaths[$j]->item_id) { if (empty($lpaths[$j]->r_status)) { $is_hidden = true; break; } else { $end_time = strtotime($lpaths[$j]->r_end); $current_time = strtotime(date("Y-m-d H:i:s")); if ($current_time > $end_time && $current_time - $end_time < $prereqs[$o]->time_minutes * 60) { $is_hidden = true; break; } } } else { if (empty($lpaths[$j]->s_status)) { $is_hidden = true; break; } else { $end_time = strtotime($lpaths[$j]->r_end); $current_time = strtotime(date("Y-m-d H:i:s")); if ($current_time > $end_time && $current_time - $end_time < $prereqs[$o]->time_minutes * 60) { $is_hidden = true; break; } } } } $j++; } } $o++; } $lpaths[$i]->is_hidden = $is_hidden; $i++; } } } } } foreach ($lpaths as $lpath) { $this->elements[_LPATH_ID][$lpath->id] = $lpath; } //populate topics with links to their items $query = "SELECT * FROM #__lms_topic_items WHERE course_id={$course_id} ORDER BY ordering"; $JLMS_DB->setQuery($query); $items = $JLMS_DB->loadObjectList(); for ($i = 0; $i < count($items); $i++) { if ($items[$i]->item_type == 7) { $query = "SELECT lp_type FROM #__lms_learn_paths WHERE id = '" . $items[$i]->item_id . "'" . $AND_ST; $JLMS_DB->SetQuery($query); $lp_type = $JLMS_DB->LoadResult(); if ($lp_type == 2) { $query = "SELECT item_id FROM #__lms_learn_paths WHERE id = '" . $items[$i]->item_id . "'"; $JLMS_DB->SetQuery($query); $learn_path_id = $JLMS_DB->LoadResult(); $query = "SELECT scorm_package, params as scorm_params, width as scorm_width, height as scorm_height FROM #__lms_n_scorm WHERE id = '" . $learn_path_id . "'"; $JLMS_DB->SetQuery($query); $outer_doc = null; $scorm_info = null; $scorm_info = $JLMS_DB->LoadObject(); if (is_object($scorm_info)) { $this->elements[_LPATH_ID][$items[$i]->item_id]->scorm_params = $scorm_info->scorm_params; $this->elements[_LPATH_ID][$items[$i]->item_id]->scorm_width = $scorm_info->scorm_width; $this->elements[_LPATH_ID][$items[$i]->item_id]->scorm_height = $scorm_info->scorm_height; $scorm_package = $scorm_info->scorm_package; $query = "SELECT id FROM #__lms_n_scorm WHERE scorm_package = '" . $scorm_package . "' AND course_id = 0"; $JLMS_DB->SetQuery($query); $scorm_lib_id = $JLMS_DB->LoadResult(); $query = "SELECT outdoc_share, owner_id, allow_link FROM #__lms_outer_documents WHERE file_id = '" . $scorm_lib_id . "' AND folder_flag = 3"; $JLMS_DB->SetQuery($query); $outer_doc = $JLMS_DB->LoadObject(); } if (is_object($outer_doc) && isset($outer_doc->allow_link) && $outer_doc->allow_link == 1) { // 01May2009: new library policy: if 'allow_link' is enabled - we can view already added resource ! } else { unset($items[$i]); } } elseif ($lp_type == 1) { $query = "SELECT item_id FROM #__lms_learn_paths WHERE id = '" . $items[$i]->item_id . "'"; $JLMS_DB->SetQuery($query); $learn_path_id = $JLMS_DB->LoadResult(); if ($learn_path_id) { $query = "SELECT params as scorm_params, width as scorm_width, height as scorm_height FROM #__lms_n_scorm WHERE id = '" . $learn_path_id . "'"; $JLMS_DB->SetQuery($query); $scorm_info = null; $scorm_info = $JLMS_DB->LoadObject(); if (is_object($scorm_info)) { $this->elements[_LPATH_ID][$items[$i]->item_id]->scorm_params = $scorm_info->scorm_params; $this->elements[_LPATH_ID][$items[$i]->item_id]->scorm_width = $scorm_info->scorm_width; $this->elements[_LPATH_ID][$items[$i]->item_id]->scorm_height = $scorm_info->scorm_height; } } } } } if (!$is_teacher) { $this->_filterItemsByShowPeriod($items, $course_id); } $mas = array(); foreach ($items as $k => $v) { $mas[] = $items[$k]; } unset($lpath); $items = $mas; $links = array(); foreach ($items as $item) { $item_tmp->id = $item->item_id; $item_tmp->type = $item->item_type; $item_tmp->ordering = $item->ordering; $links[$item->topic_id][] = $item; } $this->links = $links; }
function showCourseDetails($id, &$row, &$params, $option, &$lists, $view_type = 'view') { $_JLMS_PLUGINS =& JLMSFactory::getPlugins(); global $Itemid, $my, $JLMS_CONFIG, $JLMS_SESSION; $count_modules = 0; $JLMS_ACL =& JLMSFactory::getACL(); if ($JLMS_ACL->GetRole() && !$JLMS_ACL->isStaff()) { if ($params->get('homework_view') && $JLMS_CONFIG->get('course_homework')) { $count_modules++; } if ($params->get('agenda_view')) { $count_modules++; } if ($params->get('dropbox_view')) { $count_modules++; } if ($params->get('mailbox_view')) { $count_modules++; } if ($params->get('certificates_view')) { $count_modules++; } if ($params->get('latest_forum_posts_view')) { $count_modules++; } if ($count_modules) { ?> <?php } } JLMS_TMPL::OpenMT(); $hparams = array(); if ($view_type == 'view') { $hparams['simple_menu'] = true; $hparams['sys_msg'] = _JLMS_MESSAGE_SHORT_COURSE_INFO; } if ($view_type == 'offerWL') { $hparams['sys_msg'] = _JLMS_MESSAGE_OFFER_JOIN_WAITING_LIST; } elseif ($view_type == 'inWL') { $hparams['sys_msg'] = _JLMS_MESSAGE_ALREADY_IN_WATING_LIST; $JLMS_CONFIG->set('enableterms', 0); } if ($JLMS_SESSION->get('joomlalms_just_joined', 0)) { if (isset($hparams['sys_msg'])) { $hparams['sys_msg'] = $JLMS_SESSION->get('joomlalms_sys_message', '') . '<br />' . $hparams['sys_msg']; } else { $hparams['sys_msg'] = $JLMS_SESSION->get('joomlalms_sys_message', ''); } $JLMS_SESSION->clear('joomlalms_just_joined'); } $toolbar = array(); $JLMS_ACL =& JLMSFactory::getACL(); if ($JLMS_ACL->CheckPermissions('course', 'manage_settings')) { $toolbar[] = array('btn_type' => 'newtopic', 'btn_js' => "index.php?option={$option}&Itemid={$Itemid}&task=add_topic&id={$id}", 'btn_str' => _JLMS_TOPIC_T_ADD); $toolbar[] = array('btn_type' => 'settings', 'btn_js' => sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=settings&id={$id}")); $toolbar[] = array('btn_type' => 'edit', 'btn_js' => ampReplace(sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=edit_course&id={$id}&is_inside=1"))); } elseif ($view_type == 'view' || $view_type == 'offerWL' || $view_type == 'inWL') { $hparams['simple_menu'] = true; if ($my->id && $row->self_reg && JLMS_checkCourseGID($my->id, $row->gid)) { //check that enrollment is available and user gid is allowed if ($row->paid) { if ($view_type != 'inWL') { $toolbar[] = array('btn_type' => 'yes', 'btn_str' => _JLMS_SUBSCRIBE, 'btn_js' => "javascript:submitbutton('subscription','');"); } } else { if ($view_type != 'inWL') { $toolbar[] = array('btn_type' => 'yes', 'btn_str' => _JLMS_SUBSCRIBE, 'btn_js' => "javascript:submitbutton('course_subscribe','');"); } } if ($view_type != 'inWL') { $toolbar[] = array('btn_type' => 'cancel', 'btn_js' => sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=courses")); } else { $toolbar[] = array('btn_type' => 'back', 'btn_js' => sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=courses")); } $hparams['toolbar_position'] = 'center'; $html_code_before_toolbar = "\n\t\t\t\t<form action='" . sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}") . "' method='post' name='adminForm_enroll'>\n\t\t\t\t<script language='javascript' type='text/javascript'>\n\t\t\t\t\t<!--\n\n\t\t\t\t\tfunction submitbutton(pressbutton) {\n\t\t\t\t\t\tvar form = document.adminForm_enroll;"; if ($JLMS_CONFIG->get('enableterms') && !$row->paid) { $html_code_before_toolbar .= "\n\t\t\t\t\t\tif( (pressbutton == 'course_subscribe') && (document.getElementById('jlms_agreement').checked == false) ){\n\t\t\t\t\t\t\talert( '" . addslashes(_JLMS_AGREEMENT) . "' );\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse{\n\t\t\t\t\t\t\tform.task.value = pressbutton;\n\t\t\t\t\t\t\tform.submit();\n\t\t\t\t\t\t}\n\t\t\t\t\t\t"; } else { $html_code_before_toolbar .= "\n\t\t\t\t\t\t\tform.task.value = pressbutton;\n\t\t\t\t\t\t\tform.submit();\n\t\t\t\t\t"; } $html_code_before_toolbar .= "\n\t\t\t\t\t\t\t}\n\t\t\t\t\t//-->\n\t\t\t\t\t</script>\n\t\t\t\t\t"; if ($JLMS_CONFIG->get('enableterms') && !$row->paid) { $html_code_before_toolbar .= "\n\t\t\t\t\t<table align='center' class='jlms_table_no_borders'><tr><td width='20'>\n\t\t\t\t\t\t<input type='checkbox' name='agreement' id='jlms_agreement' />\n\t\t\t\t\t</td><td style='text-align:left'>\n\t\t\t\t\t\t<label for='jlms_agreement'>" . $JLMS_CONFIG->get('jlms_terms') . "</label>\n\t\t\t\t\t</td></tr></table>\n\t\t\t\t\t"; } if ($row->paid) { $html_code_before_toolbar .= "\n\t\t\t\t\t\t<input type='hidden' name='option' value='" . $option . "' />\n\t\t\t\t\t\t<input type='hidden' name='Itemid' value='" . $Itemid . "' />\n\t\t\t\t\t\t<input type='hidden' name='task' value='subscription' />\n\t\t\t\t\t\t<input type='hidden' name='cid[]' value='" . $row->id . "' />\n\t\t\t\t\t\t<input type='hidden' name='state' value='0' />\n\t\t\t\t\t\t</form>\n\t\t\t\t\t"; } else { $html_code_before_toolbar .= "\n\t\t\t\t\t\t<input type='hidden' name='option' value='" . $option . "' />\n\t\t\t\t\t\t<input type='hidden' name='Itemid' value='" . $Itemid . "' />\n\t\t\t\t\t\t<input type='hidden' name='task' value='courses' />\n\t\t\t\t\t\t<input type='hidden' name='id' value='" . $row->id . "' />\n\t\t\t\t\t\t<input type='hidden' name='state' value='0' />\n\t\t\t\t\t\t</form>\n\t\t\t\t\t"; } $hparams['html_code_before_toolbar'] = $html_code_before_toolbar; } else { $toolbar[] = array('btn_type' => 'back', 'btn_js' => sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=courses")); } } elseif ($view_type == 'future_course') { $hparams['simple_menu'] = true; if ($row->publish_start) { $hparams['sys_msg'] = str_replace('{date}', JLMS_dateToDisplay($row->start_date), _JLMS_COURSE_IS_PENDING_MSG); } else { $query = "SELECT start_date FROM #__lms_users_in_groups WHERE course_id = " . $row->id . " AND user_id = " . $my->id; global $JLMS_DB; $JLMS_DB->SetQuery($query); $user_start = $JLMS_DB->LoadResult(); $hparams['sys_msg'] = str_replace('{date}', JLMS_dateToDisplay($user_start), _JLMS_COURSE_USER_IS_PENDING); } } JLMS_TMPL::ShowHeader('course', _JLMS_COURSES_DETAILS, $hparams, $toolbar); $_JLMS_PLUGINS->loadBotGroup('system'); $plugin_args = array(); $plugin_args[] = $id; $_JLMS_PLUGINS->trigger('onAboveCourseDetailsPage', $plugin_args); if ($JLMS_ACL->GetRole() && !$JLMS_ACL->isStaff() && $count_modules) { $custom_sections = array(); if ($JLMS_CONFIG->get('course_homework') && $params->get('homework_view')) { $txt = JLMS_showMyHomeWork($option, $Itemid, $lists['my_hw']); $custom_sections[] = array('text' => $txt, 'attrib' => ' valign="top"'); } if ($params->get('agenda_view')) { $txt = JLMS_showMyAgenda($option, $Itemid, $lists['my_announcements']); $custom_sections[] = array('text' => $txt, 'attrib' => ' valign="top"'); } if ($params->get('dropbox_view')) { $txt = JLMS_showMyDropBox($option, $Itemid, $lists['my_dropbox'], $lists); $custom_sections[] = array('text' => $txt, 'attrib' => ' valign="top"'); } if ($params->get('mailbox_view')) { $txt = JLMS_showMyMailBox($option, $Itemid, $lists['my_mailbox'], $lists); $custom_sections[] = array('text' => $txt, 'attrib' => ' valign="top"'); } if ($params->get('certificates_view')) { $txt = JLMS_showMyCertificates($option, $Itemid, $lists['my_certificates'], $lists); $custom_sections[] = array('text' => $txt, 'attrib' => ' valign="top"'); } if ($JLMS_CONFIG->get('plugin_forum') && $params->get('latest_forum_posts_view')) { $txt = JLMS_showLatestForumPosts($option, $Itemid, $lists['latest_forum_posts'], $lists); $custom_sections[] = array('text' => $txt, 'attrib' => ' valign="top"'); } JLMS_TMPL::ShowCustomSection($custom_sections, 1, 1); } $show_description = true; if ($JLMS_ACL->GetRole() && !$JLMS_ACL->isStaff()) { if (!$params->get('show_description', 1)) { $show_description = false; } } if ($show_description) { $text = JLMS_ShowText_WithFeatures($row->course_description); JLMS_TMPL::ShowSection($text); } //$_JLMS_PLUGINS->loadBotGroup('system'); $plugin_args = array(); $plugin_args[] = $id; $_JLMS_PLUGINS->trigger('onBelowCourseDescription', $plugin_args); /*Fix short course description + all comments*/ if (isset($lists['short']) && !$lists['short']) { if ($JLMS_ACL->GetRole() && !$JLMS_ACL->isStaff()) { //show topics of the course global $JLMS_DB; $query = "SELECT count(*) FROM #__lms_topics WHERE course_id = {$id}"; $JLMS_DB->SetQuery($query); $is_any_topic = $JLMS_DB->LoadResult(); if ($is_any_topic) { JLMS_TMPL::OpenTS(); $course = new JLMS_Course_HomePage($id); $course->listTopics(); JLMS_TMPL::CloseTS(); } } } //$_JLMS_PLUGINS->loadBotGroup('system'); $plugin_args = array(); $plugin_args[] = $id; $_JLMS_PLUGINS->trigger('onBelowCourseDetailsPage', $plugin_args); JLMS_TMPL::CloseMT(); }
function JQ_view_quizReport(&$rows, &$pageNav, $option, $page, $course_id, &$lists) { global $Itemid, $JLMS_CONFIG; $toolbar = array(); $toolbar[] = array('btn_type' => 'print', 'btn_txt' => _JLMS_QUIZ_CSV_REPORT_BTN, 'btn_js' => "javascript:submitbutton('csv_report');"); $toolbar[] = array('btn_type' => 'del', 'btn_txt' => _JLMS_QUIZ_DEL_REPORT_BTN, 'btn_js' => "javascript:submitbutton('del_report');"); JLMS_quiz_admin_html_class::showQuizHead($course_id, $option, _JLMS_QUIZ_REPORTS_TITLE, true, $toolbar); ?> <script language="javascript" type="text/javascript"> <!-- function submitbutton(pressbutton) { var form = document.adminForm; if ( (pressbutton == 'del_report') && (form.boxchecked.value == "0")) { alert('<?php echo _JLMS_ALERT_SELECT_ITEM; ?> '); } else { form.page.value = pressbutton; form.submit(); } } function submitview(pressbutton){ var form = document.adminForm; if(form.user_id.value == 0){ alert('Please select User'); } else { form.view.value = pressbutton; form.submit(); } } //--> </script> <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> <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 echo _JLMS_QUIZ_FILTER_BY . ' ' . $lists['quiz'] . ', ' . $lists['user']; ?> </div> </td> </tr> </table> </td> </tr> <tr> <td width="100%"> <?php $reports_colspan = 10; ?> <table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php echo JLMSCSS::_('jlmslist'); ?> " style="margin-top:0px; padding-top:0px; margin-bottom:0px; padding-bottom:0px;"> <tr> <<?php echo JLMSCSS::tableheadertag(); ?> width="20" class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " align="center">#</<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> width="20" class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " align="center"><input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count($rows); ?> );" /></<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> "><?php echo _JLMS_QUIZ_TBL_DATE_TIME; ?> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> "><?php echo _JLMS_QUIZ_TBL_STUDENT; ?> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> "><?php echo _JLMS_QUIZ_TBL_QUIZ; ?> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> "><?php echo _JLMS_QUIZ_TBL_USER_SCORE; ?> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> "><?php echo _JLMS_QUIZ_TBL_TOTAL_SCORE; ?> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> "><?php echo _JLMS_QUIZ_TBL_PASS_SCORE; ?> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> "><?php echo _JLMS_QUIZ_TBL_PASSED; ?> </<?php echo JLMSCSS::tableheadertag(); ?> > <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> "><?php echo _JLMS_QUIZ_TBL_SPEND_TIME; ?> </<?php echo JLMSCSS::tableheadertag(); ?> > </tr> <?php $k = 1; $p_img = $JLMS_CONFIG->get('live_site') . '/components/com_joomla_lms/lms_images/toolbar/btn_accept.png'; $f_img = $JLMS_CONFIG->get('live_site') . '/components/com_joomla_lms/lms_images/toolbar/btn_cancel.png'; for ($i = 0, $n = count($rows); $i < $n; $i++) { $row = $rows[$i]; $link = sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=quizzes&id={$course_id}&page=stu_reportA&c_id=" . $row->c_id); $checked = mosHTML::idBox($i, $row->c_id); if (!$row->c_student_id) { $row->username = "******"; } if (!$row->username) { $row->username = "******"; } if (!$row->c_title) { $row->c_title = "Quiz not found"; } ?> <tr class="<?php echo JLMSCSS::_('sectiontableentry' . $k); ?> "> <td align="center"><?php echo $pageNav->limitstart + $i + 1; ?> </td> <td><?php echo $checked; ?> </td> <td align="left"> <a href="<?php echo $link; ?> "> <?php echo JLMS_dateToDisplay(strtotime($row->c_date_time), true, $JLMS_CONFIG->get('offset') * 60 * 60, ' H:i:s'); ?> </a> </td> <td align="left"> <?php echo $row->username . '<br />' . $row->name; ?> </td> <td align="left"> <?php echo $row->c_title; ?> </td> <td align="left"> <?php echo $row->c_total_score; ?> </td> <td align="left"> <?php echo $row->c_full_score . (in_array($row->cur_quiz_id, $lists['pool_quizzes']) ? '+' : ''); ?> </td> <td align="left"> <?php if ($JLMS_CONFIG->get('global_quest_pool')) { $passed_score = ceil($row->c_full_score * $row->c_passing_score / 100) . (in_array($row->cur_quiz_id, $lists['pool_quizzes_gqp']) ? '+' : ''); } else { $passed_score = ceil($row->c_full_score * $row->c_passing_score / 100) . (in_array($row->cur_quiz_id, $lists['pool_quizzes']) ? '+' : ''); } echo $passed_score . (strlen($row->c_passing_score) ? " (" . $row->c_passing_score . "%)" : ''); ?> </td> <td align="left"> <img src="<?php echo $row->c_passed ? $p_img : $f_img; ?> " width="16" height="16" border="0" alt="<?php echo $row->c_passed ? 'passed' : 'failed'; ?> " /> </td> <td align="left"> <?php $tot_min = floor($row->c_total_time / 60); $tot_sec = $row->c_total_time - $tot_min * 60; echo str_pad($tot_min, 2, "0", STR_PAD_LEFT) . ":" . str_pad($tot_sec, 2, "0", STR_PAD_LEFT); ?> </td> </tr> <?php $k = 3 - $k; } ?> <tr> <td align="center" colspan="<?php echo $reports_colspan; ?> " class="<?php echo JLMSCSS::_('jlmslist-footer_td'); ?> "> <div align="center" style="white-space: nowrap;"> <?php $link = "index.php?option={$option}&Itemid={$Itemid}&task=quizzes&id={$course_id}&page={$page}"; echo _JLMS_PN_DISPLAY_NUM . ' ' . $pageNav->getLimitBox($link) . ' ' . $pageNav->getPagesCounter(); echo '<br />'; echo $pageNav->writePagesLinks($link); ?> </div> </td> </tr> </table> </td> </tr> <tr> <td align="center"> <?php $controls = array(); $controls[] = array('href' => "javascript:submitview('xls');", 'title' => 'XLS', 'img' => 'xls'); JLMS_TMPL::ShowControlsFooterC($controls, '', false, false, _JLMS_EXPORT_TO . ':'); ?> </td> </tr> </table> <input type="hidden" name="option" value="<?php echo $option; ?> " /> <input type="hidden" name="Itemid" value="<?php echo $Itemid; ?> " /> <input type="hidden" name="task" value="quizzes" /> <input type="hidden" name="id" value="<?php echo $course_id; ?> " /> <input type="hidden" name="page" value="<?php echo $page; ?> " /> <input type="hidden" name="boxchecked" value="0" /> <input type="hidden" name="view" value="" /> </form> <?php JLMS_quiz_admin_html_class::showQuizFooter(); }
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_sreportScorm($option, &$rows, $start_date, $end_date, &$pageNav, &$lists, $levels, $filt_cat, $filt_group, $is_full) { global $JLMS_CONFIG; $Itemid = $JLMS_CONFIG->get('Itemid'); //FLMS multicat $multicat = array(); if ($JLMS_CONFIG->get('multicat_use', 0)) { $multicat = array(); $i = 0; foreach ($lists as $key => $item) { if (substr($key, 0, 7) == 'filter_') { $multicat[] = $lists['filter_' . $i]; $i++; } } } JLMS_TMPL::OpenMT(); $lists['user_id'] = isset($lists['user_id']) ? $lists['user_id'] : 0; if ($is_full) { $hparams = array('show_menu' => false); } else { $hparams = array('simple_menu' => true); } $toolbar = array(); JLMS_TMPL::ShowHeader('tracking', _JLMS_REPORTS_SCORM . ' ' . date("Y-m-d H:i:s"), $hparams, $toolbar); JLMS_TMPL::OpenTS(); ?> <script language="javascript" type="text/javascript"> <!--//--><![CDATA[//><!-- function pickup_date(){ var form = document.adminForm; form.end_date.value = form.pick_date.value; form.start_date.value = form.pick_to_date.value; var is_cor = 1; if(form.start_date.value.length == 10 && form.end_date.value.length == 10) { if("<?php echo $JLMS_CONFIG->get('date_format', "Y-m-d"); ?> " == "d-m-Y"){ if(form.end_date.value.substring(5)<form.start_date.value.substring(5)){ is_cor = 0; } else if( form.end_date.value.substring(2,5)<form.start_date.value.substring(2,5)){ is_cor = 0; } else if( form.end_date.value.substring(0,2)<form.start_date.value.substring(0,2)){ is_cor = 0; } } else { if(form.end_date.value.substring(0,4)<form.start_date.value.substring(0,4)){ is_cor = 0; } else if ( form.end_date.value.substring(5,7)<form.start_date.value.substring(5,7)){ is_cor = 0; } else if ( form.end_date.value.substring(8,10)<form.start_date.value.substring(8,10)){ is_cor = 0; } } } if(!is_cor){ alert("<?php echo _JLMS_REPORTS_SELECT_DATE; ?> "); } else { form.view.value = ''; form.submit(); } } function pickup_date_reset(){ var form = document.adminForm; form.pick_date.value = '-'; form.pick_to_date.value = '-'; form.end_date.value = form.pick_date.value; form.start_date.value = form.pick_to_date.value; form.view.value = ''; form.submit(); } var old_filters = new Array(); function read_filter(){ var form = document.adminForm; var count_levels = '<?php echo count($levels); ?> '; for(var i=0;i<parseInt(count_levels);i++){ if(form['filter_id_'+i] != null){ old_filters[i] = form['filter_id_'+i].value; } } } function write_filter(){ var form = document.adminForm; var count_levels = '<?php echo count($levels); ?> '; var j; for(var i=0;i<parseInt(count_levels);i++){ if(form['filter_id_'+i+''] != null && form['filter_id_'+i+''].value != old_filters[i]){ j = i; } if(i > j){ if(form['filter_id_'+i] != null){ form['filter_id_'+i].value = 0; } } } } function submitFormView(view){ var form = document.adminForm; form.view.value = view; form.task.value='report_scorm'; form.submit(); } //--><!]]> </script> <?php $action_url = $is_full ? $JLMS_CONFIG->get('live_site') . "/index.php?tmpl=component&option={$option}&Itemid={$Itemid}" : sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}"); ?> <form action="<?php echo $action_url; ?> " method="post" name="adminForm"> <table cellpadding="0" cellspacing="0" border="0" id="TheTable" <?php echo $is_full ? "" : 'width="100%"'; ?> > <?php if (!$is_full) { ?> <tr> <td align="<?php echo $is_full ? "left" : "right"; ?> " <?php echo !$is_full ? 'colspan="4"' : ''; ?> > <table <?php echo $is_full ? '' : 'width="30%"'; ?> > <tr> <td valign="top" <?php echo $is_full ? 'width="400"' : 'width="40%"'; ?> > <table width="100%" border="0"> <tr> <td <?php echo $is_full ? 'width="100"' : 'width="20%"'; ?> nowrap="nowrap"> Report Type: </td> <td> <?php echo JLMS_switchType($option); ?> </td> </tr> </table> </td> </tr> </table> </td> </tr> <?php } ?> <tr> <td align="left"> <table <?php echo $is_full ? '' : 'width="100%"'; ?> > <tr> <td valign="top" <?php echo $is_full ? 'width="400"' : 'width="40%"'; ?> > <table width="100%" border="0"> <?php if ($is_full) { ?> <tr> <td <?php echo $is_full ? 'width="100"' : 'width="20%"'; ?> nowrap="nowrap"> Report Type: </td> <td> <?php echo JLMS_switchType($option); ?> </td> </tr> <?php } ?> <tr> <td <?php echo $is_full ? 'width="100"' : 'width="20%"'; ?> nowrap="nowrap"> <?php if ($JLMS_CONFIG->get('multicat_use', 0)) { echo isset($levels[0]->cat_name) && $levels[0]->cat_name != '' ? $levels[0]->cat_name : _JLMS_COURSES_COURSES_GROUPS; } else { echo _JLMS_COURSES_COURSES_GROUPS; } ?> </td> <td> <?php if ($JLMS_CONFIG->get('multicat_use', 0)) { echo $lists['filter_0']; } else { echo $lists['jlms_course_cats']; } ?> </td> </tr> <?php if (count($multicat)) { for ($i = 0; $i < count($multicat); $i++) { if ($i > 0) { ?> <tr> <td <?php echo $is_full ? 'width="100"' : 'width="20%"'; ?> nowrap="nowrap"> <?php echo isset($levels[$i]->cat_name) && $levels[$i]->cat_name != '' ? $levels[$i]->cat_name : _JLMS_COURSES_COURSES_GROUPS; ?> </td> <td> <?php echo $lists['filter_' . $i]; ?> </td> </tr> <?php } } } ?> <tr> <td <?php echo $is_full ? 'width="100"' : 'width="20%"'; ?> nowrap="nowrap"> Courses: </td> <td> <?php echo $lists['filt_course']; ?> </td> </tr> </table> </td> <td valign="top" <?php echo $is_full ? 'width="400"' : 'width="40%"'; ?> > <table width="100%" border="0"> <?php if ($is_full) { ?> <tr> <td colspan="2"> </td> </tr> <?php } if ($JLMS_CONFIG->get('use_global_groups', 1)) { ?> <tr> <td style="padding-left: 5px;" <?php echo $is_full ? 'width="100"' : 'width="20%"'; ?> nowrap="nowrap"> <?php echo _JLMS_USER_GROUP_INFO; ?> </td> <td> <?php echo $lists['filt_group']; ?> </td> </tr> <?php } ?> <tr> <td colspan="2"> <table width="100%" border="0"> <tr> <td style="padding:0px 10px;" width="30">From</td> <td valign="middle" align="center"> <?php echo JLMS_HTML::_('calendar.calendar', $start_date, 'pick_to', 'pick_to', null, null, 'statictext'); ?> </td> <td style="padding:0px 10px;" width="30">To</td> <td valign="middle" align="center"> <?php echo JLMS_HTML::_('calendar.calendar', $end_date, 'pick', 'pick', null, null, 'statictext'); ?> </td> <td valign="middle" align="center" width="18" style="vertical-align:middle "> <a href="javascript:pickup_date_reset();" title=""> <img class="JLMS_png" src="<?php echo $JLMS_CONFIG->get('live_site'); ?> /components/com_joomla_lms/lms_images/toolbar/btn_publish_hidden.png" alt="" title="Disabled filter date" border="0" width="16" height="16" /> </a> </td> <td valign="middle" align="center" width="18" style="vertical-align:middle "> <a href="javascript:pickup_date();" title=""> <img class="JLMS_png" src="<?php echo $JLMS_CONFIG->get('live_site'); ?> /components/com_joomla_lms/lms_images/toolbar/btn_accept.png" alt="" title="Enabled filter date" border="0" width="16" height="16" /> </a> </td> </tr> </table> </td> </tr> </table> </td> <?php if (!$is_full) { ?> <td style="padding-left:15px; white-space: nowrap;" align="right"> <?php $link = $JLMS_CONFIG->get('live_site') . "/index.php?tmpl=component&option=" . $option . "&Itemid={$Itemid}&task=report_scorm&is_full=1"; $link .= $filt_group ? "&filt_group=" . $filt_group : ""; $link .= $start_date != "-" ? "&start_date=" . JLMS_dateToDisplay($start_date) : ""; $link .= $end_date != "-" ? "&end_date=" . JLMS_dateToDisplay($end_date) : ""; ?> <a href="<?php echo $link; ?> " target="_blank" title="<?php echo _JLMS_FULL_VIEW_BUTTON; ?> "><?php echo _JLMS_FULL_VIEW_BUTTON; ?> </a> </td> <?php } ?> </tr> </table> </td> </tr> </table> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <thead> <tr> <td class="sectiontableheader" style="white-space: nowrap;"> Username </td> <td class="sectiontableheader" style="white-space: nowrap;"> Name </td> <td class="sectiontableheader" style="white-space: nowrap;"> Email </td> <td class="sectiontableheader" style="white-space: nowrap;"> Course Name </td> <td class="sectiontableheader" style="white-space: nowrap;"> Course ID </td> <td class="sectiontableheader" style="white-space: nowrap;"> Date </td> <td class="sectiontableheader" style="text-align: center; white-space: nowrap;"> Score </td> <td class="sectiontableheader" style="text-align: center; white-space: nowrap;"> Course Status </td> </tr> </thead> <tbody> <?php $k = 1; for ($i = 0, $n = count($rows); $i < $n; $i++) { $row = $rows[$i]; ?> <tr class="<?php echo "sectiontableentry{$k}"; ?> "> <td> <?php echo $row->username; ?> </td> <td> <?php echo $row->name; ?> </td> <td> <?php echo $row->email; ?> </td> <td> <?php echo $row->course_name; ?> </td> <td> <?php echo $row->lpath_name; ?> </td> <td> <?php if (isset($row->scorm_data) && $row->scorm_data->status) { if ($row->scorm_data->end) { $date_end = date("Y-m-d H:i:s", $row->scorm_data->end); echo JLMS_dateToDisplay($date_end); } } ?> </td> <td align="center"> <?php if (isset($row->scorm_data)) { echo $row->scorm_data->score; } ?> </td> <td align="center"> <?php $image = $row->course_status ? 'btn_accept.png' : 'btn_cancel.png'; $alt = $row->course_status ? 'btn_accept' : 'btn_cancel'; $alt .= '" align="top'; echo JLMS_reports_html::publishIcon(0, 0, 0, '', $alt, $image, $option, false); ?> </td> </tr> <?php $k = 3 - $k; } ?> </tbody> </table> <?php if ($lists['user_id'] && !$is_full && count($rows)) { if ($JLMS_CONFIG->get('new_lms_features', 1)) { $controls = array(); $controls[] = array('href' => "javascript:submitFormView('csv');", 'title' => 'CSV', 'img' => 'csv'); JLMS_TMPL::ShowControlsFooterC($controls, '', false, false, _JLMS_EXPORT_TO . ':'); } } ?> <?php if ($lists['user_id'] && !$is_full) { ?> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td align="center"> <?php $link = "index.php?option={$option}&Itemid={$Itemid}&task=report_scorm&filt_group={$filt_group}&filt_cat={$filt_cat}"; $link .= strlen($start_date) ? "&start_date=" . JLMS_dateToDisplay($start_date) : ""; $link .= strlen($end_date) ? "&end_date=" . JLMS_dateToDisplay($end_date) : ""; echo $pageNav->writePagesLinks($link); ?> </td> </tr> <tr> <td align="center"> <?php echo _JLMS_PN_DISPLAY_NUM . $pageNav->getLimitBox($link) . ' ' . $pageNav->getPagesCounter(); ?> </td> </tr> </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="report_scorm" /> <input type="hidden" name="view" value="" /> <input type="hidden" name="start_date" value="<?php echo $start_date; ?> " /> <input type="hidden" name="end_date" value="<?php echo $end_date; ?> " /> <input type="hidden" name="state" value="0" /> <input type="hidden" name="boxchecked" value="0" /> <input type="hidden" name="is_full" value="<?php echo $is_full; ?> " /> </form> <?php $action_url = $is_full ? $JLMS_CONFIG->get('live_site') . "/index.php?tmpl=component&option={$option}&Itemid={$Itemid}" : sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}"); ?> <form action="<?php echo $action_url; ?> " method="post" name="adminFormCsv"> <input type="hidden" name="option" value="<?php echo $option; ?> " /> <input type="hidden" name="Itemid" value="<?php echo $Itemid; ?> " /> <input type="hidden" name="task" value="report_scorm" /> <input type="hidden" name="is_full" value="1" /> <input type="hidden" name="view" value="" /> </form> <?php JLMS_TMPL::CloseTS(); JLMS_TMPL::CloseMT(); }
function showUserAttendance($option, &$rows, &$per_rows, &$date_rows, &$lists) { global $Itemid, $my, $JLMS_CONFIG; $JLMS_ACL =& JLMSFactory::getACL(); ?> <script language="javascript" type="text/javascript"> <!--//--><![CDATA[//><!-- function submitbutton_change(pressbutton, period_id, state) { var form = document.adminForm; if (pressbutton == 'at_dateschange'){ if (form.boxchecked.value == 0) { alert( "<?php echo _JLMS_ALERT_SELECT_ITEM; ?> " ); } else { form.task.value = pressbutton; form.state.value = state; form.period_id.value = period_id; form.submit(); } } } function submitbutton_change_user(pressbutton, period_id, state, cid_id, at_date_value) { var form = document.adminForm; if (pressbutton == 'at_uchange'){ form.cid2.value = cid_id; form.task.value = pressbutton; form.at_date.value = at_date_value; form.state.value = state; form.period_id.value = period_id; form.submit(); } } function pickup_date(){ var form = document.adminForm; form.at_date.value = form.pick_date.value; form.submit(); } //--><!]]> </script> <?php JLMS_TMPL::OpenMT(); $hparams = array(); $toolbar = array(); if ($JLMS_ACL->CheckPermissions('attendance', 'manage')) { $hparams['second_tb_header'] = $lists['username'] . ', ' . $lists['name']; $toolbar[] = array('btn_type' => 'back', 'btn_js' => sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=attendance&id=" . $lists['course_id'])); } JLMS_TMPL::ShowHeader('attendance', $JLMS_ACL->CheckPermissions('attendance', 'manage') ? _JLMS_ATT_TITLE : _JLMS_ATT_TITLE_STU, $hparams, $toolbar); if ($JLMS_ACL->CheckPermissions('attendance', 'manage')) { JLMS_TMPL::OpenTS('', ' class="contentheading"'); //echo $lists['username'].', '.$lists['name']; JLMS_TMPL::CloseTS(); } 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="left" style="text-align:left "> <div align="left" style="white-space:nowrap "> </div> </td> <td align="right" style="text-align:right "> <div align="right" style="white-space:nowrap "> <table cellpadding="0" cellspacing="0" border="0" style="height:16px" class="jlms_table_no_borders"> <tr> <td><?php echo $lists['filter']; ?> </td> <td valign="middle" align="center" width="16"> <?php echo JLMS_HTML::_('calendar.calendar', $lists['at_date'], 'pick', 'pick', null, null, 'statictext'); ?> </td><td valign="middle" align="center" width="18" style="vertical-align:middle "> <a class="jlms_img_link" href="javascript:pickup_date();" title="<?php echo _JLMS_AGENDA_GO_DATE; ?> "> <img class="JLMS_png" src="<?php echo $JLMS_CONFIG->get('live_site'); ?> /components/com_joomla_lms/lms_images/agenda/loopnone.png" alt="<?php echo _JLMS_AGENDA_GO_DATE; ?> " title="<?php echo _JLMS_AGENDA_GO_DATE; ?> " border="0" width="16" height="16" /> </a> <noscript> <input type="submit" name="OK" value="OK" /> <input type="hidden" name="no_script" value="1" /> </noscript> </td> </tr> </table> </div> </td> </tr> </table> <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 if ($JLMS_ACL->CheckPermissions('attendance', 'manage')) { ?> <<?php echo JLMSCSS::tableheadertag(); ?> width="20" class="<?php echo JLMSCSS::_('sectiontableheader'); ?> " align="center"><input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count($rows); ?> );" /></<?php echo JLMSCSS::tableheadertag(); ?> > <?php } ?> <<?php echo JLMSCSS::tableheadertag(); ?> class="<?php echo JLMSCSS::_('sectiontableheader'); ?> ">date</<?php echo JLMSCSS::tableheadertag(); ?> > <?php foreach ($per_rows as $per_row) { echo '<' . JLMSCSS::tableheadertag() . ' align=\'center\' nowrap="nowrap" class="' . JLMSCSS::_('sectiontableheader') . '" style="text-align:center; white-space:nowrap">' . substr($per_row->period_begin, 0, 5) . ' - ' . substr($per_row->period_end, 0, 5) . '</' . JLMSCSS::tableheadertag() . '>'; } ?> </tr> <?php $k = 1; for ($i = 0, $n = count($rows); $i < $n; $i++) { $row = $rows[$i]; #$link = "index.php?option=$option&Itemid=".$Itemid."&task=at_userattend&course_id=".$lists['course_id']."&at_date=".$lists['at_date']."&id={$row->user_id}"; $checked = JLMS_attendance_html::idBox($i, $row->at_date, $row->is_selected); ?> <tr class="<?php echo JLMSCSS::_('sectiontableentry' . $k); ?> "> <td align="center" valign="middle"><?php echo $i + 1; ?> </td> <?php if ($JLMS_ACL->CheckPermissions('attendance', 'manage')) { ?> <td><?php echo $checked; ?> </td> <?php } ?> <td align="left" valign="middle" style="vertical-align:middle "> <?php echo JLMS_dateToDisplay($row->at_date); ?> </td> <?php $j = 0; while ($j < count($row->at_stats)) { $alt = $row->at_stats[$j]->at_status ? _JLMS_ATT_STATUS_ATTENDED : _JLMS_ATT_STATUS_NOTATTENDED; $image = $row->at_stats[$j]->at_status ? 'btn_accept.png' : 'btn_cancel.png'; $state = $row->at_stats[$j]->at_status ? 0 : 1; echo '<td align=\'center\' valign="middle" style="vertical-align:middle;text-align:center ">'; if ($JLMS_ACL->CheckPermissions('attendance', 'manage')) { echo '<a class="jlms_img_link" href="javascript:submitbutton_change_user(\'at_uchange\',' . $row->at_stats[$j]->period_id . ',' . $state . ',' . $lists['user_id'] . ',\'' . $row->at_date . '\');" title="' . $alt . '"><img 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 . '" /></a>'; } elseif ($JLMS_ACL->CheckPermissions('attendance', 'view')) { echo '<img 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 . '" />'; } echo '</td>'; $j++; } ?> </tr> <?php $k = 3 - $k; } if ($JLMS_ACL->CheckPermissions('attendance', 'manage')) { ?> <tr class="<?php echo JLMSCSS::_('sectiontableentry' . $k); ?> "> <td colspan="3"><?php echo _JLMS_ATT_WITH_SELECTED; ?> </td> <?php foreach ($per_rows as $per_row) { echo '<td align=\'center\' valign="middle" style="text-align:center; vertical-align:middle;">'; echo '<a class="jlms_img_link" href="javascript:submitbutton_change(\'at_dateschange\',' . $per_row->id . ',1);" title="' . _JLMS_ATT_MARK_ATTENDED . '">'; echo '<img class="JLMS_png" src="' . $JLMS_CONFIG->get('live_site') . '/components/com_joomla_lms/lms_images/toolbar/btn_accept.png" width="16" height="16" border="0" alt="' . _JLMS_ATT_MARK_ATTENDED . '" />'; echo '</a> '; echo '<a class="jlms_img_link" href="javascript:submitbutton_change(\'at_dateschange\',' . $per_row->id . ',0);" title="' . _JLMS_ATT_MARK_NOTATTENDED . '">'; echo '<img class="JLMS_png" src="' . $JLMS_CONFIG->get('live_site') . '/components/com_joomla_lms/lms_images/toolbar/btn_cancel.png" width="16" height="16" border="0" alt="' . _JLMS_ATT_MARK_NOTATTENDED . '" />'; echo '</a>'; echo '</td>'; } ?> </tr> <?php } ?> </table> <input type="hidden" name="option" value="<?php echo $option; ?> " /> <input type="hidden" name="Itemid" value="<?php echo $Itemid; ?> " /> <input type="hidden" name="task" value="<?php echo $JLMS_ACL->CheckPermissions('attendance', 'manage') ? 'at_userattend' : 'attendance'; ?> " /> <input type="hidden" name="at_date" value="<?php echo JLMS_dateToDisplay($lists['at_date']); ?> " /> <input type="hidden" name="period_id" value="0" /> <input type="hidden" name="state" value="0" /> <input type="hidden" name="cid2" value="0" /> <input type="hidden" name="boxchecked" value="<?php echo $lists['box']; ?> " /> <input type="hidden" name="course_id" value="<?php echo $lists['course_id']; ?> " /> <input type="hidden" name="id" value="<?php echo $JLMS_ACL->CheckPermissions('attendance', 'manage') ? $lists['user_id'] : $lists['course_id']; ?> " /> </form> <?php JLMS_TMPL::CloseTS(); JLMS_TMPL::CloseMT(); }
function makeInvoicePDF($print_row, $filename) { global $JLMS_CONFIG; $JLMS_LANGUAGE1 = array(); JLMS_require_lang($JLMS_LANGUAGE1, 'pdf.lang', $JLMS_CONFIG->get('default_language'), 'frontend'); JLMS_processLanguage($JLMS_LANGUAGE1); $image_logo = JPATH_SITE . DS . 'images' . DS . 'joomlalms_invoice_logo.jpg'; $logo_offset = 0; $this->pdf->AddPage(); $top = 20; if (file_exists($image_logo)) { $this->pdf->Image($image_logo, '', '', 56); } $imgRBY = $this->pdf->getImageRBY(); $dYl = $imgRBY ? $imgRBY + 4 : $top; $this->pdf->SetFontSize(12); $this->pdf->Text(140, $top, $print_row->site_name); $this->pdf->SetFontSize(14); $this->pdf->text(10, $dYl, _JLMS_INVOICE_HEADER); $dYl += 8; $this->pdf->setFont('freesansi', 'I'); //choose font $th_text = _JLMS_INVOICE_NUMBER_TEXT . $print_row->invoice_number; $this->pdf->SetFontSize(6); $this->pdf->text(10, $dYl, $th_text); $dYl += 4; $th_text = _JLMS_INVOICE_DATE_TEXT . JLMS_dateToDisplay($print_row->date); $this->pdf->SetFontSize(6); $this->pdf->text(10, $dYl, $th_text); $this->pdf->setFont('freesans'); //choose font $sdvig = 0; $site_descr = explode(chr(13), $print_row->site_descr); $this->pdf->SetFontSize(8); $dYr = $top + 8; for ($i = 0; $i < count($site_descr); $i++) { $this->pdf->text(140, $dYr + $sdvig, trim(stripslashes($site_descr[$i]))); $sdvig += 4; } $comp_descr = explode(chr(13), $print_row->comp_descr); $dYr += $sdvig + 8; $sdvig = 0; for ($i = 0; $i < count($comp_descr); $i++) { $this->pdf->text(140, $dYr + $sdvig, trim(str_replace(chr(13), '', stripslashes($comp_descr[$i])))); $sdvig += 4; } $this->pdf->SetFontSize(12); $dYl += $sdvig + 10; $this->pdf->text(10, $dYl, _JLMS_INVOICE_CUSTOMER_INFO_HEADER); $this->pdf->setFont('freesansb'); //choose font $custom_invoice_fields = $JLMS_CONFIG->get('custom_invoice_fields', array()); $this->pdf->SetFontSize(8); $dYl += 4; $left = 25; if (!empty($custom_invoice_fields)) { $sdvig = 0; foreach ($custom_invoice_fields as $cif) { $ftext = $cif->lang_var; if (defined($ftext)) { $ftext = constant($ftext); } $this->pdf->text($left, $dYl + $sdvig, $ftext); $sdvig += 4; } $this->pdf->setFont('freesans'); //choose font $sdvig = 0; foreach ($custom_invoice_fields as $cif) { $fname = $cif->var_name; $ftext = $print_row->{$fname}; $this->pdf->text($left + 30, $dYl + $sdvig, stripslashes($ftext)); $sdvig += 4; } $dYl += $sdvig; } else { $dYl2 = $dYl; $left = 25; $this->pdf->text($left, $dYl, _JLMS_INVOICE_CUSTOMER_NAME_TEXT); $dYl += 4; $this->pdf->text($left, $dYl, _JLMS_INVOICE_CUSTOMER_COMPANY_TEXT); $dYl += 4; $this->pdf->text($left, $dYl, _JLMS_INVOICE_CUSTOMER_ADDRESS_TEXT); $dYl += 4; $this->pdf->text($left, $dYl, _JLMS_INVOICE_CUSTOMER_CITY_TEXT); $dYl += 4; $this->pdf->text($left, $dYl, _JLMS_INVOICE_CUSTOMER_PHONE_TEXT); $this->pdf->setFont('freesans'); //choose font $this->pdf->text($left + 30, $dYl2, stripslashes($print_row->name)); $dYl2 += 4; $this->pdf->text($left + 30, $dYl2, stripslashes($print_row->company)); $dYl2 += 4; $this->pdf->text($left + 30, $dYl2, stripslashes($print_row->address)); $dYl2 += 4; $this->pdf->text($left + 30, $dYl2, stripslashes($print_row->city)); $dYl2 += 4; $this->pdf->text($left + 30, $dYl2, stripslashes($print_row->phone)); } if (chop($print_row->comments)) { $this->pdf->SetFontSize(12); $dYl += 10; $this->pdf->text(10, $dYl, _JLMS_INVOICE_COMMENTS_HEADER); $comments = explode(chr(13), $print_row->comments); $this->pdf->SetFontSize(8); $sdvig = 0; for ($i = 0; $i < count($comments); $i++) { $this->pdf->text(10, $dYl + 6 + $sdvig, trim(str_replace(chr(13), '', stripslashes($comments[$i])))); $sdvig += 4; } } $dYl += $sdvig + 6; if (isset($print_row->is_sales)) { $this->pdf->SetFontSize(10); $this->pdf->SetY($dYl); $this->pdf->Ln(); $this->pdf->Cell(30, 8, 'SALESPERSON', 1, 0, 'C'); $this->pdf->Cell(30, 8, 'P.O. NUMBER', 1, 0, 'C'); $this->pdf->Cell(30, 8, 'REQUISITIONER', 1, 0, 'C'); $this->pdf->Cell(30, 8, 'SHIPPED VIA', 1, 0, 'C'); $this->pdf->Cell(40, 8, 'F.O.B. POINT', 1, 0, 'C'); $this->pdf->Cell(30, 8, 'TERMS', 1, 0, 'C'); $this->pdf->Ln(); $this->pdf->Cell(30, 8, $print_row->sales_name, 1, 0, 'C'); $this->pdf->Cell(30, 8, $print_row->po_number, 1, 0, 'C'); $this->pdf->Cell(30, 8, $print_row->requistioner, 1, 0, 'C'); $this->pdf->Cell(30, 8, $print_row->shipped_via, 1, 0, 'C'); $this->pdf->Cell(40, 8, $print_row->fob_point, 1, 0, 'C'); $this->pdf->Cell(30, 8, $print_row->terms, 1, 0, 'C'); $this->pdf->Ln(); $dYl += 20; } $was_add_details = false; $data = array(); $w1 = 40; $w2 = 65; $w3 = 45; $w4 = 40; $this->pdf->SetY($dYl); $this->pdf->Ln(); $this->pdf->Cell($w1, 8, _JLMS_INVOICE_UNITS_TABLE_QUANTITY_COLUMN, 1, 0, 'C'); $this->pdf->Cell($w2, 8, _JLMS_INVOICE_UNITS_TABLE_DESC_COLUMN, 1, 0, 'C'); $this->pdf->Cell($w3, 8, _JLMS_INVOICE_UNITS_TABLE_UNITPRICE_COLUMN, 1, 0, 'C'); $this->pdf->Cell($w4, 8, _JLMS_INVOICE_UNITS_TABLE_TOTALPRICE_COLUMN, 1, 0, 'C'); $this->pdf->Ln(); if (!empty($print_row->payment_details) && is_array($print_row->payment_details)) { foreach ($print_row->payment_details as $pr_pd) { $this->pdf->Cell($w1, 8, $pr_pd->quantity, 1, 0, 'C'); $this->pdf->Cell($w2, 8, stripslashes($pr_pd->name), 1, 0, 'C'); $this->pdf->Cell($w3, 8, sprintf("%01.2f", $pr_pd->unit_price) . $JLMS_CONFIG->get('jlms_cur_code'), 1, 0, 'C'); $this->pdf->Cell($w4, 8, sprintf("%01.2f", $pr_pd->quantity * $pr_pd->price) . $JLMS_CONFIG->get('jlms_cur_code'), 1, 0, 'C'); $this->pdf->Ln(); } $was_add_details = true; } if (!empty($print_row->payment_details2) && is_array($print_row->payment_details2)) { foreach ($print_row->payment_details2 as $pr_pd2) { $this->pdf->Cell($w1, 8, $pr_pd2->quantity, 1, 0, 'C'); $this->pdf->Cell($w2, 8, stripslashes($pr_pd2->name), 1, 0, 'C'); $this->pdf->Cell($w3, 8, sprintf("%01.2f", $pr_pd2->unit_price) . $JLMS_CONFIG->get('jlms_cur_code'), 1, 0, 'C'); $this->pdf->Cell($w4, 8, sprintf("%01.2f", $pr_pd2->quantity * $pr_pd->price) . $JLMS_CONFIG->get('jlms_cur_code'), 1, 0, 'C'); $this->pdf->Ln(); } $was_add_details = true; } if (!$was_add_details) { $this->pdf->Cell($w1, 8, $print_row->quantity, 1, 0, 'C'); $this->pdf->Cell($w2, 8, stripslashes($print_row->description), 1, 0, 'C'); $this->pdf->Cell($w3, 8, sprintf("%01.2f", $print_row->price) . $JLMS_CONFIG->get('jlms_cur_code'), 1, 0, 'C'); $this->pdf->Cell($w4, 8, sprintf("%01.2f", $print_row->quantity * $print_row->price) . $JLMS_CONFIG->get('jlms_cur_code'), 1, 0, 'C'); $this->pdf->Ln(); } $this->pdf->Cell($w1 + $w2 + $w3, 8, _JLMS_INVOICE_UNITS_TABLE_SUBTOTALPRICE_COLUMN, 0, 0, 'R'); $this->pdf->Cell($w4, 8, sprintf("%01.2f", $print_row->quantity * $print_row->price) . $JLMS_CONFIG->get('jlms_cur_code'), 1, 0, 'C'); $this->pdf->Ln(); $this->pdf->Cell($w1 + $w2 + $w3, 8, _JLMS_INVOICE_UNITS_TABLE_TAXPRICE_COLUMN, 0, 0, 'R'); $this->pdf->Cell($w4, 8, $print_row->tax_amount, 1, 0, 'C'); $this->pdf->Ln(); $this->pdf->Cell($w1 + $w2 + $w3, 8, _JLMS_INVOICE_UNITS_TABLE_SHIPPINGPRICE_COLUMN, 0, 0, 'R'); $this->pdf->Cell($w4, 8, $print_row->shipping, 1, 0, 'C'); $this->pdf->Ln(); $this->pdf->Cell($w1 + $w2 + $w3, 8, _JLMS_INVOICE_UNITS_TABLE_TOTALDUEPRICE_COLUMN, 0, 0, 'R'); $this->pdf->Cell($w4, 8, sprintf("%01.2f", $print_row->quantity * $print_row->price + $print_row->tax_amount) . $JLMS_CONFIG->get('jlms_cur_code'), 1, 0, 'C'); $this->pdf->Ln(); $invoice_descr = explode(chr(13), $print_row->invoice_descr); $mysdvig = 8; $this->pdf->SetFontSize(8); $cur_y = $this->pdf->GetY(); for ($i = 0; $i < count($invoice_descr); $i++) { $this->pdf->text(10, $cur_y + 10 + $mysdvig, trim(str_replace(chr(13), '', stripslashes($invoice_descr[$i])))); $mysdvig += 4; } $th_text = stripslashes($print_row->thanks_text); $this->pdf->Ln(); $this->pdf->SetY(265); $this->pdf->Cell(0, 8, $th_text, 0, 0, 'C'); $this->pdf->Output($filename, 'F'); }
function show_all_notices($option, $lists, $total, $pageNav, $limitstart, $limit) { global $JLMS_CONFIG, $Itemid; //FLMS multicat $multicat = array(); if ($JLMS_CONFIG->get('multicat_use', 0)) { $multicat = array(); $i = 0; foreach ($lists as $key => $item) { if (substr($key, 0, 7) == 'filter_') { $multicat[] = $lists['filter_' . $i]; $i++; } } } $link_pages = "index.php?option={$option}&task=view_all_notices"; ?> <script language="javascript" type="text/javascript"> <!--//--><![CDATA[//><!-- var old_filters = new Array(); function read_filter(){ var form = document.adminForm; var count_levels = '<?php echo count($lists['levels']); ?> '; for(var i=0;i<parseInt(count_levels);i++){ if(form['filter_id_'+i] != null){ old_filters[i] = form['filter_id_'+i].value; } } } function write_filter(){ var form = document.adminForm; var count_levels = '<?php echo count($lists['levels']); ?> '; var j; for(var i=0;i<parseInt(count_levels);i++){ if(form['filter_id_'+i+''] != null && form['filter_id_'+i+''].value != old_filters[i]){ j = i; } if(i > j){ if(form['filter_id_'+i] != null){ form['filter_id_'+i].value = 0; } } } } function submitbutton(pressbutton) { var form = document.adminForm; if ((pressbutton == 'delete_notice_no_ajax' || pressbutton == 'edit_notice_no_ajax') && form.boxchecked.value == '0') { alert('<?php echo _JLMS_ALERT_SELECT_ITEM; ?> '); } else { form.task.value = pressbutton; form.submit(); } } //--><!]]> </script> <form action="<?php echo $JLMS_CONFIG->get('live_site') . "/index.php?option={$option}&Itemid={$Itemid}"; ?> " method="post" name="adminForm"> <?php JLMS_TMPL::OpenMT(); $params = array('show_menu' => true, 'simple_menu' => true); JLMS_TMPL::ShowHeader('doc', 'View notices', $params); $controls = array(); $controls[] = array('href' => $JLMS_CONFIG->get('live_site') . "/index.php?option={$option}&Itemid={$Itemid}&task=new_notice_no_ajax", 'title' => 'New Notice', 'img' => 'add'); $controls[] = array('href' => "javascript:submitbutton('edit_notice_no_ajax');", 'title' => 'Edit Notice', 'img' => 'edit'); $controls[] = array('href' => "javascript:submitbutton('delete_notice_no_ajax');", 'title' => 'Delete Notice(s)', 'img' => 'delete'); // $controls[] = array('href' => 'spacer'); JLMS_TMPL::ShowControlsFooter($controls, '', false); JLMS_TMPL::CloseMT(); ?> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td colspan="5"> <table border="0" cellpadding="0" cellspacing="0" align="right"> <tr> <td align="right"> <?php if ($JLMS_CONFIG->get('multicat_use', 0)) { echo (isset($lists['levels'][0]->cat_name) && $lists['levels'][0]->cat_name != '' ? $lists['levels'][0]->cat_name : _JLMS_COURSES_COURSES_GROUPS) . " " . $lists['filter_0']; } else { echo _JLMS_COURSES_COURSES_GROUPS . " " . $lists['groups_course']; } ?> </td> </tr> <?php if (count($multicat)) { for ($i = 0; $i < count($multicat); $i++) { if ($i > 0) { ?> <tr> <td align="right"> <?php echo (isset($lists['levels'][$i]->cat_name) && $lists['levels'][$i]->cat_name != '' ? $lists['levels'][$i]->cat_name : _JLMS_COURSES_COURSES_GROUPS) . " " . $lists['filter_' . $i]; ?> </td> </tr> <?php } } } if (isset($lists['levels'][0]) || count($multicat)) { ?> <tr> <td align="right"> <?php echo $lists['f_course']; ?> </td> </tr> <?php } ?> </table> </td> </tr> <tr> <td colspan="5" align="center"> <?php echo $pageNav->writePagesCounter() . ' ' . $pageNav->getLimitBox($link_pages); ?> </td> </tr> <tr> <td class="sectiontableheader" width="1%"> # </td> <td class="sectiontableheader" width="1%"> <input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count($lists['my_notices']); ?> );" /> </td> <td class="sectiontableheader"> Notice </td> <td class="sectiontableheader" width="20%"> Course name </td> <td class="sectiontableheader" width="10%"> Date </td> </tr> <?php $link_base = 'index.php?option=com_joomla_lms'; $z = $limitstart; $end = $limit + $z; if ($end > $total) { $end = $total + 1; } $k = 1; for ($i = $z; $i < $end; $i++) { if (isset($lists['my_notices'][$i])) { $m_n = $lists['my_notices'][$i]; $link = $link_base; if ($m_n->doc_id) { $link .= '&task=' . $m_n->task . '&course_id=' . $m_n->course_id . '&id=' . $m_n->doc_id . ''; } else { $link .= '&task=' . $m_n->task . '&id=' . $m_n->course_id . ''; } $checked = mosHTML::idBox($i, $m_n->id); ?> <tr class="<?php echo "sectiontableentry{$k}"; ?> "> <td align="center" width="1%"><?php echo $pageNav->limitstart + $i + 1; ?> </td> <td align="center" width="1%"><?php echo $checked; ?> </td> <td style="text-align: justify;"> <?php if (!$m_n->course_id && !$m_n->doc_id) { /* if(strlen($m_n->notice) > 100){ echo substr($m_n->notice, 0, 100).' ...'; } else { echo substr($m_n->notice, 0, 100); } */ echo $m_n->notice; } else { ?> <a href="<?php echo sefRelToAbs($link); ?> " title="<?php echo str_replace('"', '"', strip_tags(substr($m_n->notice, 0, 30))); ?> "> <?php /* if(strlen($m_n->notice) > 100){ echo substr($m_n->notice, 0, 100).' ...'; } else { echo substr($m_n->notice, 0, 100); } */ echo $m_n->notice; ?> </a> <?php } ?> </td> <td> <?php echo $m_n->course_name; ?> </td> <td width="10%" nowrap="nowrap"> on <?php echo JLMS_dateToDisplay($m_n->data, false, 0, " H:m:s"); ?> </td> </tr> <?php $k = 3 - $k; } } ?> <tr> <td colspan="5" align="center"> <br /> <?php echo $pageNav->writePagesLinks($link_pages); ?> </td> </tr> </table> <input type="hidden" name="task" value="" /> <input type="hidden" name="boxchecked" value="0" /> </form> <?php }
function JLMS_list_paid_subscriptions($option, &$subscriptions, $pageNav, &$procs, &$lists, &$avail_courses, &$user, $very_global_sub_id = 0) { global $Itemid, $JLMS_CONFIG, $JLMS_SESSION, $JLMS_DB, $my; $doc =& JFactory::getDocument(); $jlms_tax_counting = $JLMS_CONFIG->get('enabletax'); $sub_total = 0; $tax_amount = 0; $rows2 = array(); $enable_custom_subscriptions = $JLMS_CONFIG->get('use_custom_subscr', false); $custom_sub_courses = array(); // counting taxes if ($jlms_tax_counting) { $is_cb_installed = $JLMS_CONFIG->get('is_cb_installed', 0); $get_country_info = $JLMS_CONFIG->get('get_country_info', 0); $cb_country_filed_id = intval($JLMS_CONFIG->get('jlms_cb_country')); $isset_country = false; if ($is_cb_installed && $get_country_info && $cb_country_filed_id) { //by Max (get country info) $query = "SELECT cf.name" . "\n FROM #__comprofiler_fields as cf" . "\n WHERE 1" . "\n AND cf.fieldid = '" . $cb_country_filed_id . "'"; $JLMS_DB->setQuery($query); $cb_country_field_name = $JLMS_DB->loadResult(); $query = "SELECT " . $cb_country_field_name . "" . "\n FROM #__comprofiler" . "\n WHERE 1" . "\n AND user_id = '" . $my->id . "'"; $JLMS_DB->setQuery($query); $country_name = $JLMS_DB->loadResult(); require_once 'components' . DS . $option . DS . 'includes' . DS . 'libraries' . DS . 'lms.lib.countries.php'; $CodeCountry = new CodeCountries(); $code = $CodeCountry->code($country_name); if ($code) { $user_country = $code; } $user_country_name = ''; $us_state = ''; } else { $ip_address = $_SERVER['REMOTE_ADDR']; //$ip_address = '12.225.42.19'; $isset_country = false; if (@ini_get('allow_url_fopen')) { $fn = @file('http://api.hostip.info/get_html.php?ip=' . $ip_address); // country ip identified if ($fn != false) { $ip_info = implode('', $fn); preg_match_all("(\\(..\\))", $ip_info, $dop); $user_country = str_replace('(', '', str_replace(")", '', $dop[0][0])); preg_match_all("(\\:.*\\()", $ip_info, $dop2); $user_country_name = str_replace(': ', '', str_replace(" (", '', $dop2[0][0])); preg_match_all("(\\, ..)", $ip_info, $dop3); $us_state = @str_replace(', ', '', $dop3[0][0]); //echo $us_state; } } } if (isset($user_country)) { $query = "SELECT * FROM #__lms_subscriptions_countries WHERE published = 1 AND code='" . $user_country . "' "; $JLMS_DB->setQuery($query); $rows2 = $JLMS_DB->loadObjectList(); // if no country found if (!count($rows2)) { // check if in EU $query = "SELECT * FROM #__lms_subscriptions_countries WHERE published = 1 AND code='EU' AND list REGEXP '" . $user_country . "' "; $JLMS_DB->setQuery($query); $rows_eu = $JLMS_DB->loadObjectList(); if (count($rows_eu)) { $isset_country = true; $rows2[0]->tax_type = $rows_eu[0]->tax_type; $rows2[0]->tax = $rows_eu[0]->tax; $user_country_name = $rows_eu[0]->name . ' (' . $user_country_name . ')'; } } // additional check for US if ($user_country == 'US') { $query = "SELECT * FROM #__lms_subscriptions_countries WHERE published = 1 AND code = 'US-" . $us_state . "' "; $JLMS_DB->setQuery($query); $rows_states = $JLMS_DB->loadObjectList(); if (count($rows_states)) { $isset_country = true; $rows2 = array(); $rows2[0]->tax_type = $rows_states[0]->tax_type; $rows2[0]->tax = $rows_states[0]->tax; $user_country_name = 'United states (' . $rows_states[0]->name . ' )'; } } } //10.01.09 (Max) default tax option if (!$isset_country) { $rows2[0]->tax_type = $JLMS_CONFIG->get('default_tax_type', 1); $rows2[0]->tax = $JLMS_CONFIG->get('default_tax', 0); } } ?> <script language="javascript" type="text/javascript"> <!-- var global_sub_proc_name = ''; function jq_Check_selectRadio(rad_name, form_name) { var tItem = eval('document.'+form_name); if (tItem) { var selItem = eval('document.'+form_name+'.'+rad_name); if (selItem) { if (selItem.length) { var i; for (i = 0; i<selItem.length; i++) { if (selItem[i].checked) { if (selItem[i].value > 0 || 0 > selItem[i].value) { return selItem[i].value; } } } } else if (selItem.checked) { return selItem.value; } } return false; } return false; } function createCookie(name,value,days) { if (days) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); } else var expires = ""; document.cookie = name+"="+value+expires+"; path=/"; } function readCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); } return null; } function eraseCookie(name) { createCookie(name,"",-1); } function calculator(element, sub_total,discount, tax, total){ if (element) { if (element.value) { createCookie('sub_id', element.value); } } if (tax && sub_total){ document.getElementById('tax').innerHTML = tax; document.getElementById('sub_total').innerHTML = sub_total; } document.getElementById('total_amount').innerHTML = total; if (discount){ document.getElementById('discount').innerHTML = discount; }else{ document.getElementById('discount').innerHTML = ''; } } var ProcAr = Array(<?php $i = 0; foreach ($procs as $proc) { if ($i != 0 && $i != count($procs)) { echo ","; } echo $proc->id; $i++; } ?> ); var form = document.JLMS_adminForm; function checkProcessor(currentProc, ProcName){ global_sub_proc_name = ProcName; createCookie('proc_id', currentProc); createCookie('checked_proc', ProcName); for(i=0; i< ProcAr.length; i++){ if (document.getElementById('billing_form'+ProcAr[i])) { document.getElementById('billing_form'+ProcAr[i]).style.display = 'none'; } } if (document.getElementById('billing_form'+currentProc)) { document.getElementById('billing_form'+currentProc).style.display = 'block'; } } function jlms_submitbutton(pressbutton) { var form = document.JLMS_adminForm; if( pressbutton == 'subscribe' ){ var ttt = jq_Check_selectRadio('jlms_sub', 'JLMS_adminForm'); var ppp = jq_Check_selectRadio('proc_id', 'JLMS_adminForm'); <?php if ($JLMS_CONFIG->get('enableterms')) { ?> if (ttt) { if (ppp){ if (!form){ checkProcessor(ppp, ''); } if( (pressbutton == 'subscribe') && (document.getElementById('agreement').checked == false) ){ alert( "<?php echo addslashes(_JLMS_AGREEMENT); ?> " ); }else{ processor = global_sub_proc_name;//readCookie('checked_proc'); if (eval('document.JLMS_'+processor+'')){ eval('JLMS_'+processor+'_submit();'); }else{ form.task.value = pressbutton; form.id.value = ttt; form.submit(); } } }else{ alert( "<?php echo _JLMS_ALERT_SELECT_ITEM; ?> " ); } }else{ alert( "<?php echo _JLMS_ALERT_SELECT_ITEM; ?> " ); } <?php } else { ?> if (!ttt || !ppp ) { alert( "<?php echo _JLMS_ALERT_SELECT_ITEM; ?> " ); } else{ processor = global_sub_proc_name;//readCookie('checked_proc'); if (eval('document.JLMS_'+processor+'')){ eval('JLMS_'+processor+'_submit();'); }else{ form.task.value = pressbutton; form.id.value = ttt; form.submit(); } } <?php } ?> } } function getCategoryValue() { $select = document.JLMS_adminForm.category_filter; for( $i=0; $i<$select.length; $i++ ) { if ($select.options[$i].selected == true) { return $select.options[$i].value; } } } //--> </script> <form action="<?php echo sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}"); ?> " method="post" name="JLMS_adminForm"> <?php JLMS_TMPL::OpenMT(); $params = array('show_menu' => true, 'simple_menu' => true); JLMS_TMPL::ShowHeader('subscription', _JLMS_HEAD_SUBSCRIPTION_STR, $params); $show_filter = true; if (count($subscriptions) > 0 || isset($lists['course_filter_big']) && $lists['course_filter_big'] && isset($lists['course_filter_cur']) && $lists['course_filter_cur']) { JLMS_TMPL::OpenTS('', ' align="right" style="text-align:right " width="100%"'); $link = "index.php?option=" . $option . "&Itemid=" . $Itemid . "&task=subscription"; echo _JLMS_PN_DISPLAY_NUM . $pageNav->getLimitBox($link); echo _JLMS_SUBSCR_CATEGORY_FILTER . " " . $lists['category_filter']; echo _JLMS_FILTER . " " . $lists['course_filter']; //echo "Sub name: "."<input type='text' class='inputbox' name='sub_name' />"." "; JLMS_TMPL::CloseTS(); } JLMS_TMPL::CloseMT(); ?> <br /> <table cellpadding="0" cellspacing="0" border="0" class="contentpane" style="width:100%"> <?php if (count($subscriptions) > 0) { ?> <tr> <td colspan="2" > <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <<?php echo $JLMS_CONFIG->get('tableheader_tag', 'td'); ?> class="sectiontableheader" align="center" width="16">#</<?php echo $JLMS_CONFIG->get('tableheader_tag', 'td'); ?> > <<?php echo $JLMS_CONFIG->get('tableheader_tag', 'td'); ?> class="sectiontableheader" align="left" width="20"> </<?php echo $JLMS_CONFIG->get('tableheader_tag', 'td'); ?> > <<?php echo $JLMS_CONFIG->get('tableheader_tag', 'td'); ?> class="sectiontableheader" align="left" width="180"><?php echo _JLMS_SUBSCRIBE_SUB_COURSES; ?> </<?php echo $JLMS_CONFIG->get('tableheader_tag', 'td'); ?> > <<?php echo $JLMS_CONFIG->get('tableheader_tag', 'td'); ?> class="sectiontableheader" align="left" width="160"><?php echo _JLMS_SUBSCR_SUB_TYPE; ?> </<?php echo $JLMS_CONFIG->get('tableheader_tag', 'td'); ?> > <<?php echo $JLMS_CONFIG->get('tableheader_tag', 'td'); ?> class="sectiontableheader" align="left"><?php echo _JLMS_SUBSCR_PERIOD; ?> </<?php echo $JLMS_CONFIG->get('tableheader_tag', 'td'); ?> > <<?php echo $JLMS_CONFIG->get('tableheader_tag', 'td'); ?> class="sectiontableheader" align="center" width="170"><?php echo _JLMS_COURSES_PRICE; ?> </<?php echo $JLMS_CONFIG->get('tableheader_tag', 'td'); ?> > </tr> <?php $jlms_cs = $JLMS_CONFIG->get('jlms_cur_sign'); $sub_id = $JLMS_SESSION->get('sub_id'); if ($very_global_sub_id) { $sub_id = $very_global_sub_id; } elseif (isset($_COOKIE['sub_id'])) { $sub_id = $_COOKIE['sub_id']; } $temp = ''; for ($i = 0, $n = count($subscriptions); $i < $n; $i++) { $subscription = $subscriptions[$i]; // calculating taxes, country exists in the tax list $sub_total = round($subscription->price, 2); $tax_amount = 0; $disc = 0; $total = 0; if (count($rows2) > 0) { $sub_total1 = $sub_total; if ($subscription->account_type == '5') { $disc = $subscription->price * ($subscription->discount / 100); $sub_total1 = $sub_total - $disc; } if ($rows2[0]->tax_type == 1) { $tax_amount = round($sub_total1 / 100 * $rows2[0]->tax, 2); } if ($rows2[0]->tax_type == 2) { $tax_amount = $rows2[0]->tax; } if ($subscription->account_type == '5') { $disc_view = $jlms_cs . $disc . " (" . round($subscription->discount, 0) . "%)"; $total = $sub_total - $disc + $tax_amount; $price = "(" . $sub_total . "-" . $disc . ")+" . $tax_amount . " = " . $jlms_cs . ($sub_total - $disc + $tax_amount); $calc = "'" . $jlms_cs . $sub_total . "', '" . $disc_view . "','" . $jlms_cs . $tax_amount . "','" . $jlms_cs . $total . "'"; } else { $total = $sub_total + $tax_amount; $price = $sub_total . "+" . $tax_amount . " = " . $jlms_cs . $total; $calc = "' " . $jlms_cs . $sub_total . "', 0,'" . $jlms_cs . $tax_amount . "','" . $jlms_cs . $total . "'"; } } else { if ($subscription->account_type == '5') { $disc = $subscription->price * ($subscription->discount / 100); $disc_view = $jlms_cs . $disc . " (" . round($subscription->discount, 0) . "%)"; $total = $sub_total - $disc; $price = "(" . $sub_total . "-" . $disc . ") =" . $jlms_cs . $total; $calc = "0,'" . $disc_view . "',0,'" . $jlms_cs . $total . "'"; } else { $price = $jlms_cs . $sub_total; $total = $sub_total; $calc = " 0,0,0,'" . $jlms_cs . $total . "'"; } } $proc_checked = ''; if ($sub_id && $subscription->id == $sub_id) { $proc_checked = 'checked="checked"'; $temp = "calculator('', " . $calc . ");"; // setcookie('sub_id', $subscription->id); } if (count($subscriptions) == 1) { $proc_checked = 'checked="checked"'; if (!$my->id) { //$_COOKIE['sub_id'] = $subscription->id; setcookie('sub_id', $subscription->id); } } if ($sub_id) { $JLMS_SESSION->set('sub_id', $sub_id); } if ($enable_custom_subscriptions) { if ($subscription->id == -1) { foreach ($subscription->courses as $csubc) { $custom_sub_courses[] = $csubc; } } } ?> <tr valign="middle" style="vertical-align:middle" class="<?php echo $JLMS_CONFIG->get('visual_set_main_row_class'); ?> "> <td width="15" align="center"><?php echo $pageNav->limitstart + $i + 1; ?> </td> <td width="20" align="left"><input type="radio" name="jlms_sub" value="<?php echo $subscription->id; ?> " <?php echo $proc_checked; ?> onclick="calculator(this, <?php echo $calc; ?> )" /></td> <td style="font-weight:bold; "><?php echo $subscription->sub_name; ?> </td> <td><?php if ($subscription->account_type == '1') { echo _JLMS_SUBSCR_BASIC; } elseif ($subscription->account_type == '2') { echo _JLMS_SUBSCR_PERIOD; } elseif ($subscription->account_type == '3') { echo _JLMS_SUBSCR_DATE_LIFETIME; } elseif ($subscription->account_type == '4') { echo $subscription->access_days . ' ' . _JLMS_SUBSCR_DAYS_ACCESS; } elseif ($subscription->account_type == '5') { echo _JLMS_SUBSCR_WITH_DICOUNT; } ?> </td> <td><?php if ($subscription->account_type == 2) { echo _JLMS_SUBSCR_FROM . ' ' . JLMS_dateToDisplay($subscription->start_date) . ' ' . _JLMS_SUBSCR_TO . ' ' . $subscription->end_date; } elseif ($subscription->account_type == '3') { echo _JLMS_SUBSCR_FROM . ' ' . JLMS_dateToDisplay($subscription->start_date) . ' ' . _JLMS_SUBSCR_TO . ' Lifetime'; } elseif ($subscription->account_type == '4') { echo _JLMS_SUBSCR_FROM . ' ' . JLMS_dateToDisplay(date('Y-m-d')) . ' ' . _JLMS_SUBSCR_TO . ' ' . JLMS_dateToDisplay(date('Y-m-d', strtotime('+' . $subscription->access_days . ' day'))); } else { echo "-"; } ?> </td> <td align="center"> <?php echo $price; ?> </td> </tr> <?php $s = 1; foreach ($subscription->course_names as $course_name) { if ($s != count($subscription->courses)) { $src = 'components/com_joomla_lms/lms_images/treeview/sub1.png'; } else { $src = 'components/com_joomla_lms/lms_images/treeview/sub2.png'; } $img1 = "<img src='components/com_joomla_lms/lms_images/treeview/empty_line.png' width='16' height='16' alt=''/>"; $course_usertype = 0; if (in_array($subscription->courses[$s - 1], $JLMS_CONFIG->get('teacher_in_courses', array(0)))) { $course_usertype = 1; } elseif (in_array($subscription->courses[$s - 1], $JLMS_CONFIG->get('student_in_courses', array(0)))) { $course_usertype = 2; } if ($course_usertype) { $img1 = "<img src='components/com_joomla_lms/lms_images/toolbar/btn_accept.png' width='16' height='16' alt=''/>"; } ?> <tr class="<?php echo $JLMS_CONFIG->get('visual_set_child_row_class'); ?> "> <td><?php echo $img1; ?> </td> <td align="center"> <?php echo "<img src='{$src}' width='16' height='16' alt=''/>"; ?> </td> <td style="text-indent:16px;" align="left" colspan="4" valign="middle"> <?php echo $course_name; ?> </td> </tr> <?php $s++; } } ?> </table> </td> </tr> <tr> <td align="center" height="20" colspan="2" ><?php echo $pageNav->writePagesLinks($link); ?> </td> </tr> <?php if ($my->id) { ?> <tr> <td align="center" height="20" colspan="2" > <div class="joomlalms_info_legend"> <div style="text-align:left "> <img class="JLMS_png" src="<?php echo $JLMS_CONFIG->get('lms_path_to_images', 'components/com_joomla_lms/lms_images'); ?> /buttons/btn_complete.png" align="top" width="16" height="16" border="0" alt="<?php echo _JLMS_COURSES_ALREADY; ?> " title="<?php echo _JLMS_COURSES_ALREADY; ?> " /> - <?php echo _JLMS_COURSES_ALREADY; ?> . </div> </div> </td> </tr> <?php } ?> <tr> <<?php echo $JLMS_CONFIG->get('tableheader_tag', 'td'); ?> colspan="2" class="sectiontableheader"><?php echo _JLMS_SUBSCR_SELECT_PAY_METOD; ?> </<?php echo $JLMS_CONFIG->get('tableheader_tag', 'td'); ?> > </tr> <tr> <td> <?php $disabled = ''; if (!$my->id) { $disabled = "disabled='disabled'"; } $sub_proc = $JLMS_SESSION->get('sub_proc'); if (isset($_COOKIE['proc_id'])) { $sub_proc = $_COOKIE['proc_id']; } $temp2 = ""; foreach ($procs as $proc) { $checked = ''; if (count($procs) == 1) { $temp2 = "checkProcessor('" . $proc->id . "','" . $proc->filename . "');"; $checked = 'checked="checked"'; } if ($sub_proc) { if ($sub_proc == $proc->id) { $temp2 = "checkProcessor('" . $proc->id . "','" . $proc->filename . "');"; $checked = 'checked="checked"'; } } else { if ($proc->default_p) { $temp2 = "checkProcessor('" . $proc->id . "','" . $proc->filename . "');"; $checked = 'checked="checked"'; } } ?> <input type="radio" name="proc_id" value="<?php echo $proc->id; ?> " onclick="checkProcessor('<?php echo $proc->id; ?> ','<?php echo $proc->filename; ?> ' );" id="proc_<?php echo $proc->id; ?> " <?php echo $checked . " " . $disabled; ?> /> <label class="msspro_sel_proc2" for="proc_<?php echo $proc->id; ?> "><?php echo $proc->name; ?> </label><br /> <?php } ?> </td> <td width="50%" align="right"> <table cellpadding="0" cellspacing="0" border="0" width="200"> <?php if (count($rows2) > 0) { ?> <tr> <td align="right"><?php echo _JLMS_SUBSCR_SUB_TOTAL; ?> </td> <td align="left"> <span id="sub_total"> <?php echo count($subscriptions) == 1 ? $sub_total : ""; ?> </span> </td> </tr> <?php } ?> <tr> <td align="right"><?php echo _JLMS_SUBSCR_DISCOUNT; ?> </td> <td align="left"> <span id="discount"> <?php echo count($subscriptions) == 1 ? $disc ? $disc : '' : ""; ?> </span> </td> </tr> <?php if (count($rows2) > 0) { ?> <tr> <td align="right"><?php echo _JLMS_SUBSCR_TAX_AMOUNT; ?> </td> <td align="left"> <span id="tax"><?php echo count($subscriptions) == 1 ? $tax_amount : ""; ?> </span> </td> </tr> <?php } ?> <tr> <td align="right" width="105"><br /><b><?php echo _JLMS_SUBSCR_TOTAL; ?> </b></td> <td align="left" width="95"><br /> <span id="total_amount" style="font-weight:bold"><?php echo count($subscriptions) == 1 ? $jlms_cs . $total : " "; ?> </span> </td> </tr> </table> </td> </tr> </table> <?php if ($my->id) { ?> <input type="hidden" name="option" value="<?php echo $option; ?> " /> <input type="hidden" name="Itemid" value="<?php echo $Itemid; ?> " /> <input type="hidden" name="tax_amount" value="<?php echo $tax_amount; ?> " /> <input type="hidden" name="task" value="" /> <input type="hidden" name="id" value="" /> <input type="hidden" name="custom_courses" value="<?php echo $enable_custom_subscriptions && count($custom_sub_courses) ? implode(',', $custom_sub_courses) : ''; ?> " /> <?php } ?> </form> <table width="100%" style="width:100%" cellpadding="0" cellspacing="0" border="0" class="contentpane"> <tr> <td colspan="2"> <?php JLMS_UserSessions_html::loginPanel($course_id, 'subs'); ?> </td> </tr> <tr> <td colspan="2"> <?php if ($my->id) { $custom_code = ''; if ($enable_custom_subscriptions && count($custom_sub_courses)) { $custom_code = '<input type="hidden" name="custom_courses" value="' . implode(',', $custom_sub_courses) . '" />'; } foreach ($procs as $proc) { $display = 'none'; if (count($procs) == 1) { $display = 'block'; } if ($proc->default_p) { $display = 'block'; } echo '<div id="billing_form' . $proc->id . '" style="display:' . $display . ' ">'; require_once _JOOMLMS_FRONT_HOME . '/includes/processors/' . $proc->filename . '.php'; $newClass = "JLMS_" . $proc->filename; if (class_exists($newClass)) { $newProcObj = new $newClass(); $newProcObj->show_billing_form($option, $proc, $user, $custom_code); } else { } echo "</div>"; } if ($temp2) { echo '<script type="text/javascript" language="javascript"><!--' . "\r\n"; echo $temp2; echo "\r\n--></script>"; } } ?> </td> </tr> <?php if ($my->id) { ?> <tr> <td colspan="2" align="left"> <br /><?php if ($JLMS_CONFIG->get('enableterms')) { echo "<table align='center'><tr><td width='20'>\n\t\t\t\t\t\t<input type='checkbox' name='agreement' id='agreement' />\n\t\t\t\t\t</td><td style='text-align:left'>\n\t\t\t\t\t\t<label for='agreement'>" . $JLMS_CONFIG->get('jlms_terms') . "</label>\n\t\t\t\t\t</td></tr></table>"; //echo "<input type='checkbox' name='agreement' id='agreement' />"; //echo $JLMS_CONFIG->get('jlms_terms'); } ?> <br /> <?php $toolbar = array(); $toolbar[] = array('btn_type' => 'yes', 'btn_str' => _JLMS_SUBSCRIBE, 'btn_js' => "javascript:jlms_submitbutton('subscribe','');"); echo JLMS_ShowToolbar($toolbar, true, 'center'); ?> </td> </tr> <?php } } else { echo "<tr><td><div class='joomlalms_sys_message'>" . _JLMS_SUBSCR_NO_SUBS . "</div></td></tr>"; } ?> </table> <?php if ($JLMS_CONFIG->get('jlms_title')) { $doc->setTitle($JLMS_CONFIG->get('jlms_title')); } if (isset($temp) && $temp) { echo '<script type="text/javascript" language="javascript"><!--' . "\r\n"; echo $temp; echo "\r\n--></script>"; } ?> <?php }