var translations = {"WELCOME": "Sayın {0}, hoşgeldiniz.","GREETINGS": "{0} adlı öğrencimizin doğum gününü kutluyoruz.","TOTAL_ABSENCES": "Öğrencinin toplam {0} devamsızlığı bulunmaktadır",1: 1};(function ( $ ) { $.fn.el = function(selector) { return this.find(selector); }; $.fn.onClick = function(selector, callback) { this.el(selector).off("click").on("click", callback); }; $.fn.onChange = function(selector, callback) { this.el(selector).off("change").on("change", callback); }; }( jQuery )); /* * Project: SerializeObject() * URL: https://github.com/scottyc1000/serializeObject * Author: Scott Carmichael * Version: 1.3 * Requires: jQuery 1.3+ * * Copyright (c) 2013 Scott Carmichael * Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) * Copyright notice and license must remain intact for legal use */ ;(function($, window, document){ $.fn.serializeObject = function() { //Internet Explorer indxOf fix if(!Array.prototype.indexOf) { Array.prototype.indexOf = function(obj, start) { for (var i = (start || 0), j = this.length; i < j; i++) { if (this[i] === obj) { return i; } } return -1; } } var form_values = $(this).serializeArray(), form_final = {}; //fill object with results $.each(form_values, function(){ //Empty assign Null if(this.value == '') { form_final[this.name] = null; //Store Associated Array Input Array } else if(this.name.match(/\[(.+?)\]/g)){ var arrayName = this.name.match(/\w+[^\[]/g)[0], propertyName = this.name.match(/\[(.+?)\]/g)[0]; propertyName = propertyName.replace(/(\[|\])/g, ""); if(!form_final.hasOwnProperty(arrayName)){ form_final[arrayName] = new Object(); } form_final[arrayName][propertyName] = this.value; // Store Array Input Array } else if(this.name.indexOf('[]') > 0){ //Remove [] from input name this.name = this.name.split("[]")[0]; if(form_final.hasOwnProperty(this.name)){ form_final[this.name].push(this.value); } else { form_final[this.name] = [this.value] } // Store multiple / checkboxes as Array } else if(form_final.hasOwnProperty(this.name)) { if(typeof form_final[this.name] != 'object' ){ firstItem = form_final[this.name]; form_final[this.name] = new Object(); form_final[this.name][firstItem] = true; } form_final[this.name][this.value] = true; } else { form_final[this.name] = this.value; } }); //Output Object return form_final; } }(jQuery, window, document)); ;(function($, window, document){ $.fn.formReset = function() { $(this).find(".select-chosen").val("").trigger("chosen:updated"); $(this).find("select.chosen").val("").trigger("chosen:updated"); $(this).find("input[type=text], textarea, input[type=password], input[type=email], select").val(""); $(this).find("input[type=checkbox]").each(function() { try { document.getElementById($(this).attr("id")).checked = false; } catch (e) {} }); $(this).find(".picture-upload").each(function() { $(this).find("input[type=file]").val(""); $(this).find("input[type=hidden]").val(""); $(this).find("img").attr("src", "lib/images/nopic.jpg"); $(this).find(".progress-bar").css("width", "0%"); $(this).find(".progress-bar").html("0%"); }); $(this)[0].reset(); } }(jQuery, window, document)); //Data Option Prototype var DataOption = function(id,name) { this.id = id; this.name = name; }; DataOption.prototype = { id:0, name:"" } var Person = function(id, name, picture, ttype, tgroup,textra) { this.id = id; this.name = name; this.picture = picture; this.ttype = ttype; this.tgroup = tgroup; this.textra=textra; } Person.prototype = { id : 0, name : "", picture : "", ttype : '', tgroup : 0, textra:0 } //Data Time Option Prototype var DataTimeOption = function(id,beginTime,endTime) { this.id = id; this.beginTime = beginTime; this.endTime = endTime; }; DataTimeOption.prototype = { id:0, beginTime:"", endTime:"" } //Data Prototype for lazy-data var Data = function() {}; Data.prototype = { lesson : [ ["", "Ders"] ], teacher : [ ["", "Öğretmen"] ], student : [ ["", "Öğrenci"] ], subClass : [ ["", "Sınıf"] ] } //Global Loader Prototype var Loader = function() {}; Loader.prototype = { show : function() { $("#___loadingPane").css("display", "block"); }, hide : function() { $("#___loadingPane").css("display", "none"); } }; var loader = new Loader(); //View Prototype var View = function(name, content, containerClass) { this.name = name; this.content = content; this.containerClass = containerClass; }; View.prototype = { name:'', content : null, containerClass : "extTabContent" }; //Menu Prototype var Menu = function(name, className, content) { this.name = name; this.className = className; this.content = content; }; Menu.prototype = { name:'', className:'', content:'' } //Message Prototype var Message = function(status, content, data) { this.status = status; this.content = content; this.data = data; }; Message.prototype = { status : '', content : '', data : [] } //DataSource prototype var DataSource = function() {} DataSource.prototype = { rows : [], compareByOrder : function(a,b) { return (parseInt(a.sort_order,10) <= parseInt(b.sort_order,10)) ? -1 : 1; }, compareBackByOrder : function(a,b) { return (parseInt(a.sort_order,10) >= parseInt(b.sort_order,10)) ? -1 : 1; }, sortByOrder : function(fnc) { var l = this.rows.length; var sorted = this.rows.sort(this.compareByOrder); for (var i=0; i li").each(function() { var ctx = $("#"+$(this).attr("id").replace("-tab-", "-main-")); var fnc = $(this).find("a").attr("data-url"); try { var fnct = eval(fnc+".render"); fnct.call(undefined, ctx); } catch(e) {} }); /* this.listeners.forEach(function(entry) { entry[1].call(undefined, entry[0]); }); */ }, call : function() { $(".nav-tabs > li").each(function() { var ctx = $("#"+$(this).attr("id").replace("-tab-", "-main-")); var fnc = $(this).find("a").attr("data-url"); //console.log(fnc); try { var fnct = eval(fnc+".render"); fnct.call(undefined, ctx); } catch(e) {console.log(e.stack);} }); } } var CDATA_incr = 1; var CDATA = function(name) { this.name = name; this.items = []; }; CDATA.prototype = { all : function(ctx) { if (typeof this.items[ctx.attr("id")] === "undefined") return []; return this.items[ctx.attr("id")]; }, find : function(ctx, id) { if (typeof this.items[ctx.attr("id")] === "undefined") return null; var _compareTo = typeof id === "number" ? id : parseInt(id,10); for (var a in this.items[ctx.attr("id")]) { if (this.items[ctx.attr("id")][a].id === _compareTo) { return this.items[ctx.attr("id")][a]; } } return null; }, update : function(ctx, id, item) { if (typeof this.items[ctx.attr("id")] === "undefined") return null; for (var a in this.items[ctx.attr("id")]) { if (this.items[ctx.attr("id")][a].id === id) { this.items[ctx.attr("id")][a] = item; break; } } return null; }, remove : function(ctx, id) { if (typeof this.items[ctx.attr("id")] === "undefined") return null; for (var i=0; i < this.items[ctx.attr("id")].length; i++) { if (this.items[ctx.attr("id")][i].id === id) { this.items[ctx.attr("id")].splice(i,1); break; } } return null; }, clear : function(ctx) { if (typeof this.items[ctx.attr("id")] === "undefined") { this.items[ctx.attr("id")] = []; } else { this.items[ctx.attr("id")] = []; } }, add : function(ctx, item) { if (typeof this.items[ctx.attr("id")] === "undefined") { this.items[ctx.attr("id")] = []; } var temp_item = null; if (typeof item.id !== "undefined") { temp_item = this.find(ctx, item.id); } else { item.id = ++CDATA_incr; } if (typeof item.id !== "number") { item.id = parseInt(item.id, 10); } if (temp_item != null) { this.update(ctx, item.id, temp_item); } else { this.items[ctx.attr("id")].push(item); } } }; var West = function() {}; West.prototype = { _path:"", _cdn : "", _history : [], _tabID : 0, _menu : [], _data : [], _view : [], _person:null, _today : "", _loading:false, _windowResizeTO : false, _container : null, _uploadTurn : 0, _uploadings : [], _mobile_token : "", _testUser : 0, _newGallery : 1, _systemStop : false, _albumStartFrom : "", _serviceLocation: null, $mod_exam : false, $mod_club_lessons : false, $mod_accounting : false, setServiceLocation: function(data) { west._serviceLocation = data; if (typeof dashboard.setTransportInfo !== "undefined") { dashboard.setTransportInfo(data); } }, translate: function(phrase, vals) { return translations[phrase].replace("{0}", vals); }, load : function(container) { $.fn.datepicker.defaults.format = "dd.mm.yyyy"; if (typeof container === "undefined") this._container = "body"; else this._container = container; $("#___loadingPaneDIV").html(''); var params = {}; if (typeof __mobileToken !== "undefined" && __mobileToken != null) { params.token = __mobileToken; } //console.log("calling load function"); //console.log(params); if(login._login_init==0) { login.init(null); } var shortLink = ""; if (window.location.href.indexOf("?webkey=") != -1) { shortLink = "ticket_" + window.location.href.split("?webkey=")[1]; } this.getData("login/check", shortLink, null, function(msg, c) { if (msg.data[0].id != 0) { west._person = msg.data[0]; if (west._person.schoolStatus == 1) { alert("Hizmetleriniz dondurulmuştur"); west.getData("login/logout", "", "", null); return; } if (west._person.ttype == "t" && west._person.schoolStatus == 2) { alert("Değerli Temsilciliğimiz,\n" + "Kullanıcı sınırınız aşılmıştır. Konu ile ilgili 0554 577 10 26 numaralı telefondan Tuğçe Hanım ile iletişime geçmenizi önemle rica ederiz. Aksi takdirde 3 iş günü sonunda sisteminiz dondurulacaktır.\n" + "Saygılarımızla."); } login.go(null); } else { var c = west.createTab("empty", "lock", "Giriş", false, "login"); if (msg.data[0].attempt >= 3) { $(".sec1").show(); $(".sec2").show(); $("#secCode").attr("src", "securityCode"); } } }); $(document).on("scroll", function() { $(".extTabContent:visible").attr("data-scroll", ($(this).scrollTop())); }); $(window).resize(function () { clearTimeout(west._windowResizeTO); west._windowResizeTO = setTimeout(function () { var ctx = null; $(".extTabContent").each(function() { if ($(this).is(":visible")) { ctx = $(this); } }); west.fixPanels(ctx); }, 200); }); this.bindEvents(); setTimeout(west.worker, 5000); Chart.defaults.global.responsive = true; }, fixPanels : function(sender) { $("body").removeClass(); $("body").addClass("overflows"); if (sender == null) return; if (sender.find(".row").length == 1) { if (sender.find(".row").hasClass("panels-fixed")) { $("body").removeClass(); $("body").addClass("no-overflow"); var dimension = 200; if (sender.find(".panel-to-fix").hasClass("for-grid")) { dimension += 80; } sender.find(".panel-to-fix").height((parseInt($(window).height(),10)-dimension) + "px"); //sender.find(".panel-to-fix").addClass("overflows"); eval("try { " + sender.attr("data-context")+".resized(sender); } catch(e) {}"); } } }, getgridlocalizationobj:function() { var gridlocalizationobj = { //currencysymbol: "TL", // currencysymbolposition: "after", decimalseparator: '.', thousandsseparator: ',', pagergotopagestring: "Git Sayfa:", pagershowrowsstring: "Göster:", pagerrangestring: " ", pagerpreviousbuttonstring: "Önceki", pagernextbuttonstring: "Sonraki", groupsheaderstring: "Gruplamak istediğiniz sütunu sürükleyip buraya bırakabilirsiniz", sortascendingstring: "Sırala (Önce En Küçük)", sortdescendingstring: "Sırala (Önce En Büyük)", sortremovestring: "Sıralamayı İptal Et", groupbystring: "Bu sütuna göre grupla", groupremovestring: "Gruplamayı kaldır", emptydatastring: "Gösterilecek Kayıt Bulunamadı", loadtext: "Yükleniyor...", clearstring: "Temizle", todaystring: "Bugün"} ; return gridlocalizationobj; }, worker:function() { if ((west._loading) || (west._person == null)) { setTimeout(west.worker, 15000); return; } if (west._person.ttype == "v") { west.inlineCall("index/checkParentChanges", { url: window.location.href }, "-", function(msg,sender) { setTimeout(west.worker, 30000); }, "POST", true, true); return; } west.inlineCall("index/checkChanges", { url: window.location.href }, "-", function(msg,sender) { setTimeout(west.worker, 15000); }, "POST", true, true); }, changeTab : function(id) { var snd = id.split("-")[2]; /* * Setting all tabs inactive */ $(".extTabContent").each(function() { $(this).hide(); }); $(".nav-tabs").find("li").each(function() { $(this).removeClass("active"); }); /* * Setting the selected tab active */ var tabToSelect = $("#"+id.replace("-tab-", "-main-")); //tabToSelect.addClass("current"); tabToSelect.show(); $("#"+id).addClass("active"); /* * Setting the scroll position of the selected tab with the data-scroll attribute. */ $(document).scrollTop(tabToSelect.attr("data-scroll")); try { $(".panel-sticky").sticky("update"); } catch (e) {} var dataNav = $("#"+id+" > a").attr("data-nav"); var dataURL = $("#"+id+" > a").attr("data-url"); /* * Warning : Hard coding for bussiness needs. * This shouldn't be like this. */ if ((dataURL === "homework") && (west._person.ttype === "v")) { dataNav = "closer"; } /* * Checking the view's navigation property for manipulating data-nav area. */ this._menu.forEach(function(entry) { if (entry.name == dataNav) { $("#navbar").html(entry.content .replace('{navActionClose}', 'id="'+id.replace("-tab-", "-navbarclose-")+'"') .replace('{navActionSubmit}', 'id="'+id.replace("-tab-", "-navbarsubmit-")+'"') ); $("#navbar").removeClass(); $("#navbar").addClass(entry.className+" float-right"); if (dataURL != "") { eval("try { " + dataURL+".bindNavEvents(tabToSelect); } catch(e) {}"); } } }); /* * Changing all akant-combo comboboxes to pretty combobox. */ $(".akant-combo").each(function() { if ($(this).attr("data-proc") != null) return; $('.akant-combo').combobox(); $(this).attr("data-proc", "1"); }); /* * Warning : Hard coding for bussiness needs. * Akant-Main-Combo is the main combobox object for all searching parameters. * We have implemented it's bussiness here but should be in a different way. */ $(".akant-main-combo").each(function() { if ($(this).attr("data-proc") != null) return; west._data.subClass.each(function(entry) { if (entry.id == "") return; $('.akant-main-combo').append($("").attr("value","subClass-"+entry.id).text(entry.name)); }); west._data.student.each(function(entry) { if (entry.id == "") return; $('.akant-main-combo').append($("").attr("value","student-"+entry.id).text(entry.name + " - " + entry.school_number)); }); west._data.teacher.each(function(entry) { if (entry.id == "") return; $('.akant-main-combo').append($("").attr("value","teacher-"+entry.id).text(entry.name)); }); $('.akant-main-combo').combobox(); $(this).attr("data-proc", "1"); }); west.fixPanels(tabToSelect); this.bindEvents(); }, /* * creates a new tab with the given parameters. * @param {string} dataNav * @param {string} icon * @param {string} name * @param {boolean} closable * @param {string} url : the class object for the instance of this variable. * @param {void} fnc * @param {int} isUnique * @returns {Number} */ createTab : function(dataNav, icon, name, closable, url, fnc, isUnique) { var dataUnique = "0"; if (typeof isUnique != 'undefined' && isUnique != null) { dataUnique = isUnique; } var hasUnique = false; if (dataUnique == "1") { $(".nav-tabs").find("li").each(function() { var t = $(this); if ($(this).find("a").attr("data-url") == url) { west.changeTab(t.attr("id")); hasUnique = true; } }); } if (hasUnique) return; this._tabID++; var x = this._tabID; var view = null; this._view.forEach(function(entry) { if (entry.name == url) { view = entry; } }); var cls = (view != null) ? view.containerClass : "extTabContent"; var cntEL = $('
Yükleniyor
'); $(this._container).append(cntEL); var xClose = (closable ? '' : ''); $(".navbar-fixed-bottom").find(".nav-tabs").append('
  • ' + '' + ' ' + name + '' + xClose + ''+ '
  • '); if (view != null) { $('#content-main-'+x).html(view.content); west.bindEvents(); west.changeTab('content-tab-'+x); } else { $('#content-main-'+x).html(""); west.bindEvents(); west.changeTab('content-tab-'+x); } west.render_medicine_menu(); west.render_talk_menu(); if (typeof fnc != 'undefined' && fnc != null) { fnc.call(undefined, cntEL); } if (url != "") { try { if (url == "activity" || url == "etud" || url == "admin" || url == "preschool" || url == "album") { eval(url).init.call(cntEL); } else { eval("try {" + url+".init(cntEL); } catch (e) {}"); } } catch (e) { console.log(e.stack); } } this._history.push("content-tab-"+x); return cntEL; }, /* * sets the label of the tab at the bottom navigation area. * @param {int} sender * @param {string} name * @returns {void} */ setTabName : function(ctx, name) { $("#"+ctx.attr("id").replace("-main-", "-tab-")).find("span:nth-child(2)").html(name); }, removeTab : function(ctx) { var tabDIV = $("#" + ctx.attr("id").replace("-main-", "-tab-")); var closeConfirm = true; var fnc = tabDIV.find("a").attr("data-url"); try { var fnct = eval(fnc+".beforeClose"); closeConfirm = fnct.call(undefined, ctx); } catch(e) {} if (closeConfirm) { for (var i=0; i li > a").removeClass("active"); }, /* * Modifies all the common objects' methods and properties in a context for once * @returns {void} */ bindEvents : function() { $(".cmp").each(function() { if ($(this).data("proc")) return; if ($(this).hasClass("form-group")) { var labelText = $(this).data("label"); var inputType = $(this).data("type"); var isRequired = $(this).data("required"); var inputID = $(this).data("id"); var inputName = $(this).data("id"); var inputClass = "form-control"; var layout = $(this).data("layout"); if (typeof layout === "undefined") layout = "horizontal"; var $input = null; var $label = $('