public function getOfflinetest()
 {
     //q1 => jabatan_id
     $dataScheduleActive = Competency::where('status', '=', 'active')->first();
     $dataJabatan = DafUnitStaff::where('aktif_id', '=', 1)->get();
     $dataProfile = null;
     if (Input::has('q1')) {
         $jabatanTerpilih = DafUnitStaff::where('unit_staf_id', Input::get('q1'))->first();
         $dataProfile = CompetencyProfile::with('competencyDictionary.competencyType', 'competencyDictionary.level')->where('competency_id', '=', $dataScheduleActive->id)->where('jabatan_id', '=', Input::get('q1'))->get();
         //            return $jabatanTerpilih;
         $html = View::make('competency::adminProfile.downloadoffflinetest', compact('dataProfile', 'jabatanTerpilih'));
         return PDF::load($html, 'A4', 'portrait')->download('offline test competency');
     } else {
         $this->layout->content = View::make('competency::adminProfile.offlineTest', compact('dataScheduleActive', 'dataJabatan'));
     }
 }
Exemplo n.º 2
0
 public function downloadUnit($idUnit)
 {
     $unit = DafUnit::find($idUnit);
     //        $profiles = CompetencyProfile::with(['competencyDictionary' => function($q) use($idUnit) {
     //
     //            }])->where('jabatan_id', '=', $idUnit)->get();
     $profiles = CompetencyProfile::with(['competencyDictionary' => function ($q) use($idUnit) {
         $q->with('level')->get();
     }])->where('jabatan_id', '=', $idUnit)->get();
     if (count($profiles) > 0) {
         //            echo "<pre>";
         //            print_r($profiles) ;
         return $profiles;
         //            $dictionaries = CompetencyDictionary::with('competencyType', 'kopet', 'child', 'level')->take('20')->get();
         $html = View::make('competency::dictionary.unitDownload', compact('profiles'));
         //            return $html;
         return PDF::load($html, 'A4', 'portrait')->show($unit->nama);
     } else {
         dd('tidak memiliki kompetensi');
     }
 }
Exemplo n.º 3
0
 public function index()
 {
     $units = DafUnitStaff::all();
     if (Request::isMethod('post')) {
         // create the validation rules ------------------------
         $rules = array('unit' => 'required');
         // validate against the inputs from our form
         $validator = Validator::make(Input::all(), $rules);
         if ($validator->fails()) {
             // get the error messages from the validator
             $messages = $validator->messages();
             // redirect our user back to the form with the errors from the validator
             return Redirect::back()->withErrors($messages);
         } else {
             $unit = DafUnitStaff::where('unit_staf_id', Input::get('unit'))->first();
             $softProfiles = CompetencyProfile::with('competencyDictionary')->join('competency_dictionaries', 'competency_profiles.competency_dictionary_id', '=', 'competency_dictionaries.id')->where('competency_dictionaries.type_id', '=', '1')->where('jabatan_id', '=', Input::get('unit'))->groupBy('competency_dictionary_id')->get();
             $hardProfiles = CompetencyProfile::with('competencyDictionary')->join('competency_dictionaries', 'competency_profiles.competency_dictionary_id', '=', 'competency_dictionaries.id')->where('competency_dictionaries.type_id', '=', '2')->where('jabatan_id', '=', Input::get('unit'))->groupBy('competency_dictionary_id')->get();
             //                return $profiles;
             $this->layout->content = View::make('competency::profile.postindex', compact('units', 'unit', 'softProfiles', 'hardProfiles'));
         }
     } else {
         $this->layout->content = View::make('competency::profile.index', compact('units'));
     }
 }