function jlms_booking_users($course_id, $option, $lists, $pid, $rows)
    {
        global $Itemid, $my, $JLMS_DB;
        JLMS_TMPL::OpenMT();
        $params = array('show_menu' => true);
        JLMS_TMPL::ShowHeader('conference', _JLMS_HEAD_CONF_STR, $params);
        JLMS_TMPL::OpenTS();
        ?>
	<script type="text/javascript" language="javascript">
	<!--//--><![CDATA[//><!--
	function submitbutton(pressbutton) {
		var form = document.adminForm;

			form.mode.value = pressbutton;
			form.submit();
		
	}
	//--><!]]>
	</script>
		<table width="100%" cellpadding="0" cellspacing="0" border="0">
			<tr>
				<td colspan="2">&nbsp;
					
				</td>
				<td style="text-align:right;"><br />
					<?php 
        $toolbar = array();
        //$toolbar[] = array('btn_type' => 'edit', 'btn_js' => sefRelToAbs("index.php?option=$option&amp;Itemid=$Itemid&amp;task=conference&amp;id=$course_id&amp;mode=archive") );
        $toolbar[] = array('btn_type' => 'save', 'btn_js' => "javascript:submitbutton('save_users');");
        $toolbar[] = array('btn_type' => 'cancel', 'btn_js' => sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=conference&amp;mode=booking&amp;id={$course_id}"));
        //echo JLMS_ShowToolbar($toolbar);
        ?>
				</td>
			</tr>
		</table>
<?php 
        JLMS_TMPL::CloseTS();
        JLMS_TMPL::OpenTS();
        ?>
		<form action="<?php 
        echo sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}");
        ?>
" method="post" name="adminForm">
			<table cellpadding="0" cellspacing="0" border="0" width="100%">
				<tr>
					<td width="20%">
						Select user
					</td>
					<td>
						<?php 
        echo $lists['usrs'];
        ?>
					</td>
				</tr>
			</table>
			
			<table width="100%" cellpadding="0" cellspacing="0" border="0">
				<tr>
					<td class="sectiontableheader" align="left" width="15">#</td>

					<td class="sectiontableheader" align="left" width="10"><input type="checkbox" name="toggle" value="" onclick="checkAll(<?php 
        echo count($rows);
        ?>
);" /></td>
					<td class="sectiontableheader" align="left"><?php 
        echo "Username";
        ?>
</td>
				</tr>
			<?php 
        $k = 1;
        for ($i = 0, $n = count($rows); $i < $n; $i++) {
            $row = $rows[$i];
            $checked = mosHTML::idBox($i, $row->user_id);
            ?>
			
				<tr valign="middle" style="vertical-align:middle" class="<?php 
            echo "sectiontableentry{$k}";
            ?>
">
					<td align="left"><?php 
            echo $i + 1;
            ?>
</td>
					<td align="left"><?php 
            echo $checked;
            ?>
</td>
					<td align="left">
						<?php 
            echo $row->name . "(" . $row->username . ")";
            ?>
 
					</td>
				</tr>
				<?php 
            $k = 3 - $k;
        }
        ?>
			</table>
			<input type="hidden" name="task" value="conference" />
			<input type="hidden" name="mode" value="" />
			<input type="hidden" name="boxchecked" value="0" />
			<input type="hidden" name="p_id" value="<?php 
        echo $pid;
        ?>
" />
			<input type="hidden" name="id" value="<?php 
        echo $course_id;
        ?>
