コード例 #1
0
 function Echo_userinfo($name, $username, $email, $link)
 {
     $ret_str = '';
     $title = JLMS_txt2overlib(_JLMS_USER_INFORMATION);
     $content = _JLMS_UI_USERNAME . ' ' . $username . '<br />' . _JLMS_UI_NAME . ' ' . $name . '<br />' . _JLMS_UI_EMAIL . ' ' . $email;
     return JLMS_toolTip($title, $content, $name, $link, '1', '30', true, 'jlms_ttip');
 }
コード例 #2
0
    function jlms_booking_list($course_id, $option, &$rows, $pageNav, &$lists)
    {
        global $Itemid, $my, $JLMS_DB, $JLMS_CONFIG;
        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;
		if (pressbutton == 'new_period')
		{
			form.mode.value = pressbutton;
			form.submit();
		}
		else
		{
			if ( form.boxchecked.value == "0" ){
				alert("<?php 
        echo _JLMS_ALERT_SELECT_ITEM;
        ?>
");
			} else {
				if (pressbutton == 'period_delete'){
					if (confirm("<?php 
        echo 'Are you sure?';
        ?>
") == true){
						form.mode.value = pressbutton;
						form.submit();
					}
				}else{
					form.mode.value = pressbutton;
					form.submit();
				}
			}
		}	
	}
	//--><!]]>
	</script>
	<form action="<?php 
        echo sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}");
        ?>
" method="post" name="adminForm">
		<table width="100%" cellpadding="0" cellspacing="0" border="0">
			<tr>
				<td colspan="2">
					<?php 
        $link_PN = "index.php?option={$option}&Itemid={$Itemid}&task=conference&mode=booking&course_id=" . $course_id;
        echo $pageNav->getLimitBox($link_PN) . "&nbsp;" . $pageNav->getPagesCounter($link_PN);
        echo '. Filter: ' . $lists['filter_teach'] . $lists['filter_stu'];
        ?>
				</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' => 'back', 'btn_js' => sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=conference&amp;id={$course_id}"));
        echo JLMS_ShowToolbar($toolbar);
        ?>
				</td>
			</tr>
		</table>
<?php 
        /*JLMS_TMPL::CloseTS();
        		JLMS_TMPL::OpenTS();*/
        ?>
		
			<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 "Name";
        ?>
</td>
					<td class="sectiontableheader" align="left"><?php 
        echo "Teacher";
        ?>
</td>
					<td class="sectiontableheader" nowrap="nowrap" align="left"><?php 
        echo "Time";
        ?>
</td>

					<td class="sectiontableheader" align="left"><?php 
        echo "Date";
        ?>
</td>

					<td class="sectiontableheader" align="left"><?php 
        echo "Access";
        ?>
</td>

					
					
				</tr>
			<?php 
        $k = 1;
        for ($i = 0, $n = count($rows); $i < $n; $i++) {
            $row = $rows[$i];
            //$link 	= sefRelToAbs("index.php?option=".$option."&Itemid=".$Itemid."&task=details_course&id=". $row->course_id);
            $checked = mosHTML::idBox($i, $row->p_id);
            $overlib_descr = JLMS_txt2overlib($row->p_description);
            $overlib_title = "Description";
            ?>
				<tr valign="middle" style="vertical-align:middle" class="<?php 
            echo "sectiontableentry{$k}";
            ?>
">
					<td align="left"><?php 
            echo $pageNav->limitstart + $i + 1;
            ?>
</td>
					<td align="left"><?php 
            echo $checked;
            ?>
</td>
					<td align="left">
						<?php 
            $inside_tag = $row->p_name ? $row->p_name : "";
            echo JLMS_toolTip($overlib_title, $overlib_descr, $inside_tag);
            ?>
 
					</td>
					<td align="left">
						<?php 
            if ($row->user_teacher_id) {
                echo $row->name;
            } else {
                echo 'Not selected';
            }
            ?>
					</td>
					<td align="left">
						<?php 
            echo date("H:i", $row->from_time) . " - " . date("H:i", $row->to_time);
            ?>
					</td>
					<td align="left">
					<?php 
            echo date("Y-m-d", $row->from_time);
            /*
            	<a href="javascript:startAppPlayback('<?php echo sefRelToAbs('index.php?tmpl=component&option=com_joomla_lms&task=conference&mode=conference_playback&Itemid='.$Itemid.'&id='.$course_id.'&name='.$row->record_name );?>');" title="View details">
            		<?php echo $row->session_name;?>
            	</a>
            */
            ?>
	
					</td>
					<td align="left">
						<?php 
            $query = "SELECT u.username FROM #__lms_conference_usr as cu, #__users as u WHERE cu.p_id = '" . $row->p_id . "' AND cu.user_id= u.id";
            $JLMS_DB->setQuery($query);
            $cur_users = $JLMS_DB->LoadResultArray();
            $cur_users = implode(',', $cur_users);
            $ulink = sefRelToAbs('index.php?option=com_joomla_lms&task=conference&mode=user_access&Itemid=' . $Itemid . '&course_id=' . $course_id . '&amp;pid=' . $row->p_id);
            echo $row->public ? 'Public' : '<a href="' . $ulink . '">' . ($cur_users ? $cur_users : "Specify user") . '</a>';
            ?>
					</td>
				</tr>
				<?php 
            $k = 3 - $k;
        }
        ?>
				<tr>
					<td colspan="7" align="center">	
						<?php 
        if (count($rows) == 0) {
            echo _JLMS_CONFERENCE_NO_RECORD;
        } else {
            echo $pageNav->writePagesLinks($link_PN);
        }
        ?>
					</td>	
				</tr>
			</table>
			<input type="hidden" name="task" value="conference" />
			<input type="hidden" name="mode" value="booking" />
			<input type="hidden" name="boxchecked" value="0" />
			<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('period_delete');", 'title' => _JLMS_DELETE, 'img' => 'delete');
        $controls[] = array('href' => "javascript:submitbutton('edit_period');", 'title' => _JLMS_EDIT, 'img' => 'edit');
        $controls[] = array('href' => "javascript:submitbutton('new_period');", 'title' => 'New', 'img' => 'add');
        JLMS_TMPL::ShowControlsFooter($controls, sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=conference&amp;id={$course_id}"));
        JLMS_TMPL::CloseMT();
    }
コード例 #3
0
    function viewCourses(&$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) {
            //TODO: replace this db query with usage of new lmstitles object
            $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 
        }
        ?>
		<?php 
        if ($JLMS_CONFIG->get('lms_courses_sortby', 0) == 1) {
            ?>
		function submitbutton_order(pressbutton, item_id){
			var form = document.adminForm;
			if ((pressbutton == 'fcourse_orderup') || (pressbutton == 'fcourse_orderdown')){
				if (item_id) {
				form.task.value = pressbutton;
				form.row_id.value = item_id;
				form.submit();
				}
			}
		}
		function cf_saveorder(){
			var form = document.adminForm;	
			form.task.value = 'fcourse_save_order';
					form.submit();
				//submitform('fcourse_save_order');
		}
		<?php 
        }
        ?>
	
		//--><!]]>
		</script>
<?php 
        $style = "\n\t\ttable.jlmslist td.sectiontableheader, table.jlmslist th.sectiontableheader{\n\t\t\twhite-space: nowrap;\n\t\t}";
        $doc =& JFactory::getDocument();
        $doc->addStyleDeclaration($style);
        ?>
		<form action="<?php 
        echo JURI::base() . "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%"');
        $link = "index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=courses";
        //		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'];
        } else {
            echo _JLMS_COURSES_COURSES_GROUPS . " " . $lists['groups_course'];
        }
        JLMS_TMPL::CloseTS();
        if (count($multicat)) {
            for ($i = 0; $i < count($multicat); $i++) {
                if ($i > 0) {
                    JLMS_TMPL::OpenTS('', ' align="right" style="text-align:right " width="100%"');
                    echo (isset($levels[$i]->cat_name) && $levels[$i]->cat_name != '' ? $levels[$i]->cat_name : _JLMS_COURSES_COURSES_GROUPS) . " " . $lists['filter_' . $i];
                    JLMS_TMPL::CloseTS();
                }
            }
        }
        $controls = array();
        //	if ($usertype == 1) {
        $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');
        }
        $controls[] = array('href' => "javascript:submitbutton('enroll','');", 'title' => _JLMS_ENROLL, 'img' => 'publish');
        JLMS_TMPL::ShowControlsFooter($controls, '', false);
        JLMS_TMPL::OpenTS();
        ?>
		
	 			<table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php 
        echo JLMSCSS::_('jlmslist');
        ?>
">
					<tr>
						<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" align="center" width="1%">#</<?php 
        echo $JLMS_CONFIG->get('tableheader_tag', 'td');
        ?>
>
						<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" align="center" width="1%">&nbsp;</<?php 
        echo $JLMS_CONFIG->get('tableheader_tag', 'td');
        ?>
>
						<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" width="35%" align="left"><?php 
        echo _JLMS_COURSES_TBL_HEAD_NAME;
        ?>
