Ejemplo n.º 1
0
 public function getDown($id = '')
 {
     if ($id == '') {
         return Redirect::to($this->route);
     } else {
         $section = Sections::find($id);
         $upper = Sections::findByPosition($section->order + 1);
         if ($upper) {
             $section->order = $section->order + 1;
             $section->save();
             $upper->order = $upper->order - 1;
             $upper->save();
             return Redirect::to($this->route)->with('msg_success', Lang::get('messages.sections_update'));
         } else {
             return Redirect::to($this->route)->with('msg_error', Lang::get('messages.sections_display_err'));
         }
         if (!$section) {
             return Redirect::to($this->route)->with('msg_error', Lang::get('messages.sections_display_err'));
         } else {
             return View::make('backend.sections.update', array('section' => $section));
         }
     }
 }
Ejemplo n.º 2
0
 public static function getCourseContent($id, $course, $idContent)
 {
     $contents = self::getOrderedContent($course->coursesections);
     // dd($contents);
     $array = array('course' => $course, 'contents' => $contents);
     if ($idContent != '') {
         $array['section'] = CoursesSection::find($idContent);
         switch ($array['section']->section->type) {
             case 'section':
                 return View::make('frontend.courses.content')->with($array);
                 break;
             case 'teachers':
                 $array['teachers'] = $course->teachers;
                 return View::make('frontend.courses.teachers')->with($array);
                 break;
             case 'promotioners':
                 $array['promotioners'] = $course->promotioners;
                 return View::make('frontend.courses.promotioners')->with($array);
                 break;
             case 'helpers':
                 $array['helpers'] = $course->helpers;
                 return View::make('frontend.courses.helpers')->with($array);
                 break;
             case 'inscriptions':
                 return View::make('frontend.courses.inscription')->with($array);
                 break;
             case 'works':
                 return View::make('frontend.courses.works')->with($array);
                 break;
             case 'supporters':
                 $array['supporters'] = $course->supporters;
                 return View::make('frontend.courses.supporters')->with($array);
                 break;
             default:
                 return View::make('frontend.courses.content')->with($array);
                 break;
         }
     } else {
         $section = Sections::findByPosition(1);
         $array['section'] = $contents[0];
         return View::make('frontend.courses.content')->with($array);
     }
 }