25 public function addEvent($event, $jsCode, $stopPropagation=
false, $preventDefault=
false) {
26 if ($stopPropagation ===
true) {
29 if ($preventDefault ===
true) {
35 public function trigger($event,$params=
"[]"){
36 $this->
executeOnRun(
'$("#'.$this->identifier.
'").trigger("'.$event.
'",'.$params.
');');
40 return $this->
jsDoJquery(
"trigger",[
"'".$event.
"'",$params]);
49 if (array_key_exists($event, $this->_events)) {
50 if (\is_array($this->_events[$event])) {
51 if(array_search($jsCode, $this->_events[$event])===
false){
52 $this->_events[$event][]=$jsCode;
55 $this->_events[$event]=array ($this->_events[$event],$jsCode );
58 $this->_events[$event]=$jsCode;
70 public function on($event, $jsCode, $stopPropagation=
false, $preventDefault=
false) {
71 return $this->_self->addEvent($event, $jsCode, $stopPropagation, $preventDefault);
74 public function onClick($jsCode, $stopPropagation=
false, $preventDefault=
true) {
75 return $this->
on(
"click", $jsCode, $stopPropagation, $preventDefault);
83 if(isset($this->_events[
"_create"])){
84 $this->_events[
"_create"][]=$jsCode;
86 $this->_events[
"_create"]=[$jsCode];
93 if (isset($this->_bsComponent)) {
94 foreach ( $this->_events as $event => $jsCode ) {
96 if (\is_array($jsCode)) {
98 foreach ( $jsCode as $jsC ) {
100 $code.=
"\n" . $jsC->compile($js);
105 } elseif ($jsCode instanceof
AjaxCall) {
106 $code=$jsCode->compile($js);
108 $this->_bsComponent->addEvent($event, $code);
110 $this->_events=array ();
111 return $this->_bsComponent->getScript();
117 if(isset($this->_events[
"_create"])){
118 $create=$this->_events[
"_create"];
119 if(\is_array($create)){
120 $create=\implode(
"", $create);
122 if(isset($js) && $create!==
"")
123 $js->exec($create,
true);
124 unset($this->_events[
"_create"]);
136 public function _ajaxOn($operation, $event, $url, $responseElement=
"", $parameters=array()) {
137 $params=array (
"url" => $url,
"responseElement" => $responseElement );
138 $params=array_merge($params, $parameters);
152 public function getOn($event, $url, $responseElement=
"", $parameters=array()) {
153 return $this->
_ajaxOn(
"get", $event, $url, $responseElement, $parameters);
164 public function getOnClick($url, $responseElement=
"", $parameters=array()) {
165 return $this->
getOn(
"click", $url, $responseElement, $parameters);
178 public function postOn($event, $url, $params=
"{}", $responseElement=
"", $parameters=array()) {
180 if(isset($parameters[
"params"])){
186 $parameters[
"params"]=\implode(
"+'&'+", $allParameters);
187 return $this->
_ajaxOn(
"post", $event, $url, $responseElement, $parameters);
199 public function postOnClick($url, $params=
"{}", $responseElement=
"", $parameters=array()) {
200 return $this->
postOn(
"click", $url, $params, $responseElement, $parameters);
212 public function postFormOn($event, $url, $form, $responseElement=
"", $parameters=array()) {
213 $parameters[
"form"]=$form;
214 return $this->
_ajaxOn(
"postForm", $event, $url, $responseElement, $parameters);
225 public function postFormOnClick($url, $form, $responseElement=
"", $parameters=array()) {
226 return $this->
postFormOn(
"click", $url, $form, $responseElement, $parameters);
234 return $this->
_addEvent(
"execute", $jsCode);
BaseHtml for HTML components.
getOn($event, $url, $responseElement="", $parameters=array())
Performs a get to $url on the event $event on $element and display it in $responseElement.
postFormOnClick($url, $form, $responseElement="", $parameters=array())
Performs a post form with ajax on click.
_eventsOnCreate(JsUtils $js=NULL)
postOn($event, $url, $params="{}", $responseElement="", $parameters=array())
Performs a post to $url on the event $event on $element and display it in $responseElement.
onClick($jsCode, $stopPropagation=false, $preventDefault=true)
postOnClick($url, $params="{}", $responseElement="", $parameters=array())
Performs a post to $url on the click event on $element and display it in $responseElement.
addEvent($event, $jsCode, $stopPropagation=false, $preventDefault=false)
jsDoJquery($jqueryCall, $param="")
addEventsOnRun(JsUtils $js=NULL)
_ajaxOn($operation, $event, $url, $responseElement="", $parameters=array())
on($event, $jsCode, $stopPropagation=false, $preventDefault=false)
postFormOn($event, $url, $form, $responseElement="", $parameters=array())
Performs a post form with ajax.
getOnClick($url, $responseElement="", $parameters=array())
Performs a get to $url on the click event on $element and display it in $responseElement.
_addEvent($event, $jsCode)
jsTrigger($event, $params="[this]")
trigger($event, $params="[]")
static _correctParams($params, $ajaxParameters=[])
static prep_value($value)
Puts HTML values in quotes for use in jQuery code unless the supplied value contains the Javascript '...