var PO=0;
var PA=0;
var PATT=0;
var PT=0;
var MER=0;
var IBI2=0;
var IEL=0;
var IGM=0;
var IMT=0;
var IMX=0;
function findString(tstring,text) {
// Replaces text with by in string
var strLength = tstring.length, txtLength = text.length;
if ((strLength == 0) || (txtLength == 0)){
return false;
}
var i = tstring.indexOf(text);
if (i == -1) {
return false;
}
else{
return true;
}
}
var _all_persons = {325111: {“img”:”
“},
318477: {“img”:”
“},
318319: {“img”:”
“},
314462: {“img”:”
“},
318293: {“img”:”
“},
200854: {“img”:”
“},
318512: {“img”:”
“},
223560: {“img”:”
“},
301145: {“img”:”
“},
170845: {“img”:”
“},
190188: {“img”:”
“},
105782: {“img”:”
“},
182443: {“img”:”
“},
190049: {“img”:”
“},
239841: {“img”:”
“},
292067: {“img”:”
“},
111563: {“img”:”
“},
276451: {“img”:”
“},
120900: {“img”:”
“},
108571: {“img”:”
“},
190209: {“img”:”
“},
115064: {“img”:”
“},
112564: {“img”:”
“},
242254: {“img”:”
“},
123556: {“img”:”
“},
190091: {“img”:”
“},
106334: {“img”:”
“},
106123: {“img”:”
“},
161663: {“img”:”
“},
105997: {“img”:”
“},
102717: {“img”:”
“},
178549: {“img”:”
“},
105668: {“img”:”
“},
128821: {“img”:”
“},
105657: {“img”:”
“},
105633: {“img”:”
“},
139973: {“img”:”
“},
185421: {“img”:”
“},
113150: {“img”:”
“},
104267: {“img”:”
“},
178548: {“img”:”
“},
161577: {“img”:”
“},
217963: {“img”:”
“},
146262: {“img”:”
“},
123870: {“img”:”
“},
229644: {“img”:”
“},
182237: {“img”:”
“},
188690: {“img”:”
“},
110635: {“img”:”
“},
104626: {“img”:”
“},
171600: {“img”:”
“},
101178: {“img”:”
“},
152066: {“img”:”
“},
265228: {“img”:”
“},
270858: {“img”:”
“},
102121: {“img”:”
“},
105540: {“img”:”
“},
120906: {“img”:”
“},
112194: {“img”:”
“},
117014: {“img”:”
“},
133331: {“img”:”
“},
106170: {“img”:”
“},
105245: {“img”:”
“},
107331: {“img”:”
“},
105043: {“img”:”
“},
194090: {“img”:”
“},
210231: {“img”:”
“},
243438: {“img”:”
“},
122431: {“img”:”
“},
106544: {“img”:”
“},
102553: {“img”:”
“},
104759: {“img”:”
“},
201483: {“img”:”
“},
106441: {“img”:”
“},
240724: {“img”:”
“},
196998: {“img”:”
“},
105869: {“img”:”
“},
144178: {“img”:”
“},
235586: {“img”:”
“},
231890: {“img”:”
“},
138857: {“img”:”
“},
182447: {“img”:”
“},
104860: {“img”:”
“},
105945: {“img”:”
“},
199129: {“img”:”
“},
182445: {“img”:”
“},
161458: {“img”:”
“},
149175: {“img”:”
“},
190693: {“img”:”
“},
115955: {“img”:”
“},
270859: {“img”:”
“},
152027: {“img”:”
“},
254787: {“img”:”
“},
104385: {“img”:”
“},
103117: {“img”:”
“},
253103: {“img”:”
“},
106482: {“img”:”
“},
209207: {“img”:”
“},
101874: {“img”:”
“},
115671: {“img”:”
“},
174684: {“img”:”
“},
162368: {“img”:”
“},
107144: {“img”:”
“},
115227: {“img”:”
“},
104561: {“img”:”
“},
155721: {“img”:”
“},
208625: {“img”:”
“},
169253: {“img”:”
“},
100192: {“img”:”
“},
146991: {“img”:”
“},
106643: {“img”:”
“},
169199: {“img”:”
“},
170628: {“img”:”
“},
113045: {“img”:”
“},
111056: {“img”:”
“},
104911: {“img”:”
“},
248721: {“img”:”
“},
184352: {“img”:”
“},
212341: {“img”:”
“},
145160: {“img”:”
“},
192046: {“img”:”
“},
107522: {“img”:”
“},
164068: {“img”:”
“},
101565: {“img”:”
“},
229808: {“img”:”
“},
178738: {“img”:”
“},
122495: {“img”:”
“},
105556: {“img”:”
“},
231181: {“img”:”
“},
106157: {“img”:”
“},
184427: {“img”:”
“},
209104: {“img”:”
“},
106362: {“img”:”
“},
109324: {“img”:”
“},
129136: {“img”:”
“},
145781: {“img”:”
“},
113762: {“img”:”
“},
106017: {“img”:”
“},
107971: {“img”:”
“},
275762: {“img”:”
“},
105551: {“img”:”
“},
265227: {“img”:”
“},
207354: {“img”:”
“},
189938: {“img”:”
“},
211624: {“img”:”
“},
103606: {“img”:”
“},
112836: {“img”:”
“},
104417: {“img”:”
“},
108776: {“img”:”
“},
231182: {“img”:”
“},
176631: {“img”:”
“},
207237: {“img”:”
“},
104596: {“img”:”
“},
278363: {“img”:”
“},
283343: {“img”:”
“},
252550: {“img”:”
“},
109297: {“img”:”
“},
190315: {“img”:”
“},
101475: {“img”:”
“},
113157: {“img”:”
“},
182444: {“img”:”
“},
199130: {“img”:”
“},
105270: {“img”:”
“},
218367: {“img”:”
“},
218366: {“img”:”
“},
156731: {“img”:”
“},
111729: {“img”:”
“},
210230: {“img”:”
“},
106071: {“img”:”
“},
156848: {“img”:”
“},
105059: {“img”:”
“},
111182: {“img”:”
“},
167918: {“img”:”
“},
106911: {“img”:”
“},
115534: {“img”:”
“},
243441: {“img”:”
“},
159310: {“img”:”
“},
162030: {“img”:”
“},
104610: {“img”:”
“},
169419: {“img”:”
“},
168009: {“img”:”
“},
140973: {“img”:”
“},
136108: {“img”:”
“},
252123: {“img”:”
“},
199128: {“img”:”
“},
283344: {“img”:”
“},
243371: {“img”:”
“},
“_last_key_unused”: {}};
function img_of_person (person) {
var this_person = _all_persons[person.sciper];
if (! this_person) return “”;
return this_person.img;
}
function _templateCard(person) {
function _h(s, person) {
// Poor man’s handlebars
return s.replace(/{{person.([a-zA-Z_]+)}}/g,
function(unused, k) {return person[k]});
}
var html = “
person = JSON.parse(JSON.stringify(person)); // Unalias
person[“fullname”] = person.firstname + ” ” + person.lastname;
html += “” + img_of_person(person) + “\n”;
html += ”
\n”;
html += _h(
”
{{person.lastname}} {{person.firstname}}
\n”, person);
html += _h(
” {{person.mylabname}}\n”, person);
html += ”
\n”; // id=”faculty-titre-id”
html += “
\n”; // class=”faculty-titre-card” etc.
return html;
}
function _doPrintOuter(people_listing, lang) {
var test=””;
var count=0;
var result=0;
for(var x=0; x < people_listing.length; x++) {
if (people_listing[x]) {
result++;
count++;
people_listing[x].link = "https://people.epfl.ch/" + people_listing[x].sciper;
test += _templateCard(people_listing[x]);
}
}
if (count==0) {
test+= "THERE ARE NO PROFESSORS IN THIS CATEGORY“;
}
document.getElementById(‘faculty-gallery’).innerHTML = test;
}
function resetDirectoryForm() {
$(“.sti-faculty-sort a”).data(“active”, false);
$(“.sti-faculty-sort a#all”).data(“active”, true);
$(“.sti-faculty-sort a”).children(‘input’).each(function () {
$(this).prop(‘checked’, false);
});
redraw();
return false; // For the onClick() handler to suppress the event
}
function redraw () {
var $institute = undefined;
$(“.sti-faculty-sort a”).map(function (unused_index, e) {
if ($(e).data(“active”)) {
$(e).addClass(‘sti-toggled’);
} else {
$(e).removeClass(‘sti-toggled’);
}
})
function anchor2cgiparam (id) {
return ($(“#” + id).data(“active”) ? “1” : “0”);
}
var PO = anchor2cgiparam(“PO”),
PA = anchor2cgiparam(“PA”),
PATT = anchor2cgiparam(“PATT”),
PT = anchor2cgiparam(“PT”),
MER = anchor2cgiparam(“MER”);
var url = “https://stisrv13.epfl.ch/cgi-bin/whoop/faculty-and-teachers2.pl?PO=”+PO+”&PA=”+PA+”&PATT=”+PATT+”&PT=”+PT+”&MER=”+MER;
if ($institute) {
url = url + “&” + $institute + “=1”;
} else {
var IBI2 = anchor2cgiparam(“IBI2”),
IEL = anchor2cgiparam(“IEL”),
IGM = anchor2cgiparam(“IGM”),
IMT = anchor2cgiparam(“IMT”),
IMX = anchor2cgiparam(“IMX”)
url = url+”&IBI2=”+IBI2+”&IEL=”+IEL+”&IGM=”+IGM+”&IMT=”+IMT+”&IMX=”+IMX;
}
$.ajax({
url: url,
dataType: “json”,
}).done(function(people_listing) {
_doPrintOuter(people_listing, “en”);
});
}
function toggle ($link) {
$(“.sti-faculty-sort a#all”).data(“active”, false);
var oldState = $link.data(“active”);
$link.data(“active”, ! oldState);
$(function() { // Poor man’s nextTick()
$link.children(“input”).prop(“checked”, ! oldState);
});
redraw();
}
$(function() {
$(“#all”).data(“active”, true);
$(“input, a.togglable”).on(“click”, function(event) {
this_link = $(this).closest(“a”);
toggle(this_link);
event.preventDefault();
event.stopPropagation();
});
redraw();
});





































































































































