function print_graph($players, $graphs, $days, $name) { echo 'var data_' . $name . ' = {' . "\n"; echo ' labels: [' . implode(', ', $days) . '],' . "\n"; echo ' datasets: [' . "\n"; print_data($players, $name); echo ' ]' . "\n"; echo '};' . "\n"; echo "\n"; echo 'var ctx_' . $name . ' = document.getElementById("chart_' . $name . '").getContext("2d");' . "\n"; echo 'new Chart(ctx_' . $name . ').Line(data_' . $name . ', {' . "\n"; if ($name == 'ranks') { echo ' scaleLabel : "<%=-value%>",' . "\n"; } else { $graphs[$name]['min'] -= YAXIS_ALIGN - 1; $graphs[$name]['max'] += YAXIS_ALIGN - 1; $graphs[$name]['min'] -= $graphs[$name]['min'] % YAXIS_ALIGN; $graphs[$name]['max'] -= $graphs[$name]['max'] % YAXIS_ALIGN; $graphs[$name]['step'] = round(($graphs[$name]['max'] - $graphs[$name]['min']) / YAXIS_STEPS); if ($graphs[$name]['step'] > $graphs[$name]['step'] % YAXIS_ALIGN) { $graphs[$name]['step'] -= $graphs[$name]['step'] % YAXIS_ALIGN; } $steps = ($graphs[$name]['max'] - $graphs[$name]['min']) / $graphs[$name]['step']; echo ' scaleOverride : true,' . "\n"; echo ' scaleSteps : ' . $steps . ',' . "\n"; echo ' scaleStepWidth : ' . $graphs[$name]['step'] . ',' . "\n"; echo ' scaleStartValue : ' . $graphs[$name]['min'] . "\n"; } echo '});' . "\n"; echo "\n"; }
protected function generate_acl_db() { $controllers = array(); $this->load->helper('file'); // Scan files in the /application/controllers directory // Set the second param to TRUE or remove it if you // don't have controllers in sub directories $files = get_dir_file_info(APPPATH . 'controllers'); // Loop through file names removing .php extension foreach ($files as $file) { $controller = array('name' => $file['name'], 'path' => $file['server_path'], 'parent_id' => 0); if ($file['name'] != 'admin') { $methods = get_class_methods(str_replace('.php', '', $file['name'])); } if ($file['name'] == 'admin') { $admin_files = get_dir_file_info(APPPATH . 'controllers/admin'); print_data($admin_files); exit; } } }
<?php include 'important.php'; //write the importance data to file //get_words_weight(0, 0); print_data();