164 lines
4.0 KiB
JavaScript
164 lines
4.0 KiB
JavaScript
//------------------------------------------------------------------------------
|
|
// PPM - Hauptfunktion
|
|
//------------------------------------------------------------------------------
|
|
|
|
class PPM
|
|
{
|
|
constructor ()
|
|
{
|
|
this.BodyDataAction();
|
|
|
|
this.TemplateManager_o = new TemplateManager_cl();
|
|
this.TemplateManager_o;
|
|
|
|
console.log("PPM LOADED");
|
|
}
|
|
|
|
BodyDataAction ()
|
|
{
|
|
$('body').on('click', '[data-action]', function() {
|
|
var action = $(this).data('action');
|
|
|
|
PPM_o.Menu(action);
|
|
return false;
|
|
});
|
|
}
|
|
|
|
BodyTableSelect ()
|
|
{
|
|
$('#idList tr').click(function(){
|
|
$(".selected").removeClass('selected');
|
|
$(this).addClass('selected');
|
|
this.selectedId = $(this).attr('id');
|
|
console.log("SELECT ID: ", this.selectedId);
|
|
return false;
|
|
});
|
|
}
|
|
|
|
Menu (message)
|
|
{
|
|
var selectedId = $(".selected").attr('id');
|
|
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
|
|
|
|
case 'NewStudenten':
|
|
|
|
console.log("NewStudenten");
|
|
break
|
|
|
|
case 'NewLehrender':
|
|
|
|
console.log("NewLehrender");
|
|
break
|
|
|
|
case 'NewFirmen':
|
|
|
|
console.log("NewFirmen");
|
|
break
|
|
|
|
case 'ModifyStudenten':
|
|
console.log("ModifyStudenten: ", selectedId);
|
|
break
|
|
|
|
case 'ModifyLehrenden':
|
|
|
|
console.log("ModifyLehrenden", selectedId);
|
|
break
|
|
|
|
case 'ModifyFirmen':
|
|
|
|
console.log("ModifyFirmen", selectedId);
|
|
break
|
|
|
|
case 'DeleteStudenten':
|
|
|
|
console.log("DeleteStudenten", selectedId);
|
|
break
|
|
|
|
case 'DeleteLehrenden':
|
|
|
|
console.log("DeleteLehrenden", selectedId);
|
|
break
|
|
|
|
case 'DeleteFirmen':
|
|
|
|
console.log("DeleteFirmen", selectedId);
|
|
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);
|
|
$( ".clContent" ).empty();
|
|
$( ".clContent" ).append(result);
|
|
this.BodyTableSelect();
|
|
console.log("TM DONE");
|
|
})
|
|
.fail(function(jqXHR_opl, textStatus_spl) {
|
|
alert( "[PPM] Fehler bei Anforderung: " + textStatus_spl );
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
$(function() {
|
|
console.log("ONLOAD");
|
|
PPM_o = new PPM();
|
|
PPM_o.Menu("index");
|
|
}); |