浏览代码

anhadir view a typ

父节点
当前提交
5d791203c1

+ 49
- 1
app/controllers/ThreeYearPlanController.php 查看文件

@@ -614,6 +614,7 @@ class ThreeYearPlanController extends \BaseController
614 614
 
615 615
   public function printPlan($program_id, $typ)
616 616
   {
617
+	$view=0;
617 618
 
618 619
     $program = DB::table('programs')->where('id', $program_id)->first();
619 620
     $three_year_plan = DB::table('three_year_plan')->where('id', $typ)->first();
@@ -656,6 +657,53 @@ class ThreeYearPlanController extends \BaseController
656 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 查看文件

@@ -245,6 +245,10 @@ Route::group(array('before' => 'auth|has_access'), function () {
245 245
         'as' => 'printThreeYear/{program_id}/{typ}',
246 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 252
     // Fetch all criteria associated to an outcome
249 253
     Route::post('fetchInfo', array(
250 254
         'as' => 'fetchInfo',

+ 12
- 5
app/views/global/print_three_year_plan.blade.php 查看文件

@@ -93,10 +93,12 @@ echo
93 93
     @media print{@page {size: landscape}}
94 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 103
 <img class="logo" src="{{ asset('images/logo_uprrp_bw.png') }}" alt="UPRRP Logo">
102 104
 
@@ -136,7 +138,7 @@ echo '<style type="text/css" media="print">
136 138
             <ol>
137 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 143
             @endforeach
142 144
         </ol>
@@ -158,6 +160,8 @@ echo '<style type="text/css" media="print">
158 160
 
159 161
 echo '</body>';
160 162
 echo '</html>';
163
+if(!$view)
164
+{
161 165
 ?>
162 166
 
163 167
 <script type="text/javascript">
@@ -165,3 +169,6 @@ echo '</html>';
165 169
 window.print();
166 170
 
167 171
 </script>
172
+<?php
173
+}
174
+?>

+ 5
- 0
app/views/global/view-three-year-plan.blade.php 查看文件

@@ -143,6 +143,7 @@
143 143
 
144 144
         <div class="col-md-9">
145 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 147
                 <a href="" id="print_button" class="btn btn-default" target="_blank" rel="noopener noreferrer">Print</a>
147 148
             </div>
148 149
             <div id="cycle-display" class="panel panel-default">
@@ -419,6 +420,10 @@
419 420
                 $('#three_year_button').hide();
420 421
                 var id = $(this).data('cycle-id');
421 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 427
                 $('#print_button').show();
423 428
                 $('#print_button').attr("href",
424 429
                     "{{ URL::action('ThreeYearPlanController@printPlan', [$program_id]) }}" +