" />
			<input type="hidden" name="state" value="0" />
		</form>
		<?php 
        JLMS_TMPL::CloseTS();
        $controls = array();
        $controls[] = array('href' => "javascript:submitbutton('save_users');", 'title' => 'Save', 'img' => 'save');
        $controls[] = array('href' => "javascript:submitbutton('delete_users_from_conference');", 'title' => _JLMS_DELETE, 'img' => 'delete');
        JLMS_TMPL::ShowControlsFooter($controls, sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=conference&amp;mode=booking&amp;id={$course_id}"));
        /*$controls = array();
        		$controls[] = array('href' => "javascript:submitbutton('period_cancel');", 'title' => _JLMS_CANCEL_ALT_TITLE, 'img' => 'cancel');
        		$controls[] = array('href' => "javascript:submitbutton('save_users');", 'title' => _JLMS_SAVE_ALT_TITLE, 'img' => 'save');
        		
        		JLMS_TMPL::ShowControlsFooter($controls, sefRelToAbs("index.php?option=$option&amp;Itemid=$Itemid&amp;task=conference&amp;mode=booking&amp;id=$course_id"));
        */
        JLMS_TMPL::CloseMT();
    }
    function show_all_notices($option, $lists, $total, $pageNav, $limitstart, $limit)
    {
        global $JLMS_CONFIG, $Itemid;
        //FLMS multicat
        $multicat = array();
        if ($JLMS_CONFIG->get('multicat_use', 0)) {
            $multicat = array();
            $i = 0;
            foreach ($lists as $key => $item) {
                if (substr($key, 0, 7) == 'filter_') {
                    $multicat[] = $lists['filter_' . $i];
                    $i++;
                }
            }
        }
        $link_pages = "index.php?option={$option}&task=view_all_notices";
        ?>
		<script language="javascript" type="text/javascript">
		<!--//--><![CDATA[//><!--
		var old_filters = new Array();
		function read_filter(){
			var form = document.adminForm;
			var count_levels = '<?php 
        echo count($lists['levels']);
        ?>
';
			for(var i=0;i<parseInt(count_levels);i++){
				if(form['filter_id_'+i] != null){
					old_filters[i] = form['filter_id_'+i].value;
				}
			}
		}
		function write_filter(){
			var form = document.adminForm;
			var count_levels = '<?php 
        echo count($lists['levels']);
        ?>
';
			var j;
			for(var i=0;i<parseInt(count_levels);i++){
				if(form['filter_id_'+i+''] != null && form['filter_id_'+i+''].value != old_filters[i]){
					j = i;
				}
				if(i > j){
					if(form['filter_id_'+i] != null){
						form['filter_id_'+i].value = 0;	
					}
				}
			}
		}
		function submitbutton(pressbutton) {
			var form = document.adminForm;
			if ((pressbutton == 'delete_notice_no_ajax' || pressbutton == 'edit_notice_no_ajax') && form.boxchecked.value == '0') {
				alert('<?php 
        echo _JLMS_ALERT_SELECT_ITEM;
        ?>
');
			} else {
				form.task.value = pressbutton;
				form.submit();
			}
		}
		//--><!]]>
		</script>
		<form action="<?php 
        echo $JLMS_CONFIG->get('live_site') . "/index.php?option={$option}&amp;Itemid={$Itemid}";
        ?>
" method="post" name="adminForm">
			<?php 
        JLMS_TMPL::OpenMT();
        $params = array('show_menu' => true, 'simple_menu' => true);
        JLMS_TMPL::ShowHeader('doc', 'View notices', $params);
        $controls = array();
        $controls[] = array('href' => $JLMS_CONFIG->get('live_site') . "/index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=new_notice_no_ajax", 'title' => 'New Notice', 'img' => 'add');
        $controls[] = array('href' => "javascript:submitbutton('edit_notice_no_ajax');", 'title' => 'Edit Notice', 'img' => 'edit');
        $controls[] = array('href' => "javascript:submitbutton('delete_notice_no_ajax');", 'title' => 'Delete Notice(s)', 'img' => 'delete');
        //			$controls[] = array('href' => 'spacer');
        JLMS_TMPL::ShowControlsFooter($controls, '', false);
        JLMS_TMPL::CloseMT();
        ?>
			<table border="0" cellpadding="0" cellspacing="0" width="100%">
				<tr>
					<td colspan="5">
						<table border="0" cellpadding="0" cellspacing="0" align="right">
							<tr>
								<td align="right">
									<?php 
        if ($JLMS_CONFIG->get('multicat_use', 0)) {
            echo (isset($lists['levels'][0]->cat_name) && $lists['levels'][0]->cat_name != '' ? $lists['levels'][0]->cat_name : _JLMS_COURSES_COURSES_GROUPS) . " " . $lists['filter_0'];
        } else {
            echo _JLMS_COURSES_COURSES_GROUPS . " " . $lists['groups_course'];
        }
        ?>
								</td>
							</tr>
							<?php 
        if (count($multicat)) {
            for ($i = 0; $i < count($multicat); $i++) {
                if ($i > 0) {
                    ?>
										<tr>
											<td align="right">
											<?php 
                    echo (isset($lists['levels'][$i]->cat_name) && $lists['levels'][$i]->cat_name != '' ? $lists['levels'][$i]->cat_name : _JLMS_COURSES_COURSES_GROUPS) . " " . $lists['filter_' . $i];
                    ?>
	
											</td>
										</tr>	
										<?php 
                }
            }
        }
        if (isset($lists['levels'][0]) || count($multicat)) {
            ?>
								<tr>
									<td align="right">
										<?php 
            echo $lists['f_course'];
            ?>
	
									</td>
								</tr>	
								<?php 
        }
        ?>
						</table>
					</td>
				</tr>
				<tr>
					<td colspan="5" align="center">
						<?php 
        echo $pageNav->writePagesCounter() . ' ' . $pageNav->getLimitBox($link_pages);
        ?>
					</td>
				</tr>
				<tr>
					<td class="sectiontableheader" width="1%">
						#
					</td>
					<td class="sectiontableheader" width="1%">
						<input type="checkbox" name="toggle" value="" onclick="checkAll(<?php 
        echo count($lists['my_notices']);
        ?>
);" />
					</td>
					<td class="sectiontableheader">
						Notice
					</td>
					<td class="sectiontableheader" width="20%">
						Course name
					</td>
					<td class="sectiontableheader" width="10%">
						Date
					</td>
				</tr>
				<?php 
        $link_base = 'index.php?option=com_joomla_lms';
        $z = $limitstart;
        $end = $limit + $z;
        if ($end > $total) {
            $end = $total + 1;
        }
        $k = 1;
        for ($i = $z; $i < $end; $i++) {
            if (isset($lists['my_notices'][$i])) {
                $m_n = $lists['my_notices'][$i];
                $link = $link_base;
                if ($m_n->doc_id) {
                    $link .= '&task=' . $m_n->task . '&course_id=' . $m_n->course_id . '&id=' . $m_n->doc_id . '';
                } else {
                    $link .= '&task=' . $m_n->task . '&id=' . $m_n->course_id . '';
                }
                $checked = mosHTML::idBox($i, $m_n->id);
                ?>
						<tr class="<?php 
                echo "sectiontableentry{$k}";
                ?>
">
							<td align="center" width="1%"><?php 
                echo $pageNav->limitstart + $i + 1;
                ?>
</td>
							<td align="center" width="1%"><?php 
                echo $checked;
                ?>
</td>
							<td style="text-align: justify;">
								<?php 
                if (!$m_n->course_id && !$m_n->doc_id) {
                    /*
                    if(strlen($m_n->notice) > 100){
                    	echo substr($m_n->notice, 0, 100).' ...';	
                    } else {
                    	echo substr($m_n->notice, 0, 100);	
                    }
                    */
                    echo $m_n->notice;
                } else {
                    ?>
								<a href="<?php 
                    echo sefRelToAbs($link);
                    ?>
" title="<?php 
                    echo str_replace('"', '&quot;', strip_tags(substr($m_n->notice, 0, 30)));
                    ?>
">
									<?php 
                    /*
                    if(strlen($m_n->notice) > 100){
                    	echo substr($m_n->notice, 0, 100).' ...';	
                    } else {
                    	echo substr($m_n->notice, 0, 100);	
                    }
                    */
                    echo $m_n->notice;
                    ?>
								</a>
								<?php 
                }
                ?>
							</td>
							<td>
								<?php 
                echo $m_n->course_name;
                ?>
							</td>
							<td width="10%" nowrap="nowrap">
							on 
							<?php 
                echo JLMS_dateToDisplay($m_n->data, false, 0, " H:m:s");
                ?>
							</td>
						</tr>
						<?php 
                $k = 3 - $k;
            }
        }
        ?>
				<tr>
					<td colspan="5" align="center">
					<br />
						<?php 
        echo $pageNav->writePagesLinks($link_pages);
        ?>
					</td>
				</tr>
			</table>
			
			<input type="hidden" name="task" value="" />
			<input type="hidden" name="boxchecked" value="0" />
		
		</form>
		<?php 
    }
    function viewCourses_blog(&$rows, &$pageNav, $option, $usertype, $lists, $levels)
    {
        global $Itemid, $JLMS_CONFIG, $my, $JLMS_DB, $acl;
        $JLMS_ACL =& JLMSFactory::getACL();
        $pres_icons = new stdClass();
        $pres_icons->mail = 0;
        $pres_icons->already = 0;
        $pres_icons->my = 0;
        $pres_icons->wl = 0;
        $lms_img_path = $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('lms_path_to_images', 'components/com_joomla_lms/lms_images');
        //		$show_fee_col = $JLMS_CONFIG->get('show_fee_column', 1);
        $price_fee_type = $JLMS_CONFIG->get('price_fee_type', 1);
        $show_short_description = $JLMS_CONFIG->get('show_short_description', 0);
        $show_course_publish_dates = $JLMS_CONFIG->get('show_course_publish_dates', 0);
        $jlms_cs = $JLMS_CONFIG->get('jlms_cur_sign');
        $colspan_sh_description = 4;
        if ($show_course_publish_dates) {
            $colspan_sh_description = 6;
        }
        if (!$price_fee_type) {
            $colspan_sh_description = $colspan_sh_description - 1;
        }
        $show_course_author = $JLMS_CONFIG->get('show_course_authors', 1);
        $course_id = mosGetParam($_REQUEST, 'c_id', '');
        if ($course_id) {
            $query = "SELECT course_name FROM #__lms_courses WHERE id = '{$course_id}'";
            $JLMS_DB->setQuery($query);
            $course_name = $JLMS_DB->loadResult();
        }
        //FLMS multicat
        $multicat = array();
        if ($JLMS_CONFIG->get('multicat_use', 0)) {
            $multicat = array();
            $i = 0;
            foreach ($lists as $key => $item) {
                if (substr($key, 0, 7) == 'filter_') {
                    $multicat[] = $lists['filter_' . $i];
                    $i++;
                }
            }
        }
        ?>
		
		<script language="javascript" type="text/javascript">
		<!--//--><![CDATA[//><!--
		function submitbutton(pressbutton, course_id) {
			var form = document.adminForm;
			if ( (pressbutton == 'delete_course') || (pressbutton == 'edit_course') || (pressbutton == 'export_course_pre') ) {
				form.id.value = course_id;
				form.task.value = pressbutton;
				form.submit();
			}
			else if( (pressbutton == 'enroll') && (form.boxchecked.value == '0') ){
				alert( "<?php 
        echo _JLMS_ALERT_SELECT_ITEM;
        ?>
" );
			}
			else {
				if (pressbutton == 'enroll'){
					form.task.value = 'subscription';
					form.submit();
				}
			}
		}
		<?php 
        if ($JLMS_CONFIG->get('multicat_use', 0)) {
            ?>
		var old_filters = new Array();
		function read_filter(){
			var form = document.adminForm;
			var count_levels = '<?php 
            echo count($levels);
            ?>
';
			for(var i=0;i<parseInt(count_levels);i++){
				if(form['filter_id_'+i] != null){
					old_filters[i] = form['filter_id_'+i].value;
				}
			}
		}
		function write_filter(){
			var form = document.adminForm;
			var count_levels = '<?php 
            echo count($levels);
            ?>
';
			var j;
			for(var i=0;i<parseInt(count_levels);i++){
				if(form['filter_id_'+i+''] != null && form['filter_id_'+i+''].value != old_filters[i]){
					j = i;
				}
				if(i > j){
					if(form['filter_id_'+i] != null){
						form['filter_id_'+i].value = 0;	
					}
				}
			}
		}
		<?php 
        }
        ?>
		//--><!]]>
		</script>

		<form action="<?php 
        echo $JLMS_CONFIG->getCfg('live_site') . "/index.php?option={$option}&amp;Itemid={$Itemid}";
        ?>
" method="post" name="adminForm">
<?php 
        JLMS_TMPL::OpenMT();
        $params = array('show_menu' => true, 'simple_menu' => true);
        JLMS_TMPL::ShowHeader('course', _JLMS_COURSES_COURSES_LIST, $params);
        JLMS_TMPL::ShowPageTip('courses');
        JLMS_TMPL::OpenTS('', ' align="right" style="text-align:right " width="100%"');
        //		echo _JLMS_PN_DISPLAY_NUM . $pageNav->getLimitBox( $link );
        //		echo _JLMS_COURSES_FILTER." : ".$lists['courses_type'];
        if ($JLMS_CONFIG->get('multicat_use', 0)) {
            echo (isset($levels[0]->cat_name) && $levels[0]->cat_name != '' ? $levels[0]->cat_name : _JLMS_COURSES_COURSES_GROUPS) . " " . $lists['filter_0'] . "&nbsp;&nbsp;";
        } else {
            echo _JLMS_COURSES_COURSES_GROUPS . " " . $lists['groups_course'] . "&nbsp;&nbsp;";
        }
        JLMS_TMPL::CloseTS();
        if (count($multicat)) {
            for ($i = 0; $i < count($multicat); $i++) {
                if ($i > 0) {
                    JLMS_TMPL::OpenTS('', ' align="right" style="text-align:right " width="100%"');
                    echo (isset($levels[$i]->cat_name) && $levels[$i]->cat_name != '' ? $levels[$i]->cat_name : _JLMS_COURSES_COURSES_GROUPS) . " " . $lists['filter_' . $i] . "&nbsp;&nbsp;";
                    JLMS_TMPL::CloseTS();
                }
            }
        }
        $controls = array();
        $JLMS_ACL =& JLMSFactory::getACL();
        if ($JLMS_ACL->CheckPermissions('lms', 'create_course')) {
            $controls[] = array('href' => JLMSRoute::_("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=add_course"), 'title' => _JLMS_COURSES_NEW, 'img' => 'add');
            $controls[] = array('href' => JLMSRoute::_("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=course_import"), 'title' => _JLMS_COURSES_IMPORT, 'img' => 'courseimport');
            $controls[] = array('href' => 'spacer');
            JLMS_TMPL::ShowControlsFooter($controls, '', false);
        }
        //$controls[] = array('href' => "javascript:submitbutton('enroll','');", 'title' => _JLMS_ENROLL, 'img' => 'publish');
        JLMS_TMPL::OpenTS('', ' style="padding: 5px;"');
        if (JLMS_J16version()) {
            ?>
		<div class="lms_courses_blog">
			<div class="blog-featured">
				<?php 
            if (isset($lists['leading_courses']) && $lists['leading_courses']) {
                ?>
				<div class="items-leading">
					<?php 
                $lead_indx = 0;
                foreach ($rows as $row) {
                    if (isset($row->leading_course) && $row->leading_course) {
                        $leading = 'leading-' . $lead_indx;
                        ?>
							<div class="<?php 
                        echo $leading;
                        ?>
">
								<h2>
									<a href="<?php 
                        echo JRoute::_('index.php?option=' . $option . '&task=details_course&id=' . $row->id);
                        ?>
" title="<?php 
                        echo $row->course_name;
                        ?>
">
										<?php 
                        echo $row->course_name;
                        ?>
									</a>
									<?php 
                        $_JLMS_PLUGINS =& JLMSFactory::getPlugins();
                        $_JLMS_PLUGINS->loadBotGroup('system');
                        $plugin_args = array();
                        $plugin_args[] = $row->id;
                        $_JLMS_PLUGINS->trigger('onShowBlogCourseInfo', $plugin_args);
                        ?>
									<div class="clr"><!-- --></div>
								</h2>
								<dl class="article-info">
									<?php 
                        if ($show_course_author) {
                            ?>
										<dd class="createdby">
											<?php 
                            echo _JLMS_HOME_AUTHOR . ' ' . $row->user_fullname;
                            ?>
										</dd>
										<?php 
                        }
                        ?>
								</dl>
								<?php 
                        echo JLMS_ShowText_WithFeatures($row->course_sh_description);
                        ?>
								<div class="item-separator"><!-- --></div>
							</div>
							<?php 
                        $lead_indx++;
                    }
                }
                ?>
				</div>
				<?php 
            }
            $class = 'items-row';
            $cols_class = 'cols-' . $lists['menu_params']->get('num_columns', 2);
            $row_class = 'row-0';
            $class = $class . ' ' . $cols_class . ' ' . $row_class;
            ?>
				<div class="<?php 
            echo $class;
            ?>
">
				<?php 
            $n = 1;
            for ($i = 0; $i < count($rows); $i++) {
                $row = $rows[$i];
                if (!isset($row->leading_course) || !$row->leading_course) {
                    ?>
					
						<?php 
                    $column_class = 'item';
                    $column_class .= ' ' . 'column-' . $n;
                    ?>
						<div class="<?php 
                    echo $column_class;
                    ?>
">
							<h2>
								<a href="<?php 
                    echo JRoute::_('index.php?option=' . $option . '&task=details_course&id=' . $row->id);
                    ?>
" title="<?php 
                    echo $row->course_name;
                    ?>
">
									<?php 
                    echo $row->course_name;
                    ?>
								</a>
								<?php 
                    $_JLMS_PLUGINS =& JLMSFactory::getPlugins();
                    $_JLMS_PLUGINS->loadBotGroup('system');
                    $plugin_args = array();
                    $plugin_args[] = $row->id;
                    $_JLMS_PLUGINS->trigger('onShowBlogCourseInfo', $plugin_args);
                    ?>
								<div class="clr"><!-- --></div>
							</h2>
							<dl class="article-info">
								<?php 
                    if ($show_course_author) {
                        ?>
									<dd class="createdby">
										<?php 
                        echo _JLMS_HOME_AUTHOR . ' ' . $row->user_fullname;
                        ?>
									</dd>
									<?php 
                    }
                    ?>
							</dl>
							
							<?php 
                    echo JLMS_ShowText_WithFeatures($row->course_sh_description);
                    ?>
							<div class="item-separator"><!-- --></div>
						</div>
						<?php 
                    if ($lists['menu_params']->get('num_columns', 2) == $n) {
                        ?>
							<span class="row-separator"><!-- --></span>
							<?php 
                        $n = 1;
                    } else {
                        $n++;
                    }
                }
            }
            ?>
				</div>
			</div>
		</div>
		<?php 
        } else {
            ?>
		<table width="100%" cellpadding="0" cellspacing="0" border="0">
			<?php 
            if (isset($lists['leading_courses']) && $lists['leading_courses']) {
                ?>
			<tr>
				<td colspan="<?php 
                echo is_object($lists['menu_params']) && method_exists($lists['menu_params'], 'get') ? $lists['menu_params']->get('num_columns', 2) : 2;
                ?>
" valign="top">
					<?php 
                for ($x = 0; $x < count($rows); $x++) {
                    $row = $rows[$x];
                    if (isset($row->leading_course) && $row->leading_course) {
                        ?>
							<div class="course_info">
								<table width="100%" cellpadding="0" cellspacing="0" border="0">
									<tr>
										<td class="contentheading">
											<a href="<?php 
                        echo sefRelToAbs('index.php?option=' . $option . '&task=details_course&id=' . $row->id);
                        ?>
" title="<?php 
                        echo $row->course_name;
                        ?>
">
												<?php 
                        echo $row->course_name;
                        ?>
											</a>
										</td>
									</tr>
								</table>
								<?php 
                        if ($show_course_author) {
                            ?>
								<div class="course_author">
									<span class="small"><?php 
                            echo _JLMS_HOME_AUTHOR . "&nbsp;" . $row->user_fullname;
                            ?>
</span>
								</div>
								<?php 
                        }
                        ?>
								<?php 
                        $_JLMS_PLUGINS =& JLMSFactory::getPlugins();
                        $_JLMS_PLUGINS->loadBotGroup('system');
                        $plugin_args = array();
                        $plugin_args[] = $row->id;
                        $_JLMS_PLUGINS->trigger('onShowBlogCourseInfo', $plugin_args);
                        ?>
								<div class="course_sh_dsc">
									<?php 
                        echo $row->course_sh_description;
                        ?>
								</div>
							</div>
							<span class="article_separator">&nbsp;</span>
							<?php 
                    }
                }
                ?>
				</td>
			</tr>
			<?php 
            }
            ?>
	
			<tr>
				<?php 
            $divider = '';
            $menu_params_columns = is_object($lists['menu_params']) && method_exists($lists['menu_params'], 'get') ? $lists['menu_params']->get('num_columns', 2) : 2;
            for ($z = 0; $z < $menu_params_columns; $z++) {
                if ($z > 0) {
                    $divider = ' column_separator';
                }
                ?>
				<td class="article_column<?php 
                echo $divider;
                ?>
" valign="top" width="<?php 
                echo intval(100 / $menu_params_columns);
                ?>
%">
					<?php 
                for ($x = 0; $x < count($rows); $x++) {
                    $n = $x * $menu_params_columns + $z;
                    if (isset($rows[$n])) {
                        $row = $rows[$n];
                        if (!isset($row->leading_course) || !$row->leading_course) {
                            ?>
								<div class="course_info">
									<table width="100%" cellpadding="0" cellspacing="0" border="0">
										<tr>
											<td class="contentheading">
												<a href="<?php 
                            echo sefRelToAbs('index.php?option=' . $option . '&task=details_course&id=' . $row->id);
                            ?>
" title="<?php 
                            echo $row->course_name;
                            ?>
">
													<?php 
                            echo $row->course_name;
                            ?>
												</a>
											</td>
										</tr>
									</table>
									<?php 
                            if ($show_course_author) {
                                ?>
									<div class="course_author">
										<span class="small"><?php 
                                echo _JLMS_HOME_AUTHOR . "&nbsp;" . $row->user_fullname;
                                ?>
</span>
									</div>
									<?php 
                            }
                            ?>
									<?php 
                            $_JLMS_PLUGINS =& JLMSFactory::getPlugins();
                            $_JLMS_PLUGINS->loadBotGroup('system');
                            $plugin_args = array();
                            $plugin_args[] = $row->id;
                            $_JLMS_PLUGINS->trigger('onShowBlogCourseInfo', $plugin_args);
                            ?>
									<div class="course_sh_dsc">
										<?php 
                            echo $row->course_sh_description;
                            ?>
									</div>
								</div>
								<span class="article_separator">&nbsp;</span>
								<?php 
                        }
                    }
                }
                ?>
				</td>
				<?php 
            }
            ?>
			</tr>
		</table>
	<?php 
        }
        ?>
	
	<center>
	<?php 
        $link = "index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=courses";
        echo _JLMS_PN_DISPLAY_NUM . ' ' . $pageNav->getLimitBox($link);
        echo $pageNav->writePagesCounter();
        ?>
	</center>
	<center>
		<?php 
        $link = "index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=courses";
        echo $pageNav->writePagesLinks($link);
        ?>
	</center>
	<?php 
        JLMS_TMPL::CloseTS();
        if ($pres_icons->already || $pres_icons->mail || $pres_icons->my || $pres_icons->wl) {
            JLMS_TMPL::OpenTS('', ' align="left"');
            ?>
			<div class="joomlalms_info_legend">
			<?php 
            if ($pres_icons->already) {
                ?>
				<div style="text-align:left ">
					<img class="JLMS_png" src="<?php 
                echo $lms_img_path;
                ?>
/buttons/btn_complete.png" align="top" width="16" height="16" border="0" alt="<?php 
                echo _JLMS_COURSES_ALREADY;
                ?>
" title="<?php 
                echo _JLMS_COURSES_ALREADY;
                ?>
" />
					&nbsp;- <?php 
                echo _JLMS_COURSES_ALREADY;
                ?>
.
				</div>
			<?php 
            }
            ?>
			<?php 
            if ($pres_icons->mail) {
                ?>
				<div style="text-align:left ">
					<img class='JLMS_png' src="<?php 
                echo $lms_img_path;
                ?>
/dropbox/dropbox_corr.png" align="top" width='16' height='16' border='0' alt='' title='' />
					&nbsp;- <?php 
                echo _JLMS_COURSES_ADMIN_SENT;
                ?>
				</div>
			<?php 
            }
            ?>
			<?php 
            if ($pres_icons->my) {
                ?>
				<div style="text-align:left ">
					<img class="JLMS_png" src="<?php 
                echo $lms_img_path;
                ?>
/toolbar/tlb_courses.png" align="top" width="16" height="16" border="0" alt="<?php 
                echo _JLMS_COURSES_TITLE_MY_COURSES;
                ?>
" title="<?php 
                echo _JLMS_COURSES_TITLE_MY_COURSES;
                ?>
" />
					&nbsp;- <?php 
                echo _JLMS_COURSES_TITLE_MY_COURSES;
                ?>
.
				</div>
			<?php 
            }
            ?>
			<?php 
            if ($pres_icons->wl) {
                ?>
				<div style="text-align:left ">
					<img class="JLMS_png" src="<?php 
                echo $lms_img_path;
                ?>
/buttons/btn_waiting.png" align="top" width="16" height="16" border="0" alt="<?php 
                echo _JLMS_COURSES_TITLE_MY_COURSES;
                ?>
" title="<?php 
                echo _JLMS_COURSES_TITLE_MY_COURSES;
                ?>
" />
					&nbsp;- <?php 
                echo _JLMS_COURSES_IN_WL;
                ?>
.
				</div>
			<?php 
            }
            ?>
			</div>
	<?php 
            JLMS_TMPL::CloseTS();
        }
        JLMS_TMPL::CloseMT();
        ?>
		<input type="hidden" name="task" value="" />
		<input type="hidden" name="id" value="" />
		<input type="hidden" name="boxchecked" value="0" />
		<input type="hidden" name="itemid" value="" />
		<input type="hidden" name="row_id" value="0" />
	</form>
	<?php 
    }
    function showUsersGlobal($course_id, $group_id, $option, &$rows, &$lists, &$pageNav, $u_search, $view_type = 1)
    {
        global $Itemid, $JLMS_CONFIG;
        $JLMS_ACL =& JLMSFactory::getACL();
        ?>
		<script language="javascript" type="text/javascript">
		<!--
		function submitbutton(pressbutton) {
			var form = document.adminForm;
			if ((pressbutton == 'edit_user' || pressbutton == 'delete_user') && (form.boxchecked.value == "0")){
				alert( "<?php 
        echo _JLMS_USER_SELECT_USER;
        ?>
" );
			} else {
				form.task.value = pressbutton;
				form.submit();
			}
		}
		//-->
		</script>
		<?php 
        JLMS_TMPL::OpenMT();
        $hparams = array();
        $toolbar = array();
        $title = '';
        if ($view_type == 1) {
            $title = '&nbsp;' . _JLMS_USERS_TITLE;
        } elseif ($view_type == 2) {
            $title = '&nbsp;' . _JLMS_USERS_ASSISTS_TITLE;
        }
        //		$toolbar[] = array('btn_type' => 'back', 'btn_js' => sefRelToAbs("index.php?option=$option&amp;Itemid=$Itemid&amp;task=course_users&amp;id=$course_id"));
        JLMS_TMPL::ShowHeader('usergroup', $title, $hparams, $toolbar);
        if ($view_type == 1) {
            JLMS_TMPL::OpenTS();
            echo $lists['groups'];
            JLMS_TMPL::CloseTS();
        }
        JLMS_TMPL::OpenTS();
        $colspan = $view_type == 1 ? 9 : 4;
        ?>
		<form action="<?php 
        echo $JLMS_CONFIG->get('live_site') . "/index.php?option=" . $option . "&amp;Itemid=" . $Itemid;
        ?>
" method="post" name="adminForm">
			<table width="100%" cellpadding="0" cellspacing="0" border="0" class="jlms_table_no_borders" style="margin-top: 2px;">
				<tr>
					<td>
						<input type="text" class="inputbox" name="u_search" value="<?php 
        echo $u_search;
        ?>
" />
						<input type="button" value="Search" onclick="javascript:submitbutton('course_users');" />
					</td>
				</tr>
			</table>
			<table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php 
        echo JLMSCSS::_('jlmslist');
        ?>
" style="margin-top: 2px;">
				<tr>
					<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 width="20" class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" align="center">#</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
					<?php 
        if ($JLMS_ACL->CheckPermissions('users', 'manage')) {
            ?>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 width="20" class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" align="center"><input type="checkbox" name="toggle" value="" onclick="checkAll(<?php 
            echo count($rows);
            ?>
);" /></<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<?php 
        } else {
            ?>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 width="20" class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" align="center">&nbsp;</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>					
					<?php 
        }
        ?>
					<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
"><?php 
        echo _JLMS_USERS_TBL_HEAD_USERNAME;
        ?>
</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
					<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
"><?php 
        echo _JLMS_USERS_TBL_HEAD_USER_ADDINFO;
        ?>
</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
					<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
"><?php 
        echo _JLMS_USERS_TBL_HEAD_GROUP;
        ?>
</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
					<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
"><?php 
        echo _JLMS_TBL_HEAD_USERS_ROLE;
        ?>
</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
				<?php 
        if ($view_type == 1) {
            ?>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" colspan="2" align="center"><?php 
            echo _JLMS_USERS_TBL_HEAD_USER_ACC_PERIOD;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
"><?php 
            echo _JLMS_USERS_TBL_HEAD_USER_COMMENT;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
				<?php 
        }
        ?>
				</tr>
			<?php 
        $k = 1;
        for ($i = 0, $n = count($rows); $i < $n; $i++) {
            $row = $rows[$i];
            $link = "index.php?option=" . $option . "&amp;Itemid=" . $Itemid . "&amp;task=view_users&amp;course_id=" . $course_id . "&amp;id=" . $row->id;
            $checked = mosHTML::idBox($i, $row->id);
            if (!$JLMS_ACL->CheckPermissions('users', 'manage')) {
                $checked = '&nbsp;';
            }
            ?>
				<tr class="<?php 
            echo JLMSCSS::_('sectiontableentry' . $k);
            ?>
">
					<td align="center"><?php 
            echo $pageNav->limitstart + $i + 1;
            ?>
</td>
					<td><?php 
            echo $checked;
            ?>
</td>
					<td align="left">
					<?php 
            echo $row->username;
            ?>
					</td>
					<td><?php 
            echo $row->name . "(" . $row->email . ")";
            ?>
</td>
					<?php 
            if ($view_type == 1) {
                ?>
					<td align="center"><?php 
                echo $row->ug_name;
                ?>
</td>
					<td align="center"><?php 
                echo $row->lms_usertype;
                ?>
</td>
					<td align="center"><?php 
                echo $row->publish_start ? JLMS_dateToDisplay($row->start_date) : '-';
                ?>
</td>
					<td align="center"><?php 
                echo $row->publish_end ? JLMS_dateToDisplay($row->end_date) : '-';
                ?>
</td>
					<td><?php 
                echo $row->user_add_comment ? $row->user_add_comment : '&nbsp;';
                ?>
</td>
					<?php 
            }
            ?>
				</tr>
				<?php 
            $k = 3 - $k;
        }
        ?>
				<tr>
					<td colspan="<?php 
        echo $view_type == 1 ? '9' : '4';
        ?>
" align="center" class="<?php 
        echo JLMSCSS::_('jlmslist-footer_td');
        ?>
">
					<div align="center" style="white-space: nowrap;">
					<?php 
        $link = "index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=course_users&amp;id={$course_id}&amp;group_id={$group_id}";
        if ($u_search != '') {
            $link .= '&amp;u_search=' . $u_search;
        }
        echo _PN_DISPLAY_NR . $pageNav->getLimitBox($link) . ' ' . $pageNav->getPagesCounter();
        echo '<br />';
        echo $pageNav->writePagesLinks($link);
        ?>
					</div>
					</td>
				</tr>
			</table>
			<input type="hidden" name="option" value="<?php 
        echo $option;
        ?>
" />
			<input type="hidden" name="Itemid" value="<?php 
        echo $Itemid;
        ?>
" />
			<input type="hidden" name="task" value="course_users" />
			<input type="hidden" name="group_id" value="<?php 
        echo $group_id;
        ?>
" />
			<input type="hidden" name="id" value="<?php 
        echo $course_id;
        ?>
" />
			<input type="hidden" name="boxchecked" value="0" />
			<input type="hidden" name="row_id" value="0" />
			<input type="hidden" name="state" value="0" />
			<input type="hidden" name="utype" value="<?php 
        echo $view_type;
        ?>
" />
		</form>
<?php 
        JLMS_TMPL::CloseTS();
        $link_add = $JLMS_CONFIG->get('live_site') . "/index.php?option=" . $option . "&amp;task=add_user&amp;course_id=" . $course_id . "&amp;id=0&amp;Itemid=" . $Itemid . "";
        $link_import = $JLMS_CONFIG->get('live_site') . "/index.php?option=" . $option . "&amp;task=import_users_csv&amp;course_id=" . $course_id . "&amp;id=0&amp;Itemid=" . $Itemid . "";
        if ($view_type == 2) {
            $link_add .= '&amp;utype=2';
        }
        $controls = array();
        if ($JLMS_ACL->CheckPermissions('users', 'manage_teachers')) {
            $controls[] = array('href' => "javascript:submitbutton('view_assistants');", 'title' => _JLMS_USER_ASSIST_GROUP_NAME, 'img' => 'editusergroup');
            $controls[] = array('href' => 'spacer');
        }
        if ($JLMS_ACL->CheckPermissions('users', 'manage')) {
            $controls[] = array('href' => $link_add, 'title' => _JLMS_USER_ALT_ADDUSER, 'img' => 'adduser');
            $controls[] = array('href' => "javascript:submitbutton('delete_user');", 'title' => _JLMS_USER_ALT_DELUSER, 'img' => 'deluser');
            if ($view_type == 1) {
                $controls[] = array('href' => "javascript:submitbutton('edit_user');", 'title' => _JLMS_USER_ALT_EDITUSER, 'img' => 'edituser');
            }
            if ($JLMS_ACL->CheckPermissions('users', 'import_users')) {
                $controls[] = array('href' => 'spacer');
                $controls[] = array('href' => $link_import, 'title' => _JLMS_USER_IMPORT_TITLE, 'img' => 'csv_import');
            }
        }
        JLMS_TMPL::ShowControlsFooter($controls, '');
        JLMS_TMPL::CloseMT();
    }
    function showCourseLinks($id, $option, &$rows)
    {
        $user = JLMSFactory::getUser();
        $db =& JFactory::getDbo();
        $JLMS_ACL =& JLMSFactory::getACL();
        $JLMS_CONFIG = JLMSFactory::getConfig();
        $Itemid = $JLMS_CONFIG->get('Itemid');
        ?>
<script language="javascript" type="text/javascript">
<!--//--><![CDATA[//><!--
function submitbutton(pressbutton) {
	var form = document.adminForm;
	if ( ((pressbutton == 'link_delete') || (pressbutton == 'pre_link_edit')) && (form.boxchecked.value == "0")){
		alert("<?php 
        echo _JLMS_ALERT_SELECT_ITEM;
        ?>
");
	} else {
		form.task.value = pressbutton;
		form.submit();
	}
}
function submitbutton_order(pressbutton, item_id) {
	var form = document.adminForm;
	if ((pressbutton == 'link_orderup') || (pressbutton == 'link_orderdown')){
		if (item_id) {
		form.task.value = pressbutton;
		form.row_id.value = item_id;
		form.submit();
		}
	}
}
function submitbutton_change(pressbutton, state) {
	var form = document.adminForm;
	if (pressbutton == 'change_link'){
		if (form.boxchecked.value == "0") {
			alert("<?php 
        echo _JLMS_ALERT_SELECT_ITEM;
        ?>
");
		} else {
			form.task.value = pressbutton;
			form.state.value = state;
			form.submit();
		}
	}
}
function submitbutton_change2(pressbutton, state, cid_id) {
	var form = document.adminForm;
	if (pressbutton == 'change_link'){
		form.task.value = pressbutton;
		form.state.value = state;
		form.cid2.value = cid_id;
		form.submit();
	}
}
//--><!]]>
</script>
<?php 
        JLMS_TMPL::OpenMT();
        $hparams = array();
        JLMS_TMPL::ShowHeader('link', _JLMS_LINKS_COURSE_LINKS, $hparams);
        JLMS_TMPL::OpenTS();
        ?>
		<form action="<?php 
        echo $JLMS_CONFIG->get('live_site') . "/index.php?option={$option}&amp;Itemid={$Itemid}";
        ?>
" method="post" name="adminForm">
<?php 
        if (!empty($rows)) {
            ?>
			<table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php 
            echo JLMSCSS::_('jlmslist');
            ?>
">
				<tr>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 width="20" class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" align="center">#</<?php 
            echo $JLMS_CONFIG->get('tableheader_tag', 'td');
            ?>
>
				<?php 
            if ($JLMS_ACL->CheckPermissions('links', 'manage') || $JLMS_ACL->CheckPermissions('links', 'publish')) {
                ?>
					<<?php 
                echo JLMSCSS::tableheadertag();
                ?>
 width="20" class="<?php 
                echo JLMSCSS::_('sectiontableheader');
                ?>
" align="center"><input type="checkbox" name="toggle" value="" onclick="checkAll(<?php 
                echo count($rows);
                ?>
);" /></<?php 
                echo $JLMS_CONFIG->get('tableheader_tag', 'td');
                ?>
>
				<?php 
            }
            ?>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" width="40%"><?php 
            echo _JLMS_LINKS_TBL_HEAD_LINK;
            ?>
</<?php 
            echo $JLMS_CONFIG->get('tableheader_tag', 'td');
            ?>
>
				<?php 
            if ($JLMS_ACL->CheckPermissions('links', 'publish')) {
                ?>
					<<?php 
                echo JLMSCSS::tableheadertag();
                ?>
 class="<?php 
                echo JLMSCSS::_('sectiontableheader');
                ?>
" width="1">&nbsp;</<?php 
                echo $JLMS_CONFIG->get('tableheader_tag', 'td');
                ?>
>
				<?php 
            }
            if ($JLMS_ACL->CheckPermissions('links', 'order')) {
                ?>
					<<?php 
                echo JLMSCSS::tableheadertag();
                ?>
 class="<?php 
                echo JLMSCSS::_('sectiontableheader');
                ?>
" colspan="2" width="1">&nbsp;</<?php 
                echo $JLMS_CONFIG->get('tableheader_tag', 'td');
                ?>
>
				<?php 
            }
            ?>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" width="60%"><?php 
            echo _JLMS_LINKS_TBL_HEAD_DESCR;
            ?>
</<?php 
            echo $JLMS_CONFIG->get('tableheader_tag', 'td');
            ?>
>
				</tr>
			<?php 
            $there_were_squeezeboxes = false;
            $k = 1;
            for ($i = 0, $n = count($rows); $i < $n; $i++) {
                $is_squeezebox = false;
                $row = $rows[$i];
                $link = $row->link_href;
                if ($row->link_type == 2) {
                    $link = sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=view_inline_link&course_id={$id}&id={$row->id}");
                }
                if ($row->link_type == 3) {
                    $is_squeezebox = true;
                    $there_were_squeezeboxes = true;
                }
                $alt = $row->published ? _JLMS_STATUS_PUB : _JLMS_STATUS_UNPUB;
                $image = $row->published ? 'btn_accept.png' : 'btn_cancel.png';
                $state = $row->published ? 0 : 1;
                if ($row->is_time_related) {
                    $tooltip_txt = _JLMS_WILL_BE_RELEASED_IN;
                    $showperiod = $row->show_period;
                    $ost1 = $showperiod % (24 * 60);
                    $sp_days = ($showperiod - $ost1) / (24 * 60);
                    $ost2 = $showperiod % 60;
                    $sp_hours = ($ost1 - $ost2) / 60;
                    $sp_mins = $ost2;
                    $release_time_info = false;
                    if ($sp_days) {
                        $tooltip_txt .= ' ' . $sp_days . ' ' . _JLMS_RELEASED_IN_DAYS;
                        $release_time_info = true;
                    }
                    if ($sp_hours) {
                        $tooltip_txt .= ' ' . $sp_hours . ' ' . _JLMS_RELEASED_IN_HOURS;
                        $release_time_info = true;
                    }
                    if ($sp_mins) {
                        $tooltip_txt .= ' ' . $sp_mins . ' ' . _JLMS_RELEASED_IN_MINUTES;
                        $release_time_info = true;
                    }
                    if ($release_time_info) {
                        $tooltip_txt .= ' ' . _JLMS_RELEASED_AFTER_ENROLLMENT;
                    }
                }
                $checked = mosHTML::idBox($i, $row->id);
                ?>
				<tr class="<?php 
                echo JLMSCSS::_('sectiontableentry' . $k);
                ?>
">
					<td align="center"><?php 
                echo $i + 1;
                ?>
</td>
				<?php 
                if ($JLMS_ACL->CheckPermissions('links', 'manage') || $JLMS_ACL->CheckPermissions('links', 'publish')) {
                    $show_check = true;
                    if ($JLMS_ACL->CheckPermissions('links', 'only_own_items') && $row->owner_id != $user->get('id')) {
                        $show_check = false;
                    } elseif ($JLMS_ACL->CheckPermissions('links', 'only_own_role') && $JLMS_ACL->GetRole() != $JLMS_ACL->UserSystemRole($db, $row->owner_id)) {
                        $show_check = false;
                    }
                    ?>
					<td>
					<?php 
                    echo $show_check ? $checked : '&nbsp;';
                    ?>
					</td>
				<?php 
                }
                ?>
					<td align="left">
						<?php 
                if ($is_squeezebox) {
                    $tmp_params = new JLMSParameters($row->params);
                    $x_size = 0;
                    $y_size = 0;
                    if (is_object($tmp_params) && $tmp_params->get('display_width')) {
                        $x_size = intval($tmp_params->get('display_width'));
                    } elseif (isset($tmp_params->display_width)) {
                        $x_size = intval($tmp_params->display_width);
                    }
                    if (is_object($tmp_params) && $tmp_params->get('display_height')) {
                        $y_size = intval($tmp_params->get('display_height'));
                    } elseif (isset($tmp_params->display_height)) {
                        $y_size = intval($tmp_params->display_height);
                    }
                    ?>
							<a class="jlms_modal" rel="{handler:'iframe', size:{x:<?php 
                    echo $x_size;
                    ?>
,y:<?php 
                    echo $y_size;
                    ?>
}}" href="<?php 
                    echo $link;
                    ?>
" title="<?php 
                    echo str_replace('"', '&quot;', $row->link_name);
                    ?>
">
								<?php 
                    echo $row->link_name;
                    ?>
							</a>
						<?php 
                } else {
                    ?>
							<?php 
                    if ($link) {
                        ?>
							<a <?php 
                        echo !$row->link_type ? 'target="_blank" ' : ' ';
                        ?>
href="<?php 
                        echo $link;
                        ?>
" title="<?php 
                        echo str_replace('"', '&quot;', $row->link_name);
                        ?>
">
								<?php 
                        echo $row->link_name;
                        ?>
							</a>
							<?php 
                    } else {
                        echo $row->link_name;
                    }
                    ?>
						<?php 
                }
                ?>
						<?php 
                if ($JLMS_CONFIG->get('show_links_authors', 0)) {
                    ?>
						<br />
						<span class="small"><?php 
                    echo _JLMS_HOME_AUTHOR . "&nbsp;" . $row->author_name;
                    ?>
</span>
						<?php 
                }
                ?>
					</td>
				<?php 
                if ($JLMS_ACL->CheckPermissions('links', 'publish')) {
                    ?>
					<td valign="middle">
					<?php 
                    if ($JLMS_ACL->CheckPermissions('links', 'only_own_items') && $row->owner_id != $user->get('id')) {
                        ?>
						<img class="JLMS_png" src="<?php 
                        echo $JLMS_CONFIG->get('live_site');
                        ?>
/components/com_joomla_lms/lms_images/toolbar/<?php 
                        echo $image;
                        ?>
" width="16" height="16" border="0" alt="<?php 
                        echo $alt;
                        ?>
" />
					<?php 
                    } elseif ($JLMS_ACL->CheckPermissions('links', 'only_own_role') && $JLMS_ACL->GetRole() != $JLMS_ACL->UserSystemRole($db, $row->owner_id)) {
                        ?>
						<img class="JLMS_png" src="<?php 
                        echo $JLMS_CONFIG->get('live_site');
                        ?>
/components/com_joomla_lms/lms_images/toolbar/<?php 
                        echo $image;
                        ?>
" width="16" height="16" border="0" alt="<?php 
                        echo $alt;
                        ?>
" />
					<?php 
                    } else {
                        if ($row->is_time_related) {
                            if ($row->published) {
                                $image = 'btn_publish_wait.png';
                            }
                            $tooltip_link = 'javascript:submitbutton_change2(\'change_link\',' . $state . ',' . $row->id . ')';
                            $tooltip_name = '<img class="JLMS_png" src="' . $JLMS_CONFIG->get('live_site') . '/components/com_joomla_lms/lms_images/toolbar/' . $image . '" width="16" height="16" border="0" alt="' . $alt . '" />';
                            echo JLMS_toolTip($alt, $tooltip_txt, $tooltip_name, $tooltip_link);
                        } else {
                            echo '<a href="javascript:submitbutton_change2(\'change_link\',' . $state . ',' . $row->id . ')" title="' . $alt . '">';
                            echo '<img class="JLMS_png" src="' . $JLMS_CONFIG->get('live_site') . '/components/com_joomla_lms/lms_images/toolbar/' . $image . '" width="16" height="16" border="0" alt="' . $alt . '" />';
                            echo '</a>';
                        }
                    }
                    ?>
					</td>
				<?php 
                }
                if ($JLMS_ACL->CheckPermissions('links', 'order')) {
                    ?>
					<td><?php 
                    echo JLMS_orderUpIcon($i, $row->id, true, 'link_orderup');
                    ?>
</td>
					<td><?php 
                    echo JLMS_orderDownIcon($i, $n, $row->id, true, 'link_orderdown');
                    ?>
</td>
				<?php 
                }
                ?>
					<td><?php 
                echo $row->link_description ? $row->link_description : '&nbsp;';
                ?>
</td>
				</tr>
				<?php 
                $k = 3 - $k;
            }
            ?>
			</table>
<?php 
            if ($there_were_squeezeboxes) {
                JLMS_initialize_SqueezeBox(false);
            }
        } else {
            echo '<div class="joomlalms_user_message">' . _JLMS_NO_ITEMS_HERE . '</div>';
        }
        ?>
			<input type="hidden" name="option" value="<?php 
        echo $option;
        ?>
" />
			<input type="hidden" name="Itemid" value="<?php 
        echo $Itemid;
        ?>
" />
			<input type="hidden" name="task" value="setup_category" />
			<input type="hidden" name="boxchecked" value="0" />
			<input type="hidden" name="id" value="<?php 
        echo $id;
        ?>
" />
			<input type="hidden" name="row_id" value="0" />
			<input type="hidden" name="state" value="0" />
			<input type="hidden" name="cid2" value="0" />
		</form>
<?php 
        JLMS_TMPL::CloseTS();
        if ($id && ($JLMS_ACL->CheckPermissions('links', 'manage') || $JLMS_ACL->CheckPermissions('links', 'publish'))) {
            $link_new = JLMSRoute::_("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=pre_create_link&amp;id={$id}");
            $controls = array();
            if ($JLMS_ACL->CheckPermissions('links', 'publish')) {
                $controls[] = array('href' => "javascript:submitbutton_change('change_link',1);", 'title' => _JLMS_SET_PUB, 'img' => 'publish');
                $controls[] = array('href' => "javascript:submitbutton_change('change_link',0);", 'title' => _JLMS_SET_UNPUB, 'img' => 'unpublish');
                if ($JLMS_ACL->CheckPermissions('links', 'manage')) {
                    $controls[] = array('href' => 'spacer');
                }
            }
            if ($JLMS_ACL->CheckPermissions('links', 'manage')) {
                $controls[] = array('href' => $link_new, 'onclick' => "", 'title' => _JLMS_LINKS_IMG_NEW_LINK, 'img' => 'add');
                $controls[] = array('href' => "javascript:submitbutton('link_delete');", 'title' => _JLMS_LINKS_IMG_DEL_LINK, 'img' => 'delete');
                $controls[] = array('href' => "javascript:submitbutton('pre_link_edit');", 'title' => _JLMS_LINKS_IMG_EDIT_LINK, 'img' => 'edit');
            }
            JLMS_TMPL::ShowControlsFooter($controls);
        }
        JLMS_TMPL::CloseMT();
    }
Пример #6
0
    function ShowCart($option, &$subscriptions, &$lists, $procs = array())
    {
        global $Itemid, $JLMS_CONFIG, $JLMS_SESSION, $JLMS_DB, $my;
        $jlms_tax_counting = $JLMS_CONFIG->get('enabletax');
        $sub_total = 0;
        $tax_amount = 0;
        $rows2 = array();
        $custom_code = '';
        $discounts = array();
        $app =& JFactory::getApplication();
        $coupon_code = $app->getUserStateFromRequest('com_joomla_lms_dis_coupon_code', 'dis_coupon_code', '');
        $discounts['t_coupon_disc'] = JLMS_DISCOUNTS::getTotalCouponDiscount($coupon_code, $subscriptions);
        $discounts['t_disc'] = JLMS_DISCOUNTS::getTotalDiscounts($subscriptions);
        // counting taxes
        if ($jlms_tax_counting) {
            $is_cb_installed = $JLMS_CONFIG->get('is_cb_installed', 0);
            $get_country_info = $JLMS_CONFIG->get('get_country_info', 0);
            $cb_country_filed_id = intval($JLMS_CONFIG->get('jlms_cb_country'));
            $isset_country = false;
            if ($is_cb_installed && $get_country_info && $cb_country_filed_id) {
                //by Max (get country info)
                $query = "SELECT cf.name" . "\n FROM #__comprofiler_fields as cf" . "\n WHERE 1" . "\n AND cf.fieldid = '" . $cb_country_filed_id . "'";
                $JLMS_DB->setQuery($query);
                $cb_country_field_name = $JLMS_DB->loadResult();
                $query = "SELECT " . $cb_country_field_name . "" . "\n FROM #__comprofiler" . "\n WHERE 1" . "\n AND user_id = '" . $my->id . "'";
                $JLMS_DB->setQuery($query);
                $country_name = $JLMS_DB->loadResult();
                require_once 'components' . DS . $option . DS . 'includes' . DS . 'libraries' . DS . 'lms.lib.countries.php';
                $CodeCountry = new CodeCountries();
                $code = $CodeCountry->code($country_name);
                if ($code) {
                    $user_country = $code;
                }
                $user_country_name = '';
                $us_state = '';
            } else {
                $ip_address = $_SERVER['REMOTE_ADDR'];
                //$ip_address = '213.184.248.211';
                //				$ip_address = '12.225.42.19';
                //				$ip_address = '111.215.41.12';
                if (@ini_get('allow_url_fopen')) {
                    $fn = @file('http://api.hostip.info/get_html.php?ip=' . $ip_address);
                    // country ip identified
                    if ($fn != false) {
                        $ip_info = implode('', $fn);
                        preg_match_all("(\\(..\\))", $ip_info, $dop);
                        $user_country = str_replace('(', '', str_replace(")", '', $dop[0][0]));
                        preg_match_all("(\\:.*\\()", $ip_info, $dop2);
                        $user_country_name = str_replace(': ', '', str_replace(" (", '', $dop2[0][0]));
                        preg_match_all("(\\, ..)", $ip_info, $dop3);
                        $us_state = @str_replace(', ', '', $dop3[0][0]);
                    }
                }
            }
            if (isset($user_country)) {
                $query = "SELECT * FROM #__lms_subscriptions_countries WHERE published = 1 AND code='" . $user_country . "' ";
                $JLMS_DB->setQuery($query);
                $rows2 = $JLMS_DB->loadObjectList();
                // if no country found
                if (!count($rows2)) {
                    // check if in EU
                    $query = "SELECT * FROM #__lms_subscriptions_countries WHERE published = 1 AND code='EU' AND list REGEXP '" . $user_country . "' ";
                    $JLMS_DB->setQuery($query);
                    $rows_eu = $JLMS_DB->loadObjectList();
                    if (count($rows_eu)) {
                        $isset_country = true;
                        $rows2[0]->tax_type = $rows_eu[0]->tax_type;
                        $rows2[0]->tax = $rows_eu[0]->tax;
                        $user_country_name = $rows_eu[0]->name . ' (' . $user_country_name . ')';
                    }
                } else {
                    $isset_country = true;
                }
                // additional check for US
                if ($user_country == 'US') {
                    $query = "SELECT * FROM #__lms_subscriptions_countries WHERE published = 1 AND code = 'US-" . $us_state . "' ";
                    $JLMS_DB->setQuery($query);
                    $rows_states = $JLMS_DB->loadObjectList();
                    if (count($rows_states)) {
                        $isset_country = true;
                        $rows2 = array();
                        $rows2[0]->tax_type = $rows_states[0]->tax_type;
                        $rows2[0]->tax = $rows_states[0]->tax;
                        $user_country_name = 'United states (' . $rows_states[0]->name . ' )';
                    }
                }
            }
            //10.01.09 (Max) default tax option
            if (!$isset_country) {
                $rows2[0]->tax_type = $JLMS_CONFIG->get('default_tax_type', 1);
                $rows2[0]->tax = $JLMS_CONFIG->get('default_tax', 0);
            }
        }
        ?>
		<script language="javascript" type="text/javascript">
		<!--
		function jq_Check_selectCheckbox(check_name, form_name) {
			selItem = eval("document."+form_name+"['"+check_name+"']");
			if (selItem) {
				if (selItem.length) { var i;
					for (i = 0; i<selItem.length; i++) {
						if (selItem[i].checked) {
							if (selItem[i].value) { return true; }
						}}
				} else if (selItem.checked) { return true; }}
			return false;
		}
		function jlms_submitbutton(pressbutton) {
			var form = document.JLMS_adminForm;
			if( pressbutton == 'remove_from_cart' ){
				var ttt = jq_Check_selectCheckbox('jlms_sub[]', 'JLMS_adminForm');
				if (ttt) {
					form.task.value = pressbutton;
					form.submit();
				} else {
					alert("<?php 
        echo _JLMS_ALERT_SELECT_ITEM;
        ?>
");
				}
			}
			if( pressbutton == 'update_cart' ){
					form.task.value = pressbutton;
					form.submit();
			}
			if (pressbutton == 'cart_login') {
				form.task.value = pressbutton;
				form.submit();
			}
			
			if (pressbutton == 'apply_coupon_code') {
				form.task.value = pressbutton;
				form.submit();
			}
		}
		//-->
		</script>	

		<form action="<?php 
        echo sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}");
        ?>
" method="post" name="JLMS_adminForm">
		<input type="hidden" value="<?php 
        echo $option;
        ?>
" name="option">
		<input type="hidden" value="<?php 
        echo $Itemid;
        ?>
" name="Itemid">
		<input type="hidden" value="" name="task">
		<input type="hidden" value="" name="id">
		<?php 
        JLMS_TMPL::OpenMT();
        $params = array('show_menu' => true, 'simple_menu' => true);
        JLMS_TMPL::ShowHeader('cart', _JLMS_MY_CART, $params);
        JLMS_TMPL::ShowPageTip('show_cart');
        JLMS_TMPL::CloseMT();
        $count_subs = count($subscriptions);
        ?>
		<br />
		<?php 
        if ($count_subs > 0) {
            ?>
		
		<input type="text" name="dis_coupon_code" value="<?php 
            echo $coupon_code;
            ?>
" />&nbsp;
		<input type="button" value="Check coupon" onclick="jlms_submitbutton('apply_coupon_code');" />
		<?php 
        }
        ?>
	
		<table cellpadding="0" cellspacing="0" border="0" width="100%" class="jlms_cart_list_outer" style="width:100%">
		<?php 
        if ($count_subs > 0) {
            ?>
			<tr>
				<td>
				<?php 
            $need_upd_txt = false;
            for ($i = 0, $n = count($subscriptions); $i < $n; $i++) {
                if (isset($subscriptions[$i]->allow_multiple) && $subscriptions[$i]->allow_multiple) {
                    $need_upd_txt = true;
                    break;
                }
            }
            $jlms_cs = $JLMS_CONFIG->get('jlms_cur_sign');
            $total_subs = 0;
            $total_disc = 0;
            $total_tax = 0;
            $discounts['total_p_disc'] = 0;
            $reccSubId = false;
            for ($i = 0, $n = count($subscriptions); $i < $n; $i++) {
                JLMS_CART_html::initSubscriptionPaymentParams($subscriptions[$i], $rows2);
                if ($subscriptions[$i]->account_type == '6') {
                    $reccSubId = $i;
                }
                if (isset($subscriptions[$i]->count_items) && $subscriptions[$i]->count_items && isset($subscriptions[$i]->allow_multiple) && $subscriptions[$i]->allow_multiple) {
                    $total_subs += $subscriptions[$i]->sub_total * $subscriptions[$i]->count_items;
                    $total_tax += $subscriptions[$i]->tax_amount * $subscriptions[$i]->count_items;
                    $total_disc += $subscriptions[$i]->disc * $subscriptions[$i]->count_items;
                } else {
                    $total_subs += $subscriptions[$i]->sub_total;
                    $total_tax += $subscriptions[$i]->tax_amount;
                    $total_disc += $subscriptions[$i]->disc;
                }
                if ($subscriptions[$i]->p_coupon_disc || $subscriptions[$i]->p_disc) {
                    $params['showDiscount'] = true;
                }
            }
            if (isset($rows2[0]->tax_type) && $rows2[0]->tax_type == 2) {
                $total_tax += $rows2[0]->tax;
                // if tx is not in percentage....
            }
            $discounts['total_p_disc'] = $total_disc;
            $total_disc = $total_disc + ($discounts['t_coupon_disc'] + $discounts['t_disc']);
            $total_price = $total_subs - $total_disc;
            if ($total_price < 0) {
                $total_price = $total_tax;
            } else {
                $total_price += $total_tax;
            }
            $price_diff = $total_subs - $total_disc;
            if ($price_diff < 0) {
                $balance = abs($price_diff);
            } else {
                $balance = 0;
            }
            $recurr_total_desc = '';
            if ($reccSubId !== false) {
                $price = JLMS_RECURRENT_PAY::getPriceDesc($subscriptions[$reccSubId], 'basket_list', $balance, $total_price);
                $recurr_total_desc = JLMS_RECURRENT_PAY::getPriceDesc($subscriptions[$reccSubId], 'total', $balance, $total_price);
                if ($total_price == 0) {
                    $total_price = JLMS_RECURRENT_PAY::getAmountFromReccurentPrice($subscriptions[$reccSubId]);
                }
            }
            ?>

					<div style="float:right; padding-top:5px; padding-right:25px">
						<b><?php 
            echo _JLMS_SUBSCR_SUB_TOTAL . ' ' . $jlms_cs . sprintf('%.2f', round($total_price, 2));
            ?>
</b>
					</div>
				</td>
			</tr>
			<tr>
				<td>
				<?php 
            if ($need_upd_txt) {
                ?>
				<table width="100%" cellpadding="0" cellspacing="0" border="0" class="jlms_table_no_borders">
					<tr>
					<td><div style="float:right; text-align:center"><?php 
                echo _JLMS_CART_HAVE_CHANGED_QUANTITY;
                ?>
<a href="javascript:jlms_submitbutton('update_cart');"><?php 
                echo _JLMS_CART_UPDATE;
                ?>
</a></div></td>
					</tr>
				</table>
				<?php 
            }
            ?>

<?php 
            $do_show_index = false;
            for ($i = 0, $n = count($subscriptions); $i < $n; $i++) {
                $subscription = $subscriptions[$i];
                $s = 1;
                foreach ($subscription->course_names as $course_name) {
                    $course_usertype = 0;
                    if (in_array($subscription->courses[$s - 1], $JLMS_CONFIG->get('teacher_in_courses', array(0)))) {
                        $course_usertype = 1;
                    } elseif (in_array($subscription->courses[$s - 1], $JLMS_CONFIG->get('student_in_courses', array(0)))) {
                        $course_usertype = 2;
                    }
                    if ($course_usertype) {
                        $do_show_index = true;
                        break;
                    }
                    $s++;
                }
                if ($do_show_index) {
                    break;
                }
            }
            ?>
					<table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php 
            echo JLMSCSS::_('jlmslist', 'jlms_cart_list');
            ?>
">
					<tr>
						<?php 
            if ($do_show_index) {
                ?>
<<?php 
                echo JLMSCSS::tableheadertag();
                ?>
 class="<?php 
                echo JLMSCSS::_('sectiontableheader');
                ?>
" align="center" width="16">#</<?php 
                echo JLMSCSS::tableheadertag();
                ?>
><?php 
            }
            ?>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" align="left" width="20">&nbsp;</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" align="left"><?php 
            echo _JLMS_SUBSCRIBE_SUB_COURSES;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" align="left"><?php 
            echo _JLMS_DETAILS;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" align="center" width="170"><?php 
            echo _JLMS_COURSES_PRICE;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>						
						<?php 
            if (isset($params['showDiscount']) && $params['showDiscount']) {
                ?>
						<<?php 
                echo JLMSCSS::tableheadertag();
                ?>
 class="<?php 
                echo JLMSCSS::_('sectiontableheader');
                ?>
" align="center" width="40" nowrap="nowrap"><?php 
                echo _JLMS_CART_DISCOUNT;
                ?>
</<?php 
                echo JLMSCSS::tableheadertag();
                ?>
>
						<?php 
            }
            if (isset($rows2[0]) && $rows2[0]->tax_type == 1 && $rows2[0]->tax) {
                ?>
						<<?php 
                echo JLMSCSS::tableheadertag();
                ?>
 class="<?php 
                echo JLMSCSS::_('sectiontableheader');
                ?>
" align="center" width="40" nowrap="nowrap"><?php 
                echo _JLMS_CART_TAX;
                ?>
</<?php 
                echo JLMSCSS::tableheadertag();
                ?>
>
						<?php 
            }
            ?>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" align="center" width="40" nowrap="nowrap"><?php 
            echo _JLMS_CART_QUANTITY;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					</tr>
				<?php 
            for ($i = 0, $n = count($subscriptions); $i < $n; $i++) {
                $subscription = $subscriptions[$i];
                $tax_amount = 0;
                $disc = 0;
                if ($subscription->account_type != '6') {
                    $price = $jlms_cs . sprintf('%.2f', round($subscriptions[$i]->sub_total, 2));
                }
                $price_sub = $price;
                $custom_code .= JLMS_CART_html::ShowSub($subscription, $i + 1, '', $price_sub, $do_show_index, false, $params);
            }
            ?>
				</table>
				</td>
			</tr>
			<tr>
				<td>
					<div style="float:right; padding-top:5px; padding-right:25px; text-align:right;">
						<?php 
            if ($total_tax || $total_disc) {
                echo '<b>' . $jlms_cs . sprintf('%.2f', round($total_subs, 2)) . '</b><br />';
                if ($total_disc) {
                    echo '<b>' . _JLMS_SUBSCR_DISCOUNT_AMOUNT . ' ' . $jlms_cs . sprintf('%.2f', round($total_disc, 2)) . '</b><br />';
                }
                if ($total_tax) {
                    echo '<b>' . _JLMS_SUBSCR_TAX_AMOUNT . ' ' . $jlms_cs . sprintf('%.2f', round($total_tax, 2)) . '</b><br />';
                }
            }
            echo '<b>' . _JLMS_SUBSCR_SUB_TOTAL . ' ' . $jlms_cs . sprintf('%.2f', round($total_price, 2)) . '</b><br />';
            echo '<b>' . $recurr_total_desc . '</b>';
            ?>
					</div>
				</td>
			</tr>
<?php 
            $controls = array();
            if ($JLMS_CONFIG->get('under_ssl') && $JLMS_CONFIG->get('real_live_site')) {
                $temp_href = $JLMS_CONFIG->get('real_live_site') . "/index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=subscription";
            } else {
                $temp_href = $JLMS_CONFIG->get('live_site') . "/index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=subscription";
            }
            $controls[] = array('href' => $temp_href, 'title' => _JLMS_CART_BACK_TO_SHOP, 'img' => 'back');
            $controls[] = array('href' => "javascript:jlms_submitbutton('remove_from_cart');", 'title' => _JLMS_CART_REMOVE, 'img' => 'cartremove');
            JLMS_TMPL::ShowControlsFooter($controls, '', false);
            ?>
		</table>
<?php 
            if ($my->id && !empty($procs)) {
                JLMS_TMPL::OpenMT('jlms_table_no_borders');
                JLMS_TMPL::OpenTS();
                $sub_proc = $JLMS_SESSION->get('sub_proc');
                if (isset($_COOKIE['proc_id'])) {
                    $sub_proc = $_COOKIE['proc_id'];
                }
                $temp2 = "";
                foreach ($procs as $proc) {
                    $checked = '';
                    if (count($procs) == 1) {
                        $temp2 = "checkProcessor('" . $proc->id . "','" . $proc->filename . "');";
                        $checked = 'checked="checked"';
                    }
                    if ($sub_proc) {
                        if ($sub_proc == $proc->id) {
                            $temp2 = "checkProcessor('" . $proc->id . "','" . $proc->filename . "');";
                            $checked = 'checked="checked"';
                        }
                    } else {
                        if ($proc->default_p) {
                            $temp2 = "checkProcessor('" . $proc->id . "','" . $proc->filename . "');";
                            $checked = 'checked="checked"';
                        }
                    }
                    echo '<input type="radio" name="proc_id" value="' . $proc->id . '" onclick="checkProcessor(\'' . $proc->id . '\',\'' . $proc->filename . '\');" id="proc_' . $proc->id . '" ' . $checked . ' />&nbsp;<label class="msspro_sel_proc2" for="proc_' . $proc->id . '">' . $proc->name . '</label><br />';
                }
                if ($temp2) {
                    echo '<script type="text/javascript" language="javascript"><!--' . "\r\n";
                    echo $temp2;
                    echo "\r\n--></script>";
                }
                JLMS_TMPL::CloseTS();
                JLMS_TMPL::CloseMT();
            }
            ?>
	
	<?php 
            echo "</form>";
            if (!$my->id) {
                JLMS_UserSessions_html::loginPanel();
            }
        } else {
            echo "<tr><td><div class='joomlalms_sys_message'>";
            echo _JLMS_CART_IS_EMPTY;
            echo '<br />';
            if ($JLMS_CONFIG->get('under_ssl') && $JLMS_CONFIG->get('real_live_site')) {
                $temp_href = $JLMS_CONFIG->get('real_live_site') . "/index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=subscription";
            } else {
                $temp_href = $JLMS_CONFIG->get('live_site') . "/index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=subscription";
            }
            echo '<a href="' . $temp_href . '" title="' . _JLMS_CART_BACK_TO_SHOP . '">[' . _JLMS_CART_BACK_TO_SHOP . ']</a>';
            echo "</div></td></tr></table>";
            echo "</form>";
        }
        return $custom_code;
    }
Пример #7
0
    function showCoursesForGuest($option, &$lists, &$rows, &$pageNav, $enrollment)
    {
        global $Itemid, $JLMS_CONFIG;
        //		$show_fee_col = $JLMS_CONFIG->get('show_fee_column');
        $lms_img_path = $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('lms_path_to_images', 'components/com_joomla_lms/lms_images');
        $show_paid_courses = $JLMS_CONFIG->get('show_paid_courses', 1);
        $show_course_author = $JLMS_CONFIG->get('show_course_authors', 1);
        $price_fee_type = $JLMS_CONFIG->get('price_fee_type', 1);
        $show_short_description = $JLMS_CONFIG->get('show_short_description', 0);
        $show_course_publish_dates = $JLMS_CONFIG->get('show_course_publish_dates', 0);
        $jlms_cs = $JLMS_CONFIG->get('jlms_cur_sign');
        $colspan_sh_description = 4;
        if ($show_course_publish_dates) {
            $colspan_sh_description = 6;
        }
        if (!$price_fee_type) {
            $colspan_sh_description = $colspan_sh_description - 1;
        }
        //FLMS multicat
        $multicat = array();
        if ($JLMS_CONFIG->get('multicat_use', 0)) {
            $multicat = array();
            $i = 0;
            foreach ($lists as $key => $item) {
                if (substr($key, 0, 7) == 'filter_') {
                    $multicat[] = $lists['filter_' . $i];
                    $i++;
                }
            }
        }
        ?>
		
	<?php 
        if ($enrollment) {
            ?>
		<script language="javascript" type="text/javascript">
		<!--//--><![CDATA[//><!--
		function submitbutton(pressbutton, course_id) {
			var form = document.adminForm;
			if ( (pressbutton == 'delete_course') || (pressbutton == 'edit_course') || (pressbutton == 'export_course_pre') ) {
				form.id.value = course_id;
				form.task.value = pressbutton;
				form.submit();
			}
			else if( (pressbutton == 'enroll') && (form.boxchecked.value == '0') ){
				alert( "<?php 
            echo _JLMS_ALERT_SELECT_ITEM;
            ?>
" );
			}
			else {
				if (pressbutton == 'enroll'){
					form.task.value = 'subscription';
					form.submit();
				}
			}
		}
		function isChecked(isitchecked){
			if (isitchecked == true){
				document.adminForm.boxchecked.value++;
			}
			else {
				document.adminForm.boxchecked.value--;
			}
		}
		var old_filters = new Array();
		function read_filter(){
			var form = document.adminForm;
			var count_levels = '<?php 
            echo count($lists['levels']);
            ?>
';
			for(var i=0;i<parseInt(count_levels);i++){
				if(form['filter_id_'+i] != null){
					old_filters[i] = form['filter_id_'+i].value;
				}
			}
		}
		function write_filter(){
			var form = document.adminForm;
			var count_levels = '<?php 
            echo count($lists['levels']);
            ?>
';
			var j;
			for(var i=0;i<parseInt(count_levels);i++){
				if(form['filter_id_'+i+''] != null && form['filter_id_'+i+''].value != old_filters[i]){
					j = i;
				}
				if(i > j){
					if(form['filter_id_'+i] != null){
						form['filter_id_'+i].value = 0;	
					}
				}
			}
		}
		//--><!]]>
		</script>
	<?php 
        }
        JLMS_TMPL::OpenMT();
        $params = array('show_menu' => true, 'simple_menu' => true);
        JLMS_TMPL::OpenTS('', ' align="right" style="text-align:right " width="100%"');
        JLMS_showTopMenu_simple($option);
        JLMS_TMPL::CloseTS();
        JLMS_TMPL::OpenTS('', ' align="left"');
        echo JLMS_ShowText_WithFeatures($lists['homepage_text']);
        JLMS_TMPL::CloseTS();
        JLMS_TMPL::OpenTS();
        if ($enrollment) {
            ?>
			<form action="<?php 
            echo JURI::base() . "index.php?option={$option}&amp;Itemid={$Itemid}";
            ?>
" method="post" name="adminForm">
		<?php 
        }
        ?>
			<table width="100%" cellpadding="0" cellspacing="0" border="0" id="jlms_courses_guest">
<?php 
        if ($enrollment) {
            if ($JLMS_CONFIG->get('multicat_use', 0)) {
                JLMS_TMPL::OpenTS('', ' align="right" style="text-align:right " width="100%"');
                echo (isset($lists['levels'][0]->cat_name) && $lists['levels'][0]->cat_name != '' ? $lists['levels'][0]->cat_name : _JLMS_COURSES_COURSES_GROUPS) . " " . $lists['filter_0'];
                JLMS_TMPL::CloseTS();
            } else {
                JLMS_TMPL::OpenTS('', ' align="right" style="text-align:right " width="100%"');
                echo _JLMS_COURSES_COURSES_GROUPS . " " . $lists['groups_course'];
                JLMS_TMPL::CloseTS();
            }
            if (count($multicat)) {
                for ($i = 0; $i < count($multicat); $i++) {
                    if ($i > 0) {
                        JLMS_TMPL::OpenTS('', ' align="right" style="text-align:right " width="100%"');
                        echo (isset($lists['levels'][$i]->cat_name) && $lists['levels'][$i]->cat_name != '' ? $lists['levels'][$i]->cat_name : _JLMS_COURSES_COURSES_GROUPS) . " " . $lists['filter_' . $i];
                        JLMS_TMPL::CloseTS();
                    }
                }
            }
            $controls = array();
            $controls[] = array('href' => "javascript:submitbutton('enroll','');", 'noscript' => 'submit', 'value' => '1', 'title' => _JLMS_ENROLL, 'img' => 'publish');
            JLMS_TMPL::ShowControlsFooter($controls, '', false);
        }
        ?>
<tr><td><table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php 
        echo JLMSCSS::_('jlmslist');
        ?>
">
				<tr>
					<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" align="center" width="1%">#</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
			<?php 
        if ($enrollment) {
            ?>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" align="center" width="1%">&nbsp;</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
			<?php 
        }
        ?>
					<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" width="35%" align="left" id="jlms_courselist_name"><?php 
        echo _JLMS_COURSES_TBL_HEAD_NAME;
        ?>
</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
					<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" width="20%" align="left" id="jlms_courselist_category"><?php 
        echo _JLMS_COURSES_COURSES_CAT;
        ?>
</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
					<?php 
        if ($show_course_publish_dates) {
            ?>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" width="6%" align="left" nowrap="nowrap"><?php 
            echo _JLMS_COURSES_ST_DATE;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" width="6%" align="left" nowrap="nowrap"><?php 
            echo _JLMS_COURSES_END_DATE;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<?php 
        }
        if ($price_fee_type == 1) {
            ?>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" width="4%" align="left" nowrap="nowrap"><?php 
            echo _JLMS_COURSES_FEETYPE;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<?php 
        } else {
            if ($price_fee_type == 2) {
                ?>
					<<?php 
                echo JLMSCSS::tableheadertag();
                ?>
 class="<?php 
                echo JLMSCSS::_('sectiontableheader');
                ?>
" width="4%" align="left" nowrap="nowrap"><?php 
                echo _JLMS_COURSES_PRICE;
                ?>
</<?php 
                echo JLMSCSS::tableheadertag();
                ?>
>							
					<?php 
            }
        }
        ?>
				</tr>
			<?php 
        $k = 1;
        for ($i = 0, $n = count($rows); $i < $n; $i++) {
            $row = $rows[$i];
            if (!$show_paid_courses && $row->paid) {
                continue;
            }
            $course_descr = strip_tags($row->course_description);
            if (strlen($course_descr) > 100) {
                $course_descr = substr($course_descr, 0, 100) . "...";
            }
            if ($row->self_reg == 0) {
                $checked = "<a href='mailto:" . $row->email . "'><img class='JLMS_png' src=\"" . $lms_img_path . "/dropbox/dropbox_corr.png\" width='16' height='16' border='0' alt='' title='' /></a>";
            } else {
                if ($row->gid) {
                    $checked = "<a href='mailto:" . $row->email . "'><img class='JLMS_png' src=\"" . $lms_img_path . "/dropbox/dropbox_corr.png\" width='16' height='16' border='0' alt='' title='' /></a>";
                } else {
                    $checked = mosHTML::idBox($i, $row->id);
                }
            }
            $link = sefRelToAbs("index.php?option=" . $option . "&amp;Itemid=" . $Itemid . "&amp;task=course_guest&amp;id=" . $row->id);
            ?>
				<?php 
            if ($show_short_description) {
                ?>
				<tr valign="middle" style="vertical-align:middle" class="<?php 
                echo JLMSCSS::_('sectiontableentry2');
                ?>
">
				<?php 
            } else {
                ?>
				<tr valign="middle" style="vertical-align:middle" class="<?php 
                echo JLMSCSS::_('sectiontableentry' . $k);
                ?>
">				
				<?php 
            }
            ?>
					<td align="center"><?php 
            echo $pageNav->limitstart + $i + 1;
            ?>
</td>
					<?php 
            if ($enrollment) {
                ?>
					<td align="center"><?php 
                echo $checked;
                ?>
</td>
					<?php 
            }
            ?>
					<td align="left">
						<a href="<?php 
            echo $link;
            ?>
" title="<?php 
            echo _JLMS_VIEW_DETAILS;
            ?>
">
							<?php 
            echo $row->course_name;
            ?>
							</a><br />
							<?php 
            if ($show_course_author) {
                ?>
							<span class="small"><?php 
                echo _JLMS_HOME_AUTHOR . "&nbsp;" . $row->user_fullname;
                ?>
</span>
							<?php 
            }
            ?>
					</td>
					<td align="left"><?php 
            echo $row->c_category ? $row->c_category : '&nbsp;';
            ?>
</td>
					<?php 
            //						if (!$JLMS_ACL->CheckPermissions('lms', 'order_courses')) {
            if ($show_course_publish_dates) {
                ?>
						<td align="center" nowrap="nowrap"><?php 
                echo $row->publish_start ? JLMS_dateToDisplay($row->start_date) : '&nbsp;';
                ?>
</td>
						<td align="center" nowrap="nowrap"><?php 
                echo $row->publish_end ? JLMS_dateToDisplay($row->end_date) : '&nbsp;';
                ?>
</td>
						<?php 
            }
            //						}
            ?>
					<?php 
            /*if($show_fee_col == 1){?>
            		<td align="left"><?php echo $row->paid ? _JLMS_COURSES_PAID : _JLMS_COURSES_FREE;?></td>
            		<?php }*/
            if ($price_fee_type) {
                if ($price_fee_type == 1) {
                    ?>
						<td align="center"><?php 
                    echo $row->paid ? _JLMS_COURSES_PAID : _JLMS_COURSES_FREE;
                    ?>
</td>
						<?php 
                } else {
                    if ($price_fee_type == 2) {
                        ?>
						<td align="center"><?php 
                        echo $row->paid ? $jlms_cs . sprintf('%.2f', round($row->course_price, 2)) : _JLMS_COURSES_FREE;
                        ?>
</td>	
						<?php 
                    }
                }
            }
            ?>
				</tr>
				<?php 
            if ($show_short_description) {
                if (strlen($row->course_sh_description)) {
                    ?>
					<tr class="<?php 
                    echo JLMSCSS::_('sectiontableentry1');
                    ?>
">
						<td>&nbsp;</td>
						<td colspan="<?php 
                    echo $colspan_sh_description;
                    ?>
" style="text-align: justify;">
							<?php 
                    echo $row->course_sh_description;
                    ?>
						</td>
					</tr>
					<?php 
                }
            }
            ?>
				<?php 
            $k = 3 - $k;
        }
        ?>
				<tr>
					<td class="<?php 
        echo JLMSCSS::_('jlmslist-footer_td');
        ?>
" colspan="<?php 
        echo $colspan_sh_description + 1;
        ?>
" align="center"><div align="center">
<?php 
        $filter_groups = intval(mosGetParam($_REQUEST, 'groups_course', 0));
        $link = "index.php?option={$option}&amp;Itemid={$Itemid}";
        if ($filter_groups) {
            $link = $link . "&amp;groups_course={$filter_groups}";
        }
        echo $pageNav->writePagesLinks($link);
        ?>
 
					</div></td>
				</tr></table></td></tr>
				
<?php 
        if ($enrollment) {
            JLMS_TMPL::ShowControlsFooter($controls);
        }
        ?>
</table>
							
	<?php 
        if ($enrollment) {
            ?>
			<input type="hidden" name="task" value="subscription" />
			<input type="hidden" name="id" value="" />
			<input type="hidden" name="boxchecked" value="0" />
		</form>
	<?php 
        }
        JLMS_TMPL::CloseTS();
        JLMS_TMPL::CloseMT();
    }
    function showStepConditions($course_id, $lpath_id, $step_id, $option, &$conds, &$lists, $step_name)
    {
        global $Itemid, $JLMS_CONFIG;
        ?>
<script language="javascript" type="text/javascript">
<!--
function submitbutton_del(pressbutton) {
	var form = document.adminForm;
	if (form.boxchecked.value == '0') {
		alert('<?php 
        echo _JLMS_ALERT_SELECT_ITEM;
        ?>
');
	} else {
		form.task.value = pressbutton;
		form.submit();
	}
}
function submitbutton_add(pressbutton) {
	var form = document.newcondForm;
	form.task.value = pressbutton;
	form.submit();
}
//-->
</script>
<?php 
        JLMS_TMPL::OpenMT();
        $hparams = array();
        $toolbar = array();
        $toolbar[] = array('btn_type' => 'back', 'btn_js' => sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=compose_lpath&amp;course_id={$course_id}&amp;id={$lpath_id}"));
        JLMS_TMPL::ShowHeader('lpath', '', $hparams, $toolbar);
        JLMS_TMPL::OpenTS();
        echo JLMSCSS::h2(_JLMS_LPATH_TITLE_CONDITIONS . $step_name);
        ?>
	<form action="<?php 
        echo sefRelToAbs("index.php?option=" . $option . "&amp;Itemid=" . $Itemid);
        ?>
" method="post" name="adminForm">
		<table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php 
        echo JLMSCSS::_('jlmslist');
        ?>
">
			<tr>
				<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 width="20" class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" align="center">#</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
				<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 width="20" class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
">&nbsp;</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
				<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
">&nbsp;</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
				<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
"><?php 
        echo _JLMS_LPATH_COND_REF_STEP;
        ?>
</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
			</tr>
		<?php 
        $k = 1;
        for ($i = 0, $n = count($conds); $i < $n; $i++) {
            $row_cond = $conds[$i];
            $checked = mosHTML::idBox($i, $row_cond->id);
            ?>
			<tr id="tree_row_<?php 
            echo $row_cond->id;
            ?>
" class="<?php 
            echo JLMSCSS::_('sectiontableentry' . $k);
            ?>
">
				<td align="center" valign="middle"><?php 
            echo $i + 1;
            ?>
</td>
				<td valign="middle"><?php 
            echo $checked;
            ?>
</td>
				<td valign="middle"><?php 
            echo _JLMS_LPATH_CONDTYPE_COMPLETE;
            ?>
</td>
				<td valign="middle" style="vertical-align:middle ">
					<?php 
            if (isset($row_cond->cond_time) && $row_cond->cond_time) {
                $row_cond->ref_step_name .= ' (' . _JLMS_LPATH_CONDTYPE_SPENT . ' ' . $row_cond->cond_time . ' ' . _JLMS_LPATH_CONDTYPE_TIME_SPENT_MIN . ')';
            }
            echo $row_cond->ref_step_name;
            ?>
				</td>
			</tr>
			<?php 
            $k = 3 - $k;
        }
        ?>
		</table>
		<input type="hidden" name="option" value="<?php 
        echo $option;
        ?>
" />
		<input type="hidden" name="Itemid" value="<?php 
        echo $Itemid;
        ?>
" />
		<input type="hidden" name="task" value="lpath_item_delete" />
		<input type="hidden" name="id" value="<?php 
        echo $step_id;
        ?>
" />
		<input type="hidden" name="step_id" value="<?php 
        echo $step_id;
        ?>
" />
		<input type="hidden" name="lpath_id" value="<?php 
        echo $lpath_id;
        ?>
" />
		<input type="hidden" name="course_id" value="<?php 
        echo $course_id;
        ?>
" />
		<input type="hidden" name="boxchecked" value="0" />
	</form>
	<form action="<?php 
        echo sefRelToAbs("index.php?option=" . $option . "&ampItemid=" . $Itemid);
        ?>
" method="post" name="newcondForm">
<?php 
        echo '<table cellpadding="0" cellspacing="0" border="0" width="100%" class="jlms_table_no_borders">';
        $controls = array();
        $controls[] = array('href' => "javascript:submitbutton_del('lpath_cond_delete');", 'title' => _JLMS_LPATH_LINK_DEL_COND, 'img' => 'buttons_22/btn_delete_22.png');
        $controls[] = array('href' => "javascript:submitbutton_add('lpath_save_cond');", 'title' => _JLMS_LPATH_LINK_NEW_COND, 'img' => 'buttons_22/btn_add_22.png');
        $custom = _JLMS_LPATH_CONDTYPE_COMPLETE . '&nbsp;' . $lists['lpath_steps'];
        if ($JLMS_CONFIG->get('enable_timetracking')) {
            $custom .= '&nbsp;' . _JLMS_LPATH_CONDTYPE_AND_SPENT . ': <input type="text" name="cond_time" value="" size="5" class="inputbox" style="text-align: center;" /> <small>min</small>';
        }
        $controls[] = array('href' => '', 'title' => '', 'img' => '', 'custom' => $custom);
        JLMS_TMPL::ShowControlsFooter($controls, '', false, true);
        echo '</table>';
        /*
        		<table width="100%" cellpadding="0" cellspacing="0" border="0">
        			<tr>
        				<td>
        					<table width="100%" cellpadding="0" cellspacing="0" border="0"><tr>
        						<td align="center" valign="middle" width="16"><a href="javascript:submitbutton_del('lpath_cond_delete');" title="<?php echo _JLMS_LPATH_LINK_DEL_COND;?>"><img class="JLMS_png" src="<?php echo $JLMS_CONFIG->get('live_site');?>/components/com_joomla_lms/lms_images/toolbar/btn_remove.png" width="16" height="16" border="0" alt="<?php echo _JLMS_LPATH_LINK_DEL_COND;?>" title="<?php echo _JLMS_LPATH_LINK_DEL_COND;?>" /></a></td>
        						<td align="center" valign="middle" width="16"><a href="javascript:submitbutton_add('lpath_save_cond');" title="<?php echo _JLMS_LPATH_LINK_NEW_COND;?>"><img class="JLMS_png" src="<?php echo $JLMS_CONFIG->get('live_site');?>/components/com_joomla_lms/lms_images/toolbar/btn_add.png" width="16" height="16" border="0" alt="<?php echo _JLMS_LPATH_LINK_NEW_COND;?>" title="<?php echo _JLMS_LPATH_LINK_NEW_COND;?>" /></a></td>
        						<td align="left" valign="middle">
        							&nbsp;<?php echo _JLMS_LPATH_CONDTYPE_COMPLETE. "&nbsp;" . $lists['lpath_steps']; ?>
        							&nbsp;<?php echo _JLMS_LPATH_CONDTYPE_AND_SPENT;?>: <input type="text" name="cond_time" value="" size="5" class="inputbox" style="text-align: center;" /> <small>min</small>
        						</td>
        					</tr></table>
        				</td>
        			</tr>
        		</table>
        */
        ?>
		<input type="hidden" name="option" value="<?php 
        echo $option;
        ?>
" />
		<input type="hidden" name="Itemid" value="<?php 
        echo $Itemid;
        ?>
" />
		<input type="hidden" name="task" value="lpath_save_cond" />
		<input type="hidden" name="id" value="<?php 
        echo $step_id;
        ?>
" />
		<input type="hidden" name="step_id" value="<?php 
        echo $step_id;
        ?>
" />
		<input type="hidden" name="lpath_id" value="<?php 
        echo $lpath_id;
        ?>
" />
		<input type="hidden" name="course_id" value="<?php 
        echo $course_id;
        ?>
" />
	</form>
<?php 
        JLMS_TMPL::CloseTS();
        JLMS_TMPL::CloseMT();
    }
    function mailbox_view($row, $option, $course_id, $inb)
    {
        global $Itemid, $JLMS_DB;
        JLMS_TMPL::OpenMT();
        if (!$course_id) {
            $hparams = array('show_menu' => false);
        } else {
            $hparams = array();
        }
        JLMS_TMPL::ShowHeader('mailbox', _JLMS_MB_TITLE, $hparams);
        $toolbar = array();
        $toolbar[] = array('btn_type' => 'mail_inbox', 'btn_js' => "javascript:submitbutton('mailbox');");
        $toolbar[] = array('btn_type' => 'mail_outbox', 'btn_js' => "javascript:submitbutton('mail_sendbox');");
        $toolbar[] = array('btn_type' => 'mail_send', 'btn_js' => "javascript:submitbutton('mailbox_new');");
        JLMS_TMPL::ShowToolbar($toolbar, 'right', true, stripslashes($row->subject));
        JLMS_TMPL::OpenTS();
        ?>
		<form action="<?php 
        echo sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}");
        ?>
" method="post" name="adminForm">
		<table width="100%" class="jlms_table_no_borders">
			<tr>
				<td>
					
				
					<div class="small">
					<?php 
        echo !$inb ? _JLMS_MB_SENDER . ' :&nbsp;' : _JLMS_MB_RECEPIENTS . ' :&nbsp;';
        ?>
					<?php 
        if (!$inb) {
            echo $row->username;
        } else {
            $query = "SELECT u.username FROM #__lms_messages_to as mt, #__users as u WHERE mt.id=" . $row->id . " AND u.id=mt.user_id";
            $JLMS_DB->setQuery($query);
            $userki = $JLMS_DB->loadResultArray();
            echo $userz = implode(', ', $userki);
            //echo $userz = (strlen($userz)>20)?(substr($userz,0,18).'...'):$userz;
        }
        ?>
					</div>
				</td>
			</tr>
			<tr>
				
				<td>
					<?php 
        echo stripslashes($row->message);
        ?>
				</td>
			</tr>
			<?php 
        if ($row->file) {
            $query = "SELECT * FROM #__lms_files WHERE id='" . $row->file . "'";
            $JLMS_DB->setQuery($query);
            $my_file = $JLMS_DB->loadObjectList();
            if (count($my_file)) {
                $filename = $my_file[0]->file_name;
            }
            $link = sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=mfile_load&amp;id=" . $course_id . "&amp;view_id=" . $row->id);
            ?>
			<tr>
				<td>
					<?php 
            echo _JLMS_MB_ATTACHMENT . '&nbsp;';
            ?>
				
					<a href="<?php 
            echo $link;
            ?>
"><?php 
            echo $filename;
            ?>
</a>
				</td>
			</tr>
			<?php 
        }
        ?>
			
		</table>
		<input type="hidden" name="option" value="<?php 
        echo $option;
        ?>
" />
		<input type="hidden" name="Itemid" value="<?php 
        echo $Itemid;
        ?>
" />
		<input type="hidden" name="task" value="mailbox" />
		<input type="hidden" name="id" value="<?php 
        echo $course_id;
        ?>
" />
		<input type="hidden" name="boxchecked" value="0" />
		<input type="hidden" name="state" value="0" />
		<input type="hidden" name="cid[]" value="<?php 
        echo $row->id;
        ?>
" />
		</form>
		<?php 
        JLMS_TMPL::CloseTS();
        $controls = array();
        $controls[] = array('href' => "javascript:history.back(-1);", 'title' => _JLMS_BACK_ALT_TITLE, 'img' => 'back');
        $controls[] = array('href' => "javascript:submitbutton('mail_delete');", 'title' => _JLMS_DELETE, 'img' => 'delete');
        if (!$inb) {
            $controls[] = array('href' => "javascript:submitbutton('mailbox_reply');", 'title' => _JLMS_MB_REPL_REPLY, 'img' => 'mail_reply');
        }
        $tsk = $inb ? 'mail_sendbox' : 'mailbox';
        JLMS_TMPL::ShowControlsFooter($controls, sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task={$tsk}&amp;id={$course_id}"));
        JLMS_TMPL::CloseMT();
    }
    function JQ_showQuestsList(&$rows, &$lists, &$pageNav, $option, $page, $id, $is_pool = false, $gqp = false, $levels = array())
    {
        $JLMS_CONFIG =& JLMSFactory::getConfig();
        $Itemid = $JLMS_CONFIG->get('Itemid');
        $zzz = '<form action="' . $JLMS_CONFIG->get('live_site') . "/index.php?option={$option}&amp;Itemid={$Itemid}" . '" method="post" name="adminFormQ">';
        $toolbar = array();
        if (!$gqp) {
            $toolbar[] = array('btn_type' => 'csv_import', 'btn_txt' => _JLMS_QUIZ_TBL_QUEST_IMPORT_QUEST, 'btn_js' => "javascript:submitbutton('import_quest');");
            $toolbar[] = array('btn_type' => 'csv_export', 'btn_txt' => _JLMS_QUIZ_TBL_QUEST_EXPORT_QUEST, 'btn_js' => "javascript:submitbutton('export_quest');");
            $toolbar[] = array('btn_type' => 'spacer', 'btn_txt' => 'spacer', 'btn_js' => 'spacer');
            $toolbar[] = array('btn_type' => 'new', 'btn_txt' => _JLMS_QUIZ_NEW_QUEST_BTN, 'btn_js' => "javascript:submitbutton('add_quest');");
        } else {
            $toolbar[] = array('btn_type' => 'category', 'btn_txt' => _JLMS_QUIZ_TBL_CATEGORY_GQP, 'btn_js' => "javascript:submitbutton('category_gqp');");
            $toolbar[] = array('btn_type' => 'spacer', 'btn_txt' => 'spacer', 'btn_js' => 'spacer');
            $toolbar[] = array('btn_type' => 'csv_import', 'btn_txt' => _JLMS_QUIZ_TBL_QUEST_IMPORT_QUEST, 'btn_js' => "javascript:submitbutton('import_quest_gqp');");
            $toolbar[] = array('btn_type' => 'csv_export', 'btn_txt' => _JLMS_QUIZ_TBL_QUEST_EXPORT_QUEST, 'btn_js' => "javascript:submitbutton('export_quest_gqp');");
            $toolbar[] = array('btn_type' => 'spacer', 'btn_txt' => 'spacer', 'btn_js' => 'spacer');
            $toolbar[] = array('btn_type' => 'bar', 'btn_txt' => _JLMS_QUIZ_VIEW_STATS_GQP, 'btn_js' => "javascript:submitbutton('quiz_bars_gqp');");
            $toolbar[] = array('btn_type' => 'spacer', 'btn_txt' => 'spacer', 'btn_js' => 'spacer');
            $toolbar[] = array('btn_type' => 'new', 'btn_txt' => _JLMS_QUIZ_NEW_QUEST_BTN, 'btn_js' => "javascript:submitbutton('add_quest_gqp');");
        }
        $add_option = $lists['new_qtype'];
        if ($gqp) {
            $title = _JLMS_GLOBAL_QUEST_POOL;
            if ($JLMS_CONFIG->get('is_trial', false) && $JLMS_CONFIG->get('trial_gqp_heading_text', '')) {
                $title .= $JLMS_CONFIG->get('trial_gqp_heading_text', '');
            }
        } elseif ($is_pool) {
            $title = _JLMS_QUIZ_QUEST_POOL;
        } else {
            $title = _JLMS_QUIZ_QUESTLIST_TITLE;
        }
        if ($gqp && $JLMS_CONFIG->get('is_trial', false) && $JLMS_CONFIG->get('trial_gqp_page_text', '')) {
            echo '<div class="joomlalms_sys_message">' . $JLMS_CONFIG->get('trial_gqp_page_text', '') . '</div>';
        }
        JLMS_quiz_admin_html_class::showQuizHead2($id, $option, $title, true, $toolbar, $add_option, $zzz, $gqp);
        //FLMS multicat
        $multicat = array();
        if ($gqp) {
            $multicat = array();
            $i = 0;
            foreach ($lists as $key => $item) {
                if (substr($key, 0, 7) == 'filter_') {
                    $multicat[] = $lists['filter_' . $i];
                    $i++;
                }
            }
        }
        ?>
		<script language="javascript" type="text/javascript">
		<!--
		function checkAllQ( n, fldName ) {
			if (!fldName) {
				fldName = 'cb';
			}
			var f = document.adminFormQ;
			var c = f.toggle.checked;
			var n2 = 0;
			for (i=0; i < n; i++) {
				cb = eval( 'f.' + fldName + '' + i );
				if (cb) {
					cb.checked = c;
					n2++;
				}
			}
			if (c) {
				document.adminFormQ.boxchecked.value = n2;
			} else {
				document.adminFormQ.boxchecked.value = 0;
			}
		}
		function submitbutton(pressbutton) {
			var form = document.adminFormQ;
			if ((pressbutton == 'add_quest') || (pressbutton == 'add_quest_gqp')) {
				if (form.new_qtype_id.value == '0') {
					alert('<?php 
        echo html_entity_decode(_JLMS_QUIZ_SELECT_TYPE_TO_CREATE);
        ?>
');
				} else {
					form.page.value = pressbutton;
					form.submit();
				}
			} else if ( ((pressbutton == 'edit_quest' || pressbutton == 'edit_quest_gqp') || (pressbutton == 'del_quest' || pressbutton == 'del_quest_gqp') || (pressbutton == 'copy_quest_sel' || pressbutton == 'copy_quest_sel_gqp') || (pressbutton == 'move_quest_sel' || pressbutton == 'move_quest_sel_gqp') ) && (form.boxchecked.value == "0")) {
				alert('<?php 
        echo _JLMS_ALERT_SELECT_ITEM;
        ?>
');
			} else if( (pressbutton == 'publish_quest' || pressbutton == 'unpublish_quest' || pressbutton == 'publish_quest_gqp' || pressbutton == 'unpublish_quest_gqp') && form.boxchecked.value == 0){
				alert('<?php 
        echo _JLMS_ALERT_SELECT_ITEM;
        ?>
'); 
			} else if( (pressbutton == 'export_quest' || pressbutton == 'export_quest_gqp') && form.boxchecked.value == 0 && !confirm('<?php 
        echo _JLMS_QUIZ_EXPORT_ALL_QUESTS_CONFIRM;
        ?>
')){
				alert('<?php 
        echo _JLMS_ALERT_SELECT_ITEM;
        ?>
'); 
			} else {
				form.page.value = pressbutton;
				form.submit();
			}
		}
		function submitbutton_order(pressbutton, item_id) {
			var form = document.adminFormQ;
			if ((pressbutton == 'quest_orderup') || (pressbutton == 'quest_orderdown')){
				if (item_id) {
				form.page.value = pressbutton;
				form.row_id.value = item_id;
				form.submit();
				}
			}
		}
		function submitbutton_allorder(n) {
			var form = document.adminFormQ;
			for ( var j = 0; j <= n; j++ ) {
				box = eval( "document.adminFormQ.cb" + j );
				if ( box ) {
					if ( box.checked == false ) {
						box.checked = true;
					}
				}
			}
			form.page.value = 'saveorederall';
			form.submit();
		}
		function submit_preview() {
			var quest_id = 0;
			var form = document.adminFormQ;
			if (form.boxchecked.value == "0") {
				alert('<?php 
        echo _JLMS_ALERT_SELECT_ITEM;
        ?>
');
			} else {
				var selItem = document.adminFormQ['cid[]'];
				if (selItem) {
					if (selItem.length) { var i;
						for (i = 0; i<selItem.length; i++) {
							if (selItem[i].checked) {
								if (selItem[i].value > 0) { quest_id = selItem[i].value; break; }
							}
						}
					} else if (selItem.checked) { quest_id = selItem.value; }
				}
				if (quest_id != 0 && quest_id != '0'){
					var url = '<?php 
        echo $JLMS_CONFIG->get('live_site') . "/index.php?option=com_joomla_lms&Itemid={$Itemid}&task=quizzes&id={$id}&page=view_preview&c_id='+quest_id+'";
        ?>
';
					window.open(url);
				}
			}
		}
		function jlms_jq_isChecked(isitchecked){
			if (isitchecked == true){
				document.adminFormQ.boxchecked.value++;
			}
			else {
				document.adminFormQ.boxchecked.value = document.adminFormQ.boxchecked.value - 1;
			}
		} 
		
		var old_filters = new Array();
		function read_filter(){
			var form = document.adminFormQ;
			var count_levels = '<?php 
        echo count($levels);
        ?>
';
			for(var i=0;i<parseInt(count_levels);i++){
				if(form['filter_id_'+i] != null){
					old_filters[i] = form['filter_id_'+i].value;
				}
			}
		}
		function write_filter(){
			var form = document.adminFormQ;
			var count_levels = '<?php 
        echo count($levels);
        ?>
';
			var j;
			for(var i=0;i<parseInt(count_levels);i++){
				if(form['filter_id_'+i+''] != null && form['filter_id_'+i+''].value != old_filters[i]){
					j = i;
				}
				if(i > j){
					if(form['filter_id_'+i] != null){
						form['filter_id_'+i].value = 0;	
					}
				}
			}
		}
		//-->
		</script>
		<table width="100%" cellpadding="0" cellspacing="0" border="0" class="jlms_table_no_borders">
			<tr>
				<td>
				<table width="100%" cellpadding="0" cellspacing="0" border="0" class="jlms_table_no_borders">
					<tr>
						<td align="left" style="text-align:left;">
						<?php 
        if (!$gqp) {
            echo $lists['quiz'] . $lists['qtype'] . $lists['qcats'];
        } else {
            echo $lists['qtype'];
        }
        ?>
							<br />
							<input class="inputbox" type="text" name="quest_filter" value="<?php 
        echo $lists['filt_quest'];
        ?>
" /><input type="submit" name="Filter" value="<?php 
        echo str_replace(':', '', _JLMS_FILTER);
        ?>
" /> 
							
							<!--</div>-->
						</td>
						<?php 
        if (count($multicat)) {
            ?>
						<td align="right" valign="bottom">
							<table border="0" class="jlms_table_no_borders">
							<?php 
            for ($i = 0; $i < count($multicat); $i++) {
                $num = $i + 1;
                ?>
								<tr>
									<td align="right" style="text-align:right;" width="20%">
										<?php 
                echo isset($levels[$i]->cat_name) && $levels[$i]->cat_name != '' ? $levels[$i]->cat_name : '';
                //'Level #'.$num;
                ?>
									</td>
									<td align="left" style="text-align:left;" width="80%">
										<?php 
                $m_output = $lists['filter_' . $i];
                $m_output = str_replace('<option value="0" selected="selected"></option>', '<option value="0" selected="selected">&nbsp;</option>', $m_output);
                $m_output = str_replace('<option value="0"></option>', '<option value="0">&nbsp;</option>', $m_output);
                echo $m_output;
                ?>
									</td>
								</tr>
								<?php 
            }
            ?>
							</table>
						</td>
						<?php 
        }
        ?>
	
					</tr>
				</table>
				</td>
			</tr>
			<tr>
				<td width="100%">
				<?php 
        $quests_colspan = 6;
        ?>
 
				<table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php 
        echo JLMSCSS::_('jlmslist');
        ?>
" style="padding-top:0px; margin-top:0px; margin-bottom:0px; padding-bottom:0px;">
					<tr>
						<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 width="20" class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" align="center">#</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
						<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 width="20" class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" align="center"><input type="checkbox" name="toggle" value="" onclick="checkAllQ(<?php 
        echo count($rows);
        ?>
);" /></<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
						<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
"><?php 
        echo _JLMS_QUIZ_TBL_QUEST_TEXT;
        ?>
</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
						<?php 
        if ($gqp) {
            $quests_colspan = $quests_colspan + 1;
            ?>
							<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" width="1%"><?php 
            echo _JLMS_QUIZ_TBL_QUEST_PUBLISH;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
						<?php 
        }
        ?>
				<?php 
        if (isset($lists['filtered_quiz']) && $lists['filtered_quiz'] && !$gqp) {
            $quests_colspan = $quests_colspan + 5;
            ?>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" width="1%"><?php 
            echo _JLMS_QUIZ_TBL_QUEST_PUBLISH;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" colspan="2" width="1%"><?php 
            echo _JLMS_REORDER;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" width="1%"><?php 
            echo _JLMS_ORDER;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" width="1%"><a class="jlms_img_link" href="javascript:submitbutton_allorder(<?php 
            echo count($rows) - 1;
            ?>
)"><img width="16" height="16" border="0" title="<?php 
            echo _JLMS_SAVEORDER;
            ?>
" alt="<?php 
            echo _JLMS_SAVEORDER;
            ?>
" src="<?php 
            echo $JLMS_CONFIG->get('live_site');
            ?>
/components/com_joomla_lms/lms_images/filesave.png"/></a></<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
				<?php 
        }
        ?>
						<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
"><?php 
        echo _JLMS_QUIZ_TBL_QUEST_TYPE;
        ?>
</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
					<?php 
        if (!$gqp) {
            $quests_colspan = $quests_colspan + 1;
            ?>
	
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
"><?php 
            echo _JLMS_QUIZ_TBL_QUEST_QUIZ;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<?php 
        }
        ?>
	
						<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
"><?php 
        echo _JLMS_QUIZ_TBL_Q_CAT;
        ?>
</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
						<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" width="20">ID</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
					</tr>
				<?php 
        $k = 1;
        for ($i = 0, $n = count($rows); $i < $n; $i++) {
            $row = $rows[$i];
            $quiz_task = 'setup_quest';
            $img_published = $row->published ? 'btn_accept.png' : 'btn_cancel.png';
            $task_published = $row->published ? 'unpublish_quest' : 'publish_quest';
            $alt_published = $row->published ? _JLMS_STATUS_PUB : _JLMS_STATUS_UNPUB;
            $state = $row->published ? 0 : 1;
            if (!$gqp) {
                $link = "index.php?option=" . $option . "&amp;Itemid={$Itemid}&amp;task=quizzes&amp;id={$id}&amp;page=editA_quest&amp;c_id=" . $row->c_id;
            } else {
                $link = "index.php?option=" . $option . "&amp;Itemid={$Itemid}&amp;task=quizzes&amp;page=editA_quest_gqp&amp;c_id=" . $row->c_id;
            }
            $checked = '<input type="checkbox" id="cb' . $i . '" name="cid[]" value="' . $row->c_id . '" onclick="jlms_jq_isChecked(this.checked);" />';
            ?>
					<tr class="<?php 
            echo JLMSCSS::_('sectiontableentry' . $k);
            ?>
">
						<td align="center"><?php 
            echo $pageNav->limitstart + $i + 1;
            ?>
</td>
						<td><?php 
            echo $checked;
            ?>
</td>
						<td align="left">
							<?php 
            mosMakeHtmlSafe($row->c_question);
            $quest_name = jlms_string_substr(strip_tags($row->c_question), 0, 70);
            $quest_desc = '';
            if ($row->c_question) {
                $quest_desc = $row->c_question;
            }
            if (isset($row->right_answer) && $row->right_answer) {
                $quest_desc .= '<br /><br /><span class="tip-title-inner">' . _JLMS_QUIZ_CORRECT_ANSWER . '</span> ' . $row->right_answer;
            }
            if (isset($row->c_type) && $row->c_type == 21 && isset($row->c_pool_gqp) && $row->c_pool_gqp) {
                $quest_desc = _JLMS_QUIZ_QUEST_POOL_GQP_SHORT . ' ID: ' . $row->c_pool_gqp . '<br />' . ($quest_desc ? '<br />' . $quest_desc : '');
            }
            echo JLMS_toolTip($quest_name, $quest_desc, '', sefRelToAbs($link), 1, 36, 'true', 'jlms_ttip');
            ?>
						</td>
						<?php 
            if (isset($lists['filtered_quiz']) && $lists['filtered_quiz'] && !$gqp) {
                ?>
							<td valign="middle" align="center"><?php 
                echo JLMS_quiz_admin_html_class::QuizPublishIcon($row->c_id, $id, $state, $task_published, $alt_published, $img_published, $option);
                ?>
</td>
							<td valign="middle" align="center"><?php 
                echo JLMS_orderUpIcon($i, $row->c_id, true, 'quest_orderup');
                ?>
</td>
							<td valign="middle" align="center"><?php 
                echo JLMS_orderDownIcon($i, $n, $row->c_id, true, 'quest_orderdown');
                ?>
</td>
							<td colspan="2">
								<input type="text" name="order[]" size="5" value="<?php 
                echo $row->ordering;
                ?>
" class="inputbox" style="text-align: center" />
							</td>
						<?php 
            }
            ?>

						<?php 
            if ($gqp) {
                ?>
							<td valign="middle" align="center"><?php 
                echo JLMS_quiz_admin_html_class::QuizPublishIcon($row->c_id, $id, $state, $task_published, $alt_published, $img_published, $option, $gqp);
                ?>
</td>
						<?php 
            }
            ?>

						<td align="left">
							<?php 
            echo $row->qtype_full;
            ?>
						</td>
						<?php 
            if (!$gqp) {
                ?>
	
							<td align="left">
							<?php 
                if ($row->c_quiz_id) {
                    echo $row->quiz_name;
                } else {
                    echo _JLMS_QUIZ_QUEST_POOL;
                }
                ?>
							</td>
						<?php 
            }
            ?>
	
						<td align="left">
							<?php 
            echo $row->c_category ? $row->c_category : '&nbsp;';
            ?>
						</td>
						<td><?php 
            echo $row->c_id;
            echo $row->c_pool_gqp ? '/' . $row->c_pool_gqp : '';
            ?>
</td>
					</tr>
					<?php 
            $k = 3 - $k;
        }
        ?>
					<tr>
						<td align="center" colspan="<?php 
        echo $quests_colspan;
        ?>
" class="<?php 
        echo JLMSCSS::_('jlmslist-footer_td');
        ?>
">
							<div align="center" style="white-space:nowrap">
							<?php 
        $link = "index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=quizzes&amp;id={$id}&amp;page={$page}";
        echo _JLMS_PN_DISPLAY_NUM . '&nbsp;' . $pageNav->getLimitBox($link) . '&nbsp;' . $pageNav->getPagesCounter();
        echo '<br />';
        echo $pageNav->writePagesLinks($link);
        ?>
 
							</div>
						</td>
					</tr>
				</table>
				</td>
			</tr>
<?php 
        if ($gqp) {
            $controls = array();
            $controls[] = array('href' => "javascript:submitbutton('publish_quest_gqp');", 'title' => _JLMS_QUIZ_TBL_QUEST_PUBLISH_QUEST, 'img' => 'buttons_22/btn_publish_22.png');
            $controls[] = array('href' => "javascript:submitbutton('unpublish_quest_gqp');", 'title' => _JLMS_QUIZ_TBL_QUEST_UNPUBLISH_QUEST, 'img' => 'buttons_22/btn_unpublish_22.png');
            $controls[] = array('href' => "spacer", 'title' => '', 'img' => '');
            $controls[] = array('href' => "javascript:submitbutton('edit_quest_gqp');", 'title' => _JLMS_QUIZ_EDIT_QUEST_BTN, 'img' => 'quiz/btn_edit.png');
            $controls[] = array('href' => "javascript:submitbutton('del_quest_gqp');", 'title' => _JLMS_QUIZ_DEL_QUEST_BTN, 'img' => 'quiz/btn_delete.png');
            $controls[] = array('href' => "javascript:submitbutton('copy_quest_sel_gqp');", 'title' => _JLMS_QUIZ_COPY_QUEST_BTN, 'img' => 'quiz/btn_copy.png');
            $controls[] = array('href' => "javascript:submitbutton('move_quest_sel_gqp');", 'title' => _JLMS_QUIZ_MOVE_QUEST_BTN, 'img' => 'quiz/btn_move.png');
            $controls[] = array('href' => "spacer", 'title' => '', 'img' => '');
            $controls[] = array('href' => "javascript:submit_preview();", 'title' => _JLMS_QUIZ_PREVIEW_QUEST_BTN, 'img' => 'quiz/btn_preview.png');
            JLMS_TMPL::ShowControlsFooter($controls, '', false, true);
        } else {
            $controls = array();
            $controls[] = array('href' => "javascript:submitbutton('publish_quest');", 'title' => _JLMS_QUIZ_TBL_QUEST_PUBLISH_QUEST, 'img' => 'buttons_22/btn_publish_22.png');
            $controls[] = array('href' => "javascript:submitbutton('unpublish_quest');", 'title' => _JLMS_QUIZ_TBL_QUEST_UNPUBLISH_QUEST, 'img' => 'buttons_22/btn_unpublish_22.png');
            $controls[] = array('href' => "spacer", 'title' => '', 'img' => '');
            $controls[] = array('href' => "javascript:submitbutton('edit_quest');", 'title' => _JLMS_QUIZ_EDIT_QUEST_BTN, 'img' => 'quiz/btn_edit.png');
            $controls[] = array('href' => "javascript:submitbutton('del_quest');", 'title' => _JLMS_QUIZ_DEL_QUEST_BTN, 'img' => 'quiz/btn_delete.png');
            $controls[] = array('href' => "javascript:submitbutton('copy_quest_sel');", 'title' => _JLMS_QUIZ_COPY_QUEST_BTN, 'img' => 'quiz/btn_copy.png');
            $controls[] = array('href' => "javascript:submitbutton('move_quest_sel');", 'title' => _JLMS_QUIZ_MOVE_QUEST_BTN, 'img' => 'quiz/btn_move.png');
            $controls[] = array('href' => "spacer", 'title' => '', 'img' => '');
            $controls[] = array('href' => "javascript:submit_preview();", 'title' => _JLMS_QUIZ_PREVIEW_QUEST_BTN, 'img' => 'quiz/btn_preview.png');
            JLMS_TMPL::ShowControlsFooter($controls, '', false, true);
        }
        ?>
		</table>
		<?php 
        JLMS_quiz_admin_html_class::showQuizFooter();
        ?>
		<input type="hidden" name="option" value="<?php 
        echo $option;
        ?>
" />
		<input type="hidden" name="page" value="<?php 
        echo $page;
        ?>
" />
		<input type="hidden" name="task" value="quizzes" />
		<input type="hidden" name="boxchecked" value="0" />
		<input type="hidden" name="id" value="<?php 
        echo $id;
        ?>
" />
		<input type="hidden" name="row_id" value="0" />
		</form>
	<?php 
        JLMS_quiz_admin_html_class::showQuizFooter();
        //closetwicely if opened using head2() function
    }
Пример #11
0
    function showCourseDocuments($id, $option, &$rows, &$lists, &$possibilities)
    {
        $JLMS_CONFIG =& JLMSFactory::getConfig();
        $Itemid = $JLMS_CONFIG->get('Itemid');
        $db =& JFactory::getDbo();
        $user = JLMSFactory::getUser();
        $JLMS_ACL =& JLMSFactory::getACL();
        $lms_img_path = $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('lms_path_to_images', 'components/com_joomla_lms/lms_images');
        $rows_c = $lists['collapsed_folders'];
        ?>
<script language="javascript" type="text/javascript">
<!--//--><![CDATA[//><!--
function submitbutton(pressbutton) {
	var form = document.adminForm;
	if ((pressbutton == 'doc_delete') && (form.boxchecked.value == '0')) {
		alert( "<?php 
        echo _JLMS_ALERT_SELECT_ITEM;
        ?>
" );
	} else if((pressbutton == 'doc_delete')){
		if(confirm('<?php 
        echo _JLMS_OUTDOCS_JS_CONFIRM_DELETE;
        ?>
')){
			form.task.value = pressbutton;
			form.submit();
		}	
	} else if ((pressbutton == 'edit_doc') && (form.boxchecked.value == '0')) {
		alert( "<?php 
        echo _JLMS_ALERT_SELECT_ITEM;
        ?>
" );
	} else {
		form.task.value = pressbutton;
		form.submit();
	}
}
function submitbutton_change(pressbutton, state) {
	var form = document.adminForm;
	if (pressbutton == 'change_doc'){
		if (form.boxchecked.value == '0') {
			alert( "<?php 
        echo _JLMS_ALERT_SELECT_ITEM;
        ?>
" );
		} else {
			form.task.value = pressbutton;
			form.state.value = state;
			form.submit();
		}
	}
}
function submitbutton_change2(pressbutton, state, cid_id) {
	var form = document.adminForm;
	if (pressbutton == 'change_doc'){
		form.task.value = pressbutton;
		form.state.value = state;
		form.cid2.value = cid_id;
		form.submit();
	}
}
function submitbutton_order(pressbutton, item_id) {
	var form = document.adminForm;
	if ((pressbutton == 'doc_orderup') || (pressbutton == 'doc_orderdown')){
		if (item_id) {
		form.task.value = pressbutton;
		form.row_id.value = item_id;
		form.submit();
		}
	}
}
function cf_saveorder(){
	var form = document.adminForm;	
	form.task.value = 'doc_saveorder';
	form.submit();
}

var TreeArray1 = new Array();
var TreeArray2 = new Array();
var Is_ex_Array = new Array();
<?php 
        $i = 1;
        foreach ($rows as $row) {
            if ($row->p_view) {
                echo "TreeArray1[" . $i . "] = " . $row->parent_id . ";";
                echo "TreeArray2[" . $i . "] = " . $row->id . ";";
                if (in_array($row->id, $rows_c)) {
                    echo "Is_ex_Array[" . $i . "] = 0;";
                } else {
                    echo "Is_ex_Array[" . $i . "] = 1;";
                }
                $i++;
            }
        }
        ?>
function Hide_Folder(fid) {
	var vis_style = 'hidden';
	var dis_style = 'none';
	var i = 1;
	while (i < TreeArray1.length) {
		if (TreeArray1[i] == fid) {
			getObj('tree_row_'+TreeArray2[i]).style.visibility = vis_style;
			getObj('tree_row_'+TreeArray2[i]).style.display = dis_style;
			Hide_Folder(TreeArray2[i])
		}
		i ++;
	}
}
function Show_Folder(fid) {
	var vis_style = 'visible';
	var dis_style = '';
	var i = 1;
	while (i < TreeArray1.length) {
		if (TreeArray1[i] == fid) {
			if (getObj('tree_row_'+TreeArray2[i])) {
				getObj('tree_row_'+TreeArray2[i]).style.display = dis_style;
				getObj('tree_row_'+TreeArray2[i]).style.visibility = vis_style;
			}
			NoChange_Folder(TreeArray2[i])
		}
		i ++;
	}
}
function NoChange_Folder(fid) {
	var vis_style = 'hidden';var dis_style = 'none';var i = 1;var j = 0;
	while (i < TreeArray2.length) {
		if ( (TreeArray2[i] == fid) && (Is_ex_Array[i] == 1) ) {
			vis_style = 'visible';
			dis_style = '';
			j = 1;
		}
		i ++;
	}
	i = 1;
	while (i < TreeArray1.length) {
		if (TreeArray1[i] == fid) {
			getObj('tree_row_'+TreeArray2[i]).style.visibility = vis_style;
			getObj('tree_row_'+TreeArray2[i]).style.display = dis_style;
			if (j == 1) { NoChange_Folder(TreeArray2[i]);
			} else { Hide_Folder(TreeArray2[i]); }
		}
		i ++;
	}
}
function Ex_Folder(fid) {
	var i = 1;
	var j = 1;
	while (i < TreeArray2.length) {
		if ( (TreeArray2[i] == fid) && (Is_ex_Array[i] == 1) ) { j = 0; }
		i ++;
	}
	if (j == 1) {
		Show_Folder(fid);
		if (getObj('tree_img_' + fid).runtimeStyle) {
			var StStr = getObj('tree_img_' + fid).runtimeStyle.filter;
			var imgStr = getObj('tree_img_' + fid).outerHTML;
			imgStr = imgStr.replace('expandall.png','collapseall.png').replace('<?php 
        echo _JLMS_DOCS_EXP_FOLDER;
        ?>
', '<?php 
        echo _JLMS_DOCS_COLL_FOLDER;
        ?>
');
			StStr = StStr.replace('expandall.png','collapseall.png');
			getObj('tree_img_' + fid).outerHTML = imgStr;
			getObj('tree_img_' + fid).runtimeStyle.filter = StStr;
		} else {
			getObj('tree_img_' + fid).src = '<?php 
        echo $JLMS_CONFIG->get('live_site');
        ?>
/components/com_joomla_lms/lms_images/docs/collapseall.png';
			getObj('tree_img_' + fid).alt = '<?php 
        echo _JLMS_DOCS_COLLAPSE;
        ?>
';
			getObj('tree_img_' + fid).title = '<?php 
        echo _JLMS_DOCS_COLL_FOLDER;
        ?>
';
		}
	} else {
		Hide_Folder(fid);
		if (getObj('tree_img_' + fid).runtimeStyle) {
			var StStr = getObj('tree_img_' + fid).runtimeStyle.filter;
			var imgStr = getObj('tree_img_' + fid).outerHTML;
			imgStr = imgStr.replace('collapseall.png','expandall.png').replace('<?php 
        echo _JLMS_DOCS_COLL_FOLDER;
        ?>
', '<?php 
        echo _JLMS_DOCS_EXP_FOLDER;
        ?>
');
			StStr = StStr.replace('collapseall.png','expandall.png');
			getObj('tree_img_' + fid).outerHTML = imgStr;
			getObj('tree_img_' + fid).runtimeStyle.filter = StStr;
		} else {
			getObj('tree_img_' + fid).src = '<?php 
        echo $JLMS_CONFIG->get('live_site');
        ?>
/components/com_joomla_lms/lms_images/docs/expandall.png';
			getObj('tree_img_' + fid).alt = '<?php 
        echo _JLMS_DOCS_EXPAND;
        ?>
';
			getObj('tree_img_' + fid).title = '<?php 
        echo _JLMS_DOCS_EXP_FOLDER;
        ?>
';
		}
	}
	i = 1;
	while (i < TreeArray2.length) {
		if ( (TreeArray2[i] == fid) ) {
			if (Is_ex_Array[i] == 1) { Is_ex_Array[i] = 0;
			} else { Is_ex_Array[i] = 1; }
		}
		i ++;
	}
}
<?php 
        if ($possibilities->manage && count($rows)) {
            ?>
var docs_save_blocked = false;
function Docs_WriteSysMsg(mes) {
	if (jlms_writetxt('joomlalms_sys_message', mes)) {
		getObj('joomlalms_sys_message_container').style.display = '';
		getObj('joomlalms_sys_message_container').style.visibility = 'visible';
	}
}
function Docs_save_view() {
	if (!docs_save_blocked) {
		var prepare_str = '';
		Docs_WriteSysMsg("<img src='<?php 
            echo $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('ajax_settings_small_indicator');
            ?>
' />");
		i = 1;
		var ps_pref = '';
		while (i < TreeArray2.length) {
			if (Is_ex_Array[i] == 0) {
				prepare_str = ''+ prepare_str + ps_pref + TreeArray2[i];
				ps_pref = '-';
			}
			i ++;
		}
		Docs_MakeRequest(prepare_str);
	}
}
function Docs_analize_req(http_request) {
	if (http_request.readyState == 4) {
		if ((http_request.status == 200)) {
			if(http_request.responseXML.documentElement == null){
				try {
					http_request.responseXML.loadXML(http_request.responseText)
				} catch (e) {
					/*alert("Can't load");*/
				}
			}
			response  = http_request.responseXML.documentElement;
			var mes = response.getElementsByTagName('message')[0].firstChild.data
		} else {
			var mes = "Request failed";
		}
		Docs_WriteSysMsg(mes);
		docs_save_blocked = false;
	}
}

function Docs_MakeRequest(req_str) {
	docs_save_blocked = true;
	var http_request = false;
	if (window.ActiveXObject) { // IE
		try { http_request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try { http_request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	} else if (window.XMLHttpRequest) { // Mozilla, Safari,...
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType) {
			http_request.overrideMimeType('text/xml');
		}
	}
	if (!http_request) {
		return false;
	}
	http_request.onreadystatechange = function() { Docs_analize_req(http_request); };
	var lp_url_prefix2 = '';
	var post_target = '<?php 
            echo $JLMS_CONFIG->get('ajax_settings_request_safe_path');
            ?>
';
	var url = 'task=documents_view_save&id=<?php 
            echo $id;
            ?>
&folders='+req_str;
	http_request.open("POST", post_target, true);
	http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	http_request.setRequestHeader("Content-length", url.length);
	//http_request.setRequestHeader("Connection", "close");
	http_request.send(url);
}
<?php 
        }
        ?>
JLMS_preloadImages('<?php 
        echo $JLMS_CONFIG->get('live_site');
        ?>
/components/com_joomla_lms/lms_images/docs/expandall.png','<?php 
        echo $JLMS_CONFIG->get('live_site');
        ?>
/components/com_joomla_lms/lms_images/docs/collapseall.png'<?php 
        echo ", '" . $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('ajax_settings_small_indicator') . "'";
        ?>
);
//--><!]]>
</script>
<?php 
        JLMS_TMPL::OpenMT();
        $hparams = array();
        $toolbar = array();
        if ($JLMS_ACL->CheckPermissions('docs', 'manage') && count($rows)) {
            // this feature is available only for users who has 'documents' manage permission (for entire tool)
            $toolbar[] = array('btn_type' => 'save', 'btn_js' => "javascript:Docs_save_view();", 'btn_title' => _JLMS_DOCS_SAVE_VIEW_TITLE);
        }
        JLMS_TMPL::ShowHeader('docs', _JLMS_DOCS_COURSE_DOCS, $hparams, $toolbar);
        $max_tree_width = 0;
        if (isset($rows[0])) {
            $max_tree_width = $rows[0]->tree_max_width;
        }
        JLMS_TMPL::OpenTS();
        ?>
			<form action="<?php 
        echo $JLMS_CONFIG->get('live_site') . "/index.php?option=" . $option . "&amp;Itemid=" . $Itemid;
        ?>
" method="post" name="adminForm" enctype="multipart/form-data">
<?php 
        if (!empty($rows)) {
            ?>
				<table width="100%" cellpadding="0" cellspacing="0" border="0" id="jlms_doc_non_scr" class="<?php 
            echo JLMSCSS::_('jlmslist');
            ?>
">
					<tr>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 width="20" class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" align="center">#</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<?php 
            if ($possibilities->manage || $possibilities->publish) {
                ?>
						<<?php 
                echo JLMSCSS::tableheadertag();
                ?>
 width="20" class="<?php 
                echo JLMSCSS::_('sectiontableheader');
                ?>
"><input type="checkbox" value="0" name="fake_checkbox" style="visibility:hidden" /></<?php 
                echo JLMSCSS::tableheadertag();
                ?>
>
					<?php 
            }
            ?>
					<?php 
            for ($th_i = 0; $th_i < $max_tree_width + 1; $th_i++) {
                ?>
						<<?php 
                echo JLMSCSS::tableheadertag();
                ?>
 width="16" class="<?php 
                echo JLMSCSS::_('sectiontableheader');
                ?>
">&nbsp;</<?php 
                echo JLMSCSS::tableheadertag();
                ?>
>
						<?php 
            }
            ?>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" width="45%"><span style="display:block; width:150px; text-align:left;"><?php 
            echo _JLMS_DOCS_TBL_DOCNAME;
            ?>
</span></<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<?php 
            if ($possibilities->order) {
                ?>
						<<?php 
                echo JLMSCSS::tableheadertag();
                ?>
 class="<?php 
                echo JLMSCSS::_('sectiontableheader');
                ?>
" colspan="2" width="1">
						<?php 
                echo JText::_(_JLMS_REORDER);
                ?>
						</<?php 
                echo JLMSCSS::tableheadertag();
                ?>
>
						<<?php 
                echo JLMSCSS::tableheadertag();
                ?>
 class="<?php 
                echo JLMSCSS::_('sectiontableheader');
                ?>
" width="1">
							<?php 
                echo _JLMS_ORDER;
                ?>
						</<?php 
                echo JLMSCSS::tableheadertag();
                ?>
>
						<<?php 
                echo JLMSCSS::tableheadertag();
                ?>
 class="<?php 
                echo JLMSCSS::_('sectiontableheader');
                ?>
" width="1">
						<a href="javascript:saveorder(<?php 
                echo count($rows) - 1;
                ?>
, 'doc_saveorder');">
							<img src="<?php 
                echo $lms_img_path;
                ?>
/toolbar/tlb_filesave.png" border="0" width="16" height="16" alt="<?php 
                echo _JLMS_SAVEORDER;
                ?>
" title="<?php 
                echo _JLMS_SAVEORDER;
                ?>
" />
						</a>
						</<?php 
                echo JLMSCSS::tableheadertag();
                ?>
>
					<?php 
            }
            ?>
					<?php 
            if ($possibilities->manage || $possibilities->publish) {
                ?>
						<<?php 
                echo JLMSCSS::tableheadertag();
                ?>
 class="<?php 
                echo JLMSCSS::_('sectiontableheader');
                ?>
" width="1">&nbsp;</<?php 
                echo JLMSCSS::tableheadertag();
                ?>
>
						<<?php 
                echo JLMSCSS::tableheadertag();
                ?>
 class="<?php 
                echo JLMSCSS::_('sectiontableheader');
                ?>
"><?php 
                echo _JLMS_DOCS_TBL_STARTING;
                ?>
</<?php 
                echo JLMSCSS::tableheadertag();
                ?>
>
						<<?php 
                echo JLMSCSS::tableheadertag();
                ?>
 class="<?php 
                echo JLMSCSS::_('sectiontableheader');
                ?>
"><?php 
                echo _JLMS_DOCS_TBL_ENDING;
                ?>
</<?php 
                echo JLMSCSS::tableheadertag();
                ?>
>
					<?php 
            }
            ?>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" width="60%"><span style="display:block; width:110px;"><?php 
            echo _JLMS_DOCS_TBL_DESCR;
            ?>
</span></<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					</tr>
				<?php 
            $k = 1;
            $tree_modes = array();
            $visible_folder = true;
            //$next_row_is_visible = true;
            $vis_mode = 0;
            $doc_number = 1;
            for ($i = 0, $n = count($rows); $i < $n; $i++) {
                $row = $rows[$i];
                if ($row->p_view) {
                    // if user can view this item
                    $max_tree_width = $row->tree_max_width;
                    $link = '';
                    $link_title = '';
                    if ($row->folder_flag == 2) {
                        $link = sefRelToAbs("index.php?option=" . $option . "&amp;Itemid=" . $Itemid . "&amp;task=docs_view_zip&amp;course_id=" . $id . "&amp;id=" . $row->id);
                        $link_title = _JLMS_T_A_VIEW_ZIP_PACK;
                    } elseif ((!$row->folder_flag || $row->folder_flag == 3) && $row->file_id) {
                        $link = sefRelToAbs("index.php?option=" . $option . "&amp;Itemid=" . $Itemid . "&amp;task=get_document&amp;course_id=" . $id . "&amp;id=" . $row->id);
                        $link_title = _JLMS_DOCS_LINK_DOWNLOAD;
                    } elseif ((!$row->folder_flag || $row->folder_flag == 3) && !$row->file_id) {
                        $link = sefRelToAbs("index.php?option=" . $option . "&amp;Itemid=" . $Itemid . "&amp;task=docs_view_content&amp;course_id=" . $id . "&amp;id=" . $row->id);
                        $link_title = _JLMS_T_A_VIEW_CONTENT;
                    }
                    $time_p = $row->publish_start || $row->publish_end;
                    $alt = $row->published ? $time_p ? _JLMS_STATUS_PUB2 : _JLMS_STATUS_PUB : _JLMS_STATUS_UNPUB;
                    $image = $row->published ? $time_p ? 'btn_publish_wait.png' : 'btn_accept.png' : 'btn_cancel.png';
                    //($time_p?'btn_unpublish_wait.png':'btn_cancel.png');
                    $start_date_txt = '';
                    $end_date_txt = '';
                    $released_info_txt = '';
                    if ($row->is_time_related) {
                        $released_info_txt = _JLMS_WILL_BE_RELEASED_IN;
                        $showperiod = $row->show_period;
                        $ost1 = $showperiod % (24 * 60);
                        $sp_days = ($showperiod - $ost1) / (24 * 60);
                        $ost2 = $showperiod % 60;
                        $sp_hours = ($ost1 - $ost2) / 60;
                        $sp_mins = $ost2;
                        $released_info_time = false;
                        if ($sp_days) {
                            $released_info_txt .= ' ' . $sp_days . ' ' . _JLMS_RELEASED_IN_DAYS;
                            $released_info_time = true;
                        }
                        if ($sp_hours) {
                            $released_info_txt .= ' ' . $sp_hours . ' ' . _JLMS_RELEASED_IN_HOURS;
                            $released_info_time = true;
                        }
                        if ($sp_mins) {
                            $released_info_txt .= ' ' . $sp_mins . ' ' . _JLMS_RELEASED_IN_MINUTES;
                            $released_info_time = true;
                        }
                        if ($released_info_time) {
                            $released_info_txt .= ' ' . _JLMS_RELEASED_AFTER_ENROLLMENT;
                        }
                    }
                    if ($time_p) {
                        $is_expired = false;
                        if ($row->publish_end) {
                            $end_date_txt = _JLMS_COURSES_END_DATE . ': ' . $row->end_date;
                            $e_date = strtotime($row->end_date);
                            if ($e_date < time()) {
                                $is_expired = true;
                            }
                        }
                        if ($row->publish_start) {
                            $start_date_txt = _JLMS_COURSES_ST_DATE . ': ' . $row->start_date;
                        }
                        if ($is_expired) {
                            $alt = _JLMS_STATUS_EXPIRED;
                            $image = 'btn_expired.png';
                        } elseif ($row->publish_start && !$is_expired) {
                            $s_date = strtotime($row->start_date);
                            if ($s_date > time()) {
                                $alt = _JLMS_STATUS_UPCOMING;
                                $image = 'btn_expired.png';
                            }
                        }
                    }
                    $state = $row->published ? 0 : 1;
                    $checked = mosHTML::idBox($i, $row->id);
                    $manage_item = false;
                    $publish_item = false;
                    if ($row->p_manage) {
                        //JLMS_ACL->CheckPermissions('docs', 'manage')) {
                        $manage_item = true;
                    }
                    if ($row->p_publish) {
                        //$JLMS_ACL->CheckPermissions('docs', 'publish')) {
                        $publish_item = true;
                    }
                    if ($JLMS_ACL->CheckPermissions('docs', 'only_own_items') && $row->owner_id != $user->get('id')) {
                        $manage_item = false;
                        $publish_item = false;
                    } elseif ($JLMS_ACL->CheckPermissions('docs', 'only_own_role') && $JLMS_ACL->GetRole() != $JLMS_ACL->UserSystemRole($db, $row->owner_id)) {
                        $manage_item = false;
                        $publish_item = false;
                    }
                    if (!$publish_item && !$manage_item) {
                        $checked = '&nbsp;';
                    }
                    // Collapsed/Expanded view
                    $tree_row_style = '';
                    $visible_folder = true;
                    //$next_row_is_visible;
                    //$next_row_is_visible = true;
                    if ($vis_mode) {
                        if ($row->tree_mode_num < $vis_mode) {
                            $vis_mode = 0;
                        }
                    }
                    if (in_array($row->id, $rows_c)) {
                        //$next_row_is_visible = false;
                        if ($vis_mode) {
                            if ($row->tree_mode_num < $vis_mode) {
                                $vis_mode = $row->tree_mode_num;
                            } else {
                                $visible_folder = false;
                            }
                        } else {
                            $vis_mode = $row->tree_mode_num + 1;
                        }
                    } elseif ($vis_mode) {
                        if ($row->tree_mode_num >= $vis_mode) {
                            $visible_folder = false;
                        } else {
                            $vis_mode = 0;
                        }
                    }
                    if (!$visible_folder) {
                        $tree_row_style = ' style="visibility:hidden;display:none"';
                    }
                    ?>
					<tr id="tree_row_<?php 
                    echo $row->id;
                    ?>
" class="<?php 
                    echo JLMSCSS::_('sectiontableentry' . $k);
                    ?>
"<?php 
                    echo $tree_row_style;
                    ?>
>
						<td align="center" valign="middle"><?php 
                    echo $doc_number;
                    ?>
</td>
					<?php 
                    if ($possibilities->manage || $possibilities->publish) {
                        ?>
						<td valign="middle"><?php 
                        echo $row->p_manage || $row->p_publish ? $checked : '<input type="checkbox" value="0" name="fake_checkbox' . $row->id . '" style="visibility:hidden" />';
                        ?>
</td>
					<?php 
                    }
                    ?>
						<?php 
                    $add_img = '';
                    if ($row->tree_mode_num) {
                        $g = 0;
                        $tree_modes[$row->tree_mode_num - 1] = $row->tree_mode;
                        while ($g < $row->tree_mode_num - 1) {
                            $pref = '';
                            if (isset($tree_modes[$g]) && $tree_modes[$g] == 2) {
                                $pref = 'empty_';
                            }
                            $add_img .= "<td width='16' valign='middle'><img src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/treeview/" . $pref . "line.png\" width='16' height='16' alt='" . $pref . "line' /></td>";
                            $g++;
                        }
                        $add_img .= "<td width='16' valign='middle'><img src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/treeview/sub" . $row->tree_mode . ".png\" width='16' height='16' alt='sub" . $row->tree_mode . "' /></td>";
                        $max_tree_width = $max_tree_width - $g - 1;
                    }
                    echo $add_img;
                    ?>
						<td align="center" valign="middle" width='16'>
						<?php 
                    if ($row->folder_flag == 1) {
                        $collapse_img = 'collapseall.png';
                        $collapse_alt = _JLMS_DOCS_COLL_FOLDER;
                        if (in_array($row->id, $rows_c)) {
                            $collapse_img = 'expandall.png';
                            $collapse_alt = _JLMS_DOCS_EXP_FOLDER;
                        }
                        echo "<a class='jlms_img_link' id='tree_div_" . $row->id . "' style='alignment:center; width:16px; font-weight:bold; cursor:pointer; vertical-align:middle;' onclick='Ex_Folder(" . $row->id . "," . $row->id . ",true)' href='javascript:void(0);'><img class='JLMS_png' id='tree_img_" . $row->id . "' src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/docs/{$collapse_img}\" width='13' height='13' border='0' alt='" . $collapse_alt . "' title='" . $collapse_alt . "' /></a>";
                    } else {
                        echo "<span style='alignment:center; width:16px; font-weight:bold; vertical-align:middle;'><img class='JLMS_png' src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/files/" . $row->file_icon . ".png\" width='16' height='16' alt='{$row->file_icon}' /></span>";
                    }
                    ?>
						</td>
						<td align="left" valign="middle" <?php 
                    if ($max_tree_width > 0) {
                        echo "colspan='" . ($max_tree_width + 1) . "'";
                    }
                    ?>
 width="<?php 
                    echo $row->tree_mode_num == $row->tree_max_width ? '85' : '45';
                    ?>
%">
						<span style='font-weight:bold; vertical-align:middle;'>
						<?php 
                    if ($row->folder_flag == 1) {
                        echo '&nbsp;<strong>' . $row->doc_name . '</strong>';
                    } else {
                        if (!isset($row->is_link)) {
                            ?>
							<a href="<?php 
                            echo $link;
                            ?>
" title="<?php 
                            echo str_replace('"', '&quot;', $row->doc_name);
                            ?>
">
								&nbsp;<?php 
                            echo $row->doc_name;
                            ?>
							</a>
						<?php 
                        } else {
                            echo $row->doc_name;
                        }
                    }
                    ?>
						</span>
						<?php 
                    if ($JLMS_CONFIG->get('show_docs_authors', 0) && $row->author_name) {
                        ?>
						<br />
						<span class="small"><?php 
                        echo _JLMS_HOME_AUTHOR . "&nbsp;" . $row->author_name;
                        ?>
</span>
						<?php 
                    }
                    ?>
						</td>
					<?php 
                    if ($possibilities->order) {
                        ?>
						<td valign="middle" style="vertical-align:middle "><?php 
                        if ($row->allow_up == 1 && $row->p_order) {
                            echo JLMS_orderUpIcon(1, $row->id, true, 'doc_orderup');
                        } else {
                            echo '&nbsp;';
                        }
                        ?>
</td>
						<td valign="middle" style="vertical-align:middle "><?php 
                        if ($row->allow_down == 1 && $row->p_order) {
                            echo JLMS_orderDownIcon(1, 3, $row->id, true, 'doc_orderdown');
                        } else {
                            echo '&nbsp;';
                        }
                        ?>
</td>
						<td valign="middle" align="center" style="vertical-align:middle; text-align: center; " colspan="2">
							<input type="text" name="order[]" size="5" value="<?php 
                        echo $row->ordering;
                        ?>
" class="inputbox" style="text-align: center;" />
						</td>
					<?php 
                    }
                    ?>
					<?php 
                    if ($possibilities->manage || $possibilities->publish) {
                        ?>
						<td valign="middle">
						<?php 
                        if ($publish_item) {
                            $title = $alt;
                            $content = '';
                            if ($start_date_txt) {
                                $content .= $start_date_txt . '<br />';
                            }
                            if ($end_date_txt) {
                                $content .= $end_date_txt . '<br />';
                            }
                            if ($released_info_txt) {
                                $content .= $released_info_txt . '<br />';
                            }
                            if ($row->is_time_related) {
                                if ($image == 'btn_accept.png') {
                                    $image = 'btn_publish_wait.png';
                                }
                            }
                            $name = '<img class="JLMS_png" src="' . $JLMS_CONFIG->get('live_site') . '/components/com_joomla_lms/lms_images/toolbar/' . $image . '" width="16" height="16" border="0" alt="' . $alt . '" />';
                            $link = 'javascript:submitbutton_change2(\'change_doc\',' . $state . ',' . $row->id . ')';
                            echo JLMS_toolTip($title, $content, $name, $link);
                        } else {
                            echo '<img class="JLMS_png" src="' . $JLMS_CONFIG->get('live_site') . '/components/com_joomla_lms/lms_images/toolbar/' . $image . '" width="16" height="16" border="0" alt="' . $alt . '" />';
                        }
                        ?>
						</td>
						<td align="center" nowrap='nowrap' valign="middle"><?php 
                        echo $row->publish_start ? JLMS_dateToDisplay($row->start_date) : '-';
                        ?>
</td>
						<td align="center" nowrap='nowrap' valign="middle"><?php 
                        echo $row->publish_end ? JLMS_dateToDisplay($row->end_date) : '-';
                        ?>
</td>
					<?php 
                    }
                    ?>
						<td><?php 
                    $doc_descr = strip_tags($row->doc_description);
                    $doc_descr = trim($doc_descr);
                    if (!$row->folder_flag && !$row->file_id) {
                        if (strlen($doc_descr) > 75) {
                            $doc_descr = substr($doc_descr, 0, 75) . "...";
                        }
                    }
                    echo $doc_descr ? $doc_descr : '&nbsp;';
                    ?>
						</td>
					</tr>
					<?php 
                    $k = 3 - $k;
                    $doc_number++;
                }
                // end "if ($row->p_view)"
            }
            ?>
				</table>
<?php 
        } else {
            echo '<div class="joomlalms_user_message">' . _JLMS_NO_ITEMS_HERE . '</div>';
        }
        ?>
				<input type="hidden" name="option" value="<?php 
        echo $option;
        ?>
" />
				<input type="hidden" name="Itemid" value="<?php 
        echo $Itemid;
        ?>
" />
				<input type="hidden" name="task" value="" />
				<input type="hidden" name="boxchecked" value="0" />
				<input type="hidden" name="id" value="<?php 
        echo $id;
        ?>
" />
				<input type="hidden" name="row_id" value="0" />
				<input type="hidden" name="state" value="0" />
				<input type="hidden" name="cid2" value="0" />
			</form>
			<noscript>
			<style type="text/css">
			 #jlms_doc_non_scr tr.sectiontableentry1, #jlms_doc_non_scr tr.sectiontableentry2 {
			 display: table-row !important;
			 visibility:visible !important;
			 }
			</style>
			<!--[if IE]>
			<style type="text/css">
			 #jlms_doc_non_scr tr.sectiontableentry1, #jlms_doc_non_scr tr.sectiontableentry2 {
				 display: block !important;
				 visibility:visible !important;
			 }
			</style>
			<![endif]-->
			</noscript>
<?php 
        JLMS_TMPL::CloseTS();
        $controls = array();
        if ($possibilities->publish) {
            $controls[] = array('href' => "javascript:submitbutton_change('change_doc',1);", 'title' => _JLMS_SET_PUB, 'img' => 'publish');
            $controls[] = array('href' => "javascript:submitbutton_change('change_doc',0);", 'title' => _JLMS_SET_UNPUB, 'img' => 'unpublish');
            if ($possibilities->manage) {
                $controls[] = array('href' => 'spacer');
            }
        }
        if ($possibilities->create) {
            $link_foldernew = ampReplace(sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=new_folder&amp;id={$id}"));
            $link_filenew = ampReplace(sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=new_document&amp;id={$id}"));
            $controls[] = array('href' => $link_foldernew, 'title' => _JLMS_DOCS_LNK_NEW_FOLDER, 'img' => 'foldernew');
            $controls[] = array('href' => $link_filenew, 'title' => _JLMS_DOCS_LNK_NEW_DOC, 'img' => 'filenew');
        }
        if ($possibilities->manage) {
            $controls[] = array('href' => "javascript:submitbutton('doc_delete');", 'title' => _JLMS_DELETE, 'img' => 'delete');
            $controls[] = array('href' => "javascript:submitbutton('edit_doc');", 'title' => _JLMS_EDIT, 'img' => 'edit');
        }
        if ($JLMS_ACL->CheckPermissions('docs', 'manage')) {
            $controls[] = array('href' => "javascript:submitbutton('add_doclink');", 'title' => _JLMS_DOCS_ADD_FROM_LIBRARY, 'img' => 'add_library');
        }
        if (count($controls)) {
            JLMS_TMPL::ShowControlsFooter($controls);
        }
        JLMS_TMPL::CloseMT();
    }
    function showHomeWorks($id, $option, &$rows, &$pageNav, $usertype = 1)
    {
        global $JLMS_CONFIG;
        $Itemid = $JLMS_CONFIG->get('Itemid');
        $JLMS_ACL =& JLMSFactory::getACL();
        if ($JLMS_ACL->CheckPermissions('homework', 'manage')) {
            ?>
<script language="javascript" type="text/javascript">
<!--//--><![CDATA[//><!--
function submitbutton(pressbutton) {
	var form = document.adminForm;
	if ( ((pressbutton == 'hw_delete') || (pressbutton == 'hw_edit')) && (form.boxchecked.value == "0")){
		alert("<?php 
            echo _JLMS_ALERT_SELECT_ITEM;
            ?>
");
	} else {
		form.task.value = pressbutton;
		form.submit();
	}
}

function submitbutton_change2(pressbutton, state, cid_id) {
	var form = document.adminForm;
	if (pressbutton == 'hw_publish'){
		form.task.value = pressbutton;
		form.state.value = state;
		form.cid2.value = cid_id;
		form.submit();
	}
}

//--><!]]>
</script>
<?php 
        }
        JLMS_TMPL::OpenMT();
        $hparams = array();
        JLMS_TMPL::ShowHeader('homework', _JLMS_HW_TITLE_HW, $hparams);
        JLMS_TMPL::OpenTS();
        ?>
		<form action="<?php 
        echo sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}");
        ?>
" method="post" name="adminForm">
<?php 
        if (!empty($rows)) {
            ?>
				<?php 
            $hw_colspan = 5;
            ?>
				<table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php 
            echo JLMSCSS::_('jlmslist');
            ?>
">
					<tr>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 width="20" class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" align="center">#</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
						<?php 
            //						if ($usertype == 1) {
            if ($JLMS_ACL->CheckPermissions('homework', 'manage')) {
                $hw_colspan++;
                ?>
						<<?php 
                echo JLMSCSS::tableheadertag();
                ?>
 width="20" class="<?php 
                echo JLMSCSS::_('sectiontableheader');
                ?>
" align="center"><input type="checkbox" name="toggle" value="" onclick="checkAll(<?php 
                echo count($rows);
                ?>
);" /></<?php 
                echo JLMSCSS::tableheadertag();
                ?>
>
						<?php 
            }
            ?>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" width="30%"><?php 
            echo _JLMS_HW_TBL_HEAD_HW;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" nowrap='nowrap' style="white-space:nowrap"><?php 
            echo _JLMS_HW_TBL_HEAD_DATE;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" nowrap='nowrap' style="white-space:nowrap"><?php 
            echo _JLMS_HW_TBL_HEAD_ENDDATE;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<?php 
            if ($JLMS_ACL->CheckPermissions('homework', 'manage')) {
                $hw_colspan++;
                ?>
						<<?php 
                echo JLMSCSS::tableheadertag();
                ?>
 class="<?php 
                echo JLMSCSS::_('sectiontableheader');
                ?>
" nowrap='nowrap' style="white-space:nowrap">&nbsp;</<?php 
                echo JLMSCSS::tableheadertag();
                ?>
>
					<?php 
            }
            ?>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" width="50%"><?php 
            echo _JLMS_HW_TBL_HEAD_DESCR;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					</tr>
				<?php 
            $k = 1;
            for ($i = 0, $n = count($rows); $i < $n; $i++) {
                $row = $rows[$i];
                $link = "index.php?option={$option}&Itemid={$Itemid}&task=hw_stats&course_id={$id}&id={$row->id}";
                $alt = $row->published ? _JLMS_STATUS_PUB : _JLMS_STATUS_UNPUB;
                $image = $row->published ? 'btn_accept.png' : 'btn_cancel.png';
                $state = $row->published ? 0 : 1;
                $tooltip_txt = '';
                $tooltip_title = '';
                if ($row->is_time_related) {
                    if ($row->published) {
                        $image = 'btn_publish_wait.png';
                        $tooltip_title = _JLMS_STATUS_PUB;
                    } else {
                        $image = 'btn_unpublish_wait.png';
                        $tooltip_title = _JLMS_STATUS_UNPUB;
                    }
                    $tooltip_txt = _JLMS_WILL_BE_RELEASED_IN;
                    $showperiod = $row->show_period;
                    $ost1 = $showperiod % (24 * 60);
                    $sp_days = ($showperiod - $ost1) / (24 * 60);
                    $ost2 = $showperiod % 60;
                    $sp_hours = ($ost1 - $ost2) / 60;
                    $sp_mins = $ost2;
                    $release_time_info = false;
                    if ($sp_days) {
                        $tooltip_txt .= ' ' . $sp_days . ' ' . _JLMS_RELEASED_IN_DAYS;
                        $release_time_info = true;
                    }
                    if ($sp_hours) {
                        $tooltip_txt .= ' ' . $sp_hours . ' ' . _JLMS_RELEASED_IN_HOURS;
                        $release_time_info = true;
                    }
                    if ($sp_mins) {
                        $tooltip_txt .= ' ' . $sp_mins . ' ' . _JLMS_RELEASED_IN_MINUTES;
                        $release_time_info = true;
                    }
                    if ($release_time_info) {
                        $tooltip_txt .= ' ' . _JLMS_RELEASED_AFTER_ENROLLMENT;
                    }
                }
                $checked = '';
                if ($JLMS_ACL->CheckPermissions('homework', 'manage')) {
                    $checked = mosHTML::idBox($i, $row->id, $row->checkedout);
                }
                ?>
					<tr class="<?php 
                echo JLMSCSS::_('sectiontableentry' . $k);
                ?>
">
						<td align="center"><?php 
                echo $pageNav->limitstart + $i + 1;
                ?>
</td>
						<?php 
                if ($JLMS_ACL->CheckPermissions('homework', 'manage')) {
                    echo '<td>' . $checked . '</td>';
                }
                ?>
						<td align="left" valign="middle" style="vertical-align:middle ">
							<a href="<?php 
                echo sefRelToAbs($link);
                ?>
" title="<?php 
                echo str_replace('"', '&nbsp;', $row->hw_name);
                ?>
">
								<?php 
                echo $row->hw_name;
                ?>
							</a>
						</td>
						<td valign="middle" style="vertical-align:middle" nowrap="nowrap">
							<?php 
                echo JLMS_dateToDisplay($row->post_date);
                ?>
						</td>
						<td valign="middle" style="vertical-align:middle" nowrap="nowrap">
							<?php 
                echo JLMS_dateToDisplay($row->end_date);
                ?>
						</td>
					<?php 
                if ($JLMS_ACL->CheckPermissions('homework', 'manage')) {
                    ?>
						<td valign="middle">
						<?php 
                    if ($row->is_time_related) {
                        $tooltip_link = 'javascript:submitbutton_change2(\'hw_publish\',' . $state . ',' . $row->id . ')';
                        $tooltip_name = '<img class="JLMS_png" src="' . $JLMS_CONFIG->get('live_site') . '/components/com_joomla_lms/lms_images/toolbar/' . $image . '" width="16" height="16" border="0" alt="' . $alt . '" />';
                        echo JLMS_toolTip($tooltip_title, $tooltip_txt, $tooltip_name, $tooltip_link);
                    } else {
                        echo '<a class="jlms_img_link" href="javascript:submitbutton_change2(\'hw_publish\',' . $state . ',' . $row->id . ')" title="' . $alt . '">';
                        echo '<img class="JLMS_png" src="' . $JLMS_CONFIG->get('live_site') . '/components/com_joomla_lms/lms_images/toolbar/' . $image . '" width="16" height="16" border="0" alt="' . $alt . '" />';
                        echo '</a>';
                    }
                    ?>
						</td>
					<?php 
                }
                ?>
						<td valign="middle" style="vertical-align:middle "><?php 
                echo $row->hw_shortdescription ? $row->hw_shortdescription : '&nbsp;';
                ?>
</td>
					</tr>
					<?php 
                $k = 3 - $k;
            }
            ?>
				
				<tr>
					<td align="center" class="<?php 
            echo JLMSCSS::_('jlmslist-footer_td');
            ?>
" colspan="<?php 
            echo $hw_colspan;
            ?>
"><div align="center" style="white-space:nowrap;">
					<?php 
            $link = "index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=homework&amp;id={$id}";
            echo _JLMS_PN_DISPLAY_NUM . $pageNav->getLimitBox($link) . '&nbsp;' . $pageNav->getPagesCounter();
            echo '<br />';
            echo $pageNav->writePagesLinks($link);
            ?>
 
					</div></td>
				</tr>
				</table>
<?php 
        } else {
            echo '<div class="joomlalms_user_message">' . _JLMS_NO_ITEMS_HERE . '</div>';
        }
        ?>
		<input type="hidden" name="option" value="<?php 
        echo $option;
        ?>
" />
		<input type="hidden" name="Itemid" value="<?php 
        echo $Itemid;
        ?>
" />
		<input type="hidden" name="task" value="homework" />
		<input type="hidden" name="boxchecked" value="0" />
		<input type="hidden" name="id" value="<?php 
        echo $id;
        ?>
" />
		<input type="hidden" name="state" value="0" />
		<input type="hidden" name="cid2" value="0" />
		</form>
<?php 
        JLMS_TMPL::CloseTS();
        if ($id && $JLMS_ACL->CheckPermissions('homework', 'manage')) {
            $link_new = sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=hw_create&id={$id}");
            $controls = array();
            $controls[] = array('href' => $link_new, 'onclick' => "", 'title' => _JLMS_HW_IMG_NEW_HW, 'img' => 'add');
            $controls[] = array('href' => "javascript:submitbutton('hw_delete');", 'title' => _JLMS_HW_IMG_DEL_HW, 'img' => 'delete');
            $controls[] = array('href' => "javascript:submitbutton('hw_edit');", 'title' => _JLMS_HW_IMG_EDIT_HW, 'img' => 'edit');
            JLMS_TMPL::ShowControlsFooter($controls);
        }
        JLMS_TMPL::CloseMT();
    }
    function showCourseDropBox($course_id, $option, &$rows, &$lists)
    {
        global $Itemid, $my, $JLMS_CONFIG;
        ?>
<script language="javascript" type="text/javascript">
<!--//--><![CDATA[//><!--
function submitbutton(pressbutton) {
	var form = document.adminForm;
	if ((pressbutton == 'del_dropbox') && (form.boxchecked.value == '0')) {
		alert( "<?php 
        echo _JLMS_ALERT_SELECT_ITEM;
        ?>
" );
	} else {
		form.task.value = pressbutton;
		form.submit();
	}
}

function submitbutton_change(pressbutton, state) {
	var form = document.adminForm;
	if (pressbutton == 'change_dropbox'){
		if (form.boxchecked.value == '0') {
			alert('<?php 
        echo _JLMS_DROP_SELECT_ITEM;
        ?>
');
		} else {
			form.task.value = pressbutton;
			form.state.value = state;
			form.submit();
		}
	}
}
function submitbutton_change2(pressbutton, state, cid_id) {
	var form = document.adminForm;
	if (pressbutton == 'change_dropbox'){
		form.task.value = pressbutton;
		form.state.value = state;
		form.cid2.value = cid_id;
		form.submit();
	}
}
//--><!]]>
</script>
<?php 
        JLMS_TMPL::OpenMT();
        $hparams = array();
        JLMS_TMPL::ShowHeader('dropbox', _JLMS_DROP_TITLE, $hparams);
        JLMS_TMPL::OpenTS();
        ?>
		<form action="<?php 
        echo sefRelToAbs("index.php?option=" . $option . "&amp;Itemid=" . $Itemid);
        ?>
" method="post" name="adminForm">
<?php 
        if (!empty($rows)) {
            ?>
			<table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php 
            echo JLMSCSS::_('jlmslist');
            ?>
">
				<tr>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 colspan="8" class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
">
						<table width="100%" cellpadding="0" cellspacing="0" border="0">
							<tr>
								<td width="50%" align="center">
									<?php 
            echo _JLMS_DROP_INBOX . ' ' . $lists['dropbox_in_new'] . ' / ' . $lists['dropbox_in_total'];
            ?>
								</td>
								<td width="50%" align="center">
									<?php 
            echo _JLMS_DROP_OUTBOX . ' ' . $lists['dropbox_out_total'];
            ?>
								</td>
							</tr>
						</table>
					</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
				</tr>
				<tr>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 width="20" class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" align="center">#</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 width="20" class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" align="center"><input type="checkbox" name="toggle" value="" onclick="checkAll(<?php 
            echo count($rows);
            ?>
);" /></<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" width="16">&nbsp;</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
"><?php 
            echo _JLMS_DROP_TBL_HEAD_NAME;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
"><?php 
            echo _JLMS_DROP_TBL_HEAD_FROM;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
"><?php 
            echo _JLMS_DROP_TBL_HEAD_TO;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
"><?php 
            echo _JLMS_DROP_TBL_HEAD_CORRECTED;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
"><?php 
            echo _JLMS_DROP_TBL_HEAD_DESCR;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
				</tr>
			<?php 
            $k = 1;
            for ($i = 0, $n = count($rows); $i < $n; $i++) {
                $row = $rows[$i];
                $link = sefRelToAbs("index.php?option=" . $option . "&amp;Itemid=" . $Itemid . "&amp;task=get_frombox&amp;course_id=" . $course_id . "&amp;id=" . $row->id);
                $checked = mosHTML::idBox($i, $row->id);
                $mark_read = 1;
                if ($row->drp_mark == 1 && $row->recv_id == $my->id) {
                    $mark_read = 0;
                }
                if ($mark_read) {
                    $alt = _JLMS_DROP_STATUS_READ;
                    $image = 'btn_drp_readed.png';
                    $state = 1;
                } else {
                    $alt = _JLMS_DROP_STATUS_UNREAD;
                    $image = 'btn_drp_unreaded.png';
                    $state = 0;
                }
                $state = 0;
                // 23.11.2006 - Bjarne request
                #if ($row->drp_mark == 1) { $alt = _JLMS_DROP_STATUS_READ; } elseif ($row->drp_mark == 2) { $alt = _JLMS_DROP_STATUS_CORRECT; } else { $alt = _JLMS_DROP_STATUS_UNREAD; }
                #if ($row->drp_mark == 1) { $image = 'btn_drp_readed.png'; } elseif ($row->drp_mark == 2) { $image = 'btn_drp_corrected.png'; } else { $image = 'btn_drp_unreaded.png'; }
                #if ($row->drp_mark == 1) { $state = 2; } elseif ($row->drp_mark == 2) { $state = 0; } else { $state = 1; }
                ?>
				<tr class="<?php 
                echo JLMSCSS::_('sectiontableentry' . $k);
                ?>
">
					<td align="center" valign="middle"><?php 
                echo $i + 1;
                ?>
</td>
					<td align="center" valign="middle"><?php 
                echo $checked;
                ?>
</td>
					<td align="center" valign="middle">
<?php 
                echo '<a class="jlms_img_link" href="javascript:submitbutton_change2(\'change_dropbox\',' . $state . ',' . $row->id . ')" title="' . $alt . '">';
                echo '<img class="JLMS_png" src="' . $JLMS_CONFIG->get('live_site') . '/components/com_joomla_lms/lms_images/toolbar/' . $image . '" width="16" height="16" border="0" alt="' . $alt . '" />';
                echo '</a>';
                ?>
					</td>
					<td align="left" valign="middle">
					<?php 
                if (!$mark_read) {
                    echo '<strong>';
                }
                ?>
						<a href="<?php 
                echo $link;
                ?>
" title="<?php 
                echo str_replace('"', '&quot;', $row->drp_name);
                ?>
">
							<?php 
                echo $row->drp_name;
                ?>
						</a>
					<?php 
                if (!$mark_read) {
                    echo '</strong>';
                }
                ?>
					</td>
					<td valign="middle"><?php 
                echo $row->owner_username;
                ?>
</td>
					<td valign="middle"><?php 
                echo $row->recv_username;
                ?>
</td>
					<td valign="middle"><?php 
                if ($row->drp_corrected) {
                    ?>
						<img class="JLMS_png" src="<?php 
                    echo $JLMS_CONFIG->get('live_site');
                    ?>
/components/com_joomla_lms/lms_images/toolbar/btn_accept.png" width="16" height="16" alt="<?php 
                    echo _JLMS_DROP_STATUS_CORRECT;
                    ?>
" title="<?php 
                    echo _JLMS_DROP_STATUS_CORRECT;
                    ?>
" border="0" />
						<?php 
                } else {
                    echo '&nbsp;';
                }
                ?>
					</td>
					<td valign="middle"><?php 
                $drp_descr = strip_tags($row->drp_description);
                if (strlen($drp_descr) > 100) {
                    $link_drp_descr = sefrelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=drp_view_descr&amp;course_id={$course_id}&amp;id={$row->id}");
                    $drp_descr = substr($drp_descr, 0, 100) . "... <a title='" . _JLMS_DROP_LINK_FULL_DESCR . "' href='" . $link_drp_descr . "'>" . _JLMS_DROP_LINK_MORE_TEXT . "</a>";
                }
                echo $drp_descr ? $drp_descr : '&nbsp;';
                ?>
					</td>
				</tr>
				<?php 
                $k = 3 - $k;
            }
            ?>
			</table>
<?php 
        } else {
            echo '<div class="joomlalms_user_message">' . _JLMS_NO_ITEMS_HERE . '</div>';
        }
        ?>
			<input type="hidden" name="option" value="<?php 
        echo $option;
        ?>
" />
			<input type="hidden" name="Itemid" value="<?php 
        echo $Itemid;
        ?>
" />
			<input type="hidden" name="task" value="dropbox" />
			<input type="hidden" name="id" value="<?php 
        echo $course_id;
        ?>
" />
			<input type="hidden" name="boxchecked" value="0" />
			<input type="hidden" name="row_id" value="0" />
			<input type="hidden" name="state" value="0" />
			<input type="hidden" name="cid2" value="0" />
		</form>
<?php 
        JLMS_TMPL::CloseTS();
        $link_new = "index.php?option=" . $option . "&amp;Itemid=" . $Itemid . "&amp;task=new_dropbox&amp;id=" . $course_id;
        $controls = array();
        $controls[] = array('href' => "javascript:submitbutton_change('change_dropbox',0);", 'title' => _JLMS_DROP_SET_READ, 'img' => 'letter');
        //			$controls[] = array('href' => ampReplace(sefRelToAbs($link_new)), 'title' => _JLMS_DROP_NEW_ITEM, 'img' => 'add');
        $controls[] = array('href' => "javascript:submitbutton('new_dropbox');", 'title' => _JLMS_DROP_NEW_ITEM, 'img' => 'add');
        $controls[] = array('href' => "javascript:submitbutton('del_dropbox');", 'title' => _JLMS_DROP_DEL_ITEM, 'img' => 'delete');
        JLMS_TMPL::ShowControlsFooter($controls);
        JLMS_TMPL::CloseMT();
    }
Пример #14
0
    function showCourseDocuments($option, &$rows, &$lists, $is_teacher)
    {
        global $Itemid, $my, $JLMS_CONFIG;
        $JLMS_ACL =& JLMSFactory::getACL();
        $is_teacher = $JLMS_ACL->isTeacher();
        $can_do_everything = $JLMS_ACL->CheckPermissions('library', 'only_own_items') ? false : ($is_teacher ? true : false);
        $rows_c = $lists['collapsed_folders'];
        ?>
		
<script language="javascript" type="text/javascript">
<!--//--><![CDATA[//><!--
function submitbutton(pressbutton) {
	var form = document.adminForm;
	if ((pressbutton == 'outdoc_delete') && (form.boxchecked.value == '0')) {
		alert( "<?php 
        echo _JLMS_ALERT_SELECT_ITEM;
        ?>
" );
	} else if((pressbutton == 'outdoc_delete')){
		if(confirm('<?php 
        echo _JLMS_OUTDOCS_JS_CONFIRM_DELETE;
        ?>
')){
			form.task.value = pressbutton;
			form.submit();
		}
	} else if ((pressbutton == 'edit_outdoc') && (form.boxchecked.value == '0')) {
		alert( "<?php 
        echo _JLMS_ALERT_SELECT_ITEM;
        ?>
" );
	} else {
		form.task.value = pressbutton;
		form.submit();
	}
}
function submitbutton_change(pressbutton, state) {
	var form = document.adminForm;
	if (pressbutton == 'change_outdoc'){
		if (form.boxchecked.value == '0') {
			alert( "<?php 
        echo _JLMS_ALERT_SELECT_ITEM;
        ?>
" );
		} else {
			form.task.value = pressbutton;
			form.state.value = state;
			form.submit();
		}
	}
}
function submitbutton_change2(pressbutton, state, cid_id) {
	var form = document.adminForm;
	if (pressbutton == 'change_outdoc'){
		form.task.value = pressbutton;
		form.state.value = state;
		form.cid2.value = cid_id;
		form.submit();
	}
}
function submitbutton_order(pressbutton, item_id) {
	var form = document.adminForm;
	if ((pressbutton == 'outdoc_orderup') || (pressbutton == 'outdoc_orderdown')){
		if (item_id) {
		form.task.value = pressbutton;
		form.row_id.value = item_id;
		form.submit();
		}
	}
}

var TreeArray1 = new Array();
var TreeArray2 = new Array();
var Is_ex_Array = new Array();
<?php 
        $i = 1;
        foreach ($rows as $row) {
            echo "TreeArray1[" . $i . "] = " . $row->parent_id . ";";
            echo "TreeArray2[" . $i . "] = " . $row->id . ";";
            if (in_array($row->id, $rows_c)) {
                echo "Is_ex_Array[" . $i . "] = 0;";
            } else {
                echo "Is_ex_Array[" . $i . "] = 1;";
            }
            $i++;
        }
        ?>
function Hide_Folder(fid) {
	var vis_style = 'hidden';
	var dis_style = 'none';
	var i = 1;
	while (i < TreeArray1.length) {
		if (TreeArray1[i] == fid) {
			getObj('tree_row_'+TreeArray2[i]).style.visibility = vis_style;
			getObj('tree_row_'+TreeArray2[i]).style.display = dis_style;
			Hide_Folder(TreeArray2[i])
		}
		i ++;
	}
}
function Show_Folder(fid) {
	var vis_style = 'visible';
	var dis_style = '';
	var i = 1;
	while (i < TreeArray1.length) {
		if (TreeArray1[i] == fid) {
			if (getObj('tree_row_'+TreeArray2[i])) {
				getObj('tree_row_'+TreeArray2[i]).style.display = dis_style;
				getObj('tree_row_'+TreeArray2[i]).style.visibility = vis_style;
			}
			NoChange_Folder(TreeArray2[i])
		}
		i ++;
	}
}
function NoChange_Folder(fid) {
	var vis_style = 'hidden';var dis_style = 'none';var i = 1;var j = 0;
	while (i < TreeArray2.length) {
		if ( (TreeArray2[i] == fid) && (Is_ex_Array[i] == 1) ) {
			vis_style = 'visible';
			dis_style = '';
			j = 1;
		}
		i ++;
	}
	i = 1;
	while (i < TreeArray1.length) {
		if (TreeArray1[i] == fid) {
			getObj('tree_row_'+TreeArray2[i]).style.visibility = vis_style;
			getObj('tree_row_'+TreeArray2[i]).style.display = dis_style;
			if (j == 1) { NoChange_Folder(TreeArray2[i]);
			} else { Hide_Folder(TreeArray2[i]); }
		}
		i ++;
	}
}
function Ex_Folder(fid) {
	var i = 1;
	var j = 1;
	while (i < TreeArray2.length) {
		if ( (TreeArray2[i] == fid) && (Is_ex_Array[i] == 1) ) { j = 0; }
		i ++;
	}
	if (j == 1) {
		Show_Folder(fid);
		if (getObj('tree_img_' + fid).runtimeStyle) {
			var StStr = getObj('tree_img_' + fid).runtimeStyle.filter;
			var imgStr = getObj('tree_img_' + fid).outerHTML;
			imgStr = imgStr.replace('expandall.png','collapseall.png').replace('<?php 
        echo _JLMS_DOCS_EXP_FOLDER;
        ?>
', '<?php 
        echo _JLMS_DOCS_COLL_FOLDER;
        ?>
');
			StStr = StStr.replace('expandall.png','collapseall.png');
			getObj('tree_img_' + fid).outerHTML = imgStr;
			getObj('tree_img_' + fid).runtimeStyle.filter = StStr;
		} else {
			getObj('tree_img_' + fid).src = '<?php 
        echo $JLMS_CONFIG->get('live_site');
        ?>
/components/com_joomla_lms/lms_images/docs/collapseall.png';
			getObj('tree_img_' + fid).alt = '<?php 
        echo _JLMS_DOCS_COLLAPSE;
        ?>
';
			getObj('tree_img_' + fid).title = '<?php 
        echo _JLMS_DOCS_COLL_FOLDER;
        ?>
';
		}
	} else {
		Hide_Folder(fid);
		if (getObj('tree_img_' + fid).runtimeStyle) {
			var StStr = getObj('tree_img_' + fid).runtimeStyle.filter;
			var imgStr = getObj('tree_img_' + fid).outerHTML;
			imgStr = imgStr.replace('collapseall.png','expandall.png').replace('<?php 
        echo _JLMS_DOCS_COLL_FOLDER;
        ?>
', '<?php 
        echo _JLMS_DOCS_EXP_FOLDER;
        ?>
');
			StStr = StStr.replace('collapseall.png','expandall.png');
			getObj('tree_img_' + fid).outerHTML = imgStr;
			getObj('tree_img_' + fid).runtimeStyle.filter = StStr;
		} else {
			getObj('tree_img_' + fid).src = '<?php 
        echo $JLMS_CONFIG->get('live_site');
        ?>
/components/com_joomla_lms/lms_images/docs/expandall.png';
			getObj('tree_img_' + fid).alt = '<?php 
        echo _JLMS_DOCS_EXPAND;
        ?>
';
			getObj('tree_img_' + fid).title = '<?php 
        echo _JLMS_DOCS_EXP_FOLDER;
        ?>
';
		}
	}
	i = 1;
	while (i < TreeArray2.length) {
		if ( (TreeArray2[i] == fid) ) {
			if (Is_ex_Array[i] == 1) { Is_ex_Array[i] = 0;
			} else { Is_ex_Array[i] = 1; }
		}
		i ++;
	}
}
JLMS_preloadImages('<?php 
        echo $JLMS_CONFIG->get('live_site');
        ?>
/components/com_joomla_lms/lms_images/docs/expandall.png','<?php 
        echo $JLMS_CONFIG->get('live_site');
        ?>
/components/com_joomla_lms/lms_images/docs/collapseall.png'<?php 
        if ($is_teacher) {
            echo ", '" . $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('ajax_settings_small_indicator') . "'";
        }
        ?>
);
//--><!]]>
</script>
<?php 
        JLMS_TMPL::OpenMT();
        $hparams = array('show_menu' => true, 'simple_menu' => true);
        $toolbar = array();
        JLMS_TMPL::ShowHeader('outdocs', _JLMS_TOOLBAR_LIBRARY, $hparams, $toolbar);
        $max_tree_width = 0;
        if (isset($rows[0])) {
            $max_tree_width = $rows[0]->tree_max_width;
        }
        JLMS_TMPL::OpenTS('', ' align="right" style="text-align:right " width="100%"');
        $is_teacher = $JLMS_ACL->isTeacher();
        ?>
			<form action="<?php 
        echo $JLMS_CONFIG->get('live_site') . "/index.php?option=" . $option . "&amp;Itemid=" . $Itemid;
        ?>
" method="post" name="adminForm" enctype="multipart/form-data">
<?php 
        if (!empty($rows)) {
            ?>
				<table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php 
            echo JLMSCSS::_('jlmslist');
            ?>
">
					<tr>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 width="20" class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" align="center">#</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<?php 
            //if ($JLMS_ACL->CheckPermissions('docs', 'manage')) {
            ?>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 width="20" class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
"><input type="checkbox" style="visibility:hidden;" /></<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<?php 
            //}
            ?>
						<?php 
            for ($th_i = 0; $th_i < $max_tree_width + 1; $th_i++) {
                ?>
						<<?php 
                echo JLMSCSS::tableheadertag();
                ?>
 width="1%" class="<?php 
                echo JLMSCSS::_('sectiontableheader');
                ?>
"><span style="display: block; width: 16px;">&nbsp;</span></<?php 
                echo JLMSCSS::tableheadertag();
                ?>
>
						<?php 
            }
            ?>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" width="45%"><span style="display: block; width: 150px; text-align: left;"><?php 
            echo _JLMS_DOCS_TBL_DOCNAME;
            ?>
</span></<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<?php 
            //if ($JLMS_ACL->CheckPermissions('docs', 'manage')) {
            ?>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" colspan="2">&nbsp;</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" width="1">&nbsp;</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
"><?php 
            echo _JLMS_DOCS_TBL_STARTING;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
"><?php 
            echo _JLMS_DOCS_TBL_ENDING;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<?php 
            //}
            ?>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" width="60%"><?php 
            echo _JLMS_DOCS_TBL_DESCR;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					</tr>
				<?php 
            $k = 1;
            $tree_modes = array();
            $visible_folder = true;
            //$next_row_is_visible = true;
            $vis_mode = 0;
            for ($i = 0, $n = count($rows); $i < $n; $i++) {
                $row = $rows[$i];
                $max_tree_width = $row->tree_max_width;
                $link = '';
                $link_title = '';
                if ($row->folder_flag == 2) {
                    $link = sefRelToAbs("index.php?option=" . $option . "&amp;Itemid=" . $Itemid . "&amp;task=docs_view_zip&amp;id=" . $row->id);
                    $link_title = _JLMS_T_A_VIEW_ZIP_PACK;
                } elseif (!$row->folder_flag && $row->file_id) {
                    $link = sefRelToAbs("index.php?option=" . $option . "&amp;Itemid=" . $Itemid . "&amp;task=get_outdoc&amp;id=" . $row->id);
                    $link_title = _JLMS_DOCS_LINK_DOWNLOAD;
                } elseif (!$row->folder_flag && !$row->file_id) {
                    $link = sefRelToAbs("index.php?option=" . $option . "&amp;Itemid=" . $Itemid . "&amp;task=outdocs_view_content&amp;id=" . $row->id);
                    $link_title = _JLMS_T_A_VIEW_CONTENT;
                } elseif ($row->folder_flag == 3 && $row->file_id) {
                    $link = sefRelToAbs("index.php?option=" . $option . "&amp;Itemid=" . $Itemid . "&amp;task=playerSCORMFiles&amp;id=" . $row->file_id . "&amp;doc_id=" . $row->id);
                    $link_title = _JLMS_T_A_VIEW_CONTENT;
                }
                $time_p = $row->publish_start || $row->publish_end;
                $alt = $row->published ? $time_p ? _JLMS_STATUS_PUB2 : _JLMS_STATUS_PUB : _JLMS_STATUS_UNPUB;
                $image = $row->published ? $time_p ? 'btn_publish_wait.png' : 'btn_accept.png' : 'btn_cancel.png';
                //($time_p?'btn_unpublish_wait.png':'btn_cancel.png');
                if ($time_p) {
                    $is_expired = false;
                    if ($row->publish_start) {
                        $s_date = strtotime($row->start_date);
                        if ($s_date > time()) {
                            $is_expired = true;
                        }
                    }
                    if ($row->publish_end && !$is_expired) {
                        $e_date = strtotime($row->end_date);
                        if ($e_date < time()) {
                            $is_expired = true;
                        }
                    }
                    if ($is_expired) {
                        $alt = _JLMS_STATUS_EXPIRED;
                        $image = 'btn_expired.png';
                    }
                }
                $state = $row->published ? 0 : 1;
                $checked = mosHTML::idBox($i, $row->id);
                // Collapsed/Expanded view
                $tree_row_style = '';
                $visible_folder = true;
                //$next_row_is_visible;
                //$next_row_is_visible = true;
                if ($vis_mode) {
                    if ($row->tree_mode_num < $vis_mode) {
                        $vis_mode = 0;
                    }
                }
                if (in_array($row->id, $rows_c)) {
                    //$next_row_is_visible = false;
                    if ($vis_mode) {
                        if ($row->tree_mode_num < $vis_mode) {
                            $vis_mode = $row->tree_mode_num;
                        } else {
                            $visible_folder = false;
                        }
                    } else {
                        $vis_mode = $row->tree_mode_num + 1;
                    }
                } elseif ($vis_mode) {
                    if ($row->tree_mode_num >= $vis_mode) {
                        $visible_folder = false;
                    } else {
                        $vis_mode = 0;
                    }
                }
                if (!$visible_folder) {
                    $tree_row_style = ' style="visibility:hidden;display:none"';
                }
                ?>
					<tr id="tree_row_<?php 
                echo $row->id;
                ?>
" class="<?php 
                echo JLMSCSS::_('sectiontableentry' . $k);
                ?>
"<?php 
                echo $tree_row_style;
                ?>
>
						<td align="center" valign="middle"><?php 
                echo $i + 1;
                ?>
</td>
					
						<td valign="middle"><?php 
                if ($my->id == $row->owner_id || $can_do_everything) {
                    echo $checked;
                }
                ?>
</td>
					
						<?php 
                $add_img = '';
                if ($row->tree_mode_num) {
                    $g = 0;
                    $tree_modes[$row->tree_mode_num - 1] = $row->tree_mode;
                    while ($g < $row->tree_mode_num - 1) {
                        $pref = '';
                        if (isset($tree_modes[$g]) && $tree_modes[$g] == 2) {
                            $pref = 'empty_';
                        }
                        $add_img .= "<td width='16' valign='middle'><img src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/treeview/" . $pref . "line.png\" width='16' height='16' alt='" . $pref . "line' /></td>";
                        $g++;
                    }
                    $add_img .= "<td width='16' valign='middle'><img src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/treeview/sub" . $row->tree_mode . ".png\" width='16' height='16' alt='sub" . $row->tree_mode . "' /></td>";
                    $max_tree_width = $max_tree_width - $g - 1;
                }
                echo $add_img;
                ?>
						<td align="center" valign="middle" width='16'>
						<?php 
                if ($row->folder_flag == 1) {
                    $collapse_img = 'collapseall.png';
                    $collapse_alt = _JLMS_DOCS_COLL_FOLDER;
                    if (in_array($row->id, $rows_c)) {
                        $collapse_img = 'expandall.png';
                        $collapse_alt = _JLMS_DOCS_EXP_FOLDER;
                    }
                    echo "<span id='tree_div_" . $row->id . "' style='alignment:center; width:16px; font-weight:bold; cursor:pointer; vertical-align:middle;' onclick='Ex_Folder(" . $row->id . "," . $row->id . ",true)'><img class='JLMS_png' id='tree_img_" . $row->id . "' src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/docs/{$collapse_img}\" width='13' height='13' alt='" . $collapse_alt . "' title='" . $collapse_alt . "' /></span>";
                } else {
                    echo "<span style='alignment:center; width:16px; font-weight:bold; vertical-align:middle;'><img class='JLMS_png' src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/files/" . $row->file_icon . ".png\" width='16' height='16' alt='{$row->file_icon}' /></span>";
                }
                ?>
						</td>
						<td align="left" valign="middle" <?php 
                if ($max_tree_width > 0) {
                    echo "colspan='" . ($max_tree_width + 1) . "'";
                }
                ?>
 width="45%">
						<span style='font-weight:bold; vertical-align:middle;'>
						<?php 
                if ($row->folder_flag == 1) {
                    echo '&nbsp;<strong>' . $row->doc_name . '</strong>';
                } else {
                    ?>
							<?php 
                    if ($is_teacher && $row->outdoc_share || !$is_teacher && $row->outdoc_share == 2 || $my->id == $row->owner_id || $can_do_everything) {
                        $add_link_params = '';
                        if ($row->folder_flag == 3 && isset($row->scorm_params) && $row->scorm_params) {
                            $tmp_params = new JLMSParameters($row->scorm_params);
                            if ($tmp_params->get('scorm_layout', 0) == 1) {
                                $x_size = 0;
                                $y_size = 0;
                                if (isset($row->scorm_width) && $row->scorm_width > 100) {
                                    $x_size = $row->scorm_width;
                                }
                                if (isset($row->scorm_height) && $row->scorm_height > 100) {
                                    $y_size = $row->scorm_height;
                                }
                                $add_link_params = ' class="scorm_modal" rel="{handler:\'iframe\', size:{x:' . $x_size . ',y:' . $y_size . '}}"';
                                JLMS_initialize_SqueezeBox();
                            }
                        }
                        if ($link) {
                            ?>
							<a href="<?php 
                            echo $link;
                            ?>
"<?php 
                            echo $add_link_params;
                            ?>
 title="<?php 
                            echo str_replace('"', '&quot;', $row->doc_name);
                            ?>
">
<?php 
                        }
                        ?>
							<?php 
                    }
                    ?>
								&nbsp;<?php 
                    echo $row->doc_name;
                    ?>
								<?php 
                    if ($is_teacher && $row->outdoc_share || !$is_teacher && $row->outdoc_share == 2 || $my->id == $row->owner_id || $can_do_everything) {
                        if ($link) {
                            ?>
							</a>
<?php 
                        }
                        ?>
						<?php 
                    }
                }
                ?>
						</span>
						<?php 
                if ($JLMS_CONFIG->get('show_library_authors', 0) && $row->author_name) {
                    ?>
						<br />
						<span class="small"><?php 
                    echo _JLMS_HOME_AUTHOR . "&nbsp;" . $row->author_name;
                    ?>
</span>
						<?php 
                }
                ?>

						</td>
					<?php 
                //if ($JLMS_ACL->CheckPermissions('docs', 'manage')) {
                ?>
						<td valign="middle" style="vertical-align:middle "><?php 
                if ($row->allow_up == 1 && ($my->id == $row->owner_id || $can_do_everything)) {
                    echo JLMS_orderUpIcon(1, $row->id, true, 'outdoc_orderup');
                } else {
                    echo '&nbsp;';
                }
                ?>
</td>
						<td valign="middle" style="vertical-align:middle "><?php 
                if ($row->allow_down == 1 && ($my->id == $row->owner_id || $can_do_everything)) {
                    echo JLMS_orderDownIcon(1, 3, $row->id, true, 'outdoc_orderdown');
                } else {
                    echo '&nbsp;';
                }
                ?>
</td>
						<td valign="middle">
							<?php 
                if ($my->id == $row->owner_id || $can_do_everything) {
                    echo '<a class="jlms_img_link" href="javascript:submitbutton_change2(\'change_outdoc\',' . $state . ',' . $row->id . ')" title="' . $alt . '">';
                    echo '<img class="JLMS_png" src="' . $JLMS_CONFIG->get('live_site') . '/components/com_joomla_lms/lms_images/toolbar/' . $image . '" width="16" height="16" border="0" alt="' . $alt . '" />';
                    echo '</a>';
                } else {
                    echo '&nbsp;';
                }
                ?>
						</td>
						
						<td align="center" nowrap='nowrap' valign="middle"><?php 
                echo $row->publish_start ? JLMS_dateToDisplay($row->start_date) : '-';
                ?>
</td>
						<td align="center" nowrap='nowrap' valign="middle"><?php 
                echo $row->publish_end ? JLMS_dateToDisplay($row->end_date) : '-';
                ?>
</td>
					<?php 
                //}
                ?>
						<td><?php 
                $doc_descr = strip_tags($row->doc_description);
                if (!$row->folder_flag && !$row->file_id) {
                    if (strlen($doc_descr) > 75) {
                        $doc_descr = substr($doc_descr, 0, 75) . "...";
                    }
                }
                echo $doc_descr ? $doc_descr : '&nbsp;';
                ?>
						</td>
					</tr>
					<?php 
                $k = 3 - $k;
            }
            ?>
				</table>
<?php 
        } else {
            echo '<div class="joomlalms_user_message">' . _JLMS_NO_ITEMS_HERE . '</div>';
        }
        ?>
				<input type="hidden" name="option" value="<?php 
        echo $option;
        ?>
" />
				<input type="hidden" name="Itemid" value="<?php 
        echo $Itemid;
        ?>
" />
				<input type="hidden" name="task" value="" />
				<input type="hidden" name="boxchecked" value="0" />
				<input type="hidden" name="row_id" value="0" />
				<input type="hidden" name="state" value="0" />
				<input type="hidden" name="cid2" value="0" />
			</form>

<?php 
        JLMS_TMPL::CloseTS();
        //if ($JLMS_ACL->CheckPermissions('docs', 'manage')) {
        if ($is_teacher) {
            $link_foldernew = ampReplace(sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=new_outfolder"));
            $link_filenew = ampReplace(sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=new_outdocs"));
            $link_scormnew = ampReplace(sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=new_scorm"));
            $controls = array();
            $controls[] = array('href' => "javascript:submitbutton_change('change_outdoc',1);", 'title' => _JLMS_SET_PUB, 'img' => 'publish');
            $controls[] = array('href' => "javascript:submitbutton_change('change_outdoc',0);", 'title' => _JLMS_SET_UNPUB, 'img' => 'unpublish');
            $controls[] = array('href' => 'spacer');
            $controls[] = array('href' => $link_foldernew, 'title' => _JLMS_DOCS_LNK_NEW_FOLDER, 'img' => 'foldernew');
            $controls[] = array('href' => $link_filenew, 'title' => _JLMS_DOCS_LNK_NEW_DOC, 'img' => 'filenew');
            $controls[] = array('href' => "javascript:submitbutton('outdoc_delete');", 'title' => _JLMS_DELETE, 'img' => 'delete');
            $controls[] = array('href' => "javascript:submitbutton('edit_outdoc');", 'title' => _JLMS_EDIT, 'img' => 'edit');
            $controls[] = array('href' => $link_scormnew, 'title' => _JLMS_DOCS_NEW_SCORM_PACKAGE, 'img' => 'add_scorm');
            JLMS_TMPL::ShowControlsFooter($controls);
            //}
        }
        JLMS_TMPL::CloseMT();
    }
    function showGradebook($id, $option, &$rows, &$pageNav, &$lists, $manage = 0)
    {
        global $Itemid, $JLMS_CONFIG;
        $is_full = $lists['is_full'];
        ?>
		<script type="text/javascript" language="javascript">
		<!--//--><![CDATA[//><!--
		function submitFormView(view){
			var form = document.adminForm;
			form.view.value = view;
			form.task.value='gradebook';
			form.submit();
		}
		<?php 
        if (!$is_full) {
            ?>
		function submitbutton_crtf(pressbutton, state, cid_id) {
			var form = document.adminForm;
			if (pressbutton == 'gb_crt'){
				form.task.value = pressbutton;
				form.state.value = state;
				form.cid2.value = cid_id;
				form.submit();
			}
		}
		<?php 
        } else {
            ?>
		function submutFormChangeCourse(el){
			var form = document.adminForm;
			var new_id = parseInt(form.course_id.options[form.course_id.selectedIndex].value);
			form.view.value = '';
			form.id.value = new_id;
			form.task.value='gradebook';
			form.submit();	
		}
		<?php 
        }
        ?>
		//--><!]]>
		</script>
		<?php 
        JLMS_TMPL::OpenMT();
        if (!$is_full) {
            $hparams = array();
            JLMS_TMPL::ShowHeader('gradebook', _JLMS_GB_TITLE, $hparams);
            $controls = array();
            $controls[] = array('href' => sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=gb_scale&amp;course_id=" . $id), 'title' => _JLMS_GB_MENU_SCALE, 'img' => 'gradebook/gb_scale.png');
            $controls[] = array('href' => sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=gb_items&amp;id=" . $id), 'title' => _JLMS_GB_MENU_ITEMS, 'img' => 'gradebook/gb_items.png');
            $controls[] = array('href' => sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=gb_certificates&amp;id=" . $id), 'title' => _JLMS_GB_MENU_CERTS, 'img' => 'buttons_22/btn_certificates_22.png');
            //kosmos added
            $controls[] = array('href' => sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=gb_setup_path&amp;id=" . $id), 'title' => _CONFIGURE_COURSE_COMPLETION, 'img' => 'buttons_22/btn_lpath_crt_22.png');
            //--end
            JLMS_TMPL::ShowControlsFooter($controls, '', false, true);
        }
        JLMS_TMPL::OpenTS();
        $action_url = $is_full ? $JLMS_CONFIG->get('live_site') . "/index.php?tmpl=component&amp;option={$option}&amp;Itemid={$Itemid}" : sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}");
        ?>
		<form action="<?php 
        echo $action_url;
        ?>
" method="post" name="adminForm">
			<?php 
        if ($is_full) {
            ?>
				<table class="jlms_table_no_borders">
					<tr>
						<td>
							<?php 
            if (isset($lists['courses'])) {
                echo _JLMS_CURRENT_COURSE . ' ' . $lists['courses'];
            }
            ?>
						</td>
					</tr>
				</table>
				<?php 
            //$controls = array();
            //$controls[] = array('href' => "javascript:submitFormView('csv');", 'title' => 'CSV', 'img' => 'csv');
            //JLMS_TMPL::ShowControlsFooterC($controls, '', false, false, _JLMS_EXPORT_TO.':');
        }
        ?>
			<table width="100%" cellpadding="0" cellspacing="0" border="0" id="TheTable" class="jlms_table_no_borders">
				<tr>
					<td align="left" style="text-align:left ">
						<div align="left" style="white-space:nowrap ">
							<?php 
        echo "&nbsp;" . _JLMS_FILTER . "&nbsp;" . $lists['filter'];
        ?>
&nbsp;
							<input class="inputbox" type="text" name="username_filter" value="<?php 
        echo $lists['filt_user'];
        ?>
" />
							<input type="submit" name="Filter" value="<?php 
        echo str_replace(':', '', _JLMS_FILTER);
        ?>
" />
						</div>
					</td>
					<?php 
        if (!$is_full) {
            ?>
					<td align="right">
						<?php 
            $link_full = $JLMS_CONFIG->get('live_site') . '/index.php?tmpl=component&amp;option=' . $option . '&amp;Itemid=' . $Itemid . '&amp;task=gradebook&amp;id=' . $id;
            $link_full .= '&amp;is_full=1';
            ?>
						<a target="_blank" href="<?php 
            echo $link_full;
            ?>
">
							<?php 
            echo _JLMS_FULL_VIEW_BUTTON;
            ?>
						</a>
					</td>
					<?php 
        }
        /*<td align="left" style="text-align:right ">
        			<div align="left" style="white-space:nowrap ">
        				<?php echo $lists['filter'];?><input type="text" name="username_filter" value="<?php echo $lists['filt_user'];?>" /><input type="submit" name="Filter" value="Filter" />
        			</div>
        		</td>*/
        ?>
				</tr>
			</table>
			<?php 
        if (!$is_full) {
            $domready = '
				$(\'pre_div\').setStyles({\'display\': \'none\'});
				$(\'vw_div\').setStyles({\'display\': \'block\'});
				var cur_height = $(\'vw_div\').getStyle(\'height\').toInt() + 18;
				$(\'vw_div\').setStyles({\'width\': $(\'TheTable\').offsetWidth+\'px\', \'height\': cur_height+\'px\'});
				';
            $JLMS_CONFIG->set('web20_domready_code', $JLMS_CONFIG->get('web20_domready_code', '') . $domready);
            ?>
			<div id="pre_div" style="display: block; width: 100%; text-align: center;">
				<br />
				Please wait. Gradebook is loading.<br /> If this message stays for over 1 minute, please click <a target="_blank" href="<?php 
            echo $link_full;
            ?>
">&lt;here&gt;</a> to open Gradebook in new window.
			</div>
			<div id="vw_div" style="overflow: auto; width: 200px; height: auto; display: none;">
			<?php 
        }
        if ($is_full) {
            echo '<br />';
        }
        ?>
			<?php 
        $gb_colspan = 2;
        ?>
				<table width="100%" cellpadding="<?php 
        echo $is_full ? '4' : '0';
        ?>
" cellspacing="0" border="0" class="<?php 
        echo JLMSCSS::_('jlmslist', 'jlms_gradebook_fullview_table');
        ?>
"<?php 
        echo !$is_full ? ' style="margin-bottom:0px;padding-bottom:0px;"' : '';
        ?>
>
					<tr>
						<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 width="20" class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" align="center">#</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
						<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 width="20" class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" align="center"><input type="checkbox" name="toggle" value="" onclick="checkAll(<?php 
        echo count($rows);
        ?>
);" /></<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
					<?php 
        if (!$is_full) {
            $gb_colspan++;
            ?>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
"><?php 
            echo _JLMS_GB_TBL_HEAD_STU;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<?php 
        } else {
            $gb_colspan = $gb_colspan + 3;
            ?>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
"><?php 
            echo str_replace(':', '', _JLMS_UI_NAME);
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
"><?php 
            echo str_replace(':', '', _JLMS_UI_USERNAME);
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
"><?php 
            echo str_replace(':', '', _JLMS_UI_EMAIL);
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<?php 
        }
        ?>
						
					<?php 
        $com_transcript_exist = file_exists(JPATH_SITE . DS . 'components' . DS . 'com_jlms_transcript' . DS . 'jlms_transcript.php') ? true : false;
        if ($com_transcript_exist) {
            $gb_colspan++;
            ?>
							<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
">&nbsp;</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<?php 
        }
        $gb_colspan++;
        ?>
						
						<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
"><?php 
        echo _JLMS_GB_TBL_HEAD_GROUP;
        ?>
</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
						<?php 
        if (isset($lists['regenroll_fields']) && count($lists['regenroll_fields'])) {
            $regenroll_fields = $lists['regenroll_fields'];
            foreach ($regenroll_fields as $field) {
                $gb_colspan++;
                echo '<' . JLMSCSS::tableheadertag() . ' align=\'center\' nowrap=\'nowrap\' class="' . JLMSCSS::_('sectiontableheader') . '" style="text-align:center; white-space:nowrap">' . $field->title . '</' . JLMSCSS::tableheadertag() . '>';
            }
        }
        $gb_colspan = $gb_colspan + 2;
        ?>
						<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" align="center" nowrap="nowrap"><?php 
        echo _JLMS_COURSE_COMPLETION_TABLE;
        ?>
</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
						<?php 
        if ($JLMS_CONFIG->get('enable_timetracking')) {
            ?>
							<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" align="center" nowrap="nowrap"><?php 
            echo _JLMS_TIME_SPENT_TABLE;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
							<?php 
        }
        ?>
						<?php 
        if ($is_full) {
            $gb_colspan++;
            ?>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" align="center" nowrap="nowrap"><?php 
            echo str_replace(':', '', _JLMS_DATE);
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
						<?php 
        }
        ?>
						<?php 
        /*
        <td class="sectiontableheader" align="center" nowrap="nowrap"><?php echo 'Access#';?></td>
        */
        ?>
						<?php 
        $sc_num = 0;
        foreach ($lists['sc_rows'] as $sc_row) {
            if ($sc_row->show_in_gradebook) {
                $sc_num++;
                $link = isset($sc_row->is_link) ? $sc_row->is_link : '';
                if ($is_full) {
                    echo '<' . JLMSCSS::tableheadertag() . ' align=\'center\' nowrap=\'nowrap\' class="' . JLMSCSS::_('sectiontableheader') . '">' . $sc_row->lpath_name . '</' . JLMSCSS::tableheadertag() . '>';
                } else {
                    echo '<' . JLMSCSS::tableheadertag() . ' align=\'center\' nowrap=\'nowrap\' class="' . JLMSCSS::_('sectiontableheader') . '">' . JLMS_gradebook_html::Echo_tbl_header($sc_row->lpath_name, $link) . '</' . JLMSCSS::tableheadertag() . '>';
                }
                $gb_colspan++;
            }
        }
        foreach ($lists['quiz_rows'] as $quiz_row) {
            if ($is_full) {
                echo '<' . JLMSCSS::tableheadertag() . ' align=\'center\' nowrap=\'nowrap\' class="' . JLMSCSS::_('sectiontableheader') . '">' . $quiz_row->c_title . '</' . JLMSCSS::tableheadertag() . '>';
            } else {
                echo '<' . JLMSCSS::tableheadertag() . ' align=\'center\' nowrap=\'nowrap\' class="' . JLMSCSS::_('sectiontableheader') . '">' . JLMS_gradebook_html::Echo_tbl_header($quiz_row->c_title) . '</' . JLMSCSS::tableheadertag() . '>';
            }
            $gb_colspan++;
        }
        foreach ($lists['gb_rows'] as $gb_row) {
            if ($is_full) {
                echo '<' . JLMSCSS::tableheadertag() . ' align=\'center\' nowrap=\'nowrap\' class="' . JLMSCSS::_('sectiontableheader') . '">' . $gb_row->gbi_name . '</' . JLMSCSS::tableheadertag() . '>';
            } else {
                echo '<' . JLMSCSS::tableheadertag() . ' align=\'center\' nowrap=\'nowrap\' class="' . JLMSCSS::_('sectiontableheader') . '">' . JLMS_gradebook_html::Echo_tbl_header($gb_row->gbi_name) . '</' . JLMSCSS::tableheadertag() . '>';
            }
            $gb_colspan++;
        }
        ?>
						
					</tr>
				<?php 
        $k = 1;
        for ($i = 0, $n = count($rows); $i < $n; $i++) {
            $row = $rows[$i];
            $link = "index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=gb_usergrade&amp;course_id={$id}&amp;id={$row->user_id}";
            $checked = mosHTML::idBox($i, $row->user_id);
            ?>
					<tr class="<?php 
            echo JLMSCSS::_('sectiontableentry' . $k);
            ?>
">
						<td align="center" valign="middle"><?php 
            echo $pageNav->limitstart + $i + 1;
            ?>
</td>
						<td align="center" valign="middle"><?php 
            echo $checked;
            ?>
</td>
					<?php 
            if (!$is_full) {
                ?>
						<td align="left" valign="middle">
							<?php 
                /*<a href="<?php echo sefRelToAbs($link);?>" title="<?php echo _JLMS_GB_VIEW_USER;?>">*/
                ?>
								<?php 
                echo JLMS_gradebook_html::Echo_userinfo($row->name, $row->username, $row->email, sefRelToAbs($link));
                ?>
							<?php 
                /*</a> */
                ?>
						</td>
					<?php 
            } else {
                ?>
						<td align="left" valign="middle">
							<a href="<?php 
                echo sefRelToAbs($link);
                ?>
" title="<?php 
                echo _JLMS_GB_VIEW_USER;
                ?>
">
								<?php 
                echo $row->name;
                ?>
							</a>
						</td>
						<td align="left" valign="middle">
							<a href="<?php 
                echo sefRelToAbs($link);
                ?>
" title="<?php 
                echo _JLMS_GB_VIEW_USER;
                ?>
">
								<?php 
                echo $row->username;
                ?>
							</a>
						</td>
						<td align="left" valign="middle">
							<a href="<?php 
                echo sefRelToAbs($link);
                ?>
" title="<?php 
                echo _JLMS_GB_VIEW_USER;
                ?>
">
								<?php 
                echo $row->email;
                ?>
							</a>
						</td>
					<?php 
            }
            ?>
					<?php 
            if ($com_transcript_exist) {
                ?>
						<td align="left" valign="middle">
							<?php 
                $link_com_transcript = 'index.php?option=com_jlms_transcript&user_id=' . $row->user_id;
                ?>
							<a href="<?php 
                echo $link_com_transcript;
                ?>
" title="transcript">
								<?php 
                echo 'transcript';
                ?>
							</a>
						</td>
					<?php 
            }
            ?>
	
					
						<td align="left" valign="middle">
							<?php 
            echo $row->ug_name ? $row->ug_name : '&nbsp;';
            ?>
						</td>
						<?php 
            if (isset($lists['regenroll_fields']) && count($lists['regenroll_fields'])) {
                foreach ($regenroll_fields as $field) {
                    $field_name = $field->name;
                    ?>
								<td align="left" valign="middle">
								<?php 
                    echo isset($row->{$field_name}) && $row->{$field_name} ? $row->{$field_name} : '';
                    ?>
								</td>
								<?php 
                }
            }
            ?>
						<td align="center" valign="middle">
							<?php 
            $image = $row->user_certificate ? 'btn_accept.png' : 'btn_cancel.png';
            $alt = $row->user_certificate ? _JLMS_GB_USER_HAVE_CRT : _JLMS_GB_USER_HAVE_NO_CRT;
            if (!$is_full) {
                $state = $row->user_certificate ? 0 : 1;
                if ($manage) {
                    echo '<a href="javascript:submitbutton_crtf(\'gb_crt\',' . $state . ',' . $row->user_id . ')" title="' . $alt . '" class="jlms_img_link"><img class="JLMS_png" src="' . $JLMS_CONFIG->get('live_site') . '/components/com_joomla_lms/lms_images/toolbar/' . $image . '" width="16" height="16" border="0" alt="' . $alt . '" /></a>';
                } else {
                    echo '<img class="JLMS_png" src="' . $JLMS_CONFIG->get('live_site') . '/components/com_joomla_lms/lms_images/toolbar/' . $image . '" width="16" height="16" border="0" alt="' . $alt . '" />';
                }
                if (isset($row->date_completed) && $row->date_completed) {
                    echo '<br />' . JLMS_offsetDateToDisplay($row->date_completed);
                }
            } else {
                echo '<img class="JLMS_png" src="' . $JLMS_CONFIG->get('live_site') . '/components/com_joomla_lms/lms_images/toolbar/' . $image . '" width="16" height="16" border="0" alt="' . $alt . '" />';
            }
            ?>
						</td>
						<?php 
            if ($JLMS_CONFIG->get('enable_timetracking')) {
                ?>
							<td align="center" valign="middle"><?php 
                echo $row->time_spent;
                ?>
</td>
							<?php 
            }
            ?>
		
						<?php 
            if ($is_full) {
                ?>
						<td align="center" valign="middle">
							<?php 
                echo JLMS_offsetDateToDisplay($row->date_completed);
                ?>
						</td>
						<?php 
            }
            ?>
						<?php 
            /*
            <td align="center" valign="middle">
            	<?php
            	echo (int) $row->access;
            	?>
            </td>
            */
            ?>
						<?php 
            $sc_num2 = 0;
            foreach ($lists['sc_rows'] as $sc_row) {
                if ($sc_row->show_in_gradebook) {
                    $j = 0;
                    while ($j < count($row->scorm_info)) {
                        if ($row->scorm_info[$j]->gbi_id == $sc_row->item_id) {
                            if ($sc_num2 < $sc_num) {
                                if ($row->scorm_info[$j]->user_status == -1) {
                                    echo '<td align=\'center\'>-</td>';
                                } else {
                                    $image = $row->scorm_info[$j]->user_status ? 'btn_accept.png' : 'btn_cancel.png';
                                    $alt = $row->scorm_info[$j]->user_status ? 'btn_accept' : 'btn_cancel';
                                    $alt .= '" align="top';
                                    $img = JLMS_gradebook_html::publishIcon(0, 0, 0, '', $alt, $image, $option, false);
                                    echo '<td valign="middle" align="center" nowrap="nowrap">' . $img . '&nbsp;<strong>' . $row->scorm_info[$j]->user_grade . "</strong> (" . $row->scorm_info[$j]->user_pts . _JLMS_GB_POINTS . ")" . '</td>';
                                }
                                $sc_num2++;
                            }
                        }
                        $j++;
                    }
                }
            }
            foreach ($lists['quiz_rows'] as $quiz_row) {
                $j = 0;
                while ($j < count($row->quiz_info)) {
                    if ($row->quiz_info[$j]->gbi_id == $quiz_row->c_id) {
                        //									$image = $row->quiz_info[$j]->user_status ? 'btn_accept.png' : 'btn_cancel.png';
                        //									$alt = $row->quiz_info[$j]->user_status ? 'btn_accept' : 'btn_cancel';
                        //									$alt .= '" align="top';
                        //									$img = JLMS_gradebook_html::publishIcon(0, 0, 0, '', $alt, $image, $option, false );
                        //									echo $img . '&nbsp;<strong>' . $row->quiz_info[$j]->user_grade . "</strong> (" . $row->quiz_info[$j]->user_pts_full . ")";
                        //									/*Integration Plugin Percentiles*/
                        //									if(isset($row->quiz_info[$j]->user_percentile)){
                        //										echo ' - '.$row->quiz_info[$j]->user_percentile;
                        //									}
                        //									/*Integration Plugin Percentiles*/
                        echo '<td valign="middle" align="center" nowrap="nowrap">';
                        echo JLMS_showQuizStatus($row->quiz_info[$j], 50);
                        echo '</td>';
                    }
                    $j++;
                }
            }
            $j = 0;
            while ($j < count($row->grade_info)) {
                echo '<td align=\'center\' valign="middle"><strong>' . $row->grade_info[$j]->user_grade . '</strong></td>';
                $j++;
            }
            ?>
					</tr>
					<?php 
            $k = 3 - $k;
        }
        ?>
				<?php 
        if ($is_full) {
            ?>
				<tr>
					<td align="center" colspan="<?php 
            echo $gb_colspan;
            ?>
"class="<?php 
            echo JLMSCSS::_('jlmslist-footer_td');
            ?>
"><div align="center">
					<?php 
            if (!$is_full) {
                $link = "index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=gradebook&amp;id={$id}";
                echo _JLMS_PN_DISPLAY_NUM . $pageNav->getLimitBox($link) . '&nbsp;' . $pageNav->getPagesCounter();
                echo '<br />';
            }
            ?>
					<?php 
            $link = "index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=gradebook&amp;id={$id}";
            echo $pageNav->writePagesLinks($link);
            ?>
 
					</div></td>
				</tr>
				<?php 
        }
        ?>
				</table>
			<?php 
        if ($is_full && count($rows)) {
            $controls = array();
            $controls[] = array('href' => "javascript:submitFormView('csv');", 'title' => 'CSV', 'img' => 'csv');
            $controls[] = array('href' => "javascript:submitFormView('xls');", 'title' => 'XLS', 'img' => 'xls');
            JLMS_TMPL::ShowControlsFooterC($controls, '', false, false, _JLMS_EXPORT_TO . ':', true);
        } else {
            ?>
			</div>
			<?php 
            if (!$is_full) {
                ?>
			<table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php 
                echo JLMSCSS::_('jlmslist');
                ?>
" style="padding: 0px; margin-top:0px; margin-bottom:0px;">
				<tr>
					<td align="center" class="<?php 
                echo JLMSCSS::_('jlmslist-footer_td');
                ?>
"><div align="center">
					<?php 
                $link = "index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=gradebook&amp;id={$id}";
                echo _JLMS_PN_DISPLAY_NUM . $pageNav->getLimitBox($link) . '&nbsp;' . $pageNav->getPagesCounter();
                echo '<br />';
                echo $pageNav->writePagesLinks($link);
                ?>
 
					</div></td>
				</tr>
			</table>
			<?php 
            }
            ?>
			<?php 
            if ($JLMS_CONFIG->get('new_lms_features', 1) && count($rows)) {
                $controls = array();
                $controls[] = array('href' => "javascript:submitFormView('csv');", 'title' => 'CSV', 'img' => 'csv');
                $controls[] = array('href' => "javascript:submitFormView('xls');", 'title' => 'XLS', 'img' => 'xls');
                JLMS_TMPL::ShowControlsFooterC($controls, '', false, false, _JLMS_EXPORT_TO . ':');
            }
        }
        ?>
			<input type="hidden" name="option" value="<?php 
        echo $option;
        ?>
" />
			<input type="hidden" name="Itemid" value="<?php 
        echo $Itemid;
        ?>
" />
			<input type="hidden" name="task" value="gradebook" />
			<input type="hidden" name="state" value="0" />
			<input type="hidden" name="boxchecked" value="0" />
			<input type="hidden" name="id" value="<?php 
        echo $id;
        ?>
" />
			<input type="hidden" name="cid2" value="0" />
			<input type="hidden" name="view" value="" />
			<?php 
        if ($is_full) {
            ?>
			<input type="hidden" name="is_full" value="1" />
			<?php 
        }
        ?>
		</form>
<?php 
        JLMS_TMPL::CloseTS();
        JLMS_TMPL::CloseMT();
    }