本文整理汇总了PHP中app\models\Course类的典型用法代码示例。如果您正苦于以下问题:PHP Course类的具体用法?PHP Course怎么用?PHP Course使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Course类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSetRoomScheduleCourse
public function testSetRoomScheduleCourse()
{
$roomsched = new RoomSchedule();
$course = new Course();
$course->setCourseCode("IT 197");
$roomsched->setCourseCode($course->getCourseCode());
$this->assertEquals("IT 197", $course->getCourseCode());
$this->assertEquals("IT 197", $roomsched->getCourseCode());
}
示例2: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store(CourseRequest $request)
{
$data = $request->all();
unset($data['Id']);
$course = new Course();
$course->fromArray($data);
$course->save();
flash()->success("ADDED");
session(['attribute' => \Lang::get('general.COURSE')]);
return redirect($this->main_page);
}
示例3: testSetCourse
public function testSetCourse()
{
$course = new Course();
$course->setCourseCode("IT 197");
$course->setDescription("Supervised On-the-Job Training");
$course->setUnits(12);
$course->setSemester("2nd");
$this->assertEquals("IT 197", $course->getCourseCode());
if ($course->getCourseCode() == "IT 197") {
$this->assertEquals("Supervised On-the-Job Training", $course->getDescription());
$this->assertEquals(12, $course->getUnits());
$this->assertEquals("2nd", $course->getSemester());
}
}
示例4: create
/**
* Show the form for creating a new resource.
*
* @param $courseId
* @return \Illuminate\Http\Response
*/
public function create($courseId)
{
$userId = Auth::user()->id;
$tests = Test::where('user_id', '=', $userId)->get();
$course = Course::find($courseId);
return view('course.lesson.create', ['course' => $course, 'tests' => $tests]);
}
示例5: show
/**
* @param $courseId
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function show($courseId)
{
$course = Course::findOrFail($courseId);
$lessons = $course->lessons;
$members = $course->users;
return view('mark.show', ['members' => $members, 'lessons' => $lessons, 'course' => $course]);
}
示例6: 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]);
}
示例7: getInstitute
public function getInstitute()
{
if ($this->course_id != NULL) {
$institute_id = Course::find()->select(['institute_id'])->where(['id' => $this->course_id])->one()->institute_id;
$institute = Institute::findOne(['id' => $institute_id]);
return $institute;
}
}
示例8: findModel
protected function findModel($id)
{
if (($model = Course::findOne($id)) !== null) {
return $model;
} else {
throw new NotFoundHttpException('The requested page does not exist.');
}
}
示例9: postCreate
public function postCreate(Request $request)
{
$input = $request->only(['year', 'name']);
$input['user_id'] = Auth::id();
Course::create($input);
flash()->success('Kurz bol vytvorený');
return redirect()->back();
}
示例10: detachFrom
public function detachFrom(Request $request)
{
$this->validate($request, ['classroom_id' => 'required', 'course_id' => 'required'], ['required' => 'Kolom :attribute diperlukan']);
$course = Course::findOrFail($request->course_id);
$course->classrooms()->detach($request->classroom_id);
\Flash::success('Materi berhasil batalkan.');
return redirect()->back();
}
示例11: getUserCourses
/**
* 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]);
}
示例12: actionDelete
public function actionDelete($id)
{
$item = Course::findByPK($id);
if (empty($item)) {
$this->redirect('/admin/courses');
}
$item->delete();
$this->redirect('/admin/courses');
}
示例13: courseDropDown
public static function courseDropDown()
{
$courses = Course::find()->all();
//$courses = Course::courseDropDown();
//$courseList = ArrayHelper::map($courses, 'id', 'courseName');
foreach ((array) $courses as $course) {
echo "<option value='" . $course->id . "'>" . $course->courseName . "</option>";
}
}
示例14: getQuestionList
public static function getQuestionList($courseId)
{
$courseModel = Course::findOneById($courseId);
if (Course::isRoot($courseModel)) {
return static::find()->where(['root_id' => $courseId])->orderBy('create_time DESC')->all();
}
if (Course::isFile($courseModel)) {
return static::find()->where(['course_id' => $courseId])->orderBy('create_time DESC')->all();
}
}
示例15: show
/**
* 显示学生详细成绩单
* @author FuRongxin
* @date 2016-01-25
* @version 2.0
* @param string $kch 8位课程号
* @return \Illuminate\Http\Response 学生成绩单
*/
public function show($kch)
{
// 过程成绩
$detail = Dtscore::detailScore(Auth::user(), $kch)->select('xh', 'xm', 'kcxh', 'kcpt', 'kcxz', 'nd', 'xq', 'kh', 'cj1', 'cj2', 'cj3', 'cj4', 'cj5', 'cj6', 'zpcj', 'kszt', 'tjzt');
// 补考成绩
$makeup = Muscore::makeupScore(Auth::user(), $kch)->select('xh', 'xm', 'kcxh', 'kcpt', 'kcxz', 'nd', 'xq', 'kh', 'cj1', 'cj2', 'cj3', 'cj4', 'cj5', 'cj6', 'zpcj', 'kszt', 'tjzt');
$scores = $detail->union($makeup)->orderBy('nd', 'desc')->orderBy('xq', 'desc')->get();
$ratios = $this->_arrangeScores($scores);
return view('score.show')->withTitle(Course::find($kch)->kcmc . '课程详细成绩单')->withRatios($ratios);
}