1: <?php
2: /**
3: * $("#model1").modal("hide");
4: * $("#model1").modal("show");
5: */
6: class ModalB extends Sphp\tools\Component{
7: private $url = "";
8: private $btn1 = "";
9:
10: public function fu_showButton($param) {
11: $this->btn1 = $this->getButton($param);
12: }
13: public function fu_getURL($url) {
14: //$this->name.show();
15: $this->url = $url;
16: }
17:
18: protected function onrender(){
19: if($this->url != ""){
20: addHeaderJSFunctionCode('ready',$this->name, "$('#$this->name').on('shown.bs.modal', function () {getAJAX('$this->url',{},true,function(r){"
21: . " }); } );");
22: }
23:
24: $this->tagName = 'div';
25: $this->setPreTag('<div class="modal fade" id="'. $this->name .'" tabindex="-1">
26: <div class="modal-dialog modal-dialog-centered modal-dialog-scrollable">
27: <div class="modal-content">
28: <div class="modal-header">
29: <h5 class="modal-title">'. $this->title .'</h5>
30: <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
31: </div>');
32: $this->class = "modal-body";
33: $this->HTMLID = 'b' . $this->name;
34: $this->HTMLName = 'b' . $this->name;
35: $this->setPostTag('<br/>
36: </div>
37: </div>
38: </div>' . $this->btn1);
39: //addHeaderJSFunctionCode('ready', $this->name, ' window["'. $this->name .'"] = bootstrap.Modal.getOrCreateInstance(document.getElementById("'. $this->name .'")); ',true);
40: addHeaderJSFunctionCode('ready', $this->name, ' window["'. $this->name .'"] = new bootstrap.Modal(document.getElementById("'. $this->name .'")); ',true);
41: }
42: public function getButton($param) {
43: return '<button type="button" class="btn btn-primary" ldata-toggle="modal" ldata-target="#'. $this->name .'" onclick="$(\'#'. $this->name .'\').modal(\'show\')">
44: '. $param .'
45: </button>';
46: }
47:
48: }
49: