Merge branch 'maint/7.0'
[ninja.git] / system / libraries / Profiler_Table.php
blob77800ad4f1639c9e72088c17a3d404f06553655f
1 <?php defined('SYSPATH') OR die('No direct access allowed.');
2 /**
3 * Provides a table layout for sections in the Profiler library.
5 * $Id$
7 * @package Profiler
8 * @author Kohana Team
9 * @copyright (c) 2007-2008 Kohana Team
10 * @license http://kohanaphp.com/license.html
12 class Profiler_Table {
14 protected $columns = array();
15 protected $rows = array();
17 /**
18 * Get styles for table.
20 * @return string
22 public function styles()
24 static $styles_output;
26 if ( ! $styles_output)
28 $styles_output = TRUE;
29 return file_get_contents(Kohana::find_file('views', 'kohana_profiler_table', FALSE, 'css'));
32 return '';
35 /**
36 * Add column to table.
38 * @param string CSS class
39 * @param string CSS style
41 public function add_column($class = '', $style = '')
43 $this->columns[] = array('class' => $class, 'style' => $style);
46 /**
47 * Add row to table.
49 * @param array data to go in table cells
50 * @param string CSS class
51 * @param string CSS style
53 public function add_row($data, $class = '', $style = '')
55 $this->rows[] = array('data' => $data, 'class' => $class, 'style' => $style);
58 /**
59 * Render table.
61 * @return string
63 public function render()
65 $data['rows'] = $this->rows;
66 $data['columns'] = $this->columns;
67 return View::factory('kohana_profiler_table', $data)->render();