|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
*## TbJsonGridColumn class file |
|
4
|
|
|
* |
|
5
|
|
|
* @author: antonio ramirez <[email protected]> |
|
6
|
|
|
* @copyright Copyright © Clevertech 2012- |
|
7
|
|
|
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License |
|
8
|
|
|
*/ |
|
9
|
|
|
|
|
10
|
|
|
Yii::import('booster.widgets.TbDataColumn'); |
|
11
|
|
|
|
|
12
|
|
|
/** |
|
13
|
|
|
*## TbJsonGridColumn class |
|
14
|
|
|
* |
|
15
|
|
|
* This column works specifically with TbJsonGridView. |
|
16
|
|
|
* This is the base class for TbJsonDataColumn |
|
17
|
|
|
* |
|
18
|
|
|
* @property TbJsonGridView $grid |
|
19
|
|
|
* |
|
20
|
|
|
* @package booster.widgets.grids.columns.json |
|
21
|
|
|
*/ |
|
22
|
|
|
class TbJsonGridColumn extends TbDataColumn |
|
23
|
|
|
{ |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* Renders the header cell. |
|
27
|
|
|
*/ |
|
28
|
|
|
public function renderHeaderCell() |
|
29
|
|
|
{ |
|
30
|
|
|
if ($this->grid->json) { |
|
31
|
|
|
$header = array('id' => $this->id); |
|
32
|
|
|
$content = array(); |
|
33
|
|
|
if ($this->grid->enableSorting && $this->sortable && $this->name !== null) { |
|
34
|
|
|
$sort = $this->grid->dataProvider->getSort(); |
|
35
|
|
|
$label = isset($this->header) ? $this->header : $sort->resolveLabel($this->name); |
|
36
|
|
|
|
|
37
|
|
|
if ($sort->resolveAttribute($this->name) !== false) { |
|
38
|
|
|
$label .= '<span class="caret"></span>'; |
|
39
|
|
|
} |
|
40
|
|
|
$content['content'] = $sort->link($this->name, $label, array('class' => 'sort-link')); |
|
41
|
|
|
} else { |
|
42
|
|
|
if ($this->name !== null && $this->header === null) { |
|
43
|
|
|
if ($this->grid->dataProvider instanceof CActiveDataProvider) { |
|
|
|
|
|
|
44
|
|
|
$content['content'] = CHtml::encode( |
|
45
|
|
|
$this->grid->dataProvider->model->getAttributeLabel($this->name) |
|
46
|
|
|
); |
|
47
|
|
|
} else { |
|
48
|
|
|
$content['content'] = CHtml::encode($this->name); |
|
49
|
|
|
} |
|
50
|
|
|
} else { |
|
51
|
|
|
$content['content'] = trim($this->header) !== '' ? $this->header |
|
52
|
|
|
: $this->grid->blankDisplay; |
|
53
|
|
|
} |
|
54
|
|
|
} |
|
55
|
|
|
return CMap::mergeArray($header, $content); |
|
56
|
|
|
} |
|
57
|
|
|
parent::renderHeaderCell(); |
|
58
|
|
|
} |
|
59
|
|
|
} |
|
60
|
|
|
|
This error could be the result of:
1. Missing dependencies
PHP Analyzer uses your
composer.jsonfile (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects thecomposer.jsonto be in the root folder of your repository.Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the
requireorrequire-devsection?2. Missing use statement
PHP does not complain about undefined classes in
ìnstanceofchecks. For example, the following PHP code will work perfectly fine:If you have not tested against this specific condition, such errors might go unnoticed.