blob: fdb62aef5f55758b14c0fad85f9e52c14600ff0a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
<?php defined('SYSPATH') OR die('No direct access allowed.');
/**
* Provides a table layout for sections in the Profiler library.
*
* $Id: Profiler_Table.php 4679 2009-11-10 01:45:52Z isaiah $
*
* @package Profiler
* @author Kohana Team
* @copyright (c) 2007-2009 Kohana Team
* @license http://kohanaphp.com/license
*/
class Profiler_Table_Core {
protected $columns = array();
protected $rows = array();
/**
* Get styles for table.
*
* @return string
*/
public function styles()
{
static $styles_output;
if ( ! $styles_output)
{
$styles_output = TRUE;
return file_get_contents(Kohana::find_file('views', 'profiler/table', FALSE, 'css'));
}
return '';
}
/**
* Add column to table.
*
* @param string CSS class
* @param string CSS style
*/
public function add_column($class = '', $style = '')
{
$this->columns[] = array('class' => $class, 'style' => $style);
}
/**
* Add row to table.
*
* @param array data to go in table cells
* @param string CSS class
* @param string CSS style
*/
public function add_row($data, $class = '', $style = '')
{
$this->rows[] = array('data' => $data, 'class' => $class, 'style' => $style);
}
/**
* Render table.
*
* @return string
*/
public function render()
{
$data['rows'] = $this->rows;
$data['columns'] = $this->columns;
return View::factory('profiler/table', $data)->render();
}
}
|