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();
    }
Esempio n. 2
0
    function showCourseGuest($id, &$row, $option, $enrollment)
    {
        $_JLMS_PLUGINS =& JLMSFactory::getPlugins();
        $JLMS_CONFIG =& JLMSFactory::getConfig();
        $Itemid = $JLMS_CONFIG->get('Itemid');
        JLMS_TMPL::OpenMT();
        $params = array('show_menu' => true, 'simple_menu' => true);
        $toolbar = array();
        $show_down_back = true;
        if ($enrollment) {
            if ($row->self_reg && !$row->gid) {
                $params['sys_msg'] = _JLMS_COURSES_ENROLL_MSG;
                $toolbar[] = array('btn_type' => 'yes', 'btn_str' => _JLMS_SUBSCRIBE, 'btn_js' => "javascript:submitbutton('subscription','');");
                $toolbar[] = array('btn_type' => 'cancel', 'btn_js' => sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=courses"));
                $params['toolbar_position'] = 'center';
                $show_down_back = false;
                $html_code_before_toolbar = "\n\t\t\t\t<form action='" . sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}") . "' method='post' name='adminForm_enroll'>\n\t\t\t\t<script language='javascript' type='text/javascript'>\n\t\t\t\t\t<!--\n\t\t\t\t\t\n\t\t\t\t\tfunction submitbutton(pressbutton) {\n\t\t\t\t\t\tvar form = document.adminForm_enroll;\n\t\t\t\t\t\tform.task.value = pressbutton;\n\t\t\t\t\t\tform.submit();\n\t\t\t\t\t}\n\t\t\t\t\t//-->\n\t\t\t\t</script>\n\t\t\t\t";
                /*if ($row->paid) {
                			$html_code_before_toolbar .= "
                				<input type='hidden' name='option' value='".$option."' />
                				<input type='hidden' name='Itemid' value='".$Itemid."' />
                				<input type='hidden' name='task' value='subscription' />
                				<input type='hidden' name='cid[]' value='".$row->id."' />
                				<input type='hidden' name='state' value='0' />
                				</form>
                			";
                		} else {*/
                $html_code_before_toolbar .= "\n\t\t\t\t\t\t<input type='hidden' name='option' value='" . $option . "' />\n\t\t\t\t\t\t<input type='hidden' name='Itemid' value='" . $Itemid . "' />\n\t\t\t\t\t\t<input type='hidden' name='task' value='courses' />\n\t\t\t\t\t\t<input type='hidden' name='id' value='" . $row->id . "' />\n\t\t\t\t\t\t<input type='hidden' name='cid[]' value='" . $row->id . "' />\n\t\t\t\t\t\t<input type='hidden' name='state' value='0' />\n\t\t\t\t\t\t</form>\n\t\t\t\t\t";
                //}
                $params['html_code_before_toolbar'] = $html_code_before_toolbar;
            }
        }
        JLMS_TMPL::ShowHeader('course', $row->course_name, $params, $toolbar);
        JLMS_TMPL::OpenTS('', ' width="100%"');
        ?>
				<table cellpadding="0" cellspacing="0" border="0" width="100%" id="jlms_course_desc_guest">
					<?php 
        $_JLMS_PLUGINS->loadBotGroup('system');
        $plugin_args = array();
        $plugin_args[] = $id;
        $_JLMS_PLUGINS->trigger('onAboveCourseDetailsPage', $plugin_args);
        ?>
					<tr>
						<td>
						<?php 
        echo JLMS_ShowText_WithFeatures($row->course_description);
        ?>
						</td>
					</tr>
					<?php 
        //$_JLMS_PLUGINS->loadBotGroup('system');
        $plugin_args = array();
        $plugin_args[] = $id;
        $_JLMS_PLUGINS->trigger('onBelowCourseDetailsPage', $plugin_args);
        ?>
				</table>
		<?php 
        JLMS_TMPL::CloseTS();
        if ($show_down_back) {
            JLMS_TMPL::OpenTS('', ' style="text-align:center"');
            ?>
			<br /><br /><a class="back_button" href="<?php 
            echo sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}");
            ?>
"><?php 
            echo _JLMS_TXT_BACK;
            ?>
</a>
		<?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 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 editTopic($course_id, $topic_id, $row, $lists)
    {
        global $option, $Itemid, $JLMS_CONFIG;
        $is_dis_start = !($row->publish_start == 1);
        $is_dis_end = !($row->publish_end == 1);
        ?>
<script language="javascript" type="text/javascript">
<!--//--><![CDATA[//><!--
	window.addEvent('domready', function() {
		<?php 
        if ($is_dis_start) {
            ?>
	
				document.adminForm.startday.disabled = true;
				document.adminForm.startmonth.disabled = true;
				document.adminForm.startyear.disabled = true;
		<?php 
        }
        if ($is_dis_end) {
            ?>
			
				document.adminForm.endday.disabled = true;
				document.adminForm.endmonth.disabled = true;
				document.adminForm.endyear.disabled = true;	
		<?php 
        }
        ?>
	
	}
	);
	function setgood() {
		return true;
	}
	function submitbutton(pressbutton) {
		var form=document.adminForm;

		try {
			form.onsubmit();
		} catch(e) {
			//alert(e);
		}

		if (is_start_c == 1) {if (form.start_date.value == ''){jlms_getDate('start');}}
		if (is_end_c == 1) {if (form.end_date.value == ''){jlms_getDate('end');}}
		if ((pressbutton=='save_topic') && (form.name.value=="" && $weekly==0)){alert("<?php 
        echo _JLMS_TOPIC_T_NAME_NOT_SET;
        ?>
");
		} else {form.task.value = pressbutton;form.submit();}
	}
	var is_start_c = <?php 
        echo $row->publish_start ? '1' : '0';
        ?>
; 
	var is_end_c = <?php 
        echo $row->publish_end ? '1' : '0';
        ?>
;
	function jlms_Change_start() {
		var form=document.adminForm;
		if (is_start_c == 1) {
			is_start_c = 0
			form.startday.disabled = true;
			form.startmonth.disabled = true;
			form.startyear.disabled = true;
		} else {
			is_start_c = 1
			form.startday.disabled = false;
			form.startmonth.disabled = false;
			form.startyear.disabled = false;
		}
	}
	function jlms_Change_end() {
		var form=document.adminForm;
		if (is_end_c == 1) {
			is_end_c = 0
			form.endday.disabled = true;
			form.endmonth.disabled = true;
			form.endyear.disabled = true;
		} else {
			is_end_c = 1
			form.endday.disabled = false;
			form.endmonth.disabled = false;
			form.endyear.disabled = false;
		}
	}
	var $weekly=0;
	function jlms_Change_weekly() {
		showNameFields();
		var form=document.adminForm;
		$weekly = getNameFieldsCount();
		if ($weekly > 1) {
			$weekly = 0;
		} else {
			$weekly = 1;
		}
		
		if ($weekly == 1) {
			$weekly = 0;
			form.weekly.value = 0;
			form.publish_end.disabled = false;			
		} else {
			$weekly = 1;
			form.weekly.value = 1;
			is_end_c = 0;
			form.publish_end.checked = false;			
			form.publish_end.disabled = true;			
			form.endday.disabled = true;
			form.endmonth.disabled = true;
			form.endyear.disabled = true;
			is_start_c = 1
			form.publish_start.checked = true;
			form.startday.disabled = false;
			form.startmonth.disabled = false;
			form.startyear.disabled = false;
		}
	}
	function getNameFieldsCount() {
		var $select = document.adminForm.number;
		for ($i=0; $i<$select.length; $i++) {
			if ($select.options[$i].selected == true) {
				return $select.options[$i].value;
			}
		}
	}
	function showNameFields() {
		$count = getNameFieldsCount();
		for ($i=2; $i<=$count; $i++) {
			$div = document.getElementById('name_'+$i);
			$div.style.display = 'block';
		}
		for ( ; $i<=10; $i++) {
			$div = document.getElementById('name_'+$i);
			$div.style.display = 'none';
		}
	}	
	
	//--><!]]>
</script>
<?php 
        JLMS_TMPL::OpenMT();
        $hparams = array();
        $toolbar = array();
        $title = '';
        $title = $row->id ? _JLMS_TOPIC_T_EDIT : _JLMS_TOPIC_T_NEW;
        $toolbar[] = array('btn_type' => 'save', 'btn_js' => "javascript:submitbutton('save_topic');");
        $toolbar[] = array('btn_type' => 'cancel', 'btn_js' => "javascript:submitbutton('cancel_topic');");
        JLMS_TMPL::ShowHeader('doc', $title, $hparams, $toolbar);
        JLMS_TMPL::OpenTS();
        ?>
		<form action="<?php 
        echo sefRelToAbs("index.php?option=" . $option . "&amp;Itemid=" . $Itemid);
        ?>
" method="post" name="adminForm" enctype="multipart/form-data" onsubmit="setgood();">
			<table width="100%" cellpadding="0" cellspacing="0" border="0" id="jlms_item_properties">
				<tr>
					<td width="15%" valign="middle" style="vertical-align:middle"><?php 
        echo _JLMS_TOPIC_T_NAME;
        ?>
</td>
					<td><input class="inputbox" size="40" type="text" name="name" value="<?php 
        echo str_replace('"', '&quot;', $row->name);
        ?>
" />
						<?php 
        if ($topic_id == 0) {
            echo $lists['names'];
        }
        ?>
					</td>
				</tr>
				<tr>
					<td valign="middle" style="vertical-align:middle"><br /><?php 
        echo _JLMS_PUBLISHING;
        ?>
</td>
					<td><br /><?php 
        echo $lists['publishing'];
        ?>
</td>
				</tr>
				<?php 
        if ($topic_id == 0) {
            ?>
				<tr>
					<td><?php 
            echo _JLMS_TOPIC_T_10_WEEKLY;
            ?>
</td>
					<td><?php 
            echo $lists['number'];
            ?>
</td>
				</tr>
				<?php 
        }
        ?>
				<tr>
					<td valign="middle" style="vertical-align:middle"><br /><?php 
        echo _JLMS_ORDERING;
        ?>
</td>
					<td><br /><?php 
        echo $lists['ordering'];
        ?>
</td>
				</tr>
				<tr>
					<td valign="middle"><br /><?php 
        echo _JLMS_START_DATE;
        ?>
</td>
					<td valign="middle" style="vertical-align:middle "><br />
						<table cellpadding="0" cellspacing="0" border="0" class="jlms_date_outer"><tr><td valign="middle"><input type="checkbox" value="1" name="publish_start" onclick="jlms_Change_start()" <?php 
        echo $row->publish_start ? 'checked' : '';
        ?>
 /></td>
						<td valign="middle" style="vertical-align:middle ">
						<?php 
        $s_date = $is_dis_start ? date('Y-m-d') : $row->start_date;
        echo JLMS_HTML::_('calendar.calendar', $s_date, 'start', 'start');
        ?>
						</td></tr></table>
					</td>
				</tr>	
				<tr>
					<td><br /><?php 
        echo _JLMS_END_DATE;
        ?>
</td>
					<td valign="middle" style="vertical-align:middle "><br />
						<table cellpadding="0" cellspacing="0" border="0" class="jlms_date_outer"><tr><td valign="middle"><input type="checkbox" value="1" name="publish_end" onclick="jlms_Change_end()" <?php 
        echo $row->publish_end ? 'checked' : '';
        ?>
 /></td>
						<td valign="middle" style="vertical-align:middle ">
						<?php 
        $e_date = $is_dis_end ? date('Y-m-d') : $row->end_date;
        echo JLMS_HTML::_('calendar.calendar', $e_date, 'end', 'end');
        ?>
						</td></tr></table>
					</td>
				</tr>
				<tr>
					<td width="15%" valign="top" style="vertical-align:top "><br /><?php 
        echo _JLMS_IS_TIME_RELATED;
        ?>
</td>
					<td><br />
						<?php 
        JLMS_HTML::_('showperiod.field', $row->is_time_related, $row->show_period);
        ?>
					</td>
				</tr>					
				<tr>
					<td colspan="2" valign="top" align="left" style="text-align:left "><br /><?php 
        echo _JLMS_DESCRIPTION;
        ?>
</td>
				</tr>	
				<tr>
					<td colspan="2">
						<?php 
        JLMS_editorArea('editor1', $row->description, 'description', '100%;', '250', '40', '20');
        ?>
					</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="details_course" />
			<input type="hidden" name="boxchecked" value="0" />
			<input type="hidden" name="weekly" value="0" />
			<input type="hidden" name="course_id" value="<?php 
        echo $course_id;
        ?>
" />
			<input type="hidden" name="id" value="<?php 
        echo $row->id;
        ?>
" />
		</form>
<?php 
        JLMS_TMPL::CloseTS();
        JLMS_TMPL::CloseMT();
    }
    function show_head_menu($id, $option = '')
    {
        $JLMS_CONFIG =& JLMSFactory::getConfig();
        $Itemid = $JLMS_CONFIG->get('Itemid');
        $JLMS_ACL =& JLMSFactory::getACL();
        ?>
<script language="JavaScript" type="text/javascript">
<!--//--><![CDATA[//><!--
	function jlms_ShowTBToolTip_agenda(txt_tooltip_agenda) {
		var agenda_elem = getObj('JLMS_toolbar_tooltip_agenda');
		agenda_elem.innerHTML = txt_tooltip_agenda;
	}
//--><!]]>
</script>
<?php 
        JLMS_TMPL::OpenMT();
        $hparams = array();
        JLMS_TMPL::ShowHeader('agenda', _JLMS_AGENDA_HEADTITLE, $hparams);
        JLMS_TMPL::OpenTS('', ' align="center"');
        ?>
		<table align="center" class="jlms_table_no_borders">
			<tr><td align="center" style="text-align:center "><span id="JLMS_toolbar_tooltip_agenda">&nbsp;</span></td></tr>
			<tr>
				<td align="center" nowrap="nowrap" style="white-space:nowrap;">
				<?php 
        if ($id && $JLMS_ACL->CheckPermissions('announce', 'manage')) {
            if (isset($_REQUEST['cal_date'])) {
                $id .= "&amp;date=" . $_REQUEST['cal_date'];
            }
            ?>
				<a class="jlms_img_link" onmouseover='javascript:jlms_ShowTBToolTip_agenda("<?php 
            echo _JLMS_AGENDATB_ADDEVENT;
            ?>
");jlms_WStatus("<?php 
            echo _JLMS_AGENDATB_ADDEVENT;
            ?>
");return true;' onmouseout='javascript:jlms_ShowTBToolTip_agenda("&nbsp;");jlms_WStatus("");return true;' href="<?php 
            echo JRoute::_("index.php?option=com_joomla_lms&amp;Itemid=" . $Itemid . "&amp;task=agenda&amp;mode=add_event&amp;id=" . $id);
            ?>
"><img src="<?php 
            echo $JLMS_CONFIG->get('live_site');
            ?>
/components/com_joomla_lms/lms_images/agenda/ag_edit_add.png" class="JLMS_png" id="add" alt="<?php 
            echo _JLMS_AGENDATB_ADDEVENT;
            ?>
" title="<?php 
            echo _JLMS_AGENDATB_ADDEVENT;
            ?>
"  width="22" height="22"  border="0"/></a>&nbsp;&nbsp;
				<?php 
        }
        ?>
				<a class="jlms_img_link" onmouseover='javascript:jlms_ShowTBToolTip_agenda("<?php 
        echo _JLMS_AGENDATB_LIST;
        ?>
");jlms_WStatus("<?php 
        echo _JLMS_AGENDATB_LIST;
        ?>
");return true;' onmouseout='javascript:jlms_ShowTBToolTip_agenda("&nbsp;");jlms_WStatus("");return true;' href="<?php 
        echo sefRelToAbs("index.php?option=com_joomla_lms&amp;Itemid=" . $Itemid . "&amp;task=agenda&amp;id=" . $id);
        ?>
"><img src="<?php 
        echo $JLMS_CONFIG->get('live_site');
        ?>
/components/com_joomla_lms/lms_images/agenda/ag_list.png" class="JLMS_png" id="home" alt="<?php 
        echo _JLMS_AGENDATB_LIST;
        ?>
" title="<?php 
        echo _JLMS_AGENDATB_LIST;
        ?>
" width="22" height="22"  border="0"/></a>&nbsp;&nbsp;
				<a class="jlms_img_link" onmouseover='javascript:jlms_ShowTBToolTip_agenda("<?php 
        echo _JLMS_AGENDATB_MONTHLY_VIEW;
        ?>
");jlms_WStatus("<?php 
        echo _JLMS_AGENDATB_MONTHLY_VIEW;
        ?>
");return true;' onmouseout='javascript:jlms_ShowTBToolTip_agenda("&nbsp;");jlms_WStatus("");return true;' href="<?php 
        echo sefRelToAbs("index.php?option=com_joomla_lms&amp;Itemid=" . $Itemid . "&amp;task=agenda&amp;mode=view_month&amp;id={$id}");
        ?>
"><img src="<?php 
        echo $JLMS_CONFIG->get('live_site');
        ?>
/components/com_joomla_lms/lms_images/agenda/ag_month.png" class="JLMS_png" id="month" alt="<?php 
        echo _JLMS_AGENDATB_MONTHLY_VIEW;
        ?>
" title="<?php 
        echo _JLMS_AGENDATB_MONTHLY_VIEW;
        ?>
" width="22" height="22" border="0"/></a>&nbsp;&nbsp;
				<a class="jlms_img_link" onmouseover='javascript:jlms_ShowTBToolTip_agenda("<?php 
        echo _JLMS_AGENDATB_WEEKLY_VIEW;
        ?>
");jlms_WStatus("<?php 
        echo _JLMS_AGENDATB_WEEKLY_VIEW;
        ?>
");return true;' onmouseout='javascript:jlms_ShowTBToolTip_agenda("&nbsp;");jlms_WStatus("");return true;' href="<?php 
        echo sefRelToAbs("index.php?option=com_joomla_lms&amp;Itemid=" . $Itemid . "&amp;task=agenda&amp;mode=view_week&amp;id={$id}");
        ?>
"><img src="<?php 
        echo $JLMS_CONFIG->get('live_site');
        ?>
/components/com_joomla_lms/lms_images/agenda/ag_7days.png" class="JLMS_png" id="week" alt="<?php 
        echo _JLMS_AGENDATB_WEEKLY_VIEW;
        ?>
" title="<?php 
        echo _JLMS_AGENDATB_WEEKLY_VIEW;
        ?>
" width="22" height="22"  border="0"/></a>&nbsp;&nbsp;
				<a class="jlms_img_link" onmouseover='javascript:jlms_ShowTBToolTip_agenda("<?php 
        echo _JLMS_AGENDATB_DAILY_VIEW;
        ?>
");jlms_WStatus("<?php 
        echo _JLMS_AGENDATB_DAILY_VIEW;
        ?>
");return true;' onmouseout='javascript:jlms_ShowTBToolTip_agenda("&nbsp;");jlms_WStatus("");return true;' href="<?php 
        echo sefRelToAbs("index.php?option=com_joomla_lms&amp;Itemid=" . $Itemid . "&amp;task=agenda&amp;mode=view_day&amp;id={$id}");
        ?>
"><img src="<?php 
        echo $JLMS_CONFIG->get('live_site');
        ?>
/components/com_joomla_lms/lms_images/agenda/ag_1day.png"  class="JLMS_png" id="day" alt="<?php 
        echo _JLMS_AGENDATB_DAILY_VIEW;
        ?>
" title="<?php 
        echo _JLMS_AGENDATB_DAILY_VIEW;
        ?>
"  width="22" height="22" border="0"/></a>
				</td>
			</tr>
		</table>
<?php 
        JLMS_TMPL::CloseTS();
        JLMS_TMPL::CloseMT();
    }
    function confirm_delUsers(&$del_users, &$lists, $option, $course_id, $group_id, $utype, $del_group)
    {
        global $Itemid;
        ?>
<script language="javascript" type="text/javascript">
<!--
function submitbutton(pressbutton) {
	var form = document.adminForm;
	if ((pressbutton == 'user_delete_yes') && (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();
        if ($utype == 1) {
            $hparams['sys_msg'] = _JLMS_USERS_DEL_ALERT_MESSAGE;
        } elseif ($utype == 2) {
            $hparams['sys_msg'] = _JLMS_USERS_DEL_A_ALERT_MESSAGE;
        }
        $toolbar = array();
        $toolbar[] = array('btn_type' => 'yes', 'btn_js' => "javascript:submitbutton('" . ($group_id == -1 ? 'user_delete_yes2' : 'user_delete_yes') . "');");
        $toolbar[] = array('btn_type' => 'cancel', 'btn_js' => "javascript:submitbutton('" . ($group_id == -1 ? 'cancel_csv_delete' : 'cancel_user') . "');");
        $hparams['toolbar_position'] = 'center';
        JLMS_TMPL::ShowHeader('userman', _JLMS_USERS_DEL_TITLE, $hparams, $toolbar);
        JLMS_TMPL::OpenTS();
        ?>
		<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');
        ?>
" align="center"><input type="checkbox" name="toggle" value="" onclick="checkAll(<?php 
        echo count($del_users);
        ?>
);" /></<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
					<<?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_USER_GROUP;
        ?>
</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
				</tr>
			<?php 
        $k = 1;
        for ($i = 0, $n = count($del_users); $i < $n; $i++) {
            $row = $del_users[$i];
            $link = "index.php?option=" . $option . "&amp;Itemid=" . $Itemid . "&amp;task=view_users&amp;course_id=" . $course_id . "&amp;id=" . $row->id;
            $checked = JLMS_course_users_html::idBox($i, $row->id, true);
            ?>
				<tr class="<?php 
            echo JLMSCSS::_('sectiontableentry' . $k);
            ?>
">
					<td align="center"><?php 
            echo $i + 1;
            ?>
</td>
					<td><?php 
            echo $checked;
            ?>
</td>
					<td align="left">
					<?php 
            echo $row->username;
            ?>
					</td>
					<td><?php 
            echo $row->name;
            ?>
 (<?php 
            echo $row->email;
            ?>
)</td>
					<?php 
            if ($utype == 1) {
                ?>
					<td><?php 
                echo $row->ug_name ? $row->ug_name : _JLMS_USER_NO_GROUP_NAME;
                ?>
</td>
					<?php 
            } else {
                ?>
					<td><?php 
                echo _JLMS_USER_ASSIST_GROUP_NAME;
                ?>
</td>
					<?php 
            }
            ?>
				</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="delete_user" />
			<input type="hidden" name="course_id" value="<?php 
        echo $course_id;
        ?>
" />
			<input type="hidden" name="id" value="<?php 
        echo $group_id;
        ?>
" />
			<input type="hidden" name="group_id" value="<?php 
        echo $group_id;
        ?>
" />
			<input type="hidden" name="boxchecked" value="<?php 
        echo count($del_users);
        ?>
" />
			<input type="hidden" name="row_id" value="0" />
			<input type="hidden" name="state" value="0" />
			<input type="hidden" name="del_group" value="<?php 
        echo $del_group ? '1' : '0';
        ?>
" />
			<input type="hidden" name="utype" value="<?php 
        echo $utype;
        ?>
" />
		</form>
	<?php 
        JLMS_TMPL::CloseTS();
        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 NewDocLink($doc_details, $lists, $id, $option, $cur_id)
    {
        $JLMS_CONFIG =& JLMSFactory::getConfig();
        $Itemid = $JLMS_CONFIG->get('Itemid');
        $rows_c = $lists['collapsed_folders'];
        $rows = $lists['out_files'];
        $is_dis_start = !($doc_details->publish_end == 1);
        $is_dis_end = !($doc_details->publish_end == 1);
        ?>
	
	<script language="javascript" type="text/javascript">
	<!--//--><![CDATA[//><!--
	window.addEvent('domready', function() {
			document.adminForm.startday.disabled = true;
			document.adminForm.startmonth.disabled = true;
			document.adminForm.startyear.disabled = true;
				
			document.adminForm.endday.disabled = true;
			document.adminForm.endmonth.disabled = true;
			document.adminForm.endyear.disabled = true;		
	}
	);
	function submitbutton(pressbutton) {
		var form=document.adminForm;
		if (is_start_c == 1) {if (form.start_date.value == ''){jlms_getDate('start');}}
		if (is_end_c == 1) {if (form.end_date.value == ''){jlms_getDate('end');}}
	
		form.task.value = pressbutton;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 = '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 = '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 ++;
	}
}	
	
	
	var is_start_c = <?php 
        echo $doc_details->publish_start ? '1' : '0';
        ?>
; var is_end_c = <?php 
        echo $doc_details->publish_end ? '1' : '0';
        ?>
;
function jlms_Change_start() {
	var form=document.adminForm;
	if (is_start_c == 1) {
		is_start_c = 0
		form.startday.disabled = true;
		form.startmonth.disabled = true;
		form.startyear.disabled = true;
	} else {
		is_start_c = 1
		form.startday.disabled = false;
		form.startmonth.disabled = false;
		form.startyear.disabled = false;
	}
}
function jlms_Change_end() {
	var form=document.adminForm;
	if (is_end_c == 1) {
		is_end_c = 0
		form.endday.disabled = true;
		form.endmonth.disabled = true;
		form.endyear.disabled = true;
	} else {
		is_end_c = 1
		form.endday.disabled = false;
		form.endmonth.disabled = false;
		form.endyear.disabled = false;
	}
}
//--><!]]>
</script>
	<?php 
        JLMS_TMPL::OpenMT();
        $hparams = array();
        $toolbar = array();
        $title = '';
        $title = $doc_details->id ? _JLMS_DOCS_TITLE_EDIT_DOC : _JLMS_DOCS_TITLE_NEW_DOC;
        $toolbar[] = array('btn_type' => 'save', 'btn_js' => "javascript:submitbutton('save_doclink');");
        $toolbar[] = array('btn_type' => 'cancel', 'btn_js' => "javascript:submitbutton('cancel_doc');");
        if (!empty($rows)) {
            JLMS_TMPL::ShowHeader('doc', $title, $hparams, $toolbar);
        }
        JLMS_TMPL::OpenTS();
        ?>
		<form action="<?php 
        echo sefRelToAbs("index.php?option=" . $option . "&amp;Itemid=" . $Itemid);
        ?>
" method="post" name="adminForm" enctype="multipart/form-data">
			<?php 
        $max_tree_width = 0;
        if (isset($rows[0])) {
            $max_tree_width = $rows[0]->tree_max_width;
        }
        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">&nbsp;#&nbsp;</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 width="16" class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
"><input type="checkbox" value="0" name="hidden_box" style="visibility:hidden" /></<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
						<?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: 200px; text-align: left;"><?php 
            echo _JLMS_DOCS_TBL_DOCNAME;
            ?>
</span></<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
						<<?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;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;
                }
                // 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;
                    }
                }
                $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 ($row->folder_flag != 1) {
                    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 {
                    ?>
							<a href="<?php 
                    echo $link;
                    ?>
" title="<?php 
                    echo $link_title;
                    ?>
">
								&nbsp;<?php 
                    echo $row->doc_name;
                    ?>
							</a>
						<?php 
                }
                ?>
						</span>
						</td>

						<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>

			<table width="100%" cellpadding="0" cellspacing="0" border="0" class="jlms_item_properties">
				<tr>
					<td valign="middle" style="vertical-align:middle"><br /><?php 
            echo _JLMS_PLACE_IN;
            ?>
</td>
					<td><br /><?php 
            echo $lists['course_folders'];
            ?>
</td>
				</tr>	
				<tr>
					<td valign="middle" style="vertical-align:middle"><br /><?php 
            echo _JLMS_PUBLISHING;
            ?>
</td>
					<td><br /><?php 
            echo $lists['publishing'];
            ?>
</td>
				</tr>
				<tr>
					<td valign="middle"><br /><?php 
            echo _JLMS_START_DATE;
            ?>
</td>
					<td valign="middle" style="vertical-align:middle "><br />
						<table cellpadding="0" cellspacing="0" border="0" class="jlms_date_outer"><tr><td valign="middle"><input type="checkbox" value="1" name="is_start" onclick="jlms_Change_start()" <?php 
            echo $doc_details->publish_start ? 'checked' : '';
            ?>
 /></td>
						<td valign="middle" style="vertical-align:middle ">
						<?php 
            $s_date = $is_dis_start ? date('Y-m-d') : $doc_details->start_date;
            echo JLMS_HTML::_('calendar.calendar', $s_date, 'start', 'start');
            ?>
						</td></tr></table>
					</td>
				</tr>	
				<tr>
					<td><br /><?php 
            echo _JLMS_END_DATE;
            ?>
</td>
					<td valign="middle" style="vertical-align:middle "><br />
						<table cellpadding="0" cellspacing="0" border="0" class="jlms_date_outer"><tr><td valign="middle"><input type="checkbox" value="1" name="is_end" onclick="jlms_Change_end()" <?php 
            echo $doc_details->publish_end ? 'checked="checked"' : '';
            ?>
 /></td>
						<td valign="middle" style="vertical-align:middle ">
						<?php 
            $e_date = $is_dis_end ? date('Y-m-d') : $doc_details->end_date;
            echo JLMS_HTML::_('calendar.calendar', $e_date, 'end', 'end');
            ?>
						</td></tr></table>
					</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="update_document" />
			<input type="hidden" name="boxchecked" value="0" />
			<input type="hidden" name="course_id" value="<?php 
        echo $id;
        ?>
" />
			<input type="hidden" name="folder_flag" value="0" />
			<input type="hidden" name="id" value="<?php 
        echo $doc_details->id;
        ?>
" />
		</form>
<?php 
        JLMS_TMPL::CloseTS();
        JLMS_TMPL::CloseMT();
    }
Esempio n. 10
0
    function showChat($course_id, $group_id, $option, $lists, $chat_users)
    {
        global $Itemid, $JLMS_CONFIG;
        $additon_js = '
var Chat_scroll_obj;
function jlms_prepare_el_Chat_scroll_obj() {
	var Chat_scroll_obj = new Fx.Scroll(\'jlms_chat_window\', {
		wait: false,
		duration: 0,
		offset: {\'x\': 0, \'y\': 0}
	});
	Chat_scroll_obj.toBottom();
}
';
        $JLMS_CONFIG->set('jlms_aditional_js_code', $JLMS_CONFIG->get('jlms_aditional_js_code', '') . $additon_js);
        $domready = '
jlms_prepare_el_Chat_scroll_obj();
';
        $JLMS_CONFIG->set('web20_domready_code', $JLMS_CONFIG->get('web20_domready_code', '') . $domready);
        ?>
<script language="javascript" type="text/javascript">
<!--
var timer_msec = 4000;
var block_chat = 0;
var chat_last_msg = 0;
var ste_k = 2;
var tID = '';
var url_prefix = '<?php 
        echo "index.php?tmpl=component&option={$option}&Itemid={$Itemid}&id={$course_id}&group_id={$group_id}";
        ?>
';
function jlms_MakeRequest(url) {
	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() { if (window.jlms_AnalizeRequest) {jlms_AnalizeRequest(http_request);} };
	http_request.open('POST', url_prefix, true);
	http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	http_request.setRequestHeader("Content-length", url.length);	
	http_request.send(url);
}
function jlms_AnalizeRequest(http_request) {
	if (http_request.readyState == 4) {
		if ((http_request.status == 200)) {
			block_chat = 0;
			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 task = response.getElementsByTagName('task')[0].firstChild.data;
			switch (task) {
				case 'chat_xml':
					//var response_chat = response.getElementsByTagName('chat_history')[0].firstChild.data;
					var response_users = response.getElementsByTagName('chat_users')[0].firstChild.data;
					var chat_last_id = response.getElementsByTagName('chat_last_id')[0].firstChild.data;
					if (parseInt(chat_last_id)) {
						chat_last_msg = parseInt(chat_last_id);
					}
					//var response_do_scroll = response.getElementsByTagName('do_scroll')[0].firstChild.data;

					/*getObj('JLMS_chat_history').innerHTML = response_chat;
					getObj('JLMS_chat_users').innerHTML   = response_users;

					if (response_do_scroll == 1 || response_do_scroll == '1') {
						if ($defined(Chat_scroll_obj)) {
							var type = typeof Chat_scroll_obj;
							if (type == 'object') {
								Chat_scroll_obj.toBottom();
							} else {
								jlms_prepare_el_Chat_scroll_obj();
							}
						} else {
							jlms_prepare_el_Chat_scroll_obj();
						}
					}*/
					var count_new_mess = response.getElementsByTagName('count_new_msgs')[0].firstChild.data;
					if(parseInt(count_new_mess)){
						count_new_mess = parseInt(count_new_mess);
						var el_history = getObj('jlms_chathistory');
						for(var j=1;j < (count_new_mess + 1);j++){
							var message = response.getElementsByTagName('chat_message_'+j)[0].firstChild.data;
							var tbody = new Array();
							tbody = el_history.childNodes;
							for(var i=0;i < tbody.length;i++){
								if(tbody[i].tagName == "TBODY"){
									var el_tbody = tbody[i];	
								}
							}
							var tr_111 = document.createElement("tr");
							var td_111 = document.createElement("td");
							td_111.innerHTML = message;
							tr_111.appendChild(td_111);
							tr_111.className = 'sectiontableentry'+ste_k;
							ste_k = 3 - ste_k;
							el_tbody.appendChild(tr_111);
						}
						/*var scroll_y = parseInt(el_history.offsetHeight);
						document.getElementById("jlms_chat_window").scrollTop = scroll_y;*/
						if ($defined(Chat_scroll_obj)) {
							var type = typeof Chat_scroll_obj;
							if (type == 'object') {
								Chat_scroll_obj.toBottom();
							} else {
								jlms_prepare_el_Chat_scroll_obj();
							}
						} else {
							jlms_prepare_el_Chat_scroll_obj();
						}
					}
					clearTimeout(tID);
					tID = setTimeout("jlms_RequestChatHistory()", timer_msec);
				break;
			}
		} else {
		}
	}
}
function ctrlenter(e){
	$('chat_new_mes').onkeypress = function(event){
		var event = new Event(event);
		if ( ((window.opera || window.gecko) && event.code == '13' && event.control) || ((window.ie || window.webkit) && event.code == '10' && event.control) ){
			jlms_chatPostMessage();
		}
	}
}
function jlms_RequestChatHistory() {
	jlms_MakeRequest('task=get_chat_xml&last_msg='+chat_last_msg);
}
function TRIM_str(sStr) {
	return (sStr.replace(/^[\s\xA0]+/, "").replace(/[\s\xA0]+$/, ""));
}
function URLencode(sStr) {
	return escape(sStr).replace(/\+/g, '%2B').replace(/\"/g,'%22').replace(/\'/g, '%27').replace(/\//g,'%2F');
}
function jlms_chatPostMessage() {
	if (block_chat != 1) {
		clearTimeout(tID);
		var form = document.chatMesForm;
		var user_message = form.chat_new_mes.value;
		if (user_message != '') {
			form.chat_new_mes.value = '';
			if (TRIM_str(user_message) != '') 
			{
				block_chat = 1;				
				jlms_MakeRequest('task=chat_post&last_msg='+chat_last_msg+'&message='+URLencode(TRIM_str(user_message)));
			}
		}
	}
}
//-->
</script>
<?php 
        JLMS_TMPL::OpenMT();
        $hparams = array();
        JLMS_TMPL::ShowHeader('chat', _JLMS_CHAT_TITLE, $hparams);
        JLMS_TMPL::OpenTS();
        ?>
		<noscript>
			<div class="joomlalms_sys_message">
			<?php 
        echo _JLMS_JS_COOKIES_REQUIRES;
        ?>
			</div>
		</noscript>
		<table cellpadding="0" cellspacing="0" border="0" width="100%" class="jlms_table_no_borders">
			<tr>
				<td colspan="2" align="right" style="text-align:right ">
					<form action="<?php 
        echo sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}");
        ?>
" method="post" name="chatForm">
						<?php 
        echo $lists['course_chats'];
        ?>
						<input type="hidden" name="option" value="<?php 
        echo $option;
        ?>
" />
						<input type="hidden" name="Itemid" value="<?php 
        echo $Itemid;
        ?>
" />
						<input type="hidden" name="task" value="chat" />
						<input type="hidden" name="id" value="<?php 
        echo $course_id;
        ?>
" />
					</form>
				</td>
			</tr>
		</table>
		<div style="width:100%; height:400px; overflow:auto; overflow-x:hidden;" id="jlms_chat_window">
		<table cellpadding="0" cellspacing="1" border="0" width="100%" class="<?php 
        echo JLMSCSS::_('jlmslist');
        ?>
">
			<tr>
				<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" width="70%"><?php 
        echo _JLMS_CHAT_TBL_HEAD_CHAT;
        ?>
</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
				<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" width="30%"><?php 
        echo _JLMS_CHAT_TBL_HEAD_USERS;
        ?>
</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
			</tr>
			<tr>
				<td id="JLMS_chat_history" valign="top" align="left" style="text-align:left;padding:0px;margin:0px;" width="70%">
					<table width="100%" cellpadding="0" cellspacing="0" border="0" id="jlms_chathistory" class="<?php 
        echo JLMSCSS::_('jlmslist');
        ?>
" style="margin:0px; padding:0px;">
						<tr class="<?php 
        echo JLMSCSS::_('sectiontableentry1');
        ?>
"><td align="left"><?php 
        echo _JLMS_CHAT_WELCOME_MESSAGE;
        ?>
</td></tr>
					</table>
				</td>
				<td id="JLMS_chat_users" valign="top" align="left" style="text-align:left;padding:0px;margin:0px;" width="30%">
					<?php 
        echo JLMS_chat_html::prepareUserList($chat_users);
        ?>
				</td>
			</tr>
		</table>
		</div>
		<table cellpadding="0" cellspacing="0" border="0" width="100%" class="jlms_table_no_borders">
			<tr>
				<td>
					<form action="<?php 
        echo sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}");
        ?>
" onsubmit="jlms_chatPostMessage();return false;" method="get" name="chatMesForm">
					<table cellpadding="0" cellspacing="0" border="0" width="100%" class="jlms_table_no_borders">
						<tr>
							<td align="left" width="90%">
								<textarea id="chat_new_mes" name="chat_new_mes" class="inputbox" cols="65" rows="3" style="width:99%; overflow-y:auto; border: 1px solid rgb(198, 198, 198);" onkeypress="ctrlenter(this);"></textarea>
							</td>
							<td align="left" style="padding-left:20px; width:64px;">
								<img class="JLMS_png" src="<?php 
        echo $JLMS_CONFIG->get('live_site');
        ?>
/components/<?php 
        echo $option;
        ?>
/lms_images/send_post_chat.png" border="0" alt="<?php 
        echo _JLMS_CHAT_BTN_POST;
        ?>
" title="<?php 
        echo _JLMS_CHAT_BTN_POST;
        ?>
" onclick="jlms_chatPostMessage();" style="cursor:pointer;"/>
							</td>
						</tr>
					</table>
					</form>
				</td>
			</tr>
		</table>
		<script language="javascript" type="text/javascript">
		<!--
		tID = setTimeout("jlms_RequestChatHistory()", timer_msec);
		//-->
		</script>
<?php 
        JLMS_TMPL::CloseTS();
        JLMS_TMPL::CloseMT();
    }
    function viewDRPDescription($course_id, $option, &$row, &$lists)
    {
        global $Itemid;
        JLMS_TMPL::OpenMT();
        $hparams = array();
        $toolbar = array();
        $toolbar[] = array('btn_type' => 'back', 'btn_js' => sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=dropbox&amp;id={$course_id}"));
        JLMS_TMPL::ShowHeader('dropbox', $row->drp_name, $hparams, $toolbar);
        JLMS_TMPL::OpenTS();
        ?>
			<table width="100%" cellpadding="0" cellspacing="0" border="0" class="jlms_table_no_borders">
				<tr>
					<td align="left" style="text-align:left "><br />
						<table align="left" width="60%" cellpadding="0" cellspacing="0" border="0" class="jlms_table_no_borders">
						<tr>
							<td width="50%" align="left" style="text-align:left ">&nbsp;&nbsp;<?php 
        echo _JLMS_DROP_SENDER;
        ?>
</td>
							<td width="50%" align="left" style="text-align:left "><?php 
        echo $row->owner_username;
        ?>
</td>
						</tr>
						<tr>
							<td width="50%" align="left" style="text-align:left ">&nbsp;&nbsp;<?php 
        echo _JLMS_DROP_RECV;
        ?>
</td>
							<td width="50%" align="left" style="text-align:left "><?php 
        echo $row->recv_username;
        ?>
</td>
						</tr>
						</table>
					</td>
				</tr>
				<tr>
					<td><br />
						<?php 
        echo $row->drp_description;
        ?>
					</td>
				</tr>
			</table>
<?php 
        JLMS_TMPL::CloseTS();
        JLMS_TMPL::CloseMT();
    }
    function wrapper_course_forum(&$link, $option, $course_id, $msg)
    {
        global $Itemid, $JLMS_CONFIG, $JLMS_LANGUAGE;
        JLMS_require_lang($JLMS_LANGUAGE, 'course_users.lang', $JLMS_CONFIG->get('default_language'));
        if (!defined('_USERNAME')) {
            define('_USERNAME', $JLMS_LANGUAGE['_JLMS_USER_USERNAME']);
        }
        if (!defined('_PASSWORD')) {
            define('_PASSWORD', $JLMS_LANGUAGE['_JLMS_USER_PASS']);
        }
        if (!defined('_BUTTON_LOGIN')) {
            define('_BUTTON_LOGIN', 'Login');
        }
        JLMS_TMPL::OpenMT();
        $hparams = array();
        JLMS_TMPL::ShowHeader('forum', _JLMS_HEAD_FORUM_STR, $hparams);
        if ($msg) {
            JLMS_TMPL::ShowSysMessage($msg);
        }
        JLMS_TMPL::OpenTS('', ' align="center" style="text-align:center; width:100%; height:100% " valign="top"');
        if ($msg) {
            ?>
			<br />
			<form action="<?php 
            echo sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}");
            ?>
" enctype="multipart/form-data" method="post" name="adminForm">
				<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
					<tr>
						<td align="center">
							<table border="0" cellspacing="0" cellpadding="0" align="center">
								<tr>
									<td align="left">
										<label for="mod_login_username">
											<?php 
            echo _USERNAME;
            ?>
										</label>
									</td>
									<td align="left">
										<input name="username" id="mod_login_username" type="text" class="inputbox" alt="username" size="10" />
									</td>
								</tr>
								<tr>
									<td align="left">
										<label for="mod_login_password">
											<?php 
            echo _PASSWORD;
            ?>
										</label>
									</td>
									<td align="left">
										<input type="password" id="mod_login_password" name="passwd" class="inputbox" size="10" alt="password" />
									</td>
								</tr>
								<tr>
									<td colspan="2" align="center">
										<input type="submit" name="Submit" class="button" value="<?php 
            echo _BUTTON_LOGIN;
            ?>
" />
									</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="login_to_forum" />
				<input type="hidden" name="id" value="<?php 
            echo $course_id;
            ?>
" />
				<input type="hidden" name="boxchecked" value="0" />
				<input type="hidden" name="state" value="0" />
			</form>
<?php 
        } else {
            ?>
				<script language="javascript" type="text/javascript">
					function iFrameHeight() {
						var h = 0;
						if ( !document.all ) {
							h = document.getElementById('blockrandom').contentDocument.height;
							document.getElementById('blockrandom').style.height = h + 60 + 'px';
						} else if( document.all ) {
							h = document.frames('blockrandom').document.body.scrollHeight;
							document.all.blockrandom.style.height = h + 20 + 'px';
						}
					}
					</script>
					<iframe onload="iFrameHeight()"
					id="blockrandom"
					name="iframe"
					src="<?php 
            echo $link;
            ?>
"
					width="100%"
					height="800px"
					scrolling="auto"
					align="top"
					frameborder="0"
					class="wrapper" style="width:100%">
					<?php 
            echo _JLMS_IFRAMES_REQUIRES;
            ?>
<br /><a href="<?php 
            echo sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=details_course&id={$course_id}");
            ?>
">Return to the course home page</a>
					</iframe>
<?php 
        }
        JLMS_TMPL::CloseTS();
        JLMS_TMPL::CloseMT();
    }
    function showEditScorm(&$row, &$lists, $option, $params, $lp_params)
    {
        global $Itemid, $_MAMBOTS, $JLMS_CONFIG;
        ?>
<script language="javascript" type="text/javascript">
<!--
function setgood() {
	return true;
}
var tmp_sl_var = <?php 
        echo $params->get('scorm_layout', 0);
        ?>
;
function submitbutton(pressbutton, jform_name) {
	var form = eval("document."+jform_name);//adminForm;
	try {
		form.onsubmit();
	} catch(e) {
		//alert(e);
	}
	if (pressbutton == 'cancel_scorm') {
		form.task.value = 'cancel_scorm';
		form.submit();
	} else {
		if (pressbutton == 'save_scorm') {
				form.task.value = 'save_scorm';
				form.submit();
		}
	}
}
function jlms_change_scorm_stages_view() {
	if (tmp_sl_var == 1) {
		$('scorm_stage_width_section').style.display = '';
	} else {
		$('scorm_stage_width_section').style.display = 'none';
	}
}
function jlms_dis_forms(elem, type) {
	var form = document.adminFormsc;

	if (type == 1 || type == '1') {
		if (elem.checked) {
			scorm_upl_type = 1;
			elem.form.scorm_file.disabled = false;
			document.adminFormsc.scorm_ftp_file.disabled = true;
			
			form.scorm_upl_type.value = 1;
			
		} else {
			scorm_upl_type = 2;
			elem.form.scorm_file.disabled = true;
			document.adminFormsc.scorm_ftp_file.disabled = false;
		}
	}
	if (type == 2 || type == '2') {
		if (elem.checked) {
			scorm_upl_type = 2;
			elem.form.scorm_file.disabled = true;
			document.adminFormsc.scorm_ftp_file.disabled = false;
			
			form.scorm_upl_type.value = 2;
		} else {
			scorm_upl_type = 1;
			elem.form.scorm_file.disabled = false;
			document.adminFormsc.scorm_ftp_file.disabled = true;
		}
	}
}
-->		
</script>
<?php 
        JLMS_TMPL::OpenMT();
        $hparams = array('show_menu' => true, 'simple_menu' => true);
        $toolbar = array();
        $title = '';
        $title = $row->id ? _JLMS_DOCS_EDIT_SCORM_PACKAGE : _JLMS_DOCS_NEW_SCORM_PACKAGE;
        JLMS_TMPL::ShowHeader('outdoc', $title, $hparams, $toolbar);
        JLMS_TMPL::OpenTS('', ' valign="top"');
        if (!$row->id || $row->id && $row->folder_flag == 3) {
            ?>
				<form action="<?php 
            echo sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}");
            ?>
" method="post" name="adminFormsc" enctype="multipart/form-data" onsubmit="setgood();">
					<table width="100%" cellpadding="0" cellspacing="0" border="0" class="jlms_properties_table">
					<tr>
						<td align="left" class="contentheading" valign="middle" style="vertical-align:middle ">
							
						</td>
						<td align="right" style="text-align:right ">
						<?php 
            $toolbar = array();
            $toolbar[] = array('btn_type' => 'save', 'btn_js' => "javascript:submitbutton('save_scorm', 'adminFormsc');");
            $toolbar[] = array('btn_type' => 'cancel', 'btn_js' => "javascript:submitbutton('cancel_scorm', 'adminFormsc');");
            echo JLMS_ShowToolbar($toolbar);
            ?>
						</td>
					</tr>
					</table>
					<table width="100%" cellpadding="0" cellspacing="0" border="0" class="jlms_properties_table">
					<tr>
						<td width="30%"><?php 
            echo _JLMS_ENTER_NAME;
            ?>
<br /></td>
						<td>
							<input size="40" class="inputbox" type="text" name="doc_name" value="<?php 
            echo $row->doc_name;
            ?>
" /><br />
						</td>
					</tr>
					<tr>
						<td colspan="2"><input id="scorm_upl_type_1" type="radio" name="scorm_upl_type" value="1" checked="checked" onchange="jlms_dis_forms(this,1);" /> <label for="scorm_upl_type_1"><strong><?php 
            echo _JLMS_LPATH_CHOOSE_LOCAL_FILE;
            ?>
</strong></label></td>
					</tr>
					<tr>
						<td><?php 
            echo _JLMS_CHOOSE_FILE;
            ?>
</td>
						<td>
							<input size="40" class="inputbox" type="file" name="scorm_file" />
						</td>
					</tr>
					<tr>
						<td colspan="2"><input id="scorm_upl_type_2" type="radio" name="scorm_upl_type" value="2" onchange="jlms_dis_forms(this,2);" /> <label for="scorm_upl_type_2"><strong><?php 
            echo _JLMS_LPATH_CHOOSE_FTP_FILE;
            ?>
</strong></label></td>
					</tr>
					<tr>
						<td><?php 
            echo _JLMS_CHOOSE_FILE;
            ?>
</td>
						<td>
							<input size="40" class="inputbox" type="text" disabled="disabled"  name="scorm_ftp_file" />
						</td>
					</tr>
					<tr>
						<td valign="middle" style="vertical-align:middle"><br /><?php 
            echo _JLMS_PLACE_IN;
            ?>
</td>
						<td><br /><?php 
            echo $lists['course_folders'];
            ?>
</td>
					</tr>
					<tr id="scorm_stage_width_section"<?php 
            if ($params->get('scorm_layout', 0) == 0) {
                echo ' style="display:none"';
            }
            ?>
>
						<td><br /><?php 
            echo _JLMS_LP_SCORM_DISPLAY_WIDTH;
            ?>
</td>
						<td><br />
							<input size="40" class="inputbox" type="text" name="scorm_width" value="<?php 
            echo $row->scorm_width;
            ?>
" />
						</td>
					</tr>
					<tr>
						<td><br /><?php 
            echo _JLMS_LP_SCORM_DISPLAY_HEIGHT;
            ?>
</td>
						<td><br />
							<input size="40" class="inputbox" type="text" name="scorm_height" value="<?php 
            echo $row->scorm_height;
            ?>
" />
						</td>
					</tr>
					<tr>
						<td><br /><?php 
            echo _JLMS_LPATH_SCORM_NAV_BAR_OPTION;
            ?>
</td>
						<td><br />

							<select class="inputbox" size="1" name="params[scorm_nav_bar]" onchange="tmp_nb_var = this.value;jlms_change_scorm_stages_view();">
								<option<?php 
            if ($params->get('scorm_nav_bar', 0) == 0) {
                echo ' selected="selected"';
            }
            ?>
 value="0"><?php 
            echo _JLMS_LP_SCORM_NAV_BAR_HIDE;
            ?>
</option>
								<option<?php 
            if ($params->get('scorm_nav_bar', 0) == 1) {
                echo ' selected="selected"';
            }
            ?>
 value="1"><?php 
            echo _JLMS_LP_SCORM_NAV_BAR_TOP;
            ?>
</option>
								<option<?php 
            if ($params->get('scorm_nav_bar', 0) == 2) {
                echo ' selected="selected"';
            }
            ?>
 value="2"><?php 
            echo _JLMS_LP_SCORM_NAV_BAR_LEFT;
            ?>
</option>
							</select>
						</td>
					</tr>
					<tr>
						<td><br /><?php 
            echo _JLMS_LP_SCORM_LAYOUT_TYPE;
            ?>
</td>
						<td><br />
							<select class="inputbox" size="1" name="params[scorm_layout]"  onchange="tmp_sl_var = this.value;jlms_change_scorm_stages_view();">
								<option<?php 
            if ($params->get('scorm_layout', 0) == 0) {
                echo ' selected="selected"';
            }
            ?>
 value="0"><?php 
            echo _JLMS_LP_SCORM_LAYOUT_INLINE;
            ?>
</option>
								<option<?php 
            if ($params->get('scorm_layout', 0) == 1) {
                echo ' selected="selected"';
            }
            ?>
 value="1"><?php 
            echo _JLMS_LP_SCORM_LAYOUT_SBOX;
            ?>
</option>
							</select>
						</td>
					</tr>
					<tr>
					<td valign="middle"><br /><?php 
            echo _JLMS_OUTDOCS_VISFOR;
            ?>
</td>
					<td><br />
					<?php 
            $chk1 = '';
            $chk2 = '';
            $chk3 = '';
            if ($row->outdoc_share == 0) {
                $chk1 = ' checked="checked"';
            }
            if ($row->outdoc_share == 1) {
                $chk2 = ' checked="checked"';
            }
            if ($row->outdoc_share == 2) {
                $chk3 = ' checked="checked"';
            }
            ?>
						<input type="radio" name="outdoc_share" id="outdoc_share0" value="0"<?php 
            echo $chk1;
            ?>
 /><label for="outdoc_share0"><?php 
            echo _JLMS_OUTDOCS_PRIVATE;
            ?>
</label>
						<input type="radio" name="outdoc_share" id="outdoc_share1" value="1"<?php 
            echo $chk2;
            ?>
 /><label for="outdoc_share1"><?php 
            echo _JLMS_OUTDOCS_TEACHERS;
            ?>
</label>
						<input type="radio" name="outdoc_share" id="outdoc_share2" value="2"<?php 
            echo $chk3;
            ?>
 /><label for="outdoc_share2"><?php 
            echo _JLMS_OUTDOCS_ALL;
            ?>
</label>
					</td>
				</tr>
				<tr>
					<td><br /><?php 
            echo _JLMS_OUTDOCS_SHOWCOURSES;
            ?>
</td>
					<td><br /><?php 
            echo $lists['share_to_courses'];
            ?>
</td>
				</tr>
				<tr>
					<td colspan="2" valign="top" align="left" style="text-align:left "><br /><?php 
            echo _JLMS_DESCRIPTION;
            ?>
</td>
				</tr>	
				<tr>
					<td colspan="2">
					<?php 
            JLMS_editorArea('editor1', $row->doc_description, 'doc_description', '100%;', '250', '40', '20');
            ?>
					</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="save_scorm" />
					<input type="hidden" name="boxchecked" value="0" />
					<input type="hidden" name="id" value="<?php 
            echo $row->id;
            ?>
" />
					</form>
				<?php 
        }
        JLMS_TMPL::CloseTS();
        JLMS_TMPL::CloseMT();
    }
    function showCourseCertificate($course_id, $option, $row, $lists)
    {
        global $Itemid;
        ?>
<script language="JavaScript" type="text/javascript">
<!--//--><![CDATA[//><!--
function CRT_save(pressbutton) {
	var form = document.adminForm;
		form.task.value = pressbutton;
		form.submit();
}
function CRT_preview(txt_tooltip) {

}
//--><!]]>
</script>


<?php 
        JLMS_TMPL::OpenMT();
        $hparams = array();
        $toolbar = array();
        $toolbar[] = array('btn_type' => 'save', 'btn_js' => "javascript:CRT_save('crt_save')");
        $toolbar[] = array('btn_type' => 'preview', 'btn_js' => "javascript:jlms_ShowCertificatePreview()");
        $toolbar[] = array('btn_type' => 'back', 'btn_js' => sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=gradebook&amp;id={$course_id}"));
        JLMS_TMPL::ShowHeader('certificate', _JLMS_GBC_TITLE, $hparams, $toolbar);
        JLMS_TMPL::OpenTS();
        ?>
	<form action="<?php 
        echo sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}");
        ?>
" method="post" name="adminForm" enctype="multipart/form-data">

<?php 
        require_once _JOOMLMS_FRONT_HOME . "/includes/lms_certificates.php";
        JLMS_Certificates::JLMS_editCertificate_Page($row, true);
        ?>
		<input type="hidden" name="option" value="<?php 
        echo $option;
        ?>
" />
		<input type="hidden" name="Itemid" value="<?php 
        echo $Itemid;
        ?>
" />
		<input type="hidden" name="task" value="gb_certificates" />
		<input type="hidden" name="state" value="0" />
		<input type="hidden" name="boxchecked" value="0" />
		<input type="hidden" name="id" value="<?php 
        echo $course_id;
        ?>
" />
	</form>		
<?php 
        JLMS_TMPL::CloseTS();
        JLMS_TMPL::CloseMT();
    }
Esempio n. 15
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;
    }
 function show_ErrorMessage($error)
 {
     global $Itemid;
     JLMS_TMPL::OpenMT();
     $hparams = array();
     JLMS_TMPL::ShowHeader('lpath', _JLMS_LPATH_TITLE, $hparams);
     JLMS_TMPL::OpenTS();
     echo '<div class="joomlalms_sys_message">' . $error . '</div>';
     JLMS_TMPL::CloseTS();
     JLMS_TMPL::CloseMT();
 }
    function view_preDeletePage(&$rows, $id, $option)
    {
        global $Itemid;
        ?>
<script language="javascript" type="text/javascript">
<!--
function submitbutton(pressbutton) {
	var form = document.adminForm;
	if ((pressbutton == 'course_delete_yes') && (form.boxchecked.value == "0")){
		alert( "<?php 
        echo _JLMS_ALERT_SELECT_ITEM;
        ?>
" );
	} else {
		form.task.value = pressbutton;
		form.submit();
	}
}
//-->
</script>
	<?php 
        JLMS_TMPL::OpenMT();
        $params = array('show_menu' => false, 'sys_msg' => _JLMS_COURSES_DEL_ALERT_MESSAGE, 'toolbar_position' => 'center');
        $toolbar = array();
        $toolbar[] = array('btn_type' => 'yes', 'btn_js' => "javascript:submitbutton('course_delete_yes');");
        $toolbar[] = array('btn_type' => 'cancel', 'btn_js' => "javascript:submitbutton('cancel_course');");
        JLMS_TMPL::ShowHeader('course', _JLMS_COURSES_TITLE_DEL_COURSE, $params, $toolbar);
        JLMS_TMPL::OpenTS();
        ?>
				<br />
					<form action="<?php 
        echo sefRelToAbs("index.php?option=" . $option . "&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');
        ?>
" 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');
        ?>
"><?php 
        echo _JLMS_COURSES_TBL_HEAD_NAME;
        ?>
</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
					</tr>
				<?php 
        $k = 1;
        for ($i = 0, $n = count($rows); $i < $n; $i++) {
            $row = $rows[$i];
            $checked = JLMS_course_html::idBox($i, $row->id, true);
            ?>
					<tr class="<?php 
            echo JLMSCSS::_('sectiontableentry' . $k);
            ?>
">
						<td align="center"><?php 
            echo $i + 1;
            ?>
</td>
						<td><?php 
            echo $checked;
            ?>
</td>
						<td align="left">
						<?php 
            echo $row->course_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="delete_course" />
					<input type="hidden" name="id" value="<?php 
        echo $id;
        ?>
" />
					<input type="hidden" name="boxchecked" value="<?php 
        echo count($rows);
        ?>
" />
					</form>
	<?php 
        JLMS_TMPL::CloseTS();
        JLMS_TMPL::CloseMT();
    }
    function mailbox_users(&$stats, $option, $course_id, &$lists, $filt_group)
    {
        global $Itemid, $JLMS_DB, $JLMS_CONFIG;
        ?>
		<script language="javascript" type="text/javascript">
		<!--//--><![CDATA[//><!--
		var r_count = parseInt('<?php 
        echo (isset($_POST['usr_id']) ? count($_POST['usr_id']) : 0) + (isset($_POST['grp_id']) ? count($_POST['grp_id']) : 0) + (isset($_POST['mail_id']) ? count($_POST['mail_id']) : 0) + (isset($lists['repl']) ? 1 : 0);
        ?>
');
		function reanalize_class(){
			var tbl_id = getObj('show_mailz');
			if(tbl_id.rows[1]){
				for(var i=1;i<tbl_id.rows.length;i++){
					if((i % 2 + 1)==1){
						tbl_id.rows[i].className = 'sectiontableentry1 odd';
					}
					else
					{
						tbl_id.rows[i].className = 'sectiontableentry2 even';
					}
				}
			}
		}
		function Delete_tbl_row(element) {
			var del_index = element.parentNode.parentNode.sectionRowIndex;
			var tbl_id = element.parentNode.parentNode.parentNode.parentNode.id;
			element.parentNode.parentNode.parentNode.deleteRow(del_index);
			r_count = r_count - 1;
			reanalize_class();
		}
		function ading_row(texts,valuez,group)
		{
			var form = document.adminForm;
			var tbl_id = getObj('show_mailz');

			var row = tbl_id.insertRow(1);
			row.className = "sectiontableentry1 odd";
			var cell1 = document.createElement("td");
			var cell2 = document.createElement("td");
			var cell3 = document.createElement("td");
			var cell4 = document.createElement("td");
			
			input_button = document.createElement("IMG");
			input_button.src = "<?php 
        echo $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('lms_path_to_images') . '/buttons_22/btn_delete_22.png';
        ?>
";
			input_button.onclick = new Function('Delete_tbl_row(this)');
			input_button.style.cursor = "pointer";
			
			input_img = document.createElement("IMG");
			if(!group)
			input_img.src = "<?php 
        echo $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('lms_path_to_images') . '/buttons_22/btn_edituser_22.png';
        ?>
";
			else
			input_img.src = "<?php 
        echo $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('lms_path_to_images') . '/buttons_22/btn_editusergroup_22.png';
        ?>
";
			
			cell1.appendChild(input_button);
			//cell2.style.width = "10px;";
			cell2.appendChild(input_img);
			cell3.innerHTML = texts;
			var input_text = document.createElement("input");
			input_text.type = "hidden";
			if(group==1) {
				input_text.name = "grp_id[]";
				input_text.setAttribute("name","grp_id[]");
			}
			else if(group==2) {
				input_text.name = "mail_id[]";
				input_text.setAttribute("name","mail_id[]");
			}
			else   {
				input_text.name = "usr_id[]";
				input_text.setAttribute("name","usr_id[]");
			}
			input_text.value = valuez;
			cell3.appendChild(input_text);
			row.appendChild(cell1);
			row.appendChild(cell2);
			row.appendChild(cell3);
			r_count = r_count + 1;
			reanalize_class();
		}
		function setgood() {
			return true;
		}
		function submitbutton(pressbutton) {
			var form = document.adminForm;
			try {
				form.onsubmit();
			} catch(e) {
				//alert(e);
			}
			if (pressbutton == 'mail_send'){
				if (form.jlms_subject.value == ''){
					alert('<?php 
        echo _JLMS_MB_ENTER_SUBJECT;
        ?>
');
				}
				else{
					if (r_count){
						form.task.value = pressbutton;
						form.submit();
					}
					else{
					
						alert('<?php 
        echo _JLMS_MB_ENTER_USERNAME;
        ?>
');
					}
				}
			}
			else
			{
				form.task.value = pressbutton;
						form.submit();
			}
		}
		function mail_to_text()
		{
			var ulist = document.adminForm['mailbox_users[]'];

			for(i=0;i<ulist.length;i++)
			{
				
				if(ulist[i].value == 0 && ulist[i].selected)
				{
					ading_row(ulist[i].text,'<?php 
        echo $filt_group;
        ?>
',1);
					break;
				}
				else if(ulist[i].selected)
				{
					if(ulist[i].value>0)
					ading_row(ulist[i].text,ulist[i].value,0);
					else
					ading_row(ulist[i].text,ulist[i].value,2);
				}
			}
		}
		//--><!]]>
		</script>	
	<?php 
        JLMS_TMPL::OpenMT();
        if (!$course_id) {
            $hparams = array('show_menu' => false);
        } else {
            $hparams = array();
        }
        $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' => 'send', 'btn_js' => "javascript:submitbutton('mail_send');");
        JLMS_TMPL::ShowHeader('mailbox', _JLMS_MB_TITLE, $hparams, $toolbar);
        JLMS_TMPL::OpenTS();
        ?>
		<form action="<?php 
        echo sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}");
        ?>
" enctype="multipart/form-data" method="post" name="adminForm" onsubmit="setgood();">
			<table width="100%" cellpadding="2" cellspacing="0" border="0" class="jlms_table_no_borders" style="float:left;">
				<tr>
					<td align="left" style="text-align:left; width:360px; " valign="top">
						<div align="left" style="white-space:nowrap ">
							<?php 
        echo $lists['mailbox_users'];
        ?>
						</div>
						<div align="left" style="white-space:nowrap "><?php 
        echo $lists['filter2'];
        ?>
</div>
				
					</td>
					<td  width="50" valign="top">
						<?php 
        $btn_img = '2rightarrow.png';
        // 29.04.2008 - 'alt' and 'src' - changed by DEN
        echo "<img src=\"" . $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('lms_path_to_images') . "/" . $btn_img . "\" alt='>' onclick='mail_to_text();' style='cursor:pointer; padding-top:45px;' />";
        ?>
					</td>
					<td  valign="top" width="45%">
					<table id="show_mailz" cellpadding="0" cellspacing="0" border="0" width="100%" class="<?php 
        echo JLMSCSS::_('jlmslist');
        ?>
">
					<tr>
						<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
  class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" width="25"><!-- gg -->&nbsp;</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
						<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" width="25"><!-- gg -->&nbsp;</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
						<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
"><?php 
        echo _JLMS_MB_RECEPIENTS;
        ?>
</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
						
					</tr>
					<?php 
        $z = 0;
        if (isset($lists['repl'])) {
            $_POST['usr_id'][0] = $lists['repl']->sender_id;
        }
        if (isset($_POST['usr_id']) && count($_POST['usr_id'])) {
            for ($i = 0; $i < count($_POST['usr_id']); $i++) {
                if ($_POST['usr_id'][$i]) {
                    echo '<tr class="' . JLMSCSS::_('sectiontableentry' . ($z % 2 + 1)) . '">';
                    echo '<td width="25" aligh="center"><img src="' . $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('lms_path_to_images') . '/buttons_22/btn_delete_22.png" alt="' . _JLMS_DELETE . '" onclick="Delete_tbl_row(this);" style="cursor:pointer;" /></td>';
                    echo '<td width="10" aligh="center"><img src="' . $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('lms_path_to_images') . '//buttons_22/btn_edituser_22.png" /></td>';
                    if ($JLMS_CONFIG->get('use_global_groups', 0)) {
                        $query = "SELECT a.id, a.name, a.username, a.email, b.ug_name" . "\n FROM #__users as a, #__lms_users_in_global_groups as c" . "\n LEFT JOIN #__lms_usergroups as b ON c.group_id = b.id AND b.course_id = '0'" . "\n WHERE a.id = c.user_id AND a.id=" . intval($_POST['usr_id'][$i]) . "" . "\n ORDER BY b.ug_name, a.username";
                        $JLMS_DB->SetQuery($query);
                        $users = $JLMS_DB->LoadObjectList();
                    } else {
                        $query = "SELECT a.id, a.name, a.username, a.email, b.ug_name" . "\n FROM #__users as a, #__lms_users_in_groups as c" . "\n LEFT JOIN #__lms_usergroups as b ON c.group_id = b.id AND b.course_id = '" . $course_id . "'" . "\n WHERE a.id = c.user_id AND c.course_id = '" . $course_id . "' AND a.id=" . intval($_POST['usr_id'][$i]) . "" . "\n ORDER BY b.ug_name, a.username";
                        $JLMS_DB->SetQuery($query);
                        $users = $JLMS_DB->LoadObjectList();
                    }
                    if (!count($users)) {
                        $query = "SELECT username,name FROM #__users WHERE id=" . intval($_POST['usr_id'][$i]);
                        $JLMS_DB->SetQuery($query);
                        $users = $JLMS_DB->LoadObjectList();
                        if (count($users)) {
                            $users[0]->username = _JLMS_ROLE_TEACHER . ' - ' . $users[0]->username . ' (' . $users[0]->name . ')';
                        }
                    } else {
                        $users[0]->username = ($users[0]->ug_name ? $users[0]->ug_name : '') . ' - ' . $users[0]->username . ' (' . $users[0]->name . ')';
                    }
                    echo '<td>' . $users[0]->username . '<input type="hidden" name="usr_id[]" value="' . intval($_POST['usr_id'][$i]) . '" /></td>';
                    echo '</tr>';
                    $z++;
                }
            }
        }
        if (isset($_POST['grp_id']) && count($_POST['grp_id'])) {
            for ($i = 0; $i < count($_POST['grp_id']); $i++) {
                echo '<tr class="' . JLMSCSS::_('sectiontableentry' . ($z % 2 + 1)) . '">';
                echo '<td width="25" aligh="center"><img src="' . $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('lms_path_to_images') . '/buttons_22/btn_delete_22.png" alt="' . _JLMS_DELETE . '" onclick="Delete_tbl_row(this);" style="cursor:pointer;" /></td>';
                echo '<td width="10" aligh="center"><img src="' . $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('lms_path_to_images') . '/buttons_22/btn_editusergroup_22.png" /></td>';
                $query = "SELECT distinct a.ug_name as text FROM #__lms_usergroups as a" . "\n WHERE a.id = '" . intval($_POST['grp_id'][$i]) . "'  ORDER BY a.ug_name";
                $JLMS_DB->SetQuery($query);
                echo '<td>' . ($JLMS_DB->loadResult() ? $JLMS_DB->loadResult() : _JLMS_MB_ALL_USRS) . '<input type="hidden" name="grp_id[]" value="' . intval($_POST['grp_id'][$i]) . '" /></td>';
                echo '</tr>';
                $z++;
            }
        }
        if (isset($_POST['mail_id']) && count($_POST['mail_id'])) {
            for ($i = 0; $i < count($_POST['mail_id']); $i++) {
                echo '<tr class="' . JLMSCSS::_('sectiontableentry' . ($z % 2 + 1)) . '">';
                echo '<td width="25"><img src="' . $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('lms_path_to_images') . '/buttons_22/btn_delete_22.png" alt="' . _JLMS_DELETE . '" onclick="Delete_tbl_row(this);" style="cursor:pointer;" /></td>';
                echo '<td width="10"><img src="' . $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('lms_path_to_images') . '/buttons_22/btn_editusergroup_22.png" /></td>';
                $query = "SELECT pm_name FROM #__lms_messagelist WHERE id=" . intval(abs($_POST['mail_id'][$i]));
                $JLMS_DB->SetQuery($query);
                echo '<td>' . ($JLMS_DB->loadResult() ? $JLMS_DB->loadResult() : _JLMS_MB_ALL_USRS) . '<input type="hidden" name="mail_id[]" value="' . intval($_POST['mail_id'][$i]) . '" /></td>';
                echo '</tr>';
                $z++;
            }
        }
        ?>
					</table>
					<br />
					</td>
				</tr>
				
			</table>
			<div style="clear:both;"></div>
				
			<br />
			<table width="100%" cellpadding="2" cellspacing="0" border="0" class="jlms_table_no_borders">
				<tr>
					<td valign="top" align="left" >
					<?php 
        echo _JLMS_MB_SUBJECT;
        ?>
 :
					</td>
				</tr>	
				<tr>	
					<td>
					<input  type="text" name="jlms_subject"  size="60" value="<?php 
        if (isset($lists['repl'])) {
            echo _JLMS_MB_REPL_RE . $lists['repl']->subject;
        }
        ?>
"  class="inputbox" />
					</td>
				</tr>
				<tr>
					<td align="left">
					<?php 
        echo _JLMS_MB_TEXT . " :";
        ?>
					</td>
				</tr>	
				<tr>
					<td>
					<?php 
        $curmsg = '';
        if (isset($lists['repl'])) {
            $date_mas = $lists['repl']->data;
            $main_data = explode('-', substr($date_mas, 0, 10));
            $other_data = explode(':', substr($date_mas, 11, 8));
            $view_format = date(_JLMS_MB_REPL_DF, mktime($other_data[0], $other_data[1], $other_data[2], $main_data[1], $main_data[2], $main_data[0]));
            $curmsg_pre = $view_format . ' ' . _JLMS_MB_REPL_YW . ':<br />';
            $linebreak = '<br /><br />';
            $str = '';
            for ($i = 0; $i < 50; $i++) {
                $str = $str . '-';
            }
            $linebreak .= $str;
            $linebreak .= '<br />';
            $old_msg_external = $lists['repl']->message;
            $curmsg = $linebreak . $curmsg_pre . $old_msg_external;
        }
        jlms_editorArea('editor1', $curmsg, 'jlms_mailbox_letter', '100%;', '250', '40', '20');
        ?>
					</td>
				</tr>
				<tr id="hide">
					<td>
					<a href="javascript:void(0)" onclick="javascript:getObj('attach').style.display = '';getObj('hide').style.display = 'none'"><?php 
        echo _JLMS_MB_ATTACH;
        ?>
</a>
					</td>
				</tr>
				<tr style="display:none " id="attach">
					<td>
						<table class="jlms_table_no_borders" width="100%">
							<tr>
								<td>
								<a href="javascript:void(0)" onclick="javascript:getObj('attach').style.display = 'none';getObj('hide').style.display = ''"><?php 
        echo _JLMS_MB_HIDE;
        ?>
</a>
								</td>
							</tr>
							<tr>
								<td><input type="file" name="jlms_attach_file"  size="60" class="inputbox" /></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="mailbox_new" />
		<input type="hidden" name="id" value="<?php 
        echo $course_id;
        ?>
" />
		<input type="hidden" name="m_course_id" value="<?php 
        echo isset($lists['repl']->course_id) && $lists['repl']->course_id ? $lists['repl']->course_id : -1;
        ?>
" />
		<input type="hidden" name="boxchecked" value="0" />
		<input type="hidden" name="state" value="0" />
		</form>
	<?php 
        JLMS_TMPL::CloseTS();
        JLMS_TMPL::CloseMT();
        // 29.04.2008 - line added by DEN (layout fix)
    }
    function showTR_clear($id, $option, &$lists)
    {
        global $Itemid, $my, $JLMS_CONFIG;
        ?>
<script language="javascript" type="text/javascript">
<!--//--><![CDATA[//><!--
window.addEvent('domready', function() {
			document.adminForm.startday.disabled = true;
			document.adminForm.startmonth.disabled = true;
			document.adminForm.startyear.disabled = true;
				
			document.adminForm.endday.disabled = true;
			document.adminForm.endmonth.disabled = true;
			document.adminForm.endyear.disabled = true;		
}
);
function submitbutton(pressbutton) {
	var form=document.adminForm;
	if (is_se == 1) {
		if (form.start_date.value == ''){jlms_getDate('start');}
		if (form.end_date.value == ''){jlms_getDate('end');}
	}
	if (pressbutton=='track_do_clear') {
		form.task.value = pressbutton;form.submit();
	}
}
var is_se = 0;
function jlms_Change_se(rr) {
	if (rr) {is_se = 0;} else {is_se = 1;}
	var form=document.adminForm;
	form.endday.disabled = rr;
	form.endmonth.disabled = rr;
	form.endyear.disabled = rr;
	form.startday.disabled = rr;
	form.startmonth.disabled = rr;
	form.startyear.disabled = rr;
}
//--><!]]>
</script>
<?php 
        JLMS_TMPL::OpenMT();
        $hparams = array();
        $toolbar = array();
        $toolbar[] = array('btn_type' => 'clear', 'btn_js' => "javascript:submitbutton('track_do_clear')");
        $toolbar[] = array('btn_type' => 'cancel', 'btn_js' => sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=tracking&amp;id={$id}"));
        JLMS_TMPL::ShowHeader('tracking', _JLMS_TRACK_CLEAR_TITLE, $hparams, $toolbar);
        JLMS_TMPL::OpenTS();
        ?>

		<form action="<?php 
        echo sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}");
        ?>
" method="post" name="adminForm">
			<table width="100%" cellpadding="0" cellspacing="0" border="0" class="jlms_table_no_borders">
				<tr>
					<td width="15%" valign="top" align="left"><br />
					&nbsp;
					</td>
					<td valign="top"><br />
						<input type="radio" onclick="jlms_Change_se(true)" name="tr_clear_type" value="1" checked="checked" /><?php 
        echo _JLMS_TRACK_CLEAR_ALL;
        ?>
<br />
						<input type="radio" onclick="jlms_Change_se(false)" name="tr_clear_type" value="2" /><?php 
        echo _JLMS_TRACK_CLEAR_PERIOD;
        ?>
					</td>
				</tr>
				<tr>
					<td valign="middle"><br /><?php 
        echo _JLMS_START_DATE;
        ?>
</td>
					<td valign="middle" style="vertical-align:middle "><br />
						<table cellpadding="0" cellspacing="0" border="0" class="jlms_date_outer"><tr>						
						<td valign="middle">
							<?php 
        echo JLMS_HTML::_('calendar.calendar', '', 'start', 'start');
        ?>
						</td></tr></table>
					</td>
				</tr>	
				<tr>
					<td><br /><?php 
        echo _JLMS_END_DATE;
        ?>
</td>
					<td valign="middle" style="vertical-align:middle "><br />
						<table cellpadding="0" cellspacing="0" border="0" class="jlms_date_outer"><tr>						
						<td valign="middle" ><?php 
        echo JLMS_HTML::_('calendar.calendar', '', 'end', 'end');
        ?>
						</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="track_clear" />
			<input type="hidden" name="boxchecked" value="0" />
			<input type="hidden" name="id" value="<?php 
        echo $id;
        ?>
" />
		</form>
<?php 
        JLMS_TMPL::CloseTS();
        JLMS_TMPL::CloseMT();
    }
 function showQuizHead2($id, $option, $header = _JLMS_QUIZ_TITLE, $show_menu = true, $toolbar = array(), $add_options = '', $form_quiz = '', $gqp = false)
 {
     global $Itemid;
     $JLMS_ACL =& JLMSFactory::getACL();
     JLMS_TMPL::OpenMT();
     if ($gqp) {
         $hparams = array('show_menu' => true, 'simple_menu' => true);
     } else {
         $hparams = array();
     }
     JLMS_TMPL::ShowHeader('quiz', $header, $hparams, array());
     if ($show_menu) {
         $controls = array();
         if (!$gqp) {
             if ($JLMS_ACL->CheckPermissions('quizzes', 'manage')) {
                 $controls[] = array('href' => sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}&amp;id={$id}&amp;task=quizzes&amp;page=cats"), 'title' => _JLMS_QUIZ_CATS_TITLE, 'img' => 'quiz/btn_cats.png');
             }
             $controls[] = array('href' => sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}&amp;id={$id}&amp;task=quizzes&amp;page=quizzes"), 'title' => _JLMS_QUIZ_TITLE, 'img' => 'quiz/btn_quizzes.png');
             if ($JLMS_ACL->CheckPermissions('quizzes', 'view_stats')) {
                 $controls[] = array('href' => sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}&amp;id={$id}&amp;task=quizzes&amp;page=reports"), 'title' => _JLMS_QUIZ_REPORTS_TITLE, 'img' => 'quiz/btn_reports.png');
             }
             if ($JLMS_ACL->CheckPermissions('quizzes', 'manage')) {
                 $controls[] = array('href' => sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}&amp;id={$id}&amp;task=quizzes&amp;page=certificates"), 'title' => _JLMS_QUIZ_CERTIFICATES_TITLE, 'img' => 'buttons_22/btn_certificates_22.png');
                 $controls[] = array('href' => sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}&amp;id={$id}&amp;task=quizzes&amp;page=imgs"), 'title' => _JLMS_QUIZ_IMGS_TITLE, 'img' => 'buttons_22/btn_images_22.png');
             }
             if (count($toolbar)) {
                 $controls[] = array('href' => 'spacer');
             }
         }
         foreach ($toolbar as $toolbar_btn) {
             $pre_folder = 'quiz';
             $btn_img = '';
             $btn_str = $toolbar_btn['btn_txt'];
             switch ($toolbar_btn['btn_type']) {
                 case 'csv_import':
                     $btn_img = 'btn_csv_import_22.png';
                     $pre_folder = 'buttons_22';
                     break;
                 case 'csv_export':
                     $btn_img = 'btn_csv_export_22.png';
                     $pre_folder = 'buttons_22';
                     break;
                 case 'category':
                     $btn_img = 'btn_cats.png';
                     $pre_folder = 'quiz';
                     break;
                 case 'published':
                     $btn_img = 'btn_publish_22.png';
                     $pre_folder = 'buttons_22';
                     break;
                 case 'unpublished':
                     $btn_img = 'btn_unpublish_22.png';
                     $pre_folder = 'buttons_22';
                     break;
                 case 'print':
                     $btn_img = 'btn_print.png';
                     break;
                 case 'preview':
                     $btn_img = 'btn_preview.png';
                     break;
                 case 'move':
                     $btn_img = 'btn_move.png';
                     break;
                 case 'copy':
                     $btn_img = 'btn_copy.png';
                     break;
                 case 'save':
                     $btn_img = 'btn_save.png';
                     break;
                 case 'apply':
                     $btn_img = 'btn_apply.png';
                     break;
                 case 'back':
                 case 'cancel':
                     $btn_img = 'btn_back.png';
                     break;
                 case 'del':
                     $btn_img = 'btn_delete.png';
                     break;
                 case 'edit':
                     $btn_img = 'btn_edit.png';
                     break;
                 case 'bar':
                     $btn_img = 'btn_bars.png';
                     break;
                 case 'new':
                 default:
                     $btn_img = 'btn_new.png';
                     break;
             }
             $controls[] = array('href' => $toolbar_btn['btn_js'], 'title' => $btn_str, 'img' => $pre_folder . '/' . $btn_img);
         }
         if ($add_options) {
             $controls[] = array('href' => '', 'title' => '', 'img' => '', 'custom' => $add_options);
         }
         //JLMS_TMPL::CloseMT();
         JLMS_TMPL::OpenTS();
         //
         echo $form_quiz;
         JLMS_TMPL::OpenMT('jlms_table_no_borders');
         JLMS_TMPL::ShowControlsFooter($controls, '', false, true);
     }
     JLMS_TMPL::OpenTS();
 }
    function showUserAttendance($option, &$rows, &$per_rows, &$date_rows, &$lists)
    {
        global $Itemid, $my, $JLMS_CONFIG;
        $JLMS_ACL =& JLMSFactory::getACL();
        ?>
		
<script language="javascript" type="text/javascript">
<!--//--><![CDATA[//><!--
function submitbutton_change(pressbutton, period_id, state) {
	var form = document.adminForm;
	if (pressbutton == 'at_dateschange'){
		if (form.boxchecked.value == 0) {
			alert( "<?php 
        echo _JLMS_ALERT_SELECT_ITEM;
        ?>
" );
		} else {
			form.task.value = pressbutton;
			form.state.value = state;
			form.period_id.value = period_id;
			form.submit();
		}
	}
}
function submitbutton_change_user(pressbutton, period_id, state, cid_id, at_date_value) {
	var form = document.adminForm;
	if (pressbutton == 'at_uchange'){
		form.cid2.value = cid_id;		
		form.task.value = pressbutton;
		form.at_date.value = at_date_value;
		form.state.value = state;
		form.period_id.value = period_id;
		form.submit();
	}
}
function pickup_date(){
	var form = document.adminForm;
	form.at_date.value = form.pick_date.value;
	form.submit();
}
//--><!]]>
</script>
<?php 
        JLMS_TMPL::OpenMT();
        $hparams = array();
        $toolbar = array();
        if ($JLMS_ACL->CheckPermissions('attendance', 'manage')) {
            $hparams['second_tb_header'] = $lists['username'] . ',&nbsp;' . $lists['name'];
            $toolbar[] = array('btn_type' => 'back', 'btn_js' => sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=attendance&amp;id=" . $lists['course_id']));
        }
        JLMS_TMPL::ShowHeader('attendance', $JLMS_ACL->CheckPermissions('attendance', 'manage') ? _JLMS_ATT_TITLE : _JLMS_ATT_TITLE_STU, $hparams, $toolbar);
        if ($JLMS_ACL->CheckPermissions('attendance', 'manage')) {
            JLMS_TMPL::OpenTS('', ' class="contentheading"');
            //echo $lists['username'].',&nbsp;'.$lists['name'];
            JLMS_TMPL::CloseTS();
        }
        JLMS_TMPL::OpenTS();
        ?>
		<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="jlms_table_no_borders">
				<tr>
					<td align="left" style="text-align:left ">
						<div align="left" style="white-space:nowrap ">
						&nbsp;
						</div>
					</td>
					<td align="right" style="text-align:right ">
						<div align="right" style="white-space:nowrap ">
							<table cellpadding="0" cellspacing="0" border="0" style="height:16px" class="jlms_table_no_borders">
								<tr>
									<td><?php 
        echo $lists['filter'];
        ?>
&nbsp;&nbsp;</td>
									<td valign="middle" align="center" width="16">
										<?php 
        echo JLMS_HTML::_('calendar.calendar', $lists['at_date'], 'pick', 'pick', null, null, 'statictext');
        ?>
				
									</td><td valign="middle" align="center" width="18" style="vertical-align:middle ">
										<a class="jlms_img_link" href="javascript:pickup_date();" title="<?php 
        echo _JLMS_AGENDA_GO_DATE;
        ?>
">
											<img class="JLMS_png" src="<?php 
        echo $JLMS_CONFIG->get('live_site');
        ?>
/components/com_joomla_lms/lms_images/agenda/loopnone.png" alt="<?php 
        echo _JLMS_AGENDA_GO_DATE;
        ?>
" title="<?php 
        echo _JLMS_AGENDA_GO_DATE;
        ?>
" border="0" width="16" height="16" />
										</a>
										<noscript>
											<input type="submit" name="OK" value="OK" />
											<input type="hidden" name="no_script" value="1" />
										</noscript>
									</td>
								</tr>
							</table>	
						</div>
					</td>
				</tr>
			</table>

			<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('attendance', '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 
        }
        ?>
					<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
">date</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
					<?php 
        foreach ($per_rows as $per_row) {
            echo '<' . JLMSCSS::tableheadertag() . ' align=\'center\' nowrap="nowrap" class="' . JLMSCSS::_('sectiontableheader') . '" style="text-align:center; white-space:nowrap">' . substr($per_row->period_begin, 0, 5) . ' - ' . substr($per_row->period_end, 0, 5) . '</' . JLMSCSS::tableheadertag() . '>';
        }
        ?>
				</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=at_userattend&amp;course_id=".$lists['course_id']."&amp;at_date=".$lists['at_date']."&amp;id={$row->user_id}";
            $checked = JLMS_attendance_html::idBox($i, $row->at_date, $row->is_selected);
            ?>
				<tr class="<?php 
            echo JLMSCSS::_('sectiontableentry' . $k);
            ?>
">
					<td align="center" valign="middle"><?php 
            echo $i + 1;
            ?>
</td>
					<?php 
            if ($JLMS_ACL->CheckPermissions('attendance', 'manage')) {
                ?>
					<td><?php 
                echo $checked;
                ?>
</td>
					<?php 
            }
            ?>
					<td align="left" valign="middle" style="vertical-align:middle ">
						<?php 
            echo JLMS_dateToDisplay($row->at_date);
            ?>
					</td>
					<?php 
            $j = 0;
            while ($j < count($row->at_stats)) {
                $alt = $row->at_stats[$j]->at_status ? _JLMS_ATT_STATUS_ATTENDED : _JLMS_ATT_STATUS_NOTATTENDED;
                $image = $row->at_stats[$j]->at_status ? 'btn_accept.png' : 'btn_cancel.png';
                $state = $row->at_stats[$j]->at_status ? 0 : 1;
                echo '<td align=\'center\' valign="middle" style="vertical-align:middle;text-align:center ">';
                if ($JLMS_ACL->CheckPermissions('attendance', 'manage')) {
                    echo '<a class="jlms_img_link" href="javascript:submitbutton_change_user(\'at_uchange\',' . $row->at_stats[$j]->period_id . ',' . $state . ',' . $lists['user_id'] . ',\'' . $row->at_date . '\');" title="' . $alt . '"><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>';
                } elseif ($JLMS_ACL->CheckPermissions('attendance', 'view')) {
                    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 '</td>';
                $j++;
            }
            ?>
				</tr>
				<?php 
            $k = 3 - $k;
        }
        if ($JLMS_ACL->CheckPermissions('attendance', 'manage')) {
            ?>
				<tr class="<?php 
            echo JLMSCSS::_('sectiontableentry' . $k);
            ?>
">
					<td colspan="3"><?php 
            echo _JLMS_ATT_WITH_SELECTED;
            ?>
</td>
					<?php 
            foreach ($per_rows as $per_row) {
                echo '<td align=\'center\' valign="middle" style="text-align:center; vertical-align:middle;">';
                echo '<a class="jlms_img_link" href="javascript:submitbutton_change(\'at_dateschange\',' . $per_row->id . ',1);" title="' . _JLMS_ATT_MARK_ATTENDED . '">';
                echo '<img class="JLMS_png" src="' . $JLMS_CONFIG->get('live_site') . '/components/com_joomla_lms/lms_images/toolbar/btn_accept.png" width="16" height="16" border="0" alt="' . _JLMS_ATT_MARK_ATTENDED . '" />';
                echo '</a>&nbsp;';
                echo '<a class="jlms_img_link" href="javascript:submitbutton_change(\'at_dateschange\',' . $per_row->id . ',0);" title="' . _JLMS_ATT_MARK_NOTATTENDED . '">';
                echo '<img class="JLMS_png" src="' . $JLMS_CONFIG->get('live_site') . '/components/com_joomla_lms/lms_images/toolbar/btn_cancel.png" width="16" height="16" border="0" alt="' . _JLMS_ATT_MARK_NOTATTENDED . '" />';
                echo '</a>';
                echo '</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="<?php 
        echo $JLMS_ACL->CheckPermissions('attendance', 'manage') ? 'at_userattend' : 'attendance';
        ?>
" />
			<input type="hidden" name="at_date" value="<?php 
        echo JLMS_dateToDisplay($lists['at_date']);
        ?>
" />
			<input type="hidden" name="period_id" value="0" />
			<input type="hidden" name="state" value="0" />
			<input type="hidden" name="cid2" value="0" />
			<input type="hidden" name="boxchecked" value="<?php 
        echo $lists['box'];
        ?>
" />
			<input type="hidden" name="course_id" value="<?php 
        echo $lists['course_id'];
        ?>
" />
			<input type="hidden" name="id" value="<?php 
        echo $JLMS_ACL->CheckPermissions('attendance', 'manage') ? $lists['user_id'] : $lists['course_id'];
        ?>
" />
		</form>
<?php 
        JLMS_TMPL::CloseTS();
        JLMS_TMPL::CloseMT();
    }
    function JLMS_sreportScorm($option, &$rows, $start_date, $end_date, &$pageNav, &$lists, $levels, $filt_cat, $filt_group, $is_full)
    {
        global $JLMS_CONFIG;
        $Itemid = $JLMS_CONFIG->get('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++;
                }
            }
        }
        JLMS_TMPL::OpenMT();
        $lists['user_id'] = isset($lists['user_id']) ? $lists['user_id'] : 0;
        if ($is_full) {
            $hparams = array('show_menu' => false);
        } else {
            $hparams = array('simple_menu' => true);
        }
        $toolbar = array();
        JLMS_TMPL::ShowHeader('tracking', _JLMS_REPORTS_SCORM . ' ' . date("Y-m-d H:i:s"), $hparams, $toolbar);
        JLMS_TMPL::OpenTS();
        ?>
		<script language="javascript" type="text/javascript">
		<!--//--><![CDATA[//><!--
			function pickup_date(){
				var form = document.adminForm;
				form.end_date.value = form.pick_date.value;
				form.start_date.value = form.pick_to_date.value;
				var is_cor = 1;
				if(form.start_date.value.length == 10 && form.end_date.value.length == 10)
				{
					if("<?php 
        echo $JLMS_CONFIG->get('date_format', "Y-m-d");
        ?>
" == "d-m-Y"){
						if(form.end_date.value.substring(5)<form.start_date.value.substring(5)){
							is_cor = 0;
						} else if( form.end_date.value.substring(2,5)<form.start_date.value.substring(2,5)){
							is_cor = 0;
						} else if( form.end_date.value.substring(0,2)<form.start_date.value.substring(0,2)){
							is_cor = 0;
						}
					} else {	
						if(form.end_date.value.substring(0,4)<form.start_date.value.substring(0,4)){
							is_cor = 0;
						} else if ( form.end_date.value.substring(5,7)<form.start_date.value.substring(5,7)){
							is_cor = 0;
						} else if ( form.end_date.value.substring(8,10)<form.start_date.value.substring(8,10)){
							is_cor = 0;
						}
					}
				}
				if(!is_cor){
					alert("<?php 
        echo _JLMS_REPORTS_SELECT_DATE;
        ?>
");
				} else {
					form.view.value = '';	
					form.submit();	
				}
			}
			function pickup_date_reset(){
				var form = document.adminForm;
				form.pick_date.value = '-';
				form.pick_to_date.value = '-';
				form.end_date.value = form.pick_date.value;
				form.start_date.value = form.pick_to_date.value;
				form.view.value = '';	
				form.submit();	
			}
		
			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;	
						}
					}
				}
			}
			
			function submitFormView(view){
				var form = document.adminForm;
				form.view.value = view;
				form.task.value='report_scorm';
				form.submit();
			}
		//--><!]]>
		</script>
		<?php 
        $action_url = $is_full ? $JLMS_CONFIG->get('live_site') . "/index.php?tmpl=component&option={$option}&amp;Itemid={$Itemid}" : sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}");
        ?>
		<form action="<?php 
        echo $action_url;
        ?>
" method="post" name="adminForm">
			<table cellpadding="0" cellspacing="0" border="0" id="TheTable" <?php 
        echo $is_full ? "" : 'width="100%"';
        ?>
>
				<?php 
        if (!$is_full) {
            ?>
				<tr>
					<td align="<?php 
            echo $is_full ? "left" : "right";
            ?>
" <?php 
            echo !$is_full ? 'colspan="4"' : '';
            ?>
>
						<table <?php 
            echo $is_full ? '' : 'width="30%"';
            ?>
>
							<tr>
								<td valign="top" <?php 
            echo $is_full ? 'width="400"' : 'width="40%"';
            ?>
>
									<table width="100%" border="0">
										<tr>
											<td <?php 
            echo $is_full ? 'width="100"' : 'width="20%"';
            ?>
 nowrap="nowrap">
												Report Type:
											</td>
											<td>
												<?php 
            echo JLMS_switchType($option);
            ?>
											</td>
										</tr>
									</table>		
								</td>
							</tr>
						</table>	
					</td>
				</tr>
				<?php 
        }
        ?>
				<tr>
					<td align="left">
						<table <?php 
        echo $is_full ? '' : 'width="100%"';
        ?>
>
							<tr>
								<td valign="top" <?php 
        echo $is_full ? 'width="400"' : 'width="40%"';
        ?>
>
									<table width="100%" border="0">
										<?php 
        if ($is_full) {
            ?>
										<tr>
											<td <?php 
            echo $is_full ? 'width="100"' : 'width="20%"';
            ?>
 nowrap="nowrap">
												Report Type:
											</td>
											<td>
												<?php 
            echo JLMS_switchType($option);
            ?>
											</td>
										</tr>
										<?php 
        }
        ?>
										<tr>
											<td <?php 
        echo $is_full ? 'width="100"' : 'width="20%"';
        ?>
 nowrap="nowrap">
												<?php 
        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;
        } else {
            echo _JLMS_COURSES_COURSES_GROUPS;
        }
        ?>
											</td>
											<td>
												<?php 
        if ($JLMS_CONFIG->get('multicat_use', 0)) {
            echo $lists['filter_0'];
        } else {
            echo $lists['jlms_course_cats'];
        }
        ?>
											</td>
										</tr>
										<?php 
        if (count($multicat)) {
            for ($i = 0; $i < count($multicat); $i++) {
                if ($i > 0) {
                    ?>
													<tr>
														<td <?php 
                    echo $is_full ? 'width="100"' : 'width="20%"';
                    ?>
 nowrap="nowrap">
															<?php 
                    echo isset($levels[$i]->cat_name) && $levels[$i]->cat_name != '' ? $levels[$i]->cat_name : _JLMS_COURSES_COURSES_GROUPS;
                    ?>
														</td>
														<td>
															<?php 
                    echo $lists['filter_' . $i];
                    ?>
														</td>
													</tr>
													<?php 
                }
            }
        }
        ?>
										<tr>
											<td <?php 
        echo $is_full ? 'width="100"' : 'width="20%"';
        ?>
 nowrap="nowrap">
												Courses:
											</td>
											<td>
												<?php 
        echo $lists['filt_course'];
        ?>
											</td>
										</tr>
									</table>
								</td>
								<td valign="top" <?php 
        echo $is_full ? 'width="400"' : 'width="40%"';
        ?>
>
									<table width="100%" border="0">
										<?php 
        if ($is_full) {
            ?>
										<tr>
											<td colspan="2">
												&nbsp;
											</td>
										</tr>
										<?php 
        }
        if ($JLMS_CONFIG->get('use_global_groups', 1)) {
            ?>
										<tr>
											<td style="padding-left: 5px;" <?php 
            echo $is_full ? 'width="100"' : 'width="20%"';
            ?>
 nowrap="nowrap">
												<?php 
            echo _JLMS_USER_GROUP_INFO;
            ?>
											</td>
											<td>
												<?php 
            echo $lists['filt_group'];
            ?>
											</td>
										</tr>
										<?php 
        }
        ?>
										<tr>
											<td colspan="2">
												<table width="100%" border="0">
													<tr>
														<td style="padding:0px 10px;" width="30">From</td>
														<td valign="middle" align="center">
															<?php 
        echo JLMS_HTML::_('calendar.calendar', $start_date, 'pick_to', 'pick_to', null, null, 'statictext');
        ?>
														</td>
														<td style="padding:0px 10px;" width="30">To</td>
														<td valign="middle" align="center">
															<?php 
        echo JLMS_HTML::_('calendar.calendar', $end_date, 'pick', 'pick', null, null, 'statictext');
        ?>
														</td>
														<td valign="middle" align="center" width="18" style="vertical-align:middle ">
															<a href="javascript:pickup_date_reset();" title="">
																<img class="JLMS_png" src="<?php 
        echo $JLMS_CONFIG->get('live_site');
        ?>
/components/com_joomla_lms/lms_images/toolbar/btn_publish_hidden.png" alt="" title="Disabled filter date" border="0" width="16" height="16" />
															</a>
														</td>
														<td valign="middle" align="center" width="18" style="vertical-align:middle ">
															<a href="javascript:pickup_date();" title="">
																<img class="JLMS_png" src="<?php 
        echo $JLMS_CONFIG->get('live_site');
        ?>
/components/com_joomla_lms/lms_images/toolbar/btn_accept.png" alt="" title="Enabled filter date" border="0" width="16" height="16" />
															</a>
														</td>
													</tr>
												</table>
											</td>
										</tr>
									</table>
								</td>
								<?php 
        if (!$is_full) {
            ?>
								<td style="padding-left:15px; white-space: nowrap;" align="right">
									<?php 
            $link = $JLMS_CONFIG->get('live_site') . "/index.php?tmpl=component&option=" . $option . "&amp;Itemid={$Itemid}&amp;task=report_scorm&amp;is_full=1";
            $link .= $filt_group ? "&amp;filt_group=" . $filt_group : "";
            $link .= $start_date != "-" ? "&amp;start_date=" . JLMS_dateToDisplay($start_date) : "";
            $link .= $end_date != "-" ? "&amp;end_date=" . JLMS_dateToDisplay($end_date) : "";
            ?>
									<a href="<?php 
            echo $link;
            ?>
" target="_blank" title="<?php 
            echo _JLMS_FULL_VIEW_BUTTON;
            ?>
"><?php 
            echo _JLMS_FULL_VIEW_BUTTON;
            ?>
</a>
								</td>
								<?php 
        }
        ?>
							</tr>
						</table>			
					</td>
				</tr>
			</table>
					
			<table width="100%" cellpadding="0" cellspacing="0" border="0">
				<thead>
					<tr>
						<td class="sectiontableheader" style="white-space: nowrap;">
							Username
						</td>
						<td class="sectiontableheader" style="white-space: nowrap;">
							Name
						</td>
						<td class="sectiontableheader" style="white-space: nowrap;">
							Email
						</td>
						<td class="sectiontableheader" style="white-space: nowrap;">
							Course Name
						</td>
						<td class="sectiontableheader" style="white-space: nowrap;">
							Course ID
						</td>
						<td class="sectiontableheader" style="white-space: nowrap;">
							Date
						</td>
						<td class="sectiontableheader" style="text-align: center; white-space: nowrap;">
							Score
						</td>
						<td class="sectiontableheader" style="text-align: center; white-space: nowrap;">
							Course Status
						</td>
					</tr>
				</thead>
				<tbody>
					<?php 
        $k = 1;
        for ($i = 0, $n = count($rows); $i < $n; $i++) {
            $row = $rows[$i];
            ?>
						<tr class="<?php 
            echo "sectiontableentry{$k}";
            ?>
">
							<td>
								<?php 
            echo $row->username;
            ?>
							</td>
							<td>
								<?php 
            echo $row->name;
            ?>
							</td>
							<td>
								<?php 
            echo $row->email;
            ?>
							</td>
							<td>
								<?php 
            echo $row->course_name;
            ?>
							</td>
							<td>
								<?php 
            echo $row->lpath_name;
            ?>
							</td>
							<td>
								<?php 
            if (isset($row->scorm_data) && $row->scorm_data->status) {
                if ($row->scorm_data->end) {
                    $date_end = date("Y-m-d H:i:s", $row->scorm_data->end);
                    echo JLMS_dateToDisplay($date_end);
                }
            }
            ?>
							</td>
							<td align="center">
								<?php 
            if (isset($row->scorm_data)) {
                echo $row->scorm_data->score;
            }
            ?>
							</td>
							<td align="center">
								<?php 
            $image = $row->course_status ? 'btn_accept.png' : 'btn_cancel.png';
            $alt = $row->course_status ? 'btn_accept' : 'btn_cancel';
            $alt .= '" align="top';
            echo JLMS_reports_html::publishIcon(0, 0, 0, '', $alt, $image, $option, false);
            ?>
							</td>
						</tr>
						<?php 
            $k = 3 - $k;
        }
        ?>
				</tbody>
			</table>
			<?php 
        if ($lists['user_id'] && !$is_full && count($rows)) {
            if ($JLMS_CONFIG->get('new_lms_features', 1)) {
                $controls = array();
                $controls[] = array('href' => "javascript:submitFormView('csv');", 'title' => 'CSV', 'img' => 'csv');
                JLMS_TMPL::ShowControlsFooterC($controls, '', false, false, _JLMS_EXPORT_TO . ':');
            }
        }
        ?>
	
			<?php 
        if ($lists['user_id'] && !$is_full) {
            ?>
			<table width="100%" cellpadding="0" cellspacing="0" border="0">
				<tr>
					<td align="center">
					<?php 
            $link = "index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=report_scorm&amp;filt_group={$filt_group}&amp;filt_cat={$filt_cat}";
            $link .= strlen($start_date) ? "&amp;start_date=" . JLMS_dateToDisplay($start_date) : "";
            $link .= strlen($end_date) ? "&amp;end_date=" . JLMS_dateToDisplay($end_date) : "";
            echo $pageNav->writePagesLinks($link);
            ?>
 
					</td>
				</tr>
				<tr>
					<td align="center">
						<?php 
            echo _JLMS_PN_DISPLAY_NUM . $pageNav->getLimitBox($link) . '&nbsp;' . $pageNav->getPagesCounter();
            ?>
					</td>
				</tr>
			</table>
			<?php 
        }
        ?>
			<input type="hidden" name="option" value="<?php 
        echo $option;
        ?>
" />
			<input type="hidden" name="Itemid" value="<?php 
        echo $Itemid;
        ?>
" />
			<input type="hidden" name="task" value="report_scorm" />
			<input type="hidden" name="view" value="" />
			<input type="hidden" name="start_date" value="<?php 
        echo $start_date;
        ?>
" />
			<input type="hidden" name="end_date" value="<?php 
        echo $end_date;
        ?>
" />
			<input type="hidden" name="state" value="0" />
			<input type="hidden" name="boxchecked" value="0" />
			<input type="hidden" name="is_full" value="<?php 
        echo $is_full;
        ?>
" />
		</form>

		<?php 
        $action_url = $is_full ? $JLMS_CONFIG->get('live_site') . "/index.php?tmpl=component&option={$option}&amp;Itemid={$Itemid}" : sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}");
        ?>
		<form action="<?php 
        echo $action_url;
        ?>
" method="post" name="adminFormCsv">
				<input type="hidden" name="option" value="<?php 
        echo $option;
        ?>
" />
				<input type="hidden" name="Itemid" value="<?php 
        echo $Itemid;
        ?>
" />
				<input type="hidden" name="task" value="report_scorm" />
				<input type="hidden" name="is_full" value="1" />
				<input type="hidden" name="view" value="" />
		</form>	
		<?php 
        JLMS_TMPL::CloseTS();
        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 JLMS_free_subscriptions($option, $course_info, $course_id, $multi_sub = false)
    {
        /*if ($multi_sub) {
        			$course_info = $course_info[0];
        		}*/
        global $Itemid, $JLMS_CONFIG, $my;
        ?>
		<script language="javascript" type="text/javascript">
		<!--
		function jlms_submitbutton(pressbutton) {
			var form = document.JLMS_adminForm;
			<?php 
        if ($JLMS_CONFIG->get('enableterms')) {
            ?>
			if( (pressbutton == 'course_subscribe') && (document.getElementById('agreement').checked == false) ){
				alert( "<?php 
            echo addslashes(_JLMS_AGREEMENT);
            ?>
" );
			}
			else{
				form.task.value = pressbutton;
				form.submit();
			}
			<?php 
        } else {
            ?>
				form.task.value = pressbutton;
				form.submit();
			<?php 
        }
        ?>
		}
		//-->
		</script>
<?php 
        JLMS_TMPL::OpenMT();
        $params = array('show_menu' => true, 'simple_menu' => true);
        JLMS_TMPL::ShowHeader('subscription', _JLMS_HEAD_SUBSCRIPTION_STR, $params);
        JLMS_TMPL::OpenTS('', ' align="right" style="text-align:right " width="100%"');
        //echo "Sub name: "."<input type='text' class='inputbox' name='sub_name' />"."&nbsp;&nbsp;";
        JLMS_TMPL::CloseTS();
        JLMS_TMPL::CloseMT();
        ?>
		<form action="<?php 
        echo sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}");
        ?>
" method="post" name="JLMS_adminForm">
		<table width="100%" cellpadding="0" cellspacing="0" border="0" class="jlms_table_no_borders">
			<tr>
				<td colspan="2">
				<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="left" width="200"><?php 
        echo _JLMS_SUBSCRIBE_COURSE_NAME;
        ?>
</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
						<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" align="left" width="70" ><?php 
        echo _JLMS_COURSES_FEE_TYPE;
        ?>
</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
					</tr>
					<?php 
        if ($multi_sub) {
            $k = 1;
            foreach ($course_info as $course_info1) {
                ?>
							<tr class="<?php 
                echo JLMSCSS::_('sectiontableentry' . $k);
                ?>
">
								<td align="left" valign="middle"><?php 
                echo $course_info1->course_name;
                ?>
</td>
								<td align="left" valign="middle"><?php 
                echo _JLMS_COURSES_FREE;
                ?>
</td>
							</tr>
						<?php 
                $k = 3 - $k;
            }
        } else {
            ?>
					<tr class="<?php 
            echo JLMSCSS::_('sectiontableentry1');
            ?>
">
						<td align="left" valign="middle"><?php 
            echo $course_info->course_name;
            ?>
</td>
						<td align="left" valign="middle"><?php 
            echo _JLMS_COURSES_FREE;
            ?>
</td>
					</tr>
					<?php 
        }
        ?>
				</table>
				</td>
			</tr>
			<?php 
        if ($JLMS_CONFIG->get('enableterms')) {
            if ($my->id) {
                echo "<tr><td colspan='2'><table align='center' class='jlms_table_no_borders'><tr><td width='20'>\n\t\t\t\t\t\t\t<input type='checkbox' name='agreement' id='agreement' />\n\t\t\t\t\t\t</td><td style='text-align:left'>\n\t\t\t\t\t\t\t<label for='agreement'>" . $JLMS_CONFIG->get('jlms_terms') . "</label>\n\t\t\t\t\t\t</td></tr></table></td></tr>";
            } else {
                /*	echo "<tr><td colspan='2'><br /><table align='center'><tr><td width='20'>
                				<input type='checkbox' name='agreement' id='agreement' disabled='disabled' />
                			</td><td style='text-align:left'>
                				<label for='agreement'>" . $JLMS_CONFIG->get('jlms_terms')."</label>
                			</td></tr></table></td></tr>";*/
            }
            /*
            
            				?>
            			<tr>
            				<td class="sectiontableheader">Terms and conditions</td>
            			</tr>
            			<tr>
            				<td>
            				<?php 
            				echo "<input type='checkbox' name='agreement' id='agreement' />";
            				echo $JLMS_CONFIG->get('jlms_terms');
            				?>			
            				</td>
            			</tr>
            			<?php */
        }
        ?>
	
			<tr>
				<td colspan="2" align="center">
				<?php 
        $toolbar = array();
        if ($my->id) {
            $toolbar[] = array('btn_type' => 'yes', 'btn_str' => _JLMS_SUBSCRIBE, 'btn_js' => "javascript:jlms_submitbutton('course_subscribe','');");
            echo JLMS_ShowToolbar($toolbar, true, 'center');
        } else {
            //$toolbar[] = array('btn_type' => 'yes', 'btn_str' => _JLMS_SUBSCRIBE, 'btn_js' => "javascript:void(0);");
            //echo JLMS_ShowToolbar($toolbar, true, 'center');
        }
        ?>
				<noscript>
					<div class="joomlalms_sys_message">
					<?php 
        echo _JLMS_JS_COOKIES_REQUIRES;
        ?>
					</div>
				</noscript>
				</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="" />
		<input type="hidden" name="id" value="<?php 
        echo $course_id;
        ?>
" />
		<input type="hidden" name="state" value="0" />
		</form>		
		<?php 
        if (!$my->id) {
            JLMS_UserSessions_html::loginPanel($course_id, 'subs');
        }
    }