Exemple #1
0
 //从该节点中选出所有课程单元版本
 $res = $mysql->query("select * from courseversion_rel_courseunitversion where coursecategoryid=" . $leafcategory[$j]);
 $arr = $mysql->fetch_array($res);
 //选出所有关于这个单元的版本记录
 $ids = substr($arr["courseunitversionids"], 1, -1);
 //这个单元版本号的字符串
 //die("select * from coursegroup_rel_courseunitversion where coursegroupid=".$_GET["catid"]);
 $res = $mysql->query("select * from courseunitversion_rel_attachment where deleted=0 and id in ({$ids}) order by time desc");
 //选出目录下所包含的所有课程单元版本
 $courseunitArr = array();
 while ($arr = $mysql->fetch_array($res)) {
     //得到courseunitversion_rel_attachment表中的一列
     //**获取lp_id**
     $lp_id = $arr["lpid"];
     //**获取附件信息,如果是普通文件,则供下载使用**
     $lesson_attachment = getAttachmentinfoById($arr["attachmentid"]);
     //获得课程单元名称**
     $lesson_courseunitInfo = getCourseUnitinfoById($arr["courseunitid"]);
     $lesson_courseunitName = $lesson_courseunitInfo["title"];
     //获得课程单元版本名称**
     $lesson_courseunitversionName = $arr["versionname"];
     //获得课程单元版本类型**
     $lesson_packageType = $arr["lpid"] ? "SCORM/AICC" : "普通文件";
     //获得各种学习过程信息
     if ($lesson_packageType != "SCORM/AICC") {
         //非"SCORM/AICC"课件,无学习过程
         $lesson_status = "无状态";
         //学习状态:无状态、未学习、进行中、已完成
         $lesson_total_time = 0;
         //学习时间
         $lesson_score = 0;
			<?php
				//从该课程中选出课程单元版本
				$res = $mysql->query("select * from courseversion_rel_courseunitversion where coursecategoryid=".$_GET["catid"]);
				$arr = $mysql->fetch_array($res);//选出所有关于这个单元的版本记录
				$ids = substr($arr["courseunitversionids"],1,-1);//这个单元版本号的字符串
				//die("select * from coursegroup_rel_courseunitversion where coursegroupid=".$_GET["catid"]);
				$res = $mysql->query("select * from courseunitversion_rel_attachment where deleted=0 and id in ($ids) order by time desc");
				$courseunitArr = Array();
				while($arr = $mysql->fetch_array($res)){
					if(@$courseunitArr[$arr["courseunitid"]]["id"] == ""){
						$courseunitArr[$arr["courseunitid"]] = getCourseUnitinfoById($arr["courseunitid"]);
					}
					if($courseunitArr[$arr["courseunitid"]]["lpid"]){
						echo "<li><a href='scormShow.php?id=".$courseunitArr[$arr["courseunitid"]]["lpid"]."' target='_blank'><img src='../img/scorm.png' width='25' title='Scorm'>".$courseunitArr[$arr["courseunitid"]]["title"]."</a></li>";
					}else{
						$attachmentArr = getAttachmentinfoById($arr["attachmentid"]);
						$href= $attachmentArr["indexfile"]==""?$attachmentArr["path"]:$attachmentArr["indexfile"];
						$filename=basename($href);
						if(substr($filename, strrpos($filename, '.') + 1)=="xml"){
						$xmlurl=$href;
						$dir=dirname($href);
						if (is_dir($dir)) //取与xml文件同级目录下的模型文件
						{
							if ($dh = opendir($dir))
								{	
									while (($file = readdir($dh)) !== false)
										{	
											if(substr($file, strrpos($file, '.') + 1)=="unity3d"){
											$modelurl=$dir.$file;
											}
										 }
】所含有的课程单元列表</div>
			<div class="list_courseUnit">
			<ul>
			<?php 
$res = $mysql->query("select * from courseunitgroup where groupid=" . $_GET["id"]);
$arr = $mysql->fetch_array($res);
$ids = substr($arr["courseunitids"], 1, -1);
//die("select * from courseunit where deleted=0 and id in ($ids) order by time desc");
$res = $mysql->query("select * from courseunit where deleted=0 and id in ({$ids}) order by time desc");
while ($arr = $mysql->fetch_array($res)) {
    if ($arr["lpid"]) {
        echo "<li><a href='scormShow.php?id={$arr['lpid']}' target='_blank'><img src='../img/scorm.png' width='25' title='Scorm'>" . $arr["title"] . "</a></li>";
    } else {
        //echo getLastestCourseUnitAttachmentidBycuid($arr["id"]);
        //die();
        $attachmentArr = getAttachmentinfoById(getLastestCourseUnitAttachmentidBycuid($arr["id"]));
        $href = $attachmentArr["indexfile"] == "" ? $attachmentArr["path"] : $attachmentArr["indexfile"];
        echo "<li><a href='" . $href . "' target='_blank'>" . $arr["title"] . "</a></li>";
    }
}
?>
			</ul>
			</div>

			<div class="info">【<?php 
echo $_GET["title"];
?>
】所含有的课程单元组列表</div>
			<div class="list_courseUnit">
			<ul>
			<?php 
Exemple #4
0
function getCourseUnitsByCategoryid($userid, $categoryid)
{
    //通过用户id和目录id获取目录下的带有状态的课程单元,返回课程单元数组
    $courseunits = array();
    global $mysql;
    //从该节点中选出所有课程单元版本
    $res = $mysql->query("select * from courseversion_rel_courseunitversion where coursecategoryid=" . $categoryid);
    $arr = $mysql->fetch_array($res);
    //选出所有关于这个单元的版本记录
    $ids = substr($arr["courseunitversionids"], 1, -1);
    //这个单元版本号的字符串
    //die("select * from coursegroup_rel_courseunitversion where coursegroupid=".$_GET["catid"]);
    $res = $mysql->query("select * from courseunitversion_rel_attachment where deleted=0 and id in ({$ids}) order by time desc");
    //选出目录下所包含的所有课程单元版本
    $courseunitArr = array();
    while ($arr = $mysql->fetch_array($res)) {
        //得到courseunitversion_rel_attachment表中的一列
        //**获取lp_id**
        $lp_id = $arr["lpid"];
        //**获取附件信息,如果是普通文件,则供下载使用**
        $lesson_attachment = getAttachmentinfoById($arr["attachmentid"]);
        //获得课程单元名称**
        $lesson_courseunitInfo = getCourseUnitinfoById($arr["courseunitid"]);
        $lesson_courseunitName = $lesson_courseunitInfo["title"];
        //获得课程单元版本名称**
        $lesson_courseunitversionName = $arr["versionname"];
        //获得课程单元版本类型**
        $lesson_packageType = $arr["lpid"] ? "SCORM/AICC" : "普通文件";
        //获得各种学习过程信息
        if ($lesson_packageType != "SCORM/AICC") {
            //非"SCORM/AICC"课件,无学习过程
            $lesson_status = "无状态";
            //学习状态:无状态、未学习、进行中、已完成
            $lesson_total_time = 0;
            //学习时间
            $lesson_score = 0;
            //分数
            $lesson_view_count = 0;
            //学习次数
            $lesson_lastview_time = 0;
            //最后访问日期
            $lesson_remarks = "";
            //备注
            $href = $lesson_attachment["indexfile"] == "" ? $lesson_attachment["path"] : $lesson_attachment["indexfile"];
            $courseunit["name"] = $lesson_courseunitName . "(" . $lesson_courseunitversionName . ")";
            $courseunit["status"] = $lesson_status;
            $courseunit["totaltime"] = vtime($lesson_total_time);
            $courseunit["score"] = $lesson_score;
            $courseunit["viewcount"] = $lesson_view_count;
            $courseunit["lasttime"] = $lesson_lastview_time;
            $courseunit["remark"] = $lesson_remarks;
            $courseunit["itemurl"] = "<a href='" . $href . "'><img src='../img/down.gif' alt='下载' title='下载'></a>";
            $courseunits[] = $courseunit;
        } else {
            //"SCORM/AICC"课件,可记录学习状态
            $lesson_status = "";
            //学习状态:无状态、未学习、进行中、已完成(lp_item_view表中参数)
            $lesson_total_time = 0;
            //学习时间(lp_item_view表中参数)
            $lesson_score = 0;
            //*分数*由于每个item里都有一个分数,故暂时不知道用哪个分数;分数是什么意思
            $lesson_view_count = 0;
            //学习次数(lp_view表中参数)
            $lesson_lastview_time = 0;
            //最后访问日期(lp_item_view表中参数)
            $lesson_remarks = "";
            //*备注*
            //根据userid和lp_id获得lp_view表中的id;
            $res_lp_view = $mysql->query("select * from lp_view where lp_id= {$lp_id} and user_id = {$userid} ");
            $arr_lp_view = $mysql->fetch_array($res_lp_view);
            $lp_view_id = $arr_lp_view["id"];
            if ($lp_view_id) {
                //已经学习过该lp,则开始获取所有lp_item_view的信息(一个或多个)
                //根据lp_view_id获得lp_item_view表中所有的lp_item_view信息
                $res_lp_item_view = $mysql->query("select * from lp_item_view where lp_view_id= {$lp_view_id} ");
                //根据每个lp_item_view的status判断lp中尚未完成的个数,如果存在尚未完成的item,则$lesson_status=incompeled
                $incompleted_count = 0;
                //该lp中status为尚未完成的item个数;
                while ($arr_lp_item_view = $mysql->fetch_array($res_lp_item_view)) {
                    //依次取出lp_item_view信息
                    //$lesson_status
                    $lesson_item_status = $arr_lp_item_view["status"];
                    //当前这个item的status
                    if ($lesson_item_status != 'completed' && $lesson_item_status != 'complete') {
                        //如果该item尚未完成
                        $incompleted_count++;
                    }
                    //$lesson_total_time
                    $lesson_total_time += $arr_lp_item_view["total_time"];
                    //当前这个item的total_time
                    //$lesson_view_count
                    $lesson_view_count = $arr_lp_item_view["view_count"];
                    //lp_view表中的view_count
                    //$lesson_lastview_time;
                    $lesson_lastview_time = date('Y-m-d H:i:s', $arr_lp_item_view["start_time"]);
                    //当前这个item的上次访问时间
                }
                if ($incompleted_count != 0) {
                    //如果存在尚未完成的item
                    $lesson_status = "进行中";
                } else {
                    //所有lp_item_view都达到completed状态
                    $lesson_status = "已完成";
                }
            } else {
                //尚未学习过该lp,则$lesson_status=尚未学习
                $lesson_status = "未学习";
            }
            $courseunit["name"] = $lesson_courseunitName . "(" . $lesson_courseunitversionName . ")";
            $courseunit["status"] = $lesson_status;
            $courseunit["totaltime"] = vtime($lesson_total_time);
            $courseunit["score"] = $lesson_score;
            $courseunit["viewcount"] = $lesson_view_count;
            $courseunit["lasttime"] = $lesson_lastview_time;
            $courseunit["remark"] = $lesson_remarks;
            $courseunit["itemurl"] = "<a href=\"javascript:void(0);\" onclick=\"LaunchDueItem({$arr['lpid']})\" target=\"_blank\"><img src=\"../img/look.gif\" alt=\"查看\" title=\"查看\"></a>";
            $courseunits[] = $courseunit;
        }
    }
    return $courseunits;
}