public function actionQa() { $courseId = Yii::$app->request->get('cid'); $model = $this->findModelByCoursId($courseId); // var_dump($model);die; $categoryModel = Category::findOneById($model->category); $isLearn = false; if (UserCourse::isLearn(Yii::$app->user->id, $courseId)) { $isLearn = true; } $learnPersent = UserPlay::getLearnPercent(Yii::$app->user->id, $courseId) * 100; $learnTimeToal = Common::transTime(UserCourse::findOneLearnModel(Yii::$app->user->id, $courseId)->learn_time_total); return $this->render('qa', ['course' => $model, 'categoryModel' => $categoryModel, 'isLearn' => $isLearn, 'learnPersent' => $learnPersent, 'learnTimeToal' => $learnTimeToal]); }
<div class="col-lg-2 col-md-2 col-sm-2 user-head-pic"> <img src="<?php echo $model->head_picture?>" class="img-circle" id="user-head-pic" width="140px"> </div> <div class="col-lg-3 col-md-3 col-sm-3 zone-username"> <h2><?php echo $model->username;?></h2> <h4 class="signature"><?php echo $model->signature;?></h4> </div> <div class="col-lg-3 col-lg-offset-4 col-md-3 col-md-offset-4 col-sm-3 col-sm-offset-4 zone-nut"> <ul class="list-inline"> <li class="col-lg-6 col-md-6 col-sm-6 "> <?php if (Common::transTime(UserCourse::userTotalTime($model->id)) == 0): ?> <h4>0</h4> <?php else: ?> <h4><?php echo Common::transTime(UserCourse::userTotalTime($model->id))?></h4> <?php endif ?> <h5>学习时长</h5> </li> <li class="col-lg-6 col-md-6 col-sm-6 "> <h4><?php echo Nut::nutCount($model->id)?></h4> <h5>果果</h5> </li> </ul> </div> </div> <div class="col-lg-2 col-md-2 col-sm-2 zone-user-sex"> <?php if ($model->sex == $model::SEX_FEMALE) : ?> <span class="fa fa-venus"></span> <?php endif; ?>
<li> <time class="cbp_tmtime" datetime=""> <span><?php echo date('Y-m-d', strtotime($userCourse->create_time))?></span> <span><?php echo date('H:i', strtotime($userCourse->create_time))?></span></time> <div class="cbp_tmicon cbp_tmicon-learn"> <?php if ($userCourse->type == UserCourse::TYPE_FOCUS): ?> <abbr title="focus" class="initialism"><span class="fa fa-heart"></span></abbr> <?php else :?> <abbr title="learn" class="initialism"><span class="fa fa-tasks"></span></abbr> <?php endif ?> </div> <div class="cbp_tmlabel"> <h2><?php echo Course::findOneById($userCourse->course_id)->name?></h2> <a href="/course/view?cid=<?php echo Course::findOneById($userCourse->course_id)->id?>"><img src="<?php echo Course::findOneById($userCourse->course_id)->icon?>" alt="" class="img-rounded"></a> <?php if ($userCourse->type == UserCourse::TYPE_LEARN): ?> <span >已学<?php echo UserPlay::getLearnPercent(Yii::$app->user->id, $userCourse->course_id) * 100 . '%'?> 用时 <?php echo Common::transTime(UserCourse::findOneLearnModel(Yii::$app->user->id, $userCourse->course_id)->learn_time_total)?></span> <?php endif ?> </div> </li> <?php endforeach ?> </ul> <?php else: ?> <div class="alert alert-warning" role="alert" style="margin-top: 15px"><?php echo Yii::t('app', 'No more focus or learn courses.');?></div> <?php endif ?> </div> <script type="text/javascript" src="/js/jquery.min.js"></script>