Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <?php
  2. /**
  3. * @link http://www.yiiframework.com/
  4. * @copyright Copyright (c) 2008 Yii Software LLC
  5. * @license http://www.yiiframework.com/license/
  6. */
  7. namespace yii\debug;
  8. use Yii;
  9. use yii\base\Component;
  10. use yii\helpers\Url;
  11. /**
  12. * Panel is a base class for debugger panel classes. It defines how data should be collected,
  13. * what should be displayed at debug toolbar and on debugger details view.
  14. *
  15. * @property string $detail Content that is displayed in debugger detail view. This property is read-only.
  16. * @property string $name Name of the panel. This property is read-only.
  17. * @property string $summary Content that is displayed at debug toolbar. This property is read-only.
  18. * @property string $url URL pointing to panel detail view. This property is read-only.
  19. *
  20. * @author Qiang Xue <qiang.xue@gmail.com>
  21. * @since 2.0
  22. */
  23. class Panel extends Component
  24. {
  25. /**
  26. * @var string panel unique identifier.
  27. * It is set automatically by the container module.
  28. */
  29. public $id;
  30. /**
  31. * @var string request data set identifier.
  32. */
  33. public $tag;
  34. /**
  35. * @var Module
  36. */
  37. public $module;
  38. /**
  39. * @var mixed data associated with panel
  40. */
  41. public $data;
  42. /**
  43. * @var array array of actions to add to the debug modules default controller.
  44. * This array will be merged with all other panels actions property.
  45. * See [[\yii\base\Controller::actions()]] for the format.
  46. */
  47. public $actions = [];
  48. /**
  49. * @return string name of the panel
  50. */
  51. public function getName()
  52. {
  53. return '';
  54. }
  55. /**
  56. * @return string content that is displayed at debug toolbar
  57. */
  58. public function getSummary()
  59. {
  60. return '';
  61. }
  62. /**
  63. * @return string content that is displayed in debugger detail view
  64. */
  65. public function getDetail()
  66. {
  67. return '';
  68. }
  69. /**
  70. * Saves data to be later used in debugger detail view.
  71. * This method is called on every page where debugger is enabled.
  72. *
  73. * @return mixed data to be saved
  74. */
  75. public function save()
  76. {
  77. return null;
  78. }
  79. /**
  80. * Loads data into the panel
  81. *
  82. * @param mixed $data
  83. */
  84. public function load($data)
  85. {
  86. $this->data = $data;
  87. }
  88. /**
  89. * @return string URL pointing to panel detail view
  90. */
  91. public function getUrl()
  92. {
  93. return Url::toRoute(['/' . $this->module->id . '/default/view',
  94. 'panel' => $this->id,
  95. 'tag' => $this->tag,
  96. ]);
  97. }
  98. }