</<?php 
        echo $JLMS_CONFIG->get('tableheader_tag', 'td');
        ?>
>
						
						<?php 
        if (isset($lists['extra_columns']) && count($lists['extra_columns'])) {
            foreach ($lists['extra_columns'] as $column) {
                ?>
								<<?php 
                echo JLMSCSS::tableheadertag();
                ?>
 class="<?php 
                echo JLMSCSS::_('sectiontableheader');
                ?>
" width="20%" align="left"><?php 
                echo ucfirst($column->name);
                ?>
</<?php 
                echo $JLMS_CONFIG->get('tableheader_tag', 'td');
                ?>
>
								<?php 
            }
        }
        ?>
						
						
						<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" width="20%" align="left"><?php 
        echo _JLMS_COURSES_COURSES_CAT;
        ?>
</<?php 
        echo $JLMS_CONFIG->get('tableheader_tag', 'td');
        ?>
>
						<?php 
        if (!$JLMS_ACL->CheckPermissions('lms', 'order_courses')) {
            if ($show_course_publish_dates) {
                ?>
						<<?php 
                echo JLMSCSS::tableheadertag();
                ?>
 class="<?php 
                echo JLMSCSS::_('sectiontableheader');
                ?>
" width="6%" align="left" nowrap="nowrap"><?php 
                echo _JLMS_COURSES_ST_DATE;
                ?>
</<?php 
                echo $JLMS_CONFIG->get('tableheader_tag', 'td');
                ?>
>
						<<?php 
                echo JLMSCSS::tableheadertag();
                ?>
 class="<?php 
                echo JLMSCSS::_('sectiontableheader');
                ?>
" width="6%" align="left" nowrap="nowrap"><?php 
                echo _JLMS_COURSES_END_DATE;
                ?>
</<?php 
                echo $JLMS_CONFIG->get('tableheader_tag', 'td');
                ?>
>
						<?php 
            }
        }
        ?>
						<?php 
        if ($price_fee_type == 1) {
            ?>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" width="4%" align="left" nowrap="nowrap"><?php 
            echo _JLMS_COURSES_FEETYPE;
            ?>
</<?php 
            echo $JLMS_CONFIG->get('tableheader_tag', 'td');
            ?>
>
						<?php 
        } else {
            if ($price_fee_type == 2) {
                ?>
						<<?php 
                echo JLMSCSS::tableheadertag();
                ?>
 class="<?php 
                echo JLMSCSS::_('sectiontableheader');
                ?>
" width="4%" align="left" nowrap="nowrap"><?php 
                echo _JLMS_COURSES_PRICE;
                ?>
</<?php 
                echo $JLMS_CONFIG->get('tableheader_tag', 'td');
                ?>
>							
						<?php 
            }
        }
        if ($JLMS_CONFIG->get('lms_courses_sortby', 0) == 1) {
            if ($JLMS_ACL->CheckPermissions('lms', 'order_courses')) {
                ?>
						<<?php 
                echo JLMSCSS::tableheadertag();
                ?>
 colspan="2" width="5%" class="<?php 
                echo JLMSCSS::_('sectiontableheader');
                ?>
">
									<?php 
                echo _JLMS_REORDER;
                ?>
									</<?php 
                echo JLMSCSS::tableheadertag();
                ?>
>
									<<?php 
                echo JLMSCSS::tableheadertag();
                ?>
 width="2%" class="<?php 
                echo JLMSCSS::_('sectiontableheader');
                ?>
">
									<?php 
                echo _JLMS_ORDER;
                ?>
									</<?php 
                echo JLMSCSS::tableheadertag();
                ?>
>
									<<?php 
                echo JLMSCSS::tableheadertag();
                ?>
 width="1%" class="<?php 
                echo JLMSCSS::_('sectiontableheader');
                ?>
">
									<a href="javascript:cf_saveorder();"><img src="<?php 
                echo $lms_img_path;
                ?>
/toolbar/tlb_filesave.png" border="0" width="16" height="16" alt="<?php 
                echo _JLMS_SAVEORDER;
                ?>
" title="<?php 
                echo _JLMS_SAVEORDER;
                ?>
" /></a>
									</<?php 
                echo JLMSCSS::tableheadertag();
                ?>
>
						<?php 
            }
        }
        if ($JLMS_ACL->CheckPermissions('lms', 'create_course')) {
            ?>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" width="40" align="center"><?php 
            echo _JLMS_COURSES_PUBLISHED_COURSE;
            ?>
</<?php 
            echo $JLMS_CONFIG->get('tableheader_tag', 'td');
            ?>
>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" width="40" align="center"><?php 
            echo _JLMS_COURSES_DELETE_COURSE;
            ?>
</<?php 
            echo $JLMS_CONFIG->get('tableheader_tag', 'td');
            ?>
>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" width="40" align="center"><?php 
            echo _JLMS_COURSES_EDIT_COURSE;
            ?>
</<?php 
            echo $JLMS_CONFIG->get('tableheader_tag', 'td');
            ?>
>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" width="30" align="center"><?php 
            echo _JLMS_COURSES_EXPORT;
            ?>
</<?php 
            echo $JLMS_CONFIG->get('tableheader_tag', 'td');
            ?>
>
						<?php 
        }
        ?>
					</tr>
				<?php 
        $k = 1;
        $iii = 0;
        $number_of_columns_in_table = 0;
        $show_paid_courses = $JLMS_CONFIG->get('show_paid_courses', 1);
        for ($i = 0, $n = count($rows); $i < $n; $i++) {
            $row = $rows[$i];
            $number_of_columns_in_table = 0;
            $course_usertype = 0;
            if (in_array($row->id, $JLMS_CONFIG->get('teacher_in_courses', array(0)))) {
                $course_usertype = 1;
            } elseif (in_array($row->id, $JLMS_CONFIG->get('student_in_courses', array(0)))) {
                $course_usertype = 2;
            }
            //$course_usertype = JLMS_GetUserType($my->id, $row->id);
            if (!$show_paid_courses && !$course_usertype && $row->paid) {
                continue;
            }
            $course_descr = strip_tags($row->course_description);
            if (strlen($course_descr) > 100) {
                $course_descr = substr($course_descr, 0, 100) . "...";
            }
            $link = sefRelToAbs("index.php?option=" . $option . "&Itemid=" . $Itemid . "&task=details_course&id=" . $row->id);
            $checked = '';
            if ($course_usertype) {
                $bg = '';
                if ($course_usertype == 1) {
                    $checked = '<img class="JLMS_png" src="' . $lms_img_path . '/toolbar/tlb_courses.png" width="16" height="16" border="0" alt="" title="" />';
                    $pres_icons->my = 1;
                } elseif ($course_usertype == 2) {
                    $checked = '<img class="JLMS_png" src="' . $lms_img_path . '/buttons/btn_complete.png" width="16" height="16" border="0" alt="" title="" />';
                    $pres_icons->already = 1;
                }
            } elseif ($row->self_reg == 0) {
                $checked = "<a href='mailto:" . $row->email . "'><img class='JLMS_png' src=\"" . $lms_img_path . "/dropbox/dropbox_corr.png\" width='16' height='16' border='0' alt='' title='' /></a>";
                $pres_icons->mail = 1;
            } else {
                if ($row->in_wl) {
                    $checked = '<img class="JLMS_png" src="' . $lms_img_path . '/buttons/btn_waiting.png" width="16" height="16" border="0" alt="" title="" />';
                    $pres_icons->wl = 1;
                } else {
                    $can_enroll = JLMS_checkCourseGID($my->id, $row->gid);
                    if ($can_enroll) {
                        $checked = mosHTML::idBox($i, $row->id);
                    } else {
                        $checked = "<a href='mailto:" . $row->email . "'><img class='JLMS_png' src=\"" . $lms_img_path . "/dropbox/dropbox_corr.png\" width='16' height='16' border='0' alt='' title='' /></a>";
                        $pres_icons->mail = 1;
                    }
                }
            }
            ?>
					<?php 
            if ($show_short_description && !$JLMS_ACL->CheckPermissions('lms', 'order_courses')) {
                ?>
					<tr valign="middle" style="vertical-align:middle" class="<?php 
                echo JLMSCSS::_('sectiontableentry2');
                ?>
">
					<?php 
            } else {
                ?>
					<tr valign="middle" style="vertical-align:middle" class="<?php 
                echo JLMSCSS::_('sectiontableentry' . $k);
                ?>
">					
					<?php 
            }
            $number_of_columns_in_table = $number_of_columns_in_table + 4;
            // index, checkbox, name,category
            ?>
						<td align="center"><?php 
            echo $pageNav->limitstart + $iii + 1;
            ?>
</td>
						<td align="center"><?php 
            echo $checked;
            ?>
</td>
						<td align="left" class="jlms_coursename_cont_td">
							<a href="<?php 
            echo $link;
            ?>
" title="<?php 
            echo str_replace('"', '&quot;', $row->course_name);
            ?>
">
								<?php 
            echo $row->course_name;
            ?>
							</a>
							<br />
							<?php 
            if ($show_course_author) {
                ?>
								<span class="small"><?php 
                echo _JLMS_HOME_AUTHOR . "&nbsp;" . $row->user_fullname;
                ?>
</span>
							<?php 
            }
            ?>
							<?php 
            if (isset($row->plugin_course_list_extra_information) && count($row->plugin_course_list_extra_information)) {
                echo '<br />';
                $fields = $row->plugin_course_list_extra_information;
                $c = 1;
                foreach ($fields as $field) {
                    echo '<span class="small">' . $field->name . ': ' . $field->value . '</span>';
                    if ($c < count($fields)) {
                        echo '<br />';
                    }
                    $c++;
                }
            }
            ?>
						</td>
						
						<?php 
            if (isset($lists['extra_columns']) && count($lists['extra_columns'])) {
                foreach ($lists['extra_columns'] as $column) {
                    ?>
								<td align="left">
								<?php 
                    if (isset($row->plugin_course_list_extra_column) && count($row->plugin_course_list_extra_column)) {
                        $fields = $row->plugin_course_list_extra_column;
                        foreach ($fields as $field) {
                            //										echo $field->name.' '.$column->value;
                            //										echo '<br />';
                            if ($column->value == $field->name) {
                                echo $field->value;
                            }
                        }
                    }
                    ?>
								</td>
							<?php 
                }
            }
            ?>
						
						<td align="left"><?php 
            echo $row->c_category ? $row->c_category : '&nbsp;';
            ?>
</td>
						<?php 
            if (!$JLMS_ACL->CheckPermissions('lms', 'order_courses')) {
                if ($show_course_publish_dates) {
                    $number_of_columns_in_table = $number_of_columns_in_table + 2;
                    ?>
								<td align="center" nowrap="nowrap"><?php 
                    echo $row->publish_start ? JLMS_dateToDisplay($row->start_date) : '&nbsp;';
                    ?>
</td>
								<td align="center" nowrap="nowrap"><?php 
                    echo $row->publish_end ? JLMS_dateToDisplay($row->end_date) : '&nbsp;';
                    ?>
</td>
								<?php 
                }
            }
            if ($price_fee_type) {
                if ($price_fee_type == 1) {
                    $number_of_columns_in_table++;
                    ?>
							<td align="center"><?php 
                    echo $row->paid ? _JLMS_COURSES_PAID : _JLMS_COURSES_FREE;
                    ?>
</td>
							<?php 
                } else {
                    if ($price_fee_type == 2) {
                        $number_of_columns_in_table++;
                        ?>
							<td align="center"><?php 
                        echo $row->paid ? $jlms_cs . sprintf('%.2f', round($row->course_price, 2)) : _JLMS_COURSES_FREE;
                        ?>
</td>	
							<?php 
                    }
                }
            }
            if ($JLMS_CONFIG->get('lms_courses_sortby', 0) == 1) {
                if ($JLMS_ACL->CheckPermissions('lms', 'order_courses')) {
                    $number_of_columns_in_table = $number_of_columns_in_table + 4;
                    //up, down, number(colspan=2)
                    ?>
								<td>
								<?php 
                    echo JLMS_orderUpIcon($i, $row->id, true, 'fcourse_orderup');
                    ?>
								</td>
								<td>
								<?php 
                    echo JLMS_orderDownIcon($i, $n, $row->id, true, 'fcourse_orderdown');
                    ?>
								</td>
								<td align="center" colspan="2">
								<input type="text" name="order[]" size="5" value="<?php 
                    echo $row->ordering;
                    ?>
" class="text_area" style="text-align: center" />
								<input type="checkbox" name="t_chk[]" value="<?php 
                    echo $row->id;
                    ?>
" style="visibility:hidden; display:none;" checked="checked" />
								</td>
							<?php 
                }
            }
            if ($JLMS_ACL->CheckPermissions('lms', 'create_course')) {
                $number_of_columns_in_table = $number_of_columns_in_table + 4;
                // publish, delete, edit, export
                ?>
			
						<td align="center" valign="middle">
							<?php 
                if ($course_usertype == 1) {
                    $time_p = $row->publish_start || $row->publish_end;
                    $alt = $row->published ? $time_p ? _JLMS_STATUS_PUB : _JLMS_STATUS_PUB : _JLMS_STATUS_UNPUB;
                    $image = $row->published ? $time_p ? 'btn_publish_wait.png' : 'btn_accept.png' : 'btn_cancel.png';
                    $add_options = '';
                    $html_txt = '';
                    $html_txt_title = '';
                    if ($time_p) {
                        $html_txt_title = $alt;
                        $is_expired = false;
                        $is_future_course = false;
                        $html_txt = '<table cellpadding=0 cellspacing=0 border=0>';
                        if ($row->publish_start) {
                            $html_txt .= '<tr><td align=left>' . _JLMS_START_DATE . '&nbsp;</td><td align=left>' . $row->start_date . '</td></tr>';
                            $s_date = strtotime($row->start_date);
                            if ($s_date > time()) {
                                $is_future_course = true;
                            }
                        } else {
                            $html_txt .= '<tr><td align=left>' . _JLMS_START_DATE . '&nbsp;</td><td align=left>-</td></tr>';
                        }
                        if ($row->publish_end) {
                            $html_txt .= '<tr><td align=left>' . _JLMS_END_DATE . '&nbsp;</td><td align=left>' . $row->end_date . '</td></tr>';
                            $e_date = strtotime($row->end_date);
                            if ($e_date < time()) {
                                $is_expired = true;
                            }
                        } else {
                            $html_txt .= '<tr><td align=left>' . _JLMS_END_DATE . '&nbsp;</td><td align=left>-</td></tr>';
                        }
                        if ($is_expired) {
                            $alt = _JLMS_STATUS_EXPIRED;
                            $html_txt_title = _JLMS_STATUS_EXPIRED;
                            $image = 'btn_expired.png';
                        } elseif ($is_future_course) {
                            $alt = _JLMS_STATUS_FUTURE_COURSE;
                            if (!$row->published) {
                                $alt .= ' / ' . _JLMS_STATUS_UNPUB;
                            }
                            $html_txt_title = $alt;
                            $image = 'btn_expired.png';
                            if ($JLMS_CONFIG->get('show_future_courses', false) && $is_future_course && $row->published) {
                                $image = 'btn_publish_wait.png';
                            }
                        }
                        $html_txt .= '</table>';
                    }
                    $state = $row->published ? 0 : 1;
                    $plink = JLMSRoute::_("index.php?option=" . $option . "&amp;Itemid=" . $Itemid . "&amp;task=change_course&amp;state=" . $state . "&amp;id=" . $row->id);
                    $inside_tag = '<img class="JLMS_png" src="' . $lms_img_path . '/toolbar/' . $image . '" width="16" height="16" border="0" alt="' . $alt . '" title="' . $alt . '" />';
                    echo JLMS_toolTip($html_txt_title, $html_txt, $inside_tag, $plink, 1, 30, true, 'jlms_ttip jlms_img_link');
                    ?>
							<?php 
                } else {
                    echo '&nbsp;';
                }
                ?>
						</td>
						<td align="center" valign="middle">
							<?php 
                if ($course_usertype == 1) {
                    ?>
							<a class="jlms_img_link" href="javascript:submitbutton('delete_course',<?php 
                    echo $row->id;
                    ?>
);" title="<?php 
                    echo _JLMS_DELETE;
                    ?>
"><img class="JLMS_png" src="<?php 
                    echo $lms_img_path;
                    ?>
/toolbar/btn_delete.png" width="16" height="16" border="0" alt="<?php 
                    echo _JLMS_DELETE;
                    ?>
" title="<?php 
                    echo _JLMS_DELETE;
                    ?>
" /></a>
							<?php 
                } else {
                    echo '&nbsp;';
                }
                ?>
						</td>
						<td align="center" valign="middle">
							<?php 
                if ($course_usertype == 1) {
                    ?>
							<a class="jlms_img_link" href="javascript:submitbutton('edit_course',<?php 
                    echo $row->id;
                    ?>
);" title="<?php 
                    echo _JLMS_EDIT;
                    ?>
"><img class="JLMS_png" src="<?php 
                    echo $lms_img_path;
                    ?>
/toolbar/btn_edit.png" width="16" height="16" border="0" alt="<?php 
                    echo _JLMS_EDIT;
                    ?>
" title="<?php 
                    echo _JLMS_EDIT;
                    ?>
" /></a>
							<?php 
                } else {
                    echo '&nbsp;';
                }
                ?>
						</td>
						<td align="center" valign="middle">
							<?php 
                if ($course_usertype == 1) {
                    ?>
							<a class="jlms_img_link" href="javascript:submitbutton('export_course_pre',<?php 
                    echo $row->id;
                    ?>
);" title="<?php 
                    echo _JLMS_EDIT;
                    ?>
