diff --git a/.gitignore b/.gitignore index e0d0d37db7..8ae9159e7a 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,6 @@ composer.phar composer.lock .DS_Store -Thumbs.db \ No newline at end of file +Thumbs.db + +/app/config/ht2 \ No newline at end of file diff --git a/app/config/app.php b/app/config/app.php index bacc35313b..7631b8b666 100644 --- a/app/config/app.php +++ b/app/config/app.php @@ -110,7 +110,8 @@ 'Locker\Data\DataServiceProvider', 'Locker\Graphing\GraphServiceProvider', 'Jenssegers\Mongodb\MongodbServiceProvider', - 'DaveJamesMiller\Breadcrumbs\ServiceProvider' + 'DaveJamesMiller\Breadcrumbs\ServiceProvider', + 'Way\Generators\GeneratorsServiceProvider' ), diff --git a/app/controllers/xapi/BaseController.php b/app/controllers/xapi/BaseController.php index 7096062c30..bafb34a32a 100644 --- a/app/controllers/xapi/BaseController.php +++ b/app/controllers/xapi/BaseController.php @@ -4,6 +4,33 @@ class BaseController extends Controller { + /** + * Check request header for correct xAPI version + **/ + public function checkVersion( $route, $request ){ + + //should be X-Experience-API-Version: 1.0.0 or 1.0.1 (can accept 1.0), reject everything else. + $version = \Request::header('X-Experience-API-Version'); + + if( !isset($version) || ( $version < '1.0.0' || $version > '1.0.9' ) && $version != '1.0' ){ + return $this->returnSuccessError( true, 'This is not an accepted version of xAPI.', '400' ); + } + + } + + /** + * Get the LRS details based on Auth credentials + * + **/ + public function getLrs(){ + //get the lrs + $key = \Request::getUser(); + $secret = \Request::getPassword(); + $lrs = \Lrs::where('api.basic_key', $key) + ->where('api.basic_secret', $secret) + ->first(); + $this->lrs = $lrs; + } public function returnArray( $statements=array(), $params=array() ){ @@ -30,6 +57,24 @@ public function returnArray( $statements=array(), $params=array() ){ } + + /** + * Get all of the input and files for the request and store them in params. + * + */ + public function setParameters(){ + + $this->params = \Request::all(); + + } + + /** + * Return JSON with success boolean, message and HTTP status code + * @param $success + * @param $message + * @param $code HTTP Status code + * @return Response + */ protected function returnSuccessError( $success, $message, $code ){ return \Response::json( array( 'success' => $success, 'message' => $message), diff --git a/app/controllers/xapi/StatementController.php b/app/controllers/xapi/StatementController.php index e10f0dd137..945ea94420 100644 --- a/app/controllers/xapi/StatementController.php +++ b/app/controllers/xapi/StatementController.php @@ -97,34 +97,6 @@ public function show( $id ){ } - /** - * Check request header for correct xAPI version - **/ - public function checkVersion( $route, $request ){ - - //should be X-Experience-API-Version: 1.0.0 or 1.0.1 (can accept 1.0), reject everything else. - $version = \Request::header('X-Experience-API-Version'); - - if( !isset($version) || ( $version < '1.0.0' || $version > '1.0.9' ) && $version != '1.0' ){ - return $this->returnSuccessError( true, 'This is not an accepted version of xAPI.', '400' ); - } - - } - - /** - * Get the LRS details based on Auth credentials - * - **/ - public function getLrs(){ - //get the lrs - $key = \Request::getUser(); - $secret = \Request::getPassword(); - $lrs = \Lrs::where('api.basic_key', $key) - ->where('api.basic_secret', $secret) - ->first(); - $this->lrs = $lrs; - } - /** * This is used when retriving statements. Make sure any * statements requested are in the LRS relating to the @@ -145,10 +117,4 @@ public function checkAccess( $statement ){ } - public function setParameters(){ - - $this->params = \Request::all(); - - } - } \ No newline at end of file diff --git a/bootstrap/start.php b/bootstrap/start.php index 7eeea50137..5f9653f484 100644 --- a/bootstrap/start.php +++ b/bootstrap/start.php @@ -27,6 +27,7 @@ $env = $app->detectEnvironment(array( 'local' => array('your-machine-name'), + 'ht2' => array('HT2-007') )); diff --git a/composer-public.json b/composer-public.json index 726ed83f88..c5cff7235a 100644 --- a/composer-public.json +++ b/composer-public.json @@ -17,7 +17,8 @@ "require": { "laravel/framework": "4.1.*", "jenssegers/mongodb": "*", - "davejamesmiller/laravel-breadcrumbs": "~2.1.0" + "davejamesmiller/laravel-breadcrumbs": "~2.1.0", + "way/generators": "dev-master" }, "autoload": { "classmap": [ diff --git a/composer.json b/composer.json index c99b391294..741ce77c8e 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,8 @@ "require": { "laravel/framework": "4.1.*", "jenssegers/mongodb": "*", - "davejamesmiller/laravel-breadcrumbs": "~2.1.0" + "davejamesmiller/laravel-breadcrumbs": "~2.1.0", + "way/generators": "dev-master" }, "autoload": { "classmap": [