function JLMS_showCEOPage($option) { $db =& JFactory::getDbo(); $user = JLMSFactory::getUser(); $my_id = $user->get('id'); $JLMS_CONFIG =& JLMSFactory::getConfig(); $JLMS_SESSION =& JLMSFactory::getSession(); $my_learners = array(); $my_learners_1 = array(); $my_learners_2 = array(); $query = "SELECT a.*" . "\n, b.username, b.name, b.email" . "\n, d.course_name, d.id as course_id" . "\n FROM #__users as b, #__lms_user_parents as a" . "\n, #__lms_users_in_groups as c" . "\n, #__lms_courses as d" . "\n WHERE 1" . "\n AND a.user_id = b.id" . "\n AND a.user_id = c.user_id" . "\n AND c.course_id = d.id" . "\n AND a.parent_id = '" . $my_id . "'" . "\n ORDER BY b.username, b.name, d.course_name"; $db->SetQuery($query); $my_learners_1 = $db->LoadObjectList(); // echo $query; // echo '<pre>'; // print_r($my_learners_1); // echo '</pre>'; $query = "SELECT a.*" . "\n, b.username, b.name, b.email" . "\n, d.course_name, d.id as course_id" . "\n FROM #__users as b, #__lms_users_in_global_groups as a" . "\n, #__lms_users_in_groups as c" . "\n, #__lms_courses as d" . "\n, #__lms_user_assign_groups as e" . "\n WHERE 1" . "\n AND a.user_id = b.id" . "\n AND a.user_id = c.user_id" . "\n AND c.course_id = d.id" . "\n AND e.group_id = a.group_id" . "\n AND e.user_id = '" . $my_id . "'" . "\n ORDER BY b.username, b.name, d.course_name"; $db->SetQuery($query); $my_learners_2 = $db->LoadObjectList(); // echo $query; // echo '<pre>'; // print_r($my_learners_2); // echo '</pre>'; $exist_lrn_ids = array(); $i = 0; foreach ($my_learners_2 as $my_lrn_2) { $my_learners[] = $my_lrn_2; $exist_lrn_ids[] = $my_lrn_2->user_id; } foreach ($my_learners_1 as $my_lrn_1) { if (!in_array($my_lrn_1->user_id, $exist_lrn_ids)) { $my_learners[] = $my_lrn_1; $exist_lrn_ids[] = $my_lrn_1->user_id; } } // echo '<pre>'; // print_r($my_learners); // echo '</pre>'; $lists = array(); JLMS_ShowHeading($JLMS_CONFIG->get('jlms_heading'), false); //get list of all courses IDs $courses_ids = array(); $user_ids = array(); foreach ($my_learners as $my_learner) { if ($my_learner->course_id) { if (!in_array($my_learner->course_id, $courses_ids)) { $courses_ids[] = $my_learner->course_id; } } if ($my_learner->user_id) { if (!in_array($my_learner->user_id, $user_ids)) { $user_ids[] = $my_learner->user_id; } } } if (count($courses_ids) && count($user_ids)) { //check if any user has completed any course $user_ids_str = implode(',', $user_ids); $query = "SELECT * FROM #__lms_certificate_users WHERE user_id IN ({$user_ids_str}) AND crt_option = 1"; $db->SetQuery($query); $certificate_users = $db->LoadObjectList(); if (count($certificate_users)) { //check if courses have certificates enabled and configured $courses_ids_str = implode(',', $courses_ids); $query = "SELECT * FROM #__lms_certificates WHERE course_id IN ({$courses_ids_str}) AND crtf_type = 1"; $db->SetQuery($query); $courses_certificates = $db->LoadObjectList(); //populate list of CEO users with course completion information for ($i = 0, $n = count($my_learners); $i < $n; $i++) { $my_learners[$i]->course_completion = 0; foreach ($certificate_users as $certificate_user) { if ($certificate_user->user_id == $my_learners[$i]->user_id && $certificate_user->course_id == $my_learners[$i]->course_id) { $my_learners[$i]->course_completion = 1; foreach ($courses_certificates as $course_certificate) { if ($course_certificate->course_id == $certificate_user->course_id) { $my_learners[$i]->course_completion = 2; break; } } break; } } } } } joomla_lms_html::showCEO_page($option, $lists, $my_learners); }
function 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 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 echoMyCourses($option, $Itemid, &$my_courses) { global $JLMS_CONFIG; ?> <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'); ?> " align="center" style="text-align:center"><?php echo _JLMS_HOME_COURSES_TITLE; ?> </<?php echo JLMSCSS::tableheadertag(); ?> ></tr> <?php $k = 1; if (count($my_courses)) { $my_courses_teach = array(); $my_courses_enroll = array(); foreach ($my_courses as $my_course) { if ($my_course->user_course_role == 1) { $my_courses_teach[] = $my_course; } else { $my_courses_enroll[] = $my_course; } } if (count($my_courses_teach)) { echo "<tr class='" . JLMSCSS::_('sectiontableentry' . $k) . "'><td align='left'>" . _JLMS_COURSE_FP_COURSES_TEACH . "</td></tr>"; $k = 3 - $k; foreach ($my_courses_teach as $my_course) { $link = sefRelToAbs("index.php?option=" . $option . "&Itemid=" . $Itemid . "&task=details_course&id=" . $my_course->id); $description =& joomla_lms_html::PrepareDescription($my_course->course_description); $title = JLMS_txt2overlib($my_course->course_name); echo "<tr class='sectiontableentry{$k}" . ($k % 2 ? ' odd' : ' even') . "'><td>\n\t\t\t\t\t" . JLMS_toolTip($title, $description, $link) . "\n\t\t\t\t\t</td></tr>"; $k = 3 - $k; } } if (count($my_courses_enroll)) { echo "<tr class='" . JLMSCSS::_('sectiontableentry' . $k) . "'><td align='left'>" . _JLMS_COURSE_FP_COURSES_ENROLL . "</td></tr>"; $k = 3 - $k; foreach ($my_courses_enroll as $my_course) { $link = sefRelToAbs("index.php?option=" . $option . "&Itemid=" . $Itemid . "&task=details_course&id=" . $my_course->id); $description =& joomla_lms_html::PrepareDescription($my_course->course_description); $title = JLMS_txt2overlib($my_course->course_name); echo "<tr class='sectiontableentry{$k}" . ($k % 2 ? ' odd' : ' even') . "'><td>\n\t\t\t\t\t" . JLMS_toolTip($title, $description, $link) . "\n\t\t\t\t\t</td></tr>"; $k = 3 - $k; } } } else { echo "<tr class='sectiontableentry{$k}" . ($k % 2 ? ' odd' : ' even') . "'><td>" . _JLMS_HOME_COURSES_NO_ITEMS . "</td></tr>"; } ?> </table> <?php }
function JLMS_showMyDropBox($option, $Itemid, &$my_dropbox, &$lists) { global $JLMS_CONFIG; $ret_str = ' <table width="100%" cellpadding="0" cellspacing="0" border="0">' . "\r\n" . ' <tr><td class="sectiontableheader" align="center" colspan="2">' . str_replace('{Y}', $lists['dropbox_total'], str_replace('{X}', $lists['dropbox_total_new'], _JLMS_HOME_DROPBOX_TITLE)) . '</td></tr>' . "\r\n"; $k = 1; if (count($my_dropbox)) { foreach ($my_dropbox as $my_dropboxitem) { $link = sefRelToAbs("index.php?option=" . $option . "&Itemid=" . $Itemid . "&task=dropbox&id=" . $my_dropboxitem->course_id); $description =& joomla_lms_html::PrepareDescription($my_dropboxitem->drp_description); $add_info = ''; if (isset($my_dropboxitem->course_name) && $my_dropboxitem->course_name) { $add_info = " (" . $my_dropboxitem->course_name . ")"; } //$title = JLMS_txt2overlib($my_dropboxitem->drp_name); $title = $my_dropboxitem->drp_name; $ret_str .= "<tr class='sectiontableentry{$k}'><td width='16'>" . "<img class='JLMS_png' src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/toolbar/tlb_dropbox.png\" width='16' height='16' border='0' alt='dropbox' />" . "</td><td>" . JLMS_toolTip($title, $description, $title, $link) . $add_info . "</td></tr>"; $k = 3 - $k; } } else { $ret_str .= "<tr class='sectiontableentry{$k}'><td colspan='2'>" . _JLMS_HOME_DROPBOX_NO_ITEMS . "</td></tr>"; } $ret_str .= ' </table>'; return $ret_str; }