Base for a static organization website

FirePhpToolbarHelper.php 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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. App::uses('ToolbarHelper', 'DebugKit.View/Helper');
  15. App::uses('FireCake', 'DebugKit.Lib');
  16. /**
  17. * FirePHP Toolbar Helper
  18. *
  19. * Injects the toolbar elements into non-HTML layouts via FireCake.
  20. *
  21. */
  22. class FirePhpToolbarHelper extends ToolbarHelper {
  23. /**
  24. * settings property
  25. *
  26. * @var array
  27. */
  28. public $settings = array('format' => 'firePHP', 'forceEnable' => false);
  29. /**
  30. * send method
  31. *
  32. * @return void
  33. */
  34. public function send() {
  35. $view = $this->_View;
  36. $view->element('debug_toolbar', array('disableTimer' => true), array('plugin' => 'DebugKit'));
  37. }
  38. /**
  39. * makeNeatArray.
  40. *
  41. * wraps FireCake::dump() allowing panel elements to continue functioning
  42. *
  43. * @param string $values
  44. * @return void
  45. */
  46. public function makeNeatArray($values) {
  47. FireCake::info($values);
  48. }
  49. /**
  50. * Create a simple message
  51. *
  52. * @param string $label Label of message
  53. * @param string $message Message content
  54. * @return void
  55. */
  56. public function message($label, $message) {
  57. FireCake::log($message, $label);
  58. }
  59. /**
  60. * Generate a table with FireCake
  61. *
  62. * @param array $rows Rows to print
  63. * @param array $headers Headers for table
  64. * @param array $options Additional options and params
  65. * @return void
  66. */
  67. public function table($rows, $headers, $options = array()) {
  68. $title = $headers[0];
  69. if (isset($options['title'])) {
  70. $title = $options['title'];
  71. }
  72. foreach ($rows as $i => $row) {
  73. $rows[$i] = array_values($row);
  74. }
  75. array_unshift($rows, $headers);
  76. FireCake::table($title, $rows);
  77. }
  78. /**
  79. * Start a panel which is a 'Group' in FirePHP
  80. *
  81. * @param $title
  82. * @param $anchor
  83. * @return void
  84. */
  85. public function panelStart($title, $anchor) {
  86. FireCake::group($title);
  87. }
  88. /**
  89. * End a panel (Group)
  90. *
  91. * @return void
  92. */
  93. public function panelEnd() {
  94. FireCake::groupEnd();
  95. }
  96. }