Created
January 12, 2013 00:00
-
-
Save kallepersson/4515056 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * TmSectionHeader class file. | |
| * @author Kalle Persson <[email protected]> | |
| * @copyright Copyright © Afonso Wilsson 2013 - | |
| * @license http://www.opensource.org/licenses/bsd-license.php New BSD License | |
| * @package tm.widgets | |
| * @since 1.0 | |
| */ | |
| class TmSectionHeader extends CWidget | |
| { | |
| public $label = 'Title'; | |
| public $button = array( | |
| 'type' => '', | |
| 'htmlOptions' => array() | |
| ); | |
| public $encodeLabel = true; | |
| public $htmlOptions = array(); | |
| public function init() | |
| { | |
| /* | |
| if(isset($this->button['htmlOptions'])) { | |
| $this->button['htmlOptions'] = array_merge_recursive($this->pre_button, $this->button['htmlOptions']); | |
| } | |
| */ | |
| if (!isset($this->button['htmlOptions'])) { | |
| $this->button['htmlOptions'] = array('class'=>''); | |
| } | |
| if (!isset($this->button['type'])) { | |
| $this->button['type'] = 'add'; | |
| } | |
| if (!isset($this->button['label'])) { | |
| $this->button['label'] = ''; | |
| } | |
| if (isset($this->htmlOptions['class'])) { | |
| $this->htmlOptions['class'] .= ' section-title'; | |
| } | |
| else { | |
| $this->htmlOptions['class'] = 'section-title'; | |
| } | |
| if(!isset($this->button['htmlOptions']['class'])) { | |
| $this->button['htmlOptions']['class'] = ''; | |
| } | |
| $this->button['htmlOptions']['class'] .= ' header-button-'.$this->button['type']; | |
| if ($this->encodeLabel) { | |
| $this->label = CHtml::encode($this->label); | |
| } | |
| if (isset($this->button['url'])) { | |
| $this->label .= CHtml::link($this->button['label'], $this->button['url'], $this->button['htmlOptions']); | |
| } | |
| echo CHtml::tag('h2', $this->htmlOptions, $this->label); | |
| } | |
| public function run() | |
| { | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment