当前位置: 首页>>代码示例>>PHP>>正文


PHP Batches::getAllBatchesDatabySeasonId方法代码示例

本文整理汇总了PHP中Batches::getAllBatchesDatabySeasonId方法的典型用法代码示例。如果您正苦于以下问题:PHP Batches::getAllBatchesDatabySeasonId方法的具体用法?PHP Batches::getAllBatchesDatabySeasonId怎么用?PHP Batches::getAllBatchesDatabySeasonId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Batches的用法示例。


在下文中一共展示了Batches::getAllBatchesDatabySeasonId方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: index


//.........这里部分代码省略.........
             $timeString = date('Y-m-d', strtotime($inputs['startDate'])) . $inputs['startTime'];
             $timestamp = strtotime($timeString);
             $startTime24Hours = date('H:i:s', $timestamp);
             $timeString = $endDateYear . '-3-5 ' . $inputs['endTime'];
             $timestamp = strtotime($timeString);
             $endTime24Hours = date('H:i:s', $timestamp);
             $batchSlug = Courses::getBatchID($courseId, $classId, $startDate, null, $inputs['selectSeason']);
             $inputBatch['batchName'] = $batchSlug;
             $inputBatch['classId'] = $classId;
             $inputBatch['courseId'] = $courseId;
             $inputBatch['startDate'] = $startDate->toDateString();
             $inputBatch['endDate'] = $endDate->toDateString();
             $inputBatch['season_id'] = $inputs['selectSeason'];
             $inputBatch['preferredTime'] = $startTime24Hours;
             $inputBatch['preferredEndTime'] = $endTime24Hours;
             $inputBatch['leadInstructor'] = $leadInstructor;
             $inputBatch['alternateInstructor'] = $alternateInstructor;
             $inputBatch['location_id'] = $inputs['seasonLocation'];
             //$inputBatch['classAmount']=$inputs['eachClassAmount'];
             $newBatch = Batches::addBatches($inputBatch);
             /*
             				$days = 1;
             				foreach($daysFound as $monthdays){
             					
             					foreach($monthdays as $dayFound){
             						
             						if($days <= 40){
             						$batchScheduleInput['batchId']      = $newBatch->id;
                             $batchScheduleInput['seasonId']      = $inputs['selectSeason'];
             						$batchScheduleInput['scheduleDate'] = $dayFound;
             						$batchScheduleInput['startTime']    = $startTime24Hours;
             						$batchScheduleInput['endTime']      = $endTime24Hours;
             						$batchScheduleInput['scheduleType']= 'class';
             						BatchSchedule::addSchedule($batchScheduleInput);
             						}
             						
             						$days++;
             					}
             				}
             */
             //calculating dates and adding all the dates to batchschedule for new batch
             $batch_schedule = new BatchSchedule();
             do {
                 $batchScheduleInput['batchId'] = $newBatch->id;
                 $batchScheduleInput['seasonId'] = $inputs['selectSeason'];
                 $batchScheduleInput['scheduleDate'] = $startDate->toDateString();
                 $batchScheduleInput['startTime'] = $startTime24Hours;
                 $batchScheduleInput['endTime'] = $endTime24Hours;
                 $batchScheduleInput['scheduleType'] = 'class';
                 BatchSchedule::addSchedule($batchScheduleInput);
                 $startDate->addDays(7);
             } while ($startDate->eq($endDate) == FALSE);
             //for last date
             $batchScheduleInput['batchId'] = $newBatch->id;
             $batchScheduleInput['seasonId'] = $inputs['selectSeason'];
             $batchScheduleInput['scheduleDate'] = $startDate->toDateString();
             $batchScheduleInput['startTime'] = $startTime24Hours;
             $batchScheduleInput['endTime'] = $endTime24Hours;
             $batchScheduleInput['scheduleType'] = 'class';
             BatchSchedule::addSchedule($batchScheduleInput);
             //check for holidays if exists make
             if (Holidays::where('season_id', '=', $inputs['selectSeason'])->count() > 0) {
                 $holiday_data = Holidays::where('season_id', '=', $inputs['selectSeason'])->select('startdate', 'enddate')->get();
                 for ($i = 0; $i < count($holiday_data); $i++) {
                     DB::table('batch_schedule')->where('batch_id', '=', $newBatch->id)->whereBetween('schedule_date', array($holiday_data[$i]['startdate'], $holiday_data[$i]['enddate']))->update(array('holiday' => 1));
                 }
             }
             Session::flash('msg', "Batch added successfully.");
             return Redirect::to('batches');
         }
         $franchiseeId = Session::get('franchiseId');
         $season_display_data = Seasons::where('franchisee_id', '=', Session::get('franchiseId'))->orderBy('id', 'DESC')->get();
         if (isset($season_display_data[0])) {
             $s_id = $season_display_data[0]['id'];
             $batches = Batches::getAllBatchesDatabySeasonId($franchiseeId, $s_id);
             for ($i = 0; $i < count($batches); $i++) {
                 $batches[$i]['preferred_time'] = date("H:i", strtotime($batches[$i]['preferred_time']));
                 $batches[$i]['preferred_end_time'] = date("H:i", strtotime($batches[$i]['preferred_end_time']));
                 $location_data = Location::where('id', '=', $batches[$i]['location_id'])->get();
                 $batches[$i]['location_name'] = $location_data[0]['location_name'];
                 $batches[$i]['created'] = date("Y-m-d", strtotime($batches[$i]['created_at']));
                 $batches[$i]['day'] = date('l', strtotime($batches[$i]['start_date']));
                 if ($batches[$i]['lead_instructor'] != '') {
                     $user_data = User::find($batches[$i]['lead_instructor']);
                     $batches[$i]['instructor_name'] = $user_data['first_name'] . '' . $user_data['last_name'];
                 } else {
                     $batches[$i]['instructor_name'] = '';
                 }
                 $batches[$i]['count'] = StudentClasses::where('batch_id', '=', $batches[$i]['id'])->count();
             }
         }
         $courseList = Courses::getFranchiseCoursesList($franchiseeId);
         $franchiseeCourses = Courses::getFranchiseCoursesList(Session::get('franchiseId'));
         $Instructors = User::getInstructors();
         $dataToView = array('batches', 'courseList', 'currentPage', 'mainMenu', 'franchiseeCourses', 'mondays', 'Instructors');
         return View::make('pages.batches.batchesfinal', compact($dataToView));
     } else {
         return Redirect::to("/");
     }
 }
开发者ID:Headrun-php,项目名称:TLG,代码行数:101,代码来源:BatchesController.php


注:本文中的Batches::getAllBatchesDatabySeasonId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。