function JLMS_showLinks($option) { $JLMS_CONFIG =& JLMSFactory::getCOnfig(); $Itemid = $JLMS_CONFIG->get('Itemid'); $db =& JFactory::getDbo(); $user = JLMSFactory::getUser(); $my_id = $user->get('id'); $JLMS_ACL =& JLMSFactory::getACL(); $id = $JLMS_CONFIG->get('course_id'); $AND_ST = ""; if (false !== ($enroll_period = JLMS_getEnrolPeriod($my_id, $id))) { $AND_ST = " AND IF(a.is_time_related, (a.show_period < '" . $enroll_period . "' ), 1) "; } if ($id && $JLMS_ACL->CheckPermissions('links', 'view')) { $query = "SELECT a.*, b.name as author_name" . "\n FROM #__lms_links as a LEFT JOIN #__users as b ON a.owner_id = b.id" . "\n WHERE a.course_id = '" . $id . "'" . $AND_ST . ($JLMS_ACL->CheckPermissions('links', 'view_all') ? '' : "\n AND a.published = 1") . "\n ORDER BY a.ordering, a.link_name"; $db->SetQuery($query); $rows = $db->LoadObjectList(); $lms_titles_cache =& JLMSFactory::getTitles(); $lms_titles_cache->setArray('links', $rows, 'id', 'link_name'); JLMS_course_links_html::showCourseLinks($id, $option, $rows); } elseif ($id) { JLMSRedirect(sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=details_course&id={$id}")); } else { JLMSRedirect(sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}")); } }