|
@@ -11,58 +11,60 @@ class UsersController extends \BaseController
|
11
|
11
|
public function index()
|
12
|
12
|
{
|
13
|
13
|
$title = "Users";
|
14
|
|
-
|
|
14
|
+$a=microtime();
|
15
|
15
|
$users = User::with('programs', 'school')
|
16
|
16
|
->orderBy('surnames')
|
17
|
17
|
->orderBy('first_name')
|
18
|
18
|
->get();
|
19
|
|
- Log::info('LmaOOOOO get cocked');
|
|
19
|
+$b=microtime();
|
|
20
|
+
|
|
21
|
+ Log::info(($b-$a));
|
20
|
22
|
|
21
|
23
|
|
22
|
24
|
$schools = School::orderBy('name', 'asc')->get();
|
23
|
25
|
$access_level = count(User::select('role')->where('has_access', 1)->groupBy('role')->get());
|
24
|
|
- try {
|
25
|
|
- Log::info("Schools");
|
26
|
|
- foreach ($schools as $school) {
|
27
|
|
- Log::info(print_r($school, true));
|
28
|
|
- }
|
29
|
|
- foreach ($users as $user) {
|
30
|
|
- Log::info("ID");
|
31
|
|
- Log::info($user->id);
|
32
|
|
- Log::info("Name");
|
33
|
|
- Log::info($user->surname . $user->first_name);
|
34
|
|
- Log::info("if funciona??");
|
35
|
|
- Log::info($user->school_id);
|
36
|
|
- Log::info("elseif??");
|
37
|
|
- Log::info(count($user->programs));
|
38
|
|
- if ($user->school_id) {
|
39
|
|
- Log::info("Schoool");
|
40
|
|
- Log::info($user->school->name);
|
41
|
|
- Log::info($user->school_id);
|
42
|
|
- } elseif (count($user->programs) > 0) {
|
43
|
|
- Log::info("Entre aqui");
|
44
|
|
- Log::info($user->programs[0]->school_id);
|
45
|
|
- Log::info($user->programs[0]->school->name);
|
46
|
|
- } else Log::info("Not so cocked");
|
47
|
|
-
|
48
|
|
- Log::info("bueno vamos a ver que hay???");
|
49
|
|
- Log::info(count($user->programs));
|
50
|
|
- if (count($user->programs)) {
|
51
|
|
- foreach ($user->programs as $program) {
|
52
|
|
- Log::info($program->id);
|
53
|
|
- Log::info($program->name);
|
54
|
|
- }
|
55
|
|
- } else Log::info("Tal vez cocked");
|
56
|
|
- Log::info("email");
|
57
|
|
- Log::info($user->email);
|
58
|
|
- Log::info("Role" . $user->role);
|
59
|
|
- Log::info($user->office_phone);
|
60
|
|
- Log::info($user->cell_phone);
|
61
|
|
- }
|
62
|
|
- } catch (Exception $e) {
|
63
|
|
- Log::info("get Cocked" . $e);
|
64
|
|
- }
|
65
|
|
- Log::info("el error era en la base de datos XDDDDDDD");
|
|
26
|
+// try {
|
|
27
|
+// Log::info("Schools");
|
|
28
|
+// foreach ($schools as $school) {
|
|
29
|
+// Log::info(print_r($school, true));
|
|
30
|
+// }
|
|
31
|
+// foreach ($users as $user) {
|
|
32
|
+// Log::info("ID");
|
|
33
|
+// Log::info($user->id);
|
|
34
|
+// Log::info("Name");
|
|
35
|
+// Log::info($user->surname . $user->first_name);
|
|
36
|
+// Log::info("if funciona??");
|
|
37
|
+// Log::info($user->school_id);
|
|
38
|
+// Log::info("elseif??");
|
|
39
|
+// Log::info(count($user->programs));
|
|
40
|
+// if ($user->school_id) {
|
|
41
|
+// Log::info("Schoool");
|
|
42
|
+// Log::info($user->school->name);
|
|
43
|
+// Log::info($user->school_id);
|
|
44
|
+// } elseif (count($user->programs) > 0) {
|
|
45
|
+// Log::info("Entre aqui");
|
|
46
|
+// Log::info($user->programs[0]->school_id);
|
|
47
|
+// Log::info($user->programs[0]->school->name);
|
|
48
|
+// } else Log::info("Not so cocked");
|
|
49
|
+//
|
|
50
|
+// Log::info("bueno vamos a ver que hay???");
|
|
51
|
+// Log::info(count($user->programs));
|
|
52
|
+// if (count($user->programs)) {
|
|
53
|
+// foreach ($user->programs as $program) {
|
|
54
|
+// Log::info($program->id);
|
|
55
|
+// Log::info($program->name);
|
|
56
|
+// }
|
|
57
|
+// } else Log::info("Tal vez cocked");
|
|
58
|
+// Log::info("email");
|
|
59
|
+// Log::info($user->email);
|
|
60
|
+// Log::info("Role" . $user->role);
|
|
61
|
+// Log::info($user->office_phone);
|
|
62
|
+// Log::info($user->cell_phone);
|
|
63
|
+// }
|
|
64
|
+// } catch (Exception $e) {
|
|
65
|
+// Log::info("get Cocked" . $e);
|
|
66
|
+// }
|
|
67
|
+// Log::info("el error era en la base de datos XDDDDDDD");
|
66
|
68
|
|
67
|
69
|
|
68
|
70
|
return View::make('local.managers.admins.users', compact('title', 'users', 'schools', 'access_level'));
|
|
@@ -235,14 +237,19 @@ class UsersController extends \BaseController
|
235
|
237
|
array(
|
236
|
238
|
'office_phone' => 'string|max:20|required_with:office_extension',
|
237
|
239
|
'office_extension' => 'digits_between:1,5|required_with:office_phone|unique:users,office_extension,' . $user->id,
|
238
|
|
- 'cell_phone' => 'string|max:20'
|
|
240
|
+ 'cell_phone' => 'string|max:20',
|
239
|
241
|
)
|
240
|
242
|
);
|
241
|
|
-
|
|
243
|
+// Log::info("email");
|
|
244
|
+// Log::info($user->email);
|
|
245
|
+// Log::info(Input::get('email'));
|
|
246
|
+// $user->email = Input::get('email');
|
|
247
|
+// Log::info($user->email);
|
|
248
|
+
|
242
|
249
|
/** If validation fails */
|
243
|
250
|
if ($validator->fails()) {
|
244
|
251
|
/** Prepare error message */
|
245
|
|
- $message = 'Error(s) updating your Contact nformation<ul>';
|
|
252
|
+ $message = 'Error(s) updating your Contact Information<ul>';
|
246
|
253
|
|
247
|
254
|
foreach ($validator->messages()->all('<li>:message</li>') as $validationError) {
|
248
|
255
|
$message .= $validationError;
|
|
@@ -288,6 +295,45 @@ class UsersController extends \BaseController
|
288
|
295
|
try {
|
289
|
296
|
$exception = DB::transaction(function () {
|
290
|
297
|
$user = User::find(Input::get('id'));
|
|
298
|
+ $validator = Validator::make(
|
|
299
|
+ array(
|
|
300
|
+ 'email' => Input::get('email'),
|
|
301
|
+ ),
|
|
302
|
+ array(
|
|
303
|
+ 'email' => 'required|email|unique:users'
|
|
304
|
+ )
|
|
305
|
+ );
|
|
306
|
+// Log::info("email");
|
|
307
|
+// Log::info($user->email);
|
|
308
|
+// Log::info(Input::get('email'));
|
|
309
|
+// $user->email = Input::get('email');
|
|
310
|
+// Log::info($user->email);
|
|
311
|
+
|
|
312
|
+ /** If validation fails */
|
|
313
|
+ if ($validator->fails()) {
|
|
314
|
+ /** Prepare error message */
|
|
315
|
+ $message = 'Error(s) updating your Contact Information<ul>';
|
|
316
|
+
|
|
317
|
+ foreach ($validator->messages()->all('<li>:message</li>') as $validationError) {
|
|
318
|
+ $message .= $validationError;
|
|
319
|
+ }
|
|
320
|
+
|
|
321
|
+ $message .= '</ul>';
|
|
322
|
+
|
|
323
|
+ /** Send error message and old data */
|
|
324
|
+ Session::flash('status', 'danger');
|
|
325
|
+ Session::flash('message', $message);
|
|
326
|
+ return Redirect::back()->withInput();
|
|
327
|
+ } else {
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+// Log::info("email");
|
|
331
|
+// Log::info($user->email);
|
|
332
|
+// Log::info(Input::get('email'));
|
|
333
|
+ $user->email = Input::get('email');
|
|
334
|
+// Log::info($user->email);
|
|
335
|
+
|
|
336
|
+ }
|
291
|
337
|
|
292
|
338
|
switch (Input::get('role')) {
|
293
|
339
|
case '1':
|