"><img class="JLMS_png" src="<?php 
                    echo $lms_img_path;
                    ?>
/toolbar/btn_export.png" width="16" height="16" border="0" alt="<?php 
                    echo _JLMS_COURSES_EXPORT;
                    ?>
" title="<?php 
                    echo _JLMS_COURSES_EXPORT;
                    ?>
" /></a>
							<?php 
                } else {
                    echo '&nbsp;';
                }
                ?>
						</td>
						<?php 
            }
            ?>
					</tr>
					<?php 
            if (!$JLMS_ACL->CheckPermissions('lms', 'order_courses')) {
                if ($show_short_description) {
                    if (strlen($row->course_sh_description)) {
                        ?>
						<tr class="<?php 
                        echo JLMSCSS::_('sectiontableentry1');
                        ?>
">
							<td>&nbsp;</td>
							<td colspan="<?php 
                        echo $number_of_columns_in_table ? $number_of_columns_in_table - 1 : $colspan_sh_description;
                        ?>
" style="text-align: justify;">
								<?php 
                        echo $row->course_sh_description;
                        ?>
							</td>
						</tr>
						<?php 
                    }
                }
            }
            ?>
					<?php 
            $k = 3 - $k;
            $iii++;
        }
        ?>
				<?php 
        if ($pageNav->isMultiPages()) {
            ?>
					<tr>
						<?php 
            if ($JLMS_ACL->CheckPermissions('lms', 'order_courses')) {
                $colspan_sh_description = $colspan_sh_description + 7;
            }
            ?>
						<td class="<?php 
            echo JLMSCSS::_('jlmslist-footer_td');
            ?>
" colspan="<?php 
            echo $number_of_columns_in_table ? $number_of_columns_in_table : $colspan_sh_description + 1;
            ?>
" align="center">
							<div align="center" style="text-align:center">
							<?php 
            $link = "index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=courses";
            echo _JLMS_PN_DISPLAY_NUM . $pageNav->getLimitBox($link) . ' ' . $pageNav->getPagesCounter();
            ?>
							</div>
							<br />
							<div align="center" style="text-align:center">
							<?php 
            $link = "index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=courses";
            echo $pageNav->writePagesLinks($link);
            ?>
							</div>
						</td>
					</tr>
				<?php 
        }
        ?>
				</table>
				
	<?php 
        JLMS_TMPL::CloseTS();
        JLMS_TMPL::ShowControlsFooter($controls);
        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 
    }
