function __construct() { //get competency schedule active $competencyActive = Competency::where('status', '=', 'active')->first(); if ($competencyActive->count()) { $this->competencyData = $competencyActive; } else { $this->layout->content = View::make('competency::test.forbidden'); } }
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')); } }
public static function checkActive() { $competency = Competency::where('status', '=', 'active')->first(); if (count($competency) > 0) { $dateStart = strtotime($competency->date_start); $dateEnd = strtotime($competency->date_end); $now = strtotime('now'); if ($now < $dateStart) { return 200; } elseif ($now > $dateEnd) { return 300; } else { return 1; } } else { return false; } }