darthsandmann 189e58e9aa ppm2
2016-12-12 13:42:59 +01:00

93 lines
2.4 KiB
JavaScript

//------------------------------------------------------------------------------
// PPM - Hauptfunktion
//------------------------------------------------------------------------------
class PPM
{
constructor ()
{
this.TemplateManager_o = new TemplateManager_cl();
this.TemplateManager_o;
}
Menu (message)
{
switch (message)
{
case 'index':
this.LoadContent('/category/', 'index.tpl');
break;
case 'categoryStudenten':
this.LoadContent('/category/?cat=Studenten', 'list.tpl');
break
case 'categoryLehrender':
this.LoadContent('/category/?cat=Lehrender', 'list.tpl');
break
case 'categoryFirmen':
this.LoadContent('/category/?cat=Firmen', 'list.tpl');
break
case 'choice':
this.LoadContent('/choice', 'listChoice.tpl');
break
case 'evalStudenten':
this.LoadContent('/eval/?cat=Studenten', 'listEval.tpl');
break
case 'evalLehrender':
this.LoadContent('/eval/?cat=Lehrender', 'listEval.tpl');
break
case 'evalFirmen':
this.LoadContent('/eval/?cat=Firmen', 'listEval.tpl');
break
default:
alert ('[PPM] Unbekannte Anfrage: ' + message);
}
}
LoadContent ( path, template )
{
$.ajax({
dataType: "json",
url: path,
type: 'GET',
context: this
})
.done(function (json) {
console.log("JSON: ", json);
var result = this.TemplateManager_o.execute_px( template, json );
console.log("RESULT: ", result);
$( ".clContent" ).replaceWith(result);
console.log("DONE LOADING!");
})
.fail(function(jqXHR_opl, textStatus_spl) {
alert( "[PPM] Fehler bei Anforderung: " + textStatus_spl );
});
}
}
$(function() {
$('body').on('click', '[data-action]', function() {
var action = $(this).data('action');
this.PPM_o = new PPM();
this.PPM_o.Menu(action);
return false;
});
});