Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
12345 anikendra 1
<?php
2
/**
3
 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
4
 * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
5
 *
6
 * Licensed under The MIT License
7
 * Redistributions of files must retain the above copyright notice.
8
 *
9
 * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
10
 * @link          http://cakephp.org CakePHP(tm) Project
11
 * @since         DebugKit 0.1
12
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
13
 */
14
 
15
App::uses('ToolbarHelper', 'DebugKit.View/Helper');
16
App::uses('FireCake', 'DebugKit.Lib');
17
 
18
/**
19
 * FirePHP Toolbar Helper
20
 *
21
 * Injects the toolbar elements into non-HTML layouts via FireCake.
22
 *
23
 */
24
class FirePhpToolbarHelper extends ToolbarHelper {
25
 
26
/**
27
 * settings property
28
 *
29
 * @var array
30
 */
31
	public $settings = array('format' => 'firePHP', 'forceEnable' => false);
32
 
33
/**
34
 * send method
35
 *
36
 * @return void
37
 */
38
	public function send() {
39
		$view = $this->_View;
40
		$view->element('debug_toolbar', array('disableTimer' => true), array('plugin' => 'DebugKit'));
41
	}
42
 
43
/**
44
 * makeNeatArray.
45
 *
46
 * wraps FireCake::dump() allowing panel elements to continue functioning
47
 *
48
 * @param string $values
49
 * @return void
50
 */
51
	public function makeNeatArray($values) {
52
		FireCake::info($values);
53
	}
54
 
55
/**
56
 * Create a simple message
57
 *
58
 * @param string $label Label of message
59
 * @param string $message Message content
60
 * @return void
61
 */
62
	public function message($label, $message) {
63
		FireCake::log($message, $label);
64
	}
65
 
66
/**
67
 * Generate a table with FireCake
68
 *
69
 * @param array $rows Rows to print
70
 * @param array $headers Headers for table
71
 * @param array $options Additional options and params
72
 * @return void
73
 */
74
	public function table($rows, $headers, $options = array()) {
75
		$title = $headers[0];
76
		if (isset($options['title'])) {
77
			$title = $options['title'];
78
		}
79
		foreach ($rows as $i => $row) {
80
			$rows[$i] = array_values($row);
81
		}
82
		array_unshift($rows, $headers);
83
		FireCake::table($title, $rows);
84
	}
85
 
86
/**
87
 * Start a panel which is a 'Group' in FirePHP
88
 *
89
 * @param $title
90
 * @param $anchor
91
 * @return void
92
 */
93
	public function panelStart($title, $anchor) {
94
		FireCake::group($title);
95
	}
96
 
97
/**
98
 * End a panel (Group)
99
 *
100
 * @return void
101
 */
102
	public function panelEnd() {
103
		FireCake::groupEnd();
104
	}
105
 
106
}