本文整理汇总了PHP中Batches::addBatches方法的典型用法代码示例。如果您正苦于以下问题:PHP Batches::addBatches方法的具体用法?PHP Batches::addBatches怎么用?PHP Batches::addBatches使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Batches
的用法示例。
在下文中一共展示了Batches::addBatches方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
//.........这里部分代码省略.........
//Year.'-03-31');
/*
echo "<pre>";
print_r($months);
echo "</pre>";
exit();
*/
$i = 0;
foreach ($months as $month) {
$yearAndMonth = explode('-', $month['month']);
$daysFound[$i] = getDaysFromMonth($yearAndMonth['1'], $yearAndMonth['0'], $day);
$i++;
}
$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);