CIF_lib
[ class tree: CIF_lib ] [ index: CIF_lib ] [ all elements ]

Class: LeaveModal

Source Location: /leavemodalfuncs.phtml

Class Overview




Variables

Methods



Class Details

[line 3]


[ Top ]


Class Variables

static $first = true

[line 12]



Tags:

access:  public

Type:   bool


[ Top ]

static $ids = []

[line 8]



Tags:

access:  public

Type:   array


[ Top ]

=

[line 44]



Tags:

access:  protected

Type:   mixed


[ Top ]

=

[line 43]



Tags:

access:  protected

Type:   mixed


[ Top ]

=

[line 47]



Tags:

access:  protected

Type:   mixed


[ Top ]

=

[line 40]



Tags:

access:  protected

Type:   mixed


[ Top ]

$code =

[line 24]



Tags:

access:  protected

Type:   string


[ Top ]

$docid =

[line 28]



Tags:

access:  protected

Type:   integer


[ Top ]

$enabled = false

[line 32]



Tags:

access:  protected

Type:   bool


[ Top ]

$html_modal = '<div class="modal fade ajax_prepared leave-modal" data-backdrop="static" tabindex="-1" role="dialog" id="{{id}}"><div class="modal-dialog modal-dialog-centered" role="document">{{modal_content}}</div></div>'

[line 333]



Tags:

access:  protected

Type:   string


[ Top ]

$html_modal_body = '<div class="modal-body">{{content}}</div>'

[line 353]



Tags:

access:  protected

Type:   string


[ Top ]

$html_modal_content = '<div class="modal-content">{{modal_header}}{{modal_body}}{{modal_footer}}</div>'

[line 338]



Tags:

access:  protected

Type:   string


[ Top ]

$html_modal_footer = '<div class="modal-footer">{{footer_content}}</div>'

[line 358]



Tags:

access:  protected

Type:   string


[ Top ]

$html_modal_header = '<div class="modal-header"><h4 class="modal-title">{{title}}</h4><button type="button" class="close" data-dismiss="modal">&times;</button></div>'

[line 343]



Tags:

access:  protected

Type:   string


[ Top ]

$html_modal_header_notitle = '<div class="modal-header border-bottom-0 pb-0"><button type="button" class="close" data-dismiss="modal">&times;</button></div>'

[line 348]



Tags:

access:  protected

Type:   string


[ Top ]

$id =

[line 16]



Tags:

access:  protected

Type:   string


[ Top ]

$javascript_code = "var mo=new LeaveModal('#{{id}}',{{{options}}});"

[line 363]



Tags:

access:  protected

Type:   string


[ Top ]

$javascript_library = "function LeaveModal(target,options){
            options=options||{};
            var \$target=jQuery(target);
            var handle;
            var enabled=(typeof options.enabled==='boolean')?options.enabled:true;
            var brutal=(typeof options.brutal==='boolean')?options.brutal:false;
            var delay=(typeof options.delay==='number'&& !isNaN(options.delay))?parseInt(options.delay):800;
            var timer=(typeof options.timer==='number'&& !isNaN(options.timer))?parseInt(options.timer):0;
            var init_callback=(typeof options.init_callback==='function')?options.init_callback:function(){};
            var enable_callback=(typeof options.enable_callback==='function')?options.enable_callback:function(){};
            var fire_callback=(typeof options.fire_callback==='function')?options.fire_callback:function(){};
            var disable_callback=(typeof options.disable_callback==='function')?options.disable_callback:function(){};
            var docid=(typeof options.docid==='string')?options.docid:'';
            var cookie_name=(typeof options.cookie_name==='string')?options.cookie_name:'';
            var cookie_expires=(typeof options.cookie_expires==='number'&& !isNaN(options.cookie_expires))?parseInt(options.cookie_expires):30;

            this.Variable=function(name){
              return eval(name);
            };

            this.Enable=function(){
              enabled=true;
              if(cookie_name) jQuery.cookie(cookie_name,null,{ path: '/' });
              enable_callback(this,\$target,handle);
            };

            this.Disable=function(){
              if(brutal) return;
              enabled=false;
              if(cookie_name) jQuery.cookie(cookie_name,'disabled',{expires:cookie_expires, path: '/'});
              disable_callback(this,\$target,handle);
            };

            this.IsEnabled=function(){
              return enabled&&(!cookie_name||jQuery.cookie(cookie_name)!=='disabled')?true:false;
            };

            this.Fire=function(){
              if(!this.IsEnabled()) return;
              if(\$target.hasClass('show')) return;
              \$target.bootstrapModal('show');
              // GA event tracking
              analyticsTrackEvent('leaveModal', 'leaveModalOpen', {docid: docid});
              fire_callback(this,\$target,handle);
//              this.Disable();
            };

            this.InitLeave=function(){
              var _this=this;
              jQuery(document).bind('mouseleave',function(event){
                if(_this.IsEnabled()&&(event.pageY-jQuery(window).scrollTop()<=1)){
                  handle=setTimeout(function(){
                    _this.Fire();
                  },delay);
                }
              });
              jQuery(document).bind('mouseenter',function(event){
                if(handle) clearTimeout(handle);
              });
            };

            this.InitTimer=function(){
              var _this=this;
              if(timer<=0) return;
              setTimeout(function(){
                _this.Fire();
              },timer);
            };
            
            this.InitDisable=function(){
              var _this=this;
              \$target.find('a, button[href]').not('[href=\'#\']').click(function(event){
                _this.Disable();
              });
              \$target.find('form').submit(function(event){
                _this.Disable();
              });
              \$target.find('.close').click(function(event){
                _this.Disable();
              });
            };

            this.Init=function(){
              this.InitLeave();
              this.InitTimer();
              this.InitDisable();
              init_callback(this,\$target,handle);
              // GA Event Tracking
              \$target.find('a, button[href]').each(function(){
                var label=jQuery.trim(jQuery(this).text());
                if (label==''){
                    label=jQuery(this).attr('title');
                }
                jQuery(this).addClass('track-click-event').data('eventCategory', 'leaveModal').data('eventAction', 'leaveModalLinkClick').data('eventLabelText', docid+', '+label);
              });
              activateClickEventTracking(target);
              \$target.find('.close').click(function(event){analyticsTrackEvent('leaveModal', 'leaveModalClose', {docid: docid});});
            }

            this.Init();
          };"

