Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • fsini-informatik/fsfahrttool
  • kleemeis/fsfahrttool
2 results
Show changes
Showing
with 3997 additions and 550 deletions
21:07.33 - 01.05.2018 | IO(undefined, undefined Geld) wurde gespeichert.<br>
21:07.33 - 01.05.2018 | IO(undefined, undefined Geld) wurde gespeichert.<br>
21:07.33 - 01.05.2018 | IO(undefined, undefined Geld) wurde gespeichert.<br>
21:07.33 - 01.05.2018 | IO(undefined, undefined Geld) wurde gespeichert.<br>
21:07.33 - 01.05.2018 | IO(Kuchen, 2 Geld) wurde erstellt.<br>
21:26.27 - 01.05.2018 | IO(undefined, undefined Geld) wurde gespeichert.<br>
21:26.27 - 01.05.2018 | IO(undefined, undefined Geld) wurde gespeichert.<br>
21:26.27 - 01.05.2018 | IO(undefined, undefined Geld) wurde gespeichert.<br>
21:26.27 - 01.05.2018 | IO(Test, 2 Geld) wurde erstellt.<br>
21:26.27 - 01.05.2018 | IO(undefined, undefined Geld) wurde gespeichert.<br>
21:29.09 - 01.05.2018 | IO(&Uuml;bertrag WS 18/19, 132.63 Geld) wurde gespeichert.<br>
21:29.09 - 01.05.2018 | IO(Test, 2 Geld) wurde erstellt.<br>
21:29.09 - 01.05.2018 | IO(Pfand, 0 Geld) wurde gespeichert.<br>
21:29.09 - 01.05.2018 | IO(&Uuml;bertrag WS 17/18, 132.63 Geld) wurde gespeichert.<br>
21:29.09 - 01.05.2018 | IO(Ausgleich, 0 Geld) wurde gespeichert.<br>
21:29.09 - 01.05.2018 | IO(, 0 Geld) wurde gel&ouml;scht.<br>
21:30.04 - 01.05.2018 | IO(Pfand, 0 Geld) wurde gespeichert.<br>
21:30.04 - 01.05.2018 | IO(&Uuml;bertrag WS 17/18, 132.63 Geld) wurde gespeichert.<br>
21:30.04 - 01.05.2018 | IO(&Uuml;bertrag WS 18/19, 132.63 Geld) wurde gespeichert.<br>
21:30.04 - 01.05.2018 | IO(Ausgleich, 0 Geld) wurde gespeichert.<br>
21:30.04 - 01.05.2018 | IO(Test, 2 Geld) wurde erstellt.<br>
21:30.10 - 01.05.2018 | IO(Pfand, 0 Geld) wurde gespeichert.<br>
21:30.10 - 01.05.2018 | IO(&Uuml;bertrag WS 17/18, 132.63 Geld) wurde gespeichert.<br>
21:30.10 - 01.05.2018 | IO(Test, 2 Geld) wurde gel&ouml;scht.<br>
21:30.10 - 01.05.2018 | IO(&Uuml;bertrag WS 18/19, 132.63 Geld) wurde gespeichert.<br>
21:30.10 - 01.05.2018 | IO(Ausgleich, 0 Geld) wurde gespeichert.<br>
21:31.02 - 01.05.2018 | IO(&Uuml;bertrag WS 17/18, 132.63 Geld) wurde gespeichert.<br>
21:31.02 - 01.05.2018 | IO(Pfand, 0 Geld) wurde gespeichert.<br>
21:31.02 - 01.05.2018 | IO(terst, 2 Geld) wurde erstellt.<br>
21:31.02 - 01.05.2018 | IO(&Uuml;bertrag WS 18/19, 132.63 Geld) wurde gespeichert.<br>
21:31.02 - 01.05.2018 | IO(Ausgleich, 0 Geld) wurde gespeichert.<br>
21:31.07 - 01.05.2018 | IO(&Uuml;bertrag WS 17/18, 132.63 Geld) wurde gespeichert.<br>
21:31.07 - 01.05.2018 | IO(terst, 2 Geld) wurde gel&ouml;scht.<br>
21:31.07 - 01.05.2018 | IO(Pfand, 0 Geld) wurde gespeichert.<br>
21:31.07 - 01.05.2018 | IO(&Uuml;bertrag WS 18/19, 132.63 Geld) wurde gespeichert.<br>
21:31.07 - 01.05.2018 | IO(Ausgleich, 0 Geld) wurde gespeichert.<br>
<?PHP
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$myFile = "./log.html";
$stringData = "---";
if(isset($_POST['logging'])) {
$stringData = $_POST['logging'];
}
$stringData = date('G').":".date('i').".".date('s')." - ".date('d').".".date('m').".".date('Y')." | ".$stringData;
$stringData = htmlentities($stringData)."<br>";
$fh = fopen($myFile, 'a') or die("can't open file");
// echo $stringData;
// echo ("<script type='text/javascript'>alert('".$stringData."');</script>");
fwrite($fh, $stringData."\n");
fclose($fh);
?>
\ No newline at end of file
.debug{
display: none;
border: 1px dotted mediumvioletred;
}
.cost-anmerkung{
margin-top: 30px;
border-top: 1px dashed green;
padding: 15px;
background-color: greenyellow;
}
.pages-cost-edit{
border: 1px solid black;
background-color: lightcyan;
position: absolute;
top: 50px;
left: 50px;
padding: 15px;
}
.pages-cost-edit td{
border-right: 1px dotted darkgray;
padding: 3pt 5pt;
}
.deviderrow td{
border-top: 1px dotted darkgray;
}
.cost-table td{
border: 0;
}
.table-moneyio tr td{
vertical-align: top;
border: 0;
}
.table-moneyio-sum{
padding-right: 17px;
border-top: 1px dashed black !important;
border-bottom: 1px solid black !important;
}
.red-text{
color: red;
}
.green-text{
color: green;
}
.yellow-text{
color:#ffdd00;
}
/* === Buttons == */
.button-edit:before{
content: "";
background: url('../../view/graphics/jqueryui.png') no-repeat -68px -116px;
width: 9px;
height: 9px;
float: left;
margin: 2pt 4pt 0 0;
}
.button-delete:before{
content: "";
background: url('../../view/graphics/jqueryui.png') no-repeat -180px -100px;
width: 9px;
height: 10px;
float: left;
margin: 1.5pt 4pt 0 0;
}
.button-add:before{
content: "";
background: url('../../view/graphics/jqueryui.png') no-repeat -20px -133px;
width: 8px;
height: 8px;
float: left;
margin: 3pt 4pt 0 0;
}
.button-cancel:before{
content: "";
background: url('../../view/graphics/jqueryui.png') no-repeat -85px -133px;
width: 7px;
height: 7px;
float: left;
margin: 3.5pt 4pt 0 0;
}
.button-save:before{
content: "";
background: url('../../view/graphics/jqueryui.png') no-repeat -197px -100px;
width: 7px;
height: 9px;
float: left;
margin: 2.5pt 4pt 0 0;
}
.button-list:before{
content: "";
background: url('../../view/graphics/jqueryui.png') no-repeat -164px -131px;
width: 8px;
height: 11px;
float: left;
margin: 1.5pt 4pt 0 0;
}
.button-magnify:before{
content: "";
background: url('../../view/graphics/jqueryui.png') no-repeat -163px -116px;
width: 10px;
height: 9px;
float: left;
margin: 2pt 4pt 0 0;
}
/* == / end buttons == */
.tooltip {
position: absolute;
z-index: 1070;
display: block;
font-size: 12px;
line-height: 1.4;
visibility: visible;
filter: alpha(opacity=0);
opacity: 0;
}
.tooltip.in {
filter: alpha(opacity=90);
opacity: .9;
}
.tooltip.top {
padding: 5px 0;
margin-top: -3px;
}
.tooltip.right {
padding: 0 5px;
margin-left: 3px;
}
.tooltip.bottom {
padding: 5px 0;
margin-top: 3px;
}
.tooltip.left {
padding: 0 5px;
margin-left: -3px;
}
.tooltip-inner {
max-width: 200px;
padding: 3px 8px;
color: #fff;
text-align: center;
text-decoration: none;
background-color: #000;
border-radius: 4px;
}
.tooltip-arrow {
position: absolute;
width: 0;
height: 0;
border-color: transparent;
border-style: solid;
}
.tooltip.top .tooltip-arrow {
bottom: 0;
left: 50%;
margin-left: -5px;
border-width: 5px 5px 0;
border-top-color: #000;
}
.tooltip.top-left .tooltip-arrow {
bottom: 0;
left: 5px;
border-width: 5px 5px 0;
border-top-color: #000;
}
.tooltip.top-right .tooltip-arrow {
right: 5px;
bottom: 0;
border-width: 5px 5px 0;
border-top-color: #000;
}
.tooltip.right .tooltip-arrow {
top: 50%;
left: 0;
margin-top: -5px;
border-width: 5px 5px 5px 0;
border-right-color: #000;
}
.tooltip.left .tooltip-arrow {
top: 50%;
right: 0;
margin-top: -5px;
border-width: 5px 0 5px 5px;
border-left-color: #000;
}
.tooltip.bottom .tooltip-arrow {
top: 0;
left: 50%;
margin-left: -5px;
border-width: 0 5px 5px;
border-bottom-color: #000;
}
.tooltip.bottom-left .tooltip-arrow {
top: 0;
left: 5px;
border-width: 0 5px 5px;
border-bottom-color: #000;
}
.tooltip.bottom-right .tooltip-arrow {
top: 0;
right: 5px;
border-width: 0 5px 5px;
border-bottom-color: #000;
}
/* == END Tooltips ==
*/
.pages-cost-list{
position: fixed;
top:50px;
left: 50px;
width: 1000px;
height: 80%;
border: 1px solid #000000;
background-color: beige;
padding: 20px 10px 10px 10px;
}
.pages-cost-list-content{
display: block;
position:absolute;
height:auto;
bottom:0;
top:0;
left:0;
right:0;
overflow: auto;
padding: 10px;
margin: 20px 0 0 0;
}
.pages-cost-list-content ul li{
margin:0;
padding: 0;
}
.pages-cost-list-content td{
vertical-align: top;
border-bottom: 1px dotted darkgray;
}
.pages-cost-list-topbar {
background-color: #b0bed9;
height: 20px;
position: absolute;
top: 0;
left: 0;
right: 0;
padding: 0;
}
.pages-cost-list-topbar p{
position: absolute;
float: right;
top: 0;
padding: 0;
margin: 0;
right: 5px;
cursor: none;
height: 20px;
display: block;
}
\ No newline at end of file
/**
* Created by tim on 10/4/14.
*/
var defaultData = [];
defaultData.price = {
ALL: { // Stuff all have to pay, no matter when the come or leave
B_FIX: "9", // Fixkosten (z.B. Kurzreisezuschlag)
RUECK: "2", // Reiserücktrittsversicherung
C_BW: "5.5", // Bettwäsche
E_ESS:"5", // Verpflegung gekauft durch uns
REFRA: "42" // Förderung durch RefRat
},
VAR: { // stuff that has to be paid depending on certain variables
"F_FR": [ // Frühstück
{ "val": "", "ind": false, "an": false, "ab": false },
{ "val": "3.5", "ind": false, "an": false, "ab": false },
{ "val": "3.5", "ind": false, "an": false, "ab": false }
],
"G_MI": [ // Mittag
{ "val": "", "ind": false, "an": false, "ab": false },
{ "val": "", "ind": false, "an": false, "ab": false },
{ "val": "", "ind": false, "an": false, "ab": false }
],
"H_AB": [ // Abendbrot
{ "val": "4.5", "ind": false, "an": false, "ab": false },
{ "val": "", "ind": false, "an": false, "ab": false },
{ "val": "", "ind": false, "an": false, "ab": false }
],
"D_UE": [ // Übernachtung
{ "val": "16", "ind": false, "an": false, "ab": false },
{ "val": "16", "ind": false, "an": false, "ab": false },
{ "val": "", "ind": false, "an": false, "ab": false }
],
"A_FAHRT": [ // Fahrtkosten (z.B. Bus, Bahn)
{ "val": "0", "ind": false, "an": false, "ab": false },
{ "val": "", "ind": false, "an": false, "ab": false },
{ "val": "", "ind": false, "an": false, "ab": false }
]
}
};
defaultData.shopping= [
{ "pos": "Mio Mio Mate", "cnt": "0", "price": "1.00" },
{ "pos": "Knicklichter Industrie", "cnt": "5", "price": "1.70" },
{ "pos": "Knicklichter Persoenlich", "cnt": "0", "price": "25" },
{ "pos": "Grillen Freitag 01", "cnt": "0", "price": "25" },
{ "pos": "Grillen Samstag 01", "cnt": "0", "price": "25" },
{ "pos": "Freitag 02", "cnt": "0", "price": "8.50" },
{ "pos": "Freitag 03", "cnt": "0", "price": "1" },
{ "pos": "Freitag 04", "cnt": "0", "price": "1" },
{ "pos": "Samstag 02", "cnt": "0", "price": "1" },
{ "pos": "Samstag 03", "cnt": "0", "price": "1" },
{ "pos": "Samstag 04", "cnt": "0", "price": "1" },
{ "pos": "Tankkosten", "cnt": "0", "price": "1" },
{ "pos": "Pfand Sa.", "cnt": "0", "price": "1" },
{ "pos": "Pfand So.", "cnt": "0", "price": "1" },
{ "pos": "Freiplätze KiEZ-Karte", "cnt": "0", "price": "1" },
{ "pos": "Freiplätze für fälschlicherweise nicht mitgefahrene Person", "cnt": "0", "price": "1" },
{ "pos": "RRKV", "cnt": "50", "price": "2" }
];
defaultData.receipt = [
{ "pos": "Übernachtung Fr.-Sa.", "cnt": "0", "mul": "50", "price": "16" },
{ "pos": "Frühstück Sa.", "cnt": "0", "mul": "50", "price": "3.50" },
{ "pos": "Abendessen Fr.", "cnt": "0", "mul": "50", "price": "4.50" },
{ "pos": "Grillen Sa.", "cnt": "0", "mul": "50", "price": "3.50" },
{ "pos": "Übernachtung Sa.-So.", "cnt": "0", "mul": "50", "price": "16" },
{ "pos": "Frühstück So.", "cnt": "0", "mul": "50", "price": "3.50" },
{ "pos": "Bettwäsche", "cnt": "0", "mul": "50", "price": "5.50" },
{ "pos": "Freiplätze (hier nur aufführen, bei Einkaufen abrechnen!)", "cnt": "0", "mul": "1", "price": "-43.50" }
];
defaultData.moneyio = {
"in": [
{ "pos": "Pfand", "val": "0" },
{ "pos": "Übertrag WS 17/18", "val": "132.63" }
],
"out": [
{ "pos": "Ausgleich", "val": "0" },
{ "pos": "Übertrag WS 18/19", "val":"132.63" }
]
};
defaultData.other = {
"bezahlt" : 0, // number of people who payed
"count" : 0, // number of valid registrations
"amount" : 0, // amount of money to be collected per person
"back" : [],// list of people, who received money back (structure: von, bis, antyp, abtyp)
"remain" : [],// list of people, who haven't received money yet (structure: von, bis, antyp, abtyp)
"fahrt" : [],// dates of the trip (structure: von, bis)
"arten" : [],
"cnt" : {"all":0, "geman": 0, "gemab":0},
"round" : {"up":0, "down": 0}
};
// module for shared data-management
var dataapp = angular.module("dataapp", []);
/*
Data Handler for price table
*/
dataapp.service('priceData', ["$http", "$rootScope", function ($http, $rootScope) {
var table = this;
table.base = [];
$http.get('?page=cost&ajax=get-price-json').success(function(data){
if(data !== ""){
table.base = data;
console.log("got price table from DB");
} else {
table.base = defaultData.price;
console.error("Price table not loaded from DB - took default!");
}
$rootScope.$broadcast('data::priceUpdated', table.base);
});
// == table data functions ==
table.bez = {
A_FAHRT: "Fahrt",
B_FIX: "Fix",
C_BW: "Bettwäsche",
D_UE: "Übernachtung",
E_ESS: "Essen (wir)",
F_FR: "Frühstück",
G_MI: "Mittag",
H_AB: "Abend"
,
FAHRT: "Fahrtkosten",
ESSEN: "Verpflegung",
FIX: "Fixkosten",
WIR: "Zusatzverpflegung",
UE: "Übernachtung",
RUECK: "Reiserücktrittsversicherung",
REFRA: "(Förderung)"
};
table.calc = {
FAHRT: {
"pos": table.bez.FAHRT,
"sum": function(){
if(!table.base.VAR || !table.base.VAR.A_FAHRT)
return 0;
var tmp = 0;
for(var len = table.base.VAR.A_FAHRT.length; len--;)
tmp += (table.base.VAR.A_FAHRT[len].val * 1);
return tmp;
},
"cnt": function(){
if(!table.base.VAR || !table.base.VAR.A_FAHRT)
return 0;
var tmp = 0;
for(var len = table.base.VAR.A_FAHRT.length; len--;)
if(table.base.VAR.A_FAHRT[len].val > 0)
tmp++;
return tmp;
},
"val": function(){
var tmp = table.calc.FAHRT.cnt();
if(tmp > 0)
return table.calc.FAHRT.sum() / tmp;
return table.calc.FAHRT.sum();
}
},
ESSEN: {
"pos": table.bez.ESSEN,
"sum": function(){
if(!table.base.VAR || !table.base.VAR.H_AB || !table.base.VAR.F_FR || !table.base.VAR.G_MI)
return 0;
var tmp = 0;
for(var len = table.base.VAR.H_AB.length; len--;)
tmp += (table.base.VAR.H_AB[len].val * 1);
for(var len = table.base.VAR.F_FR.length; len--;)
tmp += (table.base.VAR.F_FR[len].val * 1);
for(var len = table.base.VAR.G_MI.length; len--;)
tmp += (table.base.VAR.G_MI[len].val * 1);
return tmp;
},
"cnt": function(){
if(!table.base.VAR || !table.base.VAR.H_AB || !table.base.VAR.F_FR || !table.base.VAR.G_MI)
return 0;
var tmp = 0;
for(var len = table.base.VAR.F_FR.length; len--;)
if(table.base.VAR.F_FR[len].val > 0)
tmp++;
for(var len = table.base.VAR.G_MI.length; len--;)
if(table.base.VAR.G_MI[len].val > 0)
tmp++;
for(var len = table.base.VAR.H_AB.length; len--;)
if(table.base.VAR.H_AB[len].val > 0)
tmp++;
return tmp;
},
"val": function(){
var tmp = table.calc.ESSEN.cnt();
if(tmp > 0)
return table.calc.ESSEN.sum() / tmp;
return table.calc.ESSEN.sum();
}
},
FIX: {
"pos": table.bez.FIX,
"sum": function(){
if(!table.base.ALL || !table.base.ALL.B_FIX || !table.base.ALL.C_BW)
return 0;
return (table.base.ALL.B_FIX * 1) + (table.base.ALL.C_BW * 1);
},
"cnt": function(){
if(!table.base.ALL || !table.base.ALL.B_FIX || !table.base.ALL.C_BW)
return 0;
return (table.base.ALL.B_FIX > 0 ? 1 : 0) + (table.base.ALL.C_BW > 0 ? 1 : 0);
},
"val": function(){
var tmp = table.calc.FIX.cnt();
if(tmp > 0)
return table.calc.FIX.sum() / tmp;
return table.calc.FIX.sum();
}
},
UE: {
"pos": table.bez.UE,
"sum": function(){
if(!table.base.VAR || !table.base.VAR.D_UE)
return 0;
var tmp = 0;
for(var len = table.base.VAR.D_UE.length; len--;)
tmp += (table.base.VAR.D_UE[len].val * 1);
return tmp;
},
"cnt": function(){
if(!table.base.VAR || !table.base.VAR.D_UE)
return 0;
var tmp = 0;
for(var len = table.base.VAR.D_UE.length; len--;)
if(table.base.VAR.D_UE[len].val > 0)
tmp++;
return tmp;
},
"val": function(){
var tmp = table.calc.UE.cnt();
if(tmp > 0)
return table.calc.UE.sum() / tmp;
return table.calc.UE.sum();
}
},
WIR: {
"pos": table.bez.WIR,
"sum": function(){
if(!table.base.ALL || !table.base.ALL.E_ESS)
return 0;
return table.base.ALL.E_ESS * 1;
},
"cnt": function(){
if(!table.base.ALL || !table.base.ALL.E_ESS)
return 0;
return table.base.ALL.E_ESS > 0 ? 1 : 0;
},
"val": function(){
var tmp = table.calc.WIR.cnt();
if(tmp>0)
return table.calc.WIR.sum() / tmp;
return table.calc.WIR.sum();
}
},
RUECK: {
"pos": table.bez.RUECK,
"sum": function(){
if(!table.base.ALL || !table.base.ALL.RUECK)
return 0;
return table.base.ALL.RUECK;
},
"cnt": function(){
return 1;
},
"val": function(){
return table.calc.RUECK.sum();
}
},
X_REFRA: {
"pos": table.bez.REFRA,
"sum": function(){
if(!table.base.ALL || !table.base.ALL.REFRA)
return 0;
return table.base.ALL.REFRA;
},
"cnt": function(){
return 1;
},
"val": function(){
return table.calc.X_REFRA.sum();
}
}
};
table.sum = function(){
return table.calc.ESSEN.sum() + table.calc.WIR.sum() + table.calc.FAHRT.sum() + table.calc.FIX.sum() + table.calc.UE.sum();
}
// receive new base
this.updateBase = function(b){
table.base = b;
$rootScope.$broadcast('data::priceUpdated', table.base);
}
}]);
/*
Data Handler for shopping table
*/
dataapp.service('shoppingData', ["$http", "$rootScope", function ($http, $rootScope) {
var table = this;
table.entries = [];
$http.get('?page=cost&ajax=get-shopping-json').success(function(data){
if(data !== ""){
table.entries = data;
console.log("got shopping table from DB");
} else {
table.entries = defaultData.shopping;
console.error("Shopping table not loaded from DB - took default!");
}
$rootScope.$broadcast('data::shoppingUpdated', table.entries);
});
// === basic table functions ===
table.rowSum = function(row){
return row.cnt*row.price;
};
table.sum = function(){
var ret = 0;
for(var run = 0; run < Object.keys(table.entries).length; run++)
if(!table.entries[run].isDeleted)
ret += table.rowSum(table.entries[run]);
return ret;
};
}]);
/*
Data Handler for receipt table
*/
dataapp.service('receiptData', ["$http", "$rootScope", function ($http, $rootScope) {
var table = this;
table.entries = [];
$http.get('?page=cost&ajax=get-receipt-json').success(function(data){
if(data !== ""){
table.entries = data;
console.log("got receipt table from DB");
} else {
table.entries = defaultData.receipt;
console.error("Receipt table not loaded from DB - took default!");
}
$rootScope.$broadcast('data::receiptUpdated', table.entries);
});
// === basic table functions ===
table.rowSum = function(row){
return row.cnt*row.mul*row.price;
};
table.sum = function(){
var ret = 0;
// console.log(table.entries);
for(var run = 0; run < Object.keys(table.entries).length; run++) {
if(!table.entries[run].isDeleted) {
ret += table.rowSum(table.entries[run]);
}
}
return ret;
};
}]);
/*
Data Handler for moneyio table
*/
dataapp.service('moneyioData', ["$http", "$rootScope", function ($http, $rootScope) {
var table = this;
table.entries = {
"in": [],
"out": []
};
$http.get('?page=cost&ajax=get-moneyio-json').success(function(data){
if(data !== ""){
table.entries = data;
console.log("got moneyio table from DB");
} else {
table.entries = defaultData.moneyio;
console.error("moneyio table not loaded from DB - took default!");
}
$rootScope.$broadcast('data::moneyioUpdated', table.entries);
});
// === basic table functions ===
table.colSum = function(col, ecol){
var ret = 0;
for(var i = col.length; i--;){
if(!col[i].isDeleted)
ret += 1*col[i].val;
}
for(var row in ecol){
ret += ecol[row].val;
}
return ret;
};
table.diffR = function(ex){
var cp = jQuery.extend(true, {}, ex);
delete cp.out.POUT;
delete cp.in.PVOR;
return table.diff(cp);
};
table.diffRColor = function(ex){
var cp = jQuery.extend(true, {}, ex);
delete cp.out.POUT;
delete cp.in.PVOR;
return table.diffColor(cp);
};
table.diff = function(ex){
return table.colSum(table.entries.in, ex.in) - table.colSum(table.entries.out, ex.out);
};
table.diffColor = function(ex){
var tolerance = 50; // specify the tolerance of diff
var diff = table.diff(ex);
var color = "";
if(diff < 0)
color = "red";
else if(diff >= 0 && diff <= tolerance)
color = "green";
else if(diff > tolerance)
color = "yellow";
return color;
};
}]);
/*
Data Handler for other mixed data
*/
dataapp.service('otherData', ["$http", "$rootScope", "priceData", function ($http, $rootScope, priceData) {
/*defaultData.other = {
"bezahlt" : 0, // number of people who payed
"count" : 0, // number of valid registrations
"amount" : 0, // amount of money to be collected per person
"back" : [],// list of people, who received money back (structure: von, bis, antyp, abtyp)
"remain" : [],// list of people, who haven't received money yet (structure: von, bis, antyp, abtyp)
"fahrt" : [] // dates of the trip (structure: von, bis)
"arten"
};*/
var data = defaultData.other;
var base = priceData.base;
var fdays = [];
var func = this;
$http.get('?page=cost&ajax=get-other-json').success(function(dat){
if(dat !== ""){
data = dat;
console.log("got moneyio table from DB");
} else {
console.error("other data not loaded from DB - took default!");
}
fdays = func.getDays(data.fahrt.von, data.fahrt.bis);
$rootScope.$broadcast('data::otherUpdated', data);
});
$rootScope.$on('data::priceUpdated', function(event, newTab) {
base = newTab;
console.log("data in other service received");
});
// === Data aggregation functions ===
// == local functions ==
// get js Date from a YYYY-mm-dd string (today if not a string or wrong format)
func.getDate = function(str){
if(!(typeof str == "string"))
return new Date();
var split = str.split("-");
if(split.length<3 || split.length>3)
return new Date();
return new Date(split[0],split[1]-1, split[2]);
};
// get YYYY-mm-dd string from js date object (today if not a date)
func.dateToStr = function(d){
if(!typeof d == "Date")
d = new Date();
return d.getFullYear() + "-" + (d.getMonth()+1) + "-" + d.getDate();
};
// get next day of js Date object (tomorrow if not a date)
func.nextDay = function(d){
if(!typeof d == "Date")
d = new Date();
d.setDate(d.getDate()+1);
};
// get array of dates between two dates (given as YYYY-mm-dd string) returns datestrings as key and value is daycount
// maximum number of entries: 10
func.getDays = function(vonn, biss){
var von = func.getDate(vonn);
var tmp = func.getDate(vonn);
var bis = func.getDate(biss);
var days = [];
for(var i = 0; tmp <= bis && i < 10; i++){ // maximum of 10 days (just in case)
days[func.dateToStr(tmp)] = i;
func.nextDay(tmp);
}
return days;
};
// gets the difference of start days (returns 0 on errors)
func.startOffset = function(f,p){
for(var k in p){
if(p[k]==0){
if(k in f)
return f[k];
else
return 0;
}
}
return 0;
};
// == public functions ==
// amount to be paid to person (returns array: [val:<amount to pay>, pos:[{pos:<position>, val:<value>},...])
this.repayAmount = function(person){
var pos = [];
if(base.ALL && base.VAR){
pos[pos.length] = {"pos": "(Vorkasse)", "val": data.amount};
pos[pos.length] = {"pos": priceData.bez.REFRA, "val": base.ALL.REFRA};
pos[pos.length] = {"pos": priceData.bez.B_FIX, "val": (-1)*base.ALL.B_FIX};
pos[pos.length] = {"pos": priceData.bez.C_BW, "val": (-1)*base.ALL.C_BW};
pos[pos.length] = {"pos": priceData.bez.E_ESS, "val": (-1)*base.ALL.E_ESS};
// person: Object {von: "2013-10-18", bis: "2013-10-20", antyp: "gemeinsam mit Bus/Bahn", abtyp: "gemeinsam mit Bus/Bahn"}
// fahrt: Object {von: "2013-10-25", bis: "2013-10-27"}
var pdays = func.getDays(person.von, person.bis);
var firstDay = true, lastDay = false;
var startOffset = func.startOffset(fdays,pdays);
var indAn = data.arten.BUSBAHN != person.antyp;
var indAb = data.arten.BUSBAHN != person.abtyp;
for(var pday in pdays){
firstDay = (pdays[pday] == 0 );
lastDay = (pdays[pday] == (Object.keys(pdays).length - 1));
var index = 0;
for(var tpos in base.VAR){ // for each position of base table
index = pdays[pday]+startOffset;
if(index in base.VAR[tpos] && base.VAR[tpos][index].val > 0){
if(firstDay){
if(base.VAR[tpos][index].an){
if(!indAn || (indAn &&base.VAR[tpos][index].ind)){
pos[pos.length] = {"pos": priceData.bez[tpos], "val": (-1)*base.VAR[tpos][index].val};
}
}
} else if(lastDay){
if(base.VAR[tpos][index].ab){
if(!indAb || (indAb &&base.VAR[tpos][index].ind)){
pos[pos.length] = {"pos": priceData.bez[tpos], "val": (-1)*base.VAR[tpos][index].val};
}
}
} else {
pos[pos.length] = {"pos": priceData.bez[tpos], "val": (-1)*base.VAR[tpos][index].val};
}
}
}
}
}
var val = 0;
for(var len = pos.length; len--;){
val += pos[len].val*1;
}
return {"val": ((val>data.amount) ? data.amount : val), "rval": val, "pos": pos};
};
// get list of persons with the attached amounts + sum
this.getPaymentList = function(){
var ret = {
"repaid": [],
"toPay": []
};
for(var len = data.back.length; len--;){
ret.repaid[ret.repaid.length] = {
"id": data.back[len].bachelor_id,
"name": data.back[len].forname + " " + data.back[len].sirname,
"pay": this.repayAmount(data.back[len]),
"person": data.back[len]
};
}
for(var len = data.remain.length; len--;){
ret.toPay[ret.toPay.length] = {
"id": data.remain[len].bachelor_id,
"name": data.remain[len].forname + " " + data.remain[len].sirname,
"pay": this.repayAmount(data.remain[len]),
"person": data.remain[len]
};
}
return ret;
};
// sum of all amounts that have been paid back
this.repaidSum = function(){
var ret = 0;
for(var len = data.back.length; len--;){
ret += this.repayAmount(data.back[len]).val * 1;
}
return ret;
};
// sum of all amounts that still have to be paid back
this.toPaySum = function(){
var ret = 0;
for(var len = data.remain.length; len--;){
ret += this.repayAmount(data.remain[len]).val * 1;
}
return ret;
};
// sum of all amounts paid back or still to be paid back
this.paySum = function(){
return this.repaidSum() * 1 + this.toPaySum() * 1;
};
// product of amount to be paid and number of people who paid
this.intakeSum = function(){
return data.amount * data.bezahlt;
};
this.toIntakeSum = function(){
return data.amount * (data.count-data.bezahlt);
};
// update amount function
this.updateAmount = function(a){
data.amount = a;
}
}]);
/* END: Data Module
========================================================================================================================
now the individual controllers and modules for each table....
*/
/* MAIN module */
(function() {
var app = angular.module('pages-cost', ['price','shopping','receipt','moneyio']);
app.filter('currency', ["$filter", function($filter) {
return function(input, curSymbol, decPlaces, thouSep, decSep) {
curSymbol = curSymbol || "";
decPlaces = decPlaces || 2;
thouSep = thouSep || " ";
decSep = decSep || ".";
// Check for invalid inputs
var out = isNaN(input) || input === '' || input === null ? 0.0 : input;
//Deal with the minus (negative numbers)
var minus = input < 0;
out = Math.abs(out);
out = $filter('number')(out, decPlaces);
// Replace the thousand and decimal separators.
// This is a two step process to avoid overlaps between the two
if(thouSep != ",") out = out.replace(/\,/g, "T");
if(decSep != ".") out = out.replace(/\./g, "D");
out = out.replace(/T/g, thouSep);
out = out.replace(/D/g, decSep);
// Add the minus and the symbol
if(minus){
return "-" + out + curSymbol;
}else{
return out + curSymbol;
}
}
}]);
})();
/* ****************************************************************
* pricetable module
*/
(function() {
var app = angular.module('price', ["xeditable", 'mgcrea.ngStrap.tooltip', 'dataapp']);
app.directive("tablePrice", function() {
return {
restrict: 'E',
templateUrl: "pages_cost/table-price.html",
link: function(scope, parent){
scope.showdetails = false;
scope.toggleDetails = function(){
scope.showdetails = scope.showdetails == false;
}
}
};
});
app.directive("tablePriceList", function() {
return {
restrict: 'E',
templateUrl: "pages_cost/table-price-list.html"
};
});
app.directive("tablePriceEdit", function() {
return {
restrict: 'E',
templateUrl: "pages_cost/table-price-edit.html",
link: function(scope, parent){
scope.tooltip = [];
scope.tooltip.ind = {
"title": "Auch für individuell Reisende zu zahlen",
"checked": false
};
scope.tooltip.an = {
"title": "Auch zu zahlen, wenn Anreise an dem Tag",
"checked": false
};
scope.tooltip.ab = {
"title": "Auch zu zahlen, wenn Abreise an dem Tagn",
"checked": false
};
}
};
});
app.directive("tablePriceHelper", function() {
return {
restrict: 'E',
templateUrl: "pages_cost/table-price-helper.html",
link: function(scope, parent){
scope.helpermod = 0;
scope.cnt = 0;
scope.special = 0;
scope.summy = function(tab){
var ret = 0;
var mul = 1;
for(var len = tab.in.length; len--;){
mul = 1;
if(tab.in[len].selected){
if(tab.in[len].neg) mul = -1;
ret += tab.in[len].val*mul;
}
}
for(var len = tab.out.length; len--;){
mul = 1;
if(tab.out[len].selected){
if(tab.out[len].neg) mul = -1;
ret += tab.out[len].val*mul;
}
}
ret += scope.special*1;
return ret;
};
scope.resetty = function(tab){
for(var len = tab.in.length; len--;){
delete tab.in[len].selected;
delete tab.in[len].neg;
}
for(var len = tab.out.length; len--;){
delete tab.out[len].selected;
delete tab.out[len].neg;
}
scope.special = 0;
};
scope.meaner = function(tab){
if(scope.cnt<1) scope.cnt = 1;
var proPrs = scope.summy(tab) / scope.cnt;
return proPrs;
}
}
};
});
app.controller('TablePriceController', ["$http", "$scope", "priceData", "otherData", "moneyioData", function($http, $scope, priceData, otherData, moneyioData){
var table = this;
table.editmode = false;
table.listmode = false;
table.edit = [];
table.list = [];
// === Data Binding stuff ==
$scope.dataService = priceData;
$scope.otherDataService = otherData;
$scope.moneyioDataService = moneyioData;
table.base = $scope.dataService.base;
table.calc = $scope.dataService.calc;
table.bez = $scope.dataService.bez;
table.amount = $scope.otherDataService.amount;
table.io = $scope.moneyioDataService.entries;
table.cnt = [];
$scope.$on('data::priceUpdated', function(event, newTab) {
table.base = newTab;
console.log("data in price controller received");
});
$scope.$on('data::otherUpdated', function(event, newTab) {
table.amount = newTab.amount;
table.cnt = newTab.cnt;
console.log("amount in price controller received");
});
$scope.$on('data::moneyioUpdated', function(event, newTab) {
table.io = newTab;
console.log("amount in price controller received");
});
$scope.$watch('table.base', function() {
if(table.base && $scope.dataService.base){
$scope.dataService.base = table.base;
}
});
// == table manipulation functions ==
table.toggleEditmode = function(){
table.editmode = table.editmode == false;
};
table.toggleListmode = function(){
table.listmode = table.listmode == false;
};
table.listPay = function(){
table.list = $scope.otherDataService.getPaymentList();
table.toggleListmode();
};
table.editTable = function(){
table.edit = jQuery.extend(true, {}, table.base);
table.io = jQuery.extend(true, {}, table.io);
table.toggleEditmode();
};
table.saveTable = function(){
table.base = jQuery.extend(true, {}, table.edit);
writeTextFile("KostenpP("+JSON.stringify(table.edit)+") wird gespeichert.");
$http.post('?page=cost&ajax=set-price-json', table.edit).success(function(data, status, headers, config){
toastr.success('Saved to Database! (price)');
});
$http.get('?page=cost&ajax=set-amount&data='+table.amount).success(function(data){
toastr.success('Saved to Database! (amount)');
});
$scope.otherDataService.updateAmount(table.amount);
$scope.dataService.updateBase(table.base);
table.toggleEditmode();
};
table.cancelTable = function(){
table.edit = [];
table.toggleEditmode();
};
table.editUpdateAll = function(val, pos){
table.edit.ALL[pos] = val;
};
}]);
})();
/* ****************************************************************
* shoppingtable module
*/
(function() {
var app = angular.module('shopping', ["xeditable", "dataapp"]);
app.run(function(editableOptions) {
editableOptions.theme = 'bs3';
});
app.directive("tableShopping", function() {
return {
restrict: 'E',
templateUrl: "pages_cost/table-shopping.html"
};
});
app.controller('TableShoppingController', ["$scope", "$filter", "$q", "$http", "shoppingData", function($scope, $filter, $q, $http, shoppingData){
var table = this;
// === Data Binding stuff ==
$scope.dataService = shoppingData;
table.entries = $scope.dataService.entries;
$scope.$on('data::shoppingUpdated', function(event, newTab) {
table.entries = newTab;
console.log("data in shopping controller received");
});
$scope.$watch('table.entries', function() {
if(table.entries && $scope.dataService.entries){
$scope.dataService.entries = table.entries;
}
});
// === edit table functions ===
// filter rows to show
$scope.filterRow = function(row) {
return row.isDeleted !== true;
};
// mark row as deleted
$scope.deleteRow = function(index) {
table.entries[index].isDeleted = true;
};
$scope.chang = function(index, prop, dat){
table.entries[index][prop] = dat;
};
// add row
$scope.addRow = function() {
table.entries.push({
pos: "",
cnt: 1,
price: 0,
isNew: true
});
};
// save copy of table before editing to have something to reset to
$scope.prepareForm = function(){
// table.orig = jQuery.extend(true, {}, table.entries);
table.orig = table.entries.slice();
};
// cancel all changes
$scope.cancel = function() {
table.entries = table.orig.slice();
// table.entries = jQuery.extend(true, {}, table.orig);
table.orig = [];
};
// save edits
$scope.saveTable = function() {
var results = [];
var arr = Array.from(table.entries);
console.log(arr);
console.log(table.entries);
for (var i = table.entries.length; i--;) {
var row = table.entries[i];
if(row.isDeleted) {
writeTextFile("Einkauf("+row.pos+", "+row.cnt+", "+row.price+" Geld"+") wurde gelöscht.");
}else if(row.isNew) {
writeTextFile("Einkauf("+row.pos+", "+row.cnt+", "+row.price+" Geld"+") wurde erstellt.");
}else{
writeTextFile("Einkauf("+row.pos+", "+row.cnt+", "+row.price+" Geld"+") wurde gespeichert.");
}
// actually delete row
if (row.isDeleted) {
table.entries.splice(i, 1);
}
// mark as not new
if (row.isNew) {
delete row.isNew;
}
}
table.orig = [];
$http.post('?page=cost&ajax=set-shopping-json', table.entries).success(function(data, status, headers, config){
toastr.success('Saved to Database!')
});
return $q.all(results);
};
}]);
})();
/* ****************************************************************
* receipttable module
*/
(function() {
var app = angular.module('receipt', ["xeditable", 'dataapp']);
app.directive("tableReceipt", function() {
return {
restrict: 'E',
templateUrl: "pages_cost/table-receipt.html"
};
});
app.controller('TableReceiptController', ["$scope", "$filter", "$q", "$http", "receiptData", function($scope, $filter, $q, $http, receiptData){
var table = this;
// === Data Binding stuff ==
$scope.dataService = receiptData;
table.entries = $scope.dataService.entries;
$scope.$on('data::receiptUpdated', function(event, newTab) {
table.entries = newTab;
// console.log(newTab);
console.log("data in receipt controller received");
});
$scope.$watch('table.entries', function() {
if(table.entries && $scope.dataService.entries){
$scope.dataService.entries = table.entries;
}
});
// === edit table functions ===
// filter rows to show
$scope.filterRow = function(row) {
return row.isDeleted !== true;
};
// mark row as deleted
$scope.deleteRow = function(index) {
console.log(index);
table.entries[index].isDeleted = true;
};
$scope.chang = function(index, prop, dat){
table.entries[index][prop] = dat;
};
// add row
$scope.addRow = function() {
table.entries.push({
pos: "",
cnt: 1,
mul: 1,
price: 0,
isNew: true
});
};
// save copy of table before editing to have something to reset to
$scope.prepareForm = function(){
table.orig = table.entries.slice();
// table.orig = jQuery.extend(true, {}, table.entries);
};
// cancel all changes
$scope.cancel = function() {
table.entries = table.orig.slice();
// table.entries = jQuery.extend(true, {}, table.orig);
table.orig = [];
};
// save edits
$scope.saveTable = function() {
var results = [];
for (var i = Object.keys(table.entries).length; i--;) {
var row = table.entries[i];
if(row.isDeleted) {
writeTextFile("Herberge("+row.pos+", "+row.cnt+", "+row.mul+", "+row.price+" Geld"+") wurde gelöscht.");
}else if(row.isNew) {
writeTextFile("Herberge("+row.pos+", "+row.cnt+", "+row.mul+", "+row.price+" Geld"+") wurde erstellt.");
}else{
writeTextFile("Herberge("+row.pos+", "+row.cnt+", "+row.mul+", "+row.price+" Geld"+") wurde gespeichert.");
}
// actually delete row
if (row.isDeleted) {
table.entries.splice(i, 1);
}
// mark as not new
if (row.isNew) {
delete row.isNew;
}
}
table.orig = [];
$http.post('?page=cost&ajax=set-receipt-json', table.entries).success(function(data, status, headers, config){
toastr.success('Saved to Database!')
});
return $q.all(results);
};
}]);
})();
/* ****************************************************************
* moneyIO module
*/
(function() {
var app = angular.module('moneyio', [ "xeditable", 'dataapp']);
app.directive("tableMoneyio", function() {
return {
restrict: 'E',
templateUrl: "pages_cost/table-moneyio.html"
};
});
app.directive("tableMoneyioCol", ["currencyFilter", function(currency) {
return {
restrict: 'E',
templateUrl: "pages_cost/table-moneyio-col.html",
transclude: true,
scope: {
col: '=',
io: '@',
tform: '=',
extra: '='
},
link: function(scope, element) {
scope.filterRow = function(row) {
return row.isDeleted !== true;
};
scope.chang = function(row, cell, val){
row[cell] = val;
}
scope.curr = function(e){
return currency(e);
}
}
};
}]);
app.controller('TableMoneyioController',
["$scope", "$filter", "$q", "$http", "moneyioData", "otherData", "receiptData", "shoppingData",
function($scope, $filter, $q, $http, moneyioData, otherData, receiptData, shoppingData) {
var table = this;
// === Data Binding stuff ==
$scope.moneyioDataService = moneyioData;
$scope.otherDataService = otherData;
$scope.receiptDataService = receiptData;
$scope.shoppingDataService = shoppingData;
table.entries = $scope.moneyioDataService.entries;
table.orig = [];
table.extra = {
"in": {
VOR: {"pos": "Vorkasse", "val": 0},
PVOR: {"pos": "Vorkasse (ausstehend)", "val": 0}
},
"out":{
REC: {"pos": "Herberge", "val": 0},
KAUF: {"pos": "Einkauf", "val": 0},
OUT: {"pos": "Rückzahlungen (getätigt)", "val": 0},
POUT: {"pos": "Rückzahlungen (ausstehend)", "val": 0}
}
};
$scope.$on('data::moneyioUpdated', function(event, newTab) {
table.entries = newTab;
console.log("data in moneyio controller received");
});
$scope.$on('data::otherUpdated', function(event, newTab) {
table.extra.in.VOR.val = $scope.otherDataService.intakeSum();
table.extra.in.PVOR.val = $scope.otherDataService.toIntakeSum();
table.extra.out.OUT.val = $scope.otherDataService.repaidSum();
table.extra.out.POUT.val = $scope.otherDataService.toPaySum();
console.log("other in moneyio controller received");
});
$scope.$on('data::receiptUpdated', function(event, newTab) {
table.extra.out.REC.val = $scope.receiptDataService.sum();
table.extra.out.KAUF.val = $scope.shoppingDataService.sum();
table.extra.in.VOR.val = $scope.otherDataService.intakeSum();
table.extra.in.PVOR.val = $scope.otherDataService.toIntakeSum();
table.extra.out.OUT.val = $scope.otherDataService.repaidSum();
table.extra.out.POUT.val = $scope.otherDataService.toPaySum();
console.log("receipt in moneyio controller received");
});
$scope.$watch('table.entries', function() {
if(table.entries && $scope.moneyioDataService.entries){
$scope.moneyioDataService.entries = table.entries;
}
});
// === edit table functions ===
// mark row as deleted
$scope.deleteRow = function(col,index) {
console.log("deleteRow called");
table.entries[col][index].isDeleted = true;
};
// add row
$scope.addRow = function(col) {
col.push({
pos: "",
val: 0,
isNew: true
});
};
// save copy of table before editing to have something to reset to
$scope.prepareForm = function(){
// table.orig = table.entries.slice();
table.orig = jQuery.extend(true, {}, table.entries);
};
// cancel all changes
$scope.cancel = function() {
// table.entries = table.orig.slice();
table.entries = jQuery.extend(true, {}, table.orig);
table.orig = [];
};
// save edits
$scope.saveTable = function() {
var results = [];
var salbei = function(col){
for (var i = col.length; i--;) {
var row = col[i];
console.log(row.pos+", "+row.val+" Geld");
if(row.isDeleted) {
writeTextFile("IO("+row.pos+", "+row.val+" Geld"+") wurde gelöscht.");
}else if(row.isNew) {
writeTextFile("IO("+row.pos+", "+row.val+" Geld"+") wurde erstellt.");
}else{
writeTextFile("IO("+row.pos+", "+row.val+" Geld"+") wurde gespeichert.");
}
// actually delete row
if (row.isDeleted) {
col.splice(i, 1);
}
// mark as not new
if (row.isNew) {
delete row.isNew;
}
}
}
salbei(table.entries.in);
salbei(table.entries.out);
table.orig = [];
$http.post('?page=cost&ajax=set-moneyio-json', table.entries).success(function(data, status, headers, config){
toastr.success('Saved to Database!')
});
return $q.all(results);
};
}]);
})();
/* ======================================================
Logfile
*/
function writeTextFile(output) {
$.ajax({
type:"POST",
data:"logging="+output,
url: "pages_cost/logger.php",
success: function(data){
// alert('Written in Log File');
}
});
}
/* ======================================================================================================
Mülltonne
*/
/*
var dataapp = angular.module("tabdata",[]);
dataapp.factory("DataService", ["$http", "$rootScope", function($http, $rootScope){
var dataService = {
tableShoppingData: { entries: [] }
};
$http.get('?page=cost&ajax=get-shopping-json').success(function(data){
if(data !== ""){
dataService.tableShoppingData.entries = data;
$rootScope.$broadcast("valuesUpdated");
}
});
return dataService;
}]);
dataapp.controller('dataController', function($scope, dataService) {
$scope.shared = dataService;
});*/
/*
inject data to shopping
var tmp =
[
{
"pos": "Limonade",
"cnt": "76",
"price": "1.43"
},
{
"pos": "Brause",
"cnt": "42",
"price": "0.83"
},
{
"pos": "Lutscher",
"cnt": "1",
"price": "0.5"
},
];
*/
\ No newline at end of file
<table class="cost-table">
<thead>
<tr>
<th>Position - {{io}}</th>
<th>Summe</th>
<th ng-show="tform.$visible"></th>
</tr>
</thead>
<tbody>
<!-- extra -->
<tr ng-repeat="(key,row) in extra">
<td>{{row.pos || "&nbsp;" }}</td>
<td class="cost-table-numeric">{{row.val || 0 | currency}}</td>
<td ng-show="tform.$visible"></td>
</tr>
<!-- editable stuff -->
<tr ng-repeat="row in col | filter:filterRow">
<td>
<span editable-text="row.pos" e-form="tableform" e-ng-change="chang(row, 'pos', $data)">
{{row.pos || "&nbsp;" }}
</span>
</td>
<td class="cost-table-numeric">
<span editable-text="row.val" e-form="tableform" e-style="width: 35pt" e-ng-change="chang(row, 'val', $data)">
{{row.val || 0 | currency}}
</span>
</td>
<td ng-show="tform.$visible" style="vertical-align: bottom;"><button type="button" ng-click="$parent.$parent.deleteRow(io,$index)" class="button-delete">del</button></td>
</tr>
</tbody>
</table>
<button type="button" ng-disabled="tform.$waiting" ng-show="tform.$visible" ng-click="$parent.addRow(col)" class="button-add">add row</button>
\ No newline at end of file
<form editable-form name="tableform" onaftersave="saveTable()" oncancel="cancel()" onshow="prepareForm()">
<table class="table-moneyio">
<tr>
<td>
<table-moneyio-col col="table.entries.in" extra="table.extra.in" io="in" tform="tableform"></table-moneyio-col>
</td>
<td>
<table-moneyio-col col="table.entries.out" extra="table.extra.out" io="out" tform="tableform"></table-moneyio-col>
</td>
<td></td>
<td></td>
</tr>
<tr>
<td class="cost-table-numeric table-moneyio-sum">{{ moneyioDataService.colSum(table.entries.in, table.extra.in) | currency }}</td>
<td class="cost-table-numeric table-moneyio-sum">{{ moneyioDataService.colSum(table.entries.out, table.extra.out) | currency }}</td>
<td class="cost-table-numeric table-moneyio-sum" ng-class="{red:'red-text', yellow:'yellow-text', green: 'green-text'}[moneyioDataService.diffColor(table.extra)]" data-type="info" data-title="Differenz (Prognose)" bs-tooltip>{{ moneyioDataService.diff(table.extra) | currency }}</td>
<td class="cost-table-numeric table-moneyio-sum" ng-class="{red:'red-text', yellow:'yellow-text', green: 'green-text'}[moneyioDataService.diffRColor(table.extra)]" data-type="info" data-title="Differenz (Real)" bs-tooltip>{{ moneyioDataService.diffR(table.extra) | currency }}</td>
</tr>
</table>
<!-- buttons -->
<div class="btn-edit">
<button type="button" class="button-edit" ng-show="!tableform.$visible" ng-click="tableform.$show()">edit</button>
</div>
<div class="btn-form" ng-show="tableform.$visible">
<button type="submit" ng-disabled="tableform.$waiting" class="button-save">save</button> |
<button type="button" ng-disabled="tableform.$waiting" ng-click="tableform.$cancel()" class="button-cancel">cancel</button>
</div>
</form>
<div class="debug" style="margin-top: 30px;">
{{ table.entries || "&nbsp;" | json }}
</div>
<div class="debug" style="margin-top: 30px;">
{{ table.extra || "&nbsp;" | json }}
</div>
\ No newline at end of file
<div ng-show="table.editmode" class="pages-cost-edit">
<div style="float: left">
<table>
<thead>
<tr>
<th>&nbsp;</th>
<th>Tag 1</th>
<th>Tag 2</th>
<th>Tag 3</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="(key,row) in table.edit.VAR">
<td>{{table.bez[key]}}</td>
<td ng-repeat="col in row">
<input ng-model="col.val" type="input" name="{{key}}.val" />
<input ng-model="col.ind" type="checkbox" name="{{key}}.ind" data-placement="top-left" data-type="info" data-title="{{tooltip.ind.title}}" bs-tooltip />
<input ng-model="col.an" type="checkbox" name="{{key}}.an" data-placement="top-left" data-type="info" data-title="{{tooltip.an.title}}" bs-tooltip />
<input ng-model="col.ab" type="checkbox" name="{{key}}.ab" data-placement="top-left" data-type="info" data-title="{{tooltip.ab.title}}" bs-tooltip />
</td>
</tr>
<tr class="deviderrow"><td colspan="4"></td></tr>
<tr ng-repeat="(key,val) in table.edit.ALL">
<td>{{table.bez[key]}}</td>
<td colspan="3">
<input ng-model="val" type="text" name="{{key}}" ng-change="table.editUpdateAll(val,'{{key}}')" />
</td>
</tr>
<tr>
<td>(Vorkasse)</td>
<td colspan="3">
<input ng-model="table.amount" type="text" name="table.amount" />
</td>
</tr>
</tbody>
</table>
<button type="button" ng-click="table.saveTable()" class="button-save">save</button> |
<button type="button" ng-click="table.cancelTable()" class="button-cancel">cancel</button>
</div>
<div style="float: left; margin-left: 20px; width: 400px;">
<table-price-helper></table-price-helper>
</div>
<div style="clear: both"></div>
<div class="debug" style="margin-top: 30px;">
{{ table.edit | json }}
</div>
</div>
\ No newline at end of file
<h2 style="margin-top: 0">Hilfsrechner</h2>
Zu verteilende Posten wählen: <span ng-click="resetty(table.io)">[reset]</span><br />
<br />
IN:
<ul style="list-style: none;">
<li ng-repeat="entry in table.io.in">
<input type="checkbox" ng-model="entry.neg" data-placement="top-left" data-type="info" data-title="negative" bs-tooltip />
<label><input type="checkbox" ng-model="entry.selected" /> {{entry.pos}} ({{entry.val || 0 | currency}})</label>
</li>
</ul>
OUT:
<ul style="list-style: none;">
<li ng-repeat="entry in table.io.out">
<input type="checkbox" ng-model="entry.neg" data-placement="top-left" data-type="info" data-title="negative" bs-tooltip />
<label><input type="checkbox" ng-model="entry.selected" /> {{entry.pos}} ({{entry.val || 0 | currency}})</label>
</li>
</ul>
<label>Sontiges: <input type="text" style="width: 30pt" ng-model="special" /></label><br />
<br />
Einschränken auf:<br />
<label><input type="radio" ng-model="cnt" value="{{table.cnt.geman}}"> gemeinsam hin</label>
<label><input type="radio" ng-model="cnt" value="{{table.cnt.gemab}}"> gemeinsam rück</label><br />
<label><input type="radio" ng-model="cnt" value="{{table.cnt.all}}" ng-selected="{{table.cnt.all}}"> none</label><br />
<br />
Gewählte Summe: {{summy(table.io) || 0 | currency}}<br />
Anzahl Personen: {{cnt}} <br />
Betrag pro Person: {{meaner(table.io) || 0 | currency}}<br />
<!--<label><input type="radio" ng-model="round" value="{{table.round.up}}"> Aufrunden</label>
<label><input type="radio" ng-model="round" value="{{table.round.dwn}}" ng-selected="{{table.round.dwn}}"> Abrunden</label>-->
\ No newline at end of file
<div ng-show="table.listmode" class="pages-cost-list">
<div class="pages-cost-list-topbar"><p ng-click="table.toggleListmode()">X</p></div>
<div class="pages-cost-list-content">
<button type="button" ng-click="toggleDetails()" class="button-magnify">Details</button><br />
<br />
<div ng-repeat="(key,col) in table.list" style="float: left; width: 460px; border-right: 1px dashed #d3d3d3; padding: 10px 15px">
<h1>{{key}}</h1>
<table >
<thead>
<tr>
<th style="width: 30%; text-align: left;">Name + ID</th>
<th style="width: 70%; text-align: left;">Details</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="row in col">
<td>{{row.name}} ({{row.id}})</td>
<td>
<strong>{{row.pay.val || 0 | currency}}</strong> ({{row.pay.rval || 0 | currency}})<br />
{{row.person.von}} <br />
({{row.person.antyp}})<br />
{{row.person.bis}}<br />
({{row.person.abtyp}})<br />
<br />
<ul ng-repeat="entry in row.pay.pos" ng-show="showdetails">
<li>{{entry.pos}}: {{entry.val || 0 | currency}}</li>
</ul>
</td>
</tr>
</tbody>
</table>
</div>
<div class="debug" style="margin-top: 30px;">
{{ otherDataService.getPaymentList() | json }}
</div>
</div>
</div>
\ No newline at end of file
<table class="cost-table">
<thead>
<tr>
<th>Position</th>
<th>Anzahl (normal)</th>
<th>Satz (est)</th>
<th>Summe</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="row in dataService.calc">
<td>{{row.pos}}</td>
<td class="cost-table-numeric">{{row.cnt()}}</td>
<td class="cost-table-numeric">{{row.val() | currency}}</td>
<td class="cost-table-numeric">{{row.sum() | currency}}</td>
</tr>
<tr>
<td>(Vorkasse)</td>
<td></td>
<td></td>
<td>{{table.amount || 0 | currency}}</td>
</tr>
</tbody>
<tfoot>
<tr>
<td class="cost-table-invisible"></td>
<td class="cost-table-invisible"></td>
<td class="cost-table-invisible"></td>
<td>{{dataService.sum() | currency}}</td>
</tr>
</tfoot>
</table>
<button type="button" ng-click="table.editTable()" class="button-edit" ng-hide="table.editmode" >edit</button>
<table-price-edit></table-price-edit>
<button type="button" ng-click="table.listPay()" class="button-list" ng-hide="table.listmode">Liste</button>
<table-price-list></table-price-list>
<div class="debug" style="margin-top: 30px;">
{{ table.base || "&nbsp;" | json }}
</div>
<div class="debug" style="margin-top: 30px;">
{{ dataService.base || "&nbsp;" | json }}
</div>
\ No newline at end of file
<form editable-form name="tableform" onaftersave="saveTable()" oncancel="cancel()" onshow="prepareForm()">
<table class="cost-table" id="">
<thead>
<tr>
<th>Position</th>
<th>Menge</th>
<th>Anzahl</th>
<th>Satz</th>
<th>Summe</th>
<th></th>
</tr>
</thead>
<tbody>
<tr ng-repeat="row in table.entries | filter:filterRow">
<td>
<span editable-text="row.pos" e-form="tableform" e-ng-change="chang($index, 'pos', $data)">
{{ row.pos || '&nbsp;' }}
</span>
</td>
<td class="cost-table-numeric" >
<span editable-text="row.cnt" e-form="tableform" e-style="width: 20pt" e-ng-change="chang($index, 'cnt', $data)">
{{ row.cnt || 1 }}
</span>
</td>
<td class="cost-table-numeric" >
<span editable-text="row.mul" e-form="tableform" e-style="width: 20pt" e-ng-change="chang($index, 'mul', $data)">
{{ row.mul || 1 }}
</span>
</td>
<td class="cost-table-numeric" >
<span editable-text="row.price" e-form="tableform" e-style="width: 30pt" e-ng-change="chang($index, 'price', $data)">
{{ row.price || 0 | currency}}
</span>
</td>
<td class="cost-table-numeric" >{{ dataService.rowSum(row) | currency}}</td>
<td><button type="button" ng-show="tableform.$visible" ng-click="deleteRow($index)" class="button-delete">del</button></td>
</tr>
</tbody>
<tfoot>
<tr>
<td class="cost-table-invisible"></td>
<td class="cost-table-invisible"></td>
<td class="cost-table-invisible"></td>
<td class="cost-table-invisible"></td>
<td>{{dataService.sum() | currency}}</td>
<td></td>
</tr>
</tfoot>
</table>
<!-- buttons -->
<div class="btn-edit">
<button type="button" class="button-edit" ng-show="!tableform.$visible" ng-click="tableform.$show()">edit</button>
</div>
<div class="btn-form" ng-show="tableform.$visible">
<button type="button" ng-disabled="tableform.$waiting" ng-click="addRow()" class="button-add">add row</button> |
<button type="submit" ng-disabled="tableform.$waiting" class="button-save">save</button> |
<button type="button" ng-disabled="tableform.$waiting" ng-click="tableform.$cancel()" class="button-cancel">cancel</button>
</div>
</form>
<div class="debug" style="margin-top: 30px;">
{{ table.entries || "&nbsp;" | json }}
</div>
<div class="debug" style="margin-top: 30px;">
{{ dataService.entries || "&nbsp;" | json }}
</div>
\ No newline at end of file
<form editable-form name="tableform" onaftersave="saveTable()" oncancel="cancel()" onshow="prepareForm()">
<table class="cost-table">
<thead>
<tr>
<th>Position</th>
<th>Anzahl</th>
<th>Satz</th>
<th>Summe</th>
<th></th>
</tr>
</thead>
<tbody>
<tr ng-repeat="row in table.entries | filter:filterRow">
<td>
<span editable-text="row.pos" e-form="tableform" e-ng-change="chang($index, 'pos', $data)">
{{ row.pos || '&nbsp;' }}
</span>
</td>
<td class="cost-table-numeric">
<span editable-text="row.cnt" e-form="tableform" e-style="width: 20pt" e-ng-change="chang($index, 'cnt', $data)">
{{ row.cnt || 1 }}
</span>
</td>
<td class="cost-table-numeric">
<span editable-text="row.price" e-form="tableform" e-style="width: 30pt" e-ng-change="chang($index, 'price', $data)">
{{row.price || 0 | currency}}
</span>
</td>
<td class="cost-table-numeric">{{dataService.rowSum(row) | currency}}</td>
<td><button type="button" ng-show="tableform.$visible" ng-click="deleteRow($index)" class="button-delete">del</button></td>
</tr>
</tbody>
<tfoot>
<tr>
<td class="cost-table-invisible"></td>
<td class="cost-table-invisible"></td>
<td class="cost-table-invisible"></td>
<td>{{dataService.sum() | currency}}</td>
<td></td>
</tr>
</tfoot>
</table>
<!-- buttons -->
<div class="btn-edit">
<button type="button" class="button-edit" ng-show="!tableform.$visible" ng-click="tableform.$show()">edit</button>
</div>
<div class="btn-form" ng-show="tableform.$visible">
<button type="button" ng-disabled="tableform.$waiting" ng-click="addRow()" class="button-add">add row</button> |
<button type="submit" ng-disabled="tableform.$waiting" class="button-save">save</button> |
<button type="button" ng-disabled="tableform.$waiting" ng-click="tableform.$cancel()" class="button-cancel">cancel</button>
</div>
</form>
<div class="debug" style="margin-top: 30px;">
{{ table.entries || "&nbsp;" | json }}
</div>
<div class="debug" style="margin-top: 30px;">
{{ dataService.entries || "&nbsp;" | json }}
</div>
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: tim
* Date: 8/26/14
* Time: 10:05 PM
*/
global $config_studitypen, $config_reisearten, $config_essen, $admin_db, $config_current_fahrt_id, $config_admin_verbose_level, $config_verbose_level, $text, $headers, $ajax;
$text .= '
<ul>
<li><a href="?page=export&ex=refra">RefRat-Liste</a> (<a href="http://www.refrat.hu-berlin.de/finanzen/TeilnehmerInnenlisteMitEinverstaendniserklaerung.pdf">orig</a>)</li>
<li><a href="?page=export&ex=treff">Treffpunktanwesenheitsliste</a></li>
<li><a href="?page=export&ex=konto">Kontodatenliste</a></li>
<li><a href="?page=export&ex=unter">Anwesenheitsunterschriftsliste für Unterkunft</a></li>
<li><a href="http://www.refrat.de/docs/finanzen/FormularFSErstattung_sepa_form_2.pdf">Erstattungsformular</a></li>
</ul>
';
\ No newline at end of file
class AdminExportPage extends AdminPage {
private $text = '';
private $headers = '';
private $header = '';
private $footer = '';
private static $ALLOWED_PAGES = ['refra', 'treff', 'konto', 'mord', 'room', 'unter'];
public function __construct($base) {
parent::__construct($base);
try {
if (!isset($_REQUEST['ex']) or array_search($_REQUEST['ex'], AdminExportPage::$ALLOWED_PAGES) === false)
throw new Exception('Invalide Seite!');
$exportFunction = 'export' . ucfirst($_REQUEST['ex']);
$this->$exportFunction();
$this->template = AdminPage::TEMPLATE_PRINT_FULL;
} catch (Exception $e) {
$this->exportDefault();
}
}
public function getHeaders() {
return $this->headers;
}
public function getHeader() {
return $this->header;
}
public function getFooter() {
return $this->footer;
}
public function getText() {
return $this->text;
}
public function getAjax() {
return '';
}
private function exportDefault() {
$k = [];
$k = array_keys($this->environment->oconfig['studitypen']);
array_unshift($k,'ALLE');
$this->text = '
<ul>
<li><a href="?page=export&ex=refra" target="_blank">RefRat-Liste</a> (<a href="http://www.refrat.hu-berlin.de/finanzen/TeilnehmerInnenlisteMitEinverstaendniserklaerung.pdf">orig</a>)</li>
<li><a href="?page=export&ex=treff" target="_blank">Treffpunktanwesenheitsliste</a></li>
<li><a href="?page=export&ex=konto" target="_blank">Kontodatenliste</a></li>
<li><a href="#" onClick="openMord()">Mörderspiel</a>
Erstis <input type="checkbox" checked id="e" value="Erstis"/>
Hörstis <input type="checkbox" checked id="h" value="Hoers"/>
Mentoren <input type="checkbox" checked id="m" value="Mento"/>
</li>
<li><a href="?page=export&ex=room" target="_blank">Zimmerliste</a></li>
<li><a href="?page=export&ex=unter" target="_blank">Anwesenheitsunterschriftsliste für Unterkunft</a></li>
<li><a href="http://www.refrat.de/docs/finanzen/FormularFSErstattung_sepa_form_2.pdf">Erstattungsformular</a></li>
</ul>
NOTE: No Chrome support! Webkit/Blink haven\'t implemented support for @media print... This feature is developed to support Firefox.
<script>
function openMord() {
var x = (document.querySelector("#e").checked)? "e":"-";
var y = (document.querySelector("#h").checked)? "h":"-";
var z = (document.querySelector("#m").checked)? "m":"-";
window.open("?page=export&ex=mord&studitypen="+x+y+z);
}
</script>
';
}
private function exportRefra() {
$people = $this->fahrt->getBachelors(['backstepped' => false, 'waiting' => false], ['forname'=> 'ASC']);
$data = $this->fahrt->getFahrtDetails();
$tabdata = [];
foreach ($people as $p) {
array_push($tabdata, [$p['forname'] . ' ' . $p['sirname'], '', '']);
}
// leerfelder (just in case)
for ($run = 0; $run < 8; $run++) {
array_push($tabdata, ['&nbsp;', '&nbsp;', '&nbsp;']);
}
$tabconf = ['colwidth' => ['20%', '55%', '25%'],
'cellheight' => '35pt'];
$this->text = $this->tableGenerator(['Name', 'Anschrift', 'Unterschrift'], $tabdata, $tabconf);
$this->header = '
<h1>TeilnehmerInnenliste und Einverständniserklärung</h1>
<h2>Fachschaftsfahrt</h2>
Fachschaft: <u>Informatik</u><br />
Ziel: <u>' . $data['ziel'] . '</u><br />
Datum der Fahrt: <u>' . $this->mysql2german($data['von']) . ' - ' . $this->mysql2german($data['bis']) . '</u><br />
Hiermit erklären wir uns mit unserer Unterschrift damit einverstanden, dass das von uns
ausgelegten Geld für die Fachschaftsfahrt auf das Konto des/der Finanzverantwortlichen/r,
<u>' . $data['leiter'] . '</u>, überwiesen wird.';
$this->footer = 'Einverstädniserklärung - ' . $data['titel'];
}
private function exportTreff() {
$data = $this->fahrt->getFahrtDetails();
$people = $this->fahrt->getBachelors(['antyp' => 'BUSBAHN', 'waiting' => false, 'backstepped' => false], ['forname'=> 'ASC']);
$ttabdata = [];
foreach ($people as $p) {
array_push($ttabdata, $p['forname'] . ' ' . $p['sirname']);
}
// leerfelder (just in case)
for ($run = 0; $run < 8; $run++) {
array_push($ttabdata, '&nbsp;');
}
$tabdata = [];
// transpose long list to have multiple columns
for ($run = 0; $run < count($ttabdata); $run++) {
$c1 = (isset($ttabdata[$run]) ? $ttabdata[$run] : '&nbsp;');
$run++;
$c2 = (isset($ttabdata[$run]) ? $ttabdata[$run] : '&nbsp;');
$run++;
$c3 = (isset($ttabdata[$run]) ? $ttabdata[$run] : '&nbsp;');
array_push($tabdata, [$c1, '&nbsp;', '', $c2, '&nbsp;', '', $c3, '&nbsp;']);
}
$tabconf = ['colwidth' => ['20%', '10pt', '1px; margin:0; padding:0; font-size:1pt', '20%', '10pt', '1px; margin:0; padding:0; font-size:1pt', '20%', '10pt'],
'cellheight' => '30pt'];
$this->text = $this->tableGenerator(['Name', 'X', '', 'Name', 'X', '', 'Name', 'X'], $tabdata, $tabconf);
$this->header = '
<h1>Anwesenheitsliste Treffpunkt</h1>
Liste aller Teilnehmer, die angegeben haben, gemeinsam mit Bus/Bahn anzureisen';
$this->footer = 'Anwesenheitsliste - ' . $data['titel'];
}
private function exportKonto() {
$data = $this->fahrt->getFahrtDetails();
$people = $this->fahrt->getBachelors(['waiting' => false, 'backstepped' => false], ['forname'=> 'ASC']);
$tabdata = [];
foreach ($people as $p) {
array_push($tabdata, [$p['forname'] . ' ' . $p['sirname'],
'<img src="iban.png" align="middle">',
'<img src="kontonr.png" align="middle">',
'&nbsp;', '&nbsp;']);
}
// leerfelder (just in case)
for ($run = 0; $run < 8; $run++) {
array_push($tabdata, ['&nbsp;', '&nbsp;', '&nbsp;', '&nbsp;', '&nbsp;']);
}
$tabconf = ['colwidth' => ['25%', '30%', '25%', '15%', '5%'],
'cellheight' => '30pt',
'class' => [3 => 'graycell', 4 => 'graycell']];
$this->text = $this->tableGenerator(['Name', 'Kontonummer/IBAN', 'Bankleitzahl/BIC', 'Betrag*', 'Erl*'], $tabdata, $tabconf);
$this->header = '
<h1>Kontodaten für Rücküberweisung</h1>
Diese Liste verbleibt bei dem/der Fahrtverantwortlichen <u>' . $data['leiter'] . '</u> und wird benötigt um die Förderung und den Differenzbetrag nach der Fahrt zurück zu überweisen.<br />
<b>Graue/mit Sternchen gekennzeichnete Fehler freilassen</b> (Trolle bekommen kein Geld!!)';
$this->footer = 'Kontodaten (Rücküberweisung) - ' . $data['titel'];
}
function cmp($a, $b) {
if(strcmp($a->forname,$b->forname)==0) {
if(strcmp($a->sirname==$b->sirname)==0) {
return 0;
}else{
return (strcmp($a->forname,$b->forname)<0) ? -1 : 1;
}
}
return (strcmp($a->forname,$b->forname)<0) ? -1 : 1;
}
private function exportMord() {
$preInstruction = '<u>Mordvorschlag:</u> ';
$instructions = ['Gib deinem Opfer in einem Moment des Verlusts der Aufmerksamkeit einen Gegenstand um es umzubringen und melde es dem Spielleiter.',
'Verrühre 2 Eier, 80g Mehl, 20g Zucker, 120ml Milch, 2 TL Backpulver; backe Waffeln daraus und gib eine davon deinem Opfer.',
'"Hast du schon ein Knicklicht..?"',
'Borge dir einen Stift von deinem Opfer und gib ihn zurück.',
'Kannst du mir Mal bitte kurz die Taschenlampe halten?',
'Verwechslungsgefahr: Deinem Opfer ein Rad geben zählt, einen Rat geben allerdings nicht.',
'Leih dir das Telefon deines Opfers um "mamamameine Mutter anzurufen" und gib es zurück.',
'Sammle die Wimper deines Opfers ein und händige sie über mit der Bitte sich etwas zu wünschen um dein Opfer zu ermorden. Wimper darf nicht ausgerissen werden. Andere pustbare Dinge auch erlaubt. ',
'Hilf deinem Opfer bei einer Übungsaufgabe und gib den Stift zurück um es umzubringen.',
'Das ist ein Testeintrag. Der dient nicht als echter Mordauftrag.'];
$postInstruction = ' <i>Das darf nicht erzwungen werden; keine Zeugen.</i>';
$data = $this->fahrt->getFahrtDetails();
if (false/*isset($_REQUEST['studitypen'])*/) {
$builder = '';
$people = [];
$people = $this->fahrt->getBachelors(['waiting' => false, 'backstepped' => false, 'mGame' => true], ['forname'=> 'ASC']);
/* if(strpos($_REQUEST['studitypen'], "e")!==false) {
$people = array_merge($people, $this->fahrt->getBachelors(['waiting' => false, 'backstepped' => false, 'mGame' => true, 'studityp' => 'ERSTI'], ['forname'=> 'ASC']));
}
if(strpos($_REQUEST['studitypen'], "h")!==false) {
$people = array_merge($people, $this->fahrt->getBachelors(['waiting' => false, 'backstepped' => false, 'mGame' => true, 'studityp' => 'HOERS'], ['forname'=> 'ASC']));
}
if(strpos($_REQUEST['studitypen'], "m")!==false) {
$people = array_merge($people, $this->fahrt->getBachelors(['waiting' => false, 'backstepped' => false, 'mGame' => true, 'studityp' => 'MENTO'], ['forname'=> 'ASC']));
}*/
// print_r($people);
usort($people, function ($a, $b) {
if(strcasecmp($a['forname'],$b['forname'])==0) {
if(strcasecmp($a['sirname'],$b['sirname'])==0) {
return 0;
}else{
return (strcasecmp($a['forname'],$b['forname'])<0) ? -1 : 1;
}
}
return (strcasecmp($a['forname'],$b['forname'])<0) ? -1 : 1;
});
}else{
$people = $this->fahrt->getBachelors(['waiting' => false, 'backstepped' => false, 'mGame' => true], ['forname'=> 'ASC']);
}
$tabdata = [];
foreach ($people as $p) {
array_push($tabdata, [$p['forname'] . " " . $p['sirname'], '&nbsp;', '&nbsp;', '&nbsp;']);
}
$tabconf = ['colwidth' => ['25%', '20%', '20%', '35%'], 'cellheight' => '30pt'];
$people = array_map(function ($piece) {
return $piece[0];
}, $tabdata);
shuffle($people);
$this->text = $this->tableGenerator(['Opfer', 'Zeitpunkt', 'Mörder', 'Tathergang'], $tabdata, $tabconf) .
'<div class="page-break"></div>
<div style="page-break-inside: avoid;"><h1>Cheatsheet</h1><p>' . implode('&nbsp;->&nbsp;', $people) .
'</p></div>';
for ($i = 1; $i <= count($people); $i++) {
$this->text .= '<div class="killbox">
<span role="killer">' . $people[$i - 1] . '</span>
<span role="victim">' . $people[$i % count($people)] . '</span>
<p role="instruction">'.
$preInstruction . $instructions[array_rand($instructions)] .
$postInstruction.
'</p></div>';
}
$this->header = '
<h1>Mordaufträge und Übersicht</h1>
Fröhliches Morden! Bitte keine tödlichen Gegenstände benutzen.';
$this->footer = 'Mörderspiel - ' . $data['titel'];
}
private function exportRoom() {
$this->text = '
<script type="text/javascript">
function updateRoomCnt(val) {
var table = document.getElementById("roomtab").getElementsByTagName("tbody")[0];
table.innerHTML = "";
for(var i = 0; i < val; i++) {
var row = table.insertRow(table.rows.length);
row.insertCell(0).style.height="30pt";
row.insertCell(1);
row.insertCell(2);
row.insertCell(3);
row.insertCell(4);
row.insertCell(5);
}
}
</script>
<p class="hide-print">Anzahl Zimmer: <input type="number" id="roomcnt" value="10" onchange="updateRoomCnt(this.value)" /><br>
Hint: Es kann sinnvoll sein ein paar mehr Spalten zu generieren als nötig.</p>';
$tabconf = [
'colwidth' => ['16%', '10%', '10%', '30%', '12%', '12%'],
'cellheight' => '30pt',
'id' => 'roomtab'
];
$this->text .= $this->tableGenerator(['Haus/ Etage/ Raum', '# Betten', '# Schlüssel', 'Verantwortlich', 'Erhalten', 'Zurück'], [], $tabconf);
$data = $this->fahrt->getFahrtDetails();
$this->header = '
<h1>Übersicht der Schlüssel</h1>
Mit der Unterschrift in der Spalte "Erhalten" bestätigt die Person, angegeben in der Spalte "Verantwortlich", den/die
Schlüssel zum entsprechenden Raum erhalten zu haben. Bei Verlust des Schlüssels oder Schäden im Zimmer wird diese
Person Rechenschaft tragen.
In der Spalte "Zurück" bestätigt der/die Organisator/in der Fahrt (' . $data['leiter'] . ') den Schlüssel wieder in Empfang genommen zu haben.<br>
Diese Liste ist gültig für die Fahrt "' . $data['titel'] . '" nach "' . $data['ziel'] . '" von ' . $data['von'] . ' bis ' . $data['bis'] . '.';
$this->footer = 'Schlüsselliste - ' . $data['titel'];
}
private function exportUnter() {
$data = $this->fahrt->getFahrtDetails();
$people = $this->fahrt->getBachelors(['backstepped' => false, 'waiting' => false], ['forname'=> 'ASC']);
$tabdata = [];
foreach ($people as $p) {
array_push($tabdata, [$p['forname'] . ' ' . $p['sirname'], '&nbsp;', '&nbsp;']);
}
// leerfelder (just in case)
for ($run = 0; $run < 8; $run++) {
array_push($tabdata, ['&nbsp;', '&nbsp;', '&nbsp;']);
}
$tabconf = ['colwidth' => ['20%', '25%', '55%'],
'cellheight' => '20pt'];
$this->text = $this->tableGenerator(['Name', 'Unterschrift', '&nbsp;'], $tabdata, $tabconf);
$this->header = '
<h1>TeilnehmerInnenliste</h1>
<h2>Fachschaftsfahrt</h2>
Fachschaft: <u>Informatik</u><br />
Datum der Fahrt: <u>' . $this->mysql2german($data['von']) . ' - ' . $this->mysql2german($data['bis']) . '</u><br />
Verantwortlicher: <u>' . $data['leiter'] . '</u><br />
Liste aller Teilnehmer der Fachschaftsfahrt in der Einrichtung <u>' . $data['ziel'] . '</u>';
$this->footer = 'TeilnehmerInnenliste - ' . $data['titel'];
}
private function tableGenerator($headers, $data, $tabconf = []) {
$thead = '';
foreach ($headers as $cell => $h) {
$thead .= '<th ' . $this->tableGeneratorCellStyle($tabconf, $cell) . '>' . $h . '</th>';
}
$tbody = '';
foreach ($data as $row) {
$tbody .= '<tr>';
foreach ($row as $cell => $dc) {
$tbody .= '<td' . $this->tableGeneratorCellStyle($tabconf, $cell) . '>' . $dc . '</td>';
}
$tbody .= '</tr>';
}
return '
<table class="dattable" '. (isset($tabconf['id']) ? 'id="'.$tabconf['id'].'"' : '') . '">
<thead>
<tr>' . $thead . '</tr>
</thead>
<tbody>' . $tbody . '</tbody>
</table>';
}
private function tableGeneratorCellStyle($tabconf, $cell) {
$ret = '';
if (isset($tabconf['cellheight']) || isset($tabconf['colwidth']) || isset($tabconf['class'])) {
$ret .= ' style="';
if (isset($tabconf['cellheight']))
$ret .= 'height:' . $tabconf['cellheight'] . ';';
if (isset($tabconf['colwidth']) && isset($tabconf['colwidth'][$cell]))
$ret .= 'width:' . $tabconf['colwidth'][$cell] . ';';
$ret .= '""';
if (isset($tabconf['class']) && isset($tabconf['class'][$cell]))
$ret .= ' class="' . $tabconf['class'][$cell] . '"';
}
return $ret;
}
}
<?php
class AdminInfosPage extends AdminPage {
public function __construct($base) {
parent::__construct($base);
if (isset($_POST['note-content'])) {
try {
$this->fahrt->set(['beschreibung' => $_REQUEST['note-content'],
'titel' => $_REQUEST['titel'],
'von' => $_REQUEST['von'],
'bis' => $_REQUEST['bis'],
'ziel' => $_REQUEST['ziel'],
'map_pin' => $_REQUEST['us2-lat'] . ' ' . $_REQUEST['us2-lon'],
'leiter' => $_REQUEST['leiter'],
'kontakt' => $_REQUEST['kontakt'],
'max_bachelor' => $_REQUEST['max_bachelor'],
'regopen' => isset($_REQUEST['regopen']) ? 1 : 0,
'wikilink' => $_REQUEST['wikilink'],
'paydeadline' => $_REQUEST['paydeadline'],
'payinfo' => $_REQUEST['payinfo'],
'opentime' => $_REQUEST['opentime'],
'disclaimlink' => $_REQUEST['disclaimlink'],
'isSummer' => isset($_REQUEST['isSummer']) ? 1 : 0
]);
$saveResult = $this->fahrt->save();
if (empty($saveResult)) {
$this->message_err = 'Speichern fehlgeschlagen...';
} else {
$this->message_succ = 'Gespeichert.';
}
} catch (Exception $e) {
$this->message_err = 'Fehler aufgetreten: ' . $e->getMessage();
}
}
}
public function getHeaders() {
global $config_use_openstreetmap;
return '<!-- wysihtml5 parser rules -->
<script src="../view/js/wysihtml5-0.3.0_rc2.min.js"></script>
<!-- Library -->
<script src="../view/js/wysihtml5-advanced.js"></script>
<script src="../view/js/jquery-1.11.1.min.js"></script>
<script src="../view/js/jquery-ui.min.js"></script>
<script src="../view/js/jquery.datetimepicker.js"></script>
<script type="text/javascript" src="'.(
$config_use_openstreetmap
? 'https://openlayers.org/api/OpenLayers.js'
: 'https://maps.google.com/maps/api/js?sensor=false&libraries=places'
).'"></script>
<script src="../view/js/locationpicker.jquery.js"></script>
<link type="text/css" rel="stylesheet" href="../view/jquery-ui/jquery-ui.min.css" />
<link type="text/css" rel="stylesheet" href="../view/css/jquery.datetimepicker.css" />
<link type="text/css" rel="stylesheet" href="../view/css/wysihtml5/stylesheet.css" />
<style type="text/css">
body {
min-height: 100%;
padding-top: 40px !important;
padding-left: 10px !important;
}
section{
position: relative;
top: inherit;
bottom: inherit;
width: inherit;
}
.formlist li{
margin: 8px 10px;
clear: both;
height: 30px;
}
.formlist input, .formlist textarea {
float: right;
width: 300px;
}
.formlist label{
float:left;
}
</style> ';
}
public function getHeader() {
return '';
}
public function getFooter() {
return '';
}
public function getText() {
global $config_use_openstreetmap;
$data = $this->fahrt->getFahrtDetails();
if ($data['opentime'] == 0) $data['opentime'] = time();
$pin = explode(" ", $data["map_pin"]);
$summer = ($data["isSummer"] == 1) ? "checked" : "";
$regopen = ($data["regopen"] == 1) ? "checked" : "";
return $this->getMessage().<<<EOF
<h2>Informationen</h2>
<section>
<form method="POST" style="height:300px;">
<div style="float:left">
<input type="submit" name="submit" value="submit" class="submit-button" />
<p></p>
<ul class="formlist">
<li><label>Titel</label>
<input type="text" name="titel" id="titel" value="${data["titel"]}" /></li>
<li><label>Ziel</label>
<input type="text" name="ziel" id="ziel" value="${data["ziel"]}" /></li>
<li><label>Von</label>
<input type="text" name="von" id="von" value="${data["von"]}" /></li>
<li><label>Bis</label>
<input type="text" name="bis" id="bis" value="${data["bis"]}" /></li>
<li><label>Anmeldung ab</label>
<input type="text" name="opentime" id="opentime" value="${data["opentime"]}" /></li>
<li><label>Anm. offen</label>
<input type="checkbox" name="regopen" id="regopen" value="penis" $regopen /></li>
<li><label>Max TN</label>
<input type="number" name="max_bachelor" id="max_bachelor" value="${data["max_bachelor"]}" /></li>
<li><label>Leiter</label>
<input type="text" name="leiter" id="leiter" value="${data["leiter"]}" /></li>
<li><label>E-Mail</label>
<input type="text" name="kontakt" id="kontakt" value="${data["kontakt"]}" /></li>
<li><label>Wiki-Link</label>
<input type="text" name="wikilink" id="wikilink" value="${data["wikilink"]}" /></li>
<li><label>Disclaimer-Link</label>
<input type="text" name="disclaimlink" id="disclaimlink" value="${data["disclaimlink"]}" /></li>
<li><label>Zahlung bis</label>
<input type="text" name="paydeadline" id="paydeadline" value="${data["paydeadline"]}" /></li>
<li><label>Zahlungsdetails</label>
<textarea style="border:1px dotted grey;height: 6em; padding: 0 0 0 0.4em" rows="4" name="payinfo" id="payinfo">${data["payinfo"]}</textarea></li>
<li><br><label>Ist eine Sommerfahrt</label>
<input type="checkbox" name="isSummer" id="isSummer" value="penis" $summer /></li>
</ul>
</div>
<div style="float:left">
GPS Coords: <input type="text" id="us2-address" value="${pin[0]} ${pin[1]}" style="width: 350px"/>
<div id="us2" style="width: 500px; height: 353px;"></div>
<input type="hidden" id="us2-lat" name="us2-lat" value="${pin[0]}" />
<input type="hidden" id="us2-lon" name="us2-lon" value="${pin[1]}" />
<script>
EOF
.($config_use_openstreetmap
?<<<EOF
var map = new OpenLayers.Map("us2");
var maplayer = new OpenLayers.Layer.OSM();
map.addLayer(maplayer);
var zoom=10;
var target = new OpenLayers.LonLat(parseFloat(${pin[1]}), parseFloat(${pin[0]}))
.transform(
new OpenLayers.Projection("EPSG:4326"), // transform from WGS 1984
map.getProjectionObject() // to Spherical Mercator Projection
);
var markers = new OpenLayers.Layer.Markers("Markers");
map.addLayer(markers);
var marker = new OpenLayers.Marker(target);
markers.addMarker(marker);
map.setCenter(target, zoom);
map.events.register("click", map, function(e) {
// WORKAROUND: map.getLonLatFromPixel returns the wrong coordinates unless a zoom occurred
map.setCenter(void 0, map.zoom-1);
map.setCenter(void 0, map.zoom+1);
var position = map.getLonLatFromPixel(e.xy).transform(
map.getProjectionObject(), // to Spherical Mercator Projection,
new OpenLayers.Projection("EPSG:4326") // transform from WGS 1984
);
// WORKAROUND: moveTo fails if there is no map object assigned to the marker
marker.map = map;
marker.moveTo(e.xy);
$('#us2-address').val(position.lat+' '+position.lon);
$('#us2-lat').val(position.lat);
$('#us2-lon').val(position.lon);
});
EOF
:<<<EOF
$('#us2').locationpicker({
location: {latitude: ${pin[0]}, longitude: ${pin[1]}},
radius:0,
inputBinding: {
latitudeInput: $('#us2-lat'),
longitudeInput: $('#us2-lon'),
locationNameInput: $('#us2-address')
}
});
$(function() {
$( "#von" ).datepicker( { dateFormat: "yy-mm-dd"} );
$( "#bis" ).datepicker( { dateFormat: "yy-mm-dd"} );
$( "#opentime" ).datetimepicker( { format: "unixtime" } );
$( "#paydeadline" ).datepicker( { dateFormat: "yy-mm-dd"} );
});
EOF
).<<<EOF
</script>
</div>
<div style="clear:both"></div>
<br />
<div id="wysihtml5-editor-toolbar">
<header>
<ul class="commands">
<li data-wysihtml5-command="bold" title="Make text bold (CTRL + B)" class="command"></li>
<li data-wysihtml5-command="italic" title="Make text italic (CTRL + I)" class="command"></li>
<li data-wysihtml5-command="insertUnorderedList" title="Insert an unordered list" class="command"></li>
<li data-wysihtml5-command="insertOrderedList" title="Insert an ordered list" class="command"></li>
<li data-wysihtml5-command="createLink" title="Insert a link" class="command"></li>
<li data-wysihtml5-command="insertImage" title="Insert an image" class="command"></li>
<li data-wysihtml5-command="formatBlock" data-wysihtml5-command-value="h1" title="Insert headline 1" class="command"></li>
<li data-wysihtml5-command="formatBlock" data-wysihtml5-command-value="h2" title="Insert headline 2" class="command"></li>
<li data-wysihtml5-command-group="foreColor" class="fore-color command" title="Color the selected text">
<ul>
<li data-wysihtml5-command="foreColor" data-wysihtml5-command-value="silver"></li>
<li data-wysihtml5-command="foreColor" data-wysihtml5-command-value="gray"></li>
<li data-wysihtml5-command="foreColor" data-wysihtml5-command-value="maroon"></li>
<li data-wysihtml5-command="foreColor" data-wysihtml5-command-value="red"></li>
<li data-wysihtml5-command="foreColor" data-wysihtml5-command-value="purple"></li>
<li data-wysihtml5-command="foreColor" data-wysihtml5-command-value="green"></li>
<li data-wysihtml5-command="foreColor" data-wysihtml5-command-value="olive"></li>
<li data-wysihtml5-command="foreColor" data-wysihtml5-command-value="navy"></li>
<li data-wysihtml5-command="foreColor" data-wysihtml5-command-value="blue"></li>
</ul>
</li>
<li data-wysihtml5-command="insertSpeech" title="Insert speech" class="command"></li>
<li data-wysihtml5-action="change_view" title="Show HTML" class="action"></li>
</ul>
</header>
<div data-wysihtml5-dialog="createLink" style="display: none;">
<label>
Link:
<input data-wysihtml5-dialog-field="href" value="http://">
</label>
<a data-wysihtml5-dialog-action="save">OK</a>&nbsp;<a data-wysihtml5-dialog-action="cancel">Cancel</a>
</div>
<div data-wysihtml5-dialog="insertImage" style="display: none;">
<label>
Image:
<input data-wysihtml5-dialog-field="src" value="http://">
</label>
<a data-wysihtml5-dialog-action="save">OK</a>&nbsp;<a data-wysihtml5-dialog-action="cancel">Cancel</a>
</div>
</div>
<textarea name="note-content" id="wysihtml5-editor" spellcheck="false" wrap="off" placeholder="Enter your text ...">${data["beschreibung"]}</textarea>
</form>
</section>
<script>
var editor = new wysihtml5.Editor("wysihtml5-editor", {
toolbar: "wysihtml5-editor-toolbar",
stylesheets: ["../view/css/wysihtml5/editor.css"],
parserRules: wysihtml5ParserRules
});
editor.on("load", function() {
var composer = editor.composer,
h1 = editor.composer.element.querySelector("h1");
if (h1) {
composer.selection.selectNode(h1);
}
});
</script>
EOF;
}
public function getAjax() {
return '';
}
}
<?php
class AdminJumpOfPage extends AdminPage {
public function __construct($base) {
parent::__construct($base);
if (isset($_REQUEST['change'])) {
try {
$bNew = Bachelor::makeFromForm(false, $this->fahrt, true, true);
$bNew->set(['bachelor_id' => $_REQUEST['change']]);
// print_r($bNew->getData());
$bOld = Bachelor::makeFromDB($this->fahrt, $_REQUEST['change']);
// print_r($bOld->getData());
$bOld->updateBachelor($bNew);
$saveResult = $bOld->save();
if ($saveResult !== Bachelor::SAVE_SUCCESS)
throw new Exception('Fehler beim Speichern mit code ' . $saveResult.'<br />'.implode('<br />', $b->getValidationErrors()));
else
$this->message_succ = 'Bachelor mit ID '.$_REQUEST['change'].' Erfolgreich gespeichert';
} catch (Exception $e) {
$this->message_err = $e->getMessage();
}
}
if (isset($_REQUEST['delete'])) {
$this->environment->database->delete('bachelor', ['AND' => ['bachelor_id' => $_REQUEST['delete'], 'fahrt_id'=>$_REQUEST['fahrt_id']]]);
}
}
public function getHeaders() {
return '<link rel="stylesheet" type="text/css" href="../view/css/DataTables/css/jquery.dataTables.min.css" />
<script type="text/javascript" src="../view/js/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="../view/js/jquery.dataTables.1.10.12.min.js"></script>
<style type="text/css">
div.btn{
width: 18px;
height: 18px;
padding: 3px 5px;
background-image: url("../view/graphics/MyEbaySprite.png");
background-repeat: no-repeat;
float: left;
cursor: pointer;
}
.btn-paid-0{
background-position: -23px -90px;
}
.btn-paid-1{
background-position: -70px -90px;
}
.btn-repaid-0{
background-position: -148px -89px;
}
.btn-repaid-1{
background-position:-194px -89px;
}
.btn-backstepped-0{
background-position: -51px -169px;
}
.btn-backstepped-1{
background-position: -23px -169px;
}
#editForm{
display: none;
position: fixed;
top:100px;
left: 200px;
width: 700px;
height: 80%;
border: 1px solid #000000;
background-color: beige;
padding: 20px 10px 10px 10px;
}
#editForm>p{
display: block;
position:absolute;
height:auto;
bottom:0;
top:0;
left:0;
right:0;
overflow: auto;
padding: 10px;
margin: 20px 0 0 0;
}
#editFormTopbar{
background-color: #b0bed9;
height: 20px;
position: absolute;
top: 0;
left: 0;
right: 0;
padding: 0;
}
#editFormTopbar p{
position: absolute;
float: right;
top: 0;
padding: 0;
margin: 0;
right: 5px;
cursor: none;
height: 20px;
display: block;
}
</style>';
}
public function getHeader() {
return '';
}
public function getFooter() {
return '';
}
public function getText() {
$cols = ['Anmelde-ID','Anmeldung','Name','Anreisetyp','Abreisetyp', 'Anreisetag','Abreisetag', 'Studityp', 'PaidReBack', 'BackAt'];
$buttoncol = count($cols)-2;
$thead = '';
$toggle = 'Toggle Column:';
foreach ($cols as $tcnt => $col) {
$thead .= '<th>'.$col.'</th>';
$toggle .= '<a class="toggle-vis" data-column="' . $tcnt . '">' . $col . '</a> - ';
}
$people = $this->fahrt->getBachelors(['waiting'=>false]);
$tbody = '';
foreach ($people as $b) {
if(!$b['backstepped']) {
continue;
}
$tbody .= '
<tr>
<td><a href="#" style="color:black !important;" class="edit_bachelor">'.$b['bachelor_id'].'</a></td>
<td>'.$this->mysql2german($b['anm_time']).'</td>
<td><a href="mailto:'.$b['mehl'].'?subject=FS-Fahrt">' . $b['forname'] . ' ' . $b['sirname'] . ' (' . $b['pseudo'] . ')</a></td>
<td>'.$b['antyp'].'</td>
<td>'.$b['abtyp'].'</td>
<td>'.$this->mysql2german($b['anday']).'</td>
<td>'.$this->mysql2german($b['abday']).'</td>
<td>'.$b['studityp'].'</td>
<td>'.($b['paid'] ? $b['paid'] : '0') . ',' . ($b['repaid'] ? $b['repaid'] : '0') . ',' . ($b['backstepped'] ? $b['backstepped'] : '0').'</td>
<td>'.date('d.m.Y - G:i.s', $b['backstepped']).'</td>
<td>'.($b['backstepped'] ? 1 : '0').'</td>
</tr>';
}
return '<h1>Abspringer Liste</h1>' .
$this->getMessage().'<br />' .
$toggle.'<br />
<br />
<table id="mlist" class="compact hover">
<thead>
<tr>'.$thead.'<th></th></tr>
</thead>
<tbody>'.$tbody.'</tbody>
</table>
<div id="editForm">
<div id="editFormTopbar"><p>X</p></div>
<p></p>
</div>
<script type="text/javascript">
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
"link-pre": function ( a ) {
return a.match(/<a [^>]+>([^<]+)<\/a>/)[1];
},
"prb-pre": function ( a ) {
var tmp = a.split(",");
return ((tmp[0]==0) ? "0" : "1") + ((tmp[1]==0) ? "0" : "1") + ((tmp[2]==0) ? "0" : "1");
},
"dedate-pre": function( a ) {
var tmp = a.split(".");
if(tmp.length>2)
return (tmp[2]+tmp[1]+tmp[0]);
return a;
}
});
var ltab;
$(document).ready(function(){
ltab = $("#mlist").DataTable({
"rowCallback": function (row, data, index) {
var spl = data['.$buttoncol.'].split(",");
if (spl[2] != 0) {
$("td", row).addClass("list-backstepped");
} else if (spl[0] != 0 && spl[1] != 0) {
$("td", row).addClass("list-repaid");
} else if (spl[0] != 0) {
$("td", row).addClass("list-paid");
} else if (spl[0] == 0) {
$("td", row).addClass("list-unpaid");
}
},
"columnDefs": [
{
"targets": ['.$buttoncol.'],
"render": function(data, type, row, meta) {
if (type === "display"){
var bid = row[0].match(/<a [^>]+>([^<]+)<\/a>/)[1];
var classes = ["paid", "repaid", "backstepped"];
var btns = "";
var parts = data.split(",");
for (var i = 0; i < parts.length; i++) {
var tmp = (parts[i] ==0) ? 0 : 1;
btns +="<div onclick=\\"btnclick(this, \'"+classes[i]+"\',\'"+bid+"\',"+tmp+");\\" class=\\"btn btn-"+classes[i]+"-"+tmp+"\\">&nbsp;</div>";
}
return btns;
}
return data;
}
},
{ type: "dedate", targets: [1,5,6]},
{ type: "link", targets: [0, 2] },
{ type: "prb", targets: ' . $buttoncol . ' },
{ targets: 10, visible: false, searchable: false }
],
"order": [[ 2, "asc" ]],
"paging": false,
"orderFixed": [ 8, "asc" ]
});
$("a.toggle-vis").click( function (e) {
e.preventDefault();
// Get the column API object
var column = ltab.column( $(this).attr("data-column") );
// Toggle the visibility
column.visible( ! column.visible() );
});
$(".moveToWaitlist").click( function(){
var bid = $(this).closest("tr").find("td:eq(0)").text();
$.get( "?page=jumpOf&ajax=ajax&toWaitlist=toWaitlist&hash="+bid, function( data ) {});
});
$(".edit_bachelor").click( function(){
var bid = $(this).text();
$.get( "?page=jumpOf&ajax=ajax&form=form&hash="+bid, function( data ) {
$("#editForm > p").html(data);
});
$("#editForm").show();
});
$("#editFormTopbar > p").click( function(){
$(this).parent().parent().hide();
});
});
function btnclick(that, type, hash, state){
var newstate = (((state-1)<0) ? 1 : 0);
$.get("index.php?page=jumpOf&ajax=ajax&update="+type+"&hash="+hash+"&nstate="+newstate ,"",
function(){
that.className="btn btn-"+type+"-"+newstate;
that.setAttribute("onclick", "btnclick(this, \'"+type+"\', \'"+hash+"\', "+newstate+")");
var p = $("div", $(that).parent())[0].className;
var r = $("div", $(that).parent())[1].className;
var b = $("div", $(that).parent())[2].className;
if (b == "btn btn-backstepped-1") {
updateClass(that, "list-backstepped");
} else if (p == "btn btn-paid-1" && r == "btn btn-repaid-1") {
updateClass(that, "list-repaid");
} else if (p == "btn btn-paid-1") {
updateClass(that, "list-paid");
} else if (p == "btn btn-paid-0") {
updateClass(that, "list-unpaid");
} else {
updateClass(that);
}
});
}
function updateClass(that, nClass = null) {
$("td", $(that).parent().parent()).removeClass("list-backstepped")
.removeClass("list-repaid")
.removeClass("list-paid")
.removeClass("list-unpaid");
if(nClass != null)
$("td", $(that).parent().parent()).addClass(nClass);
}
</script>';
}
public function getAjax() {
if (isset($_REQUEST['update']) && isset($_REQUEST['hash']) && isset($_REQUEST['nstate'])) {
$b = Bachelor::makeFromDB($this->fahrt, $_REQUEST['hash']);
$b->set([$_REQUEST['update'] => ($_REQUEST['nstate'] == 1) ? time() : null]);
return $b->save();
} elseif (isset($_REQUEST['form'])) {
return $this->getEditForm(Bachelor::makeFromDB($this->fahrt, $_REQUEST['hash']));
} elseif(isset($_REQUEST['toWaitlist'])) {
try {
$bachelor = Bachelor::makeFromDB($this->fahrt, $_REQUEST['hash']);
if (empty($bachelor))
throw new Exception('Person nicht vorhanden.');
$transferResult = $bachelor->registrationToWaitlist();
if ($transferResult == Bachelor::SAVE_SUCCESS) {
$this->message_succ = 'Person erfolgreich von Warteliste auf Anmeldeliste übertragen.';
return true;
} else {
throw new Exception('Hat nicht geklappt. Fehlercode '.$transferResult);
}
} catch (Exception $e) {
$this->message_err = $e->getMessage();
}
}
}
private function nulltime2german($time) {
if (empty($time)) return 'Nein';
return $this->mysql2german($time);
}
/**
* @param $bachelor Bachelor
* @return string
*/
private function getEditForm($bachelor) {
$data = $bachelor->getData();
$bid = $data['bachelor_id'];
$fid = $data['fahrt_id'];
$possibleDates = $this->fahrt->getPossibleDates();
return '
<b>Hash:</b> <a href="../status.php?fid='.$fid.'&hash='.$bid.'" target="_blank">' . $bid . '</a><br/>
<b>Fahrt:</b> ID ' . $fid . '<br/>
<b>Anmeldung:</b> ' . $this->mysql2german($data['anm_time']) . '<br/>
<b>Bezahlt:</b> ' . $this->nulltime2german($data['paid']) . '<br/>
<b>Rückgezahlt:</b> ' . $this->nulltime2german($data['repaid']) . '<br/>
<b>Zurückgetreten:</b> ' . $this->nulltime2german($data['backstepped']) . '<br/>
<br /><hr /> <br/>
<form method="POST" >
Note: Keine Nachfrage, löscht direkt und unwiederruflich!!<br />
<input type="submit" name="submit_del" value="DELETE" />
<input type="hidden" name="delete" value="' . $bid . '" />
<input type="hidden" name="bachelor_id" value="' . $bid . '" />
<input type="hidden" name="fahrt_id" value="' . $fid . '" />
</form>';
}
}
<?php
/**
* Created by PhpStorm.
* User: tim
* Date: 9/3/14
* Time: 7:09 PM
*/
global $text, $headers, $admin_db, $config_current_fahrt_id, $ajax;
class AdminListPage extends AdminPage {
if(isset($_REQUEST['ajax'])){
public function __construct($base) {
parent::__construct($base);
$this->isWaitlist = isset($_GET['waitlist']) && $_GET['waitlist'] == 'true';
$this->isAlumniPage = isset($_GET['alumni']) && $_GET['alumni'] == 'true';
if(isset($_REQUEST['update']) && isset($_REQUEST['hash']) && isset($_REQUEST['nstate'])){
$col = $_REQUEST['update'];
$id = $_REQUEST['hash'];
$val = ($_REQUEST['nstate'] == 1) ? time() : NULL;
// moves entry to final list
if(isset($_REQUEST['move'])){
try {
$bachelor = Bachelor::makeFromDB($this->fahrt, $_REQUEST['move']);
if (empty($bachelor))
throw new Exception('Person nicht vorhanden.');
if ($this->isWaitlist) {
$transferResult = $bachelor->waitlistToRegistration();
} else {
$transferResult = $bachelor->registrationToWaitlist();
}
if ($transferResult == Bachelor::SAVE_SUCCESS) {
$this->message_succ = 'Person erfolgreich von '.($this->isWaitlist?"Warteliste":"Anmeldeliste").' auf '.($this->isWaitlist?"Anmeldeliste":"Warteliste").' übertragen.';
} else {
throw new Exception('Hat nicht geklappt. Fehlercode '.$transferResult);
}
} catch (Exception $e) {
$this->message_err = $e->getMessage();
}
}
if (isset($_REQUEST['change'])) {
try {
$bNew = Bachelor::makeFromForm(false, $this->fahrt, true, true);
$bNew->set(['bachelor_id' => $_REQUEST['change']]);
$bOld = Bachelor::makeFromDB($this->fahrt, $_REQUEST['change']);
$bOld->updateBachelor($bNew);
$saveResult = $bOld->save();
if ($saveResult !== Bachelor::SAVE_SUCCESS)
throw new Exception('Fehler beim Speichern mit code ' . $saveResult.'<br />'.implode('<br />', $b->getValidationErrors()));
else
$this->message_succ = 'Bachelor mit ID '.$_REQUEST['change'].' Erfolgreich gespeichert';
} catch (Exception $e) {
$this->message_err = $e->getMessage();
}
}
$admin_db->update("bachelor", array($col=>$val), array("bachelor_id"=> $id));
if (isset($_REQUEST['delete'])) {
$this->environment->database->delete('bachelor', ['AND' => ['bachelor_id' => $_REQUEST['delete'], 'fahrt_id'=>$_REQUEST['fahrt_id']]]);
}
}
} else {
$headers =<<<END
<link rel="stylesheet" type="text/css" href="../view/css/DataTables/css/jquery.dataTables.min.css" />
<script type="text/javascript" src="../view/js/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="../view/js/jquery.dataTables.min.js"></script>
END;
$headers .= "
<style type='text/css'>
div.btn{
width: 18px;
height: 18px;
padding: 3px 5px;
background-image: url('../view/graphics/MyEbaySprite.png');
background-repeat: no-repeat;
float: left;
cursor: pointer;
}
.btn-paid-0{
background-position: -23px -90px;
}
.btn-paid-1{
background-position: -70px -90px;
}
.btn-repaid-0{
background-position: -148px -89px;
}
.btn-repaid-1{
background-position:-194px -89px;
}
.btn-backstepped-0{
background-position: -51px -169px;
}
.btn-backstepped-1{
background-position: -23px -169px;
}
public function getHeaders() {
return '<link rel="stylesheet" type="text/css" href="../view/css/DataTables/css/jquery.dataTables.min.css" />
<script type="text/javascript" src="../view/js/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="../view/js/jquery.dataTables.1.10.12.min.js"></script>
<style type="text/css">
div.btn{
width: 18px;
height: 18px;
padding: 3px 5px;
background-image: url("../view/graphics/MyEbaySprite.png");
background-repeat: no-repeat;
float: left;
cursor: pointer;
}
.btn-paid-0{
background-position: -23px -90px;
}
.btn-paid-1{
background-position: -70px -90px;
}
.btn-repaid-0{
background-position: -148px -89px;
}
.btn-repaid-1{
background-position:-194px -89px;
}
.btn-backstepped-0{
background-position: -51px -169px;
}
.btn-backstepped-1{
background-position: -23px -169px;
}
</style>";
$text .= "Meldeliste";
$columns = array(
"bachelor_id",
"fahrt_id",
"anm_time",
"forname",
"sirname",
"mehl",
"pseudo",
"antyp",
"abtyp",
"anday",
"abday",
"comment",
"studityp",
"paid",
"repaid",
"backstepped"
);
$columnFunctions = array(
"Anmelde-ID" => function($person) { return $person["bachelor_id"]; }
//,"FahrtID" => function($person) { return $person["fahrt_id"]; }
,"Anmeldung" => function($person) { return date("d.m.Y", $person['anm_time']); },
"Name" => function($person) { return "<a href='mailto:".$person["mehl"]."?subject=FS-Fahrt'>".$person["forname"]." ".$person["sirname"]." (".$person["pseudo"].")</a>"; },
"Anreisetyp" => function($person) { return $person["antyp"]; },
"Abreisetyp" => function($person) { return $person["abtyp"]; },
"Anreisetag" => function($person) { return date("d.m.Y", $person["anday"]); },
"Abreisetag" => function($person) { return date("d.m.Y", $person["abday"]); },
"Kommentar" => function($person) { return $person["comment"]; },
"StudiTyp" => function($person) { return $person["studityp"]; },
"PaidReBack" => function($person) { return ($person["paid"] ? $person["paid"] : "0") .",". ($person["repaid"] ? $person["repaid"] : "0") .",". ($person["backstepped"] ? $person["backstepped"] : "0"); }
);
$text .=<<<END
<table id="mlist">
<thead>
<tr>
END;
foreach($columnFunctions as $key => $value)
{
$text .= "<th>".$key."</th>";
}
$text .=<<<END
</tr>
</thead>
<tbody>
END;
$people = $admin_db->select('bachelor',$columns, array("fahrt_id"=>$config_current_fahrt_id));
foreach($people as $person) {
$text .= "<tr>"; //".((explode(',',$columnFunctions['PaidReBack']($person))[2]==0) ? "" : "class='list-backstepped'")."
foreach($columnFunctions as $key => $value)
{
$text .= "<td class='".$key.((explode(',',$columnFunctions['PaidReBack']($person))[2]==0) ? '' : ' list-backstepped')."'>".$value($person)."</td>";
#editForm{
display: none;
position: fixed;
top:100px;
left: 200px;
width: 700px;
height: 80%;
border: 1px solid #000000;
background-color: beige;
padding: 20px 10px 10px 10px;
}
#editForm>p{
display: block;
position:absolute;
height:auto;
bottom:0;
top:0;
left:0;
right:0;
overflow: auto;
padding: 10px;
margin: 20px 0 0 0;
}
#editFormTopbar{
background-color: #b0bed9;
height: 20px;
position: absolute;
top: 0;
left: 0;
right: 0;
padding: 0;
}
#editFormTopbar p{
position: absolute;
float: right;
top: 0;
padding: 0;
margin: 0;
right: 5px;
cursor: none;
height: 20px;
display: block;
}
</style>';
}
$text .= "</tr>";
}
$text .=<<<END
</tbody>
</table>
<script type='text/javascript'>
$(document).ready(function(){
$('#mlist').dataTable({
"iDisplayLength": 20,
"columnDefs": [{
"render": function ( data, type, row ) {
var btns = "";
var classes = ["paid", "repaid", "backstepped"];
var txt = data.split(",");
for(var i = 0; i < txt.length; i++){
var tmp = (txt[i]==0) ? 0 : 1;
btns += "<div onclick=\"btnclick(this, '"+classes[i]+"','"+row[0]+"',"+tmp+");\" class='btn btn-"+classes[i]+"-"+tmp+"'>&nbsp;</div>";
public function getHeader() {
return '';
}
public function getFooter() {
return '';
}
public function getText() {
$extra_filters = ['fahrt_id' => $this->fahrt->getID()];
$cols = ['Anmelde-ID','Anmeldung', 'Name', 'Pseudo', 'Anreisetyp', 'Abreisetyp', 'Anreisetag','Abreisetag',
'Kommentar','Studityp','Essen', '18+', 'Orga', 'M.spiel', 'PaidReBack'];
$buttoncol = count($cols)-1;
$thead = '';
$toggle = 'Toggle Column:';
foreach ($cols as $tcnt => $col) {
$thead .= '<th>'.$col.'</th>';
$toggle .= '<a class="toggle-vis" data-column="' . $tcnt . '">' . $col . '</a> - ';
}
if ($this->isWaitlist) {
$thead .= '<th>Übertragen</th>';
$toggle .= '<a class="toggle-vis" data-column=\''.sizeof($cols).'\'>toWaitlist</a> - ';
$extra_filters['on_waitlist'] = 1;
$extra_filters['studityp'.($this->isAlumniPage ? '' : '[!]')] = 'ALUMN';
} else {
$extra_filters['AND'] = [
'on_waitlist' => 0
];
$includeResigned = false;
if (isset($_REQUEST['includeResigned'])) {
$includeResigned = true;
}
if (!$includeResigned) {
$extra_filters['AND']['backstepped'] = null;
}
$thead .= '<th>toWaitlist</th>';
$toggle .= '<a class="toggle-vis" data-column=\''.sizeof($cols).'\'>toWaitlist</a> - ';
}
$tbody = '';
$people = $this->environment->database->select('bachelor', Bachelor::$ALLOWED_FIELDS,
['AND' => $extra_filters], ['anm_time' => 'ASC']);
foreach ($people as $b) {
$zurueckgetreten = $b['backstepped'] ? 1 : 0;
$anfahrtDatum = $this->mysql2german($b['anday']);
$abfahrtDatum = $this->mysql2german($b['abday']);
$antyp = strtolower($b['antyp']);
$abtyp = strtolower($b['abtyp']);
$studityp = strtolower($b['studityp']);
$essen = strtolower($b['essen']);
$anmelde_zeit = date('d.m.Y - G:i.s', $b['anm_time']);
$ueber18JaNein = $b['virgin'] == 1 ? 'Nein' : 'Ja';
$orgaJaNein = $b['isOrga'] == 1 ? 'Ja' : 'Nein';
$moerderSpielJaNein = $b['mGame'] == 1 ? 'Ja' : 'Nein';
$bezahltJaNein = $b['paid'] ? 1 : 0;
$zurueckgezahltJaNein = $b['repaid'] ? 1 : 0;
$kommentar = htmlspecialchars($b['comment'], ENT_QUOTES);
$waitlist_tf = $this->isWaitlist ? "true" : "false";
$alumni_tf = $this->isAlumniPage ? "true" : "false";
$transfer_text = $this->isWaitlist ? "Anmeldeliste" : "Warteliste";
$tbody .= <<<EOF
<tr>
<td><a href="#" class="edit_bachelor">${b['bachelor_id']}</a></td>
<td>$anmelde_zeit</td>
<td><a href="mailto:${b['mehl']}?subject=FS-Fahrt">${b['forname']} ${b['sirname']}</a></td>
<td>${b['pseudo']}</td>
<td>${antyp}</td>
<td>${abtyp}</td>
<td>$anfahrtDatum</td>
<td>$abfahrtDatum</td>
<td>$kommentar</td>
<td>${studityp}</td>
<td>${essen}</td>
<td>$ueber18JaNein</td>
<td>$orgaJaNein</td>
<td>$moerderSpielJaNein</td>
<td>$bezahltJaNein,$zurueckgezahltJaNein,$zurueckgetreten</td>
<td><a href="?page=list&waitlist=${waitlist_tf}&alumni=${alumni_tf}&move=${b['bachelor_id']}">&#8614; ${transfer_text}</a></td>
<td>$zurueckgetreten</td>
</tr>
EOF;
}
$resignCheckbox = '';
if (!$this->isWaitlist) {
$includeResignedChecked = isset($_REQUEST['includeResigned']) && $_REQUEST['includeResigned'] == 1 ? 'checked ' : '';
$resignCheckbox .= <<<EOF
<form method="GET">
<input type="hidden" name="page" value="list" />
<label><input type="checkbox" name="includeResigned" value="1" $includeResignedChecked /> Abspringer anzeigen</label>
<input type="submit" value="aktualisieren" />
</form><br/>
EOF;
}
return '<h1>' . ($this->isWaitlist ? 'Warteliste' : 'Meldeliste') . ($this->isAlumniPage ? ' für Alumnis' : '') . '</h1>' .
$this->getMessage().'<br />' .
$resignCheckbox.
$toggle.'<br />
<br />
<table id="mlist" class="compact hover">
<thead>
<tr>'.$thead.'<th></th></tr>
</thead>
<tbody>'.$tbody.'</tbody>
</table>
<div id="editForm">
<div id="editFormTopbar"><p>X</p></div>
<p></p>
</div>
<script type="text/javascript">
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
"link-pre": function ( a ) {
return a.match(/<a [^>]+>([^<]+)<\/a>/)[1];
},
"prb-pre": function ( a ) {
var tmp = a.split(",");
return ((tmp[0]==0) ? "0" : "1") + ((tmp[1]==0) ? "0" : "1") + ((tmp[2]==0) ? "0" : "1");
},
"dedate-pre": function( a ) {
var tmp = a.split(".");
if(tmp.length>2)
return (tmp[2]+tmp[1]+tmp[0]);
return a;
}
});
var ltab;
$(document).ready(function() {
ltab = $("#mlist").DataTable({
"rowCallback": function (row, data, index) {
var spl = data['.$buttoncol.'].split(",");
if (spl[2] != 0) {
$("td", row).addClass("list-backstepped");
} else if (spl[0] != 0 && spl[1] != 0) {
$("td", row).addClass("list-repaid");
} else if (spl[0] != 0) {
$("td", row).addClass("list-paid");
} else if (spl[0] == 0) {
$("td", row).addClass("list-unpaid");
}
return btns;
},
"targets": 9
}]
});
});
function btnclick(that, type, hash, state){
var newstate = (((state-1)<0) ? 1 : 0);
$.get("index.php?page=list&ajax=ajax&update="+type+"&hash="+hash+"&nstate="+newstate ,"",
function(){
that.className="btn btn-"+type+"-"+newstate;
that.setAttribute("onclick", "btnclick(this, '"+type+"', '"+hash+"', "+newstate+")");
"columnDefs": [
{
"targets": ['.$buttoncol.'],
"render": function(data, type, row, meta) {
if (type === "display"){
var bid = row[0].match(/<a [^>]+>([^<]+)<\/a>/)[1];
var classes = ["paid", "repaid", "backstepped"];
var btns = "";
var parts = data.split(",");
for (var i = 0; i < parts.length; i++) {
var tmp = (parts[i] ==0) ? 0 : 1;
btns +="<div onclick=\\"btnclick(this, \'"+classes[i]+"\',\'"+bid+"\',"+tmp+");\\" class=\\"btn btn-"+classes[i]+"-"+tmp+"\\">&nbsp;</div>";
}
return btns;
}
return data;
}
},
{ type: "dedate", targets: [1,5,6]},
{ type: "link", targets: [0, 2] },
{ type: "prb", targets: ' . $buttoncol . ' },
{ targets: 16, visible: false, searchable: false }
],
"order": [[ 2, "asc" ]],
"paging": false,
"orderFixed": [ 16, "asc" ]
});
$("a.toggle-vis").click( function (e) {
e.preventDefault();
if($(this).attr("data-column")>=0) {
// Get the column API object
var column = ltab.column( $(this).attr("data-column") );
// Toggle the visibility
column.visible( ! column.visible() );
}
});
$(".moveToWaitlist").click( function(){
var bid = $(this).closest("tr").find("td:eq(0)").text();
$.get( "?page=list&ajax=ajax&toWaitlist=toWaitlist&hash="+bid, function( data ) {});
});
$(".edit_bachelor").click( function(){
var bid = $(this).text();
$.get( "?page=list&ajax=ajax&form=form&hash="+bid, function( data ) {
$("#editForm > p").html(data);
});
$("#editForm").show();
});
$("#editFormTopbar > p").click( function(){
$(this).parent().parent().hide();
});
var column = ltab.column(3);
column.visible(false);
var column = ltab.column(8);
column.visible(false);
});
function btnclick(that, type, hash, state){
var newstate = (((state-1)<0) ? 1 : 0);
$.get("index.php?page=list&ajax=ajax&update="+type+"&hash="+hash+"&nstate="+newstate ,"",
function(){
that.className="btn btn-"+type+"-"+newstate;
that.setAttribute("onclick", "btnclick(this, \'"+type+"\', \'"+hash+"\', "+newstate+")");
var p = $("div", $(that).parent())[0].className;
var r = $("div", $(that).parent())[1].className;
var b = $("div", $(that).parent())[2].className;
if (b == "btn btn-backstepped-1") {
updateClass(that, "list-backstepped");
} else if (p == "btn btn-paid-1" && r == "btn btn-repaid-1") {
updateClass(that, "list-repaid");
} else if (p == "btn btn-paid-1") {
updateClass(that, "list-paid");
} else if (p == "btn btn-paid-0") {
updateClass(that, "list-unpaid");
} else {
updateClass(that);
}
});
}
function updateClass(that, nClass = null) {
$("td", $(that).parent().parent()).removeClass("list-backstepped")
.removeClass("list-repaid")
.removeClass("list-paid")
.removeClass("list-unpaid");
if(nClass != null)
$("td", $(that).parent().parent()).addClass(nClass);
}
</script>';
}
public function getAjax() {
if (isset($_REQUEST['update']) && isset($_REQUEST['hash']) && isset($_REQUEST['nstate'])) {
$b = Bachelor::makeFromDB($this->fahrt, $_REQUEST['hash']);
$b->set([$_REQUEST['update'] => ($_REQUEST['nstate'] == 1) ? time() : null]);
return $b->save();
} elseif (isset($_REQUEST['form'])) {
return $this->getEditForm(Bachelor::makeFromDB($this->fahrt, $_REQUEST['hash']));
} elseif(isset($_REQUEST['toWaitlist'])) {
try {
$bachelor = Bachelor::makeFromDB($this->fahrt, $_REQUEST['hash']);
if (empty($bachelor))
throw new Exception('Person nicht vorhanden.');
$transferResult = $bachelor->registrationToWaitlist();
if ($transferResult == Bachelor::SAVE_SUCCESS) {
$this->message_succ = 'Person erfolgreich von Warteliste auf Anmeldeliste übertragen.';
return true;
} else {
throw new Exception('Hat nicht geklappt. Fehlercode '.$transferResult);
}
} catch (Exception $e) {
$this->message_err = $e->getMessage();
}
}
</script>
END;
}
\ No newline at end of file
}
private function nulltime2german($time) {
if (empty($time)) return 'Nein';
return $this->mysql2german($time);
}
/**
* @param $bachelor Bachelor
* @return string
*/
private function getEditForm($bachelor) {
$data = $bachelor->getData();
$bid = $data['bachelor_id'];
$fid = $data['fahrt_id'];
$possibleDates = $this->fahrt->getPossibleDates();
return '
<b>Hash:</b> <a href="../status.php?fid='.$fid.'&hash='.$bid.'" target="_blank">' . $bid . '</a><br/>
<b>Fahrt:</b> ID ' . $fid . '<br/>
<b>Anmeldung:</b> ' . $this->mysql2german($data['anm_time']) . '<br/>
<b>Bezahlt:</b> ' . $this->nulltime2german($data['paid']) . '<br/>
<b>Rückgezahlt:</b> ' . $this->nulltime2german($data['repaid']) . '<br/>
<b>Zurückgetreten:</b> ' . $this->nulltime2german($data['backstepped']) . '<br/>
<br />
<div id="stylized" class="myform">
<form id="form" name="form" method="post">
<input type="hidden" value="' . $bid . '" name="change" id="change" />
<input type="hidden" value="' . $fid . '" name="fahrt_id" id="fahrt_id" />' .
$this->getFormInput('Vorname', 'forname', $data['forname'], '') .
$this->getFormInput('Nachname', 'sirname', $data['sirname'], '') .
$this->getFormInput('Anzeigename', 'pseudo', $data['pseudo'], '') .
$this->getFormInput('E-Mail', 'mehl', $data['mehl'], 'regelmäßig lesen!') .
$this->getFormSel('Er/Sie/Es ist', 'studityp', array_keys($this->environment->oconfig['studitypen']), $data['studityp'], '') .
$this->getFormSel('Alter 18+?', 'virgin', ['Ja', 'Nein'], ($data['virgin'] == 1) ? 'Nein' : 'Ja', 'Älter als 18?') .
$this->getFormSel('Ist in der Orga', 'isOrga', ['Ja', 'Nein'], ($data['isOrga'] == 1) ? 'Ja' : 'Nein', '') .
$this->getFormSel('Spielt Mörderspiel', 'mGame', ['Ja', 'Nein'], ($data['mGame'] == 1) ? 'Ja' : 'Nein', '') .
$this->getFormSel('Essenswunsch', 'essen', array_keys($this->environment->oconfig['essen']), $data['essen'], 'Info für den Koch') .
'<div style="clear:both;"></div>' .
$this->getFormSel2('Anreise', 'anday', array_slice($possibleDates, 0, -1), $this->mysql2german($data['anday']),
'antyp', array_keys($this->environment->oconfig['reisearten']), $data['antyp'], '') .
$this->getFormSel2('Abreise', 'abday', array_slice($possibleDates, 1), $this->mysql2german($data['abday']),
'abtyp', array_keys($this->environment->oconfig['reisearten']), $data['abtyp'], '') .
'<label>Anmerkung</label>
<textarea id="comment" name="comment" rows="3" cols="40">' . $data['comment'] . '</textarea>
<input type="checkbox" name="public" value="public" style="width:40px" ' . (($data['public'] == 0 ? " checked" : "")) . '>
<span style="float:left">Anmeldung verstecken</span><br/>
<div style="clear:both"></div>
Note: No check for validity of data here!
<button type="submit" name="submit" id="submit" value="submit">Ändern!</button>
<div class="spacer"></div>
</form>
</div>
<br /><hr /> <br/>
<form method="POST" >
Note: Keine Nachfrage, löscht direkt und unwiederruflich!!<br />
<input type="submit" name="submit_del" value="DELETE" />
<input type="hidden" name="delete" value="' . $bid . '" />
<input type="hidden" name="bachelor_id" value="' . $bid . '" />
<input type="hidden" name="fahrt_id" value="' . $fid . '" />
</form>';
}
}
<?php
/**
* Created by PhpStorm.
* User: tim
* Date: 8/17/14
* Time: 11:05 PM
*/
// ENHANCEMENT: simplified presets (Alle, gezahlt, nicht gezahlt, Anreise individuell)
class AdminMailPage extends AdminPage {
global $config_studitypen, $config_reisearten, $config_essen, $admin_db, $config_current_fahrt_id, $config_admin_verbose_level, $config_verbose_level, $text, $headers, $ajax;
$config_verbose_level = 0;
$config_admin_verbose_level = 0;
private $mails;
$headers .= '<script type="text/javascript" src="../view/js/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="../view/js/jquery-ui.min.js"></script>';
$text .= '
<script type="text/javascript">
$(function(){
public function __construct($base) {
parent::__construct($base);
$this->mails = $this->environment->database->select('bachelor',
['mehl', 'forname', 'sirname'],
$this->buildQueryWhere());
}
$("#mform").submit(function(event){
event.preventDefault();
var str = $("#mform").serialize();
str += "&submit=submit&ajax=ajax";
$.post(document.url, str, function(data){
$("#mails").html(data);
}, "text");
public function getHeaders() {
return '<script type="text/javascript" src="../view/js/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="../view/js/jquery-ui.min.js"></script>';
}
$("#mails").fadeOut().delay(50).fadeIn();
public function getHeader() {
return '';
}
});
});
</script>
<form method="POST" id="mform">
<table>
<tr>
<td>Studityp</td>
<td>Anreise</td>
<td>Abreise</td>
<td>Nächte</td>
<td>Essen</td>
<td>Gezahlt</td>
<td>Rückgezahlt</td>
<td>18+</td>
<td>Zurückgetreten</td>
</tr>
<tr>
<td><input type="checkbox" name="check_studityp" /></td>
<td><input type="checkbox" name="check_antyp" /></td>
<td><input type="checkbox" name="check_abtyp" /></td>
<td><input type="checkbox" name="check_nights" /></td>
<td><input type="checkbox" name="check_essen" /></td>
<td><input type="checkbox" name="check_paid" /></td>
<td><input type="checkbox" name="check_repaid" /></td>
<td><input type="checkbox" name="check_virgin" /></td>
<td><input type="checkbox" name="check_backstepped" /></td>
</tr>
<tr>
<td>
<select multiple name="val_studityp[]">';
foreach($config_studitypen as $typ)
$text .= '<option value="'.$typ.'">'.$typ.'</option>';
$text .= '
</select>
</td>
<td>
<select multiple name="val_antyp[]">';
foreach($config_reisearten as $typ)
$text .= '<option value="'.$typ.'">'.$typ.'</option>';
$text .= '
</select>
</td>
<td>
<select multiple name="val_abtyp[]">';
foreach($config_reisearten as $typ)
$text .= '<option value="'.$typ.'">'.$typ.'</option>';
$text .= '
</select>
</td>
<td>
<select multiple name="val_nights[]">';
$tage = $admin_db->query("SELECT DATEDIFF(bis, von) AS diff FROM fahrten WHERE fahrt_id=".$config_current_fahrt_id)->fetch(0);
for($cnt = $tage['diff']; $cnt>=0; $cnt--)
$text .= '<option value="'.$cnt.'">'.$cnt.'</option>';
$text .= '
</select>
</td>
<td>
<select multiple name="val_essen[]">';
foreach($config_essen as $typ)
$text .= '<option value="'.$typ.'">'.$typ.'</option>';
$text .= '
</select>
</td>
<td>
<select name="val_paid">
<option value="1">Ja</option>
<option value="0">Nein</option>
</select>
</td>
<td>
<select name="val_repaid">
<option value="1">Ja</option>
<option value="0">Nein</option>
</select>
</td>
<td>
<select name="val_virgin">
<option value="1">Ja</option>
<option value="0">Nein</option>
</select>
</td>
<td>
<select name="val_backstepped">
<option value="1">Ja</option>
<option value="0">Nein</option>
</select>
</td>
</tr>
</table>
<input type="submit" name="submit">
</form>';
public function getFooter() {
return '';
}
$query = "SELECT mehl, forname, sirname FROM bachelor";
$where = array();
$dsa = "";
if(!isset($_REQUEST['submit'])){
// not submitted
//$dsa = "nosubmit";
} else {
//$dsa = "submit";
if(isset($_REQUEST['check_studityp'])){
$tmp = "";
foreach($_REQUEST['val_studityp'] as $st){
$tmp.= "studityp = '".$st."' OR ";
public function getText() {
$studitypen = '';
foreach ($this->environment->oconfig['studitypen'] as $key => $typ) {
$studitypen .= '<option value="' . $key . '">' . $typ . '</option>';
}
array_push($where,substr($tmp,0,-3));
}
if(isset($_REQUEST['check_antyp'])){
$tmp = "";
foreach($_REQUEST['val_antyp'] AS $st){
$tmp.= "antyp = '".$st."' OR ";
$reisearten = '';
foreach ($this->environment->oconfig['reisearten'] as $key => $typ) {
$reisearten .= '<option value="' . $key . '">' . $typ . '</option>';
}
array_push($where,substr($tmp,0,-3));
}
if(isset($_REQUEST['check_abtyp'])){
$tmp = "";
foreach($_REQUEST['val_abtyp'] AS $st){
$tmp.= "abtyp = '".$st."' OR ";
$essen = '';
foreach ($this->environment->oconfig['essen'] as $key => $typ) {
$essen .= '<option value="' . $key . '">' . $typ . '</option>';
}
array_push($where,substr($tmp,0,-3));
$maxtage = $this->fahrt->getLenTage();
$tage = '';
for ($cnt = $maxtage; $cnt >= 0; $cnt--)
$tage .= '<option value="' . $cnt . '">' . $cnt . '</option>';
return '
<script type="text/javascript">
$(function(){
$("#mform").submit(function(event){
event.preventDefault();
var str = $("#mform").serialize();
str += "&submit=submit&ajax=ajax";
$.post(document.url, str, function(data){
$("#mails").html(data);
}, "text");
$("#mails").fadeOut().delay(50).fadeIn();
});
});
</script>
<form method="POST" id="mform">
<label>
Trennzeichen
<select name="trenner">
<option>"; "</option>
<option value="br">Zeilenumbruch</option>
</select>
</label>
<table>
<tr>
<td>Studityp</td>
<td>Anreise</td>
<td>Abreise</td>
<!--<td>Nächte</td>-->
<td>Essen</td>
<td>Gezahlt</td>
<td>Rückgezahlt</td>
<td>18+</td>
<td>Zurückgetreten</td>
<td>Orga?</td>
<td>Liste</td>
</tr>
<tr>
<td><input type="checkbox" name="check_studityp" /></td>
<td><input type="checkbox" name="check_antyp" /></td>
<td><input type="checkbox" name="check_abtyp" /></td>
<!--<td><input type="checkbox" name="check_nights" /></td>-->
<td><input type="checkbox" name="check_essen" /></td>
<td><input type="checkbox" name="check_paid" /></td>
<td><input type="checkbox" name="check_repaid" /></td>
<td><input type="checkbox" name="check_virgin" /></td>
<td><input type="checkbox" name="check_backstepped" /></td>
<td><input type="checkbox" name="check_isOrga" /></td>
<td><input type="checkbox" name="check_list" /></td>
</tr>
<tr>
<td>
<select multiple name="val_studityp[]">' . $studitypen . '</select>
</td>
<td>
<select multiple name="val_antyp[]">' . $reisearten . '</select>
</td>
<td>
<select multiple name="val_abtyp[]">' . $reisearten . '</select>
</td>
<!--<td>
<select multiple name="val_nights[]">' . $tage . '</select>
</td>-->
<td>
<select multiple name="val_essen[]">' . $essen . '</select>
</td>
<td>
<select name="val_paid">
<option value="1">Ja</option>
<option value="0">Nein</option>
</select>
</td>
<td>
<select name="val_repaid">
<option value="1">Ja</option>
<option value="0">Nein</option>
</select>
</td>
<td>
<select name="val_virgin">
<option value="0">Ja</option>
<option value="1">Nein</option>
</select>
</td>
<td>
<select name="val_backstepped">
<option value="1">Ja</option>
<option value="0">Nein</option>
</select>
</td>
<td>
<select name="val_isOrga">
<option value="1">Ja</option>
<option value="0">Nein</option>
</select>
</td>
<td>
<select name="val_list">
<option value="0">Anmeldeliste</option>
<option value="1">Warteliste</option>
<option value="2">War auf Warteliste</option>
</select>
</td>
</tr>
</table>
<input type="submit" name="submit">
</form>
<textarea style="height:300px; width:800px" id="mails">'.$this->transformContacts().'</textarea>';
}
if(isset($_REQUEST['check_nights'])){
// TODO
public function getAjax() {
return $this->transformContacts();
}
if(isset($_REQUEST['check_essen'])){
$tmp = "";
foreach($_REQUEST['val_essen'] AS $st){
$tmp.= "essen = '".$st."' OR ";
private function transformContacts() {
$trenner = "; ";
if (isset($_REQUEST['trenner'])) {
$trenner = $_REQUEST['trenner'];
if ($trenner == 'br') $trenner = "\n";
}
array_push($where,substr($tmp,0,-3));
}
if(isset($_REQUEST['check_paid'])){
if($_REQUEST['val_paid'] == 1)
array_push($where,"paid IS NOT NULL");
else
array_push($where,"paid IS NULL");
}
if(isset($_REQUEST['check_repaid'])){
if($_REQUEST['val_repaid'] == 1)
array_push($where,"repaid IS NOT NULL");
else
array_push($where,"repaid IS NULL");
}
if(isset($_REQUEST['check_virgin'])){
array_push($where,"virgin = ".$_REQUEST['val_virgin']);
$accounts = array_map(function($mehl) {
return $mehl['forname'] . " " . $mehl['sirname'] . " <" . $mehl['mehl'] . ">";
}, $this->mails);
sort($accounts);
return join($trenner, $accounts);
}
if(isset($_REQUEST['check_backstepped'])){
if($_REQUEST['val_backstepped'] == 1)
array_push($where,"backstepped IS NOT NULL");
else
array_push($where,"backstepped IS NULL");
}
if(count($where)>0){
$query .= " WHERE ";
foreach($where AS $w)
$query .= "(".$w.") AND ";
$query = substr($query,0,-4); // cut last AND
private function buildQueryWhere() {
$where = ['fahrt_id' => $this->fahrt->getID()];
if (isset($_REQUEST['submit'])) {
if (isset($_REQUEST['check_'])) {
$where['wasOnWaitlist' . ($_REQUEST['val_wasOnWaitlist'] == 1 ? '[!]' : '')] = null;
}
if (isset($_REQUEST['check_studityp'])) {
$where['studityp'] = $_REQUEST['val_studityp'];
}
if (isset($_REQUEST['check_antyp'])) {
$where['antyp'] = $_REQUEST['val_antyp'];
}
if (isset($_REQUEST['check_abtyp'])) {
$where['abtyp'] = $_REQUEST['val_abtyp'];
}
if (isset($_REQUEST['check_nights'])) {
// TODO
}
if (isset($_REQUEST['check_essen'])) {
$where['essen'] = $_REQUEST['val_essen'];
}
if (isset($_REQUEST['check_paid'])) {
$where['paid' . ($_REQUEST['val_paid'] == 1 ? '[!]' : '')] = null;
}
if (isset($_REQUEST['check_repaid'])) {
$where['repaid' . ($_REQUEST['val_repaid'] == 1 ? '[!]' : '')] = null;
}
if (isset($_REQUEST['check_virgin'])) {
$where['virgin'] = $_REQUEST['val_virgin'];
}
if (isset($_REQUEST['check_backstepped'])) {
$where['backstepped' . ($_REQUEST['val_backstepped'] == 1 ? '[!]' : '')] = null;
}
if (isset($_REQUEST['check_isOrga'])) {
$where['isOrga'] = $_REQUEST['val_isOrga'];
}
if (isset($_REQUEST['check_list'])) {
if($_REQUEST['val_list'] == 0) { // anmeldeliste
$where['OR'] = ['on_waitlist' => 0];
}else if($_REQUEST['val_list'] == 1){ // waitlist
$where['OR'] = ['on_waitlist' => 1];
}else if($_REQUEST['val_list'] == 2){ // was on waitlist
$where['AND'] = [
'on_waitlist' => 0,
'transferred[!]' => null
];
}
}
}else{
$where['OR'] = ['on_waitlist' => 0,
'AND' => [
'transferred[!]' => null,
'on_waitlist' => 1
]];
}
return ['AND' => $where];
}
}
//$config_verbose_level = 4;
$tmp = $admin_db->query($query.";");
if($tmp)
$mails = $tmp->fetchAll(PDO::FETCH_ASSOC);
else{
comm_admin_verbose(3,$admin_db->error());
$mails = array();
}
$text .= '<textarea style="height:300px; width:800px" id="mails">'.$dsa;
foreach($mails as $mehl){
$text .= "<".$mehl['forname']." ".$mehl['sirname']."> ".$mehl['mehl']."; ";
$ajax .= "<".$mehl['forname']." ".$mehl['sirname']."> ".$mehl['mehl']."; ";
}
$text .= '</textarea>';
comm_admin_verbose(3,$_REQUEST);
?>
<?php
/**
* Created by PhpStorm.
* User: tim
* Date: 8/9/14
* Time: 4:07 PM
*/
global $headers, $text, $admin_db, $config_current_fahrt_id, $config_admin_verbose_level, $config_verbose_level;
$config_admin_verbose_level = 0;
$config_verbose_level = 0;
if(isset($_POST['note-content'])){
comm_admin_verbose(2,"received submit");
$cont = $_REQUEST['note-content'];
$admin_db->update("notes",array("note"=>$cont),array("fahrt_id"=>$config_current_fahrt_id));
}
class AdminNotesPage extends AdminPage {
$content = $admin_db->get("notes", "note", array("fahrt_id"=>$config_current_fahrt_id));
public function __construct($base) {
parent::__construct($base);
$headers .="<!-- wysihtml5 parser rules -->
<script src=\"../view/js/wysihtml5-0.3.0_rc2.min.js\"></script>
<!-- Library -->
<script src=\"../view/js/wysihtml5-advanced.js\"></script>
if (isset($_POST['note-content'])) {
$cont = $_REQUEST['note-content'];
if ($this->environment->database->has('notes', ['fahrt_id' => $this->fahrt->getID()]))
$this->environment->database->update('notes', ['note' => $cont], ['fahrt_id' => $this->fahrt->getID()]);
else
$this->environment->database->insert('notes', ['note' => $cont, 'fahrt_id' => $this->fahrt->getID()]);
}
<link type='text/css' rel='stylesheet' href='../view/css/wysihtml5/editor.css' />
<link type='text/css' rel='stylesheet' href='../view/css/wysihtml5/stylesheet.css' />";
$this->content = $this->environment->database->get('notes', 'note', ['fahrt_id' => $this->fahrt->getID()]);
}
$text .= '
<div id="wysihtml5-editor-toolbar">
<header>
<ul class="commands">
<li data-wysihtml5-command="bold" title="Make text bold (CTRL + B)" class="command"></li>
<li data-wysihtml5-command="italic" title="Make text italic (CTRL + I)" class="command"></li>
<li data-wysihtml5-command="insertUnorderedList" title="Insert an unordered list" class="command"></li>
<li data-wysihtml5-command="insertOrderedList" title="Insert an ordered list" class="command"></li>
<li data-wysihtml5-command="createLink" title="Insert a link" class="command"></li>
<li data-wysihtml5-command="insertImage" title="Insert an image" class="command"></li>
<li data-wysihtml5-command="formatBlock" data-wysihtml5-command-value="h1" title="Insert headline 1" class="command"></li>
<li data-wysihtml5-command="formatBlock" data-wysihtml5-command-value="h2" title="Insert headline 2" class="command"></li>
<li data-wysihtml5-command-group="foreColor" class="fore-color" title="Color the selected text" class="command">
<ul>
<li data-wysihtml5-command="foreColor" data-wysihtml5-command-value="silver"></li>
<li data-wysihtml5-command="foreColor" data-wysihtml5-command-value="gray"></li>
<li data-wysihtml5-command="foreColor" data-wysihtml5-command-value="maroon"></li>
<li data-wysihtml5-command="foreColor" data-wysihtml5-command-value="red"></li>
<li data-wysihtml5-command="foreColor" data-wysihtml5-command-value="purple"></li>
<li data-wysihtml5-command="foreColor" data-wysihtml5-command-value="green"></li>
<li data-wysihtml5-command="foreColor" data-wysihtml5-command-value="olive"></li>
<li data-wysihtml5-command="foreColor" data-wysihtml5-command-value="navy"></li>
<li data-wysihtml5-command="foreColor" data-wysihtml5-command-value="blue"></li>
</ul>
</li>
<li data-wysihtml5-command="insertSpeech" title="Insert speech" class="command"></li>
<li data-wysihtml5-action="change_view" title="Show HTML" class="action"></li>
</ul>
</header>
<div data-wysihtml5-dialog="createLink" style="display: none;">
<label>
Link:
<input data-wysihtml5-dialog-field="href" value="http://">
</label>
<a data-wysihtml5-dialog-action="save">OK</a>&nbsp;<a data-wysihtml5-dialog-action="cancel">Cancel</a>
</div>
public function getHeaders() {
return "<!-- wysihtml5 parser rules -->
<script src=\"../view/js/wysihtml5-0.3.0_rc2.min.js\"></script>
<!-- Library -->
<script src=\"../view/js/wysihtml5-advanced.js\"></script>
<div data-wysihtml5-dialog="insertImage" style="display: none;">
<label>
Image:
<input data-wysihtml5-dialog-field="src" value="http://">
</label>
<a data-wysihtml5-dialog-action="save">OK</a>&nbsp;<a data-wysihtml5-dialog-action="cancel">Cancel</a>
</div>
</div>
<link type='text/css' rel='stylesheet' href='../view/css/wysihtml5/editor.css' />
<link type='text/css' rel='stylesheet' href='../view/css/wysihtml5/stylesheet.css' />
<style type='text/css'>
body {
/*width: 810px;*/
min-height: 100%;
/*margin: 0 auto;*/
padding-top: 40px !important;
padding-left: 10px !important;
}
#admin-content{
height: 100% !important;
}
</style>";
}
<section><form method="POST" style="height:100%"> <input type="submit" name="submit" value="submit" /><textarea name="note-content" id="wysihtml5-editor" spellcheck="false" wrap="off" placeholder="Enter your text ...">'.$content.'</textarea></form></section>
public function getHeader() {
return '';
}
<script>
var editor = new wysihtml5.Editor("wysihtml5-editor", {
toolbar: "wysihtml5-editor-toolbar",
stylesheets: ["../view/css/wysihtml5/editor.css"],
parserRules: wysihtml5ParserRules
});
public function getFooter() {
return '';
}
editor.on("load", function() {
var composer = editor.composer,
h1 = editor.composer.element.querySelector("h1");
if (h1) {
composer.selection.selectNode(h1);
}
});
</script>';
public function getText() {
return '
<div id="wysihtml5-editor-toolbar">
<header>
<ul class="commands">
<li data-wysihtml5-command="bold" title="Make text bold (CTRL + B)" class="command"></li>
<li data-wysihtml5-command="italic" title="Make text italic (CTRL + I)" class="command"></li>
<li data-wysihtml5-command="insertUnorderedList" title="Insert an unordered list" class="command"></li>
<li data-wysihtml5-command="insertOrderedList" title="Insert an ordered list" class="command"></li>
<li data-wysihtml5-command="createLink" title="Insert a link" class="command"></li>
<li data-wysihtml5-command="insertImage" title="Insert an image" class="command"></li>
<li data-wysihtml5-command="formatBlock" data-wysihtml5-command-value="h1" title="Insert headline 1" class="command"></li>
<li data-wysihtml5-command="formatBlock" data-wysihtml5-command-value="h2" title="Insert headline 2" class="command"></li>
<li data-wysihtml5-command-group="foreColor" class="fore-color command" title="Color the selected text">
<ul>
<li data-wysihtml5-command="foreColor" data-wysihtml5-command-value="silver"></li>
<li data-wysihtml5-command="foreColor" data-wysihtml5-command-value="gray"></li>
<li data-wysihtml5-command="foreColor" data-wysihtml5-command-value="maroon"></li>
<li data-wysihtml5-command="foreColor" data-wysihtml5-command-value="red"></li>
<li data-wysihtml5-command="foreColor" data-wysihtml5-command-value="purple"></li>
<li data-wysihtml5-command="foreColor" data-wysihtml5-command-value="green"></li>
<li data-wysihtml5-command="foreColor" data-wysihtml5-command-value="olive"></li>
<li data-wysihtml5-command="foreColor" data-wysihtml5-command-value="navy"></li>
<li data-wysihtml5-command="foreColor" data-wysihtml5-command-value="blue"></li>
</ul>
</li>
<li data-wysihtml5-command="insertSpeech" title="Insert speech" class="command"></li>
<li data-wysihtml5-action="change_view" title="Show HTML" class="action"></li>
</ul>
</header>
<div data-wysihtml5-dialog="createLink" style="display: none;">
<label>
Link:
<input data-wysihtml5-dialog-field="href" value="http://">
</label>
<a data-wysihtml5-dialog-action="save">OK</a>&nbsp;<a data-wysihtml5-dialog-action="cancel">Cancel</a>
</div>
<div data-wysihtml5-dialog="insertImage" style="display: none;">
<label>
Image:
<input data-wysihtml5-dialog-field="src" value="http://">
</label>
<a data-wysihtml5-dialog-action="save">OK</a>&nbsp;<a data-wysihtml5-dialog-action="cancel">Cancel</a>
</div>
</div>
<section><form method="POST" style="height:100%">
<input type="submit" name="submit" value="submit" class="submit-button" />
<textarea name="note-content" id="wysihtml5-editor" spellcheck="false" wrap="off" placeholder="Enter your text ...">' .
$this->content .
'</textarea></form></section>
<script>
var editor = new wysihtml5.Editor("wysihtml5-editor", {
toolbar: "wysihtml5-editor-toolbar",
stylesheets: ["../view/css/wysihtml5/editor.css"],
parserRules: wysihtml5ParserRules
});
editor.on("load", function() {
var composer = editor.composer,
h1 = editor.composer.element.querySelector("h1");
if (h1) {
composer.selection.selectNode(h1);
}
});
</script>';
}
public function getAjax() {
return '';
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: tim
* Date: 9/17/14
* Time: 8:04 PM
*/
global $text, $headers, $admin_db, $config_current_fahrt_id, $ajax, $config_reisearten, $config_reisearten_0, $config_studitypen_o, $config_admin_verbose_level, $config_verbose_level, $config_essen;
//$config_admin_verbose_level = 4;
//$config_verbose_level = 4;
$text .= "<h1>Übersichtsseite</h1>";
$mitfahrer['gesam'] = $admin_db->count("bachelor", ["AND"=>
["backstepped" => NULL,
"fahrt_id" => $config_current_fahrt_id]]);
$mitfahrer['gesaa'] = $admin_db->count("bachelor", ["fahrt_id" => $config_current_fahrt_id]);
$mitfahrer['erste'] = $admin_db->query("SELECT date_format(anday, '%j') as anday, COUNT(anday) as anday_cnt FROM bachelor WHERE fahrt_id=".$config_current_fahrt_id." GROUP BY anday ORDER BY anday ASC LIMIT 1")->fetchAll()[0]['anday_cnt'];
$mitfahrer['zweit'] = $admin_db->query("SELECT date_format(abday, '%j') as abday, COUNT(abday) as abday_cnt FROM bachelor WHERE fahrt_id=".$config_current_fahrt_id." GROUP BY abday ORDER BY abday DESC LIMIT 1")->fetchAll()[0]['abday_cnt'];
$mitfahrer['veget'] = $admin_db->count("bachelor", ["AND"=>
["backstepped" => NULL,
"fahrt_id" => $config_current_fahrt_id,
"essen[!]" => $config_essen[0]]]);
$mitfahrer['backs'] = $admin_db->count("bachelor", ["AND"=>
["backstepped[!]" => NULL,
"fahrt_id" => $config_current_fahrt_id]]);
$mitfahrer['treff'] = $admin_db->count("bachelor", ["AND" =>
["antyp" => $config_reisearten_o["BUSBAHN"],
"backstepped" => NULL,
"fahrt_id" => $config_current_fahrt_id]]);
$mitfahrer['ersti'] = $admin_db->count("bachelor", ["AND"=>
["backstepped" => NULL,
"fahrt_id" => $config_current_fahrt_id,
"studityp" => $config_studitypen_o["ERSTI"]]]);
$mitfahrer['tutti'] = $admin_db->count("bachelor", ["AND"=>
["backstepped" => NULL,
"fahrt_id" => $config_current_fahrt_id,
"studityp" => $config_studitypen_o["TUTTI"]]]);
$mitfahrer['hoers'] = $admin_db->count("bachelor", ["AND"=>
["backstepped" => NULL,
"fahrt_id" => $config_current_fahrt_id],
"LIKE"=>["studityp" => $config_studitypen_o["HOERS"]]]);
$text .= "<div style='float:left; margin-left: 15px'><h2>Mitfahrer</h2>
<ul class='list-nodeco'>
<li>Gesamt: ".$mitfahrer['gesam']." (".$mitfahrer['gesaa'].")</li>
<ul>
<li>Erste Nacht: ".$mitfahrer['erste']."</li>
<li>Letzte Nacht: ".$mitfahrer['zweit']."</li>
<li>Nicht-Allesesser: ".$mitfahrer['veget']."</li>
<li>Zurückgetreten: ".$mitfahrer['backs']."</li>
<li>Personen am Treffpunkt: ".$mitfahrer['treff']."</li>
</ul>
<li>Verteilung</li>
<ul>
<li>Erstis: ".$mitfahrer['ersti']."</li>
<li>Hörstis: ".$mitfahrer['hoers']."</li>
<li>Tutti: ".$mitfahrer['tutti']."</li>
<li>= Anteil Erstis: ".round(($mitfahrer['ersti']/($mitfahrer['ersti']+$mitfahrer['hoers']+$mitfahrer['tutti']))*100,2)."%</li>
</ul>
</ul></div>";
$text .= "<div style='float:left; margin-left: 15px'><h2>Zahlungen</h2>
<ul>
<li>Zahlungen</li>
<ul>
<li>Erhalten:</li>
<li>Ausstehend:</li>
</ul>
<li>Einnahmen</li>
<ul>
<li>Soll:</li>
<li>Ist:</li>
<li>Differenz:</li>
</ul>
</ul></div>";
$text .= "<p style='clear:both'></p>";
class AdminOverviewPage extends AdminPage {
private $data;
public function __construct($base) {
parent::__construct($base);
$fid = $this->fahrt->getID();
$db = $this->environment->database;
// to use in OR
$notwaiting = ['on_waitlist' => 0,
'AND' => [
'transferred[!]' => null,
'on_waitlist' => 1
]];
$notwaitingQ = '(on_waitlist = 0 OR (transferred IS NOT NULL AND on_waitlist = 1))';
$baseW = ['fahrt_id' => $fid, 'OR'=>$notwaiting, 'backstepped'=>null];
$naechte = [
'erste' => $db->query("SELECT date_format(anday, '%j') as anday, COUNT(anday) as anday_cnt FROM bachelor WHERE fahrt_id = ".$fid." AND ".$notwaitingQ." AND backstepped IS NULL GROUP BY anday ORDER BY anday ASC LIMIT 1")->fetchAll(),
'zweite' => $db->query("SELECT date_format(abday, '%j') as abday, COUNT(anday) as abday_cnt FROM bachelor WHERE fahrt_id = ".$fid." AND ".$notwaitingQ." AND backstepped IS NULL GROUP BY abday ORDER BY anday ASC LIMIT 1")->fetchAll()
];
$this->data = [
'mitfahrer' => [
'gesamt' => $this->fahrt->getNumTakenSpots(),
'gesamt_all' => $db->count('bachelor', [
'AND' => ['fahrt_id' => $fid, 'OR' => $notwaiting]]),
'erste' => isset($naechte['erste'][0]) ? $naechte['erste'][0]['anday_cnt'] : 0,
'zweite' => isset($naechte['zweite'][0]) ? $naechte['zweite'][0]['abday_cnt'] : 0,
'vege' => $db->count('bachelor', ['AND' =>
['essen' => 'VEGE', 'fahrt_id'=>$fid, 'backstepped'=>null, 'OR' => $notwaiting]]),
'vega' => $db->count('bachelor', ['AND' =>
['essen' => 'VEGA', 'fahrt_id'=>$fid, 'backstepped'=>null, 'OR' => $notwaiting]]),
'backstepped' => $db->count('bachelor', ['AND' => ['fahrt_id' => $fid, 'backstepped[!]' => null]]),
'treffpunkt' => $db->count('bachelor', ['AND' => array_merge($baseW, ['antyp' => 'BUSBAHN'])]),
'berstis' => $db->count('bachelor', ['AND' => array_merge($baseW, ['studityp' => 'ERSTI_B'])]),
'merstis' => $db->count('bachelor', ['AND' => array_merge($baseW, ['studityp' => 'ERSTI_M'])]),
'erstis' => $db->count('bachelor', ['AND' => array_merge($baseW, ['studityp' => 'ERSTI'])]),
'orgas' => $db->count('bachelor', ['AND' => array_merge($baseW, ['isOrga' => 1])]),
'alumni' => $db->count('bachelor', ['AND' => array_merge($baseW, ['studityp' => 'ALUMN'])]),
'mentor' => $db->count('bachelor', ['AND' => array_merge($baseW, ['studityp' => 'MENTO'])]),
'hoerstis' => $db->count('bachelor', ['AND' => array_merge($baseW, ['studityp' => 'HOERS'])]), # deprecated
'bhoerstis' => $db->count('bachelor', ['AND' => array_merge($baseW, ['studityp' => 'HOERS_B'])]),
'mhoerstis' => $db->count('bachelor', ['AND' => array_merge($baseW, ['studityp' => 'HOERS_M'])]),
'virgins' => $db->count('bachelor', ['AND' => array_merge($baseW, ['virgin' => 1])])
],
'warte' => [
'transferred' => $db->count('bachelor', ['AND' => ['fahrt_id' => $fid, 'transferred[!]' => null, 'on_waitlist' => 1]]),
'waiting' => $db->count('bachelor', ['AND' => ['fahrt_id' => $fid, 'transferred' => null, 'on_waitlist' => 1]]),
'wl_al' => $db->count('bachelor', ['AND' => ['fahrt_id' => $fid, 'transferred' => null, 'on_waitlist' => 1, 'studityp' => 'ALUMN']]),
'wl' => $db->count('bachelor', ['AND' => ['fahrt_id' => $fid, 'transferred' => null, 'on_waitlist' => 1, 'studityp[!]' => 'ALUMN']]),
'on_waitlist' => $db->count('bachelor', ['AND' => ['fahrt_id' => $fid, 'on_waitlist' => 1]])
],
'money' => [
'in_erhalten' => $db->count('bachelor', ['AND' => ['fahrt_id' => $fid, 'paid[!]' => null]]),
'in_ausstehend' => $db->count('bachelor', ['AND' => array_merge($baseW, ['paid' => null])]),
'out_erhalten' => $db->count('bachelor', ['AND' => array_merge($baseW, ['repaid[!]' => null])]),
'out_ausstehend' => $db->count('bachelor', ['AND' => array_merge($baseW, ['repaid' => null])]),
]
];
$this->data['mitfahrer']['erstis'] = $this->data['mitfahrer']['merstis']+$this->data['mitfahrer']['berstis']+$this->data['mitfahrer']['erstis'];
$this->data['ratio'] = ['sum' => ($this->data['mitfahrer']['mentor']+$this->data['mitfahrer']['alumni']+$this->data['mitfahrer']['erstis']+$this->data['mitfahrer']['hoerstis'])];
if ($this->data['ratio']['sum'] > 0)
$this->data['ratio']['ratioErsti'] = round($this->data['mitfahrer']['erstis']/$this->data['ratio']['sum']*100, 2);
else
$this->data['ratio']['ratioErsti'] = round(100, 2);
if ($this->data['ratio']['sum'] > 0)
$this->data['ratio']['ratioBErsti'] = round($this->data['mitfahrer']['berstis']/$this->data['ratio']['sum']*100, 2);
else
$this->data['ratio']['ratioBErsti'] = round(100, 2);
if ($this->data['ratio']['sum'] > 0)
$this->data['ratio']['ratioMErsti'] = round($this->data['mitfahrer']['merstis']/$this->data['ratio']['sum']*100, 2);
else
$this->data['ratio']['ratioMErsti'] = round(100, 2);
if ($this->data['ratio']['sum'] > 0)
$this->data['ratio']['ratioHoerst'] = round($this->data['mitfahrer']['hoerstis']/$this->data['ratio']['sum']*100, 2);
else
$this->data['ratio']['ratioHoerst'] = round(100, 2);
if ($this->data['ratio']['sum'] > 0)
$this->data['ratio']['ratioHoerstMentoren'] = round(($this->data['mitfahrer']['hoerstis']+$this->data['mitfahrer']['mentor'])/$this->data['ratio']['sum']*100, 2);
else
$this->data['ratio']['ratioHoerstMentoren'] = round(100, 2);
if ($this->data['ratio']['sum'] > 0)
$this->data['ratio']['ratioMento'] = round($this->data['mitfahrer']['mentor']/$this->data['ratio']['sum']*100, 2);
else
$this->data['ratio']['ratioMento'] = round(100, 2);
if ($this->data['ratio']['sum'] > 0)
$this->data['ratio']['ratioAlumn'] = round($this->data['mitfahrer']['alumni']/$this->data['ratio']['sum']*100, 2);
else
$this->data['ratio']['ratioAlumn'] = round(100, 2);
}
public function getHeaders() {
return '';
}
public function getHeader() {
return '';
}
public function getFooter() {
return '';
}
public function getText() {
return '<h1>Übersichtsseite</h1>
<div style="float:left; margin-left: 15px">
<h2>Mitfahrende</h2>
<ul class="list-nodeco">
<li>Gesamt: '.$this->data['mitfahrer']['gesamt'].' ('.$this->data['mitfahrer']['gesamt_all'].')</li>
<ul>
<li>Erste Nacht: '.$this->data['mitfahrer']['erste'].'</li>
<li>Letzte Nacht: '.$this->data['mitfahrer']['zweite'].'</li>
<li>Nicht-Allesesser: '.$this->data['mitfahrer']['vege'].' (vegetarisch), '.$this->data['mitfahrer']['vega'].' (vegan)</li>
<li>Zurückgetreten: '.$this->data['mitfahrer']['backstepped'].'</li>
<li>Personen am Treffpunkt: '.$this->data['mitfahrer']['treffpunkt'].'</li>
</ul>
<li>Warteliste:</li>
<ul>
<li>Noch wartend: '.$this->data['warte']['waiting'].'</li>
<li>= Anteil Alumnis: '.$this->data['warte']['wl_al'].'</li>
<li>= Anteil Rest: '.$this->data['warte']['wl'].'</li>
<li>Übertragen: '.$this->data['warte']['transferred'].'</li>
<li>Gesamt: '.$this->data['warte']['on_waitlist'].'</li>
</ul>
<li>Verteilung:</li>
<ul>
<li>Jungfrauen: '.$this->data['mitfahrer']['virgins'].'</li>
<li>Erstis: '.$this->data['mitfahrer']['erstis'].'</li>
<li>Alumnis: '.$this->data['mitfahrer']['alumni'].'</li>
<li>Hörstis: '.$this->data['mitfahrer']['hoerstis'].'</li>
<li>MentorIn: '.$this->data['mitfahrer']['mentor'].'</li>
<li>= Anteil Hörstis: '.$this->data['ratio']['ratioHoerst'].'%</li>
<li>= Anteil Mentoren: '.$this->data['ratio']['ratioMento'].'%</li>
<li>= Anteil Alumnis: '.$this->data['ratio']['ratioAlumn'].'%</li>
<li>= Anteil Hörstis + Mentoren: '.$this->data['ratio']['ratioHoerstMentoren'].'%</li>
<li>= Anteil Erstis: '.$this->data['ratio']['ratioErsti'].'%</li>
<li>=> Anteil Bachelor Erstis: '.$this->data['ratio']['ratioBErsti'].'%</li>
<li>=> Anteil Master Erstis: '.$this->data['ratio']['ratioMErsti'].'%</li>
</ul>
<li>Orgas: '.$this->data['mitfahrer']['orgas'].'</li>
</ul>
</div>
<div style="float:left; margin-left: 15px"><h2>Zahlungen</h2>
<ul>
<li>Zahlungen</li>
<ul>
<li>Erhalten: '.$this->data['money']['in_erhalten'].'</li>
<li>Ausstehende Zahlungen: '.$this->data['money']['in_ausstehend'].'</li>
<li>Ausgezahlt: '.$this->data['money']['out_erhalten'].'</li>
<li>Ausstehende Rückzahlungen: '.$this->data['money']['out_ausstehend'].'</li>
</ul>
</ul>
</div>
<p style="clear:both"></p>';
}
public function getAjax() {
return '';
}
}
/* Vorlage:
*
......
<?php
// https://repke.eu:8443
// passwort manu:kuzerPenis666!
mb_internal_encoding('UTF-8');
mb_http_output('UTF-8');
......@@ -10,43 +8,43 @@ mb_regex_encoding('UTF-8');
ob_start('mb_output_handler');
date_default_timezone_set("Europe/Berlin");
$config_verbose_level = 3; // 0 = nothing, 1 = important, 2 = somewhat important, 3 = detailed verbose, 4 = with sql
$config_admin_verbose_level = 3;
// Adjust variables here ===============================================================================================
$config_db = array(
"name" => "fsfahrt",
"user" => "fsfahrt",
"pass" => "9Lug*96q",
"host" => "localhost",
"type" => "mysql"
);
// actually adjust the stuff in there...
require("config.local.php");
// ========= DONT TOUCH ANYTHING DOWN HERE!!! ==========================================================================
$config_invalidCharsRegEx = "/^[^0-9<>!?.::,#*@^_$\\\"'%;()&+]{2,50}$/"; // d©_©b
$config_studitypen_o = array(
"ERSTI" => "Ersti", // 0
//"Wechsli", // 1 - woanders/was anderes studiert, jetzt hier
//"MasterErsti", // 2
"HOERS" => "Hoersti", // 3 - länger an der HU
"TUTTI" => "Tutor" // 4 - Tutor
//"Fachi" // 5 - FS Ini
"ERSTI_B" => "Bachelor Ersti",
"ERSTI_M" => "Master Ersti",
"HOERS" => "Hörsti",
"HOERS_B" => "Bachelor Hörsti",
"HOERS_M" => "Master Hörsti",
"MENTO" => "MentorIn",
"ALUMN" => "Alumni"
);
$config_studitypen = array_values($config_studitypen_o);
$config_essen = array(
"Alles",
"Vegetarisch",
"Vegan"
//,"Frutarisch",
//"Grießbrei",
//"Carnivore",
//"Extrawurst"
$config_essen_o = array(
"ALLES" => "Alles",
"VEGE" => "Vegetarisch",
"VEGA" => "Vegan"
);
$config_essen = array_values($config_essen_o);
$config_reisearten_o_short = array(
"BUSBAHN" => "Bus/Bahn",
"RAD" => "Fahrrad",
"INDIVIDUELL" => "Kamel/Individuell"
);
$config_reisearten_o = array(
"BUSBAHN"=>"gemeinsam mit Bus/Bahn",
"RAD"=>"gemeinsam mit Rad",
"AUTO"=>"selbst mit Auto",
"INDIVIDUELL"=>"Kamel/Individuell"
//,"mit Kamel"
"BUSBAHN" => "gemeinsam mit Bus/Bahn",
"RAD" => "gemeinsam mit Rad",
"INDIVIDUELL" => "Kamel/Individuell"
);
$config_reisearten = array_values($config_reisearten_o);
......@@ -56,14 +54,8 @@ $config_reisearten_destroyed = array(
"mit Schlauchboot"
);
$config_admins = array(
// username => password
"george" => "peter",
"tim" => '{SHA-256}8013a101f26fd8dcc8c40d0eb1dcb513$c3a97d44e67564ed79a60fa0de6ea4193bb18932a8d08b5e8d664bd14b32a4f5', // broetchen
"manu" => '{SHA-256}12c9b021c42741545f9f01e2afd67aa2$7112be28c0c11f987de4401798a2ba041e518bb3f22bcb8cf4f3bf3f590b65b9' // mepmepmep
);
$config_userfile = $config_basepath . "/passwd/users.txt"; // relative to configfile
$config_current_fahrt_file = $config_basepath . "/config_current_fahrt_id";
$config_mailtag = "[FS-Fahrt] - ";
$config_baseurl = "http://fsfahrt.repke.eu/anmeldung/registration-system/";
$config_current_fahrt_id = 2;