| 1 |
<?php |
| 2 |
/** |
| 3 |
* |
| 4 |
*/ |
| 5 |
|
| 6 |
/** |
| 7 |
* |
| 8 |
*/ |
| 9 |
class CJT_Framework_View_Block_Parameter_Grouper_Tab_Tab { |
| 10 |
|
| 11 |
/** |
| 12 |
* put your comment there... |
| 13 |
* |
| 14 |
* @var mixed |
| 15 |
*/ |
| 16 |
protected $params = null; |
| 17 |
|
| 18 |
/** |
| 19 |
* put your comment there... |
| 20 |
* |
| 21 |
* @var mixed |
| 22 |
*/ |
| 23 |
protected $paramsView = array('enqueue' => |
| 24 |
array('scripts' => array(), 'styles' => array()) |
| 25 |
); |
| 26 |
|
| 27 |
/** |
| 28 |
* put your comment there... |
| 29 |
* |
| 30 |
* @param mixed $parameters |
| 31 |
* @return CJT_Framework_View_Block_Parameter_Grouper_Tab |
| 32 |
*/ |
| 33 |
public function __construct($params) { |
| 34 |
// Cache params list reference. |
| 35 |
$this->params = $params; |
| 36 |
// Cache styles and scripts to be enqueued. |
| 37 |
foreach ($this->params as $groupKey => $group) { |
| 38 |
foreach ($group['params'] as $param) { |
| 39 |
$this->paramsView['enqueue']['scripts'] = array_merge($this->paramsView['enqueue']['scripts'], $param->enqueueScripts()); |
| 40 |
$this->paramsView['enqueue']['styles'] = array_merge($this->paramsView['enqueue']['styles'], $param->enqueueStyles()); |
| 41 |
} |
| 42 |
} |
| 43 |
} |
| 44 |
|
| 45 |
/** |
| 46 |
* put your comment there... |
| 47 |
* |
| 48 |
*/ |
| 49 |
public function __toString() { |
| 50 |
ob_start(); |
| 51 |
include 'index.phtml'; |
| 52 |
return ob_get_clean(); |
| 53 |
} |
| 54 |
|
| 55 |
/** |
| 56 |
* put your comment there... |
| 57 |
* |
| 58 |
*/ |
| 59 |
public function enqueueScripts() { |
| 60 |
return array_merge(array( |
| 61 |
'jquery', |
| 62 |
'jquery-ui-tabs' |
| 63 |
), |
| 64 |
$this->paramsView['enqueue']['scripts']); |
| 65 |
} |
| 66 |
|
| 67 |
/** |
| 68 |
* put your comment there... |
| 69 |
* |
| 70 |
*/ |
| 71 |
public function enqueueStyles() { |
| 72 |
return array_merge(array( |
| 73 |
'framework:view:block:parameter:grouper:tab:public:css:tab', |
| 74 |
'framework:css:jquery-ui-1.8.21.custom', |
| 75 |
), |
| 76 |
$this->paramsView['enqueue']['styles']); |
| 77 |
} |
| 78 |
|
| 79 |
/** |
| 80 |
* put your comment there... |
| 81 |
* |
| 82 |
*/ |
| 83 |
public function getParams() { |
| 84 |
return $this->params; |
| 85 |
} |
| 86 |
|
| 87 |
} // End class. |