[line 368]



Tags:

access:  protected

Type:   string


[ Top ]

$options = [
      'enabled'=>true

[line 37]



Tags:

access:  protected

Type:   array


[ Top ]

$title =

[line 20]



Tags:

access:  protected

Type:   string


[ Top ]



Class Methods


constructor __construct [line 55]

LeaveModal __construct( [string $id = 'cifLeaveModal'], [array $settings = []])



Tags:

throws:  Exception
access:  public


Parameters:

string   $id  
array   $settings  

[ Top ]

method CompileHtml [line 319]

string CompileHtml( string $template, [array $variables = []])



Tags:

access:  protected


Parameters:

string   $template  
array   $variables  

[ Top ]

method FetchContent [line 102]

string FetchContent( )



Tags:

access:  public


[ Top ]

method GetCode [line 193]

string GetCode( )



Tags:

access:  public


[ Top ]

method GetDocid [line 209]

int GetDocid( )



Tags:

access:  public


[ Top ]

method GetFooter [line 177]

string GetFooter( )



Tags:

access:  public


[ Top ]

method GetId [line 145]

string GetId( )



Tags:

access:  public


[ Top ]

method GetTitle [line 161]

string GetTitle( )



Tags:

access:  public


[ Top ]

method IsAllowed [line 63]

bool IsAllowed( )



Tags:

access:  public


[ Top ]

method isEnabled [line 216]

bool isEnabled( )



Tags:

access:  public


[ Top ]

method ReturnHtml [line 256]

string ReturnHtml( )



Tags:

access:  public


[ Top ]

method SetCode [line 185]

$this SetCode( string $code)



Tags:

access:  public


Parameters:

string   $code  

[ Top ]

method SetDocid [line 201]

$this SetDocid( string $docid)



Tags:

access:  public


Parameters:

string   $docid  

[ Top ]

method setEnabled [line 224]

LeaveModal setEnabled( bool $enabled)



Tags:

access:  public


Parameters:

bool   $enabled  

[ Top ]

method SetFooter [line 169]

$this SetFooter( $footer_content, string $title)



Tags:

access:  public


Parameters:

string   $title  
   $footer_content  

[ Top ]

method SetFromArray [line 88]

$this SetFromArray( array $settings, [string $prefix = ''])



Tags:

access:  public


Parameters:

array   $settings  
string   $prefix  

[ Top ]

method SetId [line 128]

$this SetId( string $id)



Tags:

throws:  Exception
access:  public


Parameters:

string   $id  

[ Top ]

method SetOption [line 247]

$this SetOption( string $name, mixed $value)



Tags:

throws:  Exception
access:  protected


Parameters:

string   $name  
mixed   $value  

[ Top ]

method SetOptions [line 234]

$this SetOptions( [array $options = []])



Tags:

throws:  Exception
access:  public


Parameters:

array   $options  

[ Top ]

method SetTitle [line 153]

$this SetTitle( string $title)



Tags:

access:  public


Parameters:

string   $title  

[ Top ]


Documentation generated on Fri, 07 Jun 2024 19:02:37 +0200 by phpDocumentor 1.4.3