本文整理汇总了PHP中app\models\Course类的典型用法代码示例。如果您正苦于以下问题:PHP Course类的具体用法?PHP Course怎么用?PHP Course使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Course类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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());
}
开发者ID:ailenepequit,项目名称:room-scheduler,代码行数:9,代码来源:RoomScheduleTest.php
示例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);
}
开发者ID:nstojanovickg,项目名称:diplomski,代码行数:16,代码来源:CourseController.php
示例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());
}
}
开发者ID:ailenepequit,项目名称:room-scheduler,代码行数:14,代码来源:CourseTest.php
示例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]);
}
开发者ID:Retsediv,项目名称:edu,代码行数:13,代码来源:LessonController.php
示例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]);
}
开发者ID:Retsediv,项目名称:edu,代码行数:11,代码来源:MarkController.php
示例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]);
}
开发者ID:songwanfu,项目名称:SummerNut,代码行数:30,代码来源:TaskController.php
示例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;
}
}
开发者ID:vishnupriyam,项目名称:invoker-web-interface,代码行数:8,代码来源:BlockTime.php
示例8: findModel
protected function findModel($id)
{
if (($model = Course::findOne($id)) !== null) {
return $model;
} else {
throw new NotFoundHttpException('The requested page does not exist.');
}
}
开发者ID:janwillemm,项目名称:sa-matcher,代码行数:8,代码来源:CourseController.php
示例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();
}
开发者ID:psiskova,项目名称:blog-academy,代码行数:8,代码来源:CourseController.php
示例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();
}
开发者ID:alfrcr,项目名称:ilearn,代码行数:8,代码来源:CourseController.php
示例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]);
}
开发者ID:santonil2003,项目名称:yii,代码行数:13,代码来源:OvcCourse.php
示例12: actionDelete
public function actionDelete($id)
{
$item = Course::findByPK($id);
if (empty($item)) {
$this->redirect('/admin/courses');
}
$item->delete();
$this->redirect('/admin/courses');
}
开发者ID:pr-of-it,项目名称:profit,代码行数:9,代码来源:Courses.php
示例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>";
}
}
开发者ID:oma378501,项目名称:attendance,代码行数:9,代码来源:Course.php
示例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();
}
}
开发者ID:songwanfu,项目名称:SummerNut,代码行数:10,代码来源:Question.php
示例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);
}
开发者ID:rxfu,项目名称:student,代码行数:18,代码来源:ScoreController.php
示例16: 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
示例17: actionCertification
public function actionCertification()
{
//$searchModel = new CourseSearch();
//$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
//$dataProvider->pagination->pageSize = 0;
$query = Course::find()->where(['category_id' => '5']);
$dataProvider = new ActiveDataProvider(['query' => $query]);
$cat = new Category();
return $this->render('mos', ['dataProvider' => $dataProvider, 'cat' => $cat]);
//return $this->render('mos');
}
开发者ID:kaweesak,项目名称:arit_training,代码行数:11,代码来源:MosController.php
示例18: actionDefault
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;
}
}
开发者ID:pr-of-it,项目名称:profit,代码行数:11,代码来源:Lessons.php
示例19: getLearnPercent
public static function getLearnPercent($userId, $courseId)
{
$fileCount = Course::fileCount($courseId);
$userPlayModels = static::findAll(['user_id' => $userId, 'learn_status' => self::LEARN_STATUS_FINISH]);
$count = 0;
foreach ($userPlayModels as $userPlayModel) {
if (Course::findOneById($userPlayModel->chapter_id)->root == $courseId) {
$count++;
}
}
return round($count / $fileCount, 2);
}
开发者ID:songwanfu,项目名称:SummerNut,代码行数:12,代码来源:UserPlay.php
示例20: addOperation
public function addOperation()
{
if ($this->currency_id != '1') {
$course = new Course();
if (!$course->checkCourse($this->currency_id)) {
$course->currency_id = $this->currency_id;
$currency = Currency::findOne($this->currency_id);
$course->course = $course->getCourse($currency->iso);
if (!$course->save()) {
throw new ErrorException('Курс не обновлен' . var_dump($course));
}
}
}
$operation = new Operation();
$operation->user_id = Yii::$app->getUser()->id;
$operation->category_id = $this->category_id === '' ? 1 : $this->category_id;
$operation->currency_id = $this->currency_id === '' ? 1 : $this->currency_id;
$operation->summ = $this->operation_type == 'income' ? $this->summ * 100 : $this->summ * -100;
$operation->description = $this->description;
return $operation->save() ? $operation : null;
}
开发者ID:Nhassa,项目名称:budget,代码行数:21,代码来源:OperationForm.php
注:本文中的app\models\Course类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论