コード例 #4
0
    function show_calendar_week($id, $option, $rows, $date)
    {
        $JLMS_CONFIG =& JLMSFactory::getConfig();
        $Itemid = $JLMS_CONFIG->get('Itemid');
        $month = date('m', $date);
        $day = date('j', $date);
        $year = date('Y', $date);
        $choose_date = JLMS_dateToDisplay(date('Y-m-d', $date));
        $date_format_fdow = $JLMS_CONFIG->get('date_format_fdow');
        /*<script type="text/javascript" src="<?php echo $JLMS_CONFIG->get('live_site');?>/includes/js/joomla.javascript.js "></script>*/
        ?>
		<script type="text/javascript" language="javascript">
		<!--
		function td_hover(elem){
			getObj(elem).style['background'] = '#EEEEEE';
			getObj(elem).style.color = '#000000';
			//getObj(elem).style.cursor = 'pointer';
		}
		//function out to other days
		function td_out(elem){
			getObj(elem).style['background'] = '';
			getObj(elem).style.color = '';
		}
		//function out to weekneds days
		function td_out2(elem){
			getObj(elem).style['background'] = '#E1CDCD';
			getObj(elem).style.color = '';
		}
		//function out to current day
		function td_out3(elem){
			getObj(elem).style['background'] = '#FBA179';
			getObj(elem).style.color = '';
		}
		-->
		</script>	
		<script language="javascript" type="text/javascript">
		<!--//
		function quick_date(){
			document.forms.jlms_agenda_form_day.submit();
		}	//-->
		</script>
		<form action="<?php 
        echo sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}");
        ?>
" method="post" name="jlms_agenda_form_day">
		<table cellpadding="0" cellspacing="0" border="0" style="height:20px" class="jlms_table_no_borders">
			<tr>
				<td valign="middle" align="center" width="18">
				<?php 
        echo JLMS_HTML::_('calendar.calendar', $choose_date, 'cal', 'jlms_choose', null, null, 'statictext');
        ?>
				
				</td><td valign="middle" align="center" width="18">
				<span onclick="quick_date()" style=" cursor:pointer" title="<?php 
        echo _JLMS_AGENDA_GO_DATE;
        ?>
">
				<img 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;
        ?>
" id="go_date" border="0" width="16" height="16" class="JLMS_png" />
				</span>
				</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="agenda" />
		<input type="hidden" name="mode" value="view_week" />
		<input type="hidden" name="boxchecked" value="0" />
		<input type="hidden" name="id" value="<?php 
        echo $id;
        ?>
" />
		</form>
		<?php 
        $wday = JDDayOfWeek(GregorianToJD($month, $day, $year), 0);
        if ($date_format_fdow == 1) {
            if ($wday == 0) {
                $wday = 7;
            }
            $mon_day_num = strtotime("-" . ($wday - 1) . " day", $date);
            $sun_day_num = strtotime("+" . (7 - $wday) . " day", $date);
            $num_sat = 5;
            $num_sun = 6;
        } else {
            $mon_day_num = strtotime("-" . $wday . " day", $date);
            $sun_day_num = strtotime("+" . (6 - $wday) . " day", $date);
            $num_sat = 0;
            $num_sun = 6;
        }
        ?>
		<!-- Shablon calendaria. -->
		<table cellpadding="0" cellspacing="0" width="100%">
			<tr style="background: url('<?php 
        echo $JLMS_CONFIG->get('live_site');
        ?>
/components/com_joomla_lms/lms_images/agenda/bg.jpg') #cccccc repeat-x; font-weight:bold; color:white;height:20px " valign="middle">
				<td valign="middle" align="center">
				<a class="jlms_img_link" href="<?php 
        echo sefRelToAbs("index.php?option={$option}&amp;Itemid=" . $Itemid . "&amp;task=agenda&amp;mode=view_week&amp;id=" . $id . "&amp;date=" . JLMS_dateToDisplay(strtotime("-1 week", $date), true));
        ?>
">
				<img src="<?php 
        echo $JLMS_CONFIG->get('live_site');
        ?>
/components/com_joomla_lms/lms_images/agenda/ag_previous.png" class="JLMS_png" alt="<?php 
        echo _JLMS_AGENDA_PREVIOUSWEEK;
        ?>
" title="<?php 
        echo _JLMS_AGENDA_PREVIOUSWEEK;
        ?>
" width="16" height="16"  border="0"/>
				</a>
				</td>
				<td align="center" style="text-align:center" valign="middle" colspan="5">
				(<?php 
        echo day_month_lang(date('w d m Y', $mon_day_num), 0, 1, 5, 2) . "&nbsp;&nbsp;-&nbsp;&nbsp;" . day_month_lang(date('w d m Y', $sun_day_num), 0, 1, 5, 2);
        ?>
)
				</td>
				<td valign="middle" align="center">
				<a class="jlms_img_link" href="<?php 
        echo sefRelToAbs("index.php?option={$option}&amp;Itemid=" . $Itemid . "&amp;task=agenda&amp;mode=view_week&amp;id=" . $id . "&amp;date=" . JLMS_dateToDisplay(strtotime("+1 week", $date), true));
        ?>
">
				<img src="<?php 
        echo $JLMS_CONFIG->get('live_site');
        ?>
/components/com_joomla_lms/lms_images/agenda/ag_next.png" class="JLMS_png" alt="<?php 
        echo _JLMS_AGENDA_NEXTWEEK;
        ?>
" title="<?php 
        echo _JLMS_AGENDA_NEXTWEEK;
        ?>
