Beispiel #1
0
 function ShowHeader($head_pic, $head_title = '', $params = array(), $toolbar = array(), $gqp = false)
 {
     global $JLMS_CONFIG, $JLMS_SESSION, $option;
     // set default parameters values
     $with_sys_msg = true;
     $sys_msg = '';
     $simple_menu = false;
     $show_menu = true;
     $toolbar_s = '';
     $toolbar_pos = '';
     $add_html_code = '';
     $output_blank_sys_msg_container = true;
     //$JLMS_CONFIG->set('start_menu_new', true);
     $second_tb_header = '';
     $add_html_tb_code = '';
     $course_id = $JLMS_CONFIG->get('course_id');
     // redefine parameters from $params variable.
     if (isset($params['with_sys_msg'])) {
         $with_sys_msg = $params['with_sys_msg'];
     }
     if (isset($params['sys_msg'])) {
         $sys_msg = $params['sys_msg'];
     }
     if (isset($params['toolbar_position'])) {
         $toolbar_pos = $params['toolbar_position'];
     }
     if (isset($params['show_menu'])) {
         $show_menu = $params['show_menu'];
     }
     if (isset($params['simple_menu'])) {
         $simple_menu = $params['simple_menu'];
     }
     if (isset($params['second_tb_header'])) {
         $second_tb_header = $params['second_tb_header'];
     }
     if (isset($params['toolbar'])) {
         $toolbar_s = $params['toolbar'];
     }
     if (isset($params['add_html_code'])) {
         $add_html_code = $params['add_html_code'];
     }
     if (isset($params['html_code_before_toolbar'])) {
         $add_html_tb_code = $params['html_code_before_toolbar'];
     }
     if (isset($params['output_blank_sys_msg_container'])) {
         $output_blank_sys_msg_container = $params['output_blank_sys_msg_container'];
     }
     if ($show_menu) {
         if (!$JLMS_CONFIG->get('lofe_show_top', true) && !$JLMS_CONFIG->get('lofe_show_course_box', true)) {
             $show_menu = 0;
             $simple_menu = 0;
         }
     }
     $skin = 'nopro';
     //'standart';
     //$skin = 'pro';
     if ($simple_menu) {
         if (!$JLMS_CONFIG->get('lofe_show_top', true)) {
             $simple_menu = 0;
             $show_menu = 0;
         }
     }
     $is_nopro_toolbar_shown = false;
     if ($skin == 'pro') {
         /*if ($show_menu) {
         			JLMS_TMPL::OpenTS('', ' width="100%"');
         			JLMS_showTopMenu( $course_id, $option );
         			JLMS_TMPL::CloseTS();
         		}*/
         JLMS_TMPL::OpenTS('', ' width="100%"');
         echo '		<table id="jlms_header_table" width="100%" cellpadding="0" cellspacing="0" border="0">' . "\r\n" . '			<tr>' . "\r\n" . '				<td width="48" valign="top" style="vertical-align:top">' . "\r\n" . JLMS_showHeadPicture($head_pic) . "\r\n" . '				</td>' . "\r\n";
         if ($show_menu) {
             if ($simple_menu) {
                 echo '				<td class="contentheading" width="100%" valign="middle" style="vertical-align:middle">' . "\r\n" . '					&nbsp;' . ($head_title ? $JLMS_CONFIG->get('additional_heading_tag_open') . $head_title . $JLMS_CONFIG->get('additional_heading_tag_close') : '') . "\r\n" . '				</td>' . "\r\n";
                 $menus = $JLMS_CONFIG->get('jlms_menu');
                 echo '				<td align="right"' . ($add_html_code ? ' colspan="2"' : '') . ' valign="top"' . ($simple_menu ? ' nowrap="nowrap"' : '') . ' style="vertical-align:top ">' . "\r\n";
                 //JLMS_showTopMenu_simple($option);
                 JLMS_TMPL::showTopMenu_simple($menus, $option, $skin);
             } else {
                 echo '				<td align="right"' . ($add_html_code ? ' colspan="2"' : '') . ' valign="top"' . ($simple_menu ? ' nowrap="nowrap"' : '') . ' style="vertical-align:top ">' . "\r\n";
                 $menus = $JLMS_CONFIG->get('jlms_menu');
                 JLMS_TMPL::showTopMenu($menus, $course_id, $option, $skin);
                 /*echo '<div style="width:100%; text-alignment: center;" class="jlms_controls_footer">';
                 		JLMS_TMPL::showMenuToolTips();
                 		echo '</div>';*/
             }
             echo '				</td>' . "\r\n";
             if (!$simple_menu) {
                 echo '</tr><tr><td colspan="2" width="100%"><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr>';
                 if (empty($toolbar)) {
                     echo '				<td class="contentheading" width="100%" valign="middle" style="vertical-align:middle">' . "\r\n" . '					&nbsp;' . ($head_title ? $JLMS_CONFIG->get('additional_heading_tag_open') . $head_title . $JLMS_CONFIG->get('additional_heading_tag_close') : '') . "\r\n" . '				</td>' . "\r\n";
                 } else {
                     echo '<td>&nbsp;</td>';
                 }
             }
             if ($add_html_code) {
                 echo '				<td align="right">' . "\r\n";
                 echo $add_html_code;
                 echo '				</td>' . "\r\n";
             }
             if (!$simple_menu) {
                 if ($JLMS_CONFIG->get('lofe_show_course_box', true)) {
                     echo '<td nowrap="nowrap" valign="top" align="right" style="vertical-align:top; text-align:right">';
                     if (false) {
                         JLMS_TMPL::ShowSelectCourseSB($course_id);
                     } else {
                         JLMS_TMPL::ShowSelectCourseSB_form($course_id);
                     }
                     echo '</td>';
                 }
             }
         } else {
             $at_first_row = true;
             echo '				<td class="contentheading" width="100%" valign="middle" style="vertical-align:middle">' . "\r\n" . '					&nbsp;' . ($head_title ? $JLMS_CONFIG->get('additional_heading_tag_open') . $head_title . $JLMS_CONFIG->get('additional_heading_tag_close') : '') . "\r\n" . '				</td>' . "\r\n";
             if ($toolbar_s) {
                 echo '				<td align="right"' . ($add_html_code ? ' colspan="2"' : '') . '>' . "\r\n";
                 echo JLMS_ShowToolbar($toolbar_s);
                 echo '				</td>' . "\r\n";
             }
         }
         if (!$simple_menu && $show_menu) {
             echo '			</tr></table></td></tr>' . "\r\n";
         } else {
             echo '			</tr>' . "\r\n";
         }
         echo '		</table>' . "\r\n";
     } else {
         JLMS_TMPL::OpenTS('', ' width="100%"');
         echo '		<table id="jlms_header_table" width="100%" cellpadding="0" cellspacing="0" border="0">' . "\r\n" . '			<tr>' . "\r\n" . '				<td width="48">' . "\r\n" . JLMS_showHeadPicture($head_pic) . "\r\n" . '				</td>' . "\r\n" . '				<td class="contentheading" width="100%" valign="middle" style="vertical-align:middle">' . "\r\n" . '					&nbsp;' . ($head_title ? $JLMS_CONFIG->get('additional_heading_tag_open') . $head_title . $JLMS_CONFIG->get('additional_heading_tag_close') : '') . "\r\n" . '				</td>' . "\r\n";
         if ($add_html_code) {
             echo '				<td align="right">' . "\r\n";
             echo $add_html_code;
             echo '				</td>' . "\r\n";
         }
         if ($show_menu) {
             echo '				<td align="right" valign="top"' . ($simple_menu ? ' nowrap="nowrap"' : '') . ' style="vertical-align:top ">' . "\r\n";
             if ($simple_menu) {
                 JLMS_showTopMenu_simple($option);
             } else {
                 JLMS_showTopMenu($course_id, $option, false, '', '', $gqp);
             }
             echo '				</td>' . "\r\n";
         } elseif ($toolbar_s) {
             echo '				<td align="right">' . "\r\n";
             echo JLMS_ShowToolbar($toolbar_s);
             echo '				</td>' . "\r\n";
         } elseif (!empty($toolbar) && $toolbar_pos != 'center') {
             echo '				<td align="right" nowrap="nowrap">' . "\r\n";
             echo JLMS_ShowToolbar($toolbar);
             echo '				</td>' . "\r\n";
             $is_nopro_toolbar_shown = true;
             /*JLMS_TMPL::ShowToolbar($toolbar, ($toolbar_pos?$toolbar_pos:'right'), true, $second_tb_header, 2 );
             		$is_nopro_toolbar_shown = true;*/
         }
         echo '			</tr>' . "\r\n" . '		</table>' . "\r\n";
     }
     if (!$simple_menu) {
         if ($show_menu) {
             JLMS_TMPL::ShowPlugins('star_menu');
         }
     }
     JLMS_TMPL::CloseTS();
     if ($with_sys_msg) {
         if (!$sys_msg) {
             $sys_msg = $JLMS_SESSION->get('joomlalms_sys_message');
         }
         $JLMS_SESSION->clear('joomlalms_sys_message');
         $tr_attrib = ' id="joomlalms_sys_message_container"';
         if (!$sys_msg) {
             $tr_attrib .= ' style="visibility:hidden;display:none"';
         }
         if ($sys_msg || $output_blank_sys_msg_container) {
             JLMS_TMPL::OpenTS($tr_attrib);
             echo '		<div class="' . $JLMS_CONFIG->get('system_message_css_class', 'joomlalms_sys_message') . '" id="joomlalms_sys_message" style="text-align:center">' . $sys_msg . '</div>' . "\r\n";
             JLMS_TMPL::CloseTS();
         }
         $task = strval(mosGetParam($_REQUEST, 'task', ''));
         if ($task) {
             $sys_msgs = $JLMS_CONFIG->get('system_messages', array());
             if (!empty($sys_msgs)) {
                 foreach ($sys_msgs as $sysmsg) {
                     if (isset($sysmsg['message']) && $sysmsg['message'] && isset($sysmsg['task']) && $sysmsg['task'] == $task && (isset($sysmsg['course']) && $sysmsg['course'] == $JLMS_CONFIG->get('course_id') || empty($sysmsg['course']))) {
                         JLMS_TMPL::OpenTS();
                         echo '		<div class="' . $JLMS_CONFIG->get('system_message_css_class', 'joomlalms_sys_message') . '"' . (isset($sysmsg['align']) && $sysmsg['align'] ? ' style="text-align:' . $sysmsg['align'] . '"' : '') . '>' . $sysmsg['message'] . '</div>' . "\r\n";
                         JLMS_TMPL::CloseTS();
                     }
                 }
                 /*$sysmsg_var = $task;
                 		if (isset($sys_msgs[$sysmsg_var]) && $sys_msgs[$sysmsg_var]) {
                 			JLMS_TMPL::OpenTS();
                 			echo '		<span class="'.$JLMS_CONFIG->get('system_message_css_class', 'joomlalms_sys_message').'">'.$sys_msgs[$sysmsg_var].'</span>'."\r\n";
                 			JLMS_TMPL::CloseTS();
                 		}*/
             }
         }
     }
     if ($add_html_tb_code) {
         JLMS_TMPL::OpenTS();
         echo $add_html_tb_code;
         JLMS_TMPL::CloseTS();
     }
     if (!empty($toolbar) && !$is_nopro_toolbar_shown) {
         if ($skin == 'pro') {
             $second_tb_header = $head_title ? $head_title : $second_tb_header;
         }
         JLMS_TMPL::ShowToolbar($toolbar, $toolbar_pos ? $toolbar_pos : 'right', true, $second_tb_header, 2);
     }
 }