|
|
@@ -107,13 +107,19 @@ class UserController extends Controller
|
|
107
|
107
|
public function load_progetti(Request $request){
|
|
108
|
108
|
$redmineUser = session('redmine_user');
|
|
109
|
109
|
$user = User::find($request->user_id);
|
|
|
110
|
+ $userProg = json_decode($user->progetti);
|
|
|
111
|
+ if($userProg == null){
|
|
|
112
|
+ $userProg = array();
|
|
|
113
|
+ }
|
|
110
|
114
|
|
|
111
|
115
|
$progettiUser = new Collection;
|
|
112
|
116
|
$progetti = new Collection;
|
|
113
|
117
|
|
|
114
|
|
- // Lista di tutti i progetti
|
|
|
118
|
+ // Lista di tutti i progetti assegnati all'utente
|
|
115
|
119
|
$projectResponseUser = Http::get(config('redmine.url').'/projects.json', [
|
|
116
|
|
- 'key' => $redmineUser->api_key
|
|
|
120
|
+ 'key' => $redmineUser->api_key,
|
|
|
121
|
+ 'id' => ($userProg!=null && count($userProg)>0)?implode('|', $userProg):'',
|
|
|
122
|
+ 'limit' => 100
|
|
117
|
123
|
]);
|
|
118
|
124
|
|
|
119
|
125
|
// Lista di 30 progetti filtrati per ricerca
|
|
|
@@ -124,13 +130,13 @@ class UserController extends Controller
|
|
124
|
130
|
]);
|
|
125
|
131
|
|
|
126
|
132
|
foreach($projectResponseUser->object()->projects as $project){
|
|
127
|
|
- if(in_array($project->id, json_decode($user->progetti))){
|
|
|
133
|
+ if(in_array($project->id, $userProg)){
|
|
128
|
134
|
$progettiUser->push($project);
|
|
129
|
135
|
}
|
|
130
|
136
|
}
|
|
131
|
137
|
|
|
132
|
138
|
foreach($projectResponse->object()->projects as $project){
|
|
133
|
|
- if(!in_array($project->id, json_decode($user->progetti))){
|
|
|
139
|
+ if(!in_array($project->id, $userProg)){
|
|
134
|
140
|
$progetti->push($project);
|
|
135
|
141
|
}
|
|
136
|
142
|
}
|