1: <?php
2:
3: namespace Sphp\Comp\Html{
4:
5: class Alert extends \Sphp\tools\Component {
6: private $innerErr = true;
7: private $showall = false;
8: // by deafult enable
9: public function fu_setInnerError() {
10: $this->innerErr = true;
11: }
12: // show all errors
13: public function fu_setShowAll() {
14: $this->showall = true;
15: }
16: protected function genhelpPropList() {
17: $this->addHelpPropFunList('setInnerError','Display Inner Error','','');
18: }
19: protected function onrender() {
20: $this->tagName = "span";
21: $stro = "";
22: //<strong class="alert-danger">' . $msg . '</strong>
23: if($this->showall){
24: $msg = traceMsg(true);
25: $emsg = traceError(true);
26: if($this->innerErr) $emsg .= traceErrorInner(true);
27: }else{
28: $msg = getMsg($this->name);
29: $emsg = getErrMsg($this->name);
30: if($this->innerErr) $emsg .= getErrMsgInner($this->name);
31: }
32: if($msg != ""){
33: $stro .= '<strong class="alert alert-info">' . $msg . '</strong>';
34: }
35: if($emsg != ""){
36: $stro .= '<strong class="alert alert-danger">' . $emsg . '</strong>';
37: }
38: $this->setInnerHTML($stro);
39: }
40: }
41: }