Beispiel #1
0
    function ShowPlugins($plugin = '')
    {
        global $JLMS_CONFIG;
        if ($plugin == 'star_menu') {
            $id = $JLMS_CONFIG->get('course_id', 0);
            global $Itemid, $option;
            ?>
			<script type="text/javascript">
			<!--
			function jlms_changeLang() {
				var user_lang = $('jlms_lang').value;
				window.top.location.href='<?php 
            echo str_replace('__lang__', "'+user_lang+'", $JLMS_CONFIG->getCfg('live_site') . "/index.php?option={$option}&Itemid={$Itemid}&task=user_lang&course_id={$id}&lang=__lang__");
            ?>
';
			}
			function jlms_changeRole() {
				var user_role = $('jlms_user_role').value;
				if (user_role == 1) {
					window.top.location.href='<?php 
            echo $JLMS_CONFIG->getCfg('live_site') . "/index.php?option={$option}&Itemid={$Itemid}&task=to_teacher&id={$id}";
            ?>
';
				} else if (user_role == 2) {
					window.top.location.href='<?php 
            echo $JLMS_CONFIG->getCfg('live_site') . "/index.php?option={$option}&Itemid={$Itemid}&task=to_student&id={$id}";
            ?>
';
				} else if (user_role == 6) {
					window.top.location.href='<?php 
            echo $JLMS_CONFIG->getCfg('live_site') . "/index.php?option={$option}&Itemid={$Itemid}&task=to_ceo&id={$id}";
            ?>
';
				}
			}
			-->
			</script>
<?php 
            echo '<div id="joomlalms_star_menu" style="visibility:hidden; display:none;">';
            echo '<div class="jlms_plugin" >';
            echo _JLMS_UO_SELECT_LANGUAGE;
            echo JLMS_TMPL::selectList($JLMS_CONFIG->get('lms_languages'), 'lms_lang', 'class="inputbox" style="width:160px; margin-right:30px; padding:0px;" size="1" id="jlms_lang" onchange="jlms_changeLang()" ', 'value', 'text', $JLMS_CONFIG->get('default_language'));
            $user_roles = array();
            $teach_role = mosHTML::makeOption('1', _JLMS_ROLE_TEACHER);
            $stu_role = mosHTML::makeOption('2', _JLMS_ROLE_STU);
            $ceo_role = mosHTML::makeOption('6', _JLMS_ROLE_CEO);
            $cur_role = $JLMS_CONFIG->get('current_usertype');
            if ($JLMS_CONFIG->get('main_usertype') == 1) {
                $user_roles[] = $teach_role;
                $user_roles[] = $stu_role;
            } elseif ($JLMS_CONFIG->get('current_usertype') == 2) {
                if ($JLMS_CONFIG->get('main_usertype') == 1) {
                    $user_roles[] = $teach_role;
                }
                $user_roles[] = $stu_role;
            } elseif ($JLMS_CONFIG->get('main_usertype') == 2) {
                $user_roles[] = $stu_role;
            }
            if ($JLMS_CONFIG->get('is_user_parent') == 1) {
                if (in_array($id, $JLMS_CONFIG->get('parent_in_courses'))) {
                    $user_roles[] = $ceo_role;
                }
            }
            if (count($user_roles) > 1) {
                echo _JLMS_UO_SWITCH_TYPE;
                echo JLMS_TMPL::selectList($user_roles, 'lms_user_role', 'class="inputbox" style="width:160px; padding:0px;" size="1" id="jlms_user_role" onchange="jlms_changeRole()" ', 'value', 'text', $JLMS_CONFIG->get('current_usertype'));
            }
            if ($JLMS_CONFIG->get('jlms_notecez', 1)) {
                require $JLMS_CONFIG->getCfg('absolute_path') . '/components/com_joomla_lms/includes/lms_notice_tpl.php';
                get_notice_html($option);
            }
            if ($JLMS_CONFIG->get('plugins_message', '')) {
                echo '<br /><br />' . $JLMS_CONFIG->get('plugins_message', '');
            }
            echo '</div>';
            echo '</div>';
            if ($JLMS_CONFIG->get('web20_effects', true)) {
                $JLMS_CONFIG->set('jlms_aditional_js_code', $JLMS_CONFIG->get('jlms_aditional_js_code', '') . 'var mySlide_star_menu;');
                $domready = '				
					mySlide_star_menu = new Fx.Slide(\'joomlalms_star_menu\');
					mySlide_star_menu.hide();
					$(\'joomlalms_star_menu\').setStyles({visibility: \'visible\',display: \'\'});					
					if ($(\'jlms_plugins_run\')) {						
						$(\'jlms_plugins_run\').addEvent(\'click\', function(e){
							e = new Event(e);
							mySlide_star_menu.toggle();
							e.stop();
						});
					}
				';
                $JLMS_CONFIG->set('web20_domready_code', $JLMS_CONFIG->get('web20_domready_code', '') . $domready);
            } else {
                $JLMS_CONFIG->set('jlms_aditional_js_code', $JLMS_CONFIG->get('jlms_aditional_js_code', '') . 'var star_menu_hidden = true;');
                $domready = '
					if ($(\'jlms_plugins_run\')) {
						$(\'jlms_plugins_run\').addEvent(\'click\', function(e){
							e = new Event(e);
							if (star_menu_hidden) {
								$(\'joomlalms_star_menu\').setStyles({visibility: \'visible\',display: \'\'});
								star_menu_hidden = false;
							} else {
								$(\'joomlalms_star_menu\').setStyles({visibility: \'hidden\',display: \'none\'});
								star_menu_hidden = true;
							}
							e.stop();
						});
					}
				';
                $JLMS_CONFIG->set('web20_domready_code', $JLMS_CONFIG->get('web20_domready_code', '') . $domready);
            }
        } elseif ($plugin == 'notes') {
            echo '';
        }
    }