You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
			
				
					27 lines
				
				876 B
			
		
		
			
		
	
	
					27 lines
				
				876 B
			| 
								 
											4 years ago
										 
									 | 
							
								<?php
							 | 
						||
| 
								 | 
							
								/* For license terms, see /license.txt */
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								require_once __DIR__.'/../../../main/inc/global.inc.php';
							 | 
						||
| 
								 | 
							
								require_once __DIR__.'/../src/LtiProvider.php';
							 | 
						||
| 
								 | 
							
								require_once __DIR__.'/../LtiProviderPlugin.php';
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								use Packback\Lti1p3;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								$launch = LtiProvider::create()->launch();
							 | 
						||
| 
								 | 
							
								if (!$launch->hasNrps()) {
							 | 
						||
| 
								 | 
							
								    throw new Exception("Don't have names and roles!");
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								$launchData = $launch->getLaunchData();
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								$plugin = LtiProviderPlugin::create();
							 | 
						||
| 
								 | 
							
								$toolVars = $plugin->getToolProviderVars($launchData['iss']);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								$login = LtiProvider::create()->validateUser($launchData, $toolVars['courseCode']);
							 | 
						||
| 
								 | 
							
								$cidReq = 'cidReq='.$toolVars['courseCode'].'&id_session=0&gidReq=0&gradebook=0';
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								$launchUrl = api_get_path(WEB_CODE_PATH).'exercise/overview.php?'.$cidReq.'&origin=embeddable&exerciseId='.$toolVars['toolId'].'<i_launch_id='.$launch->getLaunchId();
							 | 
						||
| 
								 | 
							
								header('Location: '.$launchUrl);
							 | 
						||
| 
								 | 
							
								exit;
							 | 
						||
| 
								 | 
							
								
							 |