diff --git a/app/Http/Controllers/Lti3Controller.php b/app/Http/Controllers/Lti3Controller.php index e39d45a6..a6320a2f 100644 --- a/app/Http/Controllers/Lti3Controller.php +++ b/app/Http/Controllers/Lti3Controller.php @@ -10,6 +10,7 @@ use App\Services\AdminDashboardService; use App\Services\DashboardService; use App\Services\SurveyService; +use App\Services\CourseSettingsService; use GuzzleHttp\Client; use Illuminate\Contracts\Foundation\Application; use Illuminate\Contracts\View\Factory; @@ -53,7 +54,7 @@ public function index(Request $request) * @throws LtiException */ public function launch(Request $request) - { + { $config_directory = $request->query("config_directory", "configs"); logger("LTI3Controller config directory:". $config_directory); $launch = LTI\LTI_Message_Launch::new(new LTI3_Database($config_directory)); @@ -70,6 +71,7 @@ public function launch(Request $request) $surveyMode = config('constants.options.SURVEY_MODE'); $adminDashboardMode = config('constants.options.ADMIN_DASHBOARD_MODE'); $kpasMode = $request->query("kpasMode", $roleMode); + $courseSettingsMode = config('constants.options.COURSE_SETTINGS_MODE'); if ($launch->is_resource_launch()) { logger('Resource Launch!'); } else if ($launch->is_deep_link_launch()) { @@ -95,13 +97,13 @@ public function launch(Request $request) ->withRequest($request); } else { logger('Unknown launch type'); - } + } $settings = $launch->get_launch_data()['https://purl.imsglobal.org/spec/lti/claim/custom']; logger("SETTINGS:" . print_r($settings, true)); $settings["canvas_user_id"] = (string)$settings['canvas_user_id']; - + $kpasUserView = "group_management"; if(isset($settings['kpas_user_view'])) { $kpasUserView = (string)$settings['kpas_user_view']; @@ -131,7 +133,7 @@ public function launch(Request $request) logger("Lti3Middleware has settings."); - $settings = session()->get('settings'); + $settings = session()->get('settings'); if ($kpasMode == $diplomaMode) { $downloadLink = true; logger("embed diploma"); @@ -143,7 +145,7 @@ public function launch(Request $request) } return $diplomaService->getDiplomaHtml($settings, $downloadLink, $hasDeservedDiploma); - } + } else if($kpasMode == $statisticsMode) { $statisticsService = new StatisticsService(); return $statisticsService->getStatisticsHtml($settings); @@ -160,6 +162,10 @@ public function launch(Request $request) $adminDashboardService = new AdminDashboardService(); return $adminDashboardService->getAdminDashboardBlade($settings); } + else if($kpasMode == $courseSettingsMode) { + $courseSettingsService = new CourseSettingsService(); + return $courseSettingsService->getCourseSettingsBlade($settings); + } if ($kpasUserView == 'user_management') { logger("Display user management view."); @@ -168,7 +174,7 @@ public function launch(Request $request) return view('lti.index'); } - + /** * Get categories for a given course from canvas api @@ -253,7 +259,7 @@ public function kpas_settings() public function diplomaPdf(Request $request) { logger("Diploma"); - $settings = session()->get('settings'); + $settings = session()->get('settings'); logger($settings); $diplomaService = new DiplomaService(); @@ -263,7 +269,7 @@ public function diplomaPdf(Request $request) //To make images/ references work. $dompdf->getOptions()->setChroot(public_path()); - + //To make external references to css etc. work. $dompdf->getOptions()->set('isRemoteEnabled', true); $downloadLink = false; diff --git a/app/Services/CourseSettingsService.php b/app/Services/CourseSettingsService.php new file mode 100644 index 00000000..9f6ae8ea --- /dev/null +++ b/app/Services/CourseSettingsService.php @@ -0,0 +1,14 @@ +withSettings($settings); + } + +} diff --git a/config/constants.php b/config/constants.php index 911ce912..7b43b084 100644 --- a/config/constants.php +++ b/config/constants.php @@ -6,6 +6,7 @@ 'STATISTICS_MODE' => 2, 'DASHBOARD_MODE' => 3, 'SURVEY_MODE' => 4, - 'ADMIN_DASHBOARD_MODE' => 5 + 'ADMIN_DASHBOARD_MODE' => 5, + 'COURSE_SETTINGS_MODE' => 6, ] ]; diff --git a/resources/views/main/coursesettings.blade.php b/resources/views/main/coursesettings.blade.php new file mode 100644 index 00000000..545f4666 --- /dev/null +++ b/resources/views/main/coursesettings.blade.php @@ -0,0 +1,30 @@ +@php use App\Repositories\CourseSettingsRepository; use App\Models\CourseSettings; use App\Models\CourseFilter; use App\Models\CourseCategory; use App\Models\Filter; use App\Models\Category; @endphp +@extends('layouts.app') + +@section('content') + @php + + $course_id = intval($settings["custom_canvas_course_id"]); + + $courseSettingsRepository = new CourseSettingsRepository(); + + $courseSettings = $courseSettingsRepository->getCourseSettings($course_id); + $filters = $courseSettingsRepository->getFilters(); + $categories = $courseSettingsRepository->getCategories(); + @endphp + +

Filters

+ @php + var_dump($filters); + @endphp + +

Categories

+ @php + var_dump($categories); + @endphp + +@endsection + +@section('scripts') + +@endsection \ No newline at end of file