Skip to content

Commit 1626f14

Browse files
committed
Merge pull request #583 from LearningLocker/develop
v1.3.10
2 parents c4e87df + 9298dd5 commit 1626f14

File tree

127 files changed

+3342
-4136
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+3342
-4136
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Please see our [documentation](http://docs.learninglocker.net) for installation,
1717
You may contribute to this project via [issues](/issues) and [pull request](/pulls), however, please see the [guidelines](/contributing.md) before doing so. You can also contribute by updating our [documentation](https://github.com/LearningLocker/docs). More information about how you can get involved can be found on the [Learning Locker website](http://learninglocker.net/community/get-involved/). You can see our list of contributors in our [contributors.md file](/contributors.md).
1818

1919
### Getting Started
20-
1. Install Learning Locker's [requirements](http://docs.learninglocker.net/requirements/).
20+
1. Install Learning Locker's [requirements](http://docs.learninglocker.net/installation/#requirements).
2121
2. [Install and setup](http://docs.learninglocker.net/installation/) Learning Locker.
2222
3. Change the code.
2323
4. [Test](#testing) your code. See [testing](#testing) below for more information.

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.3.9
1+
1.3.10

app/commands/StatementMigrateCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function fire() {
5555
});
5656

5757
// Uses the repository to migrate the statements.
58-
$repo = App::make('Locker\Repository\Statement\EloquentStatementRepository');
58+
$repo = App::make('Locker\Repository\Statement\EloquentVoider');
5959
$repo->updateReferences($statements_array, $lrs);
6060
$repo->voidStatements($statements_array, $lrs);
6161

Lines changed: 63 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -1,158 +1,113 @@
11
<?php
22

3-
use Locker\Repository\User\UserRepository as User;
4-
use Locker\Repository\Lrs\LrsRepository as Lrs;
5-
use Locker\Repository\Client\ClientRepository as Client;
3+
use Locker\Repository\User\UserRepository as UserRepo;
4+
use Locker\Repository\Lrs\Repository as LrsRepo;
5+
use Locker\Repository\Client\ClientRepository as ClientRepo;
66

77
class ClientController extends BaseController {
88

9-
/**
10-
* User
11-
*/
12-
protected $user;
13-
14-
/**
15-
* Lrs
16-
**/
17-
protected $lrs;
9+
protected $user, $lrs, $client;
1810

1911
/**
20-
* Client
21-
**/
22-
protected $client;
23-
24-
25-
/**
26-
* Construct
27-
*
28-
* @param User $user
29-
* @param Lrs $lrs
30-
* @param Client $client
12+
* Constructs a new ClientController.
13+
* @param UserRepo $user
14+
* @param LrsRepo $lrs
15+
* @param ClientRepo $client
3116
*/
32-
public function __construct(User $user, Lrs $lrs, Client $client){
33-
17+
public function __construct(UserRepo $user, LrsRepo $lrs, ClientRepo $client) {
3418
$this->user = $user;
35-
$this->lrs = $lrs;
36-
$this->client = $client;
37-
$this->logged_in_user = Auth::user();
38-
19+
$this->lrs = $lrs;
20+
$this->client = $client;
3921
}
4022

4123
/**
42-
* Load the manage clients page
43-
*
44-
* @param int $id
24+
* Load the manage clients page.
25+
* @param String $lrs_id
4526
* @return View
4627
*/
47-
public function manage($id){
48-
49-
$lrs = $this->lrs->find( $id );
50-
$lrs_list = $this->lrs->all();
51-
52-
$clients = \Client::where('lrs_id', $lrs->id)->get();
53-
54-
55-
return View::make('partials.client.manage', array('clients' => $clients,
56-
'lrs' => $lrs,
57-
'list' => $lrs_list
58-
));
28+
public function manage($lrs_id) {
29+
$opts = ['user' => \Auth::user()];
30+
$lrs = $this->lrs->show($lrs_id, $opts);
31+
$lrs_list = $this->lrs->index($opts);
32+
$clients = \Client::where('lrs_id', $lrs->id)->get();
33+
return View::make('partials.client.manage', [
34+
'clients' => $clients,
35+
'lrs' => $lrs,
36+
'list' => $lrs_list
37+
]);
5938
}
6039

6140
/**
62-
* Load the manage clients page
63-
*
64-
* @param int $lrs_id
65-
* @param int $id
41+
* Load the manage clients page.
42+
* @param String $lrs_id
43+
* @param String $id
6644
* @return View
6745
*/
68-
public function edit($lrs_id, $id){
69-
70-
$lrs = $this->lrs->find( $lrs_id );
71-
$lrs_list = $this->lrs->all();
72-
73-
$client = $this->client->find( $id );
74-
75-
76-
return View::make('partials.client.edit', array('client' => $client,
77-
'lrs' => $lrs,
78-
'list' => $lrs_list
79-
));
46+
public function edit($lrs_id, $id) {
47+
$opts = ['user' => \Auth::user()];
48+
$lrs = $this->lrs->show($lrs_id, $opts);
49+
$lrs_list = $this->lrs->index($opts);
50+
$client = $this->client->find($id);
51+
return View::make('partials.client.edit', [
52+
'client' => $client,
53+
'lrs' => $lrs,
54+
'list' => $lrs_list
55+
]);
8056
}
8157

82-
/**
83-
* Create a new client
84-
*
85-
* @param int $id
58+
/**
59+
* Create a new client.
60+
* @param String $lrs_id
8661
* @return View
87-
**/
88-
89-
public function create($id){
90-
91-
$lrs = $this->lrs->find( $id );
92-
93-
$data = array('lrs_id' => $lrs->id);
62+
*/
63+
public function create($lrs_id) {
64+
$opts = ['user' => \Auth::user()];
65+
$lrs = $this->lrs->show($lrs_id, $opts);
66+
$data = ['lrs_id' => $lrs->id];
9467

95-
if( $this->client->create( $data ) ){
68+
if ($this->client->create($data)) {
9669
$message_type = 'success';
97-
$message = Lang::get('update_key');
98-
}else{
70+
$message = trans('lrs.client.created_sucecss');
71+
} else {
9972
$message_type = 'error';
100-
$message = Lang::get('update_key_error');
73+
$message = trans('lrs.client.created_fail');
10174
}
10275

10376
return Redirect::back()->with($message_type, $message);
10477
}
10578

10679
/**
10780
* Update the specified resource in storage.
108-
*
109-
* @param int $id
81+
* @param String $lrs_id Id of the LRS.
82+
* @param String $id Id of the client.
11083
* @return View
11184
*/
11285
public function update($lrs_id, $id){
113-
114-
/*$data = Input::all();
115-
116-
//TODO :client input validation This may be able to re-use some of the statement validator
117-
$rules['title'] = 'required|alpha_spaces';
118-
$rules['description'] = 'alpha_spaces';
119-
$validator = Validator::make($data, $rules);
120-
if ($validator->fails()) return Redirect::back()->withErrors($validator);
121-
*/
122-
123-
124-
//{{ URL() }}/lrs/{{ $lrs->_id }}/client/manage#{{ $client->_id }}
125-
126-
if($this->client->update( $id, Input::all() )){
127-
return Redirect::to('/lrs/'.$lrs_id.'/client/manage#'.$id)->with('success', Lang::get('lrs.client.updated'));
86+
if ($this->client->update($id, Input::all())) {
87+
$redirect_url = '/lrs/'.$lrs_id.'/client/manage#'.$id;
88+
return Redirect::to($redirect_url)->with('success', trans('lrs.client.updated'));
12889
}
12990

13091
return Redirect::back()
131-
->withInput()
132-
->withErrors($this->client->errors());
133-
92+
->withInput()
93+
->withErrors($this->client->errors());
13494
}
13595

136-
13796
/**
13897
* Remove the specified resource from storage.
139-
*
140-
* @param int $lrs_id
141-
* @param int $id
98+
* @param String $lrs_id
99+
* @param String $id
142100
* @return View
143101
*/
144102
public function destroy($lrs_id, $id){
145-
146-
if( $this->client->delete($id) ){
103+
if ($this->client->delete($id)) {
147104
$message_type = 'success';
148-
$message = Lang::get('delete_client_success');
149-
}else{
105+
$message = trans('lrs.client.delete_client_success');
106+
} else {
150107
$message_type = 'error';
151-
$message = Lang::get('delete_client_error');
108+
$message = trans('lrs.client.delete_client_error');
152109
}
153110

154-
return Redirect::back()->with($message_type, $message);
155-
111+
return Redirect::back()->with($message_type, $message);
156112
}
157-
158-
}
113+
}

app/controllers/ExplorerController.php

Lines changed: 0 additions & 92 deletions
This file was deleted.

app/controllers/ExportingController.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,27 @@
11
<?php
22

3-
use Locker\Repository\Lrs\LrsRepository as Lrs;
3+
use Locker\Repository\Lrs\Repository as LrsRepo;
44

55
class ExportingController extends \BaseController {
66

77
protected $views = 'partials.exports';
88
protected $lrs;
99

10-
public function __construct(Lrs $lrs){
10+
public function __construct(LrsRepo $lrs){
1111
$this->lrs = $lrs;
12-
1312
$this->beforeFilter('auth');
1413
$this->beforeFilter('auth.lrs'); //check user can access LRS.
1514
$this->beforeFilter('csrf', array('only' => array('update', 'store', 'destroy')));
1615
}
1716

1817
/**
1918
* Display a listing of the resource.
20-
*
21-
* @return Response
19+
* @return View
2220
*/
2321
public function index($id){
24-
$lrs = $this->lrs->find( $id );
25-
$lrs_list = $this->lrs->all();
22+
$opts = ['user' => \Auth::user()];
23+
$lrs = $this->lrs->show($id, $opts);
24+
$lrs_list = $this->lrs->index($opts);
2625
return View::make("{$this->views}.index", [
2726
'lrs' => $lrs,
2827
'list' => $lrs_list,

0 commit comments

Comments
 (0)