Пример #1
0
$mode = mosGetParam($_REQUEST, 'mode', '');
$cid = josGetArrayInts('cid', $_POST);
if (!is_array($cid)) {
    $cid = array(0);
}
require_once _JOOMLMS_FRONT_HOME . "/joomla_lms.conference.html.php";
//otrisovivaem head menu
if ($mode != 'conference_room' && $mode != 'upload_popup' && $mode != 'conference_playback' && $mode != 'params' && $mode != 'save_period' && $mode != 'display_file') {
    global $JLMS_CONFIG;
    $course_id = $JLMS_CONFIG->get('course_id', 0);
    $pathway = array();
    $pathway[] = array('name' => _JLMS_PATHWAY_HOME, 'link' => sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}"), 'is_home' => true);
    $pathway[] = array('name' => $JLMS_CONFIG->get('course_name'), 'link' => sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=details_course&id={$course_id}"), 'is_course' => true);
    $pathway[] = array('name' => _JLMS_TOOLBAR_CONF, 'link' => sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=conference&id={$course_id}"));
    JLMSAppendPathWay($pathway);
    JLMS_ShowHeading();
}
switch ($task) {
    case 'conference':
        JLMS_show_conference($course_id, $option, $mode);
        break;
}
//sdelat vivod po datam
function JLMS_show_conference($course_id, $option, $mode)
{
    global $my, $JLMS_DB, $JLMS_CONFIG;
    //select date (if no, select current date)
    $user_id = $my->id;
    $cid = mosGetParam($_POST, 'cid', array(0));
    if (!is_array($cid)) {
        $cid = array(0);
Пример #2
0
function JLMS_playerSCORM($id, $option)
{
    global $JLMS_DB, $my, $JLMS_CONFIG, $Itemid, $JLMS_SESSION;
    $course_id = $JLMS_CONFIG->get('course_id');
    $usertype = $JLMS_CONFIG->get('current_usertype', 0);
    $lpath_id = intval(mosGetParam($_REQUEST, 'lpath_id', 0));
    $int_skip_resume = intval(mosGetParam($_REQUEST, 'int_skip_resume', 0));
    $scorm = null;
    //new stdClass();
    if ($course_id && ($usertype == 1 || $usertype == 2) && JLMS_CheckSCORM($id, $lpath_id, $course_id, $scorm, $usertype)) {
        if (!empty($scorm)) {
            // 11.04.2007 (parameter 'redirect_to_learnpath' used to avoid redirect cycles from course home to LP and back
            $JLMS_SESSION->clear('redirect_to_learnpath');
            // sleep one second. SCORM could send some requests on onCloasPage event. We need wait for these requests to be processed.
            #sleep(2);
            $scoid = intval(mosGetParam($_REQUEST, 'scoid', 0));
            $mode = 'normal';
            //strval(mosGetParam($_REQUEST, 'mode','normal'));//optional_param('mode', 'normal', PARAM_ALPHA);
            $currentorg = strval(mosGetParam($_REQUEST, 'currentorg', ''));
            //, PARAM_RAW);
            $newattempt = strval(mosGetParam($_REQUEST, 'newattempt', 'on'));
            require_once _JOOMLMS_FRONT_HOME . "/includes/n_scorm/lms_scorm.play.php";
            $query = "SELECT * FROM #__lms_learn_paths WHERE id = '" . $lpath_id . "' AND course_id = '" . $course_id . "'";
            $JLMS_DB->SetQuery($query);
            $lpath_data = $JLMS_DB->LoadObjectList();
            $box_view = false;
            if (count($lpath_data) == 1) {
                $pathway = array();
                $pathway[] = array('name' => $lpath_data[0]->lpath_name, 'link' => sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=player_scorm&id={$id}&course_id={$course_id}&lpath_id=" . $lpath_data[0]->id));
                JLMSAppendPathWay($pathway);
            }
            if (isset($scorm->params)) {
                $params = new JLMSParameters($scorm->params);
                if ($params->get('scorm_layout', 0) && $params->get('scorm_layout', 0) == 1) {
                    $box_view = true;
                }
            }
            if ($box_view) {
                // SqueezeBox view - don't show Heading.
                echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
                echo '<html xmlns="http://www.w3.org/1999/xhtml" style="margin:0;padding:0"><head>';
                $iso_site = 'charset=utf-8';
                if (defined('_ISO')) {
                    $iso_site = _ISO;
                    if (!$iso_site) {
                        $iso_site = 'charset=utf-8';
                    }
                }
                echo '<meta http-equiv="Content-Type" content="text/html; ' . $iso_site . '" />';
                echo '</head><body style="margin:0;padding:0">';
            } else {
                JLMS_ShowHeading();
            }
            /*JLMS_TMPL::OpenMT();
            
            			$hparams = array();
            			JLMS_TMPL::ShowHeader('scorm', $scorm->scorm_name, $hparams);
            */
            $skip_resume = $int_skip_resume ? true : false;
            JLMS_SCORM_PLAY_MAIN($scorm, $option, $course_id, $lpath_id, $scoid, $mode, $currentorg, $newattempt, false, false, $box_view, $skip_resume);
            if ($box_view) {
                echo '</body></html>';
                JLMS_die();
            }
            //JLMS_TMPL::CloseMT();
        } else {
            JLMSRedirect(sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=learnpaths&id={$course_id}"));
        }
    } else {
        JLMSRedirect(sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=learnpaths&id={$course_id}"));
    }
}
Пример #3
0
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 JLMS_view_all_notices($option)
{
    global $JLMS_DB, $my, $JLMS_CONFIG, $JLMS_SESSION;
    JLMS_ShowHeading($JLMS_CONFIG->get('jlms_heading'), true);
    $limit = intval(mosGetParam($_GET, 'limit', $JLMS_SESSION->get('list_limit', $JLMS_CONFIG->get('list_limit'))));
    $JLMS_SESSION->set('list_limit', $limit);
    $limitstart = intval(mosGetParam($_REQUEST, 'limitstart', 0));
    $course_id = intval(mosGetParam($_REQUEST, 'course_id', 0));
    $lists = array();
    if ($JLMS_CONFIG->get('multicat_use', 0)) {
        $query = "SELECT * FROM #__lms_course_cats_config ORDER BY id";
        $JLMS_DB->setQuery($query);
        $lists['levels'] = $JLMS_DB->loadObjectList();
        if (count($lists['levels']) == 0) {
            for ($i = 0; $i < 5; $i++) {
                if ($i > 0) {
                    $lists['levels'][$i]->cat_name = _JLMS_COURSES_COURSES_GROUPS;
                } else {
                    $lists['levels'][$i]->cat_name = _JLMS_COURSES_COURSES_GROUPS;
                }
            }
        }
        $level_id = array();
        for ($i = 0; $i < count($lists['levels']); $i++) {
            if ($i == 0) {
                $level_id[$i] = intval(mosGetParam($_REQUEST, 'filter_id_' . $i . '', $JLMS_SESSION->get('FLMS_filter_id_' . $i . '', 0)));
                $_REQUEST['filter_id_' . $i] = $level_id[$i];
                $JLMS_SESSION->set('FLMS_filter_id_' . $i . '', $level_id[$i]);
            } else {
                $level_id[$i] = intval(mosGetParam($_REQUEST, 'filter_id_' . $i . '', $JLMS_SESSION->get('FLMS_filter_id_' . $i . '', 0)));
                $_REQUEST['filter_id_' . $i] = $level_id[$i];
                $JLMS_SESSION->set('FLMS_filter_id_' . $i . '', $level_id[$i]);
            }
            if ($i == 0) {
                $parent_id[$i] = 0;
            } else {
                $parent_id[$i] = $level_id[$i - 1];
            }
            $query = "SELECT count(id) FROM `#__lms_course_cats` WHERE parent = '" . $parent_id[$i] . "' ORDER BY c_category";
            $JLMS_DB->setQuery($query);
            $groups = $JLMS_DB->loadResult();
            if ($groups == 0) {
                $level_id[$i] = 0;
                $JLMS_SESSION->set('FLMS_filter_id_' . $i . '', $level_id[$i]);
            }
        }
        for ($i = 0; $i < count($lists['levels']); $i++) {
            if ($i > 0 && $level_id[$i - 1] == 0) {
                $level_id[$i] = 0;
                $_REQUEST['filter_id_' . $i] = $level_id[$i];
                $JLMS_SESSION->set('FLMS_filter_id_' . $i . '', $level_id[$i]);
                $parent_id[$i] = 0;
            } elseif ($i == 0 && $level_id[$i] == 0) {
                $level_id[$i] = 0;
                $_REQUEST['filter_id_' . $i] = $level_id[$i];
                $JLMS_SESSION->set('FLMS_filter_id_' . $i . '', $level_id[$i]);
                $parent_id[$i] = 0;
            }
        }
        $javascript = 'onclick="javascript:read_filter();" onchange="javascript:write_filter();document.adminForm.task.value=\'view_all_notices\';document.adminForm.submit();"';
        $query1 = "SELECT group_id FROM `#__lms_users_in_global_groups` WHERE user_id = '" . $my->id . "'";
        $JLMS_DB->setQuery($query1);
        $user_group_ids = $JLMS_DB->loadResultArray();
        for ($i = 0; $i < count($lists['levels']); $i++) {
            if ($parent_id[$i] == 0) {
                $query = "SELECT * FROM `#__lms_course_cats` WHERE `parent` = '0'";
                /*
                $query .= "\n AND (";
                if (count($user_group_ids)) {
                	$query .= "( `restricted` = 1 AND ( `groups` LIKE '%|$user_group_ids[0]|%'";
                	for($i1=1;$i1<count($user_group_ids);$i1++) {
                		$query .= "\n OR `groups` like '%|$user_group_ids[$i1]|%'";
                	}
                	$query .=  "\n ) ) \n OR ";
                }
                $query .= "(`restricted` = 0 )) ";
                */
                $query .= "\n ORDER BY `c_category`";
            } else {
                $query = "SELECT * FROM `#__lms_course_cats` WHERE parent = '" . $parent_id[$i] . "' ORDER BY c_category";
            }
            $JLMS_DB->setQuery($query);
            $groups = $JLMS_DB->loadObjectList();
            if ($parent_id[$i] && $i > 0 && count($groups)) {
                $type_level[$i][] = mosHTML::makeOption(0, ' &nbsp; ');
                foreach ($groups as $group) {
                    $type_level[$i][] = mosHTML::makeOption($group->id, $group->c_category);
                }
                $lists['filter_' . $i . ''] = mosHTML::selectList($type_level[$i], 'filter_id_' . $i . '', 'class="inputbox" size="1" ' . $javascript, 'value', 'text', $level_id[$i]);
                //onchange="document.location.href=\''. $link_multi .'\';"
            } elseif ($i == 0) {
                $type_level[$i][] = mosHTML::makeOption(0, ' &nbsp; ');
                foreach ($groups as $group) {
                    $type_level[$i][] = mosHTML::makeOption($group->id, $group->c_category);
                }
                $lists['filter_' . $i . ''] = mosHTML::selectList($type_level[$i], 'filter_id_' . $i . '', 'class="inputbox" size="1" ' . $javascript, 'value', 'text', $level_id[$i]);
                //onchange="document.location.href=\''. $link_multi .'\';"
            }
        }
    }
    //FLMS multicat
    $where = '';
    if ($JLMS_CONFIG->get('multicat_use', 0)) {
        //NEW MUSLTICATS
        //		$tmp_level = array();
        $last_catid = 0;
        $tmp_cats_filter = JLMS_getFilterMulticategories($last_catid);
        /*
        $i=0;
        foreach($_REQUEST as $key=>$item){
        	if(preg_match('#filter_id_(\d+)#', $key, $result)){
        		if($item){
        			$tmp_level[$i] = $result;
        			$last_catid = $item;
        			$i++;
        		}	
        	}	
        }
        $query = "SELECT * FROM #__lms_course_cats ORDER BY id";
        $JLMS_DB->setQuery($query);
        $all_cats = $JLMS_DB->loadObjectList();
        
        $tmp_cats_filter = array();
        $children = array();
        foreach($all_cats as $cat){
        	$pt = $cat->parent;
        	$list = @$children[$pt] ? $children[$pt] : array();
        	array_push($list, $cat->id);
        	$children[$pt] = $list;
        }
        $tmp_cats_filter[0] = $last_catid;
        $i=1;
        foreach($children as $key=>$childs){
        	if($last_catid == $key){
        		foreach($children[$key] as $v){
        			if(!in_array($v, $tmp_cats_filter)){
        				$tmp_cats_filter[$i] = $v;
        				$i++;
        			}
        		}
        	}
        }
        foreach($children as $key=>$childs){
        	if(in_array($key, $tmp_cats_filter)){
        		foreach($children[$key] as $v){
        			if(!in_array($v, $tmp_cats_filter)){
        				$tmp_cats_filter[$i] = $v;
        				$i++;
        			}
        		}
        	}
        }
        $tmp_cats_filter = array_unique($tmp_cats_filter);
        */
        $catids = implode(",", $tmp_cats_filter);
        if ($last_catid && count($tmp_cats_filter)) {
            $where .= "\n AND ( a.cat_id IN (" . $catids . ")";
            if ($JLMS_CONFIG->get('sec_cat_use', 0)) {
                foreach ($tmp_cats_filter as $tmp_cats_filter_one) {
                    $where .= "\n OR a.sec_cat LIKE '%|" . $tmp_cats_filter_one . "|%'";
                }
            }
            $where .= "\n )";
        }
        //NEW MUSLTICATS
    }
    $query = "SELECT a.id as value, a.course_name as text" . "\n FROM #__lms_courses as a" . "\n WHERE a.id > 0" . "\n {$where}";
    $JLMS_DB->setQuery($query);
    $courses = $JLMS_DB->loadObjectList();
    //	echo '<pre>';
    //	print_r($courses);
    //	echo '</pre>';
    $courses_ids = array();
    foreach ($courses as $course) {
        $courses_ids[] = $course->value;
    }
    $str_courses_ids = implode(",", $courses_ids);
    $f_courses = array();
    $f_courses[] = mosHTML::makeOption(0, '&nbsp;');
    $f_courses = array_merge($f_courses, $courses);
    $lists['f_course'] = mosHTML::selectList($f_courses, 'course_id', 'class="inputbox" size="1" style="width: 100%;" ' . $javascript, 'value', 'text', $course_id);
    $query = "SELECT a.*, b.course_name " . "\n FROM #__lms_page_notices as a" . "\n LEFT JOIN #__lms_courses as b ON a.course_id = b.id" . "\n WHERE a.usr_id = '" . $my->id . "'" . ($level_id[0] ? "\n AND a.course_id IN (" . $str_courses_ids . ")" : '') . ($course_id ? "\n AND a.course_id = '" . $course_id . "'" : '') . "\n ORDER BY a.data DESC";
    $JLMS_DB->setQuery($query);
    $lists['my_notices'] = $JLMS_DB->loadObjectList();
    $total = count($lists['my_notices']);
    require_once _JOOMLMS_FRONT_HOME . DS . "includes" . DS . "classes" . DS . "lms.pagination.php";
    $pageNav = new JLMSPageNav($total, $limitstart, $limit);
    FLMS_page_notice::show_all_notices($option, $lists, $total, $pageNav, $limitstart, $limit);
}
Пример #5
0
function JLMS_showChat($course_id, $option)
{
    global $JLMS_DB, $my, $Itemid, $JLMS_CONFIG;
    $JLMS_ACL =& JLMSFactory::getACL();
    if ($JLMS_ACL->CheckPermissions('chat', 'view')) {
        global $JLMS_CONFIG;
        $pathway = array();
        $pathway[] = array('name' => _JLMS_PATHWAY_HOME, 'link' => sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}"), 'is_home' => true);
        $pathway[] = array('name' => $JLMS_CONFIG->get('course_name'), 'link' => sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=details_course&amp;id={$course_id}"), 'is_course' => true);
        $pathway[] = array('name' => _JLMS_TOOLBAR_CHAT, 'link' => sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=chat&amp;id={$course_id}"));
        JLMSAppendPathWay($pathway);
        JLMS_ShowHeading();
        $group_id = intval(mosGetParam($_REQUEST, 'group_id', 0));
        if ($JLMS_ACL->CheckPermissions('chat', 'manage')) {
            if ($JLMS_CONFIG->get('use_global_groups', 1)) {
                $query = "SELECT group_chat FROM #__lms_usergroups WHERE course_id = 0 AND id = {$group_id}";
                $JLMS_DB->SetQuery($query);
                $gr_c = $JLMS_DB->LoadResult();
                if (!$gr_c) {
                    $group_id = 0;
                }
            } else {
                $query = "SELECT group_chat FROM #__lms_usergroups WHERE course_id = {$course_id} AND id = {$group_id}";
                $JLMS_DB->SetQuery($query);
                $gr_c = $JLMS_DB->LoadResult();
                if (!$gr_c) {
                    $group_id = 0;
                }
            }
        } else {
            if ($JLMS_CONFIG->get('use_global_groups', 1)) {
                if ($group_id) {
                    $query = "SELECT group_chat FROM #__lms_users_in_global_groups AS uigg, #__lms_usergroups AS ug WHERE uigg.user_id = {$my->id} AND uigg.group_id = {$group_id} AND ug.id = uigg.group_id";
                    $JLMS_DB->setQuery($query);
                    if (!$JLMS_DB->loadResult()) {
                        $group_id = 0;
                    }
                }
            } else {
                if ($group_id) {
                    $query = "SELECT a.group_id FROM #__lms_users_in_groups as a, #__lms_usergroups as b WHERE a.course_id = {$course_id} AND a.user_id = '" . $my->id . "' AND a.group_id = b.id AND b.course_id = {$course_id} AND b.group_chat = 1";
                    $JLMS_DB->SetQuery($query);
                    $group_id = $JLMS_DB->LoadResult();
                    if (!$group_id) {
                        $group_id = 0;
                    }
                }
            }
        }
        $query = "SHOW COLUMNS FROM `#__lms_chat_history` WHERE Field = 'user_message'";
        $JLMS_DB->SetQuery($query);
        $chat_table = $JLMS_DB->LoadObject();
        if (is_object($chat_table) && isset($chat_table->Type)) {
            if ($chat_table->Type != 'text') {
                $query = "ALTER TABLE `#__lms_chat_history` CHANGE `user_message` `user_message` TEXT";
                $JLMS_DB->SetQuery($query);
                $JLMS_DB->query();
            }
        }
        //query (Drop users)
        $query = "DELETE FROM #__lms_chat_users WHERE user_id = '" . $my->id . "'";
        $JLMS_DB->SetQuery($query);
        $JLMS_DB->query();
        $tim_minus_15 = time() - date('Z') - 15 * 60;
        $query = "DELETE FROM #__lms_chat_users WHERE time_post < '" . date('Y-m-d H:i:s', $tim_minus_15) . "'";
        $JLMS_DB->SetQuery($query);
        $JLMS_DB->query();
        //query (Entering chat)
        $query = "INSERT INTO #__lms_chat_users (course_id, group_id, user_id, time_enter, time_post, chat_option)" . "\n VALUES ('" . $course_id . "', '" . $group_id . "', '" . $my->id . "', '" . gmdate('Y-m-d H:i:s') . "', '" . gmdate('Y-m-d H:i:s') . "', '0')";
        $JLMS_DB->SetQuery($query);
        $JLMS_DB->query();
        //tracking
        global $Track_Object;
        $Track_Object->UserEnterChat($my->id, $course_id);
        $query = "SELECT a.username FROM #__users as a, #__lms_chat_users as b" . "\n WHERE a.id = b.user_id AND b.course_id = '" . $course_id . "' AND b.group_id = '" . $group_id . "'" . "\n ORDER BY a.username";
        $JLMS_DB->SetQuery($query);
        $chat_users = $JLMS_DB->LoadObjectList();
        $course_chats = array();
        $course_chats[] = mosHTML::makeOption(0, _JLMS_CHAT_COURSE_CHAT);
        if ($JLMS_ACL->CheckPermissions('chat', 'manage')) {
            if ($JLMS_CONFIG->get('use_global_groups', 1)) {
                $query = "SELECT ug.id AS value, ug.ug_name AS text" . "\n FROM #__lms_usergroups AS ug, #__lms_users_in_groups AS uig, #__lms_users_in_global_groups AS uigg" . "\n WHERE ug.group_chat = 1 AND uig.course_id = {$course_id} AND uigg.user_id = uig.user_id AND ug.id = uigg.group_id";
                $JLMS_DB->setQuery($query);
                $group_chats = $JLMS_DB->loadObjectList();
                for ($i = 0; $i < count($group_chats); $i++) {
                    $group_chats[$i]->text = $group_chats[$i]->text . " (" . _JLMS_CHAT_GROUP_CHAT . ")";
                }
                $course_chats = array_merge($course_chats, $group_chats);
            } else {
                $query = "SELECT id as value, ug_name as text FROM #__lms_usergroups WHERE course_id = {$course_id} AND group_chat = 1";
                $JLMS_DB->SetQuery($query);
                $group_chats = $JLMS_DB->loadObjectList();
                for ($i = 0; $i < count($group_chats); $i++) {
                    $group_chats[$i]->text = $group_chats[$i]->text . " (" . _JLMS_CHAT_GROUP_CHAT . ")";
                }
                $course_chats = array_merge($course_chats, $group_chats);
            }
        } else {
            if ($JLMS_CONFIG->get('use_global_groups', 1)) {
                $query = "SELECT ug.id AS value, ug.ug_name AS text" . "\n FROM #__lms_usergroups AS ug, #__lms_users_in_groups AS uig, #__lms_users_in_global_groups AS uigg" . "\n WHERE uig.course_id = {$course_id} AND uigg.user_id = uig.user_id AND ug.id = uigg.group_id AND ug.group_chat = 1 AND uig.user_id = {$my->id}";
                $JLMS_DB->setQuery($query);
                $group_chats = $JLMS_DB->loadObjectList();
                for ($i = 0; $i < count($group_chats); $i++) {
                    $group_chats[$i]->text = $group_chats[$i]->text . " (" . _JLMS_CHAT_GROUP_CHAT . ")";
                }
                $course_chats = array_merge($course_chats, $group_chats);
            } else {
                $query = "SELECT b.id as value, b.ug_name as text FROM #__lms_users_in_groups as a, #__lms_usergroups as b WHERE a.course_id = {$course_id} AND a.user_id = '" . $my->id . "' AND a.group_id = b.id AND b.course_id = {$course_id} AND b.group_chat = 1";
                $JLMS_DB->SetQuery($query);
                $group_chats = $JLMS_DB->loadObjectList();
                for ($i = 0; $i < count($group_chats); $i++) {
                    $group_chats[$i]->text = _JLMS_CHAT_GROUP_CHAT . " (" . $group_chats[$i]->text . ")";
                }
                $course_chats = array_merge($course_chats, $group_chats);
            }
        }
        /*if (JLMS_GetUserType_simple($my->id) == 1) {
        		$query = "SELECT distinct b.* FROM #__lms_courses as b, #__lms_user_courses as a"
        		. "\n WHERE a.course_id = b.id AND a.user_id = '".$my->id."'";
        		} elseif (JLMS_GetUserType_simple($my->id) == 2) {
        		$query = "SELECT distinct a.* FROM #__lms_courses as a, #__lms_usergroups as b, #__lms_users_in_groups as c"
        		. "\n WHERE a.id = b.course_id AND b.id = c.group_id AND c.user_id = '".$my->id."'";
        		}
        		$JLMS_DB->SetQuery( $query );
        		$rows = $JLMS_DB->LoadObjectList();*/
        $lists = array();
        $javascript = 'onchange="document.chatForm.submit();"';
        $lists['course_chats'] = mosHTML::selectList($course_chats, 'group_id', 'class="inputbox" size="1" ' . $javascript, 'value', 'text', $group_id);
        JLMS_chat_html::showChat($course_id, $group_id, $option, $lists, $chat_users);
    } else {
        JLMSRedirect(sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}"));
    }
}