/** * 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 actionDefault($course = null) { if (null === $course) { $this->data->course = 'all'; $this->data->courses = Course::findAll(); } else { $this->data->course = Course::findByPK($course); $this->data->item = new Lesson(); $this->data->item->course = $this->data->course; } }
public function actionDefault() { $this->data->items = Course::findAll(['order' => 'active desc']); $this->data->item = new Course(); }