Example #1
0
 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 5) as $index) {
         App\Course::create(['name' => $faker->word, 'created_at' => $faker->dateTime, 'updated_at' => $faker->dateTime]);
     }
 }
Example #2
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $courses = App\Course::all();
     factory(App\Content::class, 100)->make()->each(function ($content) use($courses) {
         $content->course()->associate($courses->random());
         $content->save();
     });
 }
Example #3
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $courses = App\Course::all();
     factory(App\Question::class, 100)->make()->each(function ($question) use($courses) {
         $course = $courses->random();
         $question->course()->associate($course);
         $question->user()->associate($course->users->random());
         $question->save();
     });
 }
Example #4
0
 /**
  * Responds to requests to POST /courses/create
  */
 public function getPost(Request $request)
 {
     $this->validate($request, ['course_name' => 'required', 'crn' => 'required|min:5', 'requirements' => 'required|min:1']);
     # Enter course into the database
     $course = new \App\Course();
     $course->course_name = $request->course_name;
     $course->crn = $request->crn;
     $course->course_hours = $request->course_hours;
     $course->harvard_url = $request->harvard_url;
     $course->save();
     // # Add the requirements
     if ($request->requirements) {
         $requirements = $request->requirements;
     } else {
         $requirements = [];
     }
     $course->requirements()->attach($requirements);
     # Done
     \Session::flash('flash_message', 'Your course was added, please select it for your completed courses!');
     return redirect('/courses');
 }
                        $('#bar-{{ $finished->id }}').jqbar({ label: '{{ App\Course::find($finished->course_id)->title }}', value: @if($finished->points == 0) {{ 0 }} @else {{ 100/( App\Course::find($finished->course_id)->test()->first()->points / $finished->points ) }} @endif, barColor: 'red', orientation: 'h', barWidth: 20});
                    });
                </script>
            @endforeach
        </div>
        <div id="success_wrapper" >
            <div style=" font-family:Intro_Bold; color:red; font-size:30px;">SUCCESS RATE</div>

            <?php 
$count = App\Enroll::where('user_id', $user->id)->finished()->count();
$percent = 0;
foreach ($enrolls as $finished) {
    if ($finished->points == 0) {
        $percent += 0;
    } else {
        $percent += 100 / (App\Course::find($finished->course_id)->test()->first()->points / $finished->points);
    }
}
if ($count == 0) {
    $percent = 0;
} else {
    $percent /= $count;
}
$percent = round($percent, 1);
?>
            <div style="height:auto;width:auto">
                <div id="diagram-id-2" class="diagram" style=" font-family:Intro_Bold;"
                     data-circle-diagram='{
              "percent": "{{ $percent }}%",
              "size": "250",
              "borderWidth": "5",
Example #6
0
<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::get('/', function () {
    $courses = App\Course::all();
    return view('layouts.home', compact('courses'));
});
Route::get('courseregister', ['middleware' => ['auth'], function () {
    $courses = App\Course::all();
    return view('layouts.courseregister', compact('courses'));
}]);
Route::get('login', function () {
    return view('auth.login');
});
Route::get('register', function () {
    return view('auth.register');
});
Route::post('login', 'usercontroller@register');
Example #7
0
    		<?php 
$day = App\Day::getShortDay($class->cid);
$time = App\Time::getPeriod($class->cid);
$room = App\Room::getRooms($class->cid);
?>

    		@if (!empty($room) AND !empty($time))
    			<form class="save_instructor" method="post" data-alloc = "{{ $class->cid }}">
					<input type="hidden" name="ajax" value="1">
	    			<tr>
	    				<input type="hidden" name="cl_id" value="{{ $class->cid }}">
	    				<td> {{ $class->code }} </td>
	    				<td>
							@if($class->coursemajor != 0)
								<?php 
