Panel.php 1.39 KB
Newer Older
Qiang Xue committed
1 2 3 4 5 6 7 8 9
<?php
/**
 * @link http://www.yiiframework.com/
 * @copyright Copyright (c) 2008 Yii Software LLC
 * @license http://www.yiiframework.com/license/
 */

namespace yii\debug;

Qiang Xue committed
10
use Yii;
Qiang Xue committed
11 12 13
use yii\base\Component;

/**
Qiang Xue committed
14 15
 * Panel is a base class for debugger panel classes. It defines how data should be collected,
 * what should be displayed at debug toolbar and on debugger details view.
Alexander Makarov committed
16
 *
Qiang Xue committed
17 18 19 20 21
 * @author Qiang Xue <qiang.xue@gmail.com>
 * @since 2.0
 */
class Panel extends Component
{
Qiang Xue committed
22 23
	public $id;
	public $tag;
Qiang Xue committed
24 25 26 27
	/**
	 * @var Module
	 */
	public $module;
Qiang Xue committed
28 29
	public $data;

Alexander Makarov committed
30 31 32
	/**
	 * @return string name of the panel
	 */
Qiang Xue committed
33 34 35 36 37
	public function getName()
	{
		return '';
	}

Alexander Makarov committed
38 39 40
	/**
	 * @return string content that is displayed at debug toolbar
	 */
Qiang Xue committed
41 42 43 44 45
	public function getSummary()
	{
		return '';
	}

Alexander Makarov committed
46 47 48
	/**
	 * @return string content that is displayed in debugger detail view
	 */
Qiang Xue committed
49 50 51 52 53
	public function getDetail()
	{
		return '';
	}

Alexander Makarov committed
54 55 56 57 58 59
	/**
	 * Saves data to be later used in debugger detail view.
	 * This method is called on every page where debugger is enabled.
	 *
	 * @return mixed data to be saved
	 */
Qiang Xue committed
60 61 62 63 64 65 66 67 68
	public function save()
	{
		return null;
	}

	public function load($data)
	{
		$this->data = $data;
	}
Qiang Xue committed
69

Alexander Makarov committed
70 71 72
	/**
	 * @return string URL pointing to panel detail view
	 */
Qiang Xue committed
73 74 75 76 77 78 79
	public function getUrl()
	{
		return Yii::$app->getUrlManager()->createUrl($this->module->id . '/default/view', array(
			'panel' => $this->id,
			'tag' => $this->tag,
		));
	}
Qiang Xue committed
80
}