Not for public use. If you're interested please contact information.systems@ed.ac.uk
Please submit any comments and feed back on the dashboard via this feedback form
$row) { $row = explode('",', $row); foreach ($row as $c => $cell) { $array[$r][$c] = strip_quotes($cell); } } return $array; } function strip_quotes($string) { $stripped = preg_replace('/\r\n|\r|\n/','',$string); $stripped = preg_replace('/"(.*)/','$1',$stripped); $stripped = preg_replace('/(.*)"/','$1',$stripped); return $stripped; } function swapColRow($rowset) { $newrowset = array(); foreach ($rowset as $r => $row) { foreach ($row as $c => $col) { $newrowset[$c][$r] = $col; } } return $newrowset; } $chartload = array(); $fill = $paleChart; $point = $darkChart; foreach (glob($csv_folder.'*.csv') as $filepath) { $id = substr_replace($filepath, '', 0, strlen($csv_folder)); $id = preg_replace('/\.csv/', '', $id); $handle = fopen($filepath, 'r'); $title = strip_quotes(fgets($handle)); $source = strip_quotes(fgets($handle)); $timestamp = strip_quotes(fgets($handle)); $note = strip_quotes(fgets($handle)); $format = preg_replace('/Display as: ([^,]*),*/','$1',strip_quotes(fgets($handle))); $tags = strip_quotes(fgets($handle)); $file = fread($handle, filesize($filepath)); fclose($handle); if (substr($tags,0,6) == "Tags: ") { $tags = explode(", ",substr($tags,6)); } else { $file = $tags . $file; $tags = ""; } $rowset = csv2array($file); if ($format=="Line") { $chartset = swapColRow($rowset); $width=round(count($chartset[0])/6); $height=1.618; } elseif ($format=="Bar") { $chartset = swapColRow($rowset); $width=round(count($chartset[0])*count($chartset)/10); $height=1.618; } elseif ($format=="Pie" || $format=="Doughnut") { $chartset = $rowset; // $width=round(count($chartset)/12); $width = 2; $height=$width; } elseif ($format=="Radar") { $chartset = swapColRow($rowset); $width=round((count($chartset[0])-1)/6); $height=$width; } elseif ($format=="PolarArea") { $chartset = $rowset; $width=round(count($chartset)/6); $height=$width; } elseif ($format =="Table") { $width_header = round(strlen(implode(" ",$rowset[0]))/15); // where the CSS defines .width-1 as 15em $width_row1 = round(strlen(implode(" ",$rowset[1]))/15); // where the CSS defines .width-1 as 15em $width = max($width_header,$width_row1); $height = 1; } elseif ($format =="Wordle") { $chartset = $rowset; $width = round(count($chartset)/4); $height=$width*.7; } elseif ($format == "NumberBox"){ $chartset = $rowset; $width = "3"; $height = $width; } else { $format = "None"; } if ($width>5) $width=5; if ($width<1) $width=1; /* START "If it's displayable, create a div for it" */ if ($format && $format!="None") { ?>