Exemplo n.º 1
0
 /**
  * Generate the view for editing a task specified by $id.
  *
  * @param int $id
  * @return view editTaskView
  */
 public function showEditTask($id)
 {
     $schedule = Schedule::findOrFail($id);
     $entries = $schedule->getEntries()->with('getJobType')->GetResults();
     $jobtypes = Jobtype::where('jbtyp_is_archived', '=', '0')->orderBy('jbtyp_title', 'ASC')->get();
     return View::make('editTaskView', compact('schedule', 'jobtypes', 'entries'));
 }
 /**
  * Create all new scheduleEntries with entered information.
  *
  * @return Collection scheduleEntries
  */
 public static function createScheduleEntries()
 {
     $scheduleEntries = new Collection();
     // parsing jobtype entries
     for ($i = 1; $i <= Input::get("counter"); $i++) {
         // skip empty fields
         if (!empty(Input::get("jobType" . $i))) {
             // check if job type exists
             $jobType = Jobtype::where('jbtyp_title', '=', Input::get("jobType" . $i))->where('jbtyp_time_start', '=', Input::get("timeStart" . $i))->where('jbtyp_time_end', '=', Input::get("timeEnd" . $i))->first();
             // If not found - create new jpb type with data provided
             if (is_null($jobType)) {
                 // TITLE
                 $jobType = Jobtype::create(array('jbtyp_title' => Input::get("jobType" . $i)));
                 // TIME START
                 $jobType->jbtyp_time_start = Input::get('timeStart' . $i);
                 // TIME END
                 $jobType->jbtyp_time_end = Input::get('timeEnd' . $i);
                 // STATISTICAL WEIGHT
                 $jobType->jbtyp_statistical_weight = Input::get('jbtyp_statistical_weight' . $i);
                 // NEEDS PREPARATION
                 $jobType->jbtyp_needs_preparation = 'true';
                 // ARCHIVED set to "false"
                 $jobType->jbtyp_is_archived = 'false';
                 $jobType->save();
             }
             $scheduleEntry = new ScheduleEntry();
             $scheduleEntry->jbtyp_id = $jobType->id;
             // save changes
             $scheduleEntries->add(ScheduleController::updateScheduleEntry($scheduleEntry, $jobType->id, $i));
         }
     }
     return $scheduleEntries;
 }
Exemplo n.º 3
0
 /**
  * Generate the view for editing an event specified by $id.
  *
  * @param int $id
  * @return view editClubEventView
  */
 public function showEditEvent($id)
 {
     $event = ClubEvent::findOrFail($id);
     $schedule = $event->getSchedule()->getResults();
     $jobtypes = Jobtype::where('jbtyp_is_archived', '=', '0')->orderBy('jbtyp_title', 'ASC')->get();
     $places = Place::orderBy('plc_title', 'ASC')->lists('plc_title', 'id');
     $templates = Schedule::where('schdl_is_template', '=', '1')->orderBy('schdl_title', 'ASC')->get();
     $template = Schedule::where('id', '=', $schedule->id)->first();
     // put template data into entries
     $entries = $schedule->getEntries()->with('getJobType')->getResults();
     // put name of the active template for further use
     $activeTemplate = $template->schdl_title;
     return View::make('editClubEventView', compact('event', 'schedule', 'places', 'jobtypes', 'templates', 'template', 'entries', 'activeTemplate'));
 }