" width="16" height="16"  border="0"/>
				</a></td>
			</tr>	
		<!-- cycle of rows -->
		<?php 
        echo "<tr>";
        $i = 0;
        $br_right = '';
        for ($i; $i < 7; $i++) {
            if ($i == 6) {
                $br_right = ';border-right:1px solid #B3B3B3';
            }
            echo "<td style='width:14%;text-align:center; height:15px;background:#cccccc;border-bottom:1px solid #B3B3B3; border-left:1px solid #B3B3B3 {$br_right}' >" . month_lang(strftime('%m %Y', strtotime("+{$i} day", $mon_day_num)), 0, 2) . "<br />" . day_month_lang(date("w", strtotime("+{$i} day", $mon_day_num)), 0, 1, 0, 0) . "</td>";
        }
        echo "</tr>";
        $i = 0;
        echo "<tr>";
        for ($i; $i < 7; $i++) {
            if ($i == $num_sat || $i == $num_sun) {
                $color = '';
                if ($i == 6) {
                    $color = "border-right:1px solid #B3B3B3;  ";
                }
                $color .= "background:#E1CDCD;border-left:1px solid #B3B3B3; border-bottom:1px solid #B3B3B3; ";
                $w = '2';
            } else {
                $color = 'border-bottom:1px solid #B3B3B3; border-left:1px solid #B3B3B3;';
                $w = '';
            }
            if (date("" . $year . "-" . $month . "-" . $i . "", $date) == date('Y-m-d')) {
                $color = "background:#FBA179;border:1px solid #B3B3B3;";
                $w = '3';
            }
            $today = '';
            if (date('Y-m-d', strtotime("+{$i} day", $mon_day_num)) == date('Y-m-d')) {
                $color = "background:#FBA179;border-left:1px solid #B3B3B3;border-bottom:1px solid #B3B3B3;";
                $w = '3';
                //$today = _JLMS_AGENDA_TODAY;
            }
            //if ($i == 0){ echo "<tr>";}
            echo "<td style='" . $color . "width:14%; height:40px;' valign='top' id='day" . $i . "' onmouseover=\"td_hover('day" . $i . "')\" onmouseout=\"td_out" . $w . "('day" . $i . "')\">" . $today . "<br />";
            $k = 0;
            while (isset($rows[$k]) && $k < count($rows)) {
                if (strtotime("+{$i} day", $mon_day_num) >= strtotime($rows[$k]->start_date) && strtotime("+{$i} day", $mon_day_num) <= strtotime($rows[$k]->end_date)) {
                    $title = substr($rows[$k]->title, 0, 12);
                    $title .= strlen($rows[$k]->title) > 12 ? "..." : '';
                    $descr = strip_tags($rows[$k]->content);
                    $overlib_descr = substr($descr, 0, 120) . (strlen($descr) > 120 ? "..." : '');
                    $overlib_descr = JLMS_txt2overlib($overlib_descr);
                    $overlib_title = JLMS_txt2overlib($rows[$k]->title);
                    $link = sefRelToAbs("index.php?option={$option}&amp;&amp;Itemid={$Itemid}&amp;task=agenda&amp;id={$id}&amp;agenda_id=" . $rows[$k]->agenda_id . "&amp;date=" . date("Y-m", $date) . "#anc" . $rows[$k]->agenda_id . '-' . date("Y-m", $date) . "");
                    echo JLMS_toolTip($overlib_title, $overlib_descr, $title, $link);
                    echo '<br />';
                }
                $k++;
            }
            echo "</td>";
        }
        echo "</tr>";
        ?>
		</table>
	<?php 
    }
