MIOLO20
Carregando...
Procurando...
Nenhuma entrada encontrada
boxcontrols.class
Ir para a documentação deste ficheiro.
1<?php
2
6class MBoxTitle extends MDiv
7{
8 protected $icon;
9 protected $close;
10 protected $help;
11 protected $minimize;
12 protected $move;
13 protected $MIOLO;
14
18 public function __construct( $cssClass, $caption, $close = '', $icon = '', $help = NULL, $showHelp=true, $showMinimize=true, $showClose=true )
19 {
20 $this->MIOLO = MIOLO::getInstance();
21
22 parent::__construct( '', $cssClass );
23
24 $this->close = $close;
25
26 if ( MUtil::getBooleanValue($showHelp) &&
27 MUtil::getBooleanValue( $this->MIOLO->getConf('theme.options.help') )
28 )
29 {
30 $this->help = $help;
31 }
32 else
33 {
34 $this->help = '';
35 }
36
37 if ( MUtil::getBooleanValue($showMinimize) &&
38 MUtil::getBooleanValue( $this->MIOLO->getConf('theme.options.minimize') )
39 )
40 {
41 $this->minimize = true;
42 }
43 else
44 {
45 $this->minimize = false;
46 }
47
48 $this->move = MUtil::getBooleanValue( $this->MIOLO->getConf('theme.options.move') );
49
50 $this->icon = $icon;
51 $this->setCaption( $caption );
52 }
53
57 public function setIcon( $icon )
58 {
59 $this->icon = $icon;
60 }
61
65 public function setClose( $action )
66 {
67 $this->close = $action;
68 }
69
73 public function setHelp( $help, $module=null, $action=null )
74 {
75 $this->help = $help;
76 }
77
81 public function generateInner()
82 {
83 //$title = str_replace( ' ', '&nbsp;', $this->caption ) . "&nbsp;&nbsp;";
86
87 if ( $this->icon == '' )
88 {
89 $title = '&nbsp;&nbsp;' . $title;
90 $icon = NULL;
91 }
92 else
93 {
94 $icon = new MSpan( '', new MImage('', '', $this->icon ), 'icon' );
95 }
96
97 $caption = new MSpan( '', $title, 'caption' );
98 $help = $close = $minimize = '';
99
100
101 if ( $this->help != '' &&
102 MUtil::getBooleanValue( $this->MIOLO->getConf('theme.options.help') ) )
103 {
104 $linkWiki = new MImageLink('wikiHelp', _M("Ajuda"), $this->help, $MIOLO->getUI()->getImageTheme(MIOLO::getInstance()->getConf('theme.main'), 'about_free.png'));
105 $linkWiki->setTooltip("Ajuda");
106 $linkWiki->target = '_new';
107 $help = new MSpan( '', $linkWiki, 'button' );
108 $help->addAttribute('style', 'float: right');
109 }
110
111 if ( $this->close != '' &&
112 MUtil::getBooleanValue( $this->MIOLO->getConf('theme.options.close') ) )
113 {
114 if ( strpos( $this->close, 'javascript') === false)
115 {
116 if ($this->minimize )
117 {
118 $minimize = new MSpan( '', new MButtonMinimize( '' ), 'button' );
119 $minimize->addAttribute('style', 'float: right');
120 }
121 }
122
123 $close = new MSpan( '', new MButtonClose( $this->close ), 'button' );
124 $close->addAttribute('style', 'float: right');
125 }
126 elseif ($this->minimize )
127 {
128 $minimize = new MSpan( '', new MButtonMinimize( '' ), 'button' );
129 }
130
131 $spacer = new MSpacer();
132
133 if ( $this->getBoxClass() == '' )
134 {
135 $this->setBoxClass( 'm-box-title panel-heading card-header' );
136 $box = $this->getBox( );
137
138 if ( $this->move )
139 {
140 $box->addAttribute('title', _M('Double click to hide') . " - " . _M('Click and drag to move') . " - " . _M('Right click to minimize') );
141 $box->addAttribute('onMouseDown', 'return MIOLO_moveBox(event, this.parentNode, true )');
142 $box->addAttribute('onMouseUp' , 'MIOLO_moveBox(event, this.parentNode, false)');
143 $box->addAttribute('onDblClick' , 'MIOLO_hideBoxContent(this.parentNode)');
144 }
145 }
146
147 $this->inner = array( $icon, $caption, $close, $minimize, $help );
148 }
149}
150
151
155class MBox extends MDiv
156{
157 public $boxTitle;
158 protected $boxInner;
159 protected $cssClassType;
160
170 public function __construct( $caption = NULL, $close = '', $icon = '', $help = '', $showHelp=true, $showMinimize=true, $showClose=true, $cssClassType = "panel-default")
171 {
172 parent::__construct();
173 $this->cssClassType = $cssClassType;
174 $this->boxTitle = new MBoxTitle( 'boxTitle', $caption, $close, $icon, $help, $showHelp, $showMinimize, $showClose );
175 $this->setBoxClass("m-box-box");
176 }
177
181 public function setClose( $close )
182 {
183 if ( $this->boxTitle InstanceOf MBoxTitle )
184 {
185 $this->boxTitle->setClose( $close );
186 }
187 }
188
192 public function setHelp( $help )
193 {
194 if ( $this->boxTitle InstanceOf MBoxTitle )
195 {
196 $this->boxTitle->setHelp( $help );
197 }
198 }
199
203 public function setCaption( $caption )
204 {
205 if ( is_null( $caption ) )
206 {
207 $this->boxTitle = NULL;
208 }
209 elseif ( $this->boxTitle InstanceOf MBoxTitle )
210 {
211 $this->boxTitle->setCaption( $caption );
212 }
213 }
214
218 public function generateInner()
219 {
220 $this->insertControl( $this->boxTitle );
221 $class = $this->getBoxClass();
222
223 $attributes = $this->getAttributes();
224
225 $this->inner = new MDiv( NULL, $this->getControls(), "m-box-box panel card {$this->cssClassType}" );
226 $this->setBoxClass( str_replace( 'm-box-box', 'm-box-outer', $class ), false );
228 }
229
230 public function getCssClassType()
231 {
232 return $this->cssClassType;
233 }
234
236 {
237 $this->cssClassType = $cssClassType;
238 }
239}
240?>
setClose( $action)
setHelp( $help, $module=null, $action=null)
__construct( $cssClass, $caption, $close='', $icon='', $help=NULL, $showHelp=true, $showMinimize=true, $showClose=true)
setIcon( $icon)
setCaption( $caption)
__construct( $caption=NULL, $close='', $icon='', $help='', $showHelp=true, $showMinimize=true, $showClose=true, $cssClassType="panel-default")
generateInner()
setCssClassType($cssClassType)
setHelp( $help)
getCssClassType()
setClose( $close)
setBoxAttributes($attr)
Definição mcontrol.class:809
insertControl($control, $pos=0, $width=null, $float=null)
Definição mcontrol.class:657
setCaption($caption)
Definição mcontrol.class:593
setBoxClass( $cssClass, $add=true)
Definição mcontrol.class:797
getAttributes( $mergeDuplicates=false)
Definição mcontrol.class:509
getConf($key)
Definição miolo.class:548
static getInstance()
Definição miolo.class:134
static getBooleanValue($value)
Definição mutil.class:100
$action
Definição base.php:4
$title
Definição base.php:3