/** * get User Courses * @param type $userId * @return type */ public static function getUserCourses($userId = null) { if (empty($userId)) { $userId = \app\components\OvcUser::getCurrentUser()->id; } $userCourseIds = self::getCourseIdsByUserId($userId); return Course::findAll(['id' => $userCourseIds]); }
public function init() { parent::init(); if ($this->latestVideos === null) { $User = OvcUser::getCurrentUser(); $courseIds = OvcCourse::getUserCourseIds($User->id); $this->latestVideos = \app\models\Video::find()->where(['course_id' => $courseIds])->orderBy('id DESC')->limit(16)->all(); } }
/** * inline update comment */ public function actionInlineUpdateComment() { $id = Yii::$app->request->get('id'); $comment = \app\models\Comment::findOne($id); $currentUserId = \app\components\OvcUser::getCurrentUser()->id; echo $this->renderPartial('_edit_comment_on_video', ['comment' => $comment, 'currentUserId' => $currentUserId]); }