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 3145 additions and 1495 deletions
<?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
......@@ -6,16 +6,17 @@
var defaultData = [];
defaultData.price = {
ALL: { // Stuff all have to pay, no matter when the come or leave
B_FIX: "4", // Fixkosten (z.B. Kurzreisezuschlag)
C_BW: "4.5", // Bettwäsche
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", "ind": true, "an": false, "ab": true },
{ "val": "3", "ind": true, "an": true, "ab": true }
{ "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 },
......@@ -23,43 +24,59 @@ defaultData.price = {
{ "val": "", "ind": false, "an": false, "ab": false }
],
"H_AB": [ // Abendbrot
{ "val": "4", "ind": true, "an": true, "ab": false },
{ "val": "4.5", "ind": true, "an": true, "ab": false },
{ "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": "12.5", "ind": true, "an": true, "ab": false },
{ "val": "12.5", "ind": true, "an": true, "ab": false },
{ "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": "2.5", "ind": false, "an": true, "ab": false },
{ "val": "0", "ind": false, "an": false, "ab": false },
{ "val": "", "ind": false, "an": false, "ab": false },
{ "val": "2.5", "ind": false, "an": false, "ab": true }
{ "val": "", "ind": false, "an": false, "ab": false }
]
}
};
defaultData.shopping= [
{ "pos": "Limonade", "cnt": "76", "price": "1.43" },
{ "pos": "Brause", "cnt": "42", "price": "0.83" },
{ "pos": "Lutscher", "cnt": "1", "price": "0.5" }
{ "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": "Bettwäsche", "cnt": "1", "mul": "40", "price": "1.43" },
{ "pos": "Grillnutzung", "cnt": "1", "mul": "40", "price": "0.3" },
{ "pos": "Halbpension", "cnt": "2", "mul": "40", "price": "12.30" },
{ "pos": "Klodeckel", "cnt": 1, "mul": 1, "price": "33" }
{ "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": "Förderung", "val": "1200" },
{ "pos": "Pfand", "val": "31" }
{ "pos": "Pfand", "val": "0" },
{ "pos": "Übertrag WS 17/18", "val": "132.63" }
],
"out": [
{ "pos": "Einkaufen", "val": "354" },
{ "pos": "Busfahrt Hin", "val": "35" },
{ "pos": "Busfahrt Rück", "val": "40" },
{ "pos": "Kaution", "val": "100" }
{ "pos": "Ausgleich", "val": "0" },
{ "pos": "Übertrag WS 18/19", "val":"132.63" }
]
};
defaultData.other = {
......@@ -70,7 +87,8 @@ defaultData.other = {
"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}
"cnt" : {"all":0, "geman": 0, "gemab":0},
"round" : {"up":0, "down": 0}
};
......@@ -111,6 +129,7 @@ dataapp.service('priceData', ["$http", "$rootScope", function ($http, $rootScope
FIX: "Fixkosten",
WIR: "Zusatzverpflegung",
UE: "Übernachtung",
RUECK: "Reiserücktrittsversicherung",
REFRA: "(Förderung)"
};
......@@ -247,6 +266,20 @@ dataapp.service('priceData', ["$http", "$rootScope", function ($http, $rootScope
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(){
......@@ -302,7 +335,7 @@ dataapp.service('shoppingData', ["$http", "$rootScope", function ($http, $rootSc
table.sum = function(){
var ret = 0;
for(var run = 0; run < table.entries.length; run++)
for(var run = 0; run < Object.keys(table.entries).length; run++)
if(!table.entries[run].isDeleted)
ret += table.rowSum(table.entries[run]);
return ret;
......@@ -336,9 +369,12 @@ dataapp.service('receiptData', ["$http", "$rootScope", function ($http, $rootSco
table.sum = function(){
var ret = 0;
for(var run = 0; run < table.entries.length; run++)
if(!table.entries[run].isDeleted)
// 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;
};
......@@ -763,7 +799,8 @@ now the individual controllers and modules for each table....
};
scope.meaner = function(tab){
if(scope.cnt<1) scope.cnt = 1;
return scope.summy(tab) / scope.cnt;
var proPrs = scope.summy(tab) / scope.cnt;
return proPrs;
}
}
};
......@@ -832,6 +869,7 @@ now the individual controllers and modules for each table....
};
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)');
});
......@@ -925,21 +963,32 @@ now the individual controllers and modules for each table....
// save copy of table before editing to have something to reset to
$scope.prepareForm = function(){
table.orig = jQuery.extend(true, {}, table.entries);
// table.orig = jQuery.extend(true, {}, table.entries);
table.orig = table.entries.slice();
};
// cancel all changes
$scope.cancel = function() {
table.entries = jQuery.extend(true, {}, table.orig);
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);
......@@ -982,11 +1031,11 @@ now the individual controllers and modules for each table....
// === 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");
});
......@@ -997,8 +1046,6 @@ now the individual controllers and modules for each table....
});
// === edit table functions ===
// filter rows to show
......@@ -1008,6 +1055,7 @@ now the individual controllers and modules for each table....
// mark row as deleted
$scope.deleteRow = function(index) {
console.log(index);
table.entries[index].isDeleted = true;
};
......@@ -1028,21 +1076,31 @@ now the individual controllers and modules for each table....
// 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();
// table.orig = jQuery.extend(true, {}, table.entries);
};
// cancel all changes
$scope.cancel = function() {
table.entries = jQuery.extend(true, {}, table.orig);
table.entries = table.orig.slice();
// table.entries = jQuery.extend(true, {}, table.orig);
table.orig = [];
};
// save edits
$scope.saveTable = function() {
var results = [];
for (var i = table.entries.length; i--;) {
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);
......@@ -1111,8 +1169,8 @@ now the individual controllers and modules for each table....
}]);
app.controller('TableMoneyioController',
["$scope", "$filter", "$q", "$http", "moneyioData", "otherData", "receiptData",
function($scope, $filter, $q, $http, moneyioData, otherData, receiptData){
["$scope", "$filter", "$q", "$http", "moneyioData", "otherData", "receiptData", "shoppingData",
function($scope, $filter, $q, $http, moneyioData, otherData, receiptData, shoppingData) {
var table = this;
// === Data Binding stuff ==
......@@ -1120,6 +1178,7 @@ now the individual controllers and modules for each table....
$scope.moneyioDataService = moneyioData;
$scope.otherDataService = otherData;
$scope.receiptDataService = receiptData;
$scope.shoppingDataService = shoppingData;
table.entries = $scope.moneyioDataService.entries;
table.orig = [];
......@@ -1131,6 +1190,7 @@ now the individual controllers and modules for each table....
},
"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}
}
......@@ -1149,6 +1209,7 @@ now the individual controllers and modules for each table....
});
$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();
......@@ -1183,11 +1244,13 @@ now the individual controllers and modules for each table....
// 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 = [];
};
......@@ -1199,6 +1262,14 @@ now the individual controllers and modules for each table....
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) {
......@@ -1225,12 +1296,19 @@ now the individual controllers and modules for each table....
})();
/* ======================================================
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
......
......@@ -21,7 +21,7 @@
</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)">
<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>
......
......@@ -26,4 +26,6 @@ Einschränken auf:<br />
Gewählte Summe: {{summy(table.io) || 0 | currency}}<br />
Anzahl Personen: {{cnt}} <br />
Betrag pro Person: {{meaner(table.io) || 0 | currency}}
\ No newline at end of file
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
<?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>';
}
}
This diff is collapsed.
<?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("fahrt_id = ".$config_current_fahrt_id);
$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']);
}
if(isset($_REQUEST['check_backstepped'])){
if($_REQUEST['val_backstepped'] == 1)
array_push($where,"backstepped IS NOT NULL");
else
array_push($where,"backstepped IS NULL");
$accounts = array_map(function($mehl) {
return $mehl['forname'] . " " . $mehl['sirname'] . " <" . $mehl['mehl'] . ">";
}, $this->mails);
sort($accounts);
return join($trenner, $accounts);
}
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];
}
}
if(count($where)>0){
$query .= " WHERE ";
foreach($where AS $w)
$query .= "(".$w.") AND ";
$query = substr($query,0,-4); // cut last AND
}
//$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: 9/25/14
* Time: 9:24 PM
*/
global $text, $headers, $admin_db, $config_userfile, $config_current_fahrt_file, $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>SuperAdmin Panel</h1>";
// FORM submit stuff
if(isset($_REQUEST['us_submit'])){
if(!isset($_REQUEST['users'])) $text.= "something wrong... wanted to submit users";
else {
$tmp = file_put_contents($config_userfile, $_REQUEST['users']);
$text .= "updated userfile!<br />
written to file '".$config_userfile."' with exit code: ". $tmp ."<br />
if no code shown, then false -> check if file has chmod rw-rw-rw-!";
}
}
if(isset($_REQUEST['nf_submit'])){
if(isset($_REQUEST['resubmit'])){}
else{
$admin_db->insert("fahrten", ["titel"=>"neu", "map_pin" => "52.42951196033782 13.530490995971718", "von"=>date('Y-m-d'), "bis" => date('Y-m-d')]);
$tmp = $admin_db->max("fahrten", "fahrt_id");
$text .= "neue Fahrt angelegt mit ID: ".$tmp. "<br/>
Zum Bearbeiten ID ändern!";
}
}
if(isset($_REQUEST['id_submit'])){
$tmp = file_put_contents($config_current_fahrt_file, $_REQUEST['fid']);
$text .= "changed \$config_current_fahrt_id to ".$_REQUEST['fid'] . "<br />
written to file '".$config_current_fahrt_file."' with exit code: ". $tmp ."<br />
if no code shown, then false -> check if file has chmod rw-rw-rw-!";
}
// VIEW stuff:
if(file_exists($config_userfile))
$usas = file_get_contents($config_userfile);
$text .= '<h2>Nutzer bearbeiten</h2>
ACHTUNG: Tippfehler können Systemfunktionalität beeinträchtigen! <i>Format: {N|S}⎵USERNAME⎵PASSWORD⎵RANDOMSTUFF</i><br />
<i>N = Organisator der Fahrt; S = Superadmin (sieht auch diese Seite)</i><br />
Captain Obvious: "Nutzername darf kein Leerzeichen enthalten!"<br />
<a href="../passwd/index.html">Passwort-gen tool</a> (an Organisator weiterleiten, der schickt dann Passwort hash zurück)<br />
<form method="POST">
<textarea rows="8" cols="130" name="users" id="users">'.$usas.'</textarea><br />
<input type="submit" name="us_submit" id="us_submit" value="us_submit" />
</form> ';
$text .= '<h2>Neue Fahrt anlegen</h2>
<form method="POST" target="?resubmit=not">
<input type="submit" name="nf_submit" value="nf_submit" id="nf_submit" />
</form> ';
$text .= '<!--h2>Fahrt löschen</h2>
ACHTUNG: löscht ohne Nachfrage ALLE mit dieser Fahrt verbunden Daten!<br /-->';
$fids = $admin_db->select("fahrten","fahrt_id");
$config_current_fahrt_id = getCFID();
$text .= '<h2>Aktuelle Fahrt ID</h2>
Wählt die Fahrt, die über das Adminpanel bearbeitet/verwaltet werden kann.<br />
<form method="POST" >
<label>Neue ID wählen (aktiv: '.$config_current_fahrt_id.'):</label>
<select name="fid" id="fid">';
foreach($fids as $fid)
$text .= '<option value="'.$fid.'">'.$fid.'</option>';
$text .= '
</select>
<input type="submit" name="id_submit" value="id_submit" id="id_submit" />
</form>';
This diff is collapsed.
This diff is collapsed.
<?php
$config_verbose_level = 0; // 0 = nothing, 1 = important, 2 = somewhat important, 3 = detailed verbose, 4 = with sql
$config_admin_verbose_level = 0;
if (true) {
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
}
$config_databse_debug = false;
// URL where site is hosted with trailing slash
$config_baseurl = "localhost/fsfahrt"; //"http://fsfahrt.repke.eu/anmeldung/registration-system/";
$config_baseurl = "http://localhost/fsfahrt/registration-system/";
// absolute path to doc root withOUT trailing slash
$config_basepath = __DIR__; //"/var/www/vhosts/fsfahrt.repke.eu/httpdocs/anmeldung/registration-system";
$config_basepath = __DIR__;
$config_impressum = 'https://fachschaft.informatik.hu-berlin.de/index.php/Fachschaft_Informatik:Impressum';
// database config
$config_db = array(
$config_db = [
"name" => "fsfahrt", // name of DB
"user" => "fsfahrt", // username
"pass" => "9Lug*96q", // password
"host" => "localhost", // host
"type" => "mysql" // type of DB - only tested with mysql (so better not change)!!
);
];
$config_use_openstreetmap = true;
2
\ No newline at end of file
registration-system/favicon.ico

766 B

This diff is collapsed.
This diff is collapsed.
This diff is collapsed.