I’m working on a cgridview with, atm this:
$this->widget('zii.widgets.grid.CGridView',
array( 'id'=>'standaard-verlofuren',
'dataProvider'=>$model->search(),
'columns'=>array(
'week',
'some value',
'some description',
),
));
which shows me:
week 1 | 15 | description
week 12 | 4 | description
week 13 | 7 | description
etc.
i can get these values for every single employee and list the data in the cgridview
Now i want to have the following columns added while being matched with the weeks that are in the db:
week 1 | first date of the week | 15 | description
week 2 | first date of the week | |
week 3 | first date of the week | |
week 4 | first date of the week | |
week 5 | first date of the week | |
week 6 | first date of the week | |
week 7 | first date of the week | |
week 8 | first date of the week | |
week 9 | first date of the week | |
week 10 | first date of the week | |
week 11 | first date of the week | |
week 12 | first date of the week | 4 | description
week 13 | first date of the week | 7 | description
etc.
i’ve got the array to summon all the weeks of the year and the dates:
function StartOfWeek($year, $week) {
$Jan1 = mktime(1,1,1,1,1,$year);
$MondayOffset = (11-date('w',$Jan1))%7-3;
$desiredMonday = strtotime(($week-1) . ' weeks '.$MondayOffset.' days', $Jan1);
return $desiredMonday;
}
for($week = 1; $week<=52; $week++)
$weeks[] = date("Y m d",StartOfWeek(2012, $week));
how can i put these two columns in the cgridview and match them with the weeks in de db?
Thanks in advance.