当前位置: 首页>>代码示例>>PHP>>正文


PHP Course::findModel方法代码示例

本文整理汇总了PHP中app\models\Course::findModel方法的典型用法代码示例。如果您正苦于以下问题:PHP Course::findModel方法的具体用法?PHP Course::findModel怎么用?PHP Course::findModel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\models\Course的用法示例。


在下文中一共展示了Course::findModel方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionCreate

 /**
  * Creates a new Task model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $course_id = Yii::$app->request->get('course_id');
     $model = new Task();
     if ($model->load(Yii::$app->request->post())) {
         $model = $model->validateAttr($model);
         if (empty($model->errors)) {
             $resourceModel = new Resource();
             $model = $resourceModel->uploadImg($model, 'image');
             if ($model->save()) {
                 return $this->redirect(['view', 'id' => $model->id]);
             }
         }
     }
     $model->course_id = $course_id;
     if (!json_decode($model->answer_json)) {
         $model->answer_json = '';
     }
     $chapterName = $courseName = null;
     if (!empty($course_id)) {
         $chapterName = Course::findModel($course_id)->name;
         $courseName = Course::findRoot($course_id)->name;
     }
     return $this->render('create', ['model' => $model, 'courseId' => $course_id, 'chapterName' => $chapterName, 'courseName' => $courseName]);
 }
开发者ID:songwanfu,项目名称:SummerNut,代码行数:30,代码来源:TaskController.php

示例2: commentList

 public static function commentList($courseId)
 {
     $courseModel = Course::findModel($courseId);
     if (Course::isFile($courseModel)) {
         return static::find()->where(['course_id' => $courseId, 'comment_type' => self::COMMENT_TYPE_COMMENT])->orderBy('comment_time DESC')->all();
     }
     if (Course::isRoot($courseModel)) {
         return static::find()->where(['root_id' => $courseId, 'comment_type' => self::COMMENT_TYPE_COMMENT])->orderBy('comment_time DESC')->all();
     }
 }
开发者ID:songwanfu,项目名称:SummerNut,代码行数:10,代码来源:CourseComment.php

示例3:

            'extension',
            'url:url',
            'size',
            'duration',
            [
                'attribute' => 'status',
                'value' => $statusList[$model->status],
            ],
            [
                'attribute' => 'resource_type',
                'value' => $typeList[$model->resource_type],
            ],
            [
                'attribute' => 'course_id',
                'label' => Yii::t('app', 'Chapter'),
                'value' => Course::findModel($model->course_id)->name,
            ],
            [
                'attribute' => 'course_id',
                'label' => Yii::t('app', 'Course'),
                'value' => Course::findRoot($model->course_id)->name,
            ],
            'play_count',
            'download_count',
            'create_time',
            'update_time',
        ],
    ]) ?>

    <p>
        <?= Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
开发者ID:songwanfu,项目名称:SummerNut,代码行数:31,代码来源:view.php

示例4: if

        <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 comment-detail">
					<?php if (CourseComment::commentList($course->id)): ?>					
						<?php $i = 1; foreach (CourseComment::commentList($course->id) as $comment): ?>
							<div class="media col-lg-12 evaluation-con">
							  <div class="media-left media-middle">
							    <a href="#">
							      <img class="media-object img-circle" src="<?php echo User::findModel($comment->user_id)->head_picture?>" alt="" width="60px">
							    </a>
							  </div>
							  <div class="media-body">
							  	<span class="evaluation-name"><?php echo User::findModel($comment->user_id)->username?></span>
							    <h5 class="media-heading evaluation-content" id="comment-content-<?php echo $i?>"><?php echo $comment->content?></h5>
							    <?php if ($comment->course_id == $comment->root_id): ?>
							    	<span class="evaluation-time">时间:<?php echo Common::getAwayTime($comment->comment_time)?></span>
									<?php else: ?>
							    	<span class="evaluation-time">时间:<?php echo Common::getAwayTime($comment->comment_time)?>&nbsp;<a href="/resource/play?id=<?php echo Resource::getVideo($comment->course_id)->url?>">源自:<?php Course::findModel($comment->course_id)->name?></a></span>
							    <?php endif ?>
							    <span class="fa fa-thumbs-o-down comment-down" onclick="commentDown(<?php echo $comment->id?>)"><?php echo $comment->down_count?></span>
							    <span class="fa fa-thumbs-o-up comment-up" onclick="commentUp(<?php echo $comment->id?>)"><?php echo $comment->up_count?></span>
							  </div>
							</div>
						<?php $i++;endforeach ?>
					<?php else: ?>
					  <div class="alert alert-warning" role="alert" style="margin-top: 15px"><?php echo Yii::t('app', 'No more comments.');?></div>
					<?php endif ?>

				</div>



开发者ID:songwanfu,项目名称:SummerNut,代码行数:27,代码来源:play.php

示例5: function

            'extension',
            [
                'attribute' => 'url',
                'format' => 'raw',
                'value' => function ($model) {
                    return Html::a($model->name . '.' . $model->extension, ["play?id=$model->id"]);
                }
            ],
            'size',
            // 'duration',
            
            
            [
                'label' => Yii::t('app', 'Chapter'),
                'value' => function ($model) {
                    return Course::findModel($model->course_id)->name;
                }   
            ],

            [
                'label' => Yii::t('app', 'Course'),
                'attribute' => 'course_id',
                'value' => function ($model) {
                    return Course::findRoot($model->course_id)->name;
                }   
            ],
            'play_count',
            'download_count',

            ['class' => 'yii\grid\ActionColumn'],
        ],
开发者ID:songwanfu,项目名称:SummerNut,代码行数:31,代码来源:index.php


注:本文中的app\models\Course::findModel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。