Преглед на файлове

arregle bug de logout en admins, cambios a los seeders para ajustarnos a los formatos nuevos de archivos y cambio para que se ajuste a production cuando este en el servidor

Carlos J Corrada Bravo преди 3 години
родител
ревизия
c21fe57e78

+ 5
- 5
app/database/seeds/CourseStudentTableSeeder.php Целия файл

@@ -15,7 +15,7 @@ class CourseStudentTableSeeder extends Seeder {
15 15
         $time_start = microtime(true);
16 16
 
17 17
         // Open file
18
-        if($file = fopen('app/database/csv/course_student.csv', 'r'))
18
+        if($file = fopen('app/database/csv/estudiante_curso.csv', 'r'))
19 19
         {
20 20
             // Initialize count variables
21 21
             $read = 0;
@@ -25,16 +25,16 @@ class CourseStudentTableSeeder extends Seeder {
25 25
             $semester_id = NULL;
26 26
 
27 27
             // Read each row
28
-            while($data = fgetcsv($file, 5000, "|")) // se cambio delimitador para evitar problemas con nombre separados del apellido con coma
28
+            while($data = fgetcsv($file, 5000)) // se cambio delimitador para evitar problemas con nombre separados del apellido con coma
29 29
             {
30 30
                 // Add read count
31 31
                 $read++;
32 32
 
33 33
                 try
34 34
                 {
35
-                    $code_number_section = trim($data[3]);
36
-                    $student_number = trim($data[0]);
37
-                    $term_code = trim($data[2]);
35
+                    $student_number = trim($data[1]);
36
+                    $code_number_section = trim($data[2]);
37
+                    $term_code = trim($data[3]);
38 38
 
39 39
                     // If any required field is empty, raise an exception
40 40
                     if(!$code_number_section || !$student_number || !$term_code)

+ 12
- 9
app/database/seeds/CourseTableSeeder.php Целия файл

@@ -13,7 +13,7 @@ class CourseTableSeeder extends Seeder {
13 13
         $time_start = microtime(true);
14 14
 
15 15
         // Open file
16
-        if($file = fopen('app/database/csv/courses.csv', 'r'))
16
+        if($file = fopen('app/database/csv/cursos.csv', 'r'))
17 17
         {
18 18
             // Initialize count variables
19 19
             $read = 0;
@@ -22,7 +22,7 @@ class CourseTableSeeder extends Seeder {
22 22
             $error = 0;
23 23
 
24 24
             // Read each row
25
-            while($data = fgetcsv($file, 5000, "|")) // se cambio delimitador para evitar problemas con nombres separados del apellido por coma
25
+            while($data = fgetcsv($file, 5000)) // se cambio delimitador para evitar problemas con nombres separados del apellido por coma
26 26
             {
27 27
                 // Add read count
28 28
                 $read++;
@@ -31,13 +31,14 @@ class CourseTableSeeder extends Seeder {
31 31
                 try
32 32
                 {
33 33
                     // Get row info
34
-                    $name = $data[6];
35
-                    $code = trim(substr($data[0], 0, 4));
36
-                    $number = trim(substr($data[0], 4, 4));
37
-                    $section = trim(substr($data[0], 8, 3));
38
-                    $user_id = User::select('id')->where('ssn', trim($data[14]))->first();
39
-                    $semester_id = Semester::select('id')->where('code', strtoupper(trim($data[2])))->first();
40
-                    $program_code = trim($data[7]);
34
+                    $name = $data[8];
35
+                    $code = trim(substr($data[1], 0, 4));
36
+                    $number = trim(substr($data[1], 4, 4));
37
+                    $section = trim(substr($data[1], 8, 3));
38
+                    $user_id = User::select('id')->where('ssn', trim($data[11]))->first();
39
+                    $semester_id = Semester::select('id')->where('code', strtoupper(trim($data[3])))->first();
40
+                    $program_code = trim($data[9]);
41
+                    $modality = trim($data[5]);
41 42
 
42 43
                     // If any row is empty, raise an exception
43 44
                     if($name=='' || $code=='' || $number=='' || $section=='' || trim($data[14])=='' || trim($data[2])=='')
@@ -93,6 +94,7 @@ class CourseTableSeeder extends Seeder {
93 94
                                     'code' => $code,
94 95
                                     'number' => $number,
95 96
                                     'section' => $section,
97
+                                    'modality' => $modality,
96 98
                                     'program_id' => $program_id,
97 99
                                     'user_id' => $user_id,
98 100
                                     'updated_at' => date("Y-m-d H:i:s", time())
@@ -110,6 +112,7 @@ class CourseTableSeeder extends Seeder {
110 112
                             'code' => $code,
111 113
                             'number' => $number,
112 114
                             'section' => $section,
115
+                            'modality' => $modality,
113 116
                             'program_id' => $program_id,
114 117
                             'user_id' => $user_id,
115 118
                             'semester_id' => $semester_id

+ 13
- 1
app/database/seeds/UserTableSeeder.php Целия файл

@@ -29,7 +29,7 @@ class UserTableSeeder extends Seeder {
29 29
             $error = 0;
30 30
 
31 31
             // Read each row
32
-            while($data = fgetcsv($file, 5000, "|"))
32
+            while($data = fgetcsv($file, 5000))
33 33
             {
34 34
                 // Add read count
35 35
                 $read++;
@@ -44,6 +44,18 @@ class UserTableSeeder extends Seeder {
44 44
                     $email = strtolower(trim($data[3]));
45 45
                     $emp_number = strtolower(trim($data[4]));
46 46
 
47
+                    if($email=="null" or $email=="")
48
+                    {
49
+                    	$email="email".rand()."@upr.edu";
50
+//                     	print($email);
51
+//                     	var_dump($data);exit();
52
+                    }
53
+                    if($emp_number=="null" or $emp_number=="")
54
+                    {
55
+                    	$emp_number="NO".rand(10000000,99999999);
56
+//                     	print($emp_number);
57
+//                     	var_dump($data);exit();
58
+                    }
47 59
                     // Program unavailable.For the moment, I'm setting it to null, but it should eventually be the commented line below
48 60
                     // $program_id = trim($data[4]);
49 61
                     $program_id = NULL;

+ 4
- 2
app/views/local/managers/admins/_navigation.blade.php Целия файл

@@ -72,14 +72,16 @@
72 72
       </li>
73 73
       <li class="dropdown">
74 74
         <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Account<span class="caret"></span></a>
75
-{{--         <ul class="dropdown-menu" role="menu">
75
+         <ul class="dropdown-menu" role="menu">
76 76
           <li>{{ HTML::linkAction('UsersController@edit', 'Profile') }}</li>
77 77
           <li>{{ HTML::linkAction('AuthController@logout', 'Log out ('.Auth::user()->email.')') }}</li>
78 78
         </ul>
79 79
       </li>
80
+<!-- 
80 81
           <li>{{ HTML::linkAction('AuthController@logout', 'Log out ('.Auth::user()->email.')') }}
81 82
       </li>
82
-    </ul>--}}
83
+ -->
84
+    </ul>
83 85
     </li>
84 86
     </ul>
85 87
   </div>

+ 9
- 1
bootstrap/start.php Целия файл

@@ -23,13 +23,21 @@ $app = new Illuminate\Foundation\Application;
23 23
 | given environment, then we will automatically detect it for you.
24 24
 |
25 25
 */
26
-
26
+/*
27 27
 $env = $app->detectEnvironment(array(
28 28
 
29 29
 	'local' => array(gethostname(), 'RPV20111.rrp.campus', 'homestead'),
30 30
     'production' => array('*.com', '*.edu', '*.org'),
31 31
 
32 32
 ));
33
+*/
34
+
35
+$env = $app->detectEnvironment(array(
36
+
37
+	'local' => array('RPV20111.rrp.campus', 'homestead'),
38
+    'production' => array('*.com', '*.edu', '*.org'),
39
+
40
+));
33 41
 
34 42
 /*
35 43
 |--------------------------------------------------------------------------