Example #1
0
 public static function module($id = 0)
 {
     $courses_modules = \Pinom\Models\CoursesModules::where('id', '=', $id)->get();
     //echo '<pre>';print_R($courses_modules);die();
     $tmp = null;
     foreach ($courses_modules as $cm) {
         switch ($cm->module()->name) {
             case 'assign':
                 $tmp = \Pinom\Models\Assign::where('id', '=', $cm->instance)->where('course', '=', $cm->course)->first();
                 break;
             case 'page':
                 $tmp = \Pinom\Models\Page::where('id', '=', $cm->instance)->where('course', '=', $cm->course)->first();
                 break;
             case 'resource':
                 $tmp = \Pinom\Models\Resource::where('id', '=', $cm->instance)->where('course', '=', $cm->course)->first();
                 break;
             case 'forum':
                 $tmp = \Pinom\Models\Forum::where('id', '=', $cm->instance)->where('course', '=', $cm->course)->first();
                 break;
             default:
                 $tmp = \DB::table('mdl_' . $cm->module()->name)->where('id', '=', $cm->instance)->where('course', '=', $cm->course)->first();
         }
     }
     //echo '<pre>';print_R($courses_modules);die();
     unset($courses_modules);
     return $tmp;
 }
Example #2
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     //
     $this->html->course = \Pinom\Models\Courses::find($id);
     if (!isset($this->html->course)) {
         return Redirect::to('/');
     }
     $this->html->modules = array();
     $courses_sections = \Pinom\Models\CoursesSections::where('course', '=', $id)->orderBy('section', 'ASC')->get();
     foreach ($courses_sections as $cs) {
         $this->html->modules[$cs->section] = \Pinom\Models\CoursesModules::whereIn('id', explode(',', $cs->sequence))->get();
     }
     return view($this->html->config->theme_folder . '.course-detail')->with('html', $this->html);
 }