29 $this->_template=include
'templates/tplModal.php';
30 $this->buttons=array ();
33 foreach ( $buttonCaptions as $button ) {
44 public function addButton($value=
"Okay", $style=
"btn-primary") {
45 $btn=
new HtmlButton($this->identifier.
"-".$value);
46 $btn->setStyle($style);
47 $btn->setValue($value);
48 $this->buttons []=$btn;
58 $btn=$this->
addButton($value,
"btn-default");
59 $btn->setProperty(
"data-dismiss",
"modal");
69 $btn=$this->
addButton($value,
"btn-primary");
70 $btn->onClick(
"if(".$this->
getValidCondition().
"){ ".$jsCode.
"$('#".$this->identifier.
"').modal('hide');}");
75 return "$('#".$this->identifier.
"').prop('valid')";
79 $this->validCondition=$js;
83 if ($this->validCondition==NULL) {
91 $this->validCondition=
"1==1";
118 $this->content=$js->
renderContent($initialController, $viewName,$params);
129 public function forward(
JsUtils $js,$initialControllerInstance,$controllerName,$actionName,$params=NULL){
130 $this->content=$js->
forward($initialControllerInstance, $controllerName, $actionName,$params);
138 if($this->content instanceof
BaseHtml){
139 $this->content->run($js);
141 $this->_bsComponent=$js->
bootstrap()->modal(
"#".$this->identifier, array (
142 "show" => $this->showOnStartup
145 $this->_bsComponent->setDraggable(
true);
146 $this->_bsComponent->setBackdrop($this->backdrop);
153 return $this->buttons [$index];
159 $this->showOnStartup=
true;
164 return "$('#{$this->identifier}').modal('show');";
168 return "$('#{$this->identifier}').modal('hide');";
172 return $js->
getDeferred($url,
"#".$this->identifier.
" .modal-body");
176 return "$('#".$this->identifier.
" .modal-title').html('".
$title.
"');";
182 return "$('#".$btn->getIdentifier().
"').hide();";
193 $this->backdrop=
false;
204 $this->backdrop=$value;
forward($initialController, $controller, $action, $params)
Forwards to.
renderContent($initialControllerInstance, $viewName, $params=NULL)
render the content of an existing view : $viewName and set the response to the modal content Used int...
bootstrap(Bootstrap $bootstrap=NULL)
getter or setter of the Twitter Bootstrap variable
Twitter Bootstrap HTML Modal component.
addCancelButton($value="Annuler")
Add a cancel button (dismiss)
setContent($content)
set the content of the modal
renderView(JsUtils $js, $initialController, $viewName, $params=array())
render the content of an existing view : $controller/$action and set the response to the modal conten...
draggable($value=true)
Allow modal to be moved using the mouse, on the dialog title.
setBackdrop($value)
Includes a modal-backdrop element.
setTitle($title)
set the title of the modal
addButton($value="Okay", $style="btn-primary")
Add a button.
__construct($identifier, $title="", $content="", $buttonCaptions=array())
addOkayButton($value="Okay", $jsCode="")
Add an Okay button (close the box only if .valid===true)
getDefaultValidCondition()
forward(JsUtils $js, $initialControllerInstance, $controllerName, $actionName, $params=NULL)
render the content of
jsGetContent(JsUtils $js, $url)
BaseHtml for HTML components.
getElementById($identifier, $elements)
addEventsOnRun(JsUtils $js=NULL)
getDeferred($url, $responseElement="", $parameters=[])
Prepares a Get ajax request for using on an event.