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(); }