Overview

Namespaces

  • Cakestrap
    • View
      • Helper

Classes

  • Cakestrap\View\Helper\AlertHelper
  • Cakestrap\View\Helper\AssetHelper
  • Cakestrap\View\Helper\BadgeHelper
  • Cakestrap\View\Helper\Basic
  • Cakestrap\View\Helper\ButtonItemsHelper
  • Cakestrap\View\Helper\CakestrapHelper
  • Cakestrap\View\Helper\CallOutHelper
  • Cakestrap\View\Helper\CollapseHelper
  • Cakestrap\View\Helper\DropdownHelper
  • Cakestrap\View\Helper\ListGroupHelper
  • Cakestrap\View\Helper\ModalHelper
  • Cakestrap\View\Helper\PanelHelper
  • Cakestrap\View\Helper\TabHelper
  • Cakestrap\View\Helper\TableHelper
  • Cakestrap\View\Helper\Templates
  • Cakestrap\View\Helper\WellHelper
  • Overview
  • Namespace
  • Class
  1: <?php
  2: /**
  3:  * Copyright (c) CMNWorks
  4:  *
  5:  * Licensed under The MIT License
  6:  * For full copyright and license information, please see the LICENSE.txt
  7:  * Redistributions of files must retain the above copyright notice.
  8:  *
  9:  * @copyright     Copyright (c) CMNWorks Christopher M. Natan
 10:  * @author        Christopher M. Natan
 11:  * @link          http://cmnworks.com
 12:  * @since         1.8.8
 13:  * @license       http://www.opensource.org/licenses/mit-license.php MIT License
 14:  */
 15: namespace Cakestrap\View\Helper;
 16: 
 17: /**
 18:  * While not always necessary, sometimes you need to put your
 19:  * DOM in a box. For those situations, try the panel component.
 20:  *
 21:  * <code>
 22:  * <?php
 23:  * echo $this->Cakestrap->Panel()->header(string $header)
 24:  *                               ->body(stringOrArray $body)
 25:  *                               ->footer(string $footer)
 26:  *                               ->set();
 27:  * ?>
 28:  * </code>
 29:  *
 30:  * @method header(string $header)
 31:  * @method body(arrayOrstring $body)
 32:  * @method footer(string $footer)
 33:  *
 34:  * @package Cakestrap\View\Helper
 35:  * @link http://getbootstrap.com/javascript/#modals
 36:  */
 37: 
 38: class PanelHelper extends Basic
 39: {
 40:     /**
 41:      * Additional options for this helper
 42:      *
 43:      * @var array
 44:      */
 45:     protected $_options   = [
 46:         'type' => 'panel-default'
 47:     ];
 48: 
 49:     /**
 50:      * Set all the defined values.
 51:      * This will return the final html template.
 52:      *
 53:      * @return string
 54:      */
 55:     public function set()
 56:     {
 57:         $this->_setHeader();
 58:         $this->_setBody();
 59:         $this->_setFooter();
 60: 
 61:         $this->_addToContainer();
 62:         return $this->_container;
 63:     }
 64: 
 65:     /**
 66:      * Add the  panel html template to parent container.
 67:      *
 68:      * @return void
 69:      */
 70:     protected function _addToContainer()
 71:     {
 72:         $contents = $this->_contents();
 73:         $this->_container = $this->_stringTemplate->format('container', [
 74:             'container' => $contents, 'type' => $this->_options['type']
 75:         ]);
 76:     }
 77: 
 78:     /**
 79:      * Set the panel header
 80:      *
 81:      * @return void
 82:      */
 83:     protected function _setHeader()
 84:     {
 85:         $this->_contents[] = $this->_stringTemplate->format('header', ['header'=>$this->header]);
 86:     }
 87: 
 88:     /**
 89:      * Set the panel body
 90:      *
 91:      * @return void
 92:      */
 93:     protected function _setBody()
 94:     {
 95:         $this->_contents[] = $this->_stringTemplate->format('body',   ['body'=>$this->body]);
 96:     }
 97: 
 98:     /**
 99:      * Set the panel footer
100:      *
101:      * @return void
102:      */
103:     protected function _setFooter()
104:     {
105:         $this->_contents[] = $this->_stringTemplate->format('footer', ['footer'=>$this->footer]);
106:     }
107: 
108:     /**
109:      * Set the panel contents
110:      *
111:      * @return void
112:      */
113:     protected function _contents()
114:     {
115:         $contents  = implode("", $this->_contents);
116:         return $contents;
117:     }
118: }
API documentation generated by ApiGen