$course = App\Course::find($class->coursemajor);
?>

								@if( !$course instanceof ModelNotFoundException)
									{{ $course->description }}
								@endif

							@else
								Not Available
							@endif
						</td>
	    				<td> {{ $room }} </td>
	    				<td> {{ $day }} </td>
	    				<td> {{ $time }} </td>
	    				<td>
	    					<select class="form-control" name="instructor" required>
    $firs_name = $faker->firstName;
    $last_name = $faker->lastName;
    return ['identification' => $faker->unique()->numberBetween(5000000, 39999999), 'first_name' => $firs_name, 'last_name' => $last_name, 'avatar' => 'vendor/AdminTheme/images/avatar/default.png', 'type' => $faker->randomElement(['teacher', 'student']), 'email' => $faker->unique()->email, 'password' => '123456'];
});
$factory->define(App\Course::class, function ($faker) {
    return ['title' => $faker->sentence(3), 'description' => $faker->paragraph(10), 'image' => $faker->imageUrl(660, 260), 'user_id' => App\User::all()->random()->id];
});
$factory->define(App\Unit::class, function ($faker) {
    return ['pos' => $faker->randomNumber(1), 'title' => $faker->sentence(5), 'description' => $faker->paragraph(10), 'image' => $faker->imageUrl(660, 260), 'user_id' => App\User::all()->random()->id, 'course_id' => App\Course::all()->random()->id];
});
$factory->define(App\Lesson::class, function ($faker) {
    return ['pos' => $faker->randomNumber(1), 'title' => $faker->sentence(5), 'content' => $faker->paragraph(10), 'user_id' => App\User::all()->random()->id, 'unit_id' => App\Unit::all()->random()->id];
});
$factory->define(App\Question::class, function ($faker) {
    return ['title' => $faker->sentence(2) . '?', 'unit_id' => App\Unit::all()->random()->id, 'user_id' => App\User::all()->random()->id];
});
$factory->define(App\Answer::class, function ($faker) {
    return ['content' => $faker->sentence(5), 'correct' => rand(0, 1), 'question_id' => App\Question::all()->random()->id, 'user_id' => App\User::all()->random()->id];
});
$factory->define(App\Comment::class, function ($faker) {
    return ['content' => $faker->paragraph(5), 'user_id' => App\User::all()->random()->id, 'lesson_id' => App\Lesson::all()->random()->id];
});
$factory->define(App\Reply::class, function ($faker) {
    return ['content' => $faker->paragraph(5), 'user_id' => App\User::all()->random()->id, 'comment_id' => App\Comment::all()->random()->id];
});
$factory->define(App\Evaluation::class, function ($faker) {
    return ['value' => $faker->numberBetween(15, 20), 'min_value' => $faker->numberBetween(50, 85), 'max_question' => $faker->numberBetween(5, 6), 'unit_id' => App\Unit::all()->random()->id, 'user_id' => App\User::all()->random()->id];
});
$factory->define(App\CourseUser::class, function ($faker) {
    return ['course_id' => App\Course::all()->random()->id, 'user_id' => App\User::all()->random()->id];
});
    swal({
                title: "You successfully made a question!",
                text: "Do you want to make another question, or do you wish to finish the test and make a course?",
                type: "success",
                showCancelButton: true,
                cancelButtonText: "Make another question!",
                confirmButtonColor: "#DD6B55",
                confirmButtonText: "Finish course!",
                allowEscapeKey: false,
                allowOutsideClick:false
            },
            function(isConfirm){
                if (isConfirm)
                {
                    <?php 
$course = App\Course::findorFail($id);
?>
                    window.location = "{{ url('/finish/'.$course->id) }}";
                }
            });
    </script>
    <script>
        $(document).ready(function(){
        var x1=$('#button')
        x1.height(x1.width()%4)
        $(window).resize(function(){
            x1.height(x1.width()%4)
        });
        });
    </script>
@endif
Example #10
0
});
// Routes served to only ajax requests
Route::group(['middleware' => 'ajax'], function () {
    // Angular view templates
    Route::get('ng/{view}', function ($view) {
        return view('ng.' . $view);
    });
    Route::get('ajax/auth', 'AuthController@ajax_check');
    Route::post('ajax/login', 'AuthController@ajax_login');
});
///////////////////////////////////////////////////////////////////////
// Routes that don't require elevated admin permissions
Route::group(['prefix' => 'ajax', 'middleware' => 'auth.ajax'], function () {
    Route::get('/recent', function (App\Repositories\ArchiveEntries $entries) {
        $tests = App\Test::with('course', 'questions')->orderBy('updated_at', 'DESC')->limit(5)->get();
        $courses = App\Course::with('tests')->orderBy('updated_at', 'DESC')->limit(5)->get();
        $archive = $entries->getEntries()->where('replied_to', 0)->where('discarded', 0)->orderBy('created_at', 'ASC');
        $new_count = 0;
        $new_archive = [];
        foreach ($archive->get() as $item) {
            if ($item->discarded == App\Archive::NOT_DISCARDED) {
                $new_count++;
                if (count($new_archive) < 5) {
                    $item->data = json_decode($item->data);
                    $new_archive[] = $item;
                }
            }
        }
        return ['archive' => $new_archive, 'archive_new' => $new_count, 'tests' => $tests, 'courses' => $courses];
    });
    Route::get('/sessions', function () {
                            <th>Student ID</th>
                            <th>Name</th>
                            <th>Course w/ Major</th>
                            <th style="width:20%;" colspan="2" class="text-center">Action</th>
                        </tr>
                    </thead>
                    <tbody>

                        @foreach($registrations as $registration)
                            <tr>
                                <td> {{ $registration->user->legacyid }} </td>
                                <td> {{ $registration->user->lastname.', '.$registration->user->firstname }} </td>
                                <td>
                                    <?php 
$coursemajor = DB::table('tbl_coursemajor')->where('id', $registration->coursemajor)->first();
$course = App\Course::find($coursemajor->course);
$major = '';
if ($coursemajor->major != 0) {
    $majors = DB::table('tbl_major')->where('id', $coursemajor->major)->first();
    $major = '(' . $majors->description . ')';
}
?>
                                    {{ $course->description.' '.$major }}
                                </td>
                                <td>
                                    <a href="{{ url("registration/$registration->id") }}" class="btn btn-primary btn-sm btn-raised pull-left">View</a>
                                </td>
                                <td>
                                    <a href="{{ url("registration/$registration->id") }}" class="btn btn-success btn-sm btn-raised pull-right">Confirm</a>
                                </td>
                            </tr>