本文整理汇总了PHP中app\models\User::findModel方法的典型用法代码示例。如果您正苦于以下问题:PHP User::findModel方法的具体用法?PHP User::findModel怎么用?PHP User::findModel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\User
的用法示例。
在下文中一共展示了User::findModel方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
<span class="fa fa-star-o"></span>
<?php endif;?>
<?php endfor;?>
<span class="comment-total"><?php echo $judgmentCount;?><?php echo Yii::t('app', 'students comment')?></span>
</div>
<?php foreach ($judgments as $judgment): ?>
<div class="media col-lg-12 col-md-12 col-sm-12 evaluation-con">
<div class="media-left media-middle">
<a href="#">
<img class="media-object img-circle" src="<?php echo User::findModel($judgment->user_id)->head_picture;?>" alt="..." width="60px">
</a>
</div>
<div class="media-body">
<span class="evaluation-name"><?php echo User::findModel($judgment->user_id)->username;?></span>
<?php for ($i = 1; $i <=5; $i++): ?>
<?php if ($i <= $judgment->score) : ?>
<span class="fa fa-star"></span>
<?php else : ?>
<span class="fa fa-star-o"></span>
<?php endif;?>
<?php endfor;?>
<h5 class="media-heading evaluation-content"><?php echo $judgment->content;?></h5>
<h6 class="evaluation-time"><?php echo Yii::t('app', 'Time')?>:<?php echo Common::getAwayTime($judgment->comment_time);?></h6>
</div>
</div>
<?php endforeach ?>
示例2: foreach
<?php foreach (Question::getQuestionList($course->id) as $question): ?>
<div class="media col-lg-12">
<div class="media-left media-middle col-lg-2">
<a href="#">
<img class="media-object img-circle" style="margin: 6% 0 0 0 " src="<?php echo User::findModel($question->user_id)->head_picture?>" alt="" width="60px">
</a>
<span class="qa-name" style="text-align: center"><?php echo User::findModel($question->user_id)->username?></span>
</div>
<div class="media-body">
<span class="fa fa-question-circle fa-lg col-lg-1 qa-question-fa"></span>
<span class="media-heading qa-content" ><?php echo Markdown::convert($question->content)?></span>
<div class="qa-new">
<span class="fa fa-comment fa-lg col-lg-1"></span>
<?php if (Answer::replyLatest($question->id)): ?>
<span>[最新回答]</span>
<span><a href=""><?php echo User::findModel(Answer::replyLatest($question->id)->answer_user_id)->username?> :</a></span>
<span><?php echo Answer::replyLatest($question->id)->content?></span>
<?php else: ?>
<span>[还没有人回答]</span>
<?php endif ?>
</div>
<span class="evaluation-time col-lg-4">时间:<?php echo Common::getAwayTime($question->create_time)?></span>
<a href="/course/qadetail?qid=<?php echo $question->id?>"><span class="fa fa-comments comment-down"><?php echo count(Answer::replyList($question->id))?></span></a>
<a href="/course/qadetail?qid=<?php echo $question->id?>"><span class="fa fa-eye comment-up"><?php echo $question->views?></span></a>
</div>
</div>
<?php endforeach ?>
</div>
</div>
<div class="tab-pane" id="attachment" style="margin-top:20px">
示例3: function
$this->title = Yii::t('app', 'Nuts');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="nut-index">
<?= GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'id',
[
'attribute' => 'user_id',
'label' => Yii::t('app', 'Username'),
'value' => function ($model) {
return User::findModel($model->user_id)->username;
}
],
[
'attribute' => 'course_id',
'label' => Yii::t('app', 'Course'),
'value' => function ($model) {
return Course::findOneById($model->course_id)->name;
}
],
'nut_count',
'create_time',
'update_time',
[
'class' => 'yii\grid\ActionColumn',
示例4: if
<div class="lear-start">
<?php if ($isLearn) : ?>
<a href="/course/learn?cid=<?php echo $course->id?>" class="btn btn-info btn-start col-lg-12"><?php echo Yii::t('app', 'Learn Continue');?></a>
<?php else : ?>
<a href="/course/learn?cid=<?php echo $course->id?>" class="btn btn-info btn-start col-lg-12"><?php echo Yii::t('app', 'Learn Start');?></a>
<?php endif;?>
</div>
<div class="teacher-info">
<h4 class="teacher-word"><?php echo Yii::t('app', 'Teacher Tips')?></h4>
<div class="media-left media-middle">
<a href="#">
<img class="media-object img-circle" src="<?php echo User::findModel($course->teacher_id)->head_picture?>" alt="..." width="80px">
</a>
</div>
<div class="media-body">
<h5><?php echo User::findModel($course->teacher_id)->username?></h5>
<!-- <h6 class="teacher-job">页面重构设计</h6> -->
</div>
<div class="col-lg-12 col-md-12 col-sm-12 course-notice">
<?php if ($course->notice): ?>
<h5><?php echo Yii::t('app', 'Course Notice')?></h5>
<p><?php echo $course->notice;?></p>
<?php endif; ?>
<?php if ($course->gains) : ?>
<h5><?php echo Yii::t('app', 'What you gaint')?></h5>
<p><?php echo $course->gains;?></p>
<!-- <ol>
<li>relative与absolute;</li>
<li>relative与z-index;</li>
示例5: empty
<span>[最新回答] <?php echo empty(Answer::replyLatest($question->id)->content) ? '暂无' : Answer::replyLatest($question->id)->content?></span>
<a href="/course/qadetail?qid=<?php echo $question->id?>"><span class="fa fa-comments comment-down"><?php echo count(Answer::replyList($question->id))?></span></a>
<a href="/course/qadetail?qid=<?php echo $question->id?>"><span class="fa fa-eye comment-up"><?php echo $question->views?></span></a>
</div>
</div>
<?php endforeach ?>
<?php else: ?>
<div class="alert alert-warning" role="alert"><?php echo Yii::t('app', 'No more questions.');?></div>
<?php endif ?>
</section>
<section id="section-reply">
<?php if (Answer::myReplyList($user->id)): ?>
<?php foreach (Answer::myReplyList($user->id) as $reply): ?>
<div class="alert alert-success" role="alert">
<span>[回复<a href="#"><?php echo User::findModel($reply->answered_user_id)->username?>]</a>:<?php echo $reply->content?></span>
<a href="/course/qadetail?qid=<?php echo $reply->question_id?>"><span class="fa fa-eye" style="float: right;margin-left: 5px"></span></a>
<span class="zone-reply-time"><?php echo Common::getAwayTime($reply->create_time)?></span>
</div>
<?php endforeach ?>
<?php else: ?>
<div class="alert alert-warning" role="alert"><?php echo Yii::t('app', 'No more answers.');?></div>
<?php endif ?>
</section>
<section id="section-focus">
<div class="alert alert-warning" role="alert"><?php echo Yii::t('app', 'No more focus questions.');?></div>
</section>
</div>
</div>
</div>
示例6: actionQadetail
public function actionQadetail()
{
$questionModel = Question::findModel(Yii::$app->request->get('qid'));
$courseModel = Course::findOneById($questionModel->course_id);
$userModel = User::findModel($questionModel->user_id);
$questionModel->views += 1;
$questionModel->save();
return $this->render('qadetail', ['question' => $questionModel, 'course' => $courseModel, 'user' => $userModel]);
}
示例7: count
<div class="col-lg-2 col-md-2 col-sm-2" style="float:right">
<span><?php echo count($replyList)?>回答</span>
<span><?php echo $question->views?>浏览</span>
</div>
</div>
<?php foreach ($replyList as $reply): ?>
<div class="col-lg-12 col-md-12 col-sm-12 qadetail-reply">
<div class="col-lg-2 col-md-2 col-sm-2 reply-user-info">
<div style="margin: 0 25%"><a href='#'><img src="<?php echo User::findModel($reply->answer_user_id)->head_picture?>" class="img-circle" width="60px"></a></div>
<div class="reply-user-info-name"><?php echo User::findModel($reply->answer_user_id)->username?></div>
</div>
<div class="col-lg-3 col-md-2 col-sm-2">
<?php if ($user->id != $reply->answered_user_id): ?>
<span style="color: rgba(102,102,102,0.5)">[<?php echo User::findModel($reply->answer_user_id)->username?>回复<?php echo User::findModel($reply->answered_user_id)->username?>]</span>
<?php endif ?>
</div>
<div class="col-lg-10 col-md-10 col-sm-10">
<?php echo Markdown::convert($reply->content)?>
</div>
<div class="col-lg-10 col-md-10 col-sm-10">
<div class="col-lg-4 col-md-4 col-sm-4">
<?php echo Common::getAwayTime($reply->create_time)?>
</div>
<div class="col-lg-2 col-md-2 col-sm-2" style="float:right">
<?php if ($reply->answer_user_id != Yii::$app->user->id): ?>
<span class="fa fa-reply" onclick="changeAnsweredName(<?php echo $reply->answer_user_id?>)">回复</span>
<?php endif ?>
</div>