Welcome Guest, Not a member yet? Register   Sign In
controller and view not working correctly
#3

I have redefined some of the above code so it now reads
$data['dates'][$date->id] = array('ctask_id' => $date->cluster_task_id,'item_date' => $date->item_date, 'cluster_tasks' => array());

and print_r($data['dates']); (in the view) gives

Array ( [26] => Array ( [ctask_id] => 217 [item_date] => 2015-06-04 [cluster_tasks] => Array ( ) )
[27] => Array ( [ctask_id] => 218 [item_date] => 2015-06-03 [cluster_tasks] => Array ( ) )
[34] => Array ( [ctask_id] => 218 [item_date] => 2015-06-05 [cluster_tasks] => Array ( ) )
[28] => Array ( [ctask_id] => 219 [item_date] => 2015-06-05 [cluster_tasks] => Array ( ) ) )
so it has passed the $data
so i guess i'm now trying to work out how to recode the following part to put the name into the empty cluster_tasks array to forward to the view - i think that will work?
foreach($items AS $item){
for($count = 0; $count < $cluster_task_id_count[$item->id]; $count++){
so how would i redefine these lines?
$data['dates'][$item->cluster_task_id]['cluster_tasks'][$item->cluster_task_id] = array(
'name' => $item->cluster_task_name
);
so the code will read the first entry in the dates array of 26, see the next portion where the ctask_id is 217 and compare this to the cluster_task table and get the corresponding name and put that into the array so i the end the array will then look like

Array ( [26] => Array ( [ctask_id] => 217 [item_date] => 2015-06-04 [cluster_tasks] => Array (nameA ) )
[27] => Array ( [ctask_id] => 218 [item_date] => 2015-06-03 [cluster_tasks] => Array (nameB ) )
[34] => Array ( [ctask_id] => 218 [item_date] => 2015-06-05 [cluster_tasks] => Array (nameC ) )
[28] => Array ( [ctask_id] => 219 [item_date] => 2015-06-05 [cluster_tasks] => Array (nameD ) ) )

or am I completey off track with my thinking? I think I've been thinkng too much as to how I thought it would work :-)
Reply


Messages In This Thread
RE: controller and view not working correctly - by scoobie - 06-17-2015, 06:34 PM



Theme © iAndrew 2016 - Forum software by © MyBB