在codeigniter中设置时间表 [英] Set time schedule in codeigniter
本文介绍了在codeigniter中设置时间表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个学生列表和一个常用的按钮预约时间表。
当我点击按钮设置每个学生的时间表int db
现在我将开始时间设置为上午9点。
为该表中的所有学生安排20分钟时间间隔的预约。
控制
function appointment_schedule )
{
$ filtered_students = $ this-> home_model-> getFilterStudents();
$ fil_std_count = $ filtered_students-> num_rows();
$ filtered_student_ids = $ this-> home_model-> getFilterStudentsIds();
$ total_time = $ fil_std_count * 20;
if($ total_time <= 240)
{
$ st_time = strtotime(09:00 am);
for($ i = 0; $ i <$ fil_std_count; $ i ++)
{
$ end_time = date(H:i:sa,strtotime('+ 20 minutes' $ st_time));
$ filtered_students = $ this-> home_model-> insert_appointment_schedule(date(H:i:s a,($ st_time)),$ end_time,$ filtered_student_ids [$ i] - > applicant_id);
$ st_time = strtotime($ end_time);
}
}
if($ total_time> 240& $ total_time< = 360)
{
$ st_time = strtotime );
for($ i = 13; $ i <$ fil_std_count; $ i ++)
{
$ end_time = date(H:i:sa,strtotime('+ 20 minutes' $ st_time));
$ filtered_students = $ this-> home_model-> insert_appointment_schedule(date(H:i:s a,($ st_time)),$ end_time,$ filtered_student_ids [$ i] - > applicant_id);
$ st_time = strtotime($ end_time);
}
}
redirect(base_url()。'home / get_filtered_students','refresh');
}
解决方案
try
与此 $ st_time = strtotime(09:00 am);
替换循环,
$ st_time = strtotime(09:00);
for($ i = 0; $ i< $ fil_std_count; $ i ++)
{
$ st_time = $ st_time;
$ end_time = date(H:i:s a,strtotime('+ 20 minutes',$ st_time));
$ filtered_students = $ this-> home_model-> insert_appointment_schedule(date(H:i:s a,($ st_time)),$ end_time);
$ st_time = strtotime($ end_time);
}
所以结束时间将有 +20分钟
到当前值
$ st_time
I have a list of students and a common button Appointment Schedule.
When i click the button set the time schedule for each student is inserted int db
Now i set start time as 9 am .
schedule appointment for all students in that table with 20 min time gap.
controller
function appointment_schedule()
{
$filtered_students = $this->home_model->getFilterStudents();
$fil_std_count=$filtered_students->num_rows();
$filtered_student_ids = $this->home_model->getFilterStudentsIds();
$total_time=$fil_std_count*20;
if($total_time<=240)
{
$st_time = strtotime("09:00 am");
for($i=0;$i<$fil_std_count;$i++)
{
$end_time = date("H:i:s a", strtotime('+20 minutes', $st_time));
$filtered_students = $this->home_model->insert_appointment_schedule(date("H:i:s a", ($st_time)),$end_time,$filtered_student_ids[$i]->applicant_id);
$st_time = strtotime($end_time);
}
}
if($total_time>240 && $total_time <= 360)
{
$st_time = strtotime("02:00 pm");
for($i=13;$i<$fil_std_count;$i++)
{
$end_time = date("H:i:s a", strtotime('+20 minutes', $st_time));
$filtered_students = $this->home_model->insert_appointment_schedule(date("H:i:s a", ($st_time)), $end_time,$filtered_student_ids[$i]->applicant_id);
$st_time = strtotime($end_time);
}
}
redirect(base_url().'home/get_filtered_students','refresh');
}
But i have a doubt in time assignment..thats wrong
Plzz help
解决方案
try with this
$st_time = strtotime("09:00 am");
replace for loop ,
$st_time = strtotime("09:00");
for($i=0;$i<$fil_std_count;$i++)
{
$st_time=$st_time;
$end_time = date("H:i:s a", strtotime('+20 minutes', $st_time));
$filtered_students = $this->home_model->insert_appointment_schedule(date("H:i:s a", ($st_time)),$end_time);
$st_time = strtotime($end_time);
}
so end time will have +20 Minutes
to current value of $st_time
这篇关于在codeigniter中设置时间表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文