YUI.add("moodle-report_eventlist-eventfilter",function(d,e){function t(){t.superclass.constructor.apply(this,arguments)}var l="#id_eventname",n="#id_eventcomponent",i="#id_eventedulevel",a="#id_eventcrud",r="#id_filterbutton",s="#id_clearbutton";d.extend(t,d.Base,{_table:null,_eventName:null,_component:null,_eduLevel:null,_crud:null,initializer:function(){var e=d.one(r),t=d.one(s);this._createTable(this.get("tabledata")),this._eventName=d.one(l),this._component=d.one(n),this._eduLevel=d.one(i),this._crud=d.one(a),this._eventName.on("valuechange",this._totalFilter,this),e.on("click",this._totalFilter,this),t.on("click",this._clearFilter,this)},_createTable:function(e){e=new d.DataTable({columns:[{key:"fulleventname",label:M.util.get_string("eventname","report_eventlist"),allowHTML:!0,sortable:!0,sortFn:function(e,t,l){e=e.getAttrs().raweventname,t=t.getAttrs().raweventname<e?1:-1;return l?-t:t},title:M.util.get_string("eventname","report_eventlist")},{key:"component",label:M.util.get_string("component","report_eventlist"),allowHTML:!0,sortable:!0,title:M.util.get_string("component","report_eventlist")},{key:"edulevel",label:M.util.get_string("edulevel","report_eventlist"),sortable:!0,title:M.util.get_string("edulevel","report_eventlist")},{key:"crud",label:M.util.get_string("crud","report_eventlist"),sortable:!0,title:M.util.get_string("crud","report_eventlist")},{key:"objecttable",label:M.util.get_string("affectedtable","report_eventlist"),sortable:!0,title:M.util.get_string("affectedtable","report_eventlist")},{key:"since",label:M.util.get_string("since","report_eventlist"),sortable:!0,title:M.util.get_string("since","report_eventlist")},{key:"legacyevent",label:M.util.get_string("legacyevent","report_eventlist"),sortable:!0,title:M.util.get_string("legacyevent","report_eventlist")}],data:e,strings:{sortBy:"{title}",reverseSortBy:"{title}"}});return e.render("#report-eventlist-table"),e.get("boundingBox").addClass("report-eventlist-datatable-table"),this._table=e,this},_totalFilter:function(){for(var e,t,l,n,i=this._eventName.get("value").toLowerCase(),a=this._component.get("value"),r=this._eduLevel.get("options").item(this._eduLevel.get("selectedIndex")).get("text").toLowerCase(),s=this._eduLevel.get("value"),v=this._crud.get("options").item(this._crud.get("selectedIndex")).get("text").toLowerCase(),_=this._crud.get("value"),o=[],u=0;u<this.get("tabledata").length;u++)e=0<=d.Node.create(this.get("tabledata")[u].fulleventname).get("text").toLowerCase().indexOf(i),t=0<=this.get("tabledata")[u].eventname.indexOf("\\"+a+"\\event\\"),l=0<=this.get("tabledata")[u].edulevel.toLowerCase().indexOf(r),n=0<=this.get("tabledata")[u].crud.toLowerCase().indexOf(v),"0"===a&&(t=!0),"0"===s&&(l=!0),"0"===_&&(n=!0),(e=""===i?!0:e)&&t&&l&&n&&o.push(this.get("tabledata")[u]);this._table.set("data",o)},_clearFilter:function(){this._eventName.set("value",""),this._component.set("value","0"),this._eduLevel.set("value","0"),this._crud.set("value","0"),this._table.set("data",this.get("tabledata"))}},{NAME:"eventFilter",ATTRS:{tabledata:{value:null}}}),d.namespace("M.report_eventlist.EventFilter").init=function(e){return new t(e)}},"@VERSION@",{requires:["base","event","node","node-event-delegate","datatable","autocomplete","autocomplete-filters"]});