After a little help here. I m looking to produce some code that will take an incoming array of data, and order the data by time (This I can do easily enough)
我的议席上有22个时段,因此,我需要各行各占22个(阵列中每个项目都具有块状价值),我可以这样做。
我接着正在拿到这种数据阵列,并说,如果从09:00am到3个位置,则需要3个位置(我可以做的),但如果09:00am是当天的第一个项目,则需要先设定1个区块位置,直到它发现阵列中的第1个位置,那么下一个排位数为14个。
i.e. 相反
test1, 2slots, 09:00, room1
test1, 1slot, 12:00, room1
test1, 2slots, 13:00, room1
test1, 4slots, 15:00, room1
10
11
12
13
...
22
我谨表示,
1
2
3
4
test1, 2slots, 09:00, room1, 6
7
8
9
10
test1, 1slot, 12:00, room1, 11
12
test1, 2slots, 13:00, room1, 14
15
16
test1, 4slots, 15:00, room1, 20
21
22
我的职能目前是(这归第一编)。
if(is_array($meetrooms)){
$i = 0;
foreach($meetrooms as $valuer){
$b = $valuer[ num_blocks ];
$i += $b;
?>
<span><?php echo $valuer[ title ] . " " . $valuer[ num_blocks ] . " " . $valuer[ room_name ] . " " . $i . " " . br() ;?></span>
<?php
}
if($i != 22){
while($i <= 22){ ?>
<span><?php echo $i . br() ;?></span>
<?php
$i++;
}
}
}
我的阵列已经减少,但结构已经结构化。
[0] => Array
(
[mr_id] => 3
[title] => test1 meeting
[description] => Some meeting going on here
[staff_id] => 2454
[room_name] => room1
[start_date] => 2012-04-20 00:43:58
[start_time] => 08:00:00
[end_date] => 2012-04-20 00:43:58
[end_time] => 09:00:00
[num_blocks] => 2
)
Any help would be fantastic!!! Need anything else please ask
www.un.org/spanish/ga/president
I m 90%
只有问题才是问题。 如何在休息时间外加固价值?
if(is_array($meetingrooms))
{
$time = date( H:i , strtotime("07:00"));
$i = 1;
foreach($meetingrooms as $valuer)
{
while ($time < $valuer[ start_time ])
{ ?>
<span><?php echo "....." . $time . " " . $i . ".....";?></span>
<?php
$prev = date( H:i , strtotime($time));
$next = strtotime( +30mins , strtotime($prev));
$time = date( H:i , $next);
$i++;
}
$nummins = $valuer[ num_blocks ] * 30 - 30;
$next = strtotime( + . $nummins . mins , strtotime($time));
$time = date( H:i , $next);
$b = $valuer[ num_blocks ];
echo "td" . $valuer[ num_blocks ];
$i = $i + 1;
}
$timetofinish = date( H:i , strtotime("18:00"));
if ($time < $timetofinish)
{
while ($time < $timetofinish)
{
echo "<span>......$time..." . $i . "</span>";
$prev = date( H:i , strtotime($time));
$next = strtotime( +30mins , strtotime($prev));
$time = date( H:i , $next);
$i++;
}
}
}
What it now returns is
.....07:00 1..... .....07:30 2..... .....08:00 3..... td2 .....09:00 5..... .....09:30 6..... .....10:00 7..... .....10:30 8..... td1 .....11:00 10..... .....11:30 11..... .....12:00 12..... td4 .....14:00 14..... .....14:30 15..... .....15:00 16..... td1......15:30...18......16:00...19......16:30...20......17:00...21......17:30...22