[eluser]Solarpitch[/eluser]
Let me just add to this... its been 4 hours and I could quite possibly be loosing my mind trying to figure this out.
I have confirmed that the sessions are being set correctly as I can print the values of them all over the application. However, when I called this chart function to print the values into the chart, the values print but are messed about.
eg:
CONROLLER...
Code:
function dashboard(){
$this->load->model('report_model');
$this->load->library('session');
$date = '20081209';
//set the hours to get reports
$hours = array(
array ("start" => '14:00:00', "finish" => '15:00:00'),
array ("start" => '15:00:00', "finish" => '16:00:00'),
array ("start" => '16:00:00', "finish" => '17:00:00')
);
//loop through the array and get the TOTAL for each hour
foreach($hours as $e)
{
$start = $e['start']; $finish = $e['finish'];
$hour_total = $this->report_model->hourly_breakdown($date, $start, $finish);
//store the hour start time and total for the hour in session
$this->session->set_userdata($start, $hour_total);
//the above session will hold now have...
//$this->session->userdata('14:00:00', '340');
//$this->session->userdata('15:00:00', '500');
//$this->session->userdata('16:00:00', '200');
}
$this->load->helper('graph');
$url = 'http://www.mysite.ie/enterprise/index.php/charter/show_report/';
$charturl = 'http://www.mysite.ie/enterprise/charts/charts.swf';
$chartlib = 'http://www.mysite.ie/enterprise/charts/charts_library';
$data['chart'] = InsertChart( $charturl, $chartlib, $url ,450,300,'cccccc' ); // passing the chart information to view.
$data['right_box'] = "right_box/dashboard_view";
$this->load->view('template/page_1', $data);
}
//SO IN THE SHOW_REPORT FUNCTION BELOW....THIS IS WHAT HAPPENS
function showsummary()
{
$this->load->helper('graph');
$chart =
"
<chart>
<chart_data>
<row>
<string>14:00</string>
<string>15:00</string>
<string>16:00</string>
</row>
<row>
<string>Region A</string>
<number>".$this->session->userdata('14:00:00')."</number> //THIS WILL PRINT 500
<number>".$this->session->userdata('15:00:00')."</number> //THIS WILL PRINT 500
<number>".$this->session->userdata('16:00:00')."</number> //THIS WILL PRINT Noting
</row>
</chart_data>
</chart>
";
SendChartData ($chart);
}