function Controller(){function e(e){void 0!==e.row.teamId&&(Alloy.Globals.loading.showHide("show"),_.defer(function(){Alloy.Globals.setActiveMenuItem({controller:"team",controllerArgs:{id:e.row.teamId,name:e.row.teamName}})}))}function l(e,l){var a=[];return a.push(t.UI.create("TableViewRow",{title:"  "+l,backgroundGradient:Alloy.CFG.gradients.lightGrey,height:28})),e=_.sortBy(e,function(e){return e.position}),_.each(e,function(e,l){a.push(Alloy.createController("standingsTableRow",{id:e.teamId,position:e.total.position,teamName:e.teamName,teamLogo:e.teamLogo,matchesTotal:e.total.matchesTotal,matchesWon:e.total.w,matchesDrawn:e.total.d,matchesLost:e.total.l,goalDiff:e.total.goalsPro-e.total.goalsAgainst,points:e.total.points,bgColor:0==l%2?Alloy.CFG.colors.white:Alloy.CFG.colors.veryLightGrey}).getView())}),a}function a(e){function a(e){r.is("standings",e);var a=e.tables,o=[];void 0!==a[0]?(t.labelLeague.text=a[0].competitionName,t.labelColumnHeaders.visible=!0):(t.labelLeague.text=L("Tables_NoResults"),t.labelColumnHeaders.visible=!1),1===a.length?o=o.concat(l(a[0].teams,a[0].roundName)):_.each(a,function(e){o=o.concat(l(e.teams,e.groupName))}),t.table.data=o,_.defer(function(){Alloy.Globals.loading.showHide("hide")})}function o(){}var i=n.signUrl(Alloy.CFG.feedUrls.tables.replace("{{id}}",e));s.getData({getUrl:i},a,o)}require("alloy/controllers/BaseController").apply(this,Array.prototype.slice.call(arguments)),this.__controllerPath="standingsTable",arguments[0]?arguments[0].__parentSymbol:null,arguments[0]?arguments[0].$model:null,arguments[0]?arguments[0].__itemTemplate:null;var t=this,o={},i={};t.__views.standingsTable=Ti.UI.createView({layout:"vertical",id:"standingsTable"}),t.__views.standingsTable&&t.addTopLevelView(t.__views.standingsTable),t.__views.headerWrapper=Ti.UI.createView({backgroundColor:Alloy.CFG.colors.white,height:30,id:"headerWrapper"}),t.__views.standingsTable.add(t.__views.headerWrapper),t.__views.labelLeague=Ti.UI.createLabel({font:{fontSize:16,fontFamily:Alloy.CFG.fonts.bold},left:8,id:"labelLeague"}),t.__views.headerWrapper.add(t.__views.labelLeague),t.__views.labelColumnHeaders=Ti.UI.createLabel({font:{fontSize:13,fontFamily:Alloy.CFG.fonts.bold},right:4,id:"labelColumnHeaders"}),t.__views.headerWrapper.add(t.__views.labelColumnHeaders),t.__views.table=Ti.UI.createTableView({separatorColor:Alloy.CFG.colors.darkGrey,backgroundColor:Alloy.CFG.colors.white,id:"table"}),t.__views.standingsTable.add(t.__views.table),e?t.__views.table.addEventListener("click",e):i["$.__views.table!click!tableClicked"]=!0,o.destroy=function(){},_.extend(t,t.__views);var r=require("helpers"),n=require("feedSigner"),s=require("netConnect"),d=arguments[0]||{};t.labelColumnHeaders.text="GP  W   D   L    +/- Pts",void 0!==d.competitionId&&a(d.competitionId),o.getStandings=a,i["$.__views.table!click!tableClicked"]&&t.__views.table.addEventListener("click",e),_.extend(t,o)}var Alloy=require("alloy"),Backbone=Alloy.Backbone,_=Alloy._;module.exports=Controller;