Skip to content
Snippets Groups Projects
Commit e91a68e8 authored by Tim Repke's avatar Tim Repke
Browse files

verboselevel turned off | in admin panel - list - now popup for editing...

verboselevel turned off | in admin panel - list - now popup for editing included, not working yet though
parent dad0452c
No related branches found
No related tags found
No related merge requests found
......@@ -105,4 +105,69 @@ function comm_admin_verbose($level, $text){
} else
echo $text.'<br />';
}
}
\ No newline at end of file
}
/**
* Puts out Label and Selection box
*
* @param $name
* @param $id
* @param $values
* @param $selected
* @param $subtext
*/
function admin_show_formular_helper_sel($name, $id, $values, $selected, $subtext){
$r = '<label>'.$name.'
<span class="small">'.$subtext.'</span>
</label>
<select name="'.$id.'" id="'.$id.'">';
foreach($values as $val){
$r .= '<option value="'.$val.'"';
if($val == $selected) $r .= ' selected';
$r .= '>'.$val.'</option>';
}
$r .= '</select>';
return $r;
}
/**
* Puts out Label and two selection boxes side by side right below
*
* @param $name
* @param $id
* @param $values
* @param $selected
* @param $id2
* @param $values2
* @param $selected2
* @param $subtext
*/
function admin_show_formular_helper_sel2($name, $id, $values, $selected, $id2, $values2, $selected2, $subtext){
$r = '<label style="text-align:left">'.$name.'
<span class="small">'.$subtext.'</span>
</label><table><tr><td>
<select name="'.$id.'" id="'.$id.'" style="width:110px; text-align: center">';
foreach($values as $val){
$r .= '<option value="'.$val.'"';
if($val == $selected) $r .= ' selected';
$r .='>'.$val.'</option>';
}
$r .= '</select></td><td><select name="'.$id2.'" id="'.$id2.'">';
foreach($values2 as $val){
$r .= '<option value="'.$val.'"';
if($val == $selected2) $r .= ' selected';
$r .='>'.$val.'</option>';
}
$r .= '</select></td></tr></table>';
return $r;
}
function admin_show_formular_helper_input($name, $id, $value, $subtext){
$r = '<label>'.$name.'
<span class="small">'.$subtext.'</span>
</label>
<input type="text" name="'.$id.'" id="'.$id.'" value="'.$value.'" />';
return $r;
}
......@@ -7,7 +7,7 @@
*/
global $text, $headers, $admin_db, $config_current_fahrt_id, $ajax;
global $text, $headers, $admin_db, $config_current_fahrt_id, $ajax, $config_studitypen, $config_essen, $config_reisearten;
if(isset($_REQUEST['ajax'])){
......@@ -15,10 +15,73 @@ if(isset($_REQUEST['ajax'])){
$col = $_REQUEST['update'];
$id = $_REQUEST['hash'];
$val = ($_REQUEST['nstate'] == 1) ? time() : NULL;
$admin_db->update("bachelor", array($col=>$val), array("bachelor_id"=> $id));
}
elseif(isset($_REQUEST['form'])){
$bid = $_REQUEST['hash'];
$ecols = [
"forname",
"sirname",
"mehl",
"pseudo",
"antyp",
"abtyp",
"anday",
"abday",
"comment",
"studityp"
];
$rcols = [
"bachelor_id" => ["Hash", function( $b ){ return $b; }],
"fahrt_id" => ["Fahrt", function( $b ){ return "ID ".$b; }],
"anm_time" => ["Anmeldung", function( $b ){ return date("d.m.Y",$b); }],
"paid" => ["Bezahlt", function( $b ){ return ($b==0) ? "Nein" : date("d.m.Y", $b); }],
"repaid" => ["Rückgezahlt", function($b){ return ($b==0) ? "Nein" : date("d.m.Y", $b); }],
"backstepped" => ["Zurückgetreten", function( $b ){ return ($b==0) ? "Nein" : date("d.m.Y", $b); }]
];
$bachelor = $admin_db->get('bachelor', array_merge($ecols, array_keys($rcols)), array('bachelor_id'=>$bid));
$possible_dates = comm_get_possible_dates($admin_db, $bachelor['fahrt_id']);
foreach($rcols as $k=>$r){
$ajax .= "<b>".$r[0].":</b> ".$r[1]($bachelor[$k])."<br />";
}
$ajax .= '<br />
<div id="stylized" class="myform">
<form id="form" name="form" method="post" action="">';
$ajax .= admin_show_formular_helper_input("Vorname", "forname", $bachelor["forname"], "");
$ajax .= admin_show_formular_helper_input("Nachname","sirname",$bachelor["sirname"],"");
$ajax .= admin_show_formular_helper_input("Anzeigename","pseudo",$bachelor["pseudo"],"");
$ajax .= admin_show_formular_helper_input("E-Mail-Adresse","mehl",$bachelor["mehl"],"regelmäßig lesen!");
$ajax .= admin_show_formular_helper_sel("Du bist","studityp",$config_studitypen, $bachelor["studityp"],"");
$ajax .= admin_show_formular_helper_sel("Alter 18+?","virgin",array("Nein", "Ja"), (($bachelor["virgin"]==1) ? "Nein" : "Ja"), "Bist du älter als 18 Jahre?");
$ajax .= admin_show_formular_helper_sel("Essenswunsch","essen",$config_essen, $bachelor["essen"],"Info für den Koch.");
$ajax .= admin_show_formular_helper_sel2("Anreise","anday", array_slice($possible_dates,0, -1), $bachelor["anday"]
,"antyp",$config_reisearten, $bachelor["antyp"],"");
$ajax .= admin_show_formular_helper_sel2("Abreise","abday", array_slice($possible_dates,1), $bachelor["abday"]
,"abtyp",$config_reisearten,$bachelor["abtyp"],"");
$ajax .= '
<label>Anmerkung</label>
<textarea id="comment" name="comment" rows="3" cols="40">'.$bachelor["comment"].'</textarea>
<input type="checkbox" name="public" value="public" style="width:40px" '.(($bachelor['public']==1 ? " checked" : "")).'><span style="float:left">Anmeldung verstecken</span><br/>
<div style="clear:both"></div>
<button type="submit" name="submit" id="submit" value="submit">Ändern!</button>
<div class="spacer"></div>';
$ajax .= '</form>
</div>
';
}
} else {
$headers =<<<END
<link rel="stylesheet" type="text/css" href="../view/css/DataTables/css/jquery.dataTables.min.css" />
......@@ -61,11 +124,32 @@ div.btn{
top:100px;
left: 200px;
width: 700px;
height: 800px;
height: 700px;
overflow: auto;
border: 1px solid #000000;
background-color: beige;
padding: 20px 10px 10px 10px;
}
#editFormTopbar{
background-color: #b0bed9;
height: 20px;
position: absolute;
top: 0;
left: 0;
right: 0;
paddin: 0;
}
#editFormTopbar p{
position: absolute;
float: right;
top: 0;
padding: 0;
margin: 0;
right: 5px;
cursor: none;
}
</style>";
$text .= "Meldeliste";
......@@ -90,7 +174,7 @@ $columns = array(
);
$columnFunctions = array(
"Anmelde-ID" => function($person) { return $person["bachelor_id"]; }
"Anmelde-ID" => function($person) { return "<a href='#' class='edit_bachelor'>".$person["bachelor_id"]."</a>"; }
//,"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>"; },
......@@ -131,7 +215,10 @@ foreach($people as $person) {
$text .=<<<END
</tbody>
</table>
<div id="editForm"></div>
<div id="editForm">
<div id="editFormTopbar"><p>X</p></div>
<p></p>
</div>
<script type='text/javascript'>
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
......@@ -159,6 +246,7 @@ $text .=<<<END
"iDisplayLength": 70,
"columnDefs": [
{ type: 'link', targets: 2 },
{ type: 'link', targets: 0 },
{ type: 'prb', targets: 9 }
],
"aoColumnDefs": [
......@@ -173,7 +261,7 @@ $text .=<<<END
var txt = data[9].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>";
btns += "<div onclick=\"btnclick(this, '"+classes[i]+"','"+data[0].match(/<a [^>]+>([^<]+)<\/a>/)[1]+"',"+tmp+");\" class='btn btn-"+classes[i]+"-"+tmp+"'>&nbsp;</div>";
}
// Store the computed display for speed
......@@ -190,6 +278,37 @@ $text .=<<<END
],
"order": [[ 2, "asc" ]]
});
$(".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();
});
$(".js-ajax-php-json").submit(function(){
var data = $(this).serialize();
$.ajax({
type: "POST",
dataType: "json",
url: "response.php",
data: data,
success: function(data) {
$(".the-return").html(
"Favorite beverage: " + data["favorite_beverage"] + "<br />Favorite restaurant: " + data["favorite_restaurant"] + "<br />Gender: " + data["gender"] + "<br />JSON: " + data["json"]
);
// alert("Form submitted successfully.Returned json: " + data["json"]);
}
});
return false;
});
});
function btnclick(that, type, hash, state){
......@@ -202,4 +321,4 @@ $text .=<<<END
}
</script>
END;
}
\ No newline at end of file
}
......@@ -10,8 +10,8 @@ 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;
$config_verbose_level = 0; // 0 = nothing, 1 = important, 2 = somewhat important, 3 = detailed verbose, 4 = with sql
$config_admin_verbose_level = 0;
$config_db = array(
"name" => "fsfahrt",
......
......@@ -86,4 +86,66 @@ form table tr td{
.cost-table tfoot td{
border-bottom: 1px solid #0c0c0c;
border-top: 1px dashed #0c0c0c;
}
/* ----------- My Form ----------- */
.myform{
margin:0 auto;
width:400px;
padding:14px;
}
/* ----------- stylized ----------- */
#stylized{
border:solid 2px #b7ddf2;
background:#ebf4fb;
}
#stylized h1 {
font-size:1.5em;
color:black;
font-weight:bold;
margin-bottom:8px;
}
#stylized p{
font-size:11px;
color:#666666;
margin-bottom:20px;
border-bottom:solid 1px #b7ddf2;
padding-bottom:10px;
}
#stylized label{
display:block;
font-weight:bold;
text-align:right;
width:140px;
float:left;
}
#stylized .small{
color:#666666;
display:block;
font-size:11px;
font-weight:normal;
text-align:right;
width:140px;
}
#stylized input, #stylized select, #stylized textarea{
float:left;
font-size:12px;
padding:4px 2px;
border:solid 1px #aacfe4;
width:200px;
margin:2px 0 20px 10px;
}
#stylized button{
clear:both;
margin-left:150px;
width:125px;
height:31px;
background:#666666 url(img/button.png) no-repeat;
text-align:center;
line-height:31px;
color:#FFFFFF;
font-size:11px;
font-weight:bold;
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment