Browse Source

anhadir view a typ

parent
commit
5d791203c1

+ 49
- 1
app/controllers/ThreeYearPlanController.php View File

614
 
614
 
615
   public function printPlan($program_id, $typ)
615
   public function printPlan($program_id, $typ)
616
   {
616
   {
617
+	$view=0;
617
 
618
 
618
     $program = DB::table('programs')->where('id', $program_id)->first();
619
     $program = DB::table('programs')->where('id', $program_id)->first();
619
     $three_year_plan = DB::table('three_year_plan')->where('id', $typ)->first();
620
     $three_year_plan = DB::table('three_year_plan')->where('id', $typ)->first();
656
     Log::info($typ_semester_outcome);
657
     Log::info($typ_semester_outcome);
657
 
658
 
658
 
659
 
659
-    return View::make('global.print_three_year_plan', compact('typ_semesters', 'program', 'three_year_plan', 'typ_semesters', 'typ_semester_outcome'));
660
+    return View::make('global.print_three_year_plan', compact('typ_semesters', 'program', 'three_year_plan', 'typ_semesters', 'typ_semester_outcome', 'view'));
661
+  }
662
+  
663
+  public function viewPlan($program_id, $typ)
664
+  {
665
+	$view=1;
666
+    $program = DB::table('programs')->where('id', $program_id)->first();
667
+    $three_year_plan = DB::table('three_year_plan')->where('id', $typ)->first();
668
+
669
+    $typ_program_id = DB::table('typ_program')->where('three_year_plan_id', $three_year_plan->id)
670
+      ->where('program_id', $program->id)
671
+      ->first()->id;
672
+
673
+    $typ_semesters = DB::table('semesters')
674
+      ->join('typ_semesters', 'semesters.id', '=', 'typ_semesters.semester_id')
675
+      ->where('typ_id', $three_year_plan->id)
676
+      ->orderBy('semester_id')
677
+      ->get();
678
+
679
+
680
+    foreach ($typ_semesters as $semester) {
681
+      $typ_semester_outcome[$semester->semester_id] = DB::table('typ_semester_outcome')
682
+        ->join('outcomes', 'outcomes.id', '=', 'typ_semester_outcome.outcome_id')
683
+        ->where('typ_program_id', $typ_program_id)
684
+        ->where('semester_id', $semester->semester_id)
685
+        ->select('typ_semester_outcome.id as typ_id')
686
+        ->addSelect('outcomes.id as outcome_id', 'outcomes.name')
687
+        ->get();
688
+
689
+      foreach ($typ_semester_outcome[$semester->semester_id] as $outcome) {
690
+        $outcome->objectives = DB::table('typ_semester_objectives')
691
+          ->join('objectives', 'objectives.id', '=', 'typ_semester_objectives.objective_id')
692
+          ->where('typ_semester_outcome_id', $outcome->typ_id)
693
+          ->select('typ_semester_objectives.id as typ_obj_id')
694
+          ->addSelect('objectives.text', 'objectives.id as objective_id')
695
+          ->get();
696
+        foreach ($outcome->objectives as $objective) {
697
+          $objective->courses = DB::table('typ_semester_courses')
698
+            ->join('courses', 'courses.id', '=', 'typ_semester_courses.course_id')
699
+            ->where('typ_semester_objective_id', $objective->typ_obj_id)
700
+            ->get();
701
+        }
702
+      }
703
+    }
704
+    Log::info($typ_semester_outcome);
705
+
706
+
707
+    return View::make('global.print_three_year_plan', compact('typ_semesters', 'program', 'three_year_plan', 'typ_semesters', 'typ_semester_outcome', 'view'));
660
   }
708
   }
661
 }
709
 }

+ 4
- 0
app/routes.php View File

245
         'as' => 'printThreeYear/{program_id}/{typ}',
245
         'as' => 'printThreeYear/{program_id}/{typ}',
246
         'uses' => 'ThreeYearPlanController@printPlan'
246
         'uses' => 'ThreeYearPlanController@printPlan'
247
     ));
247
     ));
248
+    Route::get('viewThreeYear/{program_id}/{typ}', array(
249
+        'as' => 'viewThreeYear/{program_id}/{typ}',
250
+        'uses' => 'ThreeYearPlanController@viewPlan'
251
+    ));
248
     // Fetch all criteria associated to an outcome
252
     // Fetch all criteria associated to an outcome
249
     Route::post('fetchInfo', array(
253
     Route::post('fetchInfo', array(
250
         'as' => 'fetchInfo',
254
         'as' => 'fetchInfo',

+ 12
- 5
app/views/global/print_three_year_plan.blade.php View File

93
     @media print{@page {size: landscape}}
93
     @media print{@page {size: landscape}}
94
 </style>';
94
 </style>';
95
 
95
 
96
-echo '<style type="text/css" media="print">
97
-  @page { size: landscape; }
98
-</style>';
99
-
96
+if(!$view) 
97
+{
98
+	echo '<style type="text/css" media="print">
99
+	  @page { size: landscape; }
100
+	</style>';
101
+}
100
 ?>
102
 ?>
101
 <img class="logo" src="{{ asset('images/logo_uprrp_bw.png') }}" alt="UPRRP Logo">
103
 <img class="logo" src="{{ asset('images/logo_uprrp_bw.png') }}" alt="UPRRP Logo">
102
 
104
 
136
             <ol>
138
             <ol>
137
             @foreach($objective->courses as $course)
139
             @foreach($objective->courses as $course)
138
             
140
             
139
-    <li>[{{$course->code}}] {{$course->name}}</li>
141
+    <li>[{{$course->code}}{{$course->number}}] {{$course->name}}</li>
140
             
142
             
141
             @endforeach
143
             @endforeach
142
         </ol>
144
         </ol>
158
 
160
 
159
 echo '</body>';
161
 echo '</body>';
160
 echo '</html>';
162
 echo '</html>';
163
+if(!$view)
164
+{
161
 ?>
165
 ?>
162
 
166
 
163
 <script type="text/javascript">
167
 <script type="text/javascript">
165
 window.print();
169
 window.print();
166
 
170
 
167
 </script>
171
 </script>
172
+<?php
173
+}
174
+?>

+ 5
- 0
app/views/global/view-three-year-plan.blade.php View File

143
 
143
 
144
         <div class="col-md-9">
144
         <div class="col-md-9">
145
             <div class="btn-group pull-right">
145
             <div class="btn-group pull-right">
146
+                <a href="" id="view_button" class="btn btn-default" target="_blank" rel="noopener noreferrer">View</a>
146
                 <a href="" id="print_button" class="btn btn-default" target="_blank" rel="noopener noreferrer">Print</a>
147
                 <a href="" id="print_button" class="btn btn-default" target="_blank" rel="noopener noreferrer">Print</a>
147
             </div>
148
             </div>
148
             <div id="cycle-display" class="panel panel-default">
149
             <div id="cycle-display" class="panel panel-default">
419
                 $('#three_year_button').hide();
420
                 $('#three_year_button').hide();
420
                 var id = $(this).data('cycle-id');
421
                 var id = $(this).data('cycle-id');
421
                 $('#table-cycles').data('typ-id', id);
422
                 $('#table-cycles').data('typ-id', id);
423
+                $('#view_button').show();
424
+                $('#view_button').attr("href",
425
+                    "{{ URL::action('ThreeYearPlanController@viewPlan', [$program_id]) }}" +
426
+                    '/' + $(this).data('cycle-id'));
422
                 $('#print_button').show();
427
                 $('#print_button').show();
423
                 $('#print_button').attr("href",
428
                 $('#print_button').attr("href",
424
                     "{{ URL::action('ThreeYearPlanController@printPlan', [$program_id]) }}" +
429
                     "{{ URL::action('ThreeYearPlanController@printPlan', [$program_id]) }}" +