public function studentPerprogramFilter($id)
 {
     $program_id = $id;
     $program = Program::with('courses')->find($program_id);
     $programs = Program::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->get();
     $menu = 'report';
     return View::make('reports.studentperprogram', compact('programs', 'program', 'menu'));
 }
 public function destroy($id)
 {
     $program = Program::with('courses')->find($id);
     if ($program->courses->count() > 0) {
         Session::flash('message', 'Tidak dapat menutup program! Program ini pernah berjalan');
     } else {
         Program::destroy($id);
         Session::flash('message', 'Sukses menutup program!');
         return Redirect::route('programs.index');
     }
 }
Exemple #3
0
 /**
  * 获取节目单HTML字符串
  *
  * @param string $keyword
  * @return string
  */
 private function getProgramsArchiveHtml($keyword = '')
 {
     // query program list, and sort by date
     $programs = Program::with('participants')->enabled()->orderBy('date', 'desc')->get();
     // search
     if ($keyword) {
         $keywords = array_filter(explode(' ', $keyword));
         foreach ($keywords as $keyword) {
             $participantIds = Participant::searched($keyword)->lists('id');
             $programIds = ProgramParticipant::whereIn('participant_id', $participantIds)->lists('program_id')->flip()->toArray();
             foreach ($programs as $i => $program) {
                 if (false === strpos(strtolower($program->topic), $keyword) and empty($programIds[$program->id])) {
                     unset($programs[$i]);
                 }
             }
         }
     }
     // collect
     $list = [];
     foreach ($programs as $program) {
         $list[$program->dates->year][$program->dates->month][] = $program;
     }
     // render page
     return (string) View::make('program.index.archive')->with('list', $list);
 }