@@ -8,28 +8,28 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | class Query { |
| 10 | 10 | |
| 11 | - const COMMENT = "AUTOGENERATED BY - DO NOT MANUALLY AMEND"; |
|
| 11 | + const COMMENT = "AUTOGENERATED BY - DO NOT MANUALLY AMEND"; |
|
| 12 | 12 | |
| 13 | - /** |
|
| 14 | - * Generate the Statement Forward Query |
|
| 15 | - * based on the Object Completion Criteria |
|
| 16 | - */ |
|
| 17 | - public static function statementForward($org_id) { |
|
| 13 | + /** |
|
| 14 | + * Generate the Statement Forward Query |
|
| 15 | + * based on the Object Completion Criteria |
|
| 16 | + */ |
|
| 17 | + public static function statementForward($org_id) { |
|
| 18 | 18 | $criteria = ObjectCompletionCriterion::where('org_id', $org_id)->whereHas(\Object::class, function($q){ |
| 19 | - $q->where("completion_type", Types::XAPI); |
|
| 19 | + $q->where("completion_type", Types::XAPI); |
|
| 20 | 20 | })->with('object')->get(); |
| 21 | 21 | |
| 22 | 22 | if (sizeof($criteria) === 0 ){ |
| 23 | - // if there are no criteria |
|
| 24 | - return false; |
|
| 23 | + // if there are no criteria |
|
| 24 | + return false; |
|
| 25 | 25 | } else { |
| 26 | - //if there is criteria |
|
| 27 | - $queries = []; |
|
| 26 | + //if there is criteria |
|
| 27 | + $queries = []; |
|
| 28 | 28 | |
| 29 | - foreach ($criteria as $criterion) { |
|
| 29 | + foreach ($criteria as $criterion) { |
|
| 30 | 30 | $course = $criterion->object->course; |
| 31 | 31 | if (empty($course) || ($course && !empty($course->deleted_at))) { |
| 32 | - continue; |
|
| 32 | + continue; |
|
| 33 | 33 | } |
| 34 | 34 | $criteriaQuery = []; |
| 35 | 35 | $criteriaQuery['$comment'] = 'id:' . $criterion->id . ', object_id:' . $criterion->object_id; |
@@ -42,48 +42,48 @@ discard block |
||
| 42 | 42 | if (is_numeric($criterion->scaled)) $criteriaQuery['statement.result.score.scaled'] = ['$gte' => floatval($criterion->scaled)]; |
| 43 | 43 | |
| 44 | 44 | if (sizeof($criteriaQuery) > 0) { |
| 45 | - $queries[] = $criteriaQuery; |
|
| 45 | + $queries[] = $criteriaQuery; |
|
| 46 | + } |
|
| 46 | 47 | } |
| 47 | - } |
|
| 48 | - if (sizeof($queries) === 0 ){ |
|
| 48 | + if (sizeof($queries) === 0 ){ |
|
| 49 | 49 | // if there are no quries |
| 50 | 50 | return false; |
| 51 | - } |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - $query = [ |
|
| 53 | + $query = [ |
|
| 54 | 54 | '$comment' => self::COMMENT, |
| 55 | 55 | '$or'=>$queries |
| 56 | - ]; |
|
| 56 | + ]; |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | return json_encode($query); |
| 60 | - } |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | - /** |
|
| 63 | - * Get the Learning Locker Statement Forward by ID. |
|
| 64 | - * |
|
| 65 | - * @param $id |
|
| 66 | - * @return $response |
|
| 67 | - */ |
|
| 68 | - protected function get() { |
|
| 62 | + /** |
|
| 63 | + * Get the Learning Locker Statement Forward by ID. |
|
| 64 | + * |
|
| 65 | + * @param $id |
|
| 66 | + * @return $response |
|
| 67 | + */ |
|
| 68 | + protected function get() { |
|
| 69 | 69 | try { |
| 70 | - $url = $this->endpoint . $this->api . $this->v2 . $this->query . '/'; |
|
| 71 | - $request = $this->getClient()->get($url, [ |
|
| 70 | + $url = $this->endpoint . $this->api . $this->v2 . $this->query . '/'; |
|
| 71 | + $request = $this->getClient()->get($url, [ |
|
| 72 | 72 | 'auth' => $this->getAuth(), |
| 73 | 73 | 'headers' => [ |
| 74 | - 'content-type' => 'application/json' |
|
| 74 | + 'content-type' => 'application/json' |
|
| 75 | 75 | ], |
| 76 | - ]); |
|
| 76 | + ]); |
|
| 77 | 77 | |
| 78 | - if($request->getStatusCode() === 404) { |
|
| 78 | + if($request->getStatusCode() === 404) { |
|
| 79 | 79 | throw new ClientException('There was a issue connecting to Learning Locker.'); |
| 80 | - } |
|
| 81 | - $response = $request->json(); |
|
| 80 | + } |
|
| 81 | + $response = $request->json(); |
|
| 82 | 82 | } catch (ClientException $e) { |
| 83 | - return $e; |
|
| 83 | + return $e; |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | return $response; |
| 87 | - } |
|
| 87 | + } |
|
| 88 | 88 | |
| 89 | 89 | } |
@@ -3,5 +3,5 @@ |
||
| 3 | 3 | namespace Ijeffro\Laralocker\LearningLocker\Visualisations; |
| 4 | 4 | |
| 5 | 5 | interface VisualisationInterface { |
| 6 | - function get(); |
|
| 6 | + function get(); |
|
| 7 | 7 | } |
@@ -3,5 +3,5 @@ |
||
| 3 | 3 | namespace Ijeffro\Laralocker\LearningLocker\Personas; |
| 4 | 4 | |
| 5 | 5 | interface PersonaInterface { |
| 6 | - function get(); |
|
| 6 | + function get(); |
|
| 7 | 7 | } |
@@ -484,7 +484,7 @@ |
||
| 484 | 484 | if ($this->learning_locker_api->check()) { |
| 485 | 485 | $this->info('Successfully connected to Learning Locker®'); |
| 486 | 486 | } else { |
| 487 | - return $this->error(' << Could not connect to Learning Locker® '); |
|
| 487 | + return $this->error(' << Could not connect to Learning Locker® '); |
|
| 488 | 488 | } |
| 489 | 489 | |
| 490 | 490 | } |
@@ -133,7 +133,7 @@ |
||
| 133 | 133 | */ |
| 134 | 134 | public function store() |
| 135 | 135 | { |
| 136 | - $this->send = $this->send( |
|
| 136 | + $this->send = $this->send( |
|
| 137 | 137 | $this->actor, |
| 138 | 138 | $this->verb, |
| 139 | 139 | $this->object, |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | private $v2 = '/v2'; |
| 13 | 13 | |
| 14 | 14 | protected $headers = [ |
| 15 | - 'Content-Type' => 'application/json' |
|
| 15 | + 'Content-Type' => 'application/json' |
|
| 16 | 16 | ]; |
| 17 | 17 | |
| 18 | 18 | function __construct($id = null) { |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | private $v2 = '/v2'; |
| 13 | 13 | |
| 14 | 14 | protected $headers = [ |
| 15 | - 'content-type' => 'application/json' |
|
| 15 | + 'content-type' => 'application/json' |
|
| 16 | 16 | ]; |
| 17 | 17 | |
| 18 | 18 | function __construct($id = null) { |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | private $v2 = '/v2'; |
| 13 | 13 | |
| 14 | 14 | protected $headers = [ |
| 15 | - 'content-type' => 'application/json' |
|
| 15 | + 'content-type' => 'application/json' |
|
| 16 | 16 | ]; |
| 17 | 17 | |
| 18 | 18 | function __construct($id = null) { |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | private $v2 = '/v2'; |
| 13 | 13 | |
| 14 | 14 | protected $headers = [ |
| 15 | - 'content-type' => 'application/json' |
|
| 15 | + 'content-type' => 'application/json' |
|
| 16 | 16 | ]; |
| 17 | 17 | |
| 18 | 18 | function __construct($id = null) { |