- Usage of materialize css framework
- outsourcing functions to new lib/api.php
This commit is contained in:
1
homepage/mams/lib/.htaccess
Normal file
1
homepage/mams/lib/.htaccess
Normal file
@@ -0,0 +1 @@
|
||||
Deny from all
|
||||
10
homepage/mams/lib/api.php
Normal file
10
homepage/mams/lib/api.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
function processPostData($db, $post){
|
||||
if($post['action']){
|
||||
giveJudokasAttendence($db, $post['attandanceDate'], $post['judokaIdsInTraining']);
|
||||
header("Location: .");
|
||||
}
|
||||
return;
|
||||
}
|
||||
?>
|
||||
@@ -117,10 +117,16 @@ return dbQuery($dbConnection, $query, $params);
|
||||
|
||||
function giveJudokasAttendence($dbConnection, $date, $ids){
|
||||
$values = array();
|
||||
foreach( $ids as $id){
|
||||
array_push( $values, "(\"".$date."\", ".$id.")");;
|
||||
try{
|
||||
foreach( $ids as $id){
|
||||
array_push( $values, "(\"".$date."\", ".$id.")");;
|
||||
}
|
||||
$query = "INSERT INTO `cwsvjudo`.`anwesenheit` (`date`, `userId`) VALUES ".join(",", $values).";";
|
||||
dbQuery($dbConnection, $query, array(), ['dontFetch' => true]);
|
||||
}
|
||||
catch(PDOException $db_error){
|
||||
print "Error!: " . $db_error->getMessage() . "<br/>";
|
||||
return null;
|
||||
}
|
||||
$query = "INSERT INTO `cwsvjudo`.`anwesenheit` (`date`, `userId`) VALUES ".join(",", $values).";";
|
||||
dbQuery($dbConnection, $query, array(), ['dontFetch' => true]);
|
||||
}
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user