Пример #1
0
<?php 
} elseif ($lesson->mediaType == "video") {
    $this->renderPartial('/lesson/_file_video', array('lesson' => $lesson));
} elseif ($lesson->mediaType == "text") {
    ?>
<div class="dxd-post-content" style="margin-bottom:30px;">
<?php 
    $text = Text::model()->findByPk($lesson->mediaId);
    echo $text->content;
    ?>
</div>
<?php 
}
?>

<div class="mt10">
    <!-- JiaThis 分享 -->
    <div class="pull-left">
        <?php 
$this->widget('ext.jiathis.JiaThis');
?>
    </div>
    <?php 
$finished = LessonLearn::model()->checkFinish($lesson->id, Yii::app()->user->id);
?>
    <?php 
echo CHtml::link(Yii::t('app', '学完了'), array('lesson/toggleFinishLearn', 'id' => $lesson->id), array('onclick' => 'openFancyBox(this);$(this).toggleClass("btn-success");return false;', 'class' => 'pull-right btn btn-default ' . ($finished ? 'btn-success' : "")));
?>
    <div class="clearfix"></div>
</div>
Пример #2
0
 /**
  *
  */
 public function getLearnLessonNum()
 {
     $criteria = new CDbCriteria();
     $criteria->join = 'left join {{lesson}} l on t.lessonId=l.id';
     $criteria->addcondition("l.courseId={$this->id}");
     $criteria->addcondition('t.userId=' . Yii::app()->user->id);
     $num = LessonLearn::model()->count($criteria);
     return $num ? (int) $num : 0;
 }
Пример #3
0
 public function actionProgress($id, $userId = 0)
 {
     $course = $this->loadModel($id);
     if (!$userId) {
         $userId = Yii::app()->user->id;
     }
     $user = UserInfo::model()->findByPk($userId);
     if (!$user) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     $criteria = new CDbCriteria();
     $criteria->condition = "courseId=:courseId and status=:status and chapterId=0";
     $criteria->params = array(':courseId' => $course->id, ':status' => Lesson::STATUS_PUBLIC);
     $criteria->order = "weight asc";
     $lessons = Lesson::model()->findAll($criteria);
     $criteria->condition = "courseId=:courseId";
     $criteria->params = array(':courseId' => $course->id);
     $chapters = Chapter::model()->findAll($criteria);
     $lessonsAndChapters = array_merge($lessons, $chapters);
     usort($lessonsAndChapters, array(new LessonSorter(), 'sortByWeight'));
     if ($userId) {
         $member = CourseMember::model()->findByAttributes(array('courseId' => $course->id, 'userId' => $userId));
     } else {
         $member = new CourseMember();
     }
     $lessonTotalCount = $course->lessonCount;
     $lessonLearnedCount = LessonLearn::model()->lessonCount($userId, $course->id);
     $nextLesson = LessonLearn::model()->nextLesson($course->id, $userId);
     $this->render('progress', array('lessonsAndChapters' => $lessonsAndChapters, 'course' => $course, 'member' => $member, 'lessonTotalCount' => $lessonTotalCount, 'lessonLearnedCount' => $lessonLearnedCount, 'user' => $user, 'percent' => $lessonTotalCount > 0 ? 100 * $lessonLearnedCount / $lessonTotalCount : 0, 'nextLesson' => $nextLesson));
 }
Пример #4
0
 public function actionToggleFinishLearn($id)
 {
     //$learn = new LessonLearn($id, Yii::app()->user->id);
     $learn = LessonLearn::model()->findByAttributes(array('userId' => Yii::app()->user->id, 'lessonId' => $id));
     if ($learn) {
         if ($learn->status == LessonLearn::STATUS_FINISH) {
             $learn->notFinish();
         } else {
             $learn->finish();
         }
     }
     /*        $currentLesson  =   $this->loadModel($id);
             $nextLesson     =   Lesson::model()->find('courseId=' . $currentLesson->courseId . ' and ' . 'weight=' . ($currentLesson->weight+1));
             $this->renderPartial('_toggleFinishLearn', array('nextLesson'=>$nextLesson));
     		$learn->status==LessonLearn::STATUS_FINISH ? true : false;
     */
     echo $learn->status == LessonLearn::STATUS_FINISH ? "恭喜,请继续努力" : "请继续努力";
 }
Пример #5
0
<?php

$learn = LessonLearn::model()->findByAttributes(array('lessonId' => $data->id, 'userId' => $user->id));
?>
<div style="color:#666">
<?php 
if ($data->mediaType != "quiz") {
    ?>
<div>
	<div class="lead light-green" style="margin-bottom:10px;">
		<a href="<?php 
    echo Yii::app()->createUrl('course/lesson/view', array('id' => $data->id));
    ?>
" class='light-green' >	
		<span class="pull-left"><?php 
    echo Yii::t('app', '课时');
    ?>
&nbsp;<?php 
    echo $data->number;
    ?>
&nbsp;&nbsp;&nbsp;</span>	
	<?php 
    echo $data->title;
    ?>
	
		</a>
	</div>
		<?php 
    if ($learn) {
        ?>
		<div>
Пример #6
0
 public function actionToggleFinishLearn($id)
 {
     //$learn = new LessonLearn($id, Yii::app()->user->id);
     $learn = LessonLearn::model()->findByAttributes(array('userId' => Yii::app()->user->id, 'lessonId' => $id));
     if ($learn) {
         if ($learn->status == LessonLearn::STATUS_FINISH) {
             $learn->notFinish();
         } else {
             $learn->finish();
         }
     }
     echo $learn->status == LessonLearn::STATUS_FINISH ? true : false;
 }
			<?php 
    }
    ?>
		<?php 
    if ($data->isFree && (!$member || !$member->inRoles(array('student', 'teacher', 'admin')))) {
        ?>
			<span class="text-warning ml10" style="font-size:0.9em"><?php 
        echo Yii::t('app', '免费');
        ?>
</span>
			<?php 
    }
    ?>
	
			<?php 
    if (LessonLearn::model()->checkFinish($data->id, Yii::app()->user->id)) {
        echo CHtml::image(Yii::app()->baseUrl . "/images/tick.png", Yii::t('app', '已学完'), array('style' => 'margin-left:10px;height:14px;'));
    }
    ?>
	
		<!--  
		<div class="muted" style="font-size:0.8em;"><?php 
    //$introduction= strip_tags($data->introduction);echo mb_substr($introduction, 0,70,'utf-8');if(mb_strlen($introduction)>70) echo "..."
    ?>
</div>
		-->
	</div>
	
</a>
<?php 
} else {