コード例 #5
0
    function showCourseLPath($course_id, $lpath_id, &$lpath, &$conds, $option)
    {
        global $Itemid, $JLMS_CONFIG;
        ?>

<script language="javascript" type="text/javascript">
<!--
function submitbutton(pressbutton) {
	var form = document.adminForm;

	// do field validation
	if (((pressbutton == 'lpath_item_delete') || (pressbutton == 'lpath_item_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 == 'lpath_item_orderup') || (pressbutton == 'lpath_item_orderdown')){
		if (item_id) {
		form.task.value = pressbutton;
		form.row_id.value = item_id;
		form.submit();
		}
	}
}
/*
Ordering (Max)
*/
function checkAll_button( n ) {
	for ( var j = 0; j <= n; j++ ) {
		box = eval( "document.adminForm.cb" + j );
		if ( box ) {
			if ( box.checked == false ) {
				box.checked = true;
			}
		} else {
			alert("You cannot change the order of items, as an item in the list is `Checked Out`");
			return;
		}
	}
	submitform('lpath_item_saveorder');
}
var TreeArray1 = new Array();
var TreeArray2 = new Array();
var Is_ex_Array = new Array();
<?php 
        $i = 1;
        foreach ($lpath as $lpath_row) {
            echo "TreeArray1[" . $i . "] = " . $lpath_row->parent_id . ";";
            echo "TreeArray2[" . $i . "] = " . $lpath_row->id . ";";
            echo "Is_ex_Array[" . $i . "] = 1;" . "\n";
            $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) {
			getObj('tree_row_'+TreeArray2[i]).style.visibility = vis_style;
			getObj('tree_row_'+TreeArray2[i]).style.display = dis_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('chapter_expand.png','chapter_collapse.png').replace('<?php 
        echo _JLMS_LPATH_EXP_CHAP;
        ?>
', '<?php 
        echo _JLMS_LPATH_COLL_CHAP;
        ?>
');
			StStr = StStr.replace('chapter_expand.png','chapter_collapse.png');
			getObj('tree_img_' + fid).outerHTML = imgStr;
			getObj('tree_img_' + fid).runtimeStyle.filter = StStr;
		} else {
			getObj('tree_img_' + fid).src = '<?php 
        echo $JLMS_CONFIG->getCfg('live_site');
        ?>
/components/com_joomla_lms/lms_images/learnpath/chapter_collapse.png';
			getObj('tree_img_' + fid).alt = '<?php 
        echo _JLMS_LPATH_COLLAPSE;
        ?>
';
			getObj('tree_img_' + fid).title = '<?php 
        echo _JLMS_LPATH_COLL_CHAP;
        ?>
';
		}
	} 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('chapter_collapse.png','chapter_expand.png').replace('<?php 
        echo _JLMS_LPATH_COLL_CHAP;
        ?>
', '<?php 
        echo _JLMS_LPATH_EXP_CHAP;
        ?>
');
			StStr = StStr.replace('chapter_collapse.png','chapter_expand.png');
			getObj('tree_img_' + fid).outerHTML = imgStr;
			getObj('tree_img_' + fid).runtimeStyle.filter = StStr;
		} else {
			getObj('tree_img_' + fid).src = '<?php 
        echo $JLMS_CONFIG->getCfg('live_site');
        ?>
/components/com_joomla_lms/lms_images/learnpath/chapter_expand.png';
			getObj('tree_img_' + fid).alt = '<?php 
        echo _JLMS_LPATH_EXPAND;
        ?>
';
			getObj('tree_img_' + fid).title = '<?php 
        echo _JLMS_LPATH_EXP_CHAP;
        ?>
';
		}
	}
	i = 1;
	while (i < TreeArray2.length) {
		if ( (TreeArray2[i] == fid) ) {
			if (Is_ex_Array[i] == 1) { Is_ex_Array[i] = 0; } else { Is_ex_Array[i] = 1; } }
		i++; }
}
JLMS_preloadImages('<?php 
        echo $JLMS_CONFIG->getCfg('live_site');
        ?>
/components/com_joomla_lms/lms_images/learnpath/chapter_expand.png','<?php 
        echo $JLMS_CONFIG->getCfg('live_site');
        ?>
/components/com_joomla_lms/lms_images/learnpath/chapter_collapse.png');
//-->
</script>
<?php 
        JLMS_TMPL::OpenMT();
        $hparams = array();
        JLMS_TMPL::ShowHeader('lpath', _JLMS_LPATH_TITLE_LP, $hparams);
        $max_tree_width = 0;
        if (isset($lpath[0])) {
            $max_tree_width = $lpath[0]->tree_max_width;
        }
        JLMS_TMPL::OpenTS();
        ?>
		<form action="<?php 
        echo $JLMS_CONFIG->getCfg('live_site') . "/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();
        ?>
 width="<?php 
        echo 16 * ($max_tree_width + 1);
        ?>
" class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" colspan="<?php 
        echo $max_tree_width + 1;
        ?>
">&nbsp;</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
				<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" width="30%"><?php 
        echo _JLMS_LPATH_TBL_HEAD_NAME_LP;
        ?>
</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
				<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" colspan="2" width="1"><?php 
        echo _JLMS_REORDER;
        ?>
</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
				<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" width="1"><?php 
        echo _JLMS_ORDER;
        ?>
</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
				<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" width="1">
					<a class="jlms_img_link" href="javascript:checkAll_button(<?php 
        echo count($lpath) - 1;
        ?>
)"><img width="16" height="16" border="0" title="<?php 
        echo _JLMS_SAVEORDER;
        ?>
" alt="<?php 
        echo _JLMS_SAVEORDER;
        ?>
" src="<?php 
        echo $JLMS_CONFIG->get('live_site');
        ?>
/components/com_joomla_lms/lms_images/filesave.png"/></a>
				</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
				<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" colspan="2" width="1">&nbsp;</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
				<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" width="60%"><?php 
        echo _JLMS_LPATH_TBL_HEAD_DESCR_LP;
        ?>
</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
			</tr>
		<?php 
        $k = 1;
        $tree_modes = array();
        for ($i = 0, $n = count($lpath); $i < $n; $i++) {
            $row_path = $lpath[$i];
            $max_tree_width = $row_path->tree_max_width;
            $link = "index.php?option=" . $option . "&amp;Itemid=" . $Itemid . "&amp;task=details_course&amp;id=" . $row_path->id;
            //ne zabyt' sefRelToAbs
            $checked = mosHTML::idBox($i, $row_path->id);
            ?>
			
			<tr id="tree_row_<?php 
            echo $row_path->id;
            ?>
" class="<?php 
            echo JLMSCSS::_('sectiontableentry' . $k);
            ?>
">
				<td align="center" valign="middle"><?php 
            echo $i + 1;
            ?>
</td>
				<td valign="middle"><?php 
            if (!isset($row_path->is_link)) {
                echo $checked;
            }
            ?>
</td>
				<?php 
            $add_img = '';
            if ($row_path->tree_mode_num) {
                $g = 0;
                $tree_modes[$row_path->tree_mode_num - 1] = $row_path->tree_mode;
                while ($g < $row_path->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='line' border='0' /></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_path->tree_mode . ".png\" width='16' height='16' border='0' alt='sub' /></td>";
                $max_tree_width = $max_tree_width - $g - 1;
            }
            echo $add_img;
            ?>
				<td valign="middle" align="center" width="16"><div align="center" style="vertical-align:middle;"><?php 
            switch ($row_path->step_type) {
                case 1:
                    echo "<span id='tree_div_" . $row_path->id . "' style='text-align:center; cursor:pointer; vertical-align:middle;' onclick='Ex_Folder(" . $row_path->id . "," . $row_path->id . ",true)'><img id='tree_img_" . $row_path->id . "' class='JLMS_png' src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/learnpath/chapter_collapse.png\" width='16' height='16' border='0' alt='chapter' /></span>";
                    break;
                case 2:
                    if (isset($row_path->folder_flag) && $row_path->folder_flag == 2) {
                        echo "<span style='text-align:center;'><img class='JLMS_png' src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/files/file_zippack.png\" width='16' height='16' border='0' alt='zip package' /></span>";
                    } else {
                        echo "<span style='text-align:center;'><img class='JLMS_png' src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/files/" . $row_path->file_icon . ".png\" width='16' height='16' border='0' alt='file' /></span>";
                    }
                    break;
                case 3:
                    echo "<span style='text-align:center;'><img class='JLMS_png' src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/files/link_world.png\" width='16' height='16' border='0' alt='link' /></span>";
                    break;
                case 4:
                    echo "<span style='text-align:center;'><img class='JLMS_png' src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/files/file_content.png\" width='16' height='16' border='0' alt='content' /></span>";
                    break;
                case 5:
                    echo "<span style='text-align:center;'><img class='JLMS_png' src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/toolbar/tlb_quiz.png\" width='16' height='16' border='0' alt='quiz' /></span>";
                    break;
                case 6:
                    echo "<span style='text-align:center;'><img class='JLMS_png' src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/toolbar/tlb_scorm.png\" width='16' height='16' border='0' alt='scorm' /></span>";
                    break;
            }
            ?>
				</div>
				</td>
				<td width="30%" align="left" valign="middle" <?php 
            if ($max_tree_width > 0) {
                echo "colspan='" . ($max_tree_width + 1) . "'";
            }
            ?>
>
					<?php 
            if ($row_path->step_type == 1) {
                echo "<strong>" . $row_path->doc_name . "</strong>";
            } elseif ($row_path->step_type == 2) {
                if ($row_path->folder_flag == 2 && $row_path->file_id) {
                    $link_download = sefRelToAbs("index.php?option=" . $option . "&amp;Itemid=" . $Itemid . "&amp;task=docs_view_zip&amp;course_id=" . $course_id . "&amp;id=" . $row_path->item_id);
                    echo '<a target="_blank" href="' . $link_download . '" title="' . _JLMS_T_A_VIEW_ZIP_PACK . '">' . $row_path->doc_name . '</a>';
                } elseif ((!$row_path->folder_flag || $row_path->folder_flag == 3) && !$row_path->file_id) {
                    if (!isset($row_path->is_link)) {
                        $link_download = sefRelToAbs("index.php?option=" . $option . "&amp;Itemid=" . $Itemid . "&amp;task=docs_view_content&amp;course_id=" . $course_id . "&amp;id=" . $row_path->item_id);
                        echo '<a target="_blank" href="' . $link_download . '" title="' . _JLMS_T_A_VIEW_CONTENT . '">' . $row_path->doc_name . '</a>';
                    } else {
                        echo $row_path->doc_name;
                    }
                } else {
                    if (!isset($row_path->is_link)) {
                        $link_download = sefRelToAbs("index.php?option=" . $option . "&amp;Itemid=" . $Itemid . "&amp;task=get_document&amp;course_id=" . $course_id . "&amp;id=" . $row_path->item_id . "&amp;lpath_id=" . $lpath_id);
                        echo '<a href="' . $link_download . '" title="' . _JLMS_T_A_DOWNLOAD . '">' . $row_path->doc_name . '</a>';
                    } else {
                        echo $row_path->doc_name;
                    }
                }
            } elseif ($row_path->step_type == 3) {
                echo '<a target="_blank" href="' . $row_path->link_href . '" title="' . _JLMS_T_A_VIEW_LINK . '">' . $row_path->doc_name . '</a>';
            } elseif ($row_path->step_type == 4) {
                echo '<a href="' . sefRelToAbs("index.php?option=" . $option . "&amp;Itemid=" . $Itemid . "&amp;task=show_lp_content&amp;course_id=" . $course_id . "&amp;lpath_id=" . $row_path->lpath_id . "&amp;id=" . $row_path->id) . '" title="' . _JLMS_T_A_VIEW_CONTENT . '">' . $row_path->doc_name . '</a>';
            } else {
                echo $row_path->doc_name;
            }
            ?>
				</td>
				<td valign="middle" style="vertical-align:middle;"><?php 
            if ($row_path->allow_up == 1) {
                echo JLMS_orderUpIcon(1, $row_path->id, true, 'lpath_item_orderup');
            } else {
                echo '&nbsp;';
            }
            ?>
</td>
				<td valign="middle" style="vertical-align:middle;"><?php 
            if ($row_path->allow_down == 1) {
                echo JLMS_orderDownIcon(1, 3, $row_path->id, true, 'lpath_item_orderdown');
            } else {
                echo '&nbsp;';
            }
            ?>
</td>
				<td valign="middle" style="vertical-align:middle;" colspan="2">
					<?php 
            //					if ($row_path->step_type != 1) {
            ?>
						<input type="text" name="order[]" size="5" value="<?php 
            echo $row_path->ordering;
            ?>
" class="inputbox" style="text-align: center" />
					<?php 
            //					}
            ?>
				</td>
				<td valign="middle" style="vertical-align:middle ">
					<?php 
            if ($row_path->step_type == 1) {
                ?>
						<a class="jlms_img_link" href="<?php 
                echo $JLMS_CONFIG->getCfg('live_site') . "/index.php?option=" . $option . "&amp;Itemid=" . $Itemid . "&amp;task=add_lpath_step&amp;course_id=" . $row_path->course_id . "&amp;id=" . $row_path->lpath_id . "&amp;parent=" . $row_path->id;
                ?>
" title="<?php 
                echo _JLMS_LPATH_LINK_ADDSTEP_TITLE;
                ?>
"><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_ADDSTEP_TITLE;
                ?>
" title="<?php 
                echo _JLMS_LPATH_LINK_ADDSTEP_TITLE;
                ?>
" /></a>
					<?php 
            } else {
                echo '&nbsp;';
            }
            ?>
				</td>
				<td valign="middle" style="vertical-align:middle ">
					<?php 
            $cond_link = sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=lpath_step_cond&amp;course_id={$course_id}&amp;lpath_id={$lpath_id}&amp;id={$row_path->id}");
            $cond_descr = _JLMS_LPATH_FLWINDOW_NOCOND;
            $cond_title = _JLMS_LPATH_TITLE_FLWINDOW;
            $cond_img = 'btn_warning';
            if ($row_path->is_condition) {
                $cond_img = 'btn_cond_present';
                $y = 0;
                $is_cond_descr = false;
                $cond_descr = '<table cellpadding=0 cellspacing=0 border=0>';
                while ($y < count($conds)) {
                    if ($conds[$y]->step_id == $row_path->id) {
                        $ref_name = '';
                        $u = 0;
                        while ($u < count($lpath)) {
                            if ($lpath[$u]->id == $conds[$y]->ref_step) {
                                $ref_name = $lpath[$u]->step_name;
                                break;
                            }
                            $u++;
                        }
                        if (isset($conds[$y]->cond_time) && $conds[$y]->cond_time) {
                            $ref_name .= ' (' . _JLMS_LPATH_CONDTYPE_SPENT . ' ' . $conds[$y]->cond_time . ' ' . _JLMS_LPATH_CONDTYPE_TIME_SPENT_MIN . ')';
                        }
                        $cond_descr .= '<tr><td>' . _JLMS_LPATH_CONDTYPE_COMPLETE_W . '&nbsp;</td><td>' . $ref_name . '</td></tr>';
                        $is_cond_descr = true;
                    }
                    $y++;
                }
                $cond_descr .= '</table>';
                if (!$is_cond_descr) {
                    $cond_descr = _JLMS_LPATH_FLWINDOW_NOCOND;
                }
            }
            $img_inside_tag = '<img class="JLMS_png" src="' . $JLMS_CONFIG->get('live_site') . '/components/com_joomla_lms/lms_images/toolbar/' . $cond_img . '.png" width="16" height="16" border="0" alt="cond" />';
            echo JLMS_toolTip($cond_title, JLMS_txt2overlib($cond_descr), $img_inside_tag, $cond_link);
            ?>
				</td>
				<td width="60%" valign="middle" style="vertical-align:middle; "><?php 
            echo strlen($row_path->step_shortdescription) ? $row_path->step_shortdescription : '&nbsp;';
            ?>
</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_add_chapter" />
			<input type="hidden" name="id" value="<?php 
        echo $lpath_id;
        ?>
" />
			<input type="hidden" name="course_id" value="<?php 
        echo $course_id;
        ?>
" />
			<input type="hidden" name="row_id" value="0" />
			<input type="hidden" name="boxchecked" value="0" />
		</form>
<?php 
        JLMS_TMPL::CloseTS();
        $link_new = ampReplace(sefRelToAbs("index.php?option=" . $option . "&amp;Itemid=" . $Itemid . "&amp;task=new_lpath_chapter&amp;id=" . $lpath_id . "&amp;course_id=" . $course_id));
        $controls = array();
        //$controls[] = array('href' => $link_new, 'onclick' => "", 'title' => _JLMS_LPATH_LINK_NEW_CHAP, 'img' => 'add');
        $controls[] = array('href' => "javascript:submitbutton('add_lpath_step');", 'onclick' => "", 'title' => _JLMS_LPATH_LINK_ADDSTEP_TITLE, 'img' => 'add');
        $controls[] = array('href' => "javascript:submitbutton('lpath_item_delete');", 'onclick' => "", 'title' => _JLMS_LPATH_LINK_DEL_ITEM, 'img' => 'delete');
        $controls[] = array('href' => "javascript:submitbutton('lpath_item_edit');", 'onclick' => "", 'title' => _JLMS_LPATH_LINK_EDIT_ITEM, 'img' => 'edit');
        //$controls[] = array('href' => "spacer");
        JLMS_TMPL::ShowControlsFooter($controls, sefRelToAbs("index.php?option=" . $option . "&amp;Itemid=" . $Itemid . "&amp;task=learnpaths&amp;id=" . $course_id));
        JLMS_TMPL::CloseMT();
    }
コード例 #6
0
    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();
    }
コード例 #7
0
    function echoMyCourses($option, $Itemid, &$my_courses)
    {
        global $JLMS_CONFIG;
        ?>
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php 
        echo JLMSCSS::_('jlmslist', 'jlms_homepage_list');
        ?>
" style="margin-top:0; margin-bottom:0;">
		<tr><<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" align="center" style="text-align:center"><?php 
        echo _JLMS_HOME_COURSES_TITLE;
        ?>
</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
></tr>
	<?php 
        $k = 1;
        if (count($my_courses)) {
            $my_courses_teach = array();
            $my_courses_enroll = array();
            foreach ($my_courses as $my_course) {
                if ($my_course->user_course_role == 1) {
                    $my_courses_teach[] = $my_course;
                } else {
                    $my_courses_enroll[] = $my_course;
                }
            }
            if (count($my_courses_teach)) {
                echo "<tr class='" . JLMSCSS::_('sectiontableentry' . $k) . "'><td align='left'>" . _JLMS_COURSE_FP_COURSES_TEACH . "</td></tr>";
                $k = 3 - $k;
                foreach ($my_courses_teach as $my_course) {
                    $link = sefRelToAbs("index.php?option=" . $option . "&amp;Itemid=" . $Itemid . "&amp;task=details_course&amp;id=" . $my_course->id);
                    $description =& joomla_lms_html::PrepareDescription($my_course->course_description);
                    $title = JLMS_txt2overlib($my_course->course_name);
                    echo "<tr class='sectiontableentry{$k}" . ($k % 2 ? ' odd' : ' even') . "'><td>\n\t\t\t\t\t" . JLMS_toolTip($title, $description, $link) . "\n\t\t\t\t\t</td></tr>";
                    $k = 3 - $k;
                }
            }
            if (count($my_courses_enroll)) {
                echo "<tr class='" . JLMSCSS::_('sectiontableentry' . $k) . "'><td align='left'>" . _JLMS_COURSE_FP_COURSES_ENROLL . "</td></tr>";
                $k = 3 - $k;
                foreach ($my_courses_enroll as $my_course) {
                    $link = sefRelToAbs("index.php?option=" . $option . "&amp;Itemid=" . $Itemid . "&amp;task=details_course&amp;id=" . $my_course->id);
                    $description =& joomla_lms_html::PrepareDescription($my_course->course_description);
                    $title = JLMS_txt2overlib($my_course->course_name);
                    echo "<tr class='sectiontableentry{$k}" . ($k % 2 ? ' odd' : ' even') . "'><td>\n\t\t\t\t\t" . JLMS_toolTip($title, $description, $link) . "\n\t\t\t\t\t</td></tr>";
                    $k = 3 - $k;
                }
            }
        } else {
            echo "<tr class='sectiontableentry{$k}" . ($k % 2 ? ' odd' : ' even') . "'><td>" . _JLMS_HOME_COURSES_NO_ITEMS . "</td></tr>";
        }
        ?>
	</table>
	<?php 
    }
コード例 #8
0
    function JQ_editQuest_Pool_GQP($row, $lists, $option, $page, $course_id, $q_om_type, $qtype_str, $rows, $pageNav, $levels)
    {
        global $Itemid;
        ?>
		<script language="javascript" type="text/javascript">
		<!--
		function submitbutton(pressbutton) {
			var form = document.adminForm;
			
			if (pressbutton == 'cancel_quest') {
				form.page.value = pressbutton;
				form.submit();
			}
			if (pressbutton == 'preview_quest') {
					if (form.c_id.value == '0') {
						alert("<?php 
        echo _JLMS_QUIZ_SAVE_QUEST_FIRST;
        ?>
");
					} else {
						window.open('index.php?option=<?php 
        echo $option;
        ?>
&Itemid=<?php 
        echo $Itemid;
        ?>
&task=quizzes&id=<?php 
        echo $course_id;
        ?>
&page=view_preview&c_id=<?php 
        echo $row->c_id;
        ?>
');
						return;
					}
			}		
			if (pressbutton == 'save_quest') {
			// do field validation
				if (form.boxchecked.value == 0){
					alert( "<?php 
        echo _JLMS_QUIZ_SELECT_QUESTIONS;
        ?>
" );
				} 
				else {
					form.page.value = pressbutton;
					form.submit();
				}
			}
		}
		function jlms_jq_isChecked(isitchecked){
			if (isitchecked == true){
				document.adminForm.boxchecked.value++;
			}
			else {
				document.adminForm.boxchecked.value = document.adminForm.boxchecked.value - 1;
			}
		}
		function checkAllQ( n, fldName ) {
			if (!fldName) {
				fldName = 'cb';
			}
			var f = document.adminForm;
			var c = f.toggle.checked;
			var n2 = 0;
			for (i=0; i < n; i++) {
				cb = eval( 'f.' + fldName + '' + i );
				if (cb) {
					cb.checked = c;
					n2++;
				}
			}
			if (c) {
				document.adminForm.boxchecked.value = n2;
			} else {
				document.adminForm.boxchecked.value = 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['level_id_'+i] != null){
					old_filters[i] = form['level_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['level_id_'+i] != null && form['level_id_'+i].value != old_filters[i]){
					j = i;
				}
				if(i > j){
					if(form['level_id_'+i] != null){
						form['level_id_'+i].value = 0;	
					}
				}
			}
		}
		//-->
		</script>	
		
		<?php 
        //FLMS multicat
        $multicat = array();
        $i = 0;
        foreach ($lists as $key => $item) {
            if (substr($key, 0, 6) == 'level_') {
                $multicat[] = $lists['level_' . $i];
                $i++;
            }
        }
        $toolbar = JLMS_quiz_admin_html_class::GetQuestEdit_Toolbar(0, false, true);
        $h = $row->c_id ? _JLMS_QUIZ_QUEST_EDIT_TITLE : _JLMS_QUIZ_QUEST_NEW_TITLE;
        JLMS_quiz_admin_html_class::showQuizHead($course_id, $option, $h, true, $toolbar);
        ?>
		
		<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">
					<tr>
						<td width="20%" valign="middle" ><?php 
        echo _JLMS_QUIZ_QUEST_QUIZ;
        ?>
</td><td><?php 
        echo $lists['quiz'];
        ?>
</td>
					</tr>
					
					<tr>
						<td  valign="middle" >
							<?php 
        echo _JLMS_QUIZ_TBL_QUEST_PUBLISH;
        ?>
:
						</td>
						<td>
							<?php 
        echo $lists['published'];
        ?>
						</td>
					</tr>
						
					<tr>
						<td colspan="2" class="contentheading">
						<?php 
        echo _JLMS_QUIZ_SELECT_QUEST_FROM_POOL;
        ?>
						</td>
					</tr>
				</table>
				<table width="100%" cellpadding="0" cellspacing="0" border="0">
					<tr>
						<td>
							<?php 
        $link_page = "index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=quizzes&amp;id={$course_id}&amp;page=add_quest&amp;c_type=21";
        $link_page .= $lists['qtype_id'] ? "&amp;qtype_id=" . $lists['qtype_id'] : '';
        $i = 0;
        $data = get_object_vars($lists['data']);
        foreach ($data as $key => $value) {
            if (substr($key, 0, 6) == 'level_' && $value) {
                $link_page .= "&amp;level_id_" . $i . "=" . $value;
                $i++;
            }
        }
        echo _JLMS_PN_DISPLAY_NUM . $pageNav->getLimitBox($link_page) . $pageNav->getPagesCounter();
        echo '<br />';
        echo $lists['qtype'];
        ?>
		
						</td>	
						<td align="right">						
							<table border="0">
							<?php 
        for ($i = 0; $i < count($multicat); $i++) {
            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['level_' . $i] . "";
            JLMS_TMPL::CloseTS();
        }
        ?>
							</table>
						</td>
					</tr>
					<tr>
						<td colspan="2">							
						
							<table width="100%" cellpadding="0" cellspacing="0" border="0">
									<tr>
										<td width="20" class="sectiontableheader" align="center">#</td>
										<td width="20" class="sectiontableheader" align="center"><input type="checkbox" name="toggle" value="" onclick="checkAllQ(<?php 
        echo count($rows);
        ?>
);" /></td>
										<td class="sectiontableheader"><?php 
        echo _JLMS_QUIZ_TBL_QUEST_TEXT;
        ?>
</td>
								<?php 
        if (isset($lists['filtered_quiz']) && $lists['filtered_quiz']) {
            ?>
										<td class="sectiontableheader" width="1%"><?php 
            echo _JLMS_QUIZ_TBL_QUEST_PUBLISH;
            ?>
</td>
										<td class="sectiontableheader" colspan="2" width="1%"><?php 
            echo _JLMS_QUIZ_TBL_QUEST_REORDER;
            ?>
</td>
										<td class="sectiontableheader" width="1%"><?php 
            echo 'Order';
            ?>
</td>
										<td class="sectiontableheader" width="1%"><a href="javascript:submitbutton_allorder(<?php 
            echo count($rows) - 1;
            ?>
)"><img width="16" height="16" border="0" alt="Save Order" src="<?php 
            echo $JLMS_CONFIG->get('live_site');
            ?>
/components/com_joomla_lms/lms_images/filesave.png"/></a></td>
								<?php 
        }
        ?>
										<td class="sectiontableheader"><?php 
        echo _JLMS_QUIZ_TBL_QUEST_TYPE;
        ?>
</td>
										<td class="sectiontableheader"><?php 
        echo _JLMS_QUIZ_TBL_Q_CAT;
        ?>
</td>
										<td class="sectiontableheader" width="20">ID</td>
									</tr>
								<?php 
        $k = 1;
        for ($i = 0, $n = count($rows); $i < $n; $i++) {
            $row = $rows[$i];
            $quiz_task = 'setup_quest';
            $img_published = $row->published ? 'btn_accept.png' : 'btn_cancel.png';
            $task_published = $row->published ? 'unpublish_quest' : 'publish_quest';
            $alt_published = $row->published ? _JLMS_STATUS_PUB : _JLMS_STATUS_UNPUB;
            $state = $row->published ? 0 : 1;
            $checked = '<input type="checkbox" id="cb' . $i . '" name="cid[]" value="' . $row->c_id . '" onclick="jlms_jq_isChecked(this.checked);" />';
            /*mosHTML::idBox( $i, $row->c_id);*/
            ?>
									<tr class="<?php 
            echo "sectiontableentry{$k}";
            ?>
">
										<td align="center"><?php 
            echo $pageNav->limitstart + $i + 1;
            ?>
</td>
										<td><?php 
            echo $checked;
            ?>
</td>
										<td align="left">
											<?php 
            mosMakeHtmlSafe($row->c_question);
            ?>
											<?php 
            //											$link = 'index.php?option='.$option.'&task=quizzes&page=editA_quest_gqp&c_id='.$row->c_id; //not use
            if (isset($row->right_answer) && $row->right_answer) {
                if ($row->c_question) {
                    $quest_desc = $row->c_question . '<br />';
                }
                $quest_desc .= '<span class="tip-title-inner">' . _JLMS_QUIZ_CORRECT_ANSWER . '</span> ' . $row->right_answer;
            } else {
                $quest_desc = $row->c_question;
            }
            //$quest_desc = isset($row->right_answer) && $row->right_answer ? (_JLMS_QUIZ_CORRECT_ANSWER . ' ' . $row->right_answer) : $row->c_question;
            $link = '#';
            echo JLMS_toolTip(substr(strip_tags($row->c_question), 0, 70), $quest_desc, '', $link);
            ?>
										</td>
								<?php 
            if (isset($lists['filtered_quiz']) && $lists['filtered_quiz']) {
                ?>
										<td valign="middle" align="center"><?php 
                echo JLMS_quiz_admin_html_class::QuizPublishIcon($row->c_id, $id, $state, $task_published, $alt_published, $img_published, $option);
                ?>
</td>
										<td valign="middle" align="center"><?php 
                echo JLMS_orderUpIcon($i, $row->c_id, true, 'quest_orderup');
                ?>
</td>
										<td valign="middle" align="center"><?php 
                echo JLMS_orderDownIcon($i, $n, $row->c_id, true, 'quest_orderdown');
                ?>
</td>
										<td colspan="2">
											<input type="text" name="order[]" size="5" value="<?php 
                echo $row->ordering;
                ?>
" class="inputbox" style="text-align: center" />
										</td>
								<?php 
            }
            ?>
										<td align="left">
											<?php 
            echo $row->qtype_full;
            ?>
										</td>
										<td align="left">
											<?php 
            echo $row->c_category ? $row->c_category : '&nbsp;';
            ?>
										</td>
										<td><?php 
            echo $row->c_id;
            ?>
</td>
									</tr>
									<?php 
            $k = 3 - $k;
        }
        ?>
								</table>
								<table width="100%">
									<tr>
										<td align="center"><div align="center">
										<?php 
        echo $pageNav->writePagesLinks($link_page);
        ?>
 
										</div>
										</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="quizzes" />
				<input type="hidden" name="id" value="<?php 
        echo $course_id;
        ?>
" />
				<input type="hidden" name="page" value="editA_quest_gqp" />
				<input type="hidden" name="c_type" value="<?php 
        echo $q_om_type;
        ?>
" />
				<input type="hidden" name="boxchecked" value="0" />
		</form>
		<?php 
        JLMS_quiz_admin_html_class::showQuizFooter();
        ?>
		<?php 
    }
コード例 #9
0
    function showCourseDocuments($id, $option, &$rows, &$lists, &$possibilities)
    {
        $JLMS_CONFIG =& JLMSFactory::getConfig();
        $Itemid = $JLMS_CONFIG->get('Itemid');
        $db =& JFactory::getDbo();
        $user = JLMSFactory::getUser();
        $JLMS_ACL =& JLMSFactory::getACL();
        $lms_img_path = $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('lms_path_to_images', 'components/com_joomla_lms/lms_images');
        $rows_c = $lists['collapsed_folders'];
        ?>
<script language="javascript" type="text/javascript">
<!--//--><![CDATA[//><!--
function submitbutton(pressbutton) {
	var form = document.adminForm;
	if ((pressbutton == 'doc_delete') && (form.boxchecked.value == '0')) {
		alert( "<?php 
        echo _JLMS_ALERT_SELECT_ITEM;
        ?>
" );
	} else if((pressbutton == 'doc_delete')){
		if(confirm('<?php 
        echo _JLMS_OUTDOCS_JS_CONFIRM_DELETE;
        ?>
')){
			form.task.value = pressbutton;
			form.submit();
		}	
	} else if ((pressbutton == 'edit_doc') && (form.boxchecked.value == '0')) {
		alert( "<?php 
        echo _JLMS_ALERT_SELECT_ITEM;
        ?>
" );
	} else {
		form.task.value = pressbutton;
		form.submit();
	}
}
function submitbutton_change(pressbutton, state) {
	var form = document.adminForm;
	if (pressbutton == 'change_doc'){
		if (form.boxchecked.value == '0') {
			alert( "<?php 
        echo _JLMS_ALERT_SELECT_ITEM;
        ?>
" );
		} else {
			form.task.value = pressbutton;
			form.state.value = state;
			form.submit();
		}
	}
}
function submitbutton_change2(pressbutton, state, cid_id) {
	var form = document.adminForm;
	if (pressbutton == 'change_doc'){
		form.task.value = pressbutton;
		form.state.value = state;
		form.cid2.value = cid_id;
		form.submit();
	}
}
function submitbutton_order(pressbutton, item_id) {
	var form = document.adminForm;
	if ((pressbutton == 'doc_orderup') || (pressbutton == 'doc_orderdown')){
		if (item_id) {
		form.task.value = pressbutton;
		form.row_id.value = item_id;
		form.submit();
		}
	}
}
function cf_saveorder(){
	var form = document.adminForm;	
	form.task.value = 'doc_saveorder';
	form.submit();
}

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

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