function build_filter_link($filter, $label) { $params = get_spark_params(); $class = ''; if (isset($params['filter']) and $filter == $params['filter']) { $class = 'active'; } else { if (!isset($params['filter']) and $filter == 'all') { $class = 'active'; } } $params['filter'] = $filter; $url = build_spark_url($params, TRUE); return "<a href=\"{$url}\" class=\"{$class}\">{$label}</a>"; }
public function get_file($log_file) { $path = APPPATH . 'logs/' . $log_file; if (file_exists($path)) { $this->split_files($path); $config = $this->CI->config->item('fire_log_pagination_settings'); $config['base_url'] = build_spark_url($this->url_vals); $config['total_rows'] = count($this->pages); $config['uri_segment'] = $this->CI->uri->total_segments(); // this is hardcoded so it doesnt get overode from config $config['per_page'] = 1; $this->CI->pagination->initialize($config); $cur_page = $this->CI->uri->segment($config['uri_segment']); if (!is_array($cur_page)) { $cur_page = intval($cur_page); } else { $cur_page = 0; } //trace( $cur_page, TRUE ); if (isset($this->pages[$cur_page])) { $data = $this->pages[$cur_page]; } else { $data = $this->CI->lang->line('fire_log_no_results_found'); } $data = ltrim($data, "\n"); $data = ltrim($data, "\n"); $data = str_replace('DEBUG', '<div class="debug">DEBUG', $data); $data = str_replace('ERROR', '<div class="error">ERROR', $data); $data = str_replace('INFO', '<div class="info">INFO', $data); $data = str_replace("<div", "</div><div", $data); // $data = ltrim( $data, '<div class="logContainer"></div>' ); $data = substr($data, 6); } else { $msg = $this->CI->lang->line('fire_log_not_found'); $msg = str_replace('%log_file%', $this->log_file, $msg); $data = $msg; } return $data; }
<?php foreach ($list as $file) { echo build_log_link($file, $log_file_name); } ?> </div> <div class="container"> <div id="filterBar"> <?php echo build_filter_link('all', 'SHOW ALL'); echo build_filter_link('error', 'ERRORS'); echo build_filter_link('info', 'INFO'); echo build_filter_link('debug', 'DEBUG'); ?> <a href="<?php echo build_spark_url(array('delete' => $log_file_name), TRUE); ?> " onclick="return confirm('Are You Sure?');" class="deleteFile" >DELETE CURRENT FILE</a> </div> <?php echo str_replace(" ", '', $pagination_links); ?> <div class="logContainer"><?php echo $log_contents; ?> </div> <?php echo str_replace(" ", '', $pagination_links); ?> </div>