Browse Source

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

parent
commit
c21fe57e78

+ 5
- 5
app/database/seeds/CourseStudentTableSeeder.php View File

15
         $time_start = microtime(true);
15
         $time_start = microtime(true);
16
 
16
 
17
         // Open file
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
             // Initialize count variables
20
             // Initialize count variables
21
             $read = 0;
21
             $read = 0;
25
             $semester_id = NULL;
25
             $semester_id = NULL;
26
 
26
 
27
             // Read each row
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
                 // Add read count
30
                 // Add read count
31
                 $read++;
31
                 $read++;
32
 
32
 
33
                 try
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
                     // If any required field is empty, raise an exception
39
                     // If any required field is empty, raise an exception
40
                     if(!$code_number_section || !$student_number || !$term_code)
40
                     if(!$code_number_section || !$student_number || !$term_code)

+ 12
- 9
app/database/seeds/CourseTableSeeder.php View File

13
         $time_start = microtime(true);
13
         $time_start = microtime(true);
14
 
14
 
15
         // Open file
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
             // Initialize count variables
18
             // Initialize count variables
19
             $read = 0;
19
             $read = 0;
22
             $error = 0;
22
             $error = 0;
23
 
23
 
24
             // Read each row
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
                 // Add read count
27
                 // Add read count
28
                 $read++;
28
                 $read++;
31
                 try
31
                 try
32
                 {
32
                 {
33
                     // Get row info
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
                     // If any row is empty, raise an exception
43
                     // If any row is empty, raise an exception
43
                     if($name=='' || $code=='' || $number=='' || $section=='' || trim($data[14])=='' || trim($data[2])=='')
44
                     if($name=='' || $code=='' || $number=='' || $section=='' || trim($data[14])=='' || trim($data[2])=='')
93
                                     'code' => $code,
94
                                     'code' => $code,
94
                                     'number' => $number,
95
                                     'number' => $number,
95
                                     'section' => $section,
96
                                     'section' => $section,
97
+                                    'modality' => $modality,
96
                                     'program_id' => $program_id,
98
                                     'program_id' => $program_id,
97
                                     'user_id' => $user_id,
99
                                     'user_id' => $user_id,
98
                                     'updated_at' => date("Y-m-d H:i:s", time())
100
                                     'updated_at' => date("Y-m-d H:i:s", time())
110
                             'code' => $code,
112
                             'code' => $code,
111
                             'number' => $number,
113
                             'number' => $number,
112
                             'section' => $section,
114
                             'section' => $section,
115
+                            'modality' => $modality,
113
                             'program_id' => $program_id,
116
                             'program_id' => $program_id,
114
                             'user_id' => $user_id,
117
                             'user_id' => $user_id,
115
                             'semester_id' => $semester_id
118
                             'semester_id' => $semester_id

+ 13
- 1
app/database/seeds/UserTableSeeder.php View File

29
             $error = 0;
29
             $error = 0;
30
 
30
 
31
             // Read each row
31
             // Read each row
32
-            while($data = fgetcsv($file, 5000, "|"))
32
+            while($data = fgetcsv($file, 5000))
33
             {
33
             {
34
                 // Add read count
34
                 // Add read count
35
                 $read++;
35
                 $read++;
44
                     $email = strtolower(trim($data[3]));
44
                     $email = strtolower(trim($data[3]));
45
                     $emp_number = strtolower(trim($data[4]));
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
                     // Program unavailable.For the moment, I'm setting it to null, but it should eventually be the commented line below
59
                     // Program unavailable.For the moment, I'm setting it to null, but it should eventually be the commented line below
48
                     // $program_id = trim($data[4]);
60
                     // $program_id = trim($data[4]);
49
                     $program_id = NULL;
61
                     $program_id = NULL;

+ 4
- 2
app/views/local/managers/admins/_navigation.blade.php View File

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

+ 9
- 1
bootstrap/start.php View File

23
 | given environment, then we will automatically detect it for you.
23
 | given environment, then we will automatically detect it for you.
24
 |
24
 |
25
 */
25
 */
26
-
26
+/*
27
 $env = $app->detectEnvironment(array(
27
 $env = $app->detectEnvironment(array(
28
 
28
 
29
 	'local' => array(gethostname(), 'RPV20111.rrp.campus', 'homestead'),
29
 	'local' => array(gethostname(), 'RPV20111.rrp.campus', 'homestead'),
30
     'production' => array('*.com', '*.edu', '*.org'),
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
 |--------------------------------------------------------------------------