示例#1
0
function JLMSEmailRoute($url)
{
    $JLMS_CONFIG =& JLMSFactory::getConfig();
    $url = JRoute::_($url, false);
    $pos = strpos($url, 'http');
    if ($pos !== 0) {
        $del_part = JURI::root(true);
        $live_site_part = $JLMS_CONFIG->get('live_site');
        if (strlen($del_part)) {
            $live_site_part = str_replace(JURI::root(true) . '/', '', JURI::root(false));
        }
        $url = $live_site_part . $url;
    }
    return $url;
}
示例#2
0
 function getJReviews_Form($listing_id, $tmpl_suffix = '')
 {
     $JLMS_CONFIG =& JLMSFactory::getConfig();
     # Populate $params array with module settings
     $JreParams['data']['extension'] = 'com_joomla_lms';
     $JreParams['data']['tmpl_suffix'] = $tmpl_suffix;
     $JreParams['data']['controller'] = 'everywhere';
     $JreParams['data']['action'] = 'index';
     $JreParams['data']['listing_id'] = $listing_id;
     $JreParams['data']['limit_special'] = $JLMS_CONFIG->getCfg('list_limit', 15);
     // Load dispatch class
     $Dispatcher = new S2Dispatcher('jreviews', true);
     $jreDetail = $Dispatcher->dispatch($JreParams);
     $form = false;
     if ($jreDetail) {
         $form = $jreDetail['output'];
     }
     return $form;
 }
示例#3
0
function Joomla_lmsParseRoute($segments)
{
    //Get the active menu item
    $component = JComponentHelper::getComponent('com_joomla_lms');
    $app = JFactory::getApplication();
    $menu = $app->getMenu();
    $item = $menu->getActive();
    $itemid = isset($item->id) ? $item->id : 0;
    if (!$itemid) {
        $JLMS_CONFIG =& JLMSFactory::getConfig();
        $itemid = $JLMS_CONFIG->get('Itemid');
    }
    $JLMSSefObject = getJLMSSefObject();
    $segments = str_replace(':', '-', $segments);
    $JLMSSefObject->setData($segments);
    $JLMSSefObject->calledFromRouterPHP();
    $vars = $JLMSSefObject->parseSefSegments();
    $vars['Itemid'] = $itemid;
    return $vars;
}
示例#4
0
function notifyCourseJoined($users_info)
{
    $_JLMS_PLUGINS =& JLMSFactory::getPlugins();
    $JLMS_CONFIG =& JLMSFactory::getConfig();
    //---->get bot info
    $dbo =& JFactory::GetDbo();
    if (!isset($_JLMS_PLUGINS->_nontify_bot_params['coursejoinnotify'])) {
        // load mambot params info
        $query = "SELECT params" . "\n FROM #__lms_plugins" . "\n WHERE element = 'coursejoinnotify'" . "\n AND folder = 'notifications'";
        $dbo->setQuery($query);
        $bot = $dbo->loadObject();
        // save query to class variable
        $_JLMS_PLUGINS->_notify_bot_params['coursejoinnotify'] = $bot;
    }
    // pull query data from class variable
    $bot = $_JLMS_PLUGINS->_notify_bot_params['coursejoinnotify'];
    $botParams = new jlmsPluginParameters($bot->params);
    $botParams->def('mail_template', 'Hello {user_name}, You have just been added to the course {course_name} attendees list.');
    $botParams->def('mail_subject', 'Course joining notification');
    //<----
    foreach ($users_info as $info_ids) {
        $query = "SELECT c.course_name AS course_name, u.name AS user_name, u.email AS mail_address FROM #__lms_courses AS c, #__users AS u" . "\n WHERE c.id={$info_ids->course_id} AND u.id={$info_ids->user_id}";
        $dbo->setQuery($query);
        $info_text = $dbo->loadObject();
        $mail_address = $dbo->getEscaped($info_text->mail_address);
        $mail_subject = $dbo->getEscaped($botParams->get('mail_subject'));
        $mail_text = $botParams->get('mail_template');
        $mail_text = str_replace('{user_name}', $info_text->user_name, $mail_text);
        $mail_text = str_replace('{course_name}', $info_text->course_name, $mail_text);
        $mail_text = str_replace('{site_URL}', $JLMS_CONFIG->get('live_site'), $mail_text);
        $mail_text = $dbo->getEscaped($mail_text);
        $query = "INSERT INTO #__lms_notifications (assigned, mail_address, mail_subject, mail_body, sent) VALUES" . "\n ({$info_ids->teacher_id}, '{$mail_address}', '{$mail_subject}', '{$mail_text}', 0)";
        $dbo->setQuery($query);
        $dbo->query();
    }
}
示例#5
0
function JLMS_showCEOPage($option)
{
    $db =& JFactory::getDbo();
    $user = JLMSFactory::getUser();
    $my_id = $user->get('id');
    $JLMS_CONFIG =& JLMSFactory::getConfig();
    $JLMS_SESSION =& JLMSFactory::getSession();
    $my_learners = array();
    $my_learners_1 = array();
    $my_learners_2 = array();
    $query = "SELECT a.*" . "\n, b.username, b.name, b.email" . "\n, d.course_name, d.id as course_id" . "\n FROM #__users as b, #__lms_user_parents as a" . "\n, #__lms_users_in_groups as c" . "\n, #__lms_courses as d" . "\n WHERE 1" . "\n AND a.user_id = b.id" . "\n AND a.user_id = c.user_id" . "\n AND c.course_id = d.id" . "\n AND a.parent_id = '" . $my_id . "'" . "\n ORDER BY b.username, b.name, d.course_name";
    $db->SetQuery($query);
    $my_learners_1 = $db->LoadObjectList();
    //	echo $query;
    //	echo '<pre>';
    //	print_r($my_learners_1);
    //	echo '</pre>';
    $query = "SELECT a.*" . "\n, b.username, b.name, b.email" . "\n, d.course_name, d.id as course_id" . "\n FROM #__users as b, #__lms_users_in_global_groups as a" . "\n, #__lms_users_in_groups as c" . "\n, #__lms_courses as d" . "\n, #__lms_user_assign_groups as e" . "\n WHERE 1" . "\n AND a.user_id = b.id" . "\n AND a.user_id = c.user_id" . "\n AND c.course_id = d.id" . "\n AND e.group_id = a.group_id" . "\n AND e.user_id = '" . $my_id . "'" . "\n ORDER BY b.username, b.name, d.course_name";
    $db->SetQuery($query);
    $my_learners_2 = $db->LoadObjectList();
    //	echo $query;
    //	echo '<pre>';
    //	print_r($my_learners_2);
    //	echo '</pre>';
    $exist_lrn_ids = array();
    $i = 0;
    foreach ($my_learners_2 as $my_lrn_2) {
        $my_learners[] = $my_lrn_2;
        $exist_lrn_ids[] = $my_lrn_2->user_id;
    }
    foreach ($my_learners_1 as $my_lrn_1) {
        if (!in_array($my_lrn_1->user_id, $exist_lrn_ids)) {
            $my_learners[] = $my_lrn_1;
            $exist_lrn_ids[] = $my_lrn_1->user_id;
        }
    }
    //	echo '<pre>';
    //	print_r($my_learners);
    //	echo '</pre>';
    $lists = array();
    JLMS_ShowHeading($JLMS_CONFIG->get('jlms_heading'), false);
    //get list of all courses IDs
    $courses_ids = array();
    $user_ids = array();
    foreach ($my_learners as $my_learner) {
        if ($my_learner->course_id) {
            if (!in_array($my_learner->course_id, $courses_ids)) {
                $courses_ids[] = $my_learner->course_id;
            }
        }
        if ($my_learner->user_id) {
            if (!in_array($my_learner->user_id, $user_ids)) {
                $user_ids[] = $my_learner->user_id;
            }
        }
    }
    if (count($courses_ids) && count($user_ids)) {
        //check if any user has completed any course
        $user_ids_str = implode(',', $user_ids);
        $query = "SELECT * FROM #__lms_certificate_users WHERE user_id IN ({$user_ids_str}) AND crt_option = 1";
        $db->SetQuery($query);
        $certificate_users = $db->LoadObjectList();
        if (count($certificate_users)) {
            //check if courses have certificates enabled and configured
            $courses_ids_str = implode(',', $courses_ids);
            $query = "SELECT * FROM #__lms_certificates WHERE course_id IN ({$courses_ids_str}) AND crtf_type = 1";
            $db->SetQuery($query);
            $courses_certificates = $db->LoadObjectList();
            //populate list of CEO users with course completion information
            for ($i = 0, $n = count($my_learners); $i < $n; $i++) {
                $my_learners[$i]->course_completion = 0;
                foreach ($certificate_users as $certificate_user) {
                    if ($certificate_user->user_id == $my_learners[$i]->user_id && $certificate_user->course_id == $my_learners[$i]->course_id) {
                        $my_learners[$i]->course_completion = 1;
                        foreach ($courses_certificates as $course_certificate) {
                            if ($course_certificate->course_id == $certificate_user->course_id) {
                                $my_learners[$i]->course_completion = 2;
                                break;
                            }
                        }
                        break;
                    }
                }
            }
        }
    }
    joomla_lms_html::showCEO_page($option, $lists, $my_learners);
}
    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();
    }
 function editLpath_showPrereq(&$lists, $formname = 'adminFormlp', $show_full = true)
 {
     $JLMS_CONFIG =& JLMSFactory::getConfig();
     if (!empty($lists['lps_prereq']) || !empty($lists['lps']) || !$show_full) {
         echo JLMSCSS::h2(_JLMS_LPATH_PREREQUISITES);
     }
     if ($show_full) {
         if (!empty($lists['lps_prereq'])) {
             echo '<table cellpadding="0" cellspacing="0" border="0" width="100%" class="' . JLMSCSS::_('jlmslist') . '" style="margin-bottom:0px;">';
             echo '<tr><' . JLMSCSS::tableheadertag() . ' width="20" class="' . JLMSCSS::_('sectiontableheader') . '">#</' . JLMSCSS::tableheadertag() . '><' . JLMSCSS::tableheadertag() . ' class="' . JLMSCSS::_('sectiontableheader') . '" colspan="' . ($JLMS_CONFIG->get('time_released_lpaths_prerequisites', false) ? '11' : '2') . '">' . _JLMS_LPATH_LIST_PREREQUISITES . '</' . JLMSCSS::tableheadertag() . '></tr>';
             $k = 1;
             foreach ($lists['lps_prereq'] as $lppr) {
                 echo '<tr class="' . JLMSCSS::_('sectiontableentry' . $k) . '">';
                 echo '<td><input type="checkbox" name="cid[]" value="' . $lppr->req_id . '" onclick="jlms_isChecked(\'' . $formname . '\', this.checked);"/>';
                 echo '<td width="20%" nowrap="nowrap">' . $lppr->lpath_name . "</td>";
                 if ($JLMS_CONFIG->get('time_released_lpaths_prerequisites', false)) {
                     if ($lppr->minute) {
                         echo '<td width="1%">&nbsp;</td>';
                         echo '<td width="1%">' . _JLMS_LPATH_PREREQ_MINUTE . '</td>';
                         echo '<td width="1%">' . $lppr->minute . '</td>';
                     } else {
                         echo '<td width="1%">&nbsp;</td>';
                         echo '<td width="1%">&nbsp;</td>';
                         echo '<td width="1%">&nbsp;</td>';
                     }
                     if ($lppr->hour) {
                         echo '<td width="1%">&nbsp;</td>';
                         echo '<td width="1%">' . _JLMS_LPATH_PREREQ_HOUR . '</td>';
                         echo '<td width="1%">' . $lppr->hour . '</td>';
                     } else {
                         echo '<td width="1%">&nbsp;</td>';
                         echo '<td width="1%">&nbsp;</td>';
                         echo '<td width="1%">&nbsp;</td>';
                     }
                     if ($lppr->day) {
                         echo '<td width="1%">&nbsp;</td>';
                         echo '<td width="1%">' . _JLMS_LPATH_PREREQ_DAY . '</td>';
                         echo '<td width="1%">' . $lppr->day . '</td>';
                     } else {
                         echo '<td width="1%">&nbsp;</td>';
                         echo '<td width="1%">&nbsp;</td>';
                         echo '<td width="1%">&nbsp;</td>';
                     }
                 }
                 echo '<td width="auto">&nbsp;</td>';
                 echo '</tr>';
             }
             echo '</table>';
         }
         if (isset($lists['lps']) && $lists['lps']) {
             echo '<table cellpadding="0" cellspacing="0" border="0" width="100%" class="jlms_table_no_borders">';
             $controls = array();
             $controls[] = array('href' => "javascript:submitbutton('lpath_del_prereq', '" . $formname . "')", 'title' => _JLMS_DELETE, 'img' => 'buttons_22/btn_delete_22.png');
             $controls[] = array('href' => "javascript:submitbutton('lpath_add_prereq', '" . $formname . "')", 'title' => _JLMS_ADD_ITEM, 'img' => 'buttons_22/btn_add_22.png');
             $controls[] = array('href' => '', 'title' => '', 'img' => '', 'custom' => $lists['lps']);
             JLMS_TMPL::ShowControlsFooter($controls, '', false, true);
             echo '</table>';
             /*
             				?>
             				<table cellpadding="2" cellspacing="2" border="0" class="jlms_table_no_borders">
             				<tr>
             					<td width="22" style="vertical-align:middle ">
             						<a href="javascript:submitbutton('lpath_del_prereq', '<?php echo $formname;?>');">
             							<img src="<?php echo $JLMS_CONFIG->get('live_site');?>/components/com_joomla_lms/lms_images/buttons_22/btn_delete_22.png" class="JLMS_png" width="22" height="22" border="0" alt="btn_delete" />
             						</a>
             					</td>
             					<td width="22" style="vertical-align:middle ">
             						<a href="javascript:submitbutton('lpath_add_prereq', '<?php echo $formname;?>');">
             							<img src="<?php echo $JLMS_CONFIG->get('live_site');?>/components/com_joomla_lms/lms_images/buttons_22/btn_add_22.png" class="JLMS_png" width="22" height="22" border="0" alt="btn_add" />
             						</a>
             					</td>
             					<td>
             						<table border="0" cellpadding="0" cellspacing="0" class="jlms_table_no_borders">
             							<tr>
             								<td style="vertical-align:middle;">
             									<?php echo $lists['lps'];?>
             								</td>
             								<td>
             									&nbsp;&nbsp;
             								</td>
             							<?php if ($JLMS_CONFIG->get('time_released_lpaths_prerequisites', false)) { ?>
             								<td style="vertical-align:middle;">
             									<?php echo _JLMS_LPATH_PREREQ_MINUTE;?>
             								</td>
             								<td style="vertical-align:middle;">
             									<input type="text" name="prereq_minute" value="0" size="2" class="inputbox" />
             								</td>
             								<td>
             									&nbsp;&nbsp;
             								</td>
             								<td style="vertical-align:middle;">
             									<?php echo _JLMS_LPATH_PREREQ_HOUR;?>
             								</td>
             								<td style="vertical-align:middle;">
             									<input type="text" name="prereq_hour" value="0" size="1" class="inputbox" />
             								</td>
             								<td>
             									&nbsp;&nbsp;
             								</td>
             								<td style="vertical-align:middle;">
             									<?php echo _JLMS_LPATH_PREREQ_DAY;?>
             								</td>
             								<td style="vertical-align:middle;">
             									<input type="text" name="prereq_day" value="0" size="1" class="inputbox" />
             								</td>
             							<?php } ?>
             							</tr>
             						</table>
             					</td>
             				</tr>
             				</table>
             			<?php */
         }
     } else {
         echo _JLMS_LPATH_PREREQUISITES_FIRST_MSG;
     }
 }
