Example #1
0
 function &PrepareDescription(&$pr_desc)
 {
     $description = strip_tags($pr_desc);
     if (strlen($description) > 120) {
         $description = jlms_string_substr($description, 0, 120) . "...";
     }
     //$description = JLMS_txt2overlib($description);
     return $description;
 }
    function JQ_showQuestsList(&$rows, &$lists, &$pageNav, $option, $page, $id, $is_pool = false, $gqp = false, $levels = array())
    {
        $JLMS_CONFIG =& JLMSFactory::getConfig();
        $Itemid = $JLMS_CONFIG->get('Itemid');
        $zzz = '<form action="' . $JLMS_CONFIG->get('live_site') . "/index.php?option={$option}&amp;Itemid={$Itemid}" . '" method="post" name="adminFormQ">';
        $toolbar = array();
        if (!$gqp) {
            $toolbar[] = array('btn_type' => 'csv_import', 'btn_txt' => _JLMS_QUIZ_TBL_QUEST_IMPORT_QUEST, 'btn_js' => "javascript:submitbutton('import_quest');");
            $toolbar[] = array('btn_type' => 'csv_export', 'btn_txt' => _JLMS_QUIZ_TBL_QUEST_EXPORT_QUEST, 'btn_js' => "javascript:submitbutton('export_quest');");
            $toolbar[] = array('btn_type' => 'spacer', 'btn_txt' => 'spacer', 'btn_js' => 'spacer');
            $toolbar[] = array('btn_type' => 'new', 'btn_txt' => _JLMS_QUIZ_NEW_QUEST_BTN, 'btn_js' => "javascript:submitbutton('add_quest');");
        } else {
            $toolbar[] = array('btn_type' => 'category', 'btn_txt' => _JLMS_QUIZ_TBL_CATEGORY_GQP, 'btn_js' => "javascript:submitbutton('category_gqp');");
            $toolbar[] = array('btn_type' => 'spacer', 'btn_txt' => 'spacer', 'btn_js' => 'spacer');
            $toolbar[] = array('btn_type' => 'csv_import', 'btn_txt' => _JLMS_QUIZ_TBL_QUEST_IMPORT_QUEST, 'btn_js' => "javascript:submitbutton('import_quest_gqp');");
            $toolbar[] = array('btn_type' => 'csv_export', 'btn_txt' => _JLMS_QUIZ_TBL_QUEST_EXPORT_QUEST, 'btn_js' => "javascript:submitbutton('export_quest_gqp');");
            $toolbar[] = array('btn_type' => 'spacer', 'btn_txt' => 'spacer', 'btn_js' => 'spacer');
            $toolbar[] = array('btn_type' => 'bar', 'btn_txt' => _JLMS_QUIZ_VIEW_STATS_GQP, 'btn_js' => "javascript:submitbutton('quiz_bars_gqp');");
            $toolbar[] = array('btn_type' => 'spacer', 'btn_txt' => 'spacer', 'btn_js' => 'spacer');
            $toolbar[] = array('btn_type' => 'new', 'btn_txt' => _JLMS_QUIZ_NEW_QUEST_BTN, 'btn_js' => "javascript:submitbutton('add_quest_gqp');");
        }
        $add_option = $lists['new_qtype'];
        if ($gqp) {
            $title = _JLMS_GLOBAL_QUEST_POOL;
            if ($JLMS_CONFIG->get('is_trial', false) && $JLMS_CONFIG->get('trial_gqp_heading_text', '')) {
                $title .= $JLMS_CONFIG->get('trial_gqp_heading_text', '');
            }
        } elseif ($is_pool) {
            $title = _JLMS_QUIZ_QUEST_POOL;
        } else {
            $title = _JLMS_QUIZ_QUESTLIST_TITLE;
        }
        if ($gqp && $JLMS_CONFIG->get('is_trial', false) && $JLMS_CONFIG->get('trial_gqp_page_text', '')) {
            echo '<div class="joomlalms_sys_message">' . $JLMS_CONFIG->get('trial_gqp_page_text', '') . '</div>';
        }
        JLMS_quiz_admin_html_class::showQuizHead2($id, $option, $title, true, $toolbar, $add_option, $zzz, $gqp);
        //FLMS multicat
        $multicat = array();
        if ($gqp) {
            $multicat = array();
            $i = 0;
            foreach ($lists as $key => $item) {
                if (substr($key, 0, 7) == 'filter_') {
                    $multicat[] = $lists['filter_' . $i];
                    $i++;
                }
            }
        }
        ?>
		<script language="javascript" type="text/javascript">
		<!--
		function checkAllQ( n, fldName ) {
			if (!fldName) {
				fldName = 'cb';
			}
			var f = document.adminFormQ;
			var c = f.toggle.checked;
			var n2 = 0;
			for (i=0; i < n; i++) {
				cb = eval( 'f.' + fldName + '' + i );
				if (cb) {
					cb.checked = c;
					n2++;
				}
			}
			if (c) {
				document.adminFormQ.boxchecked.value = n2;
			} else {
				document.adminFormQ.boxchecked.value = 0;
			}
		}
		function submitbutton(pressbutton) {
			var form = document.adminFormQ;
			if ((pressbutton == 'add_quest') || (pressbutton == 'add_quest_gqp')) {
				if (form.new_qtype_id.value == '0') {
					alert('<?php 
        echo html_entity_decode(_JLMS_QUIZ_SELECT_TYPE_TO_CREATE);
        ?>
');
				} else {
					form.page.value = pressbutton;
					form.submit();
				}
			} else if ( ((pressbutton == 'edit_quest' || pressbutton == 'edit_quest_gqp') || (pressbutton == 'del_quest' || pressbutton == 'del_quest_gqp') || (pressbutton == 'copy_quest_sel' || pressbutton == 'copy_quest_sel_gqp') || (pressbutton == 'move_quest_sel' || pressbutton == 'move_quest_sel_gqp') ) && (form.boxchecked.value == "0")) {
				alert('<?php 
        echo _JLMS_ALERT_SELECT_ITEM;
        ?>
');
			} else if( (pressbutton == 'publish_quest' || pressbutton == 'unpublish_quest' || pressbutton == 'publish_quest_gqp' || pressbutton == 'unpublish_quest_gqp') && form.boxchecked.value == 0){
				alert('<?php 
        echo _JLMS_ALERT_SELECT_ITEM;
        ?>
'); 
			} else if( (pressbutton == 'export_quest' || pressbutton == 'export_quest_gqp') && form.boxchecked.value == 0 && !confirm('<?php 
        echo _JLMS_QUIZ_EXPORT_ALL_QUESTS_CONFIRM;
        ?>
')){
				alert('<?php 
        echo _JLMS_ALERT_SELECT_ITEM;
        ?>
'); 
			} else {
				form.page.value = pressbutton;
				form.submit();
			}
		}
		function submitbutton_order(pressbutton, item_id) {
			var form = document.adminFormQ;
			if ((pressbutton == 'quest_orderup') || (pressbutton == 'quest_orderdown')){
				if (item_id) {
				form.page.value = pressbutton;
				form.row_id.value = item_id;
				form.submit();
				}
			}
		}
		function submitbutton_allorder(n) {
			var form = document.adminFormQ;
			for ( var j = 0; j <= n; j++ ) {
				box = eval( "document.adminFormQ.cb" + j );
				if ( box ) {
					if ( box.checked == false ) {
						box.checked = true;
					}
				}
			}
			form.page.value = 'saveorederall';
			form.submit();
		}
		function submit_preview() {
			var quest_id = 0;
			var form = document.adminFormQ;
			if (form.boxchecked.value == "0") {
				alert('<?php 
        echo _JLMS_ALERT_SELECT_ITEM;
        ?>
');
			} else {
				var selItem = document.adminFormQ['cid[]'];
				if (selItem) {
					if (selItem.length) { var i;
						for (i = 0; i<selItem.length; i++) {
							if (selItem[i].checked) {
								if (selItem[i].value > 0) { quest_id = selItem[i].value; break; }
							}
						}
					} else if (selItem.checked) { quest_id = selItem.value; }
				}
				if (quest_id != 0 && quest_id != '0'){
					var url = '<?php 
        echo $JLMS_CONFIG->get('live_site') . "/index.php?option=com_joomla_lms&Itemid={$Itemid}&task=quizzes&id={$id}&page=view_preview&c_id='+quest_id+'";
        ?>
';
					window.open(url);
				}
			}
		}
		function jlms_jq_isChecked(isitchecked){
			if (isitchecked == true){
				document.adminFormQ.boxchecked.value++;
			}
			else {
				document.adminFormQ.boxchecked.value = document.adminFormQ.boxchecked.value - 1;
			}
		} 
		
		var old_filters = new Array();
		function read_filter(){
			var form = document.adminFormQ;
			var count_levels = '<?php 
        echo count($levels);
        ?>
';
			for(var i=0;i<parseInt(count_levels);i++){
				if(form['filter_id_'+i] != null){
					old_filters[i] = form['filter_id_'+i].value;
				}
			}
		}
		function write_filter(){
			var form = document.adminFormQ;
			var count_levels = '<?php 
        echo count($levels);
        ?>
';
			var j;
			for(var i=0;i<parseInt(count_levels);i++){
				if(form['filter_id_'+i+''] != null && form['filter_id_'+i+''].value != old_filters[i]){
					j = i;
				}
				if(i > j){
					if(form['filter_id_'+i] != null){
						form['filter_id_'+i].value = 0;	
					}
				}
			}
		}
		//-->
		</script>
		<table width="100%" cellpadding="0" cellspacing="0" border="0" class="jlms_table_no_borders">
			<tr>
				<td>
				<table width="100%" cellpadding="0" cellspacing="0" border="0" class="jlms_table_no_borders">
					<tr>
						<td align="left" style="text-align:left;">
						<?php 
        if (!$gqp) {
            echo $lists['quiz'] . $lists['qtype'] . $lists['qcats'];
        } else {
            echo $lists['qtype'];
        }
        ?>
							<br />
							<input class="inputbox" type="text" name="quest_filter" value="<?php 
        echo $lists['filt_quest'];
        ?>
" /><input type="submit" name="Filter" value="<?php 
        echo str_replace(':', '', _JLMS_FILTER);
        ?>
" /> 
							
							<!--</div>-->
						</td>
						<?php 
        if (count($multicat)) {
            ?>
						<td align="right" valign="bottom">
							<table border="0" class="jlms_table_no_borders">
							<?php 
            for ($i = 0; $i < count($multicat); $i++) {
                $num = $i + 1;
                ?>
								<tr>
									<td align="right" style="text-align:right;" width="20%">
										<?php 
                echo isset($levels[$i]->cat_name) && $levels[$i]->cat_name != '' ? $levels[$i]->cat_name : '';
                //'Level #'.$num;
                ?>
									</td>
									<td align="left" style="text-align:left;" width="80%">
										<?php 
                $m_output = $lists['filter_' . $i];
                $m_output = str_replace('<option value="0" selected="selected"></option>', '<option value="0" selected="selected">&nbsp;</option>', $m_output);
                $m_output = str_replace('<option value="0"></option>', '<option value="0">&nbsp;</option>', $m_output);
                echo $m_output;
                ?>
									</td>
								</tr>
								<?php 
            }
            ?>
							</table>
						</td>
						<?php 
        }
        ?>
	
					</tr>
				</table>
				</td>
			</tr>
			<tr>
				<td width="100%">
				<?php 
        $quests_colspan = 6;
        ?>
 
				<table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php 
        echo JLMSCSS::_('jlmslist');
        ?>
" style="padding-top:0px; margin-top:0px; margin-bottom:0px; padding-bottom:0px;">
					<tr>
						<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 width="20" class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" align="center">#</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
						<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 width="20" class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" align="center"><input type="checkbox" name="toggle" value="" onclick="checkAllQ(<?php 
        echo count($rows);
        ?>
);" /></<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
						<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
"><?php 
        echo _JLMS_QUIZ_TBL_QUEST_TEXT;
        ?>
</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
						<?php 
        if ($gqp) {
            $quests_colspan = $quests_colspan + 1;
            ?>
							<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" width="1%"><?php 
            echo _JLMS_QUIZ_TBL_QUEST_PUBLISH;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
						<?php 
        }
        ?>
				<?php 
        if (isset($lists['filtered_quiz']) && $lists['filtered_quiz'] && !$gqp) {
            $quests_colspan = $quests_colspan + 5;
            ?>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" width="1%"><?php 
            echo _JLMS_QUIZ_TBL_QUEST_PUBLISH;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" colspan="2" width="1%"><?php 
            echo _JLMS_REORDER;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" width="1%"><?php 
            echo _JLMS_ORDER;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" width="1%"><a class="jlms_img_link" href="javascript:submitbutton_allorder(<?php 
            echo count($rows) - 1;
            ?>
)"><img width="16" height="16" border="0" title="<?php 
            echo _JLMS_SAVEORDER;
            ?>
" alt="<?php 
            echo _JLMS_SAVEORDER;
            ?>
" src="<?php 
            echo $JLMS_CONFIG->get('live_site');
            ?>
/components/com_joomla_lms/lms_images/filesave.png"/></a></<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
				<?php 
        }
        ?>
						<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
"><?php 
        echo _JLMS_QUIZ_TBL_QUEST_TYPE;
        ?>
</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
					<?php 
        if (!$gqp) {
            $quests_colspan = $quests_colspan + 1;
            ?>
	
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
"><?php 
            echo _JLMS_QUIZ_TBL_QUEST_QUIZ;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<?php 
        }
        ?>
	
						<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
"><?php 
        echo _JLMS_QUIZ_TBL_Q_CAT;
        ?>
</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
						<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" width="20">ID</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
					</tr>
				<?php 
        $k = 1;
        for ($i = 0, $n = count($rows); $i < $n; $i++) {
            $row = $rows[$i];
            $quiz_task = 'setup_quest';
            $img_published = $row->published ? 'btn_accept.png' : 'btn_cancel.png';
            $task_published = $row->published ? 'unpublish_quest' : 'publish_quest';
            $alt_published = $row->published ? _JLMS_STATUS_PUB : _JLMS_STATUS_UNPUB;
            $state = $row->published ? 0 : 1;
            if (!$gqp) {
                $link = "index.php?option=" . $option . "&amp;Itemid={$Itemid}&amp;task=quizzes&amp;id={$id}&amp;page=editA_quest&amp;c_id=" . $row->c_id;
            } else {
                $link = "index.php?option=" . $option . "&amp;Itemid={$Itemid}&amp;task=quizzes&amp;page=editA_quest_gqp&amp;c_id=" . $row->c_id;
            }
            $checked = '<input type="checkbox" id="cb' . $i . '" name="cid[]" value="' . $row->c_id . '" onclick="jlms_jq_isChecked(this.checked);" />';
            ?>
					<tr class="<?php 
            echo JLMSCSS::_('sectiontableentry' . $k);
            ?>
">
						<td align="center"><?php 
            echo $pageNav->limitstart + $i + 1;
            ?>
</td>
						<td><?php 
            echo $checked;
            ?>
</td>
						<td align="left">
							<?php 
            mosMakeHtmlSafe($row->c_question);
            $quest_name = jlms_string_substr(strip_tags($row->c_question), 0, 70);
            $quest_desc = '';
            if ($row->c_question) {
                $quest_desc = $row->c_question;
            }
            if (isset($row->right_answer) && $row->right_answer) {
                $quest_desc .= '<br /><br /><span class="tip-title-inner">' . _JLMS_QUIZ_CORRECT_ANSWER . '</span> ' . $row->right_answer;
            }
            if (isset($row->c_type) && $row->c_type == 21 && isset($row->c_pool_gqp) && $row->c_pool_gqp) {
                $quest_desc = _JLMS_QUIZ_QUEST_POOL_GQP_SHORT . ' ID: ' . $row->c_pool_gqp . '<br />' . ($quest_desc ? '<br />' . $quest_desc : '');
            }
            echo JLMS_toolTip($quest_name, $quest_desc, '', sefRelToAbs($link), 1, 36, 'true', 'jlms_ttip');
            ?>
						</td>
						<?php 
            if (isset($lists['filtered_quiz']) && $lists['filtered_quiz'] && !$gqp) {
                ?>
							<td valign="middle" align="center"><?php 
                echo JLMS_quiz_admin_html_class::QuizPublishIcon($row->c_id, $id, $state, $task_published, $alt_published, $img_published, $option);
                ?>
</td>
							<td valign="middle" align="center"><?php 
                echo JLMS_orderUpIcon($i, $row->c_id, true, 'quest_orderup');
                ?>
</td>
							<td valign="middle" align="center"><?php 
                echo JLMS_orderDownIcon($i, $n, $row->c_id, true, 'quest_orderdown');
                ?>
</td>
							<td colspan="2">
								<input type="text" name="order[]" size="5" value="<?php 
                echo $row->ordering;
                ?>
" class="inputbox" style="text-align: center" />
							</td>
						<?php 
            }
            ?>

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

						<td align="left">
							<?php 
            echo $row->qtype_full;
            ?>
						</td>
						<?php 
            if (!$gqp) {
                ?>
	
							<td align="left">
							<?php 
                if ($row->c_quiz_id) {
                    echo $row->quiz_name;
                } else {
                    echo _JLMS_QUIZ_QUEST_POOL;
                }
                ?>
							</td>
						<?php 
            }
            ?>
	
						<td align="left">
							<?php 
            echo $row->c_category ? $row->c_category : '&nbsp;';
            ?>
						</td>
						<td><?php 
            echo $row->c_id;
            echo $row->c_pool_gqp ? '/' . $row->c_pool_gqp : '';
            ?>
</td>
					</tr>
					<?php 
            $k = 3 - $k;
        }
        ?>
					<tr>
						<td align="center" colspan="<?php 
        echo $quests_colspan;
        ?>
" class="<?php 
        echo JLMSCSS::_('jlmslist-footer_td');
        ?>
">
							<div align="center" style="white-space:nowrap">
							<?php 
        $link = "index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=quizzes&amp;id={$id}&amp;page={$page}";
        echo _JLMS_PN_DISPLAY_NUM . '&nbsp;' . $pageNav->getLimitBox($link) . '&nbsp;' . $pageNav->getPagesCounter();
        echo '<br />';
        echo $pageNav->writePagesLinks($link);
        ?>
 
							</div>
						</td>
					</tr>
				</table>
				</td>
			</tr>
<?php 
        if ($gqp) {
            $controls = array();
            $controls[] = array('href' => "javascript:submitbutton('publish_quest_gqp');", 'title' => _JLMS_QUIZ_TBL_QUEST_PUBLISH_QUEST, 'img' => 'buttons_22/btn_publish_22.png');
            $controls[] = array('href' => "javascript:submitbutton('unpublish_quest_gqp');", 'title' => _JLMS_QUIZ_TBL_QUEST_UNPUBLISH_QUEST, 'img' => 'buttons_22/btn_unpublish_22.png');
            $controls[] = array('href' => "spacer", 'title' => '', 'img' => '');
            $controls[] = array('href' => "javascript:submitbutton('edit_quest_gqp');", 'title' => _JLMS_QUIZ_EDIT_QUEST_BTN, 'img' => 'quiz/btn_edit.png');
            $controls[] = array('href' => "javascript:submitbutton('del_quest_gqp');", 'title' => _JLMS_QUIZ_DEL_QUEST_BTN, 'img' => 'quiz/btn_delete.png');
            $controls[] = array('href' => "javascript:submitbutton('copy_quest_sel_gqp');", 'title' => _JLMS_QUIZ_COPY_QUEST_BTN, 'img' => 'quiz/btn_copy.png');
            $controls[] = array('href' => "javascript:submitbutton('move_quest_sel_gqp');", 'title' => _JLMS_QUIZ_MOVE_QUEST_BTN, 'img' => 'quiz/btn_move.png');
            $controls[] = array('href' => "spacer", 'title' => '', 'img' => '');
            $controls[] = array('href' => "javascript:submit_preview();", 'title' => _JLMS_QUIZ_PREVIEW_QUEST_BTN, 'img' => 'quiz/btn_preview.png');
            JLMS_TMPL::ShowControlsFooter($controls, '', false, true);
        } else {
            $controls = array();
            $controls[] = array('href' => "javascript:submitbutton('publish_quest');", 'title' => _JLMS_QUIZ_TBL_QUEST_PUBLISH_QUEST, 'img' => 'buttons_22/btn_publish_22.png');
            $controls[] = array('href' => "javascript:submitbutton('unpublish_quest');", 'title' => _JLMS_QUIZ_TBL_QUEST_UNPUBLISH_QUEST, 'img' => 'buttons_22/btn_unpublish_22.png');
            $controls[] = array('href' => "spacer", 'title' => '', 'img' => '');
            $controls[] = array('href' => "javascript:submitbutton('edit_quest');", 'title' => _JLMS_QUIZ_EDIT_QUEST_BTN, 'img' => 'quiz/btn_edit.png');
            $controls[] = array('href' => "javascript:submitbutton('del_quest');", 'title' => _JLMS_QUIZ_DEL_QUEST_BTN, 'img' => 'quiz/btn_delete.png');
            $controls[] = array('href' => "javascript:submitbutton('copy_quest_sel');", 'title' => _JLMS_QUIZ_COPY_QUEST_BTN, 'img' => 'quiz/btn_copy.png');
            $controls[] = array('href' => "javascript:submitbutton('move_quest_sel');", 'title' => _JLMS_QUIZ_MOVE_QUEST_BTN, 'img' => 'quiz/btn_move.png');
            $controls[] = array('href' => "spacer", 'title' => '', 'img' => '');
            $controls[] = array('href' => "javascript:submit_preview();", 'title' => _JLMS_QUIZ_PREVIEW_QUEST_BTN, 'img' => 'quiz/btn_preview.png');
            JLMS_TMPL::ShowControlsFooter($controls, '', false, true);
        }
        ?>
		</table>
		<?php 
        JLMS_quiz_admin_html_class::showQuizFooter();
        ?>
		<input type="hidden" name="option" value="<?php 
        echo $option;
        ?>
" />
		<input type="hidden" name="page" value="<?php 
        echo $page;
        ?>
" />
		<input type="hidden" name="task" value="quizzes" />
		<input type="hidden" name="boxchecked" value="0" />
		<input type="hidden" name="id" value="<?php 
        echo $id;
        ?>
" />
		<input type="hidden" name="row_id" value="0" />
		</form>
	<?php 
        JLMS_quiz_admin_html_class::showQuizFooter();
        //closetwicely if opened using head2() function
    }
    function JLMS_sreportCertif($hits, $users, $courses, $pageNav, $lists, $levels, $filt_cat, $filt_group, $option, $is_full)
    {
        $JLMS_CONFIG =& JLMSFactory::getConfig();
        global $JLMS_DB;
        $Itemid = $JLMS_CONFIG->get('Itemid');
        //FLMS multicat
        $multicat = array();
        if ($JLMS_CONFIG->get('multicat_use', 0)) {
            $multicat = array();
            $i = 0;
            foreach ($lists as $key => $item) {
                if (substr($key, 0, 7) == 'filter_') {
                    $multicat[] = $lists['filter_' . $i];
                    $i++;
                }
            }
        }
        ?>
	
	<?php 
        JLMS_TMPL::OpenMT();
        if ($is_full) {
            $hparams = array('show_menu' => false);
        } else {
            $hparams = array('simple_menu' => true);
        }
        $toolbar = array();
        $page_heading = _JLMS_REPORTS_CONCLUSION;
        if ($JLMS_CONFIG->get('is_trial', false) && $JLMS_CONFIG->get('trial_reports_heading_text', '')) {
            $page_heading .= $JLMS_CONFIG->get('trial_reports_heading_text', '');
        }
        JLMS_TMPL::ShowHeader('tracking', $page_heading, $hparams, $toolbar);
        JLMS_TMPL::OpenTS();
        ?>
	<script language="javascript" type="text/javascript">
	<!--//--><![CDATA[//><!--
	var old_filters = new Array();
	function read_filter(){
		var form = document.adminForm;
		var count_levels = '<?php 
        echo count($levels);
        ?>
';
		for(var i=0;i<parseInt(count_levels);i++){
			if(form['filter_id_'+i] != null){
				old_filters[i] = form['filter_id_'+i].value;
			}
		}
	}
	function write_filter(){
		var form = document.adminForm;
		var count_levels = '<?php 
        echo count($levels);
        ?>
';
		var j;
		for(var i=0;i<parseInt(count_levels);i++){
			if(form['filter_id_'+i+''] != null && form['filter_id_'+i+''].value != old_filters[i]){
				j = i;
			}
			if(i > j){
				if(form['filter_id_'+i] != null){
					form['filter_id_'+i].value = 0;	
				}
			}
		}
	}
	function submitFormView(view){
		var form = document.adminForm;
		form.view.value = view;
		form.task.value='report_certif';
		form.submit();
	}
	
	//--><!]]>
	</script>
	<?php 
        $action_url = $is_full ? $JLMS_CONFIG->get('live_site') . "/index.php?tmpl=component&amp;option={$option}&amp;Itemid={$Itemid}" : sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}");
        ?>
			<form action="<?php 
        echo $action_url;
        ?>
" method="post" name="adminForm">
					<table width="100%" cellpadding="0" cellspacing="0" border="0" id="TheTable" class="jlms_table_no_borders">
						<?php 
        if (!$is_full) {
            ?>
						<tr>
							<td align="<?php 
            echo $is_full ? "left" : "right";
            ?>
">
								<table <?php 
            echo $is_full ? '' : 'width="30%"';
            ?>
 class="jlms_table_no_borders">
									<tr>
										<td valign="top" <?php 
            echo $is_full ? 'width="400"' : 'width="40%"';
            ?>
>
											<table width="100%" border="0" class="jlms_table_no_borders">
												<tr>
													<td <?php 
            echo $is_full ? 'width="100"' : 'width="20%"';
            ?>
 nowrap="nowrap">
														Report Type:
													</td>
													<td>
														<?php 
            echo JLMS_switchType($option);
            ?>
													</td>
												</tr>
											</table>		
										</td>
									</tr>
								</table>	
							</td>
						</tr>
						<?php 
        }
        ?>
						<tr>	
							<td align="left">
								<table <?php 
        echo $is_full ? '' : 'width="100%"';
        ?>
 class="jlms_table_no_borders">
									<tr>
										<td valign="top" <?php 
        echo $is_full ? 'width="400"' : 'width="40%"';
        ?>
>
											<table width="100%" border="0" class="jlms_table_no_borders">
												<?php 
        if ($is_full) {
            ?>
												<tr>
													<td <?php 
            echo $is_full ? 'width="100"' : 'width="20%"';
            ?>
 nowrap="nowrap">
														Report Type:
													</td>
													<td>
														<?php 
            echo JLMS_switchType($option);
            ?>
													</td>
												</tr>
												<?php 
        }
        ?>
												<tr>
													<td <?php 
        echo $is_full ? 'width="100"' : 'width="20%"';
        ?>
 nowrap="nowrap">
														<?php 
        if ($JLMS_CONFIG->get('multicat_use', 0)) {
            echo isset($levels[0]->cat_name) && $levels[0]->cat_name != '' ? $levels[0]->cat_name : _JLMS_COURSES_COURSES_GROUPS;
        } else {
            echo _JLMS_COURSES_COURSES_GROUPS;
        }
        ?>
													</td>
													<td>
														<?php 
        if ($JLMS_CONFIG->get('multicat_use', 0)) {
            echo $lists['filter_0'];
        } else {
            echo $lists['jlms_course_cats'];
        }
        ?>
													</td>
												</tr>
												<?php 
        if (count($multicat)) {
            for ($i = 0; $i < count($multicat); $i++) {
                if ($i > 0) {
                    ?>
															<tr>
																<td <?php 
                    echo $is_full ? 'width="100"' : 'width="20%"';
                    ?>
 nowrap="nowrap">
																	<?php 
                    echo isset($levels[$i]->cat_name) && $levels[$i]->cat_name != '' ? $levels[$i]->cat_name : _JLMS_COURSES_COURSES_GROUPS;
                    ?>
																</td>
																<td>
																	<?php 
                    echo $lists['filter_' . $i];
                    ?>
																</td>
															</tr>
															<?php 
                }
            }
        }
        ?>
											</table>
										</td>
										
										<td valign="top" <?php 
        echo $is_full ? 'width="400"' : 'width="40%"';
        ?>
>
										<?php 
        if ($JLMS_CONFIG->get('use_global_groups', 1)) {
            ?>
											<table width="100%" border="0" cellpadding="0" cellspacing="0" class="jlms_table_no_borders">
												<?php 
            if ($is_full) {
                ?>
												<tr>
													<td colspan="2">
														&nbsp;
													</td>
												</tr>
												<?php 
            }
            ?>
												<tr>
													<td style="padding-left: 5px;" <?php 
            echo $is_full ? 'width="100"' : 'width="20%"';
            ?>
 nowrap="nowrap">
														<?php 
            echo _JLMS_USER_GROUP_INFO;
            ?>
													</td>
													<td>
														<?php 
            echo $lists['filter'];
            ?>
													</td>
												</tr>
											</table>
										<?php 
        }
        ?>
										</td>
										
										<?php 
        if (!$is_full) {
            ?>
										<td style="padding-left:15px;" align="right" class="jlms_table_no_borders">
											<?php 
            $link = $JLMS_CONFIG->get('live_site') . "/index.php?tmpl=component&amp;option=" . $option . "&amp;Itemid={$Itemid}&amp;task=report_certif&amp;is_full=1";
            if ($filt_group) {
                $link .= "&amp;filt_group=" . $filt_group;
            }
            ?>
										
											<a href="<?php 
            echo $link;
            ?>
" target="_blank" title="<?php 
            echo _JLMS_FULL_VIEW_BUTTON;
            ?>
"><?php 
            echo _JLMS_FULL_VIEW_BUTTON;
            ?>
]</a>
										</td>
										<?php 
        }
        ?>
									</tr>
								</table>		
							</td>
						</tr>
					</table>
					<?php 
        if (!$is_full) {
            $domready = '
							$(\'pre_div\').setStyles({\'display\': \'none\'});
							$(\'vw_div\').setStyles({\'display\': \'block\'});
							var cur_height = $(\'vw_div\').getStyle(\'height\').toInt() + 18;
							$(\'vw_div\').setStyles({\'width\': $(\'TheTable\').offsetWidth+\'px\', \'height\': cur_height+\'px\'});
							';
            $JLMS_CONFIG->set('web20_domready_code', $JLMS_CONFIG->get('web20_domready_code', '') . $domready);
            ?>
					<div id="pre_div" style="display: block; width: 100%; text-align: center;">
						<br />
						Please wait. <?php 
            echo _JLMS_REPORTS_CONCLUSION;
            ?>
 is loading.<br /> If this message stays for over 1 minute, please click <a target="_blank" href="<?php 
            echo $link;
            ?>
">&lt;here&gt;</a> to open <?php 
            echo _JLMS_REPORTS_CONCLUSION;
            ?>
 in new window.
					</div>
					<div id="vw_div" style="overflow: auto; width: 200px; height: auto; display: none;">
					<?php 
        }
        ?>
					<table width="100%" cellpadding="<?php 
        echo $is_full ? '4' : '0';
        ?>
" cellspacing="0" border="0" class="<?php 
        echo JLMSCSS::_('jlmslist', 'jlms_report_fullview_table');
        ?>
" style="margin-bottom: 0px; padding-bottom:0px;">
					<?php 
        $courses_str = implode(',', $courses);
        $users_str = implode(',', $users);
        $JLMS_DB->setQuery('SELECT course_name FROM #__lms_courses WHERE id IN(' . $courses_str . ') ORDER BY course_name');
        $crs_name = $JLMS_DB->loadResultArray();
        $JLMS_DB->setQuery('SELECT * FROM #__lms_courses WHERE id IN(' . $courses_str . ') ORDER BY course_name');
        $crs_options = $JLMS_DB->loadObjectList();
        $cut_for = $JLMS_CONFIG->get('cutoff_reports_coursename', 0);
        echo '<tr>';
        echo '<' . JLMSCSS::tableheadertag() . ' class="' . JLMSCSS::_('sectiontableheader') . '" style="text-align:center; white-space:nowrap">' . _JLMS_OU_USER . '</' . JLMSCSS::tableheadertag() . '>';
        foreach ($crs_name as $key => $c_name) {
            if (!$is_full) {
                if ($cut_for) {
                    if (strlen($c_name) > $cut_for) {
                        $c_name = jlms_string_substr($c_name, 0, $cut_for) . "...";
                    }
                }
            }
            $view_is_course = 1;
            if ($JLMS_CONFIG->get('flms_integration', 1)) {
                $params = new JLMSParameters($crs_options[$key]->params);
                $view_is_course = $params->get('show_in_report', 1);
            }
            if ($view_is_course) {
                echo '<' . JLMSCSS::tableheadertag() . ' class="' . JLMSCSS::_('sectiontableheader') . '" style="text-align:center;">' . $c_name . '</' . JLMSCSS::tableheadertag() . '>';
            }
        }
        echo '</tr>';
        $zzz = 0;
        foreach ($users as $usr_id) {
            $JLMS_DB->setQuery('SELECT name FROM #__users WHERE id =' . $usr_id);
            $usrname = $JLMS_DB->LoadResult();
            $course_hits = 0;
            echo '<tr class="' . JLMSCSS::_('sectiontableentry' . ($zzz % 2 + 1)) . '">';
            $linka = sefRelToAbs(($is_full ? "index.php?tmpl=component&" : "index.php?") . 'option=' . $option . '&amp;Itemid=' . $Itemid . '&amp;task=report_grade&amp;filt_group=' . $filt_group . '&amp;filt_user='******'&amp;is_full=' . $is_full);
            echo '<td nowrap="nowrap"><a href="' . $linka . '">' . $usrname . '</a></td>';
            foreach ($courses as $key => $course_id) {
                $hit_num = _JLMS_NO_ALT_TITLE;
                for ($i = 0; $i < count($hits); $i++) {
                    if ($hits[$i]->c_id == $course_id && $hits[$i]->usr_id == $usr_id) {
                        $hit_num = _JLMS_YES_ALT_TITLE;
                        break;
                        // by DEN
                    }
                }
                $view_is_course = 1;
                if ($JLMS_CONFIG->get('flms_integration', 1)) {
                    $params = new JLMSParameters($crs_options[$key]->params);
                    $view_is_course = $params->get('show_in_report', 1);
                }
                if ($view_is_course) {
                    echo '<td align="center">' . $hit_num . '</td>';
                }
            }
            echo '</tr>';
            $zzz++;
        }
        ?>
					</table>
					<?php 
        if ($is_full) {
            $controls = array();
            $controls[] = array('href' => "javascript:submitFormView('csv');", 'title' => 'CSV', 'img' => 'csv');
            $controls[] = array('href' => "javascript:submitFormView('xls');", 'title' => 'XLS', 'img' => 'xls');
            JLMS_TMPL::ShowControlsFooterC($controls, '', false, false, _JLMS_EXPORT_TO . ':', true);
        } else {
            ?>
	
					</div>
					<table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php 
            echo JLMSCSS::_('jlmslist');
            ?>
" style="margin-top:0px; padding-top:0px; margin-bottom:0px;">
						<tr>
							<td align="center" style="text-align:center;" class="<?php 
            echo JLMSCSS::_('jlmslist-footer_td');
            ?>
">
								<div align="center" style="white-space:nowrap ">
								<?php 
            $link = "index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=report_certif&amp;filt_group={$filt_group}&amp;filt_cat={$filt_cat}";
            echo _JLMS_PN_DISPLAY_NUM . $pageNav->getLimitBox($link) . '&nbsp;' . $pageNav->getPagesCounter();
            echo '<br />';
            echo $pageNav->writePagesLinks($link);
            ?>
 
								</div>
							</td>
						</tr>
					</table>
						<?php 
            if ($JLMS_CONFIG->get('new_lms_features', 1)) {
                $controls = array();
                $controls[] = array('href' => "javascript:submitFormView('csv');", 'title' => 'CSV', 'img' => 'csv');
                $controls[] = array('href' => "javascript:submitFormView('xls');", 'title' => 'XLS', 'img' => 'xls');
                JLMS_TMPL::ShowControlsFooterC($controls, '', false, false, _JLMS_EXPORT_TO . ':');
            }
            ?>
					<?php 
        }
        ?>
					<input type="hidden" name="option" value="<?php 
        echo $option;
        ?>
" />
					<input type="hidden" name="Itemid" value="<?php 
        echo $Itemid;
        ?>
" />
					<input type="hidden" name="task" value="report_certif" />
					<input type="hidden" name="view" value="" />
					<input type="hidden" name="is_full" value="<?php 
        echo $is_full;
        ?>
" />
			</form>
			
			<?php 
        $action_url = $is_full ? $JLMS_CONFIG->get('live_site') . "/index.php?tmpl=component&amp;option={$option}&amp;Itemid={$Itemid}" : sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}");
        ?>

			<form action="<?php 
        echo $action_url;
        ?>
" method="post" name="adminFormCsv">
					<input type="hidden" name="option" value="<?php 
        echo $option;
        ?>
" />
					<input type="hidden" name="Itemid" value="<?php 
        echo $Itemid;
        ?>
" />
					<input type="hidden" name="task" value="report_certif" />
					<input type="hidden" name="is_full" value="1" />
					<input type="hidden" name="view" value="" />
			</form>
		<?php 
        JLMS_TMPL::CloseTS();
        JLMS_TMPL::CloseMT();
    }
Example #4
0
 function JQ_GetPanelData_LP($quiz_id, $course_id, $panel_data = array())
 {
     global $JLMS_DB;
     $JLMS_CONFIG =& JLMSFactory::getConfig();
     $lpath_id = intval(mosGetParam($_REQUEST, 'lpath_id', 0));
     $step_id = intval(mosGetParam($_REQUEST, 'step_id', 0));
     $result_id = intval(mosGetParam($_REQUEST, 'user_start_id', 0));
     $result_uniq = strval(mosGetParam($_REQUEST, 'lp_user_unique_id', ''));
     // return id of this step, of next step and return quiz contents...... (to create 'contentents' at the F.E.)
     $lpath_contents = JLMS_GetLPath_Data($lpath_id, $course_id);
     $panel_str = '';
     $tree_modes = array();
     $prev_tds = array();
     $colspan = 0;
     for ($i = 0, $n = count($lpath_contents); $i < $n; $i++) {
         $row_path = $lpath_contents[$i];
         $max_tree_width = $row_path->tree_max_width;
         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_';
                 }
                 if ($row_path->id == $step_id) {
                     $prev_tds[] = "<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' />";
                 }
                 $g++;
             }
             if ($row_path->id == $step_id) {
                 $pref = '';
                 if ($row_path->tree_mode == 2) {
                     $pref = 'empty_';
                 }
                 $prev_tds[] = "<img src='" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/treeview/" . $pref . "line.png' width='16' height='16' border='0' alt='line' />";
             }
             $max_tree_width = $max_tree_width - $g - 1;
         }
         if ($row_path->id == $step_id) {
             $colspan = $max_tree_width + 1;
         }
     }
     /*options Quiz*/
     $query = "SELECT * FROM #__lms_quiz_t_quiz WHERE c_id = '" . $quiz_id . "'";
     $JLMS_DB->setQuery($query);
     $option_quiz = $JLMS_DB->loadObject();
     /*Fix contents quiz in LPath (Max)*/
     if (isset($option_quiz->c_slide) && $option_quiz->c_slide) {
         /*Fix contents quiz in LPath (Max)*/
         $panel_str .= "\t" . '<prev_tds_count>' . count($prev_tds) . '</prev_tds_count>' . "\n";
         for ($i = 0, $n = count($prev_tds); $i < $n; $i++) {
             $panel_str .= "\t" . '<prev_td_' . ($i + 1) . '><![CDATA[' . $prev_tds[$i] . ']]></prev_td_' . ($i + 1) . '>' . "\n";
         }
         $panel_str .= "\t" . '<quest_colspan>' . $colspan . '</quest_colspan>' . "\n";
         if (empty($panel_data)) {
             $query = "SELECT * FROM #__lms_quiz_t_question WHERE c_quiz_id = '" . $quiz_id . "' ORDER BY ordering, c_id";
             $JLMS_DB->SetQuery($query);
             $panel_data = $JLMS_DB->LoadObjectList();
         }
         $panel_str .= "\t" . '<quest_count_c_gen>' . count($panel_data) . '</quest_count_c_gen>' . "\n";
         /*Fix contents quiz in LPath (Max)*/
     } else {
         $panel_str .= "\t" . '<prev_tds_count>0</prev_tds_count>' . "\n";
         $panel_str .= "\t" . '<quest_colspan>' . $colspan . '</quest_colspan>' . "\n";
         $panel_str .= "\t" . '<quest_count_c_gen>0</quest_count_c_gen>' . "\n";
     }
     /*Fix contents quiz in LPath (Max)*/
     if (!empty($panel_data)) {
         #$panel_str .= "\t" . '<questions>' . "\n";
         $i = 0;
         foreach ($panel_data as $panel_row) {
             $panel_str .= "\t" . '<question_' . ($i + 1) . '_id>' . $panel_row->c_id . '</question_' . ($i + 1) . '_id>' . "\n";
             $panel_str .= "\t" . '<question_' . ($i + 1) . '_points>' . $panel_row->c_point . '</question_' . ($i + 1) . '_points>' . "\n";
             $panel_str .= "\t" . '<question_' . ($i + 1) . '_text><![CDATA[' . jlms_string_substr(strip_tags($panel_row->c_question), 0, 50) . ']]></question_' . ($i + 1) . '_text>' . "\n";
             $i++;
         }
         #$panel_str .= "\t" . '</questions>' . "\n";
     }
     //$panel_str .= "\t" . '</quiz_panel_data_gen>' . "\n";
     return $panel_str;
     /*$panel_str = "\t" . '<quiz_panel_data><![CDATA[';
     	if (empty($panel_data)) {
     		$query = "SELECT * FROM #__lms_quiz_t_question WHERE c_quiz_id = '".$quiz_id."' ORDER BY ordering, c_id";
     		$JLMS_DB->SetQuery( $query );
     		$panel_data = $JLMS_DB->LoadObjectList();
     	}
     	$panel_str .= '<table id="jq_results_panel_table" width="100%" style="padding: 0px 20px 0px 20px" class="">';
     	$k = 1;
     	foreach ($panel_data as $panel_row) {
     		$panel_str .= '<tr class="sectiontableentry'.$k.'"><td><a href="javascript:void(0)" onclick="javascript:JQ_gotoQuestionOn('.$panel_row->c_id.')">'.substr(strip_tags($panel_row->c_question),0,50).'</a></td><td width="40px" align="center">'.$panel_row->c_point.'</td><td width="25px" align="center"><div id="quest_result_'.$panel_row->c_id.'">-</div></td></tr>';
     		$k = 3 - $k;
     	}
     	$panel_str .= '</table>]]></quiz_panel_data>' . "\n";
     	return $panel_str;*/
 }