function viewCourses_blog(&$rows, &$pageNav, $option, $usertype, $lists, $levels)
    {
        global $Itemid, $JLMS_CONFIG, $my, $JLMS_DB, $acl;
        $JLMS_ACL =& JLMSFactory::getACL();
        $pres_icons = new stdClass();
        $pres_icons->mail = 0;
        $pres_icons->already = 0;
        $pres_icons->my = 0;
        $pres_icons->wl = 0;
        $lms_img_path = $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('lms_path_to_images', 'components/com_joomla_lms/lms_images');
        //		$show_fee_col = $JLMS_CONFIG->get('show_fee_column', 1);
        $price_fee_type = $JLMS_CONFIG->get('price_fee_type', 1);
        $show_short_description = $JLMS_CONFIG->get('show_short_description', 0);
        $show_course_publish_dates = $JLMS_CONFIG->get('show_course_publish_dates', 0);
        $jlms_cs = $JLMS_CONFIG->get('jlms_cur_sign');
        $colspan_sh_description = 4;
        if ($show_course_publish_dates) {
            $colspan_sh_description = 6;
        }
        if (!$price_fee_type) {
            $colspan_sh_description = $colspan_sh_description - 1;
        }
        $show_course_author = $JLMS_CONFIG->get('show_course_authors', 1);
        $course_id = mosGetParam($_REQUEST, 'c_id', '');
        if ($course_id) {
            $query = "SELECT course_name FROM #__lms_courses WHERE id = '{$course_id}'";
            $JLMS_DB->setQuery($query);
            $course_name = $JLMS_DB->loadResult();
        }
        //FLMS multicat
        $multicat = array();
        if ($JLMS_CONFIG->get('multicat_use', 0)) {
            $multicat = array();
            $i = 0;
            foreach ($lists as $key => $item) {
                if (substr($key, 0, 7) == 'filter_') {
                    $multicat[] = $lists['filter_' . $i];
                    $i++;
                }
            }
        }
        ?>
		
		<script language="javascript" type="text/javascript">
		<!--//--><![CDATA[//><!--
		function submitbutton(pressbutton, course_id) {
			var form = document.adminForm;
			if ( (pressbutton == 'delete_course') || (pressbutton == 'edit_course') || (pressbutton == 'export_course_pre') ) {
				form.id.value = course_id;
				form.task.value = pressbutton;
				form.submit();
			}
			else if( (pressbutton == 'enroll') && (form.boxchecked.value == '0') ){
				alert( "<?php 
        echo _JLMS_ALERT_SELECT_ITEM;
        ?>
" );
			}
			else {
				if (pressbutton == 'enroll'){
					form.task.value = 'subscription';
					form.submit();
				}
			}
		}
		<?php 
        if ($JLMS_CONFIG->get('multicat_use', 0)) {
            ?>
		var old_filters = new Array();
		function read_filter(){
			var form = document.adminForm;
			var count_levels = '<?php 
            echo count($levels);
            ?>
';
			for(var i=0;i<parseInt(count_levels);i++){
				if(form['filter_id_'+i] != null){
					old_filters[i] = form['filter_id_'+i].value;
				}
			}
		}
		function write_filter(){
			var form = document.adminForm;
			var count_levels = '<?php 
            echo count($levels);
            ?>
';
			var j;
			for(var i=0;i<parseInt(count_levels);i++){
				if(form['filter_id_'+i+''] != null && form['filter_id_'+i+''].value != old_filters[i]){
					j = i;
				}
				if(i > j){
					if(form['filter_id_'+i] != null){
						form['filter_id_'+i].value = 0;	
					}
				}
			}
		}
		<?php 
        }
        ?>
		//--><!]]>
		</script>

		<form action="<?php 
        echo $JLMS_CONFIG->getCfg('live_site') . "/index.php?option={$option}&amp;Itemid={$Itemid}";
        ?>
" method="post" name="adminForm">
<?php 
        JLMS_TMPL::OpenMT();
        $params = array('show_menu' => true, 'simple_menu' => true);
        JLMS_TMPL::ShowHeader('course', _JLMS_COURSES_COURSES_LIST, $params);
        JLMS_TMPL::ShowPageTip('courses');
        JLMS_TMPL::OpenTS('', ' align="right" style="text-align:right " width="100%"');
        //		echo _JLMS_PN_DISPLAY_NUM . $pageNav->getLimitBox( $link );
        //		echo _JLMS_COURSES_FILTER." : ".$lists['courses_type'];
        if ($JLMS_CONFIG->get('multicat_use', 0)) {
            echo (isset($levels[0]->cat_name) && $levels[0]->cat_name != '' ? $levels[0]->cat_name : _JLMS_COURSES_COURSES_GROUPS) . " " . $lists['filter_0'] . "&nbsp;&nbsp;";
        } else {
            echo _JLMS_COURSES_COURSES_GROUPS . " " . $lists['groups_course'] . "&nbsp;&nbsp;";
        }
        JLMS_TMPL::CloseTS();
        if (count($multicat)) {
            for ($i = 0; $i < count($multicat); $i++) {
                if ($i > 0) {
                    JLMS_TMPL::OpenTS('', ' align="right" style="text-align:right " width="100%"');
                    echo (isset($levels[$i]->cat_name) && $levels[$i]->cat_name != '' ? $levels[$i]->cat_name : _JLMS_COURSES_COURSES_GROUPS) . " " . $lists['filter_' . $i] . "&nbsp;&nbsp;";
                    JLMS_TMPL::CloseTS();
                }
            }
        }
        $controls = array();
        $JLMS_ACL =& JLMSFactory::getACL();
        if ($JLMS_ACL->CheckPermissions('lms', 'create_course')) {
            $controls[] = array('href' => JLMSRoute::_("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=add_course"), 'title' => _JLMS_COURSES_NEW, 'img' => 'add');
            $controls[] = array('href' => JLMSRoute::_("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=course_import"), 'title' => _JLMS_COURSES_IMPORT, 'img' => 'courseimport');
            $controls[] = array('href' => 'spacer');
            JLMS_TMPL::ShowControlsFooter($controls, '', false);
        }
        //$controls[] = array('href' => "javascript:submitbutton('enroll','');", 'title' => _JLMS_ENROLL, 'img' => 'publish');
        JLMS_TMPL::OpenTS('', ' style="padding: 5px;"');
        if (JLMS_J16version()) {
            ?>
		<div class="lms_courses_blog">
			<div class="blog-featured">
				<?php 
            if (isset($lists['leading_courses']) && $lists['leading_courses']) {
                ?>
				<div class="items-leading">
					<?php 
                $lead_indx = 0;
                foreach ($rows as $row) {
                    if (isset($row->leading_course) && $row->leading_course) {
                        $leading = 'leading-' . $lead_indx;
                        ?>
							<div class="<?php 
                        echo $leading;
                        ?>
">
								<h2>
									<a href="<?php 
                        echo JRoute::_('index.php?option=' . $option . '&task=details_course&id=' . $row->id);
                        ?>
" title="<?php 
                        echo $row->course_name;
                        ?>
">
										<?php 
                        echo $row->course_name;
                        ?>
									</a>
									<?php 
                        $_JLMS_PLUGINS =& JLMSFactory::getPlugins();
                        $_JLMS_PLUGINS->loadBotGroup('system');
                        $plugin_args = array();
                        $plugin_args[] = $row->id;
                        $_JLMS_PLUGINS->trigger('onShowBlogCourseInfo', $plugin_args);
                        ?>
									<div class="clr"><!-- --></div>
								</h2>
								<dl class="article-info">
									<?php 
                        if ($show_course_author) {
                            ?>
										<dd class="createdby">
											<?php 
                            echo _JLMS_HOME_AUTHOR . ' ' . $row->user_fullname;
                            ?>
										</dd>
										<?php 
                        }
                        ?>
								</dl>
								<?php 
                        echo JLMS_ShowText_WithFeatures($row->course_sh_description);
                        ?>
								<div class="item-separator"><!-- --></div>
							</div>
							<?php 
                        $lead_indx++;
                    }
                }
                ?>
				</div>
				<?php 
            }
            $class = 'items-row';
            $cols_class = 'cols-' . $lists['menu_params']->get('num_columns', 2);
            $row_class = 'row-0';
            $class = $class . ' ' . $cols_class . ' ' . $row_class;
            ?>
				<div class="<?php 
            echo $class;
            ?>
">
				<?php 
            $n = 1;
            for ($i = 0; $i < count($rows); $i++) {
                $row = $rows[$i];
                if (!isset($row->leading_course) || !$row->leading_course) {
                    ?>
					
						<?php 
                    $column_class = 'item';
                    $column_class .= ' ' . 'column-' . $n;
                    ?>
						<div class="<?php 
                    echo $column_class;
                    ?>
">
							<h2>
								<a href="<?php 
                    echo JRoute::_('index.php?option=' . $option . '&task=details_course&id=' . $row->id);
                    ?>
" title="<?php 
                    echo $row->course_name;
                    ?>
">
									<?php 
                    echo $row->course_name;
                    ?>
								</a>
								<?php 
                    $_JLMS_PLUGINS =& JLMSFactory::getPlugins();
                    $_JLMS_PLUGINS->loadBotGroup('system');
                    $plugin_args = array();
                    $plugin_args[] = $row->id;
                    $_JLMS_PLUGINS->trigger('onShowBlogCourseInfo', $plugin_args);
                    ?>
								<div class="clr"><!-- --></div>
							</h2>
							<dl class="article-info">
								<?php 
                    if ($show_course_author) {
                        ?>
									<dd class="createdby">
										<?php 
                        echo _JLMS_HOME_AUTHOR . ' ' . $row->user_fullname;
                        ?>
									</dd>
									<?php 
                    }
                    ?>
							</dl>
							
							<?php 
                    echo JLMS_ShowText_WithFeatures($row->course_sh_description);
                    ?>
							<div class="item-separator"><!-- --></div>
						</div>
						<?php 
                    if ($lists['menu_params']->get('num_columns', 2) == $n) {
                        ?>
							<span class="row-separator"><!-- --></span>
							<?php 
                        $n = 1;
                    } else {
                        $n++;
                    }
                }
            }
            ?>
				</div>
			</div>
		</div>
		<?php 
        } else {
            ?>
		<table width="100%" cellpadding="0" cellspacing="0" border="0">
			<?php 
            if (isset($lists['leading_courses']) && $lists['leading_courses']) {
                ?>
			<tr>
				<td colspan="<?php 
                echo is_object($lists['menu_params']) && method_exists($lists['menu_params'], 'get') ? $lists['menu_params']->get('num_columns', 2) : 2;
                ?>
" valign="top">
					<?php 
                for ($x = 0; $x < count($rows); $x++) {
                    $row = $rows[$x];
                    if (isset($row->leading_course) && $row->leading_course) {
                        ?>
							<div class="course_info">
								<table width="100%" cellpadding="0" cellspacing="0" border="0">
									<tr>
										<td class="contentheading">
											<a href="<?php 
                        echo sefRelToAbs('index.php?option=' . $option . '&task=details_course&id=' . $row->id);
                        ?>
" title="<?php 
                        echo $row->course_name;
                        ?>
">
												<?php 
                        echo $row->course_name;
                        ?>
											</a>
										</td>
									</tr>
								</table>
								<?php 
                        if ($show_course_author) {
                            ?>
								<div class="course_author">
									<span class="small"><?php 
                            echo _JLMS_HOME_AUTHOR . "&nbsp;" . $row->user_fullname;
                            ?>
</span>
								</div>
								<?php 
                        }
                        ?>
								<?php 
                        $_JLMS_PLUGINS =& JLMSFactory::getPlugins();
                        $_JLMS_PLUGINS->loadBotGroup('system');
                        $plugin_args = array();
                        $plugin_args[] = $row->id;
                        $_JLMS_PLUGINS->trigger('onShowBlogCourseInfo', $plugin_args);
                        ?>
								<div class="course_sh_dsc">
									<?php 
                        echo $row->course_sh_description;
                        ?>
								</div>
							</div>
							<span class="article_separator">&nbsp;</span>
							<?php 
                    }
                }
                ?>
				</td>
			</tr>
			<?php 
            }
            ?>
	
			<tr>
				<?php 
            $divider = '';
            $menu_params_columns = is_object($lists['menu_params']) && method_exists($lists['menu_params'], 'get') ? $lists['menu_params']->get('num_columns', 2) : 2;
            for ($z = 0; $z < $menu_params_columns; $z++) {
                if ($z > 0) {
                    $divider = ' column_separator';
                }
                ?>
				<td class="article_column<?php 
                echo $divider;
                ?>
" valign="top" width="<?php 
                echo intval(100 / $menu_params_columns);
                ?>
%">
					<?php 
                for ($x = 0; $x < count($rows); $x++) {
                    $n = $x * $menu_params_columns + $z;
                    if (isset($rows[$n])) {
                        $row = $rows[$n];
                        if (!isset($row->leading_course) || !$row->leading_course) {
                            ?>
								<div class="course_info">
									<table width="100%" cellpadding="0" cellspacing="0" border="0">
										<tr>
											<td class="contentheading">
												<a href="<?php 
                            echo sefRelToAbs('index.php?option=' . $option . '&task=details_course&id=' . $row->id);
                            ?>
" title="<?php 
                            echo $row->course_name;
                            ?>
">
													<?php 
                            echo $row->course_name;
                            ?>
												</a>
											</td>
										</tr>
									</table>
									<?php 
                            if ($show_course_author) {
                                ?>
									<div class="course_author">
										<span class="small"><?php 
                                echo _JLMS_HOME_AUTHOR . "&nbsp;" . $row->user_fullname;
                                ?>
</span>
									</div>
									<?php 
                            }
                            ?>
									<?php 
                            $_JLMS_PLUGINS =& JLMSFactory::getPlugins();
                            $_JLMS_PLUGINS->loadBotGroup('system');
                            $plugin_args = array();
                            $plugin_args[] = $row->id;
                            $_JLMS_PLUGINS->trigger('onShowBlogCourseInfo', $plugin_args);
                            ?>
									<div class="course_sh_dsc">
										<?php 
                            echo $row->course_sh_description;
                            ?>
									</div>
								</div>
								<span class="article_separator">&nbsp;</span>
								<?php 
                        }
                    }
                }
                ?>
				</td>
				<?php 
            }
            ?>
			</tr>
		</table>
	<?php 
        }
        ?>
	
	<center>
	<?php 
        $link = "index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=courses";
        echo _JLMS_PN_DISPLAY_NUM . ' ' . $pageNav->getLimitBox($link);
        echo $pageNav->writePagesCounter();
        ?>
	</center>
	<center>
		<?php 
        $link = "index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=courses";
        echo $pageNav->writePagesLinks($link);
        ?>
	</center>
	<?php 
        JLMS_TMPL::CloseTS();
        if ($pres_icons->already || $pres_icons->mail || $pres_icons->my || $pres_icons->wl) {
            JLMS_TMPL::OpenTS('', ' align="left"');
            ?>
			<div class="joomlalms_info_legend">
			<?php 
            if ($pres_icons->already) {
                ?>
				<div style="text-align:left ">
					<img class="JLMS_png" src="<?php 
                echo $lms_img_path;
                ?>
/buttons/btn_complete.png" align="top" width="16" height="16" border="0" alt="<?php 
                echo _JLMS_COURSES_ALREADY;
                ?>
" title="<?php 
                echo _JLMS_COURSES_ALREADY;
                ?>
" />
					&nbsp;- <?php 
                echo _JLMS_COURSES_ALREADY;
                ?>
.
				</div>
			<?php 
            }
            ?>
			<?php 
            if ($pres_icons->mail) {
                ?>
				<div style="text-align:left ">
					<img class='JLMS_png' src="<?php 
                echo $lms_img_path;
                ?>
/dropbox/dropbox_corr.png" align="top" width='16' height='16' border='0' alt='' title='' />
					&nbsp;- <?php 
                echo _JLMS_COURSES_ADMIN_SENT;
                ?>
				</div>
			<?php 
            }
            ?>
			<?php 
            if ($pres_icons->my) {
                ?>
				<div style="text-align:left ">
					<img class="JLMS_png" src="<?php 
                echo $lms_img_path;
                ?>
/toolbar/tlb_courses.png" align="top" width="16" height="16" border="0" alt="<?php 
                echo _JLMS_COURSES_TITLE_MY_COURSES;
                ?>
" title="<?php 
                echo _JLMS_COURSES_TITLE_MY_COURSES;
                ?>
" />
					&nbsp;- <?php 
                echo _JLMS_COURSES_TITLE_MY_COURSES;
                ?>
.
				</div>
			<?php 
            }
            ?>
			<?php 
            if ($pres_icons->wl) {
                ?>
				<div style="text-align:left ">
					<img class="JLMS_png" src="<?php 
                echo $lms_img_path;
                ?>
/buttons/btn_waiting.png" align="top" width="16" height="16" border="0" alt="<?php 
                echo _JLMS_COURSES_TITLE_MY_COURSES;
                ?>
" title="<?php 
                echo _JLMS_COURSES_TITLE_MY_COURSES;
                ?>
" />
					&nbsp;- <?php 
                echo _JLMS_COURSES_IN_WL;
                ?>
.
				</div>
			<?php 
            }
            ?>
			</div>
	<?php 
            JLMS_TMPL::CloseTS();
        }
        JLMS_TMPL::CloseMT();
        ?>
		<input type="hidden" name="task" value="" />
		<input type="hidden" name="id" value="" />
		<input type="hidden" name="boxchecked" value="0" />
		<input type="hidden" name="itemid" value="" />
		<input type="hidden" name="row_id" value="0" />
	</form>
	<?php 
    }
Пример #2
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;
    }