示例#8
0
 function ShowStatusAs($row)
 {
     $JLMS_CONFIG =& JLMSFactory::getConfig();
     if ($row->item_id) {
         //scorm
         switch ($JLMS_CONFIG->get('scorm_status_as', 0)) {
             case 0:
                 require_once _JOOMLMS_FRONT_HOME . "/includes/lms_grades.lib.php";
                 echo JLMS_getLpathProgress($row);
                 break;
             case 1:
                 if (isset($row->s_status) && $row->s_status) {
                     echo '<b>' . _JLMS_LPATH_STU_LPSTATUS_COMPLETED . '</b>';
                 } else {
                     echo '<b>' . _JLMS_LPATH_STU_LPSTATUS_NOTCOMPLETED . '</b>';
                 }
                 break;
             case 2:
                 $r_img = 'btn_cancel';
                 $r_sta = _JLMS_LPATH_STU_LPSTATUS_NOTCOMPLETED;
                 if (isset($row->s_status) && $row->s_status) {
                     $r_img = 'btn_accept';
                     $r_sta = _JLMS_LPATH_STU_LPSTATUS_COMPLETED;
                 } else {
                     if (isset($row->s_status) && $row->s_status == 0) {
                         $r_img = 'btn_pending_cur';
                     }
                 }
                 echo '<img class=\'JLMS_png\' src="' . $JLMS_CONFIG->get('live_site') . '/components/com_joomla_lms/lms_images/toolbar/' . $r_img . '.png" width=\'16\' height=\'16\' alt="' . $r_sta . '" title="' . $r_sta . '" />';
                 break;
         }
     } else {
         //lpath
         switch ($JLMS_CONFIG->get('lpath_status_as', 0)) {
             case 0:
                 require_once _JOOMLMS_FRONT_HOME . "/includes/lms_grades.lib.php";
                 echo JLMS_getLpathProgress($row);
                 break;
             case 1:
                 if ($row->r_status) {
                     echo '<b>' . _JLMS_LPATH_STU_LPSTATUS_COMPLETED . '</b>';
                 } else {
                     echo '<b>' . _JLMS_LPATH_STU_LPSTATUS_NOTCOMPLETED . '</b>';
                 }
                 break;
             case 2:
                 $r_img = 'btn_cancel';
                 $r_sta = _JLMS_LPATH_STU_LPSTATUS_NOTCOMPLETED;
                 if (isset($row->r_status) && $row->r_status) {
                     $r_img = 'btn_accept';
                     $r_sta = _JLMS_LPATH_STU_LPSTATUS_COMPLETED;
                 } else {
                     if (isset($row->r_status) && $row->r_status == 0) {
                         $r_img = 'btn_pending_cur';
                     }
                 }
                 echo '<img class=\'JLMS_png\' src="' . $JLMS_CONFIG->get('live_site') . '/components/com_joomla_lms/lms_images/toolbar/' . $r_img . '.png" width=\'16\' height=\'16\' alt="' . $r_sta . '" title="' . $r_sta . '" />';
                 break;
         }
     }
 }
    function showpageTracking($id, $option, &$rows, &$lists)
    {
        $JLMS_CONFIG =& JLMSFactory::getConfig();
        $JLMS_SESSION =& JLMSFactory::getSession();
        $Itemid = $JLMS_CONFIG->get('Itemid');
        global $my;
        JLMS_TMPL::OpenMT();
        $hparams = array();
        $page_13_stats_shown = false;
        $page_12_stats_shown = false;
        $page_14_stats_shown = false;
        if ($lists['page'] == 12) {
            $hparams['second_tb_header'] = _JLMS_TRACKING_DOCUMENTS_STATISTICS;
        } elseif ($lists['page'] == 13) {
            $hparams['second_tb_header'] = _JLMS_TRACKING_LPATHS_STATISTICS;
        } elseif ($lists['page'] == 14) {
            $hparams['second_tb_header'] = _JLMS_TRACKING_LATEST_COURSE_ACTIVITIES_REPORT;
        } else {
            $hparams['second_tb_header'] = _JLMS_TRACK_TITLE_ACCESS . JLMS_TRACKING_getTitle($lists['page']);
        }
        $toolbar = array();
        $toolbar[] = array('btn_type' => 'back', 'btn_js' => sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=tracking&id={$id}"));
        JLMS_TMPL::ShowHeader('tracking', _JLMS_TRACK_TITLE, $hparams, $toolbar);
        JLMS_TMPL::OpenTS();
        ?>
		<form action="<?php 
        echo sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}");
        ?>
" method="post" name="adminForm">
			<table width="100%" cellpadding="0" cellspacing="0" border="0" class="jlms_table_no_borders">
				<tr>
					<td align="right" style="text-align:right ">
						<div align="right" style="white-space:nowrap ">
						<?php 
        if ($lists['page'] == 12 || $lists['page'] == 13 || $lists['page'] == 14) {
            //only group and user filters
            if (isset($lists['filter_lpath']) && $lists['page'] == 13) {
                echo $lists['filter_lpath'] . '<br />';
            }
            if (isset($lists['filter2'])) {
                echo $lists['filter2'] . '<br />';
            }
            if (isset($lists['filter3'])) {
                echo $lists['filter3'] . '<br />';
            }
            echo $lists['filter_stu'] . '<br />';
        } else {
            echo $lists['filter_pages'] . $lists['filter'] . $lists['filter_month'] . $lists['filter_day'];
            ?>
<br />
							<?php 
            /*if(isset($lists['filter_lpath'])){
            			echo $lists['filter_lpath'].'<br />';
            		}*/
            if (isset($lists['filter2'])) {
                echo $lists['filter2'] . '<br />';
            }
            if (isset($lists['filter3'])) {
                echo $lists['filter3'] . '<br />';
            }
            echo $lists['filter_stu'] . '<br />';
        }
        ?>
						</div>
					</td>
				</tr>
			</table>
<?php 
        if ($lists['page'] == 12 || $lists['page'] == 13 || $lists['page'] == 14) {
            //do nothing
        } else {
            //show hits statistics
            ?>
	<?php 
            $link = "index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=tracking&amp;id={$id}";
            ?>
			<table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php 
            echo JLMSCSS::_('jlmslist');
            ?>
">
				<tr>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
"><?php 
            echo _JLMS_TRACK_TBL_H_STU;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<?php 
            $rr = array();
            if ($lists['is_day']) {
                foreach ($lists['months'] as $ma) {
                    echo '<' . JLMSCSS::tableheadertag() . ' class="' . JLMSCSS::_('sectiontableheader') . '" align="center">' . JLMS_dateToDisplay(mktime(0, 0, 0, $ma->month, $ma->day, $ma->year), true) . '</' . JLMSCSS::tableheadertag() . '>';
                    $rr[] = $ma->month;
                }
            } else {
                foreach ($lists['months'] as $ma) {
                    echo '<' . JLMSCSS::tableheadertag() . ' class="' . JLMSCSS::_('sectiontableheader') . '" align="center">' . month_lang(strftime('%m', mktime(0, 0, 0, $ma->month + 1, 0, 0)), 0, 2) . ', ' . $ma->year . '</' . JLMSCSS::tableheadertag() . '>';
                    $rr[] = $ma->month;
                }
            }
            ?>
				</tr>
			<?php 
            $k = 1;
            $i = 0;
            $total_counts = array();
            for ($j = 0; $j < count($lists['months']); $j++) {
                $total_counts[$j] = 0;
            }
            while ($i < count($rows)) {
                $row = $rows[$i];
                $link = '';
                $link = "index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=tracking&amp;id={$id}&amp;filter_stu=" . $row->user_id . "&amp;page=" . $lists['page'];
                ?>
				<tr class="<?php 
                echo JLMSCSS::_('sectiontableentry' . $k);
                ?>
">
					<td align="left" valign="middle" style="vertical-align:middle ">
						<a href="<?php 
                echo sefRelToAbs($link);
                ?>
" title="<?php 
                echo _JLMS_VIEW_DETAILS;
                ?>
">
							<?php 
                echo $row->username;
                ?>
						</a>
					</td>
					<?php 
                #$j = $lists['month']-1;
                $e = 0;
                $user = $rows[$i]->user_id;
                #$month = $rows[$i]->month;
                #$year = $rows[$i]->year;
                do {
                    if ($lists['is_day']) {
                        while (($lists['months'][$e]->day != $rows[$i]->day || $lists['months'][$e]->month != $rows[$i]->month || $lists['months'][$e]->year != $rows[$i]->year) && $e < count($lists['months'])) {
                            echo '<td align="center">0</td>';
                            $e++;
                        }
                        if ($rows[$i]->user_id == $user && $rows[$i]->day == $lists['months'][$e]->day && $rows[$i]->month == $lists['months'][$e]->month && $rows[$i]->year == $lists['months'][$e]->year) {
                            echo '<td align="center">' . $rows[$i]->count_hits . '</td>';
                            $total_counts[$e] = $total_counts[$e] + $rows[$i]->count_hits;
                        }
                    } else {
                        while (($lists['months'][$e]->month != $rows[$i]->month || $lists['months'][$e]->year != $rows[$i]->year) && $e < count($lists['months'])) {
                            echo '<td align="center">0</td>';
                            $e++;
                        }
                        if ($rows[$i]->user_id == $user && $rows[$i]->month == $lists['months'][$e]->month && $rows[$i]->year == $lists['months'][$e]->year) {
                            echo '<td align="center">' . $rows[$i]->count_hits . '</td>';
                            $total_counts[$e] = $total_counts[$e] + $rows[$i]->count_hits;
                        }
                    }
                    #$j ++;
                    $e++;
                    $i++;
                } while ($i < count($rows) && $rows[$i]->user_id == $user);
                while ($e < count($lists['months'])) {
                    echo '<td align="center">0</td>';
                    $e++;
                }
                if (isset($rows[$i]->user_id) && $rows[$i]->user_id != $user) {
                    $i--;
                }
                ?>
				</tr>
				<?php 
                $k = 3 - $k;
                $i++;
            }
            ?>
				<tr class="<?php 
            echo JLMSCSS::_('sectiontableentry' . $k);
            ?>
">
					<td align="left" valign="middle" style="vertical-align:middle "><?php 
            echo _JLMS_TOTAL;
            ?>
</td>
					<?php 
            for ($j = 0; $j < count($lists['months']); $j++) {
                echo '<td align="center"><strong>' . $total_counts[$j] . '</strong></td>';
            }
            ?>
				</tr>
			</table>
			<br /><br />
<?php 
        }
        ?>
		<?php 
        if ($lists['page'] == 14 && isset($lists['page14_stats']) && !empty($lists['page14_stats'])) {
            $page_14_stats_shown = true;
            ?>
		
			<script type="text/javascript">
				function submitbutton(pressbutton){
					var form = document.adminForm;
					form.view.value = pressbutton;
					form.submit();
				}
			</script>
		
			<table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php 
            echo JLMSCSS::_('jlmslist');
            ?>
">
				<tr>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" width="20">#</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
">
					<?php 
            echo _JLMS_TRACK_TBL_H_STU;
            ?>
					</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
">
					&nbsp;
					</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
">
					<?php 
            echo _JLMS_TRACK_TBL_H_ACTIVITY;
            ?>
					</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
">
					<?php 
            echo _JLMS_TRACK_TBL_H_TIME;
            ?>
					</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
				</tr>
			<?php 
            $limit = intval(mosGetParam($_GET, 'limit', $JLMS_SESSION->get('list_limit', $JLMS_CONFIG->getCfg('list_limit'))));
            $JLMS_SESSION->set('list_limit', $limit);
            $limitstart = intval(mosGetParam($_GET, 'limitstart', 0));
            $total = count($lists['page14_stats']);
            require_once _JOOMLMS_FRONT_HOME . DS . "includes" . DS . "classes" . DS . "lms.pagination.php";
            $pageNav = new JLMSPageNav($total, $limitstart, $limit);
            $k = 1;
            $count_activities = 0;
            $items_counter = 0;
            foreach ($lists['page14_stats'] as $latest_activity) {
                if ($count_activities >= $pageNav->limitstart && $count_activities < $pageNav->limitstart + $pageNav->limit) {
                    echo '<tr class="' . JLMSCSS::_('sectiontableentry' . $k) . '">';
                    echo '<td>';
                    echo $pageNav->limitstart + $items_counter + 1;
                    echo '</td>';
                    echo '<td>' . $latest_activity->user . '</td>';
                    echo '<td width="16"><img src="' . $JLMS_CONFIG->get('live_site') . '/components/com_joomla_lms/lms_images/' . $latest_activity->icon . '" alt="i" width="16" height="16" border="0" /></td>';
                    echo '<td>' . $latest_activity->activity . '</td>';
                    echo '<td>' . JLMS_dateToDisplay($latest_activity->time, true, $JLMS_CONFIG->get('offset') * 60 * 60, ' H:i:s') . '</td>';
                    echo '</tr>';
                    $k = 3 - $k;
                    $items_counter++;
                }
                $count_activities++;
            }
            ?>
			<tr>
				<td colspan="5" align="center"class="<?php 
            echo JLMSCSS::_('jlmslist-footer_td');
            ?>
">
					<div align="center">
					<?php 
            $link = "index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=tracking&amp;id={$id}&amp;page=14";
            echo $pageNav->writePagesLinks($link);
            ?>
					</div>
				</td>
			</tr>
			</table>
			<table width="100%" cellpadding="0" cellspacing="0" class="jlms_table_no_borders">
			<tr>
				<td align="center">
					<?php 
            $controls = array();
            $controls[] = array('href' => "javascript:submitbutton('csv');", 'title' => 'CSV', 'img' => 'csv');
            $controls[] = array('href' => "javascript:submitbutton('xls');", 'title' => 'XLS', 'img' => 'xls');
            JLMS_TMPL::ShowControlsFooterC($controls, '', false, false, _JLMS_EXPORT_TO . ':');
            ?>
	
				</td>
			</tr>
			</table>
		<?php 
        } elseif ($lists['page'] == 14 && !$page_14_stats_shown) {
            echo '<div class="joomlalms_user_message">' . _JLMS_TRACKING_NO_STATISTICS . '</div>';
        } elseif ($lists['page'] == 12 && $lists['filter_stu_val'] && isset($lists['page12_stats']) && !empty($lists['page12_stats'])) {
            $page_12_stats_shown = true;
            $max_tree_width = 0;
            if (isset($lists['page12_stats'][0])) {
                $max_tree_width = $lists['page12_stats'][0]->tree_max_width;
            }
            ?>
			<table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php 
            echo JLMSCSS::_('jlmslist');
            ?>
">
				<tr>
					<<?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="45%"><?php 
            echo _JLMS_TRACK_TBL_DOC_NAME;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" align="center"><?php 
            echo _JLMS_TRACK_TBL_DOC_DOWNS;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" align="center"><?php 
            echo _JLMS_TRACK_TBL_DOC_LAST;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
				</tr>
			<?php 
            $k = 1;
            $tree_modes = array();
            for ($i = 0, $n = count($lists['page12_stats']); $i < $n; $i++) {
                $row_doc = $lists['page12_stats'][$i];
                $max_tree_width = $row_doc->tree_max_width;
                ?>
				<tr class="<?php 
                echo JLMSCSS::_('sectiontableentry' . $k);
                ?>
">
					<?php 
                $add_img = '';
                if ($row_doc->tree_mode_num) {
                    $g = 0;
                    $tree_modes[$row_doc->tree_mode_num - 1] = $row_doc->tree_mode;
                    while ($g < $row_doc->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' /></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_doc->tree_mode . ".png\" width='16' height='16' /></td>";
                    $max_tree_width = $max_tree_width - $g - 1;
                }
                echo $add_img;
                ?>
					<td align="center" valign="middle" style="vertical-align:middle " width='16'>
					<?php 
                if ($row_doc->folder_flag == 1) {
                    echo "<span style='alignment:center; font-weight:bold; vertical-align:middle;'><img class='JLMS_png' src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/folder.png\" width='16' height='16' alt='Folder' /></span>";
                } else {
                    echo "<span style='alignment:center; font-weight:bold; vertical-align:middle;'><img class='JLMS_png' src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/files/" . $row_doc->file_icon . ".png\" width='16' height='16' alt='File' /></span>";
                }
                ?>
					</td>
					<td align="left" valign="middle" <?php 
                if ($max_tree_width > 0) {
                    echo "colspan='" . ($max_tree_width + 1) . "'";
                }
                ?>
 width="35%">
					<?php 
                if ($row_doc->folder_flag || !$row_doc->folder_flag && !$row_doc->file_id) {
                    echo '<strong>' . $row_doc->doc_name . '</strong>';
                } else {
                    echo $row_doc->doc_name;
                }
                ?>
					</td>
					<td valign="middle" align="center">
						<?php 
                echo $row_doc->downloads;
                ?>
					</td>
					<td valign="middle" align="center">
						<?php 
                echo JLMS_dateToDisplay($row_doc->last_access, false, $JLMS_CONFIG->get('offset') * 60 * 60, ' H:i:s');
                ?>
					</td>
				</tr>
				<?php 
                $k = 3 - $k;
            }
            ?>
			</table>
		<?php 
        } elseif ($lists['page'] == 12 && !$lists['filter_stu_val'] && isset($lists['page12_stats']) && !empty($lists['page12_stats'])) {
            $page_12_stats_shown = true;
            $max_tree_width = 0;
            if (isset($lists['page12_stats'][0])) {
                $max_tree_width = $lists['page12_stats'][0]->tree_max_width;
            }
            ?>
<script language="javascript" type="text/javascript">
<!--//--><![CDATA[//><!--
var block_stats = 0;
var tID = '';
var url_prefix = '<?php 
            echo $JLMS_CONFIG->get('live_site') . "/index.php?tmpl=component&option={$option}&Itemid={$Itemid}&id={$id}";
            ?>
';
function jlms_MakeRequest(url) {
	var http_request = false;
	if (window.ActiveXObject) { // IE
		try { http_request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try { http_request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	} else if (window.XMLHttpRequest) { // Mozilla, Safari,...
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType) {
			http_request.overrideMimeType('text/xml');
		}
	}
	if (!http_request) {
		return false;
	}
	http_request.onreadystatechange = function() { jlms_AnalizeRequest(http_request); };
	http_request.open('GET', url_prefix + url, true);
	http_request.send(null);
}
function jlms_AnalizeRequest(http_request) {
	if (http_request.readyState == 4) {
		if ((http_request.status == 200)) {
			block_stats = 0;
			if(http_request.responseXML.documentElement == null){
				try {
					http_request.responseXML.loadXML(http_request.responseText)
				} catch (e) {
					/*alert("Can't load");*/
				}
			}
			response  = http_request.responseXML.documentElement;
			var task = response.getElementsByTagName('task')[0].firstChild.data;
			switch (task) {
				case 'doc_xml':
					var response_data = response.getElementsByTagName('stats_table')[0].firstChild.data;
					var sec_indx = gl_el.parentNode.sectionRowIndex;
					var table = gl_el.parentNode.parentNode;
					var row = table.insertRow(sec_indx + 1);
					var cell1 = document.createElement("td");
					cell1.align = 'left';
					cell1.colSpan = "<?php 
            echo $max_tree_width + 5;
            ?>
";
					cell1.style.padding = '0px';
					cell1.style.margin = '0px';
					cell1.innerHTML = response_data;
					row.appendChild(cell1);
					gl_el.innerHTML = "<img class='JLMS_png' src='<?php 
            echo $JLMS_CONFIG->get('live_site');
            ?>
/components/com_joomla_lms/lms_images/toolbar/btn_accept.png' width='16' height='16' alt=\"done\" title=\"done\" />";
				break;
			}
		} else {
		}
	}
}
var gl_el = '';
function jlms_RequestDOCS_stats( doc_id, element ) {
	if (block_stats == 0) {
		block_stats = 1;
		gl_el = element.parentNode;
		jlms_MakeRequest('&task=get_docs_stats&doc_id='+doc_id+'&colspan=<?php 
            echo $max_tree_width + 2;
            ?>
');
		gl_el.innerHTML = "<img src='<?php 
            echo $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('ajax_settings_small_indicator');
            ?>
' width='16' height='16' alt=\"loading\" title=\"loading\" />";
	}
}
JLMS_preloadImages('<?php 
            echo $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('ajax_settings_small_indicator');
            ?>
', '<?php 
            echo $JLMS_CONFIG->get('live_site');
            ?>
/components/com_joomla_lms/lms_images/toolbar/btn_accept.png');
//--><!]]> 
</script>
			<table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php 
            echo JLMSCSS::_('jlmslist');
            ?>
">
				<tr>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 width="16" 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="45%"><?php 
            echo _JLMS_TRACK_TBL_DOC_NAME;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" width="100" align="center"><?php 
            echo _JLMS_TRACK_TBL_DOC_DOWNS;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" width="100" align="center"><?php 
            echo _JLMS_TRACK_TBL_DOC_LAST;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
				</tr>
			<?php 
            $k = 1;
            $tree_modes = array();
            for ($i = 0, $n = count($lists['page12_stats']); $i < $n; $i++) {
                $row_doc = $lists['page12_stats'][$i];
                $max_tree_width = $row_doc->tree_max_width;
                ?>
				<tr class="<?php 
                echo JLMSCSS::_('sectiontableentry' . $k);
                ?>
">
					<td valign="middle" align="center">
					<?php 
                if ($row_doc->folder_flag != 1) {
                    ?>
						<span style="alignment:center; vertical-align:middle; cursor:pointer" onclick="jlms_RequestDOCS_stats(<?php 
                    echo $row_doc->id;
                    ?>
, this);">
							<img class='JLMS_png' src="<?php 
                    echo $JLMS_CONFIG->get('live_site');
                    ?>
/components/com_joomla_lms/lms_images/toolbar/btn_pending_cur.png" width='16' height='16' alt="<?php 
                    echo _JLMS_TRACK_VIEW_DETAILS;
                    ?>
" title="<?php 
                    echo _JLMS_TRACK_VIEW_DETAILS;
                    ?>
" />
						</span>
					<?php 
                } else {
                    echo '&nbsp;';
                }
                ?>
					</td>
					<?php 
                $add_img = '';
                if ($row_doc->tree_mode_num) {
                    $g = 0;
                    $tree_modes[$row_doc->tree_mode_num - 1] = $row_doc->tree_mode;
                    while ($g < $row_doc->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' /></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_doc->tree_mode . ".png\" width='16' height='16' alt='sub' /></td>";
                    $max_tree_width = $max_tree_width - $g - 1;
                }
                echo $add_img;
                ?>
					<td align="center" valign="middle" style="vertical-align:middle " width='16'>
					<?php 
                if ($row_doc->folder_flag == 1) {
                    echo "<span style='alignment:center; font-weight:bold; vertical-align:middle;'><img class='JLMS_png' src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/folder.png\" width='16' height='16' alt='Folder' /></span>";
                } else {
                    echo "<span style='alignment:center; font-weight:bold; vertical-align:middle;'><img class='JLMS_png' src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/files/" . $row_doc->file_icon . ".png\" width='16' height='16' alt='File' /></span>";
                }
                ?>
					</td>
					<td align="left" valign="middle" <?php 
                if ($max_tree_width > 0) {
                    echo "colspan='" . ($max_tree_width + 1) . "'";
                }
                ?>
 width="35%">
					<?php 
                if ($row_doc->folder_flag || !$row_doc->folder_flag && !$row_doc->file_id) {
                    echo '<strong>' . $row_doc->doc_name . '</strong>';
                } else {
                    echo $row_doc->doc_name;
                }
                ?>
					</td>
					<td valign="middle" align="center">
						<?php 
                echo $row_doc->downloads;
                ?>
					</td>
					<td valign="middle" align="center">
						<?php 
                echo JLMS_dateToDisplay($row_doc->last_access, false, $JLMS_CONFIG->get('offset') * 60 * 60, ' H:i:s');
                ?>
					</td>
				</tr>
				<?php 
                $k = 3 - $k;
            }
            ?>
			</table>
		<?php 
        } elseif ($lists['page'] == 12 && !$page_12_stats_shown) {
            echo '<div class="joomlalms_user_message">' . _JLMS_TRACKING_NO_STATISTICS . '</div>';
        } elseif ($lists['page'] == 13 && $lists['filter_stu_val'] && isset($lists['page13_stats']) && !empty($lists['page13_stats'])) {
            $page_13_stats_shown = true;
            ?>
<script language="javascript" type="text/javascript">
<!--//--><![CDATA[//><!--

function submitbutton(pressbutton){
	var form = document.adminForm;
	form.view.value = pressbutton;
	form.submit();
}

var block_stats = 0;
var tID = '';
var url_prefix = '<?php 
            echo $JLMS_CONFIG->get('live_site') . "/index.php?tmpl=component&option={$option}&Itemid={$Itemid}&id={$id}";
            ?>
';
function jlms_MakeRequest(url) {
	var http_request = false;
	if (window.XMLHttpRequest) { // Mozilla, Safari,...
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType) {
			http_request.overrideMimeType('text/xml');
		}
	} else if (window.ActiveXObject) { // IE
		try { http_request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try { http_request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}
	if (!http_request) {
		return false;
	}
	http_request.onreadystatechange = function() { jlms_AnalizeRequest(http_request); };
	http_request.open('GET', url_prefix + url, true);
	http_request.send(null);
}
function jlms_AnalizeRequest(http_request) {
	if (http_request.readyState == 4) {
		if ((http_request.status == 200)) {
			block_stats = 0;
			if(http_request.responseXML.documentElement == null){
				try {
					http_request.responseXML.loadXML(http_request.responseText)
				} catch (e) {
					/*alert("Can't load");*/
				}
			}
			response  = http_request.responseXML.documentElement;
			var task = response.getElementsByTagName('task')[0].firstChild.data;
			switch (task) {
				case 'lpath_xml':
					var response_data = response.getElementsByTagName('stats_table')[0].firstChild.data;
					if (response_data && response_data != '' && response_data != ' ') {
						var sec_indx = gl_el.parentNode.sectionRowIndex;
						var table = gl_el.parentNode.parentNode;
						var row = table.insertRow(sec_indx + 1);
						var cell1 = document.createElement("td");
						cell1.align = 'left';
						cell1.colSpan = "3";
						cell1.style.padding = '0px';
						cell1.style.margin = '0px';
						cell1.innerHTML = response_data;
						row.appendChild(cell1);
					}
					gl_el.innerHTML = "<img class='JLMS_png' src='<?php 
            echo $JLMS_CONFIG->get('live_site');
            ?>
/components/com_joomla_lms/lms_images/toolbar/btn_accept.png' width='16' height='16' alt=\"done\" title=\"done\" />";
				break;
				case 'scorm_progress_xml':
					var response_data = response.getElementsByTagName('stats_table')[0].firstChild.data;
					var res_user = response.getElementsByTagName('user_id')[0].firstChild.data;
					var res_lpsc = response.getElementsByTagName('lpath_id')[0].firstChild.data;
					if (response_data && response_data != '' && response_data != ' ') {
						gl_el_res = document.getElementById('sc_progress_td_'+res_user+'_'+res_lpsc);
						if (gl_el_res) {
							gl_el_res.innerHTML = response_data;
						}
					}
				break;
			}
		} else {
		}
	}
}
var gl_el = '';
function jlms_RequestLP_stats( lp_id, element ) {
	if (block_stats == 0) {
		block_stats = 1;
		gl_el = element.parentNode;
		jlms_MakeRequest('&task=get_lp_stats&lpath_id='+lp_id);
		gl_el.innerHTML = "<img src='<?php 
            echo $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('ajax_settings_small_indicator');
            ?>
' width='16' height='16' alt=\"loading\" title=\"loading\" />";
	}
}
function ChangeScormProgress( user_id, sc_id, new_stat, element) {
	if (block_stats == 0) {
		block_stats = 1;
		gl_el = document.getElementById('sc_progress_td_'+user_id+'_'+sc_id);
		jlms_MakeRequest('&task=get_lp_stats&mode=scormstatus&user_id='+user_id+'&nstat='+new_stat+'&lpath_id='+sc_id);
		gl_el.innerHTML = "<img src='<?php 
            echo $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('ajax_settings_small_indicator');
            ?>
' width='16' height='16' alt=\"loading\" title=\"loading\" />";
	}
}
JLMS_preloadImages('<?php 
            echo $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('ajax_settings_small_indicator');
            ?>
', '<?php 
            echo $JLMS_CONFIG->get('live_site');
            ?>
/components/com_joomla_lms/lms_images/toolbar/btn_accept.png', '<?php 
            echo $JLMS_CONFIG->get('live_site');
            ?>
/components/com_joomla_lms/lms_images/toolbar/btn_cancel.png');
//--><!]]> 
</script>
			<table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php 
            echo JLMSCSS::_('jlmslist');
            ?>
">
				<tr>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 width="16" class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" align="center">&nbsp;</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
"><?php 
            echo _JLMS_LPATH_TBL_HEAD_NAME;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" width="1" colspan="3">&nbsp;</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" align="center"><?php 
            echo _JLMS_LPATH_TBL_TIME_SPENT;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" align="center"><?php 
            echo _JLMS_LPATH_TBL_STARTING;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" align="center"><?php 
            echo _JLMS_LPATH_TBL_ENDING;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
				</tr>
			<?php 
            $k = 1;
            for ($i = 0, $n = count($lists['page13_stats']); $i < $n; $i++) {
                $row_path = $lists['page13_stats'][$i];
                $icon_img = "toolbar/tlb_lpath";
                $icon_alt = "learnpath";
                if ($row_path->item_id) {
                    $icon_img = "toolbar/tlb_scorm";
                    $icon_alt = "scorm";
                }
                ?>
				<tr class="<?php 
                echo JLMSCSS::_('sectiontableentry' . $k);
                ?>
">
					<td valign="middle" align="center">
						&nbsp;
					</td>
					<td valign="middle" align="left">
						<?php 
                if ($lists['f_lpath']) {
                    echo JLMS_tracking_html::Echo_userinfo($row_path->u_name, $row_path->username, $row_path->email, 'javascript:void(0);');
                } else {
                    echo $row_path->lpath_name;
                }
                ?>
					</td>
					<?php 
                if ($lists['f_lpath']) {
                    ?>
						<td width="1%" style="white-space: nowrap;"><?php 
                    echo JLMS_getLpathProgress($row_path, $row_path->user_id ? $row_path->user_id : 0);
                    ?>
</td>
					<?php 
                } else {
                    ?>
						<td width="1%" style="white-space: nowrap;"><?php 
                    echo JLMS_getLpathProgress($row_path, $lists['filter_stu_val']);
                    ?>
</td>
					<?php 
                }
                ?>
				<?php 
                $r_img = 'btn_cancel';
                $r_sta = _JLMS_LPATH_STU_LPSTATUS_NOTCOMPLETED;
                $time_spent = $row_path->time_spent;
                $r_start = '-';
                $r_end = '-';
                $new_s_status = '1';
                if (!$row_path->item_id) {
                    if (isset($row_path->r_status) && $row_path->r_status == 1) {
                        $r_img = 'btn_accept';
                        $r_sta = _JLMS_LPATH_STU_LPSTATUS_COMPLETED;
                        $r_start = isset($row_path->r_start) && $row_path->r_start ? JLMS_dateToDisplay($row_path->r_start, false, $JLMS_CONFIG->get('offset') * 60 * 60, '\\<\\b\\r \\/>H:i:s') : '-';
                        $r_end = isset($row_path->r_start) && $row_path->r_start ? JLMS_dateToDisplay($row_path->r_end, false, $JLMS_CONFIG->get('offset') * 60 * 60, '\\<\\b\\r \\/>H:i:s') : '-';
                    } elseif (isset($row_path->r_status) && $row_path->r_status == 0) {
                        $r_img = 'btn_pending_cur';
                        $r_start = isset($row_path->r_start) && $row_path->r_start ? JLMS_dateToDisplay($row_path->r_start, false, $JLMS_CONFIG->get('offset') * 60 * 60, '\\<\\b\\r \\/>H:i:s') : '-';
                    }
                } else {
                    if (isset($row_path->s_status) && $row_path->s_status == 1) {
                        $r_img = 'btn_accept';
                        $r_sta = _JLMS_LPATH_STU_LPSTATUS_COMPLETED;
                        $r_start = '-';
                        $r_end = '-';
                        $new_s_status = '0';
                    }
                    if ($row_path->lp_type == 1 || $row_path->lp_type == 2) {
                        $r_end = isset($row_path->r_end) && $row_path->r_end ? JLMS_dateToDisplay($row_path->r_end, true, $JLMS_CONFIG->get('offset') * 60 * 60, '\\<\\b\\r \\/>H:i:s') : '-';
                        $r_start = isset($row_path->r_start) && $row_path->r_start ? JLMS_dateToDisplay($row_path->r_start, true, $JLMS_CONFIG->get('offset') * 60 * 60, '\\<\\b\\r \\/>H:i:s') : '-';
                    }
                }
                ?>
					<?php 
                if ($row_path->item_id) {
                    ?>
					<td valign="middle" align="center" width="16" id="sc_progress_td_<?php 
                    echo $lists['filter_stu_val'] . "_" . $row_path->item_id;
                    ?>
">
						<a class="jlms_img_link" id="sc_progress_a_<?php 
                    echo $lists['filter_stu_val'] . "_" . $row_path->item_id;
                    ?>
" href="javascript:ChangeScormProgress(<?php 
                    echo $lists['filter_stu_val'];
                    ?>
,<?php 
                    echo $row_path->item_id;
                    ?>
,<?php 
                    echo $new_s_status;
                    ?>
,this);"><img id="sc_progress_img_<?php 
                    echo $lists['filter_stu_val'] . "_" . $row_path->item_id;
                    ?>
" align="absmiddle" class="JLMS_png" src="<?php 
                    echo $JLMS_CONFIG->get('live_site');
                    ?>
/components/com_joomla_lms/lms_images/toolbar/<?php 
                    echo $r_img;
                    ?>
.png" width="16" height="16" border="0" alt="<?php 
                    echo $r_sta;
                    ?>
" title="<?php 
                    echo $r_sta;
                    ?>
" /></a>
					<?php 
                } else {
                    ?>
					<td valign="middle" align="center" width="16">
						<img class='JLMS_png' src='<?php 
                    echo $JLMS_CONFIG->get('live_site');
                    ?>
/components/com_joomla_lms/lms_images/toolbar/<?php 
                    echo $r_img;
                    ?>
.png' width='16' height='16' alt="<?php 
                    echo $r_sta;
                    ?>
" title="<?php 
                    echo $r_sta;
                    ?>
" />
					<?php 
                }
                ?>
					</td>
					<td valign="middle" align="center" nowrap="nowrap">
						<?php 
                echo $row_path->item_id ? isset($row_path->s_score) ? $row_path->s_score . _JLMS_GB_POINTS : '&nbsp;' : '&nbsp;';
                ?>
					</td>
					<td valign="middle" align="center" nowrap="nowrap"><?php 
                echo $time_spent;
                ?>
</td>
					<td valign="middle" align="center" nowrap="nowrap"><?php 
                echo $r_start;
                ?>
</td>
					<td valign="middle" align="center" nowrap="nowrap"><?php 
                echo $r_end;
                ?>
</td>
				</tr>
				<?php 
                $k = 3 - $k;
            }
            ?>
			</table>
			<table width="100%" cellpadding="0" cellspacing="0" class="jlms_table_no_borders">
				<tr>
					<td align="center">
						<?php 
            $controls = array();
            $controls[] = array('href' => "javascript:submitbutton('csv');", 'title' => 'CSV', 'img' => 'csv');
            $controls[] = array('href' => "javascript:submitbutton('xls');", 'title' => 'XLS', 'img' => 'xls');
            JLMS_TMPL::ShowControlsFooterC($controls, '', false, false, _JLMS_EXPORT_TO . ':');
            ?>
	
					</td>
				</tr>
			</table>
		<?php 
        } elseif ($lists['page'] == 13 && !$lists['filter_stu_val'] && isset($lists['page13_stats']) && !empty($lists['page13_stats'])) {
            $page_13_stats_shown = true;
            ?>
<script language="javascript" type="text/javascript">
<!--//--><![CDATA[//><!--
var block_stats = 0;
var tID = '';
var url_prefix = '<?php 
            echo $JLMS_CONFIG->get('live_site') . "/index.php?tmpl=component&option={$option}&Itemid={$Itemid}&id={$id}";
            ?>
';
function jlms_MakeRequest(url) {
	var http_request = false;
	if (window.XMLHttpRequest) { // Mozilla, Safari,...
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType) {
			http_request.overrideMimeType('text/xml');
		}
	} else if (window.ActiveXObject) { // IE
		try { http_request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try { http_request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}
	if (!http_request) {
		return false;
	}
	http_request.onreadystatechange = function() { jlms_AnalizeRequest(http_request); };
	http_request.open('GET', url_prefix + url, true);
	http_request.send(null);
}
function jlms_AnalizeRequest(http_request) {
	if (http_request.readyState == 4) {
		if ((http_request.status == 200)) {
			block_stats = 0;
			if(http_request.responseXML.documentElement == null){
				try {
					http_request.responseXML.loadXML(http_request.responseText)
				} catch (e) {
					/*alert("Can't load");*/
				}
			}
			response  = http_request.responseXML.documentElement;
			var task = response.getElementsByTagName('task')[0].firstChild.data;
			switch (task) {
				case 'lpath_xml':
					var response_data = response.getElementsByTagName('stats_table')[0].firstChild.data;
					if (response_data && response_data != '' && response_data != ' ') {
						var sec_indx = gl_el.parentNode.sectionRowIndex;
						var table = gl_el.parentNode.parentNode;
						var row = table.insertRow(sec_indx + 1);
						var cell1 = document.createElement("td");
						cell1.align = 'left';
						cell1.colSpan = "3";
						cell1.style.padding = '0px';
						cell1.style.margin = '0px';
						cell1.innerHTML = response_data;
						row.appendChild(cell1);
					}
					gl_el.innerHTML = "<img class='JLMS_png' src='<?php 
            echo $JLMS_CONFIG->get('live_site');
            ?>
/components/com_joomla_lms/lms_images/toolbar/btn_accept.png' width='16' height='16' alt=\"done\" title=\"done\" />";
				break;
				case 'scorm_progress_xml':
					var response_data = response.getElementsByTagName('stats_table')[0].firstChild.data;
					var res_user = response.getElementsByTagName('user_id')[0].firstChild.data;
					var res_lpsc = response.getElementsByTagName('lpath_id')[0].firstChild.data;
					if (response_data && response_data != '' && response_data != ' ') {
						gl_el_res = document.getElementById('sc_progress_td_'+res_user+'_'+res_lpsc);
						if (gl_el_res) {
							gl_el_res.innerHTML = response_data;
						}
					}
				break;
			}
		} else {
		}
	}
}
var gl_el = '';
function jlms_RequestLP_stats( lp_id, element ) {
	if (block_stats == 0) {
		block_stats = 1;
		gl_el = element.parentNode;
		jlms_MakeRequest('&task=get_lp_stats&lpath_id='+lp_id);
		gl_el.innerHTML = "<img src='<?php 
            echo $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('ajax_settings_small_indicator');
            ?>
' width='16' height='16' alt=\"loading\" title=\"loading\" />";
	}
}
function ChangeScormProgress( user_id, sc_id, new_stat, element) {
	if (block_stats == 0) {
		block_stats = 1;
		gl_el = document.getElementById('sc_progress_td_'+user_id+'_'+sc_id);
		jlms_MakeRequest('&task=get_lp_stats&mode=scormstatus&user_id='+user_id+'&nstat='+new_stat+'&lpath_id='+sc_id);
		gl_el.innerHTML = "<img src='<?php 
            echo $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('ajax_settings_small_indicator');
            ?>
' width='16' height='16' alt=\"loading\" title=\"loading\" />";
	}
}
JLMS_preloadImages('<?php 
            echo $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('ajax_settings_small_indicator');
            ?>
', '<?php 
            echo $JLMS_CONFIG->get('live_site');
            ?>
/components/com_joomla_lms/lms_images/toolbar/btn_accept.png');
//--><!]]> 
</script>
			<table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php 
            echo JLMSCSS::_('jlmslist');
            ?>
">
				<tr>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 width="16" class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" align="center">&nbsp;</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 width="16" class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" align="center">&nbsp;</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" width="100%"><?php 
            echo _JLMS_LPATH_TBL_HEAD_NAME;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
				</tr>
			<?php 
            $k = 1;
            for ($i = 0, $n = count($lists['page13_stats']); $i < $n; $i++) {
                $row_path = $lists['page13_stats'][$i];
                $icon_img = "toolbar/tlb_lpath";
                $icon_alt = "learnpath";
                if ($row_path->item_id) {
                    $icon_img = "toolbar/tlb_scorm";
                    $icon_alt = "scorm";
                }
                ?>
				<tr class="<?php 
                echo JLMSCSS::_('sectiontableentry' . $k);
                ?>
">
					<td valign="middle" align="center">
					<?php 
                if (!isset($row_path->is_link)) {
                    ?>
						<span style="alignment:center; vertical-align:middle; cursor:pointer" onclick="jlms_RequestLP_stats(<?php 
                    echo $row_path->id;
                    ?>
, this);">
							<img class='JLMS_png' src="<?php 
                    echo $JLMS_CONFIG->get('live_site');
                    ?>
/components/com_joomla_lms/lms_images/toolbar/btn_pending_cur.png" width='16' height='16' alt="<?php 
                    echo _JLMS_TRACK_VIEW_DETAILS;
                    ?>
" title="<?php 
                    echo _JLMS_TRACK_VIEW_DETAILS;
                    ?>
" />
						</span>	
					<?php 
                }
                ?>
	
					</td>
					<td valign="middle" align="center">
						<span style="alignment:center; vertical-align:middle">
							<img class='JLMS_png' src="<?php 
                echo $JLMS_CONFIG->get('live_site');
                ?>
/components/com_joomla_lms/lms_images/<?php 
                echo $icon_img;
                ?>
.png" width='16' height='16' alt="<?php 
                echo $icon_alt;
                ?>
" />
						</span>
					</td>
					<td valign="middle" align="left">
						<?php 
                echo $row_path->lpath_name;
                ?>
					</td>
				</tr>
				<?php 
                $k = 3 - $k;
            }
            ?>
			</table>
		<?php 
        } elseif ($lists['page'] == 13 && !$page_13_stats_shown) {
            echo '<div class="joomlalms_user_message">' . _JLMS_TRACKING_NO_STATISTICS . '</div>';
        } elseif ($lists['page'] == 5 && $lists['filter_stu_val'] && isset($lists['page5_stats'])) {
            ?>
			<br /><br />
			<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();
            ?>
 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');
            ?>
"><?php 
            echo _JLMS_HW_TBL_HEAD_DATE;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
"><?php 
            echo _JLMS_HW_TBL_HEAD_ENDDATE;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" width="1">&nbsp;</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
				</tr>
			<?php 
            $k = 1;
            for ($i = 0, $n = count($lists['page5_stats']); $i < $n; $i++) {
                $row_hw = $lists['page5_stats'][$i];
                $alt = $row_hw->hw_status ? _JLMS_HW_STATUS_COMPLETED : _JLMS_HW_STATUS_INCOMPLETED;
                $image = $row_hw->hw_status ? 'btn_accept.png' : 'btn_cancel.png';
                ?>
				<tr class="<?php 
                echo JLMSCSS::_('sectiontableentry' . $k);
                ?>
">
					<td align="center"><?php 
                echo $i + 1;
                ?>
</td>
					<td align="left" valign="middle" style="vertical-align:middle ">
						<?php 
                echo $row_hw->hw_name;
                ?>
					</td>
					<td valign="middle" style="vertical-align:middle ">
						<?php 
                echo $row_hw->post_date;
                ?>
					</td>
					<td valign="middle" style="vertical-align:middle ">
						<?php 
                echo $row_hw->end_date;
                ?>
					</td>
					<td align="left" valign="middle" style="vertical-align:middle; text-align:left; white-space:nowrap " nowrap="nowrap">
						<?php 
                echo '<img align="absmiddle" class="JLMS_png" src="' . $JLMS_CONFIG->get('live_site') . '/components/com_joomla_lms/lms_images/toolbar/' . $image . '" width="16" height="16" border="0" alt="' . $alt . '" />';
                if ($row_hw->hw_status) {
                    echo '&nbsp;&nbsp;' . JLMS_dateToDisplay($row_hw->hw_date, false, $JLMS_CONFIG->get('offset') * 60 * 60, ' H:i:s');
                }
                ?>
					</td>
				</tr>
				<?php 
                $k = 3 - $k;
            }
            ?>
			</table>
		<?php 
        } elseif ($lists['page'] == 11 && $lists['filter_stu_val'] && isset($lists['page11_stats']) && !empty($lists['page11_stats'])) {
            ?>
			<br /><br />
			<table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php 
            echo JLMSCSS::_('jlmslist');
            ?>
">
				<tr>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 width="16" class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" align="center">&nbsp;</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
"><?php 
            echo _JLMS_LPATH_TBL_HEAD_NAME;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
">&nbsp;</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" width="1" colspan="2">&nbsp;</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					
				</tr>
			<?php 
            $k = 1;
            for ($i = 0, $n = count($lists['page11_stats']); $i < $n; $i++) {
                $row_path = $lists['page11_stats'][$i];
                $icon_img = "toolbar/tlb_lpath";
                $icon_alt = "learnpath";
                if ($row_path->c_id) {
                    $icon_img = "toolbar/tlb_scorm";
                    $icon_alt = "scorm";
                }
                ?>
				<tr class="<?php 
                echo JLMSCSS::_('sectiontableentry' . $k);
                ?>
">
					<td valign="middle" align="center">
						<span style="alignment:center; vertical-align:middle">
							<img class='JLMS_png' src="<?php 
                echo $JLMS_CONFIG->get('live_site');
                ?>
/components/com_joomla_lms/lms_images/<?php 
                echo $icon_img;
                ?>
.png" width='16' height='16' alt="<?php 
                echo $icon_alt;
                ?>
" />
						</span>
					</td>
					<td valign="middle" align="left">
							<?php 
                echo $row_path->c_title;
                ?>
					</td>
					
				<?php 
                $r_img = 'btn_cancel';
                $r_sta = _JLMS_LPATH_STU_LPSTATUS_NOTCOMPLETED;
                $r_start = '-';
                $r_end = '-';
                if (!$row_path->c_id) {
                    if (isset($row_path->published) && $row_path->published == 1) {
                        $r_img = 'btn_accept';
                        $r_sta = _JLMS_LPATH_STU_LPSTATUS_COMPLETED;
                        $r_start = $row_path->r_start ? JLMS_dateToDisplay($row_path->r_start, false, $JLMS_CONFIG->get('offset') * 60 * 60, '\\<\\b\\r \\/>H:i:s') : '-';
                        $r_end = $row_path->r_start ? JLMS_dateToDisplay($row_path->r_end, false, $JLMS_CONFIG->get('offset') * 60 * 60, '\\<\\b\\r \\/>H:i:s') : '-';
                    } elseif (isset($row_path->published) && $row_path->published == 0) {
                        $r_img = 'btn_pending_cur';
                        $r_start = $row_path->r_start ? JLMS_dateToDisplay($row_path->r_start, false, $JLMS_CONFIG->get('offset') * 60 * 60, '\\<\\b\\r \\/>H:i:s') : '-';
                    }
                } else {
                    if (isset($row_path->published) && $row_path->published == 1) {
                        $r_img = 'btn_accept';
                        $r_sta = _JLMS_LPATH_STU_LPSTATUS_COMPLETED;
                        $r_start = '-';
                        $r_end = '-';
                    }
                }
                ?>
					<td valign="middle" align="center">
					<a style="border:0px;" href="<?php 
                echo sefRelToAbs("index.php?option=" . $option . "&task=quizzes&id=" . $id . "&page=reports&quiz_id=" . $row_path->c_id . "");
                ?>
"><img class='JLMS_png' src="<?php 
                echo $JLMS_CONFIG->get('live_site');
                ?>
/components/com_joomla_lms/lms_images/toolbar/btn_pending_cur.png" width='16' height='16' alt="<?php 
                echo 'Report';
                ?>
" title="<?php 
                echo 'Report';
                ?>
" border="0" /></a>
					</td>
					<td valign="middle" align="center" width="16">
						<img class='JLMS_png' src="<?php 
                echo $JLMS_CONFIG->get('live_site');
                ?>
/components/com_joomla_lms/lms_images/toolbar/<?php 
                echo $r_img;
                ?>
.png" width='16' height='16' alt="<?php 
                echo $r_sta;
                ?>
" title="<?php 
                echo $r_sta;
                ?>
" />
					</td>
					<td valign="middle" align="center" nowrap="nowrap">
						<?php 
                echo $row_path->c_id ? isset($row_path->s_score) ? $row_path->s_score . _JLMS_GB_POINTS : '&nbsp;' : '&nbsp;';
                ?>
					</td>
					
				</tr>
				<?php 
                $k = 3 - $k;
            }
            ?>
			</table>
		<?php 
        } elseif ($lists['page'] == 11 && !$lists['filter_stu_val'] && isset($lists['page11_stats']) && !empty($lists['page11_stats'])) {
            ?>
<script language="javascript" type="text/javascript">
<!--//--><![CDATA[//><!--
var block_stats = 0;
var tID = '';
var url_prefix = '<?php 
            echo $JLMS_CONFIG->get('live_site') . "/index.php?tmpl=component&option={$option}&Itemid={$Itemid}&id={$id}";
            ?>
';
function jlms_MakeRequest(url) {
	var http_request = false;
	if (window.XMLHttpRequest) { // Mozilla, Safari,...
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType) {
			http_request.overrideMimeType('text/xml');
		}
	} else if (window.ActiveXObject) { // IE
		try { http_request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try { http_request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}
	if (!http_request) {
		return false;
	}
	http_request.onreadystatechange = function() { jlms_AnalizeRequest(http_request); };
	http_request.open('GET', url_prefix + url, true);
	http_request.send(null);
}
function jlms_AnalizeRequest(http_request) {
	if (http_request.readyState == 4) {
		if ((http_request.status == 200)) {
			block_stats = 0;
			if(http_request.responseXML.documentElement == null){
				try {
					http_request.responseXML.loadXML(http_request.responseText)
				} catch (e) {
					/*alert("Can't load");*/
				}
			}
			response  = http_request.responseXML.documentElement;
			var task = response.getElementsByTagName('task')[0].firstChild.data;
			switch (task) {
				case 'lpath_xml':
					var response_data = response.getElementsByTagName('stats_table')[0].firstChild.data;
					if (response_data && response_data != '' && response_data != ' ') {
						var sec_indx = gl_el.parentNode.sectionRowIndex;
						var table = gl_el.parentNode.parentNode;
						var row = table.insertRow(sec_indx + 1);
						var cell1 = document.createElement("td");
						cell1.align = 'left';
						cell1.colSpan = "4";
						cell1.style.padding = '0px';
						cell1.style.margin = '0px';
						cell1.innerHTML = response_data;
						row.appendChild(cell1);
					}
					gl_el.innerHTML = "<img class='JLMS_png' src='<?php 
            echo $JLMS_CONFIG->get('live_site');
            ?>
/components/com_joomla_lms/lms_images/toolbar/btn_accept.png' width='16' height='16' alt=\"done\" title=\"done\" />";
				break;
				case 'scorm_progress_xml':
					var response_data = response.getElementsByTagName('stats_table')[0].firstChild.data;
					var res_user = response.getElementsByTagName('user_id')[0].firstChild.data;
					var res_lpsc = response.getElementsByTagName('quiz_id')[0].firstChild.data;
					if (response_data && response_data != '' && response_data != ' ') {
						gl_el_res = document.getElementById('quizid_'+res_lpsc);
						if (gl_el_res) {
							gl_el_res.innerHTML = response_data;
						}
					}
				break;
			}
		} else {
		}
	}
}
var gl_el = '';
function jlms_RequestQuiz_stats( lp_id, element ) {
	if (block_stats == 0) {
		block_stats = 1;
		gl_el = element.parentNode;
		jlms_MakeRequest('&task=get_quiz_stats&quiz_id='+lp_id);
		gl_el.innerHTML = "<img src='<?php 
            echo $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('ajax_settings_small_indicator');
            ?>
' width='16' height='16' alt=\"loading\" title=\"loading\" />";
	}
}

JLMS_preloadImages('<?php 
            echo $JLMS_CONFIG->get('live_site') . '/' . $JLMS_CONFIG->get('ajax_settings_small_indicator');
            ?>
', '<?php 
            echo $JLMS_CONFIG->get('live_site');
            ?>
/components/com_joomla_lms/lms_images/toolbar/btn_accept.png', 'components/com_joomla_lms/lms_images/toolbar/btn_cancel.png');
//--><!]]> 
</script>
			<table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php 
            echo JLMSCSS::_('jlmslist');
            ?>
">
				<tr>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 width="16" class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" align="center">&nbsp;</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 width="16" class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" align="center">&nbsp;</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" ><?php 
            echo _JLMS_LPATH_TBL_HEAD_NAME;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
">&nbsp;</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
				</tr>
			<?php 
            $k = 1;
            for ($i = 0, $n = count($lists['page11_stats']); $i < $n; $i++) {
                $row_path = $lists['page11_stats'][$i];
                $icon_img = "toolbar/tlb_lpath";
                $icon_alt = "learnpath";
                if ($row_path->c_id) {
                    $icon_img = "toolbar/tlb_quiz";
                    $icon_alt = "scorm";
                }
                ?>
				<tr class="<?php 
                echo JLMSCSS::_('sectiontableentry' . $k);
                ?>
">
					<td valign="middle" align="center">
						<span style="alignment:center; vertical-align:middle; cursor:pointer" onclick="jlms_RequestQuiz_stats(<?php 
                echo $row_path->c_id;
                ?>
, this);">
							<img class='JLMS_png' src="<?php 
                echo $JLMS_CONFIG->get('live_site');
                ?>
/components/com_joomla_lms/lms_images/toolbar/btn_pending_cur.png" width='16' height='16' alt="<?php 
                echo _JLMS_TRACK_VIEW_DETAILS;
                ?>
" title="<?php 
                echo _JLMS_TRACK_VIEW_DETAILS;
                ?>
" />
						</span>	
					</td>
					<td valign="middle" align="center">
						<span style="alignment:center; vertical-align:middle">
							<img class='JLMS_png' src="<?php 
                echo $JLMS_CONFIG->get('live_site');
                ?>
/components/com_joomla_lms/lms_images/<?php 
                echo $icon_img;
                ?>
.png" width='16' height='16' alt="<?php 
                echo $icon_alt;
                ?>
" />
						</span>
					</td>
					<td valign="middle" align="left">
						<?php 
                echo $row_path->c_title;
                ?>
					</td>
					<td valign="middle" align="center">
					<a class="jlms_img_link" style="border:0px;" href="<?php 
                echo sefRelToAbs("index.php?option=" . $option . "&task=quizzes&id=" . $id . "&page=reports&quiz_id=" . $row_path->c_id . "");
                ?>
"><img class='JLMS_png' src="<?php 
                echo $JLMS_CONFIG->get('live_site');
                ?>
/components/com_joomla_lms/lms_images/toolbar/btn_pending_cur.png" width='16' height='16' alt="<?php 
                echo 'Report';
                ?>
" title="<?php 
                echo 'Report';
                ?>
" border="0" /></a>
					</td>
				</tr>
				<?php 
                $k = 3 - $k;
            }
            ?>
			</table>
		<?php 
        }
        ?>
			<input type="hidden" name="option" value="<?php 
        echo $option;
        ?>
" />
			<input type="hidden" name="Itemid" value="<?php 
        echo $Itemid;
        ?>
" />
			<input type="hidden" name="task" value="tracking" />
			<input type="hidden" name="id" value="<?php 
        echo $id;
        ?>
" />
			
			<input type="hidden" name="page" value="<?php 
        echo $lists['page'];
        ?>
" />
			<input type="hidden" name="view" value="" />
		</form>
<?php 
        JLMS_TMPL::CloseTS();
        JLMS_TMPL::CloseMT();
    }
    /**
     * Prints one row of link type content
     *
     * @param stdClass $row contains info on element
     * @param int $i number of row
     * @param int $topic_id no comments
     * @param string $checked used for creating special checkbox
     * @param int $manage show/hide control buttons
     */
    function showLinkRow(&$k, $row, $i, $topic_id, $checked = null, $manage = 1, $span = 1)
    {
        $JLMS_CONFIG =& JLMSFactory::getConfig();
        $Itemid = $JLMS_CONFIG->get('Itemid');
        $course_id = $JLMS_CONFIG->get('course_id');
        global $my, $option;
        $usertype = $JLMS_CONFIG->get('current_usertype', 0);
        if ($usertype == 2) {
            $checked = null;
            $manage = 0;
        }
        $course_id = intval(mosGetParam($_REQUEST, 'id', 0));
        $k = 3 - $k;
        $link = $row->link_href;
        if (!$checked && $manage == 1) {
            $checked = mosHTML::idBox($topic_id * 1000 + $i, $row->link_id);
        }
        // 01.12.2007 '$i' chenged to '$topic_id*1000+$i' by DEN - to avoid dublicate id's
        ?>
		<tr class="<?php 
        echo JLMSCSS::_('sectiontableentry' . $k);
        ?>
">
			<td width='1%' align="center"><?php 
        if ($usertype != 2) {
            echo $i + 1;
        } else {
            echo '&nbsp;';
        }
        ?>
</td>
			<?php 
        if ($checked) {
            echo "<td width='1%'>{$checked}</td>";
        }
        ?>
			<td width="1%"><img src="<?php 
        echo $JLMS_CONFIG->get('live_site');
        ?>
/components/com_joomla_lms/lms_images/toolbar/tlb_links.png" alt='link' /></td>
			<td align="left" colspan="<?php 
        echo $span;
        ?>
">
			<?php 
        $add_link_params = '';
        if ($row->link_type == 3) {
            $tmp_params = new JLMSParameters($row->params);
            $x_size = 0;
            $y_size = 0;
            if (isset($tmp_params->display_width)) {
                $x_size = $tmp_params->display_width;
            }
            if (isset($tmp_params->display_height)) {
                $y_size = $tmp_params->display_height;
            }
            $add_link_params = ' class="jlms_modal" rel="{handler:\'iframe\', size:{x:' . $x_size . ',y:' . $y_size . '}}"';
            JLMS_initialize_SqueezeBox(false);
            ?>
					<a href="<?php 
            echo $link;
            ?>
"<?php 
            echo $add_link_params;
            ?>
 title="<?php 
            echo str_replace('"', '&quot;', $row->link_name);
            ?>
">
						<?php 
            echo $row->link_name;
            ?>
					</a>
				<?php 
        } else {
            if ($row->link_type == 2) {
                $link = sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=view_inline_link&course_id={$course_id}&id={$row->id}");
            }
            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 
        }
        ?>
			</td>
			<?php 
        if ($usertype != 2) {
            //teacher/admin table handler
            ?>
				<?php 
            if ($manage == 1) {
                ?>
					<td valign="middle" class="controltd"><?php 
                if ($row->allow_up == 1 && $manage == 1) {
                    echo JLMS_orderIcon_element($topic_id, $course_id, 'orderup_element', _JLMS_TOPIC_I_MOVEUP, $row->ordering);
                } else {
                    echo '&nbsp;';
                }
                ?>
</td>
					<td valign="middle" class="controltd"><?php 
                if ($row->allow_down == 1 && $manage == 1) {
                    echo JLMS_orderIcon_element($topic_id, $course_id, 'orderdown_element', _JLMS_TOPIC_I_MOVEDOWN, $row->ordering);
                } else {
                    echo '&nbsp;';
                }
                ?>
</td>
					<?php 
                $state = publishUtility($row->published, $row->show);
                ?>
					<td valign="middle" class="controltd"><?php 
                echo JLMS_showHideIcon($row->link_id, $course_id, $topic_id, $state, 'change_element', $option);
                ?>
</td>
				<?php 
            }
            ?>
				<td align="center">-</td>
				<td align="center">-</td>
			<?php 
        } else {
            ?>
				<td align="center">-</td>
				<td align="center">-</td>
				<td align="center">-</td>
			<?php 
        }
        ?>
			<td><?php 
        $descr = strip_tags($row->link_description);
        if (strlen($descr) > 75) {
            $descr = substr($descr, 0, 75) . "...";
        }
        echo $descr ? $descr : '&nbsp;';
        ?>
			</td>
		</tr>
		<?php 
    }
示例#11
0
 function JQ_show_results_footer_content_bars($images_array, $title_array, $count_array, $id)
 {
     $JLMS_CONFIG =& JLMSFactory::getConfig();
     $jq_tmpl_html = '<table width="100%" cellpadding="0" cellspacing="0" border="0" align="center" class="' . JLMSCSS::_('jlmslist') . '" style="margin: 0 auto;">' . "\n\r";
     for ($i = 0, $n = count($images_array); $i < $n; $i++) {
         if (!isset($images_array[$i]->is_survey)) {
             if (isset($images_array[$i]->graph)) {
                 $q_num = $i + 1;
                 $jq_tmpl_html .= '<tr><td align="left">';
                 $jq_tmpl_html .= _JLMS_QUIZ_QUESTION_NUM . $q_num . ': <b>' . $title_array[$i]->graph . '</b>';
                 $jq_tmpl_html .= '</td></tr>';
                 $jq_tmpl_html .= '<tr><td align="center">';
                 $jq_tmpl_html .= '<img src="' . $JLMS_CONFIG->get('live_site') . '/' . $images_array[$i]->graph . '" width="600" height="' . ($count_array[$i]->graph ? $count_array[$i]->graph * 200 : 200) . '" alt="' . $title_array[$i]->graph . '" title="' . $title_array[$i]->graph . '" border=\'0\' /><br />';
                 $jq_tmpl_html .= '</td></tr>';
             }
             if (isset($images_array[$i]->correct)) {
                 $q_num = $i + 1;
                 $jq_tmpl_html .= '<tr><td align="left">';
                 $jq_tmpl_html .= _JLMS_QUIZ_VIEW_STATISTICS_CI;
                 $jq_tmpl_html .= '</td></tr>';
                 $jq_tmpl_html .= '<tr><td align="center">';
                 $jq_tmpl_html .= '<img src="' . $JLMS_CONFIG->get('live_site') . '/' . $images_array[$i]->correct . '" width="600" height="' . ($count_array[$i]->correct ? $count_array[$i]->correct * 200 : 200) . '" alt="' . $title_array[$i]->correct . '" title="' . $title_array[$i]->correct . '" border=\'0\' /><br />';
                 $jq_tmpl_html .= '</td></tr>';
             }
         }
     }
     $jq_tmpl_html .= "</table>\n";
     return $jq_tmpl_html;
 }
    function showUsers($course_id, $id, $option, &$rows, &$lists, &$pageNav, $u_search, $view_type = 1)
    {
        global $Itemid, $task;
        $JLMS_CONFIG =& JLMSFactory::getConfig();
        $JLMS_ACL =& JLMSFactory::getACL();
        ?>
<script language="javascript" type="text/javascript">
<!--
function submitbutton(pressbutton) {
	var form = document.adminForm;
	if ((pressbutton == 'edit_user' || pressbutton == 'delete_user') && (form.boxchecked.value == "0")){
		alert( "<?php 
        echo _JLMS_USER_SELECT_USER;
        ?>
" );
	} else {
		form.task.value = pressbutton;
		form.submit();
	}
}
//-->
</script>
<?php 
        JLMS_TMPL::OpenMT();
        $hparams = array();
        $toolbar = array();
        $title = '';
        if ($view_type == 1) {
            $title = '&nbsp;' . _JLMS_USERS_TITLE . (isset($rows[0]->ug_name) ? " (" . $rows[0]->ug_name . ")" : '');
        } elseif ($view_type == 2) {
            $title = '&nbsp;' . _JLMS_USERS_ASSISTS_TITLE;
        }
        $toolbar[] = array('btn_type' => 'back', 'btn_js' => sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=course_users&amp;id={$course_id}"));
        JLMS_TMPL::ShowHeader('usergroup', $title, $hparams, $toolbar);
        if ($view_type == 1) {
            JLMS_TMPL::OpenTS();
            echo $lists['groups'];
            JLMS_TMPL::CloseTS();
        }
        JLMS_TMPL::OpenTS();
        $colspan = $view_type == 1 ? 7 : 6;
        ?>
		<form action="<?php 
        echo $JLMS_CONFIG->get('live_site') . "/index.php?option=" . $option . "&amp;Itemid=" . $Itemid;
        ?>
" method="post" name="adminForm">
			<table width="100%" cellpadding="0" cellspacing="0" border="0" class="jlms_table_no_borders">
				<tr>
					<td>
						<input type="text" class="inputbox" name="u_search" value="<?php 
        echo $u_search;
        ?>
" />
						<input type="button" value="Search" onclick="javascript:submitbutton('<?php 
        echo $task;
        ?>
');" />
					</td>
				</tr>
			</table>
			<table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php 
        echo JLMSCSS::_('jlmslist');
        ?>
">
				<tr>
					<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 width="20" class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" align="center">#</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
					<?php 
        if ($view_type == 1) {
            $view_checkbox = 1;
        } else {
            $view_checkbox = 0;
            foreach ($rows as $row) {
                if ($row->roletype_id == 2) {
                    $view_checkbox = 1;
                    break;
                }
            }
        }
        if ($JLMS_ACL->CheckPermissions('users', 'manage') && $view_checkbox) {
            ?>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 width="20" class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" align="center"><input type="checkbox" name="toggle" value="" onclick="checkAll(<?php 
            echo count($rows);
            ?>
);" /></<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<?php 
        } else {
            ?>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 width="20" class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" align="center">&nbsp;</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<?php 
        }
        ?>
					<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
"><?php 
        echo _JLMS_USERS_TBL_HEAD_USERNAME;
        ?>
</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
					<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
"><?php 
        echo _JLMS_USERS_TBL_HEAD_USER_ADDINFO;
        ?>
</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
					<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
"><?php 
        echo _JLMS_TBL_HEAD_USERS_ROLE;
        ?>
</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
				<?php 
        if ($view_type == 1) {
            ?>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" colspan="2" align="center"><?php 
            echo _JLMS_USERS_TBL_HEAD_USER_ACC_PERIOD;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
"><?php 
            echo _JLMS_USERS_TBL_HEAD_USER_COMMENT;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
				<?php 
        } else {
            ?>

				<?php 
        }
        ?>
				</tr>
			<?php 
        $k = 1;
        for ($i = 0, $n = count($rows); $i < $n; $i++) {
            $row = $rows[$i];
            $link = "index.php?option=" . $option . "&amp;Itemid=" . $Itemid . "&amp;task=view_users&amp;course_id=" . $course_id . "&amp;id=" . $row->id;
            $checked = mosHTML::idBox($i, $row->id);
            /*if ($JLMS_ACL->GetTypeofRole($row->role_id) == 2) {
            			$checked = '&nbsp;';
            		} elseif (!$JLMS_ACL->isTeacher()) {
            			$checked = '&nbsp;';
            		}*/
            if (!$JLMS_ACL->CheckPermissions('users', 'manage')) {
                $checked = '&nbsp;';
            }
            if ($row->roletype_id == 2) {
                //Max: no select teachers
                $checked = '&nbsp;';
            }
            if ($row->roletype_id == 5) {
                //Den: do not select assistants who is not in your 'roles assignments' permissions
                $ass_roles = $JLMS_ACL->GetSystemRolesIds(5, true);
                if (is_array($ass_roles) && in_array($row->role_id, $ass_roles)) {
                    //ok
                } else {
                    $checked = '&nbsp;';
                }
            }
            ?>
				<tr class="<?php 
            echo JLMSCSS::_('sectiontableentry' . $k);
            ?>
">
					<td align="center"><?php 
            echo $pageNav->limitstart + $i + 1;
            ?>
</td>
					<td><?php 
            echo $checked;
            ?>
</td>
					<td align="left">
					<?php 
            echo $row->username;
            ?>
					</td>
					<td><?php 
            echo $row->name . "(" . $row->email . ")";
            ?>
</td>
					<td><?php 
            echo $row->lms_usertype;
            ?>
</td>
					<?php 
            if ($view_type == 1) {
                ?>
					<td align="center"><?php 
                echo $row->publish_start ? JLMS_dateToDisplay($row->start_date) : '-';
                ?>
</td>
					<td align="center"><?php 
                echo $row->publish_end ? JLMS_dateToDisplay($row->end_date) : '-';
                ?>
</td>
					<td><?php 
                echo $row->user_add_comment ? $row->user_add_comment : '&nbsp;';
                ?>
</td>
					<?php 
            } else {
                ?>

					<?php 
            }
            ?>
				</tr>
				<?php 
            $k = 3 - $k;
        }
        ?>
				<tr>
					<td colspan="<?php 
        echo $view_type == 1 ? '8' : '5';
        ?>
" align="center" class="<?php 
        echo JLMSCSS::_('jlmslist-footer_td');
        ?>
">
						<div align="center" style="white-space: nowrap;">
						<?php 
        if ($view_type == 1) {
            $link = "index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=view_users&amp;course_id={$course_id}&amp;id={$id}";
        } else {
            $link = "index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=view_assistants&amp;id={$course_id}";
        }
        if ($u_search != '') {
            $link .= '&amp;u_search=' . $u_search;
        }
        echo _PN_DISPLAY_NR . $pageNav->getLimitBox($link) . ' ' . $pageNav->getPagesCounter();
        echo '<br />';
        echo $pageNav->writePagesLinks($link);
        ?>
						</div>
					</td>
				</tr>
			</table>
			<input type="hidden" name="option" value="<?php 
        echo $option;
        ?>
" />
			<input type="hidden" name="Itemid" value="<?php 
        echo $Itemid;
        ?>
" />
			<input type="hidden" name="task" value="<?php 
        echo $task;
        ?>
" />
			<input type="hidden" name="course_id" value="<?php 
        echo $course_id;
        ?>
" />
			<input type="hidden" name="id" value="<?php 
        echo $id;
        ?>
" />
			<input type="hidden" name="boxchecked" value="0" />
			<input type="hidden" name="row_id" value="0" />
			<input type="hidden" name="state" value="0" />
			<input type="hidden" name="utype" value="<?php 
        echo $view_type;
        ?>
" />
		</form>
<?php 
        JLMS_TMPL::CloseTS();
        $link_add = $JLMS_CONFIG->get('live_site') . "/index.php?option=" . $option . "&amp;task=add_user&amp;course_id=" . $course_id . "&amp;id=" . $id . "&amp;Itemid=" . $Itemid . "";
        $link_import = $JLMS_CONFIG->get('live_site') . "/index.php?option=" . $option . "&amp;task=import_users_csv&amp;course_id=" . $course_id . "&amp;id=" . $id . "&amp;Itemid=" . $Itemid . "";
        if ($view_type == 2) {
            $link_add .= '&amp;utype=2';
            $link_import .= '&amp;utype=2';
        }
        $controls = array();
        if ($JLMS_ACL->CheckPermissions('users', 'manage')) {
            $controls[] = array('href' => $link_add, 'title' => _JLMS_USER_ALT_ADDUSER, 'img' => 'adduser');
            $controls[] = array('href' => "javascript:submitbutton('delete_user');", 'title' => _JLMS_USER_ALT_DELUSER, 'img' => 'deluser');
            if ($view_type == 1) {
                $controls[] = array('href' => "javascript:submitbutton('edit_user');", 'title' => _JLMS_USER_ALT_EDITUSER, 'img' => 'edituser');
            }
            if ($JLMS_ACL->CheckPermissions('users', 'import_users')) {
                $controls[] = array('href' => 'spacer');
                $controls[] = array('href' => $link_import, 'title' => _JLMS_USER_IMPORT_TITLE, 'img' => 'csv_import');
            }
        }
        JLMS_TMPL::ShowControlsFooter($controls, sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=course_users&amp;id={$course_id}"));
        JLMS_TMPL::CloseMT();
    }
    function showLPath_MainPage($course_id, $lpath_id, $option, &$lpath_data, &$lpath_contents, &$quizzes_data)
    {
        $JLMS_CONFIG =& JLMSFactory::getConfig();
        $Itemid = $JLMS_CONFIG->get('Itemid');
        $lp_params = new JLMSParameters($lpath_data->lp_params);
        $show_lpath_contents_at_the_left = $lp_params->get('navigation_type', 0) ? true : false;
        $is_quiz = count($quizzes_data) ? true : false;
        $is_drag_drop = false;
        $c_time_limit = 0;
        $inside_lp = 1;
        $c_slide = false;
        //pri starte quiza
        $c_generated_panel = true;
        // Contents of quiz will be generated on 'satrt' action
        $c_slide_update = false;
        $quiz_id = 0;
        foreach ($quizzes_data as $qd) {
            $quiz_id = $qd->c_id;
            foreach ($qd->panel_data as $q) {
                if ($q->c_type == 4) {
                    $is_drag_drop = true;
                    break;
                }
            }
        }
        require_once _JOOMLMS_FRONT_HOME . "/includes/ajax_features.class.php";
        // preloading QUIZ languge (28.02.2007 new method) (all quizzes messages now in global quiz language)
        global $JLMS_LANGUAGE;
        JLMS_require_lang($JLMS_LANGUAGE, 'quiz.lang', $JLMS_CONFIG->get('default_language'));
        require dirname(__FILE__) . '/includes/quiz/quiz_language.php';
        global $jq_language;
        $e = true;
        // enable force echo
        $AF = new JLMS_Ajax_Features();
        $AF->set('c_slide', $c_slide);
        $AF->set('c_generated_panel', $c_generated_panel);
        $AF->set('c_slide_update', $c_slide_update);
        $AF->set('quiz_id', $quiz_id);
        if ($is_quiz) {
            $AF->GetInclude_Msgs($e);
        }
        $AF->JS_open($e);
        $AF->GetFunc_JS_in_array($e);
        $AF->GetFunc_RFE($e);
        if ($is_quiz) {
            $document =& JFactory::getDocument();
            $document->addStyleSheet($JLMS_CONFIG->getCfg('live_site') . '/components/com_joomla_lms/includes/quiz/templates/joomlaquiz_lms_template/jq_template.css');
            echo "function jlms_gotoQuestion(qid) { if (stu_step_type == 5 && user_unique_id && quiz_id) { jlms_SwitchOpenedContents();JQ_gotoQuestionOn(qid);} }";
            $AF->QUIZ_JS_DrDr_Code($e);
            $AF->QUIZ_preloadMsgs($e, $jq_language);
            $AF->QUIZ_doInitialize($e, $JLMS_CONFIG->getCfg('live_site') . "/index.php?tmpl=component&option={$option}&inside_lp={$inside_lp}&Itemid={$Itemid}&jlms=1&task=quiz_ajax_action&id={$course_id}", '');
            /* We must override this func (to reduce JS weigth)
            			$AF->QUIZ_MakeRequest($e); */
            ?>
function jq_MakeRequest(url, do_clear) {
	if (do_clear == 1) {
		jq_showLoading();
	}
	quiz_blocked == 1;
	jlms_MakeRequest('jq_AnalizeRequest', url, 'quiz');
}			
<?php 
            $req_tasks = array('start', 'seek_quest', 'review_start', 'review_next', 'review_finish', 'next', 'no_attempts', 'email_results', 'time_is_up', 'finish', 'results', 'failed');
            $AF->QUIZ_AnalizeRequest($e, 'jq_AnalizeRequest', $req_tasks);
            $AF->QUIZ_releaseblock($e);
            $AF->QUIZ_StartTickTack($e);
            $AF->QUIZ_ContinueTickTack($e);
            //$AF->QUIZ_StartQuizOn($e);
            $AF->QUIZ_StartQuizOn($e);
            $AF->QUIZ_StartQuiz($e);
            $AF->QUIZ_GoToQuestionOn($e);
            $AF->QUIZ_GoToQuestion($e);
            $AF->QUIZ_EmailResults($e);
            $AF->QUIZ_StartReview($e);
            $AF->QUIZ_ReviewNext($e);
            $AF->QUIZ_ReviewPrev($e);
            $AF->QUIZ_Check_selectRadio($e);
            $AF->QUIZ_Check_selectCheckbox($e);
            $AF->QUIZ_Check_valueItem($e);
            $AF->QUIZ_QuizNextOn($e);
            $toolbar = array();
            $toolbar[] = array('btn_type' => 'quiz_ok', 'btn_js' => "javascript:jq_QuizNextOn(); void(0);");
            if ($inside_lp && !$show_lpath_contents_at_the_left) {
                $toolbar[] = array('btn_type' => 'contents', 'btn_js' => "javascript:ajax_action('contents_lpath');");
            } else {
                if ($c_slide && !$show_lpath_contents_at_the_left) {
                    $toolbar[] = array('btn_type' => 'contents', 'btn_js' => "javascript:jq_ShowPanel();");
                }
            }
            $m_str_no_skip = JLMS_ShowToolbar($toolbar);
            //8.10.08 - (Max) - dva toolbars dlia skip i standart
            $toolbar = array();
            $toolbar[] = array('btn_type' => 'quiz_ok', 'btn_js' => "javascript:jq_QuizNextOn(); void(0);");
            $toolbar[] = array('btn_type' => 'skip', 'btn_js' => "javascript:JQ_gotoQuestion(__skip__);void(0);");
            if ($inside_lp && !$show_lpath_contents_at_the_left) {
                $toolbar[] = array('btn_type' => 'contents', 'btn_js' => "javascript:ajax_action('contents_lpath');");
            } else {
                if ($c_slide && !$show_lpath_contents_at_the_left) {
                    $toolbar[] = array('btn_type' => 'contents', 'btn_js' => "javascript:jq_ShowPanel();");
                }
            }
            $m_str_skip = JLMS_ShowToolbar($toolbar);
            $AF->QUIZ_QuizContinue($e, $m_str_no_skip, $m_str_skip);
            $cf_url = "'&atask=finish_stop&quiz='+quiz_id+'&stu_quiz_id='+stu_quiz_id";
            $AF->QUIZ_QuizContinueFinish($e, $cf_url);
            $toolbar = array();
            $toolbar[] = array('btn_type' => 'quiz_ok', 'btn_js' => "javascript:jq_QuizNextOn(); void(0);");
            if ($inside_lp && !$show_lpath_contents_at_the_left) {
                $toolbar[] = array('btn_type' => 'contents', 'btn_js' => "javascript:ajax_action('contents_lpath');");
            } else {
                if ($c_slide && !$show_lpath_contents_at_the_left) {
                    $toolbar[] = array('btn_type' => 'contents', 'btn_js' => "javascript:jq_ShowPanel();");
                }
            }
            $m_str = JLMS_ShowToolbar($toolbar);
            $AF->QUIZ_QuizBack($e, $m_str);
            $AF->QUIZ_Next($e);
            $AF->QUIZ_showLoading($e);
            /*
            			$AF->QUIZ_UpdateTaskDiv_htm($e);
            			$AF->QUIZ_UpdateTaskDiv($e, $c_slide);*/
            // We must override task div functionality for quiz
            ?>
function jq_UpdateTaskDiv_htm(htm_txt) {
	getObj('jlms_lpath_menu').innerHTML = htm_txt;
}
function jq_UpdateTaskDiv(task) {

	switch (task) {
		case 'start':
			getObj('jlms_lpath_menu').innerHTML = jq_StartButton('jq_StartQuizOn()', mes_quiz_start);
		break;
		case 'next':
			getObj('jq_quest_num_container').innerHTML = mes_quest_number.replace("{X}", cur_quest_num).replace("{Y}", quiz_count_quests);
			getObj('jq_quest_num_container').style.visibility = "visible";
			getObj('jq_points_container').innerHTML = mes_quest_points.replace("{X}", cur_quest_score);
			getObj('jq_points_container').style.visibility = "visible";
			<?php 
            if ($JLMS_CONFIG->get('quiz_progressbar', 0) == 1) {
                ?>
			if (getObj('progress_bar')) { getObj('progress_bar').style.display = "block"; }
			<?php 
            }
            ?>
		break;
		case 'review_next':
			getObj('jq_quest_num_container').innerHTML = mes_quest_number.replace("{X}", cur_quest_num).replace("{Y}", quiz_count_quests);
			getObj('jq_quest_num_container').style.visibility = "visible";
			getObj('jq_points_container').innerHTML = mes_quest_points.replace("{X}", cur_quest_score);
			getObj('jq_points_container').style.visibility = "visible";
		break;
		case 'continue':
			<?php 
            if ($JLMS_CONFIG->get('quiz_progressbar', 0) == 1) {
                ?>
			if (getObj('progress_bar')) { getObj('progress_bar').style.display = "block"; }
			<?php 
            }
            ?>
		break;
		case 'continue_finish':
			<?php 
            if ($JLMS_CONFIG->get('quiz_progressbar', 0) == 1) {
                ?>
			if (getObj('progress_bar')) { getObj('progress_bar').style.display = "block"; }
			<?php 
            }
            ?>
		break;
		case 'finish':
			getObj('jlms_lpath_menu').innerHTML = lp_menu_item_contents;
			getObj('jq_quest_num_container').style.visibility = 'hidden';
			getObj('jq_points_container').style.visibility = 'hidden';
			<?php 
            if ($JLMS_CONFIG->get('quiz_progressbar', 0) == 1) {
                ?>
			if (getObj('progress_bar')) { getObj('progress_bar').style.display = "none"; }
			<?php 
            }
            ?>
		break;
		case 'clear':
			getObj('jlms_lpath_menu').innerHTML = '';
			getObj('jq_quest_num_container').style.visibility = 'hidden';
			getObj('jq_points_container').style.visibility = 'hidden';
		break;
	}
<?php 
            if ($c_slide) {
                ?>
	
	if (result_is_shown == 1) { jq_ShowPanel(); }
<?php 
            }
            ?>
}
<?php 
            $AF->QUIZ_NextButton($e);
            $AF->QUIZ_ContinueButton($e);
            $AF->QUIZ_StartButton($e);
            $AF->QUIZ_BackButton($e);
            if ($c_slide) {
                $AF->QUIZ_ShowPanel_go($e);
                $AF->QUIZ_HidePanel_go($e);
                $AF->QUIZ_ShowPanel($e);
            }
        }
        $AF->GetFunc_JS_URLencode($e);
        $AF->GetFunc_JS_TRIM_str($e);
        $AF->JS_close($e);
        $lpc_btn = $AF->Get_LPContents_btn(false);
        $toolbar = array();
        $toolbar[] = array('btn_type' => 'next', 'btn_js' => "javascript:ajax_action('next_lpathstep');");
        if (!$show_lpath_contents_at_the_left) {
            $toolbar[] = array('btn_type' => 'contents', 'btn_js' => "javascript:ajax_action('contents_lpath');");
        }
        $rs = JLMS_ShowToolbar($toolbar);
        $rs = str_replace('"components/com_joomla_lms', '"' . $JLMS_CONFIG->getCfg('live_site') . '/components/com_joomla_lms', $rs);
        $lpc_btn = str_replace('/', '\\/', str_replace('"', "\\\"", $rs));
        ?>
<script language="javascript" type="text/javascript">
<!--//--><![CDATA[//><!--
var timer_KeepAL = 990066;
<?php 
        /* variable timer_keepAl was added 21.08.2007 - for keeping joomla session whilst SCORM playing */
        ?>
var lp_menu_item_contents = "<?php 
        echo $lpc_btn;
        ?>
";
var jlms_contents_visible = 0;
var jlms_contents_visible_only = 0;
var jlms_lpath = <?php 
        echo $lpath_id;
        ?>
;
var jlms_course = <?php 
        echo $course_id;
        ?>
;
function ajax_action(pressbutton) {
	if ((jlms_blocked == 1) && (pressbutton != 'contents_lpath') && (pressbutton != 'get_document')) {
		if (jlms_allow_pending_task == 1) {
			if (jlms_is_pending_task == 0) {
				jlms_is_pending_task = 1;
				jlms_pending_task = pressbutton;
			}
		}
	} else {
		jlms_blocked = 1;
		if ((pressbutton != 'contents_lpath') && (pressbutton != 'get_document')) {
			$('jlms_lpath_completion_msg_container').setStyles({visibility: 'hidden',display: 'none'});
		}
		switch (pressbutton) {
			case 'lpath_restart':
<?php 
        if (!$show_lpath_contents_at_the_left) {
            ?>
				jlms_SwitchOpenedContents();
<?php 
        }
        ?>
				jlms_MakeRequest('jlms_AnalizeRequest', '&action=restart_lpath&id='+jlms_lpath, 'lpath');
			break;
			case 'start_lpath':
<?php 
        if (!$show_lpath_contents_at_the_left) {
            ?>
				jlms_SwitchOpenedContents();
<?php 
        }
        ?>
				jlms_MakeRequest('jlms_AnalizeRequest', '&action=start_lpath&id='+jlms_lpath, 'lpath');
			break;
			case 'next_lpathstep':
<?php 
        if (!$show_lpath_contents_at_the_left) {
            ?>
				jlms_SwitchOpenedContents();
<?php 
        }
        ?>
				jlms_MakeRequest('jlms_AnalizeRequest', '&action=next_lpathstep&id='+jlms_lpath+'&step_id='+stu_step_id, 'lpath');
			break;
			case 'prev_lpathstep':
<?php 
        if (!$show_lpath_contents_at_the_left) {
            ?>
				jlms_SwitchOpenedContents();
<?php 
        }
        ?>
				jlms_MakeRequest('jlms_AnalizeRequest', '&action=prev_lpathstep&id='+jlms_lpath+'&step_id='+stu_step_id, 'lpath');
			break;
			case 'lpath_seek':
<?php 
        if (!$show_lpath_contents_at_the_left) {
            ?>
				jlms_SwitchOpenedContents();
<?php 
        }
        ?>
				jlms_MakeRequest('jlms_AnalizeRequest', '&action=seek_lpathstep&id='+jlms_lpath+'&step_id='+seek_step_id, 'lpath');
			break;
			case 'contents_lpath':
				jlms_blocked = 0;
<?php 
        if (!$show_lpath_contents_at_the_left) {
            ?>
				jlms_SwitchContents();
<?php 
        } else {
            ?>
				jlms_SwitchContents2();
<?php 
        }
        ?>
			break;
			case 'get_document':
				jlms_blocked = 0;
				/*window.open('index.php?tmpl=component&no_html=1&option=<?php 
        echo $option;
        ?>
&Itemid=<?php 
        echo $Itemid;
        ?>
&task=show_lpath&action=get_lpath_doc&user_unique_id=' + user_unique_id +'&user_start_id='+user_start_id+'&id='+jlms_lpath+'&course_id='+jlms_course+'&doc_id='+get_doc_id+'&step_id='+stu_step_id
				,null,"height=200,width=400,status=yes,toolbar=no,menubar=no,location=no");*/
				window.location.href = '<?php 
        echo $JLMS_CONFIG->getCfg('live_site');
        ?>
/index.php?tmpl=component&no_html=1&option=<?php 
        echo $option;
        ?>
&Itemid=<?php 
        echo $Itemid;
        ?>
&task=show_lpath&action=get_lpath_doc&user_unique_id=' + lp_user_unique_id +'&user_start_id='+user_start_id+'&id='+jlms_lpath+'&course_id='+jlms_course+'&doc_id='+get_doc_id+'&step_id='+stu_step_id;
				//return true;
				void(0);
			break;
			default:
				jlms_blocked = 0;
			break;
		}
	}
}
<?php 
        if (JLMS_mootools12()) {
            $fxFunc = 'Tween';
        } else {
            $fxFunc = 'Style';
        }
        $additon_js = '
var mySlide_contents2;
var mySlide_contents2_width_start = 0;
var mySlide_contents2_width_end = 0;
var mySlide_contents3;
var mySlide_contents2_mode = 2;
var mySlide_contents3_margin_start = 0;
var mySlide_contents3_margin_end = 10;
var mySlide_contents4;
var winScroller2 = new Fx.Scroll(window);
function jlms_prepare_el_mySlide_contents2() {
	mySlide_contents2 = new Fx.' . $fxFunc . '(\'jlms_lpath_contents_container\', \'width\');
	mySlide_contents2_width_start = $(\'jlms_lpath_contents_container\').getStyle(\'width\');
	mySlide_contents3_margin_start = $(\'jlms_lpath_descr\').getStyle(\'margin-left\');
	mySlide_contents3 = new Fx.' . $fxFunc . '(\'jlms_lpath_descr\', \'margin-left\');
	mySlide_contents4 = new Fx.' . $fxFunc . '(\'jlms_lpath_completion_msg_container\', \'margin-left\');
	$(\'jlms_lpath_completion_msg_container\').setStyles({\'margin-left\': \'0\'});
	$(\'jlms_lpath_descr\').setStyles({\'margin-left\': \'0\'});
	//mySlide_contents2.hide();
	//$(\'jlms_lpath_contents_container\').setStyles({visibility: \'visible\',display: \'\'});
}
function jlms_SwitchContents2() {
	if (mySlide_contents2_mode == 2) {
		$(\'jlms_lpath_contents_container\').setStyles({visibility: \'visible\',display: \'\'});
		mySlide_contents2.start(0, mySlide_contents2_width_start);
		mySlide_contents3.start(0, mySlide_contents3_margin_start);
		mySlide_contents4.start(0, mySlide_contents3_margin_start);
		mySlide_contents2_mode = 1;
		$(\'left_nav_collapser_container\').setStyles({visibility: \'visible\',display: \'\'});
	} else if (mySlide_contents2_mode == 1) {
		mySlide_contents2.start(mySlide_contents2_width_end);
		mySlide_contents3.start(mySlide_contents3_margin_end);
		mySlide_contents4.start(mySlide_contents3_margin_end);
		$(\'left_nav_collapser_container\').setStyles({visibility: \'hidden\',display: \'none\'});
		mySlide_contents2_mode = 0;
	} else {
		$(\'jlms_lpath_contents_container\').setStyles({visibility: \'visible\',display: \'\'});
		mySlide_contents2.start(mySlide_contents2_width_start);
		mySlide_contents3.start(mySlide_contents3_margin_start);
		mySlide_contents4.start(mySlide_contents3_margin_start);
		mySlide_contents2_mode = 1;
		$(\'left_nav_collapser_container\').setStyles({visibility: \'visible\',display: \'\'});
	}
}
';
        if (JLMS_mootools12()) {
            $setHTML = 'set(\'html\',';
        } else {
            $setHTML = 'setHTML(';
        }
        $JLMS_CONFIG->set('jlms_aditional_js_code', $JLMS_CONFIG->get('jlms_aditional_js_code', '') . $additon_js);
        $domready = '
jlms_prepare_el_mySlide_contents2();
';
        $JLMS_CONFIG->set('web20_domready_code', $JLMS_CONFIG->get('web20_domready_code', '') . $domready);
        ?>


<?php 
        if ($JLMS_CONFIG->get('web20_effects', true) && !$show_lpath_contents_at_the_left) {
            $additon_js = '
var mySlide_contents;
function jlms_prepare_el_mySlide_contents() {
	mySlide_contents = new Fx.Slide(\'jlms_lpath_contents_container\');
	mySlide_contents.hide();
	$(\'jlms_lpath_contents_container\').setStyles({visibility: \'visible\',display: \'\'});
}
';
            $JLMS_CONFIG->set('jlms_aditional_js_code', $JLMS_CONFIG->get('jlms_aditional_js_code', '') . $additon_js);
            $domready = '
jlms_prepare_el_mySlide_contents();
';
            $JLMS_CONFIG->set('web20_domready_code', $JLMS_CONFIG->get('web20_domready_code', '') . $domready);
            ?>

function jlms_SwitchOpenedContents() {
	if ($defined(mySlide_contents)) {
		var type = typeof mySlide_contents;
		if (type == 'object') {
			mySlide_contents.hide();
		}
	} else {
		jlms_prepare_el_mySlide_contents();
	}
}
function jlms_SwitchContentsOnly(par) {
	if (par == 'show') {
		mySlide_contents.slideIn();
	} else {
		mySlide_contents.hide();
	}
}
function jlms_SwitchContents() {
	mySlide_contents.toggle();
}
<?php 
        } elseif ($show_lpath_contents_at_the_left) {
            ?>
function jlms_SwitchOpenedContents() {
	jlms_SwitchContents();
}
function jlms_SwitchContentsOnly(par) {
	if (par == 'show') {
		if (jlms_contents_visible == 1) {
			
		} else {
			var vis_style1 = 'visible';
			var disp_style1 = '';
			var jlcc = getObj('jlms_lpath_contents_container');
			jlcc.style.visibility = vis_style1;
			jlcc.style.display = disp_style1;
		}
	}
}
function jlms_SwitchContents() {
	if (jlms_contents_visible == 1) {
		
	} else {
		var vis_style1 = 'visible';
		var disp_style1 = '';
		var vis_style2 = 'visible';
		var disp_style2 = '';
		var jlcc = getObj('jlms_lpath_contents_container');
		var jldc = getObj('jlms_lpath_descr');
		jlcc.style.visibility = vis_style1;
		jlcc.style.display = disp_style1;
		jldc.style.visibility = vis_style2;
		jldc.style.display = disp_style2;
		if (jlms_contents_visible == 1) { jlms_contents_visible = 0;}
		else { jlms_contents_visible = 1; }
	}
}
<?php 
        } else {
            ?>
function jlms_SwitchOpenedContents() {
	if (jlms_contents_visible == 1) {
		jlms_SwitchContents();
	}
}
function jlms_SwitchContentsOnly(par) {
	if (par == 'show') {
		var vis_style1 = 'visible';
		var disp_style1 = '';
	} else {
		var vis_style1 = 'hidden';
		var disp_style1 = 'none';
	}
	var jlcc = getObj('jlms_lpath_contents_container');
	jlcc.style.visibility = vis_style1;
	jlcc.style.display = disp_style1;
}
function jlms_SwitchContents() {
	var vis_style1 = 'visible';
	var disp_style1 = '';
	var vis_style2 = 'hidden';
	var disp_style2 = 'none';
	if (jlms_contents_visible == 1) {
		var vis_style2 = 'visible';
		var disp_style2 = '';
		var vis_style1 = 'hidden';
		var disp_style1 = 'none';
	}
	var jlcc = getObj('jlms_lpath_contents_container');
	var jldc = getObj('jlms_lpath_descr');
	jlcc.style.visibility = vis_style1;
	jlcc.style.display = disp_style1;
	jldc.style.visibility = vis_style2;
	jldc.style.display = disp_style2;
	if (jlms_contents_visible == 1) { jlms_contents_visible = 0;}
	else { jlms_contents_visible = 1; }
}
<?php 
        }
        ?>
function jlms_SwitchContentsOnly2(par) {
	if (par == 'show') {
		mySlide_contents2.slideIn();
	} else {
		mySlide_contents2.hide();
	}
}
var stu_step_id = 0;
var stu_last_cur_id = 0;
var stu_step_type = 0;
var jlms_blocked = 0;
var jlms_is_pending_task = 0;
var jlms_pending_task = '';
var jlms_allow_pending_task = 1;
var seek_step_id = 0;
var get_doc_id = 0;
var lp_url_prefix = '<?php 
        echo $JLMS_CONFIG->get('live_site');
        ?>
/index.php?option=<?php 
        echo $option;
        ?>
&Itemid=<?php 
        echo $Itemid;
        ?>
';
var lp_user_unique_id = '';
var user_start_id = 0;
var mCfg_live_site = '';
function jlms_MakeRequest(onstate, url, mr_type) {
	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() { eval(onstate+'(http_request);') };
	var lp_url_prefix2 = '';
	var post_target = '<?php 
        echo $JLMS_CONFIG->get('live_site');
        ?>
/index.php?jlms=1';
	if (mr_type == 'lpath') {
		jlms_blocked == 1;
		jlms_showLoading();
		lp_url_prefix2 = 'jlms=1&option=<?php 
        echo $option;
        ?>
&Itemid=<?php 
        echo $Itemid;
        ?>
&task=show_lpath&user_unique_id=' + lp_user_unique_id +'&user_start_id='+user_start_id+'&id='+jlms_lpath+'&course_id='+jlms_course;
		post_target = mCfg_live_site + lp_url_prefix;
	} else if (mr_type == 'quiz'){
		lp_url_prefix2 = 'user_unique_id=' + user_unique_id + '&lp_user_unique_id=' + lp_user_unique_id +'&user_start_id='+user_start_id+'&lpath_id='+jlms_lpath+'&step_id='+stu_step_id;
		post_target = mCfg_live_site + url_prefix;
	}
	//http_request.open('GET', mCfg_live_site + lp_url_prefix + lp_url_prefix2 + url, true);
	//http_request.send(null);
	http_request.open("POST", post_target, false);
	http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	http_request.setRequestHeader("Content-length", lp_url_prefix2.length + url.length);
	//http_request.setRequestHeader("Connection", "close"); - if close - bug in IE7 - it hungs up
	http_request.send(lp_url_prefix2 + url);
	if (mr_type == 'lpath') {
		jlms_allow_pending_task = 0;
	}
}
function jlms_AnalizeRequest(http_request) {
	if (http_request.readyState == 4) {
		if ((http_request.status == 200)) {
			jlms_WStatus('');
			
			if(http_request.responseXML.documentElement == null){
				try {
					//alert(http_request.responseXML.parseError.reason);
					http_request.responseXML.loadXML(http_request.responseText)
				} catch (e) {
					/*alert("Can't load");*/
				}
			}
			response = http_request.responseXML.documentElement;
			var task = jlms_RFE(response,'task');
			jlms_blocked = 1;
			jlms_allow_pending_task = 1;
			setTimeout("jlms_releaseBlock()", 1000);
<?php 
        if (!$show_lpath_contents_at_the_left) {
            ?>
			jlms_SwitchOpenedContents();
<?php 
        }
        ?>
			switch (task) {
				case 'start_restart':
				case 'start':
					if ($('joomlalms_sys_message_container')) {
		                //hide course enrollment message (if autoredirect to lpath enabled)
		                $('joomlalms_sys_message_container').setStyles({visibility: 'hidden',display: 'none'});
					}
					lp_user_unique_id = jlms_RFE(response,'user_unique_id');
					user_start_id = jlms_RFE(response,'user_start_id');
					stu_step_type = jlms_RFE(response,'step_type');
					if (stu_step_type == 5) {
						quiz_blocked = 0;
						timer_sec = 0;
						stop_timer = 0;
						quiz_id = jlms_RFE(response,'step_item_id');
					}
					prev_step_type = stu_step_type;
					stu_step_id = jlms_RFE(response,'step_id');
					stu_last_cur_id = stu_step_id;
					prev_step_id = stu_step_id;
					jlms_ChangeFrontPage(response);
					if (task == 'start_restart') {
						$('jlms_lpath_completion_msg_container').setStyles({visibility: 'hidden',display: 'none'});
						jlms_setPendingSteps('cancel',response);
						jlms_setPendingSteps('quiz',response);
					}
					jlms_setPendingSteps('pending',response);
					jlms_setPendingSteps('accept',response);
				break;
				case 'restart':
					$('jlms_lpath_completion_msg_container').setStyles({visibility: 'hidden',display: 'none'});
					jlms_ChangeFrontPage(response);
					getObj('jlms_lpath_contents').innerHTML = jlms_RFE(response,'contents_data');
					jlms_setPendingSteps('pending',response);
				break;
				case 'check_cond':
					lp_user_unique_id = jlms_RFE(response,'user_unique_id');
					user_start_id = jlms_RFE(response,'user_start_id');	
				
					//stu_step_id = jlms_RFE(response,'step_id');
					//prev_step_id = stu_step_id;
					jlms_ChangeFrontPage(response);
					jlms_changePendingSteps();
					//jlms_setPendingSteps('pending',response);
					jlms_setPendingSteps('accept',response);
				break;
				case 'seek_step':
				case 'next_step':
					user_unique_id = '';
					quiz_id = 0;
					stu_step_type = jlms_RFE(response,'step_type');
					if (stu_step_type == 5) {
						quiz_id = jlms_RFE(response,'step_item_id');
					}
					prev_step_type = stu_step_type;
					stu_step_id = jlms_RFE(response,'step_id');
					prev_step_id = stu_step_id;
					jlms_ChangeFrontPage(response);
					jlms_setPendingSteps('pending',response);
					jlms_setPendingSteps('accept',response);
				break;
				case 'finish_lpath_quick':// without break;
					lp_user_unique_id = jlms_RFE(response,'user_unique_id');
					user_start_id = jlms_RFE(response,'user_start_id');
				case 'finish_lpath':
					jlms_ChangeFrontPage(response);

					var is_show_cmsg = jlms_RFE(response,'show_completion_msg');
					if (is_show_cmsg == 1 || is_show_cmsg == '1') {
						var cmsg_txt = jlms_RFE(response,'lpath_completion_msg');
						$('jlms_lpath_completion_msg_container').<?php 
        echo $setHTML;
        ?>
cmsg_txt);
						$('jlms_lpath_completion_msg_container').setStyles({visibility: 'visible',display: ''});
					}

					jlms_setPendingSteps('accept',response);
<?php 
        if (!$show_lpath_contents_at_the_left) {
            ?>
					jlms_SwitchContentsOnly('show');
<?php 
        }
        ?>
				break;
				case 'failed':
					getObj('jlms_lpath_descr').innerHTML = '<div class="joomlalms_sys_message"><?php 
        echo str_replace('/', '\\/', _JLMS_LPATH_LOAD_DATA_ERROR);
        ?>
<\/div>';
					//getObj('jlms_lpath_menu').innerHTML = jlms_RFE(response,'menu_contents');
				break;
				default:
					getObj('jlms_lpath_descr').innerHTML = '<div class="joomlalms_sys_message"><?php 
        echo str_replace('/', '\\/', _JLMS_LPATH_LOAD_DATA_ERROR);
        ?>
<\/div>';
					getObj('jlms_lpath_menu').innerHTML = '';
				break;
			}
		} else {
			alert('Bad Request status');
		}
	}
}
function jlms_RFE(response,elem_name) {
	return response.getElementsByTagName(''+elem_name)[0].firstChild ? response.getElementsByTagName(''+elem_name)[0].firstChild.data : 0;
}
var is_collapser_timer = 0;
<?php 
        echo JLMSCSS::h2_js();
        //JLMSCSS_h2_js function
        ?>
function jlms_ChangeFrontPage(response) {
	var head_data = jlms_RFE(response,'step_name');
	if (head_data != '') {
		getObj('jlms_lpath_head').innerHTML = JLMSCSS_h2_js(head_data);
	}
	var tmp_div = document.createElement("div");
	tmp_div.id = 'temporary_div_tst';
	tmp_div.innerHTML = jlms_RFE(response,'step_descr');
	tmp_div.style.width = '100%';
	getObj('jlms_lpath_descr').innerHTML = '';
	getObj('jlms_lpath_descr').appendChild(tmp_div);

	//getObj('jlms_lpath_descr').innerHTML = jlms_RFE(response,'step_descr');
	getObj('jlms_lpath_menu').innerHTML = jlms_RFE(response,'menu_contents');
	var temp_script = jlms_RFE(response,'step_exec_script');
	if (temp_script == 1 || temp_script == '1') {
		var exec_script = jlms_RFE(response,'step_exec_script_contents');
		var new_script_el = document.createElement("script");
		new_script_el.text = exec_script;
		new_script_el.type="text/javascript";
		document.getElementsByTagName("head")[0].appendChild(new_script_el);
		//eval(exec_script);
	}
<?php 
        if ($show_lpath_contents_at_the_left) {
            ?>
	jlms_ChangeCollapserHeight(0);
<?php 
        }
        ?>
	if (window.set_height) {
		set_height();
	}
	jlms_ScrollBrowserWindow();
	setTimeout("jlms_ScrollBrowserWindow()", 300);
}
function jlms_ScrollBrowserWindow() {
	window.scrollTo(0,$('jlms_topdiv').getTop());
}
function jlms_ChangeCollapserHeight(by_timer) {
	var leftnav_h, main_st_h = 0;
	leftnav_h = $('jlms_lpath_contents_container').getStyle('height').toInt();
	main_st_h = $('jlms_lpath_descr').getStyle('height').toInt();
	if (leftnav_h < main_st_h) {
		leftnav_h = main_st_h;
	}
	$('left_nav_collapser_container').setStyle('height', leftnav_h+'px');
	if (is_collapser_timer == 1) {
		if (by_timer == 1) {
			setTimeout("jlms_ChangeCollapserHeight(1)", 300);
		}
	} else {
		is_collapser_timer = 1;
		setTimeout("jlms_ChangeCollapserHeight(1)", 300);
	}
}
function jlms_releaseBlock() {
	jlms_blocked = 0;
	if (jlms_is_pending_task == 1) {
		if (jlms_pending_task != '') {
			jlms_is_pending_task = 0;
			eval("ajax_action('"+jlms_pending_task+"')");
			jlms_pending_task = '';
		}
	}
}
function jlms_showLoading() {
	jlms_SwitchContentsOnly('hide');
	getObj('jlms_lpath_descr').innerHTML = '<br \/><br \/><center><img src="<?php 
        echo str_replace('/', '\\/', $JLMS_CONFIG->get('live_site'));
        ?>
\/components\/com_joomla_lms\/lms_images\/loading.gif" height="32" width="32" border="0" alt="loading" \/><\/center>';
}
function jlms_setPendingSteps(step_type, response) {
	var st = 'pending_steps';
	var prfx = 'jlms_step_';
	var is_lp = true;
	switch (step_type) {
		case 'pending': st = 'pending_steps'; break;
		case 'accept': st = 'completed_steps'; break;
		case 'cancel': st = 'incompleted_steps'; break;
		case 'quiz': st = 'incompleted_quests'; prfx = 'quest_result_'; is_lp = false; break;
	}
	if (is_lp) {
		var steps_ids;
		steps_ids = jlms_RFE(response,st);
		var arr = steps_ids.split(',');
		var i = 0;
		while (i < arr.length ) {
			if (getObj(prfx+arr[i])) {
				getObj(prfx+arr[i]).innerHTML = '<img class=\'JLMS_png\' src="<?php 
        echo $JLMS_CONFIG->get('live_site');
        ?>
/components/com_joomla_lms/lms_images/toolbar/btn_'+step_type+'.png" height="16" width="16" border="0" alt="'+step_type+'" />';
			}
			i ++;
		}
		if (step_type == 'pending') {
			var r = getObj(prfx+stu_step_id);
			if (r) {r.innerHTML = '<img class=\'JLMS_png\' src="<?php 
        echo $JLMS_CONFIG->get('live_site');
        ?>
/components/com_joomla_lms/lms_images/toolbar/btn_'+step_type+'_cur.png" height="16" width="16" border="0" alt="'+step_type+'" />';}
			if (stu_last_cur_id != stu_step_id) {
				r = getObj(prfx+stu_last_cur_id);
				if (r) {r.innerHTML = '<img class=\'JLMS_png\' src="<?php 
        echo $JLMS_CONFIG->get('live_site');
        ?>
/components/com_joomla_lms/lms_images/toolbar/btn_'+step_type+'.png" height="16" width="16" border="0" alt="'+step_type+'" />';}
			}
			stu_last_cur_id = stu_step_id;
		}
	} else {
		var steps_ids;
		steps_ids = jlms_RFE(response,st);
		var arr = steps_ids.split(',');
		var i = 0;
		while (i < arr.length ) {
			if (getObj(prfx+arr[i])) {
				getObj(prfx+arr[i]).innerHTML = '-';
			}
			i ++;
		}
	}
}
function jlms_changePendingSteps() {
	r = getObj('jlms_step_'+stu_last_cur_id);
	if (r) {r.innerHTML = '<img class=\'JLMS_png\' src="<?php 
        echo $JLMS_CONFIG->get('live_site');
        ?>
/components/com_joomla_lms/lms_images/toolbar/btn_pending.png" height="16" width="16" border="0" alt="pending" />';}
}
JLMS_preloadImages('<?php 
        echo $JLMS_CONFIG->getCfg('live_site');
        ?>
/components/com_joomla_lms/lms_images/loading.gif','<?php 
        echo $JLMS_CONFIG->getCfg('live_site');
        ?>
/components/com_joomla_lms/lms_images/buttons/btn_back.png','<?php 
        echo $JLMS_CONFIG->getCfg('live_site');
        ?>
/components/com_joomla_lms/lms_images/buttons/btn_restart.png', '<?php 
        echo $JLMS_CONFIG->getCfg('live_site');
        ?>
/components/com_joomla_lms/lms_images/toolbar/btn_pending.png', '<?php 
        echo $JLMS_CONFIG->getCfg('live_site');
        ?>
/components/com_joomla_lms/lms_images/toolbar/btn_accept.png');
//--><!]]>
</script>
<?php 
        JLMS_TMPL::OpenMT();
        $hparams = array();
        //$toolbar = array();
        //$toolbar[] = array('btn_type' => 'start', 'btn_js' => "javascript:ajax_action('start_lpath');");
        JLMS_TMPL::ShowHeader('lpath', '', $hparams);
        //JLMS_TMPL::ShowToolbar($toolbar, 'right', true, $lpath_data->lpath_name, 2);
        //JLMS_TMPL::CloseMT();
        JLMS_TMPL::OpenTS();
        ?>
		<table width="100%" cellpadding="0" cellspacing="0" border="0" class="jlms_table_no_borders">
			<tr>
				<td align="left" valign="middle" id="jlms_lpath_head" width="100%">
					<?php 
        echo JLMSCSS::h2($lpath_data->lpath_name);
        ?>
				</td>
				<td align="right" style="text-align:right " valign="middle" id="jlms_lpath_menu">
					<?php 
        $toolbar = array();
        $toolbar[] = array('btn_type' => 'start', 'btn_js' => "javascript:void(0);");
        //$toolbar[] = array('btn_type' => 'start', 'btn_js' => sefrelToAbs("index.php?option=$option&amp;Itemid=$Itemid&amp;task=show_lpath_nojs&amp;course_id=$course_id&amp;id=$lpath_id&amp;action=start_lpath"));
        //no-js functionality commented (version 1.1.0) due to the lots of bugs, lack of usage/testing
        echo JLMS_ShowToolbar($toolbar);
        ?>
				</td>
			</tr>
		</table>
<?php 
        JLMS_TMPL::CloseTS();
        JLMS_TMPL::OpenTS();
        $toolbar = array();
        $toolbar[] = array('btn_type' => 'start', 'btn_js' => "javascript:ajax_action('start_lpath');");
        $rs = JLMS_ShowToolbar($toolbar);
        $rs = str_replace('"components/com_joomla_lms', '"' . $JLMS_CONFIG->getCfg('live_site') . '/components/com_joomla_lms', $rs);
        $lpc_btn = str_replace('/', '\\/', str_replace('"', "\\\"", $rs));
        $additon_js = '
var lp_menu_item_contents_pre = "' . $lpc_btn . '";
';
        $JLMS_CONFIG->set('jlms_aditional_js_code', $JLMS_CONFIG->get('jlms_aditional_js_code', '') . $additon_js);
        $domready = '
$(\'jlms_lpath_menu\').innerHTML = lp_menu_item_contents_pre;

if (document.constructor) {
	document.constructor.prototype.write = function() { };
} else {
	document.write = function() { };
}
';
        $JLMS_CONFIG->set('web20_domready_code', $JLMS_CONFIG->get('web20_domready_code', '') . $domready);
        if ($show_lpath_contents_at_the_left) {
            ?>
		<div id="jlms_lpath_contents_container" style="visibility:hidden; display:none; width:203px; float:left; overflow-x:hidden; margin-right: -1px">
		<?php 
            global $JLMS_CONFIG;
            $JLMS_CONFIG->set('show_lpath_contents_at_the_left', $show_lpath_contents_at_the_left);
            ?>

			<?php 
            JLMS_course_lpathstu_html::showLPath_contents($lpath_contents, $quizzes_data);
            ?>
<br />
		</div>
		<div id="left_nav_collapser_container" style="width:7px; float:left; overflow-x:hidden; visibility:hidden; display:none ">
			<a id="left_nav_collapser" href="javascript:jlms_SwitchContents2();"><img class="collapse_button_maximized_xxx" border="1" width="1" height="1" src="<?php 
            echo $JLMS_CONFIG->get('live_site');
            ?>
/components/com_joomla_lms/lms_images/spacer.png"/></a>
		</div>
		<div id="jlms_lpath_completion_msg_container" class="jlms_lpath_completion_message" style="visibility:hidden; display:none; margin-left:210px; width:auto;">
			<!--x-->
		</div>
		<div id="jlms_lpath_descr" style="margin-left:210px; width:auto;">
			<?php 
            $text = JLMS_ShowText_WithFeatures($lpath_data->lpath_description);
            echo $text;
            ?>
		</div>
		<br />
<?php 
        } else {
            ?>
		<div id="jlms_lpath_completion_msg_container" class="jlms_lpath_completion_message" style="visibility:hidden; display:none">
			<!--x-->
		</div>
		<div id="jlms_lpath_contents_container" style="visibility:hidden; display:none; width:100%">
			<?php 
            JLMS_course_lpathstu_html::showLPath_contents($lpath_contents, $quizzes_data);
            ?>
<br />
		</div>
		<div id="jlms_lpath_descr" style="width:100%">
			<?php 
            $text = JLMS_ShowText_WithFeatures($lpath_data->lpath_description);
            echo $text;
            ?>
		</div>
<?php 
        }
        JLMS_TMPL::CloseTS();
        JLMS_TMPL::CloseMT();
    }
示例#14
0
function JLMS_save_event($option)
{
    $JLMS_CONFIG =& JLMSFactory::getConfig();
    $Itemid = $JLMS_CONFIG->get('Itemid');
    global $my, $JLMS_DB;
    //$course_id     = intval(mosGetParam($_REQUEST, 'id', 0));
    $course_id = $JLMS_CONFIG->get('course_id');
    $start_date = JLMS_dateToDB(mosGetParam($_REQUEST, 'start_date', date('Y-m-d')));
    $end_date = JLMS_dateToDB(mosGetParam($_REQUEST, 'end_date', date('Y-m-d')));
    $agenda_detail = isset($_REQUEST['jlms_agenda_detail']) ? strval($_REQUEST['jlms_agenda_detail']) : '';
    $agenda_detail = get_magic_quotes_gpc() ? stripslashes($agenda_detail) : $agenda_detail;
    $agenda_detail = JLMS_ProcessText_HardFilter($agenda_detail);
    $edit = mosGetParam($_REQUEST, 'edit', '');
    $agenda_id = intval(mosGetParam($_REQUEST, 'agenda_id', 0));
    $agenda_title = isset($_REQUEST['jlms_agenda_title']) ? strval($_REQUEST['jlms_agenda_title']) : '';
    $agenda_title = get_magic_quotes_gpc() ? stripslashes($agenda_title) : $agenda_title;
    $agenda_title = ampReplace(strip_tags($agenda_title));
    $groups = mosGetParam($_REQUEST, 'groups', array(0));
    $is_limited = intval(mosGetParam($_REQUEST, 'is_limited', 0));
    $is_time_related = intval(mosGetParam($_POST, 'is_time_related', ''));
    $days = intval(mosGetParam($_POST, 'days', ''));
    $hours = intval(mosGetParam($_POST, 'hours', ''));
    $mins = intval(mosGetParam($_POST, 'mins', ''));
    if ($is_time_related) {
        $show_period = JLMS_HTML::_('showperiod.getminsvalue', $days, $hours, $mins);
    }
    $JLMS_ACL =& JLMSFactory::getACL();
    $assigned_groups_only = $JLMS_ACL->CheckPermissions('advanced', 'assigned_groups_only');
    if ($assigned_groups_only) {
        $is_limited = 1;
        $groups_where_admin_manager = JLMS_ACL_HELPER::GetAssignedGroups($my->id, $course_id);
        for ($i = 0; $i < count($groups); $i++) {
            if (!in_array($groups[$i], $groups_where_admin_manager)) {
                unset($groups[$i]);
            }
        }
        sort($groups);
    }
    $groups_in_db_arr = array();
    $query = "SELECT groups FROM #__lms_agenda WHERE agenda_id = {$agenda_id} AND course_id = {$course_id}";
    $JLMS_DB->setQuery($query);
    $groups_in_db = $JLMS_DB->LoadResult();
    if ($groups_in_db) {
        $groups_in_db = substr($groups_in_db, 1, strlen($groups_in_db) - 2);
        $groups_in_db_arr = explode('|', $groups_in_db);
        if (count($groups_where_admin_manager)) {
            $groups_in_db_arr = array_diff($groups_in_db_arr, $groups_where_admin_manager);
        }
    }
    $groups_str = '';
    if ($is_limited && (count($groups) && $groups[0] != 0 || count($groups_in_db_arr))) {
        $groups = array_merge($groups, $groups_in_db_arr);
        $razd = '|';
        for ($i = 0; $i < count($groups); $i++) {
            $groups_str .= $razd . $groups[$i];
        }
        $groups_str .= '|';
    } else {
        $groups_str = '';
    }
    //echo $groups_str; die;
    $ag_id = 0;
    if ($course_id && $JLMS_ACL->CheckPermissions('announce', 'manage')) {
        //proverka na korrektnost' end_date
        if (strtotime($end_date) < strtotime($start_date)) {
            $end_date = $start_date;
        }
        if (isset($edit) && $edit == 'yes' && $agenda_id) {
            $query = "SELECT owner_id FROM #__lms_agenda WHERE agenda_id = {$agenda_id} AND course_id = {$course_id}";
            $JLMS_DB->setQuery($query);
            $agenda_owner = $JLMS_DB->LoadResult();
            $proceed_with_edit = true;
            if ($agenda_owner) {
                if ($JLMS_ACL->CheckPermissions('announce', 'only_own') && $agenda_owner != $my->id) {
                    $proceed_with_edit = false;
                } elseif ($JLMS_ACL->CheckPermissions('announce', 'only_own_role') && $JLMS_ACL->GetRole() != $JLMS_ACL->UserSystemRole($JLMS_DB, $agenda_owner)) {
                    $proceed_with_edit = false;
                }
            }
            if ($proceed_with_edit) {
                $set = '';
                if ($is_time_related) {
                    $set = ",  show_period = '" . $show_period . "'";
                }
                $query = "UPDATE `#__lms_agenda` " . " SET title = " . $JLMS_DB->Quote($agenda_title) . ", is_limited = '" . $is_limited . "', groups = '" . $groups_str . "', content = " . $JLMS_DB->Quote($agenda_detail) . ", start_date = '" . $start_date . "', end_date = '" . $end_date . "', is_time_related = '" . $is_time_related . "'" . $set . " WHERE agenda_id = '" . $agenda_id . "' AND course_id = '" . $course_id . "' ";
                $JLMS_DB->setQuery($query);
                $JLMS_DB->query();
                $ag_id = $agenda_id;
            }
        } else {
            $row = new StdClass();
            #$row->id = 0;
            $row->course_id = $course_id;
            $row->owner_id = $my->id;
            $row->is_limited = $is_limited;
            $row->title = $agenda_title;
            $row->groups = $groups_str;
            $row->content = $agenda_detail;
            $row->start_date = $start_date;
            $row->end_date = $end_date;
            $row->is_time_related = $is_time_related;
            $row->show_period = $show_period;
            $JLMS_DB->insertobject('#__lms_agenda', $row);
            $insert_id = $JLMS_DB->insertid();
            $ag_id = $insert_id;
        }
    }
    if ($ag_id) {
        JLMSRedirect(sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=agenda&amp;id={$course_id}&amp;agenda_id=" . $ag_id));
    } else {
        JLMSRedirect(sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}&amp;task=agenda&amp;id={$course_id}"));
    }
}
示例#15
0
    function NewDocLink($doc_details, $lists, $id, $option, $cur_id)
    {
        $JLMS_CONFIG =& JLMSFactory::getConfig();
        $Itemid = $JLMS_CONFIG->get('Itemid');
        $rows_c = $lists['collapsed_folders'];
        $rows = $lists['out_files'];
        $is_dis_start = !($doc_details->publish_end == 1);
        $is_dis_end = !($doc_details->publish_end == 1);
        ?>
	
	<script language="javascript" type="text/javascript">
	<!--//--><![CDATA[//><!--
	window.addEvent('domready', function() {
			document.adminForm.startday.disabled = true;
			document.adminForm.startmonth.disabled = true;
			document.adminForm.startyear.disabled = true;
				
			document.adminForm.endday.disabled = true;
			document.adminForm.endmonth.disabled = true;
			document.adminForm.endyear.disabled = true;		
	}
	);
	function submitbutton(pressbutton) {
		var form=document.adminForm;
		if (is_start_c == 1) {if (form.start_date.value == ''){jlms_getDate('start');}}
		if (is_end_c == 1) {if (form.end_date.value == ''){jlms_getDate('end');}}
	
		form.task.value = pressbutton;form.submit();

	}
	
var TreeArray1 = new Array();
var TreeArray2 = new Array();
var Is_ex_Array = new Array();
<?php 
        $i = 1;
        foreach ($rows as $row) {
            echo "TreeArray1[" . $i . "] = " . $row->parent_id . ";";
            echo "TreeArray2[" . $i . "] = " . $row->id . ";";
            if (in_array($row->id, $rows_c)) {
                echo "Is_ex_Array[" . $i . "] = 0;";
            } else {
                echo "Is_ex_Array[" . $i . "] = 1;";
            }
            $i++;
        }
        ?>
function Hide_Folder(fid) {
	var vis_style = 'hidden';
	var dis_style = 'none';
	var i = 1;
	while (i < TreeArray1.length) {
		if (TreeArray1[i] == fid) {
			getObj('tree_row_'+TreeArray2[i]).style.visibility = vis_style;
			getObj('tree_row_'+TreeArray2[i]).style.display = dis_style;
			Hide_Folder(TreeArray2[i])
		}
		i ++;
	}
}
function Show_Folder(fid) {
	var vis_style = 'visible';
	var dis_style = '';
	var i = 1;
	while (i < TreeArray1.length) {
		if (TreeArray1[i] == fid) {
			if (getObj('tree_row_'+TreeArray2[i])) {
				getObj('tree_row_'+TreeArray2[i]).style.display = dis_style;
				getObj('tree_row_'+TreeArray2[i]).style.visibility = vis_style;
			}
			NoChange_Folder(TreeArray2[i])
		}
		i ++;
	}
}
function NoChange_Folder(fid) {
	var vis_style = 'hidden';var dis_style = 'none';var i = 1;var j = 0;
	while (i < TreeArray2.length) {
		if ( (TreeArray2[i] == fid) && (Is_ex_Array[i] == 1) ) {
			vis_style = 'visible';
			dis_style = '';
			j = 1;
		}
		i ++;
	}
	i = 1;
	while (i < TreeArray1.length) {
		if (TreeArray1[i] == fid) {
			getObj('tree_row_'+TreeArray2[i]).style.visibility = vis_style;
			getObj('tree_row_'+TreeArray2[i]).style.display = dis_style;
			if (j == 1) { NoChange_Folder(TreeArray2[i]);
			} else { Hide_Folder(TreeArray2[i]); }
		}
		i ++;
	}
}
function Ex_Folder(fid) {
	var i = 1;
	var j = 1;
	while (i < TreeArray2.length) {
		if ( (TreeArray2[i] == fid) && (Is_ex_Array[i] == 1) ) { j = 0; }
		i ++;
	}
	if (j == 1) {
		Show_Folder(fid);
		if (getObj('tree_img_' + fid).runtimeStyle) {
			var StStr = getObj('tree_img_' + fid).runtimeStyle.filter;
			var imgStr = getObj('tree_img_' + fid).outerHTML;
			imgStr = imgStr.replace('expandall.png','collapseall.png').replace('<?php 
        echo _JLMS_DOCS_EXP_FOLDER;
        ?>
', '<?php 
        echo _JLMS_DOCS_COLL_FOLDER;
        ?>
');
			StStr = StStr.replace('expandall.png','collapseall.png');
			getObj('tree_img_' + fid).outerHTML = imgStr;
			getObj('tree_img_' + fid).runtimeStyle.filter = StStr;
		} else {
			getObj('tree_img_' + fid).src = 'components/com_joomla_lms/lms_images/docs/collapseall.png';
			getObj('tree_img_' + fid).alt = '<?php 
        echo _JLMS_DOCS_COLLAPSE;
        ?>
';
			getObj('tree_img_' + fid).title = '<?php 
        echo _JLMS_DOCS_COLL_FOLDER;
        ?>
';
		}
	} else {
		Hide_Folder(fid);
		if (getObj('tree_img_' + fid).runtimeStyle) {
			var StStr = getObj('tree_img_' + fid).runtimeStyle.filter;
			var imgStr = getObj('tree_img_' + fid).outerHTML;
			imgStr = imgStr.replace('collapseall.png','expandall.png').replace('<?php 
        echo _JLMS_DOCS_COLL_FOLDER;
        ?>
', '<?php 
        echo _JLMS_DOCS_EXP_FOLDER;
        ?>
');
			StStr = StStr.replace('collapseall.png','expandall.png');
			getObj('tree_img_' + fid).outerHTML = imgStr;
			getObj('tree_img_' + fid).runtimeStyle.filter = StStr;
		} else {
			getObj('tree_img_' + fid).src = 'components/com_joomla_lms/lms_images/docs/expandall.png';
			getObj('tree_img_' + fid).alt = '<?php 
        echo _JLMS_DOCS_EXPAND;
        ?>
';
			getObj('tree_img_' + fid).title = '<?php 
        echo _JLMS_DOCS_EXP_FOLDER;
        ?>
';
		}
	}
	i = 1;
	while (i < TreeArray2.length) {
		if ( (TreeArray2[i] == fid) ) {
			if (Is_ex_Array[i] == 1) { Is_ex_Array[i] = 0;
			} else { Is_ex_Array[i] = 1; }
		}
		i ++;
	}
}	
	
	
	var is_start_c = <?php 
        echo $doc_details->publish_start ? '1' : '0';
        ?>
; var is_end_c = <?php 
        echo $doc_details->publish_end ? '1' : '0';
        ?>
;
function jlms_Change_start() {
	var form=document.adminForm;
	if (is_start_c == 1) {
		is_start_c = 0
		form.startday.disabled = true;
		form.startmonth.disabled = true;
		form.startyear.disabled = true;
	} else {
		is_start_c = 1
		form.startday.disabled = false;
		form.startmonth.disabled = false;
		form.startyear.disabled = false;
	}
}
function jlms_Change_end() {
	var form=document.adminForm;
	if (is_end_c == 1) {
		is_end_c = 0
		form.endday.disabled = true;
		form.endmonth.disabled = true;
		form.endyear.disabled = true;
	} else {
		is_end_c = 1
		form.endday.disabled = false;
		form.endmonth.disabled = false;
		form.endyear.disabled = false;
	}
}
//--><!]]>
</script>
	<?php 
        JLMS_TMPL::OpenMT();
        $hparams = array();
        $toolbar = array();
        $title = '';
        $title = $doc_details->id ? _JLMS_DOCS_TITLE_EDIT_DOC : _JLMS_DOCS_TITLE_NEW_DOC;
        $toolbar[] = array('btn_type' => 'save', 'btn_js' => "javascript:submitbutton('save_doclink');");
        $toolbar[] = array('btn_type' => 'cancel', 'btn_js' => "javascript:submitbutton('cancel_doc');");
        if (!empty($rows)) {
            JLMS_TMPL::ShowHeader('doc', $title, $hparams, $toolbar);
        }
        JLMS_TMPL::OpenTS();
        ?>
		<form action="<?php 
        echo sefRelToAbs("index.php?option=" . $option . "&amp;Itemid=" . $Itemid);
        ?>
" method="post" name="adminForm" enctype="multipart/form-data">
			<?php 
        $max_tree_width = 0;
        if (isset($rows[0])) {
            $max_tree_width = $rows[0]->tree_max_width;
        }
        if (!empty($rows)) {
            ?>
				<table width="100%" cellpadding="0" cellspacing="0" border="0" class="<?php 
            echo JLMSCSS::_('jlmslist');
            ?>
">
					<tr>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 width="20" class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" align="center">&nbsp;#&nbsp;</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 width="16" class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
"><input type="checkbox" value="0" name="hidden_box" style="visibility:hidden" /></<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
						<?php 
            for ($th_i = 0; $th_i < $max_tree_width + 1; $th_i++) {
                ?>
						<<?php 
                echo JLMSCSS::tableheadertag();
                ?>
 width="1%" class="<?php 
                echo JLMSCSS::_('sectiontableheader');
                ?>
"><span style="display: block; width: 16px;">&nbsp;</span></<?php 
                echo JLMSCSS::tableheadertag();
                ?>
>
						<?php 
            }
            ?>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" width="45%"><span style="display: block; width: 200px; text-align: left;"><?php 
            echo _JLMS_DOCS_TBL_DOCNAME;
            ?>
</span></<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
						<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader');
            ?>
" width="60%"><?php 
            echo _JLMS_DOCS_TBL_DESCR;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
					</tr>
				<?php 
            $k = 1;
            $tree_modes = array();
            $visible_folder = true;
            //$next_row_is_visible = true;
            $vis_mode = 0;
            for ($i = 0, $n = count($rows); $i < $n; $i++) {
                $row = $rows[$i];
                $max_tree_width = $row->tree_max_width;
                $link = '';
                $link_title = '';
                if ($row->folder_flag == 2) {
                    $link = sefRelToAbs("index.php?option=" . $option . "&amp;Itemid=" . $Itemid . "&amp;task=docs_view_zip&amp;course_id=" . $id . "&amp;id=" . $row->id);
                    $link_title = _JLMS_T_A_VIEW_ZIP_PACK;
                } elseif ((!$row->folder_flag || $row->folder_flag == 3) && $row->file_id) {
                    $link = sefRelToAbs("index.php?option=" . $option . "&amp;Itemid=" . $Itemid . "&amp;task=get_document&amp;course_id=" . $id . "&amp;id=" . $row->id);
                    $link_title = _JLMS_DOCS_LINK_DOWNLOAD;
                } elseif ((!$row->folder_flag || $row->folder_flag == 3) && !$row->file_id) {
                    $link = sefRelToAbs("index.php?option=" . $option . "&amp;Itemid=" . $Itemid . "&amp;task=docs_view_content&amp;course_id=" . $id . "&amp;id=" . $row->id);
                    $link_title = _JLMS_T_A_VIEW_CONTENT;
                }
                // Collapsed/Expanded view
                $tree_row_style = '';
                $visible_folder = true;
                //$next_row_is_visible;
                //$next_row_is_visible = true;
                if ($vis_mode) {
                    if ($row->tree_mode_num < $vis_mode) {
                        $vis_mode = 0;
                    }
                }
                $checked = mosHTML::idBox($i, $row->id);
                // Collapsed/Expanded view
                $tree_row_style = '';
                $visible_folder = true;
                //$next_row_is_visible;
                //$next_row_is_visible = true;
                if ($vis_mode) {
                    if ($row->tree_mode_num < $vis_mode) {
                        $vis_mode = 0;
                    }
                }
                if (in_array($row->id, $rows_c)) {
                    //$next_row_is_visible = false;
                    if ($vis_mode) {
                        if ($row->tree_mode_num < $vis_mode) {
                            $vis_mode = $row->tree_mode_num;
                        } else {
                            $visible_folder = false;
                        }
                    } else {
                        $vis_mode = $row->tree_mode_num + 1;
                    }
                } elseif ($vis_mode) {
                    if ($row->tree_mode_num >= $vis_mode) {
                        $visible_folder = false;
                    } else {
                        $vis_mode = 0;
                    }
                }
                if (!$visible_folder) {
                    $tree_row_style = ' style="visibility:hidden;display:none"';
                }
                ?>
					
					<tr id="tree_row_<?php 
                echo $row->id;
                ?>
" class="<?php 
                echo JLMSCSS::_('sectiontableentry' . $k);
                ?>
"<?php 
                echo $tree_row_style;
                ?>
>					
						<td align="center" valign="middle"><?php 
                echo $i + 1;
                ?>
</td>
						<td valign="middle"><?php 
                if ($row->folder_flag != 1) {
                    echo $checked;
                }
                ?>
</td>

						<?php 
                $add_img = '';
                if ($row->tree_mode_num) {
                    $g = 0;
                    $tree_modes[$row->tree_mode_num - 1] = $row->tree_mode;
                    while ($g < $row->tree_mode_num - 1) {
                        $pref = '';
                        if (isset($tree_modes[$g]) && $tree_modes[$g] == 2) {
                            $pref = 'empty_';
                        }
                        $add_img .= "<td width='16' valign='middle'><img src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/treeview/" . $pref . "line.png\" width='16' height='16' alt='" . $pref . "line' /></td>";
                        $g++;
                    }
                    $add_img .= "<td width='16' valign='middle'><img src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/treeview/sub" . $row->tree_mode . ".png\" width='16' height='16' alt='sub" . $row->tree_mode . "' /></td>";
                    $max_tree_width = $max_tree_width - $g - 1;
                }
                echo $add_img;
                ?>

						<td align="center" valign="middle" width='16'>

						<?php 
                if ($row->folder_flag == 1) {
                    $collapse_img = 'collapseall.png';
                    $collapse_alt = _JLMS_DOCS_COLL_FOLDER;
                    if (in_array($row->id, $rows_c)) {
                        $collapse_img = 'expandall.png';
                        $collapse_alt = _JLMS_DOCS_EXP_FOLDER;
                    }
                    echo "<span id='tree_div_" . $row->id . "' style='alignment:center; width:16px; font-weight:bold; cursor:pointer; vertical-align:middle;' onclick='Ex_Folder(" . $row->id . "," . $row->id . ",true)'><img class='JLMS_png' id='tree_img_" . $row->id . "' src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/docs/{$collapse_img}\" width='13' height='13' alt='" . $collapse_alt . "' title='" . $collapse_alt . "' /></span>";
                } else {
                    echo "<span style='alignment:center; width:16px; font-weight:bold; vertical-align:middle;'><img class='JLMS_png' src=\"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/files/" . $row->file_icon . ".png\" width='16' height='16' alt='{$row->file_icon}' /></span>";
                }
                ?>
						
						</td>

						<td align="left" valign="middle" <?php 
                if ($max_tree_width > 0) {
                    echo "colspan='" . ($max_tree_width + 1) . "'";
                }
                ?>
 width="45%">
						<span style='font-weight:bold; vertical-align:middle;'>
						<?php 
                if ($row->folder_flag == 1) {
                    echo '&nbsp;<strong>' . $row->doc_name . '</strong>';
                } else {
                    ?>
							<a href="<?php 
                    echo $link;
                    ?>
" title="<?php 
                    echo $link_title;
                    ?>
">
								&nbsp;<?php 
                    echo $row->doc_name;
                    ?>
							</a>
						<?php 
                }
                ?>
						</span>
						</td>

						<td><?php 
                $doc_descr = strip_tags($row->doc_description);
                if (!$row->folder_flag && !$row->file_id) {
                    if (strlen($doc_descr) > 75) {
                        $doc_descr = substr($doc_descr, 0, 75) . "...";
                    }
                }
                echo $doc_descr ? $doc_descr : '&nbsp;';
                ?>
						</td>
					</tr>
					<?php 
                $k = 3 - $k;
            }
            ?>
				</table>

			<table width="100%" cellpadding="0" cellspacing="0" border="0" class="jlms_item_properties">
				<tr>
					<td valign="middle" style="vertical-align:middle"><br /><?php 
            echo _JLMS_PLACE_IN;
            ?>
</td>
					<td><br /><?php 
            echo $lists['course_folders'];
            ?>
</td>
				</tr>	
				<tr>
					<td valign="middle" style="vertical-align:middle"><br /><?php 
            echo _JLMS_PUBLISHING;
            ?>
</td>
					<td><br /><?php 
            echo $lists['publishing'];
            ?>
</td>
				</tr>
				<tr>
					<td valign="middle"><br /><?php 
            echo _JLMS_START_DATE;
            ?>
</td>
					<td valign="middle" style="vertical-align:middle "><br />
						<table cellpadding="0" cellspacing="0" border="0" class="jlms_date_outer"><tr><td valign="middle"><input type="checkbox" value="1" name="is_start" onclick="jlms_Change_start()" <?php 
            echo $doc_details->publish_start ? 'checked' : '';
            ?>
 /></td>
						<td valign="middle" style="vertical-align:middle ">
						<?php 
            $s_date = $is_dis_start ? date('Y-m-d') : $doc_details->start_date;
            echo JLMS_HTML::_('calendar.calendar', $s_date, 'start', 'start');
            ?>
						</td></tr></table>
					</td>
				</tr>	
				<tr>
					<td><br /><?php 
            echo _JLMS_END_DATE;
            ?>
</td>
					<td valign="middle" style="vertical-align:middle "><br />
						<table cellpadding="0" cellspacing="0" border="0" class="jlms_date_outer"><tr><td valign="middle"><input type="checkbox" value="1" name="is_end" onclick="jlms_Change_end()" <?php 
            echo $doc_details->publish_end ? 'checked="checked"' : '';
            ?>
 /></td>
						<td valign="middle" style="vertical-align:middle ">
						<?php 
            $e_date = $is_dis_end ? date('Y-m-d') : $doc_details->end_date;
            echo JLMS_HTML::_('calendar.calendar', $e_date, 'end', 'end');
            ?>
						</td></tr></table>
					</td>
				</tr>	
			</table>
			<?php 
        } else {
            echo '<div class="joomlalms_user_message">' . _JLMS_NO_ITEMS_HERE . '</div>';
        }
        ?>
			<input type="hidden" name="option" value="<?php 
        echo $option;
        ?>
" />
			<input type="hidden" name="Itemid" value="<?php 
        echo $Itemid;
        ?>
" />
			<input type="hidden" name="task" value="update_document" />
			<input type="hidden" name="boxchecked" value="0" />
			<input type="hidden" name="course_id" value="<?php 
        echo $id;
        ?>
" />
			<input type="hidden" name="folder_flag" value="0" />
			<input type="hidden" name="id" value="<?php 
        echo $doc_details->id;
        ?>
" />
		</form>
<?php 
        JLMS_TMPL::CloseTS();
        JLMS_TMPL::CloseMT();
    }
示例#16
0
function JLMS_switchType($option)
{
    $JLMS_CONFIG =& JLMSFactory::getConfig();
    global $task;
    $type = strval(mosGetParam($_REQUEST, 'type', $task));
    $javascript = 'onchange="javascript:document.adminForm.task.value=document.adminForm.type.options[document.adminForm.type.selectedIndex].value;document.adminForm.view.value=\'\';document.adminForm.submit();"';
    $types = array();
    $types[] = mosHTML::makeOption('report_access', _JLMS_REPORTS_ACCESS);
    $types[] = mosHTML::makeOption('report_certif', _JLMS_REPORTS_CONCLUSION);
    $types[] = mosHTML::makeOption('report_grade', _JLMS_REPORTS_USER);
    if ($JLMS_CONFIG->get('show_scorm_report_link', false)) {
        $types[] = mosHTML::makeOption('report_scorm', _JLMS_REPORTS_SCORM);
    }
    $type = mosHTML::selectList($types, 'type', 'class="inputbox" size="1" style="width: 100%;" ' . $javascript, 'value', 'text', $type);
    return $type;
}
示例#17
0
    function JQ_Content_nojs()
    {
        global $option, $Itemid, $JLMS_DB;
        $JLMS_CONFIG =& JLMSFactory::getConfig();
        $id = intval(mosGetParam($_REQUEST, 'id', 0));
        $quiz_id = intval(mosGetParam($_REQUEST, 'quiz', 0));
        $stu_quiz_id = intval(mosGetParam($_REQUEST, 'stu_quiz_id', 0));
        $user_unique_id = strval(mosGetParam($_REQUEST, 'user_unique_id', ''));
        $quest_id = intval(mosGetParam($_REQUEST, 'quest_id', 0));
        $inside_lp = intval(mosGetParam($_REQUEST, 'inside_lp', 0));
        $QA = new JLMS_quiz_API($quiz_id, $inside_lp);
        if (!$QA->quiz_valid()) {
            return '';
        }
        $QA->set('stu_quiz_id', $stu_quiz_id);
        $QA->set('user_unique_id', $user_unique_id);
        $QA->quiz_ProcessStartData();
        $quiz = $QA->quiz_data;
        // temporary for compatibility
        $quiz_params = new JLMSParameters($QA->get_qvar('params'));
        $q_data = $QA->quiz_Get_QuestionList();
        $link_back = sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&id={$id}&task=quiz_action&quiz={$quiz_id}&atask=goto_quest&stu_quiz_id={$stu_quiz_id}&user_unique_id={$user_unique_id}&seek_quest_id={$quest_id}");
        ?>
		<table border="0" width="100%" class="jlms_table_no_borders">
			<tr>
				<td align="right">
					<table class="jlms_table_no_borders">
						<tr>
							<td>
								<a href="<?php 
        echo $link_back;
        ?>
">
									<img src="<?php 
        echo $JLMS_CONFIG->get('live_site');
        ?>
/components/com_joomla_lms/lms_images/buttons/btn_back.png" border="0" alt=""/>
								</a>
							</td>
							<td>
								<a href="<?php 
        echo $link_back;
        ?>
">
									<?php 
        echo _JLMS_q_quiz_back;
        ?>
								</a>
							</td>
						</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td align="center">
					<table width="100%" class="jlms_table_no_borders" style="padding: 0px 20px;" id="jq_results_panel_table">
					<?php 
        $i = 1;
        foreach ($q_data as $data) {
            $link_goto_quest = sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&id={$id}&task=quiz_action&atask=goto_quest&quiz={$quiz_id}&seek_quest_id={$data->c_id}&stu_quiz_id={$stu_quiz_id}&user_unique_id={$user_unique_id}");
            ?>
						<tr class="sectiontableentry<?php 
            echo $i;
            ?>
">
							<td>
								<a href="<?php 
            echo $link_goto_quest;
            ?>
">
									<?php 
            echo $data->c_question;
            ?>
								</a>
							</td>
							<td width="40" align="center">
								<?php 
            echo $data->c_point;
            ?>
							</td>
							<td width="25" align="center">
								<div id="quest_result_<?php 
            echo $data->c_id;
            ?>
">
									<?php 
            if (isset($data->c_correct) && $data->c_correct) {
                if ($data->c_correct == 1) {
                    ?>
										<img border="0" src="<?php 
                    echo $JLMS_CONFIG->get('live_site');
                    ?>
/components/com_joomla_lms/lms_images/toolbar/btn_cancel.png" alt=""/>
										<?php 
                } elseif ($data->c_correct == 2) {
                    ?>
										<img border="0" src="<?php 
                    echo $JLMS_CONFIG->get('live_site');
                    ?>
/components/com_joomla_lms/lms_images/toolbar/btn_accept.png" alt=""/>
										<?php 
                }
            } else {
                if (isset($data->c_score) && $data->c_score > 0) {
                    ?>
										<img border="0" src="<?php 
                    echo $JLMS_CONFIG->get('live_site');
                    ?>
/components/com_joomla_lms/lms_images/toolbar/btn_cancel.png" alt=""/>
										<?php 
                } elseif (isset($data->c_score) && $data->c_score > 0) {
                    ?>
										<img border="0" src="<?php 
                    echo $JLMS_CONFIG->get('live_site');
                    ?>
/components/com_joomla_lms/lms_images/toolbar/btn_accept.png" alt=""/>
										<?php 
                } else {
                    ?>
										-
										<?php 
                }
            }
            ?>
								</div>
							</td>
						</tr>
					<?php 
            if ($i == 2) {
                $i = $i - 1;
            } else {
                $i++;
            }
        }
        ?>
					</table>
				</td>
			</tr>
		</table>
		<?php 
    }
function JLMS_saveDropBox($option)
{
    $JLMS_CONFIG =& JLMSFactory::getConfig();
    $Itemid = $JLMS_CONFIG->get('Itemid');
    $_JLMS_PLUGINS =& JLMSFactory::getPlugins();
    $db =& JFactory::getDbo();
    $user = JLMSFactory::getUser();
    $course_id = intval(mosGetParam($_REQUEST, 'course_id', 0));
    //	if ($user->get('id') && $course_id && JLMS_GetUserType($user->get('id'), $course_id) ) {
    $JLMS_ACL =& JLMSFactory::getACL();
    if ($user->get('id') && $course_id && $JLMS_ACL->CheckPermissions('dropbox', 'view')) {
        $recv_id = intval(mosGetParam($_REQUEST, 'recv_id', 0));
        $recv_id = mosGetParam($_POST, 'recv_id', array(0));
        if (!is_array($recv_id)) {
            $recv_id = array(0);
        }
        if (isset($recv_id[0]) && !$recv_id[0] || !count($recv_id)) {
            //fix one user (ticket  [QDHZ-1096])
            $msg = _JLMS_DROP_ERROR_NO_SEND_TO;
            JLMSRedirect(sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=dropbox&id={$course_id}"), $msg);
        }
        //convert array of receiver's to numeric values
        $i = 0;
        while ($i < count($recv_id)) {
            $recv_id[$i] = intval($recv_id[$i]);
            $i++;
        }
        $recv_ids = implode(',', $recv_id);
        $do_continue = false;
        /*
        New permissions (Max)
        */
        $query = "SELECT count(user_id) FROM #__lms_user_courses" . "\n WHERE course_id = '" . $course_id . "' AND user_id IN ( {$recv_ids} )";
        $db->setQuery($query);
        $count_users = $db->LoadResult();
        if ($JLMS_ACL->CheckPermissions('dropbox', 'send_to_teachers')) {
            if ($count_users) {
                $do_continue = true;
            } else {
                $query = "SELECT count(c.user_id) FROM #__lms_users_in_groups as c" . "\n WHERE c.course_id = '" . $course_id . "' AND c.user_id IN ( {$recv_ids} )";
                $db->setQuery($query);
                $count_users = $db->LoadResult();
                if ($count_users) {
                    $do_continue = true;
                }
            }
        }
        if ($JLMS_ACL->CheckPermissions('dropbox', 'send_to_learners')) {
            if ($count_users) {
                $do_continue = true;
            }
        }
        /*
        Old part
        */
        /*
        if (JLMS_GetUserType($user->get('id'), $course_id) == 1) {
        	$query = "SELECT count(user_id) FROM #__lms_user_courses"
        	. "\n WHERE course_id = '".$course_id."' AND (role_id = 1 OR role_id = 4) AND user_id IN ( $recv_ids )";
        	$db->setQuery($query);
        	$count_users = $db->LoadResult();
        	
        	if ($count_users) {
        		$do_continue = true;
        	} else {
        		$query = "SELECT count(c.user_id) FROM #__lms_users_in_groups as c"
        		. "\n WHERE c.course_id = '".$course_id."' AND c.user_id IN ( $recv_ids )";
        		$db->setQuery($query);
        		$count_users = $db->LoadResult();
        		if ($count_users) {
        			$do_continue = true;
        		}
        	}
        } elseif (JLMS_GetUserType($user->get('id'), $course_id) == 2) {
        	$query = "SELECT count(user_id) FROM #__lms_user_courses"
        	. "\n WHERE course_id = '".$course_id."' AND (role_id = 1 OR role_id = 4) AND user_id IN ( $recv_ids )";
        	$db->setQuery($query);
        	$count_users = $db->LoadResult();
        	if ($count_users) {
        		$do_continue = true;
        	}
        }
        */
        // (TIPS)
        // sender: teacher - RECEIVER must be teacher of this course or student of this course
        // sender: student - RECEIVER must be teacher of this course
        $flag = false;
        if ($do_continue) {
            if ($_FILES['userfile']['name'] == '') {
                $file_id = 0;
                $flag = true;
            } else {
                $file_id = JLMS_uploadFile($course_id);
                if ($file_id) {
                    $flag = true;
                }
            }
            $_POST['drp_type'] = 1;
            if (intval(mosGetParam($_REQUEST, 'file_id', 0))) {
                $file_id = intval(mosGetParam($_REQUEST, 'file_id', 0));
                $_POST['drp_type'] = 2;
            }
            if ($flag) {
                $row = new mos_Joomla_LMS_DropBox($db);
                if (!$row->bind($_POST)) {
                    echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
                    exit;
                }
                $row->file_id = $file_id;
                $row->owner_id = $user->get('id');
                $row->drp_mark = 1;
                /*$query = "SELECT file_name FROM #__lms_files WHERE id = '".$file_id."'";
                				$db->SetQuery( $query );
                
                				$row->drp_name = $db->LoadResult();*/
                //$row->drp_name = strval(mosGetParam($_FILES['userfile'], 'name', 'dropbox_file'));
                if ($file_id > 0) {
                    if ($row->drp_type == 1) {
                        $drp_name = isset($_FILES['userfile']['name']) ? strval($_FILES['userfile']['name']) : 'dropbox_file';
                    } else {
                        if ($row->drp_type == 2) {
                            $drp_name = strval(mosGetParam($_REQUEST, 'dropbox_name', 'dropbox_file_(' . time() . ')'));
                        }
                    }
                } else {
                    $drp_name = mosGetParam($_REQUEST, 'dropbox_name');
                }
                $drp_name = get_magic_quotes_gpc() ? stripslashes($drp_name) : $drp_name;
                $row->drp_name = ampReplace(strip_tags($drp_name));
                $row->drp_description = strval(JLMS_getParam_LowFilter($_POST, 'drp_description', ''));
                //$row->drp_description = JLMS_ProcessText_LowFilter($row->drp_description);
                //				if (JLMS_GetUserType($user->get('id'), $course_id ) == 1) {
                if ($JLMS_ACL->CheckPermissions('dropbox', 'mark_as_corrected')) {
                    $drp_corr = intval(mosGetParam($_REQUEST, 'drp_corrected', 0));
                    if ($drp_corr != 1) {
                        $drp_corr = 0;
                    }
                    $row->drp_corrected = $drp_corr;
                } else {
                    $row->drp_corrected = 0;
                }
                $row->drp_time = date('Y-m-d H:i:s');
                //Replace old function JLMS_GetUserType //tmp
                $users_teachers = array();
                $users_learners = array();
                if ($JLMS_ACL->CheckPermissions('dropbox', 'send_to_teachers')) {
                    $query = "SELECT a.* FROM #__users as a, #__lms_user_courses as c" . "\n WHERE a.id = c.user_id AND c.course_id = '" . $course_id . "' AND a.id <> '" . $user->id . "'" . "\n ORDER BY a.username";
                    $db->SetQuery($query);
                    $users_teachers = $db->LoadObjectList();
                    $i = 0;
                    while ($i < count($users_teachers)) {
                        $users_teachers[$i]->username = _JLMS_ROLE_TEACHER . ' - ' . $users_teachers[$i]->name . ' (' . $users_teachers[$i]->username . ')';
                        $i++;
                    }
                }
                if ($JLMS_ACL->CheckPermissions('dropbox', 'send_to_learners')) {
                    $users_learners = JLMS_getCourseStudentsList($course_id);
                }
                $tmp = array();
                foreach ($users_teachers as $n => $ut) {
                    $tmp[$n] = $ut->id;
                }
                if (count($tmp)) {
                    $users_teachers = $tmp;
                }
                $tmp = array();
                foreach ($users_learners as $n => $ul) {
                    $tmp[$n] = $ul->id;
                }
                if (count($tmp)) {
                    $users_learners = $tmp;
                }
                //Replace old function JLMS_GetUserType //tmp
                foreach ($recv_id as $recv) {
                    $check_recv = false;
                    //Replace old function JLMS_GetUserType //tmp
                    if ($JLMS_ACL->CheckPermissions('dropbox', 'send_to_teachers') && in_array($recv, $users_teachers)) {
                        $check_recv = true;
                    }
                    if ($JLMS_ACL->CheckPermissions('dropbox', 'send_to_learners') && in_array($recv, $users_learners)) {
                        $check_recv = true;
                    }
                    //Replace old function JLMS_GetUserType //tmp
                    //					if ($recv && ($recv != $user->get('id')) && ((JLMS_GetUserType($user->get('id'), $course_id) == 1 && JLMS_GetUserType($recv, $course_id)) || ((JLMS_GetUserType($user->get('id'), $course_id) == 2) && (JLMS_GetUserType($recv, $course_id, true) == 1))) || ((JLMS_GetUserType($user->get('id'), $course_id) == 2) && (JLMS_GetUserType($recv, $course_id, true) == 2)) ) { //old
                    if ($recv && $recv != $user->get('id') && $check_recv) {
                        $row->id = 0;
                        $row->recv_id = $recv;
                        if (!$row->check()) {
                            echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
                            exit;
                        }
                        if (!$row->store()) {
                            echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
                            exit;
                        }
                        //*** send email notification
                        $e_course = new stdClass();
                        $e_course->course_alias = '';
                        $e_course->course_name = '';
                        $query = "SELECT course_name, name_alias FROM #__lms_courses WHERE id = '" . $course_id . "'";
                        $db->setQuery($query);
                        $e_course = $db->loadObject();
                        $e_user = new stdClass();
                        $e_user->name = '';
                        $e_user->email = '';
                        $e_user->username = '';
                        $query = "SELECT email, name, username FROM #__users WHERE id = '" . $recv . "'";
                        $db->setQuery($query);
                        $e_user = $db->loadObject();
                        $e_params['user_id'] = $recv;
                        $e_params['course_id'] = $course_id;
                        $e_params['markers']['{email}'] = $e_user->email;
                        $e_params['markers']['{name}'] = $e_user->name;
                        $e_params['markers']['{username}'] = $e_user->username;
                        $e_params['markers']['{coursename}'] = $e_course->course_name;
                        //( $e_course->course_alias )?$e_course->course_alias:$e_course->course_name;
                        $e_params['markers']['{filename}'] = $row->drp_name;
                        $e_params['markers']['{courselink}'] = JLMSEmailRoute("index.php?option=com_joomla_lms&Itemid={$Itemid}&task=details_course&id={$course_id}");
                        $e_params['markers_nohtml']['{courselink}'] = $e_params['markers']['{courselink}'];
                        $e_params['markers']['{courselink}'] = '<a href="' . $e_params['markers']['{courselink}'] . '">' . $e_params['markers']['{courselink}'] . '</a>';
                        $e_params['markers']['{lmslink}'] = JLMSEmailRoute("index.php?option=com_joomla_lms&Itemid={$Itemid}");
                        $e_params['markers_nohtml']['{lmslink}'] = $e_params['markers']['{lmslink}'];
                        $e_params['markers']['{lmslink}'] = '<a href="' . $e_params['markers']['{lmslink}'] . '">' . $e_params['markers']['{lmslink}'] . '</a>';
                        $e_params['action_name'] = 'OnNewDropboxFile';
                        $_JLMS_PLUGINS->loadBotGroup('emails');
                        $plugin_result_array = $_JLMS_PLUGINS->trigger('OnNewDropboxFile', array(&$e_params));
                        //*** end of emails
                    }
                }
                JLMSRedirect(sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=dropbox&id={$course_id}"));
            } else {
                mosErrorAlert("Upload of " . $userfile_name . " failed");
            }
        } else {
            JLMSRedirect(sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=dropbox&id={$course_id}"));
        }
    } else {
        JLMSRedirect(sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=dropbox&id={$course_id}"));
    }
}
示例#19
0
 function show($object_id, $object_group = 'com_content', $object_title = '', $search_text = '')
 {
     $object_id = (int) $object_id;
     $object_group = trim($object_group);
     $object_title = trim($object_title);
     $acl =& JCommentsFactory::getACL();
     $config =& JCommentsFactory::getConfig();
     $JLMS_CONFIG =& JLMSFactory::getConfig();
     $app =& JFactory::getApplication();
     $tmpl =& JCommentsFactory::getTemplate($object_id, $object_group);
     $tmpl->load('tpl_index');
     if ($config->getInt('object_locked', 0) == 1) {
         $config->set('enable_rss', 0);
         $tmpl->addVar('tpl_index', 'comments-form-locked', 1);
     }
     if (JCOMMENTS_JVERSION == '1.5') {
         $document =& JFactory::getDocument();
     }
     if (!defined('JCOMMENTS_CSS')) {
         include_once JCOMMENTS_HELPERS . DS . 'system.php';
         if ($app->isAdmin()) {
             $tmpl->addVar('tpl_index', 'comments-css', 1);
         } else {
             $link = JCommentsSystemPluginHelper::getCSS();
             $document->addStyleSheet($link);
         }
     }
     if (!defined('JCOMMENTS_JS')) {
         include_once JCOMMENTS_HELPERS . DS . 'system.php';
         if ($config->getInt('gzip_js') == 1) {
             $document->addScript(JCommentsSystemPluginHelper::getCompressedJS());
         } else {
             $document->addScript(JCommentsSystemPluginHelper::getCoreJS());
             if (!defined('JOOMLATUNE_AJAX_JS')) {
                 $document->addScript(JCommentsSystemPluginHelper::getAjaxJS());
                 define('JOOMLATUNE_AJAX_JS', 1);
             }
         }
     }
     $tmpl->addVar('tpl_index', 'comments-form-captcha', $acl->check('enable_captcha'));
     $tmpl->addVar('tpl_index', 'comments-form-link', $config->getInt('form_show') ? 0 : 1);
     if ($config->getInt('enable_rss') == 1) {
         $link = JCommentsFactory::getLink('rss', $object_id, $object_group);
         $attribs = array('type' => 'application/rss+xml', 'title' => strip_tags($object_title));
         $document->addHeadLink($link, 'alternate', 'rel', $attribs);
     }
     $cacheEnabled = intval($JLMS_CONFIG->get('caching')) == 1;
     if ($cacheEnabled == 0) {
         $jrecache = $JLMS_CONFIG->get('absolute_path') . DS . 'components' . DS . 'com_jrecache' . DS . 'jrecache.config.php';
         if (is_file($jrecache)) {
             $cfg = new _JRECache_Config();
             $cacheEnabled = $cacheEnabled && $cfg->enable_cache;
         }
     }
     $load_cached_comments = $config->getInt('load_cached_comments', 0);
     if ($cacheEnabled) {
         $tmpl->addVar('tpl_index', 'comments-anticache', 1);
     }
     if (!$cacheEnabled || $load_cached_comments === 1) {
         if ($config->get('template_view') == 'tree' && !strlen($search_text)) {
             $tmpl->addVar('tpl_index', 'comments-list', JLMS_JComments::getCommentsTree($object_id, $object_group, $search_text));
         } else {
             $tmpl->addVar('tpl_index', 'comments-list', JLMS_JComments::getCommentsList($object_id, $object_group, $search_text));
         }
     }
     $needScrollToComment = $cacheEnabled || $config->getInt('comments_per_page') > 0;
     $tmpl->addVar('tpl_index', 'comments-gotocomment', (int) $needScrollToComment);
     $tmpl->addVar('tpl_index', 'comments-form', JComments::getCommentsForm($object_id, $object_group, $config->getInt('form_show') == 1));
     $result = $tmpl->renderTemplate('tpl_index');
     $tmpl->freeAllTemplates();
     return $result;
 }
    function show_add_event($course_id, $option, &$agenda_item, $lists)
    {
        $JLMS_CONFIG =& JLMSFactory::getConfig();
        $Itemid = $JLMS_CONFIG->get('Itemid');
        $content = $title = '';
        $start_date = $end_date = date('Y-m-d');
        if ($agenda_item) {
            $content = $agenda_item->content;
            $title = $agenda_item->title;
            $start_date = $agenda_item->start_date;
            $end_date = $agenda_item->end_date;
            $is_time_related = $agenda_item->is_time_related;
            $show_period = $agenda_item->show_period;
        }
        ?>

<script language="javascript" type="text/javascript">
<!--
var start_date = '';
function setgood() {
	return true;
}
function submitbutton(task){
	elem = document.forms.adminForm;
	try {
		elem.onsubmit();
	} catch(e) {
		//alert(e);
	}
	if (task == 'save_agenda'){
		if (elem.jlms_agenda_title.value.length < 1){
			alert ('<?php 
        echo _JLMS_AGENDA_TITLE_INCORRECT;
        ?>
');
			elem.jlms_agenda_title.focus();
		}
		else {
			elem.submit();
		}
	}
	else{
		elem.mode.value = task;
		elem.submit();
	}	
}
//-->
</script>
		<form action="<?php 
        echo sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}");
        ?>
" method="post" name="adminForm" onsubmit="setgood();">
		<table width="100%" cellpadding="2" cellspacing="0" border="0" id="jlms_item_properties">
			<tr>
				<td colspan="2">
					<table width="100%" cellpadding="0" cellspacing="0" border="0" class="jlms_table_no_borders">
						<tr>
							<td width="100%" valign="middle" style="vertical-align:middle " rowspan="2" class="contentheading">
								<?php 
        echo _JLMS_AGENDA_ADD_ITEM;
        ?>
							</td>
							<td align="right" valign="top" style="vertical-align:top ">
								<?php 
        $toolbar = array();
        $toolbar[] = array('btn_type' => 'save', 'btn_js' => "javascript:submitbutton('save_agenda');");
        $toolbar[] = array('btn_type' => 'cancel', 'btn_js' => "javascript:submitbutton('cancel_agenda');");
        echo JLMS_ShowToolbar($toolbar);
        ?>
							</td>
						</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td valign="middle"><br /><?php 
        echo _JLMS_START_DATE;
        ?>
</td>
				<td valign="middle" style="vertical-align:middle "><br />
					<table cellpadding="0" cellspacing="0" border="0" class="jlms_date_outer"><tr>
					<td valign="middle" style="vertical-align:middle ">
					<?php 
        echo JLMS_HTML::_('calendar.calendar', $start_date, 'start', 'start');
        ?>
					</td></tr></table>
				</td>
			</tr>
			<tr>
				<td><br /><?php 
        echo _JLMS_END_DATE;
        ?>
</td>
				<td valign="middle" style="vertical-align:middle "><br />
					<table cellpadding="0" cellspacing="0" border="0" class="jlms_date_outer"><tr>
					<td valign="middle" style="vertical-align:middle ">
					<?php 
        echo JLMS_HTML::_('calendar.calendar', $end_date, 'end', 'end');
        ?>
					</td></tr></table>
				</td>
			</tr>
			<tr>
					<td valign="top" style="vertical-align:top "><br /><?php 
        echo _JLMS_IS_TIME_RELATED;
        ?>
</td>
					<td><br />
						<?php 
        if (isset($is_time_related)) {
            JLMS_HTML::_('showperiod.field', $is_time_related, $show_period);
        } else {
            JLMS_HTML::_('showperiod.field');
        }
        ?>
					</td>
				</tr>
			<tr>
				<td colspan="2" height="20"></td>
			</tr>
			
			<tr>
				<td>
				<?php 
        echo _JLMS_LIMIT_RESOURCE_TO_GROUPS;
        ?>
				</td>
				<td>
					<?php 
        echo $lists['is_limited'];
        ?>
				</td>
			</tr>

			<tr>
				<td colspan="2" height="20"></td>
			</tr>

			<tr>
				<td valign="top">
				<?php 
        echo _JLMS_LIMIT_RESOURCE_USERGROUPS;
        ?>
				</td>
				<td>
				<?php 
        echo $lists['groups'];
        ?>
				</td>
			</tr>
			<tr>
				<td valign="top" align="left"  width="20%" colspan="2">
				<?php 
        echo _JLMS_AGENDA_TITLE;
        ?>
				</td>
			</tr>	
			<tr>	
				<td colspan="2">
				<input  type="text" name="jlms_agenda_title"  size="60" value="<?php 
        echo $title;
        ?>
"  class="inputbox" />
				</td>
			</tr>
			<tr>
				<td colspan="2">
				<?php 
        echo _JLMS_DESCRIPTION;
        ?>
				</td>
			</tr>	
			<tr>
				<td  colspan="2">
				<?php 
        echo jlms_editorArea('editor1', $content, 'jlms_agenda_detail', '100%;', '250', '40', '20');
        ?>
				</td>
			</tr>
		</table>
		<input type="hidden" name="option" value="<?php 
        echo $option;
        ?>
" />
		<input type="hidden" name="Itemid" value="<?php 
        echo $Itemid;
        ?>
" />
		<input type="hidden" name="task" value="agenda" />
		<input type="hidden" name="mode" value="event_save" />
		<?php 
        if (isset($agenda_item->agenda_id)) {
            echo "<input type='hidden' name='edit' value='yes' />";
            echo "<input type='hidden' name='agenda_id' value='" . $agenda_item->agenda_id . "' />";
        }
        ?>
		<input type="hidden" name="boxchecked" value="0" />
		<input type="hidden" name="id" value="<?php 
        echo $course_id;
        ?>
" />
		</form>
	<?php 
    }
function jlms_displayFile($course_id, $option)
{
    global $Itemid, $my, $JLMS_DB;
    $JLMS_CONFIG =& JLMSFactory::getConfig();
    $id = intval(mosGetParam($_REQUEST, 'id', 0));
    $filename = mosGetParam($_REQUEST, 'filename', '');
    if ($id == -2) {
        JLMSRedirect($filename);
    }
    if ($id == -1) {
        $file = new stdClass();
        $file->filename = "JLMS_intro.swf";
        $file->upload_type = 0;
    } else {
        /*		$query = "ALTER TABLE `#__lms_conference_doc` ADD `upload_type` TINYINT DEFAULT '0' NOT NULL AFTER `owner_id` , ADD `file_id` INT NOT NULL AFTER `upload_type`";
        		$JLMS_DB->setQuery($query);
        		$JLMS_DB->query();*/
        $query = "SELECT * FROM `#__lms_conference_doc` WHERE course_id = {$course_id} AND doc_id={$id} ORDER BY doc_id";
        $JLMS_DB->setQuery($query);
        $file = $JLMS_DB->loadObject();
    }
    //print_r($file);
    if (is_object($file)) {
        if ($file->upload_type == 1) {
            $headers = array();
            $headers['Content-Disposition'] = 'inline';
            JLMS_downloadFile($file->file_id, $option, '', true, $headers);
        } else {
            $file_name = $file->filename;
            $srv_name = $JLMS_CONFIG->get('absolute_path') . "/components/com_joomla_lms/upload/" . $file_name;
            if (file_exists($srv_name) && is_readable($srv_name)) {
                $v_date = date("Y-m-d H:i:s");
                if (preg_match('/Opera(\\/| )([0-9].[0-9]{1,2})/', $_SERVER['HTTP_USER_AGENT'])) {
                    $UserBrowser = "Opera";
                } elseif (preg_match('/MSIE ([0-9].[0-9]{1,2})/', $_SERVER['HTTP_USER_AGENT'])) {
                    $UserBrowser = "IE";
                } else {
                    $UserBrowser = '';
                }
                $mime_type = $UserBrowser == 'IE' || $UserBrowser == 'Opera' ? 'application/octetstream' : 'application/octet-stream';
                header('Content-Type: ' . $mime_type);
                header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
                if ($UserBrowser == 'IE') {
                    header('Content-Disposition: inline; filename="' . $file_name . '";');
                    header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
                    header('Content-Length: ' . filesize($srv_name));
                    header('Pragma: public');
                } else {
                    header('Content-Disposition: inline; filename="' . $file_name . '";');
                    header('Content-Length: ' . filesize($srv_name));
                    header('Pragma: no-cache');
                }
                @ob_end_clean();
                readfile($srv_name);
                exit;
            }
        }
    }
}
    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
    }
示例#23
0
function JLMS_tchangeHW($course_id, $option)
{
    $JLMS_CONFIG =& JLMSFactory::getConfig();
    $Itemid = $JLMS_CONFIG->get('Itemid');
    $_JLMS_PLUGINS =& JLMSFactory::getPlugins();
    $db =& JFactory::getDbo();
    $user_id = intval(mosGetParam($_REQUEST, 'user_id', 0));
    $JLMS_ACL =& JLMSFactory::getACL();
    if ($course_id && $user_id && $JLMS_ACL->CheckPermissions('homework', 'manage')) {
        $state = intval(mosGetParam($_REQUEST, 'state', 0));
        if ($state != 1) {
            $state = 0;
        }
        //$state = 1;
        $cid = mosGetParam($_REQUEST, 'cid', array(0));
        $cid2 = intval(mosGetParam($_REQUEST, 'cid2', 0));
        if ($cid2) {
            $cid = array();
            $cid[] = $cid2;
        }
        if (!is_array($cid)) {
            $cid = array(0);
        }
        if (!is_array($cid) || count($cid) < 1) {
            $action = 1 ? 'Publish' : 'Unpublish';
            echo "<script> alert('Select an item to {$action}'); window.history.go(-1);</script>\n";
            exit;
        }
        $cid1 = array();
        $cid1[] = $cid[0];
        $cids = implode(',', $cid1);
        //$now = date( 'Y-m-d', time() );
        //check rights to change id's
        $query = "SELECT id FROM #__lms_homework WHERE course_id = '" . $course_id . "'" . "\n AND id IN ( {$cids} )";
        $db->SetQuery($query);
        $cid = $db->LoadResultArray();
        if (!is_array($cid)) {
            $cid = array(0);
        }
        $cids = implode(',', $cid);
        $query = "SELECT hw_id FROM #__lms_homework_results WHERE course_id = '" . $course_id . "' AND user_id = '" . $user_id . "' AND hw_id IN ( {$cids} )";
        $db->SetQuery($query);
        $pre_cids = $db->LoadResultArray();
        if (!count($pre_cids)) {
            $pre_cids = array(0);
        }
        $upd_cid = array_intersect($cid, $pre_cids);
        $ins_cid = array_diff($cid, $pre_cids);
        $now = date('Y-m-d H:i:s');
        if (!$state) {
            $now = '';
        }
        $hw_id_notify = 0;
        if (count($upd_cid)) {
            $cids = implode(',', $upd_cid);
            if (isset($upd_cid[0]) && $upd_cid[0]) {
                $hw_id_notify = $upd_cid[0];
            }
            $query = "UPDATE #__lms_homework_results" . "\n SET hw_status = {$state}, hw_date = '" . $now . "'" . "\n WHERE hw_id IN ( {$cids} ) AND course_id = {$course_id} AND user_id = '" . $user_id . "'";
            $db->setQuery($query);
            if (!$db->query()) {
                echo "<script> alert('" . $db->getErrorMsg() . "'); window.history.go(-1); </script>\n";
                exit;
            }
        }
        if (count($ins_cid)) {
            if (isset($ins_cid[0]) && $ins_cid[0]) {
                $hw_id_notify = $ins_cid[0];
            }
            $query = "INSERT INTO #__lms_homework_results (course_id, user_id, hw_id, hw_status, hw_date) VALUES ";
            $t = 0;
            foreach ($ins_cid as $ins_id) {
                $query .= "\n ({$course_id}, " . $user_id . ", " . $ins_id . ", {$state}, '" . $now . "')" . ($t < count($ins_cid) - 1 ? ',' : '');
                $t++;
            }
            $db->setQuery($query);
            if (!$db->query()) {
                echo "<script> alert('" . $db->getErrorMsg() . "'); window.history.go(-1); </script>\n";
                exit;
            }
        }
        if ($state && $hw_id_notify) {
            //*** email notification about new homework submission
            $e_course = new stdClass();
            $e_course->course_alias = '';
            $e_course->course_name = '';
            $query = "SELECT course_name, name_alias FROM #__lms_courses WHERE id = '" . $course_id . "'";
            $db->setQuery($query);
            $e_course = $db->loadObject();
            $query = "SELECT hw_name FROM #__lms_homework WHERE id = '" . $hw_id_notify . "'";
            $db->setQuery($query);
            $e_hw_name = $db->loadResult();
            $e_user = new stdClass();
            $e_user->name = '';
            $e_user->email = '';
            $e_user->username = '';
            $query = "SELECT email, name, username FROM #__users WHERE id = '" . $user_id . "'";
            $db->setQuery($query);
            $e_user = $db->loadObject();
            $e_params['user_id'] = $user_id;
            $e_params['course_id'] = $course_id;
            $e_params['markers']['{email}'] = $e_user->email;
            $e_params['markers']['{name}'] = $e_user->name;
            $e_params['markers']['{username}'] = $e_user->username;
            $e_params['markers']['{coursename}'] = $e_course->course_name;
            //( $e_course->course_alias )?$e_course->course_alias:$e_course->course_name;
            $e_params['markers']['{homeworkname}'] = $e_hw_name;
            $e_params['markers']['{courselink}'] = JLMSEmailRoute("index.php?option=com_joomla_lms&Itemid={$Itemid}&task=details_course&id={$course_id}");
            $e_params['markers_nohtml']['{courselink}'] = $e_params['markers']['{courselink}'];
            $e_params['markers']['{courselink}'] = '<a href="' . $e_params['markers']['{courselink}'] . '">' . $e_params['markers']['{courselink}'] . '</a>';
            $e_params['markers']['{lmslink}'] = 'OnCSVImportUser';
            $e_params['markers']['{lmslink}'] = JLMSEmailRoute("index.php?option=com_joomla_lms&Itemid={$Itemid}");
            $e_params['markers_nohtml']['{lmslink}'] = $e_params['markers']['{lmslink}'];
            $e_params['markers']['{lmslink}'] = '<a href="' . $e_params['markers']['{lmslink}'] . '">' . $e_params['markers']['{lmslink}'] . '</a>';
            $e_params['action_name'] = 'OnHomeworkReview';
            $_JLMS_PLUGINS->loadBotGroup('emails');
            $plugin_result_array = $_JLMS_PLUGINS->trigger('OnHomeworkReview', array(&$e_params));
            //*** end of emails
        }
    }
    JLMSRedirect(sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=hw_stats&course_id={$course_id}&id={$cid[0]}"));
}
示例#24
0
function mail_notification($subscription)
{
    if (in_array(15, $subscription->courses)) {
        jimport('joomla.mail.helper');
        $JLMS_CONFIG =& JLMSFactory::getConfig();
        $SiteName = $JLMS_CONFIG->get('sitename');
        $MailFrom = $JLMS_CONFIG->get('mailfrom');
        $FromName = $JLMS_CONFIG->get('fromname');
        JLoader::import('autoresponder_spu', JPATH_SITE, '');
        $subject = AutoResponder::getSubject();
        $body = AutoResponder::getBody();
        $body = sprintf($body);
        $subject = JMailHelper::cleanSubject($subject);
        $body = JMailHelper::cleanBody($body);
        $from = $SiteName . ' ' . $FromName;
        $sender = JMailHelper::cleanAddress($MailFrom);
        $email = JMailHelper::cleanAddress(JRequest::getVar('x_email', ''));
        $user =& JFactory::getUser();
        $name = explode(' ', $user->name);
        $firstname = isset($name[0]) && $name[0] ? $name[0] : $user->name;
        $body = str_replace('{firstname}', $firstname, $body);
        if (JUtility::sendMail($from, $sender, $email, $subject, $body, true) !== true) {
            JError::raiseNotice(500, JText::_('EMAIL_NOT_SENT'));
        }
    }
}
    function JLMS_sreportGradeFV($option, &$rows, &$pageNav, &$lists, $levels, $filt_group, $filt_cat, $user_id, $is_full)
    {
        $JLMS_CONFIG =& JLMSFactory::getConfig();
        $Itemid = $JLMS_CONFIG->get('Itemid');
        //FLMS multicat
        $multicat = array();
        if ($JLMS_CONFIG->get('multicat_use', 0)) {
            $multicat = array();
            $i = 0;
            foreach ($lists as $key => $item) {
                if (substr($key, 0, 7) == 'filter_') {
                    $multicat[] = $lists['filter_' . $i];
                    $i++;
                }
            }
        }
        JLMS_TMPL::OpenMT();
        $lists['user_id'] = isset($lists['user_id']) ? $lists['user_id'] : 0;
        if ($is_full) {
            $hparams = array('show_menu' => false);
        } else {
            $hparams = array('simple_menu' => true);
        }
        $toolbar = array();
        $page_heading = _JLMS_REPORTS_USER . ' ' . date("Y-m-d H:i:s");
        if ($JLMS_CONFIG->get('is_trial', false) && $JLMS_CONFIG->get('trial_reports_heading_text', '')) {
            $page_heading = _JLMS_REPORTS_USER . $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(){
				var form = document.adminForm;
			//	form.view.value = view;
				form.task.value='report_grade';
				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 cellpadding="0" cellspacing="0" border="0" id="TheTable" <?php 
        echo $is_full ? "" : 'width="100%"';
        ?>
 class="jlms_table_no_borders">
					<?php 
        if (!$is_full) {
            ?>
					<tr>
						<td align="<?php 
            echo $is_full ? "left" : "right";
            ?>
" <?php 
            echo !$is_full ? 'colspan="2"' : '';
            ?>
>
							<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%"';
        ?>
>
										<table width="100%" border="0" class="jlms_table_no_borders">
											<?php 
        if ($is_full) {
            ?>
											<tr>
												<td colspan="2">
													&nbsp;
												</td>
											</tr>
											<?php 
        }
        if ($JLMS_CONFIG->get('use_global_groups', 1)) {
            ?>
											<tr>
												<td <?php 
            echo $is_full ? 'width="100"' : 'width="20%"';
            ?>
 nowrap="nowrap" style="padding-left: 5px;">
													<?php 
            echo _JLMS_USER_GROUP_INFO;
            ?>
												</td>
												<td>
													<?php 
            echo $lists['filter'];
            ?>
												</td>
											</tr>
											<?php 
        }
        ?>
											<tr>
												<td <?php 
        echo $is_full ? 'width="100"' : 'width="20%"';
        ?>
 nowrap="nowrap" style="padding-left: 5px;">
													<?php 
        echo _JLMS_USERS_TBL_HEAD_USERNAME . ':';
        ?>
												</td>
												<td>
													<?php 
        echo $lists['jlms_filt_user'];
        ?>
												</td>
											</tr>
										</table>
									</td>
									<?php 
        if (!$is_full) {
            ?>
									<td style="padding-left:15px;" align="right">
										<?php 
            $link = $JLMS_CONFIG->get('live_site') . "/index.php?tmpl=component&option=" . $option . "&amp;Itemid={$Itemid}&amp;task=report_grade&amp;is_full=1";
            if ($filt_group) {
                $link .= "&amp;filt_group=" . $filt_group;
            }
            if ($user_id) {
                $link .= "&amp;filt_user="******"<?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 
        $max_row = 0;
        for ($i = 0, $n = count($rows); $i < $n; $i++) {
            $latest_max_row = 0;
            $sc_rows = array();
            if (count($lists['sc_rows'][$i])) {
                $j = 0;
                foreach ($lists['sc_rows'][$i] as $sc_row) {
                    if ($sc_row->show_in_gradebook) {
                        $sc_rows[$j] = $sc_row;
                        $j++;
                    }
                }
            }
            $latest_max_row = $latest_max_row + count($sc_rows);
            $latest_max_row = $latest_max_row + count($lists['quiz_rows'][$i]);
            $latest_max_row = $latest_max_row + count($lists['gb_rows'][$i]);
            if ($latest_max_row > $max_row) {
                $max_row = $latest_max_row;
            }
        }
        ?>

				<table cellpadding="0" cellspacing="0" border="0" width="100%" class="<?php 
        echo JLMSCSS::_('jlmslist');
        ?>
">
				<?php 
        for ($i = 0, $n = count($rows); $i < $n; $i++) {
            $row = $rows[$i];
            ?>
						<tr style="border: 0px none;">
							<td colspan="<?php 
            echo $max_row + 1;
            ?>
" style="border: 0px none;">
							<br />
								<?php 
            echo JLMSCSS::h2($row->course_name);
            ?>
								<span class="small"><?php 
            echo _JLMS_REPORTS_ACCESSED_TIMES . " " . $lists['hits'][$i];
            ?>
</span>
							</td>
						</tr>
						<tr class="jlms_report_fullview_row">
							<<?php 
            echo JLMSCSS::tableheadertag();
            ?>
 class="<?php 
            echo JLMSCSS::_('sectiontableheader', 'first_td');
            ?>
" style="text-align:center; white-space:nowrap"><?php 
            echo _JLMS_REPORTS_CONCLUSION_ROW;
            ?>
</<?php 
            echo JLMSCSS::tableheadertag();
            ?>
>
							<?php 
            $sc_num = 0;
            $i_row = 0;
            foreach ($lists['sc_rows'][$i] as $sc_row) {
                if ($sc_row->show_in_gradebook) {
                    $sc_num++;
                    echo '<' . JLMSCSS::tableheadertag() . ' align=\'center\' nowrap=\'nowrap\' class="' . JLMSCSS::_('sectiontableheader') . '" style="text-align:center; white-space:nowrap">' . JLMS_reports_html::Echo_tbl_header($sc_row->lpath_name) . '</' . JLMSCSS::tableheadertag() . '>';
                    $i_row++;
                }
            }
            foreach ($lists['quiz_rows'][$i] as $quiz_row) {
                echo '<' . JLMSCSS::tableheadertag() . ' align=\'center\' nowrap=\'nowrap\' class="' . JLMSCSS::_('sectiontableheader') . '" style="text-align:center; white-space:nowrap">' . JLMS_reports_html::Echo_tbl_header($quiz_row->c_title) . '</' . JLMSCSS::tableheadertag() . '>';
                $i_row++;
            }
            foreach ($lists['gb_rows'][$i] as $gb_row) {
                echo '<' . JLMSCSS::tableheadertag() . ' align=\'center\' nowrap=\'nowrap\' class="' . JLMSCSS::_('sectiontableheader') . '" style="text-align:center; white-space:nowrap">' . JLMS_reports_html::Echo_tbl_header($gb_row->gbi_name) . '</' . JLMSCSS::tableheadertag() . '>';
                $i_row++;
            }
            if ($i_row < $max_row) {
                for ($jj = $i_row; $jj < $max_row; $jj++) {
                    echo '<' . JLMSCSS::tableheadertag() . ' align=\'center\' nowrap=\'nowrap\' class="' . JLMSCSS::_('sectiontableheader') . '" style="text-align:center; white-space:nowrap">&nbsp;<!--x--></' . JLMSCSS::tableheadertag() . '>';
                }
            }
            ?>
						</tr>
					<?php 
            $k = 1;
            ?>
						<tr class="<?php 
            echo JLMSCSS::_('sectiontableentry' . $k, 'jlms_report_fullview_row_bottom');
            ?>
">
							<td align="center" valign="middle" style=" text-align:center; vertical-align:middle" class="first_td">
								<?php 
            $image = $row->user_certificate ? 'btn_accept.png' : 'btn_cancel.png';
            $alt = '';
            $state = $row->user_certificate ? 0 : 1;
            echo JLMS_reports_html::publishIcon($row->user_id, 0, $state, 'gb_crt', $alt, $image, $option);
            ?>
							</td>
							<?php 
            $sc_num2 = 0;
            foreach ($lists['sc_rows'][$i] as $sc_row) {
                if ($sc_row->show_in_gradebook) {
                    $j = 0;
                    while ($j < count($row->scorm_info)) {
                        if ($row->scorm_info[$j]->gbi_id == $sc_row->item_id) {
                            if ($sc_num2 < $sc_num) {
                                if ($row->scorm_info[$j]->user_status == -1) {
                                    echo '<td align=\'center\' style="text-align:center">-</td>';
                                } else {
                                    $image = $row->scorm_info[$j]->user_status ? 'btn_accept.png' : 'btn_cancel.png';
                                    $alt = $row->scorm_info[$j]->user_status ? 'btn_accept' : 'btn_cancel';
                                    $alt .= '" align="top';
                                    $img = JLMS_reports_html::publishIcon(0, 0, 0, '', $alt, $image, $option, false);
                                    echo '<td style="vertical-align:middle; text-align:center" nowrap="nowrap">' . $img . '&nbsp;<strong>' . $row->scorm_info[$j]->user_grade . "</strong> (" . $row->scorm_info[$j]->user_pts . ")" . '</td>';
                                }
                                $sc_num2++;
                            }
                        }
                        $j++;
                    }
                }
            }
            foreach ($lists['quiz_rows'][$i] as $quiz_row) {
                $j = 0;
                while ($j < count($row->quiz_info)) {
                    if ($row->quiz_info[$j]->gbi_id == $quiz_row->c_id) {
                        if ($row->quiz_info[$j]->user_status == -1) {
                            echo '<td align=\'center\' style="text-align:center">-</td>';
                        } else {
                            //											$image = $row->quiz_info[$j]->user_status ? 'btn_accept.png' : 'btn_cancel.png';
                            //											$alt = $row->quiz_info[$j]->user_status ? 'btn_accept' : 'btn_cancel';
                            //											$alt .= '" align="top';
                            //											$img = JLMS_reports_html::publishIcon(0, 0, 0, '', $alt, $image, $option, false );
                            //
                            //											echo '<td style="vertical-align:middle; text-align:center" nowrap="nowrap">'.$img
                            //											. '&nbsp;<strong>' . $row->quiz_info[$j]->user_grade . "</strong> (" . $row->quiz_info[$j]->user_pts_full .")"
                            //											. '</td>';
                            echo '<td style="vertical-align:middle; text-align:center" nowrap="nowrap">';
                            echo JLMS_showQuizStatus($row->quiz_info[$j], 50);
                            echo '</td>';
                        }
                    }
                    $j++;
                }
            }
            $j = 0;
            while ($j < count($row->grade_info)) {
                echo '<td align=\'center\' valign="middle" style="vertical-align:middle;text-align:center "><strong>' . $row->grade_info[$j]->user_grade . '</strong></td>';
                $j++;
            }
            if ($i_row < $max_row) {
                for ($jj = $i_row; $jj < $max_row; $jj++) {
                    echo '<td align=\'center\' style="text-align:center;">&nbsp;<!--x--></td>';
                }
            }
            ?>
						</tr>
					<?php 
            $k = 3 - $k;
        }
        ?>
					</table>
					<?php 
        if (!$lists['user_id']) {
            echo '<div class="joomlalms_page_tip"  style="text-align:center">' . _JLMS_REPORTS_SELECT_USER . '</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="report_grade" />
				<input type="hidden" name="state" value="0" />
				<input type="hidden" name="view" value="" />
				<input type="hidden" name="boxchecked" value="0" />
				<input type="hidden" name="is_full" value="<?php 
        echo $is_full;
        ?>
" />
	
			</form>
	<?php 
        JLMS_TMPL::CloseTS();
        JLMS_TMPL::CloseMT();
    }
示例#26
0
function JLMS_LoadSCOSCORM($option)
{
    global $JLMS_DB, $my, $Itemid;
    $JLMS_CONFIG =& JLMSFactory::getConfig();
    $id = intval(mosGetParam($_REQUEST, 'id', 0));
    $delayseconds = 20;
    // Delay time before sco launch, used to give time to browser to define API
    $delayseconds_nojs = 2;
    // if API were defined earlier than timer is passed - SCO will be launched
    if ($id) {
        $query = "SELECT * FROM #__lms_n_scorm WHERE id = {$id}";
        $JLMS_DB->SetQuery($query);
        $scorm = $JLMS_DB->LoadObject();
        if (is_object($scorm)) {
            $scoid = intval(mosGetParam($_REQUEST, 'scoid', 0));
            if (!empty($scoid)) {
                //
                // Direct SCO request
                //
                if ($sco = scorm_get_sco($scoid)) {
                    // (DEN) check if this $scoid from our SCORM !!!!
                    if ($sco->launch == '') {
                        // Search for the next launchable sco
                        $query = "SELECT * FROM #__lms_n_scorm_scoes WHERE scorm = {$scorm->id} AND launch <> '' AND id > {$sco->id} ORDER BY id ASC";
                        $JLMS_DB->SetQuery($query);
                        $scoes = $JLMS_DB->LoadObjectList();
                        //if ($scoes = get_records_select('scorm_scoes','scorm='.$scorm->id." AND launch<>'' AND id>".$sco->id,'id ASC')) {
                        if (!empty($scoes)) {
                            $sco = current($scoes);
                        }
                    }
                }
            }
            //
            // If no sco was found get the first of SCORM package
            //
            if (!isset($sco)) {
                $query = "SELECT * FROM #__lms_n_scorm_scoes WHERE scorm = {$scorm->id} AND launch <> '' ORDER BY id ASC";
                $JLMS_DB->SetQuery($query);
                $scoes = $JLMS_DB->LoadObjectList();
                //$scoes = get_records_select('scorm_scoes','scorm='.$scorm->id." AND launch<>''",'id ASC');
                $sco = current($scoes);
            }
            if (!empty($sco)) {
                if ($sco->scormtype == 'asset') {
                    $attempt = scorm_get_last_attempt($scorm->id, $my->id);
                    $element = $scorm->version == 'scorm_13' ? 'cmi.completion_status' : 'cmi.core.lesson_status';
                    $value = 'completed';
                    $result = scorm_insert_track($my->id, $scorm->id, $sco->id, $attempt, $element, $value);
                }
            }
            //
            // Forge SCO URL
            //
            $connector = '';
            $version = substr($scorm->version, 0, 4);
            if (isset($sco->parameters) && !empty($sco->parameters) || $version == 'AICC') {
                /**
                 * 06.10.2007 (DEN) "''." - is added for compatibility with Joomla compatibility :)) library compat.php50x.php (on line 105 in PHP 4.4.7 there was a notice)
                 */
                if (stripos('' . $sco->launch, '?') !== false) {
                    $connector = '&';
                } else {
                    $connector = '?';
                }
                if (isset($sco->parameters) && !empty($sco->parameters) && $sco->parameters[0] == '?') {
                    $sco->parameters = substr($sco->parameters, 1);
                }
            }
            if ($version == 'AICC') {
                if (isset($sco->parameters) && !empty($sco->parameters)) {
                    $sco->parameters = '&' . $sco->parameters;
                }
                //$launcher = $sco->launch.$connector.'aicc_sid='.$my->id.'&aicc_url='.$CFG->wwwroot.'/mod/scorm/aicc.php'.$sco->parameters;
                $launcher = $sco->launch . $connector . 'aicc_sid=' . $my->id . '&aicc_url=' . $JLMS_CONFIG->get('live_site') . "/index.php?option={$option}&Itemid={$Itemid}&task=aicc_task&course_id={$course_id}" . $sco->parameters;
                // (DEN) check this URL /\ !!!!!!!!!
            } else {
                if (isset($sco->parameters) && !empty($sco->parameters)) {
                    $launcher = $sco->launch . $connector . $sco->parameters;
                } else {
                    $launcher = $sco->launch;
                }
            }
            $query = "SELECT * FROM #__lms_scorm_packages WHERE id = {$scorm->scorm_package}";
            $JLMS_DB->SetQuery($query);
            $scorm_ref = $JLMS_DB->LoadObject();
            //$reference = $CFG->dataroot.'/'.$courseid.'/'.$reference;
            //$row->reference = _JOOMLMS_SCORM_FOLDER_PATH . "/" . $scorm_ref->package_srv_name;
            $reference_folder = $JLMS_CONFIG->get('live_site') . "/" . _JOOMLMS_SCORM_PLAYER . "/" . $scorm_ref->folder_srv_name;
            //$reference_folder = _JOOMLMS_SCORM_FOLDER_PATH . "/" . $scorm_ref->folder_srv_name;
            // (DEN) we don't use external links nor repositry (but maybe...maybe...)
            /*if (scorm_external_link($sco->launch)) {
            			// Remote learning activity
            			$result = $launcher;
            		} else if ($scorm->reference[0] == '#') {
            			// Repository
            			require_once($repositoryconfigfile);
            			$result = $CFG->repositorywebroot.substr($scorm->reference,1).'/'.$sco->launch;
            		} else {*/
            if (true) {
                // (DEN) we don't use external packages
                /*if ((basename($scorm->reference) == 'imsmanifest.xml') && scorm_external_link($scorm->reference)) {
                			// Remote manifest
                			$result = dirname($scorm->reference).'/'.$launcher;
                		} else {*/
                if (true) {
                    // Moodle internal package/manifest or remote (auto-imported) package
                    //if (basename($scorm->reference) == 'imsmanifest.xml') {
                    if (basename($reference_folder) == 'imsmanifest.xml') {
                        //$basedir = dirname($scorm->reference);
                        $basedir = dirname($reference_folder);
                    } else {
                        $basedir = $reference_folder;
                        //$CFG->moddata.'/scorm/'.$scorm->id;
                    }
                    /*if ($CFG->slasharguments) {
                    			$result = $CFG->wwwroot.'/file.php/'.$scorm->course.'/'.$basedir.'/'.$launcher;
                    		} else {
                    			$result = $CFG->wwwroot.'/file.php?file=/'.$scorm->course.'/'.$basedir.'/'.$launcher;
                    		}*/
                    $result = $reference_folder . '/' . $launcher;
                    // determine the name of the API variable, which are we looking for
                    $LMS_api = $scorm->version == 'scorm_12' || $scorm->version == 'SCORM_1.2' || empty($scorm->version) ? 'API' : 'API_1484_11';
                    if (isset($sco->scormtype) && strtolower($sco->scormtype) == 'asset') {
                        $delayseconds = 2;
                        // if resource is 'asset' - we don't need SCORM API
                    }
                    ?>
<html>
    <head>
        <title>LoadSCO</title>
        <script type="text/javascript">
        //<![CDATA[
		var delaySeconds = <?php 
                    echo $delayseconds;
                    ?>

		function findscormAPI(win) {
			var findAPITries = 0;
			while ((win.<?php 
                    echo $LMS_api;
                    ?>
 == null) && (win.parent != null) && (win.parent != win)) {
				findAPITries++;
				if (findAPITries > 7) { // we don't have more than 7 nested window objects....
					return null;
				}
				win = win.parent;
			}
			return win.<?php 
                    echo $LMS_api;
                    ?>
;
		}

		function getscormAPI() {
			var theAPI = findscormAPI(window);
			if ((theAPI == null) && (window.opener != null) && (typeof(window.opener) != "undefined")) {
				theAPI = findscormAPI(window.opener);
			}
			if (theAPI == null) {
				return null;
			}
			return theAPI;
		}

		function try_redirect() {
			if (getscormAPI() == null) {
				delaySeconds = delaySeconds - 1;
				if (delaySeconds < 0) {
					setTimeout('do_window_redirect();',1000);
				} else {
					setTimeout('try_redirect();',1000);
				}
			} else {
				setTimeout('do_window_redirect();',1000);
			}
		}
		function do_window_redirect() {
			document.location = "<?php 
                    echo $result;
                    ?>
";
		}
        //]]>
        </script>
        <noscript>
            <meta http-equiv="refresh" content="<?php 
                    echo $delayseconds_nojs;
                    ?>
;url=<?php 
                    echo $result;
                    ?>
" />
        </noscript> 
    </head>
    <body onload="try_redirect();">
        <br /><br /><center><img src="<?php 
                    echo $JLMS_CONFIG->get('live_site');
                    ?>
/components/com_joomla_lms/lms_images/loading.gif" height="32" width="32" border="0" alt="loading" /></center>
    </body>
</html>
<?php 
                }
            }
        }
    }
    die;
}
示例#27
0
 function onAfterRoute()
 {
     $database = JFactory::getDBO();
     $task = JRequest::getVar('task', '');
     $option = JRequest::getVar('option', '');
     $id = JRequest::getInt('id');
     $version = new JVersion();
     $app =& JFactory::getApplication();
     $loginTasks = array('login', 'user.login');
     $logoutTasks = array('logout', 'user.logout');
     $editTasks = array('saveUserEdit', 'saveregisters', 'profile.save', 'registration.register', 'register_save', 'user.save', 'user.apply', 'save', 'apply');
     if (strnatcasecmp($version->RELEASE, '1.7') >= 0) {
         $jVersion = 17;
     } else {
         if (strnatcasecmp($version->RELEASE, '1.6') >= 0) {
             $jVersion = 16;
         } else {
             $jVersion = 15;
         }
     }
     if (file_exists(JPATH_SITE . DS . 'components' . DS . 'com_joomla_lms' . DS . "includes" . DS . "classes" . DS . "lms.factory.php")) {
         require_once JPATH_SITE . DS . 'components' . DS . 'com_joomla_lms' . DS . "includes" . DS . "classes" . DS . "lms.factory.php";
     } else {
         //JoomlaLMS system files not found
         return;
     }
     if (!file_exists(JPATH_SITE . DS . 'components' . DS . 'com_joomla_lms' . DS . 'includes' . DS . 'forums' . DS . 'smf' . DS . 'smf.php')) {
         //JoomlaLMS system files not found
         return;
     }
     if (!class_exists('JLMSFactory')) {
         //JoomlaLMS system class not found
         return;
     }
     jimport('joomla.user.helper');
     $JLMS_CONFIG = JLMSFactory::getConfig();
     /* admin language for JoomlaLMS BackEnd menu */
     $app =& JFactory::getApplication();
     if ($app->isAdmin()) {
         $language = $JLMS_CONFIG->get('default_language');
         $lang_path = JPATH_SITE . DS . "administrator" . DS . "components" . DS . "com_joomla_lms";
         $lang =& JFactory::getLanguage();
         $oldLang = $lang->setDefault('english');
         if ($jVersion >= 16) {
             $lang->load('com_joomla_lms.sys', $lang_path, $language);
         } else {
             $lang->load('admin.menu.lang', $lang_path, $language);
         }
         $lang->setDefault($oldLang);
     }
     /* end of admin language */
     $user_id = 0;
     if (in_array($task, $loginTasks)) {
         $username = JRequest::getVar('username', '', 'post', 'username');
         $password = JRequest::getVar('password', '', 'post', 'string', JREQUEST_ALLOWRAW);
         if (!$username) {
             return false;
         }
         if (!$password) {
             $password = JRequest::getVar('passwd', '', 'post', 'string', JREQUEST_ALLOWRAW);
         }
         $query = 'SELECT * ' . ' FROM `#__users`' . ' WHERE username='******':', $result->password);
             $crypt = $parts[0];
             $salt = @$parts[1];
             $testcrypt = JUserHelper::getCryptedPassword($password, $salt);
             if ($crypt == $testcrypt) {
                 $juser = $result;
             }
         }
         if (isset($juser->id)) {
             $user_id = $juser->id;
         }
     } else {
         $user =& JFactory::getUser();
         $user_id = $id ? $id : $user->get('id');
     }
     //echo '<pre>';
     //print_r($juser);
     //echo '</pre>';
     //die;
     $do_synchronize = false;
     if ($this->params->get('synch_all_users', 1)) {
         $do_synchronize = true;
     } else {
         if (!$user_id) {
             return false;
         }
         $query = "SELECT user_id FROM #__lms_users WHERE user_id = " . $user_id;
         $database->setQuery($query);
         $lms_user_id = $database->LoadResult();
         if (!$lms_user_id) {
             $query = "SELECT user_id FROM #__lms_user_courses WHERE user_id = " . $user_id;
             $database->setQuery($query);
             $lms_user_id = $database->LoadResult();
             if (!$lms_user_id) {
                 $query = "SELECT user_id FROM #__lms_users_in_groups WHERE user_id = " . $user_id;
                 $database->setQuery($query);
                 $lms_user_id = $database->LoadResult();
             }
         }
         if (!$lms_user_id) {
             $do_synchronize = false;
         } else {
             $do_synchronize = true;
         }
     }
     if ($JLMS_CONFIG->get('plugin_forum') && $option && $do_synchronize) {
         if (in_array($option, array('com_users', 'com_user', 'com_comprofiler')) && in_array($task, $loginTasks)) {
             $forum =& JLMS_SMF::getInstance();
             if (is_object($forum)) {
                 //require_once ( JPATH_SITE.'/components/com_joomla_lms/includes/jlms_reg_forum.php');
                 if (isset($juser) && is_object($juser)) {
                     if (isset($juser->id)) {
                         //----> CB section
                         $query = "SELECT lms_config_var, lms_config_value FROM `#__lms_config` WHERE lms_config_var LIKE '%_cb_%' ";
                         $database->setQuery($query);
                         $configs = $database->loadObjectList();
                         $cb_values = array();
                         foreach ($configs as $cb_value) {
                             $cb_values[$cb_value->lms_config_var] = $cb_value->lms_config_value;
                         }
                         $cb_info = array();
                         if ($cb_values['is_cb_installed']) {
                             $fields = array('website', 'ICQ', 'AIM', 'YIM', 'MSN', 'location');
                             $fields_isset = array();
                             foreach ($fields as $field) {
                                 if (isset($cb_values['jlms_cb_' . $field]) && $cb_values['jlms_cb_' . $field]) {
                                     $fields_isset[] = $cb_values['jlms_cb_' . $field];
                                 }
                             }
                             if (!empty($fields_isset)) {
                                 $fields_str = implode(',', $fields_isset);
                                 $query = "SELECT name FROM `#__comprofiler_fields` WHERE fieldid IN ({$fields_str}) ";
                                 $database->setQuery($query);
                                 $field_name = $database->loadResultArray();
                                 $field_names = implode(',', $field_name);
                                 $query = "SELECT " . $field_names . " FROM `#__comprofiler` WHERE user_id=" . $juser->id;
                                 $database->setQuery($query);
                                 $cb_user = $database->loadResultArray();
                                 if (isset($cb_user[0])) {
                                     $cb_info = array_values($cb_user);
                                 }
                             }
                         }
                         $groups = '';
                         $smf_user = $forum->loadMemberByName($username);
                         if (is_object($smf_user) && isset($smf_user->id_member)) {
                             $mem_id = $smf_user->id_member;
                         } else {
                             $mem_id = $forum->registerOnForum($juser, $password, $groups, $cb_info);
                         }
                         $forum->setLoginCookie15($mem_id, $password);
                     }
                 }
             }
         } elseif (in_array($option, array('com_users', 'com_user', 'com_comprofiler')) && in_array($task, $logoutTasks)) {
             $forum =& JLMS_SMF::getInstance();
             if (is_object($forum)) {
                 $cookiename = $forum->getCookieName();
                 $parts = $forum->urlParts();
                 if ($parts[0] == 'localhost') {
                     setcookie($cookiename, 0, time() - 3600, $parts[1]);
                 } else {
                     setcookie($cookiename, 0, time() - 3600, $parts[1], $parts[0]);
                 }
             }
         } elseif (in_array($option, array('com_users', 'com_user', 'com_comprofiler')) && in_array($task, $editTasks)) {
             if (!$id) {
                 return false;
             }
             $forum =& JLMS_SMF::getInstance();
             if (is_object($forum)) {
                 $loginForm = JRequest::getVar('jform', array(), 'default', 'array');
                 $verifyPass = JRequest::getVar('password__verify', '', 'post', 'string', JREQUEST_ALLOWRAW);
                 $isCB = !$verifyPass ? false : true;
                 if ($isCB) {
                     $email = JRequest::getVar('email');
                     $username = JRequest::getVar('username');
                     $name = JRequest::getVar('name');
                     $postPass = JRequest::getVar('password', '', 'post', 'string', JREQUEST_ALLOWRAW);
                 } else {
                     if ($jVersion > 15) {
                         $username = $loginForm['username'];
                         $name = $loginForm['name'];
                         if ($app->isAdmin()) {
                             $email = $loginForm['email'];
                             $postPass = $loginForm['password'];
                         } else {
                             $email = $loginForm['email1'];
                             $postPass = $loginForm['password1'];
                         }
                         $verifyPass = $loginForm['password2'];
                     } else {
                         $email = JRequest::getVar('email');
                         $username = JRequest::getVar('username');
                         $name = JRequest::getVar('name');
                         $postPass = JRequest::getVar('password', '', 'post', 'string', JREQUEST_ALLOWRAW);
                         $verifyPass = JRequest::getVar('password2', '', 'post', 'string', JREQUEST_ALLOWRAW);
                     }
                 }
                 //$pass='******';
                 $password = '';
                 if (!preg_match("/.+@.+\\..+/", $email)) {
                     return false;
                 }
                 if ($username) {
                     if ($verifyPass) {
                         if ($verifyPass == $postPass) {
                             $password = $forum->password($username, $postPass);
                             //$pass = "******".$password."', ";
                         } else {
                             return false;
                         }
                     }
                 }
                 if ($id) {
                     $query = "SELECT username FROM `#__users` WHERE id='" . $id . "'";
                     $database->setQuery($query);
                     $database->query();
                     $usernameOld = $database->loadResult();
                     $smf_user = $forum->loadMemberByName($usernameOld);
                     $userid_forum = $smf_user->id_member;
                     $storeData = get_object_vars($smf_user);
                 }
                 $storeData['id_member'] = $userid_forum;
                 $storeData['member_name'] = $username;
                 $storeData['email_address'] = $email;
                 $storeData['real_name'] = $name;
                 if ($password) {
                     $storeData['passwd'] = $password;
                 }
                 $forum->storeMember($storeData);
                 if ($password) {
                     $forum->setLoginCookie15($userid_forum, $post_password);
                 }
             }
         }
     }
 }
示例#28
0
 function file()
 {
     $JLMS_CONFIG =& JLMSFactory::getConfig();
     return 'jlms_107.css?rev=' . $JLMS_CONFIG->getVersionToken();
 }
示例#29
0
    function ShowCertificates($option, $id, &$rows)
    {
        global $Itemid;
        $JLMS_CONFIG =& JLMSFactory::getConfig();
        $toolbar = array();
        $toolbar[] = array('btn_type' => 'new', 'btn_txt' => _JLMS_QUIZ_NEW_CRTF_BTN, 'btn_js' => sefRelToAbs("index.php?option={$option}&amp;Itemid={$Itemid}&amp;id={$id}&amp;task=quizzes&amp;page=add_crtf"));
        $toolbar[] = array('btn_type' => 'edit', 'btn_txt' => _JLMS_QUIZ_EDIT_CRTF_BTN, 'btn_js' => "javascript:submitbutton('edit_crtf');");
        $toolbar[] = array('btn_type' => 'del', 'btn_txt' => _JLMS_QUIZ_DEL_CRTF_BTN, 'btn_js' => "javascript:submitbutton('del_crtf');");
        $toolbar[] = array('btn_type' => 'preview', 'btn_txt' => _JLMS_QUIZ_PREVIEW_CRTF_BTN, 'btn_js' => "javascript:submit_preview();");
        JLMS_quiz_admin_html_class::showQuizHead($id, $option, _JLMS_QUIZ_CERTIFICATES_TITLE, true, $toolbar);
        ?>
<script language="javascript" type="text/javascript">
<!--
function submitbutton(pressbutton) {
	var form = document.adminForm;
	if ( ((pressbutton == 'edit_crtf') || (pressbutton == 'del_crtf') ) && (form.boxchecked.value == "0")) {
		alert('<?php 
        echo _JLMS_ALERT_SELECT_ITEM;
        ?>
');
	} else {
		form.page.value = pressbutton;
		form.submit();
	}
}
function submit_preview() {
	var crtf_id = 0;
	var form = document.adminForm;
	if (form.boxchecked.value == "0") {
		alert('<?php 
        echo _JLMS_ALERT_SELECT_ITEM;
        ?>
');
	} else {
		var selItem = document.adminForm['cid[]'];
		if (selItem) {
			if (selItem.length) { var i;
				for (i = 0; i<selItem.length; i++) {
					if (selItem[i].checked) {
						if (selItem[i].value > 0) { crtf_id = selItem[i].value; break; }
					}
				}
			} else if (selItem.checked) { crtf_id = selItem.value; }
		}
		if (crtf_id != '0' && crtf_id != '0') {
			window.open('<?php 
        echo $JLMS_CONFIG->get('live_site') . "/index.php?tmpl=component&option=com_joomla_lms&Itemid={$Itemid}&no_html=1&task=quizzes&id={$id}&page=preview_crtf&crtf_id='+crtf_id+'";
        ?>
');
		}
	}
}
//-->
</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" class="<?php 
        echo JLMSCSS::_('jlmslist');
        ?>
">
			<tr>
				<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 width="20" class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" align="center">#</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
				<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 width="20" class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
" align="center"><input type="checkbox" name="toggle" value="" onclick="checkAll(<?php 
        echo count($rows);
        ?>
);" /></<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
				<<?php 
        echo JLMSCSS::tableheadertag();
        ?>
 class="<?php 
        echo JLMSCSS::_('sectiontableheader');
        ?>
"><?php 
        echo _JLMS_QUIZ_TBL_CRTF_NAME;
        ?>
</<?php 
        echo JLMSCSS::tableheadertag();
        ?>
>
			</tr>
		<?php 
        $k = 1;
        for ($i = 0, $n = count($rows); $i < $n; $i++) {
            $row = $rows[$i];
            #$link 	= sefRelToAbs("index.php?option=".$option."&amp;Itemid=".$Itemid."&amp;task=quizzes&amp;id=$id&amp;page=quizzes&amp;cat_id=". $row->c_id);
            $checked = mosHTML::idBox($i, $row->id);
            ?>
			<tr class="<?php 
            echo JLMSCSS::_('sectiontableentry' . $k);
            ?>
">
				<td align="center"><?php 
            echo $i + 1;
            ?>
</td>
				<td align="center"><?php 
            echo $checked;
            ?>
</td>
				<td align="left">
					<?php 
            echo $row->crtf_name ? $row->crtf_name : $row->crtf_text;
            ?>
				</td>
			</tr>
			<?php 
            $k = 3 - $k;
        }
        ?>
		</table>
		<input type="hidden" name="option" value="<?php 
        echo $option;
        ?>
" />
		<input type="hidden" name="page" value="" />
		<input type="hidden" name="task" value="quizzes" />
		<input type="hidden" name="boxchecked" value="0" />
		<input type="hidden" name="id" value="<?php 
        echo $id;
        ?>
" />
		</form>
		<?php 
        JLMS_quiz_admin_html_class::showQuizFooter();
    }