This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
ini_set('display_errors', 1); | |
error_reporting(E_ALL); | |
include ("config2.php"); | |
include_once("config.php"); | |
include(PHPGRID_LIBPATH . "inc/jqgrid_dist.php"); | |
$fk_Mitarbeiter = $_SESSION['pk']; | |
/** | |
* PHP Grid Component | |
* | |
* @author Abu Ghufran <gridphp@gmail.com> - http://www.phpgrid.org | |
* @version 2.0.0 | |
* @license: see license.txt included in package | |
*/ | |
// Database config file to be passed in phpgrid constructor | |
$db_conf = array( | |
"type" => PHPGRID_DBTYPE, | |
"server" => PHPGRID_DBHOST, | |
"user" => PHPGRID_DBUSER, | |
"password" => PHPGRID_DBPASS, | |
"database" => PHPGRID_DBNAME | |
); | |
date_default_timezone_set("Europe/Berlin"); | |
$timestamp = time(); | |
$dat = date("d.m.Y",$timestamp); | |
$dat2 = date("Y-m-d",$timestamp); | |
# print_r($dat); | |
$g = new jqgrid($db_conf); | |
$grid["caption"] = "Tabelle Zeitpositionen"; | |
$grid["autowidth"] = true; // expand grid to screen width | |
# $grid["multiselect"] = true; // allow you to multi-select through checkboxes | |
$grid["view_options"] = array("width"=>"500"); | |
$g->set_options($grid); | |
# $opt["footerrow"] = true; | |
$opt["globalsearch"] = false; | |
$g->set_options($opt); | |
$g->set_actions(array( | |
"add"=>true, // allow/disallow add | |
"edit"=>true, // allow/disallow edit | |
"delete"=>true, // allow/disallow delete | |
"rowactions"=>true, // show/hide row wise edit/del/save option | |
"autofilter" => true, // show/hide autofilter for search | |
) | |
); | |
$g->set_options($grid); | |
$g->table = "Zeitpositionen"; | |
$g->select_command = "SELECT pk, fk_Mitarbeiter, fk_Kunde, fk_Auftrag, Jobart, Beschreibung, Dauer, Status FROM Zeitpositionen WHERE fk_Mitarbeiter = " . $fk_Mitarbeiter; | |
$col = array(); | |
$col["name"] = "pk"; | |
$col["hidden"] = true; | |
$col["editable"] = true; | |
$col["search"] = false; | |
$cols[] = $col; | |
$col = array(); | |
$col["name"] = "fk_Mitarbeiter"; | |
$col["hidden"] = true; | |
$col["editable"] = true; | |
$col["search"] = false; | |
$col["editoptions"]["defaultValue"] = $fk_Mitarbeiter; | |
$cols[] = $col; | |
$col = array(); | |
$col["name"] = "Datum"; | |
$col["hidden"] = true; | |
$col["editable"] = true; | |
$col["search"] = false; | |
$col["editoptions"]["defaultValue"] = $dat2; | |
$col["formatter"] = "date"; | |
$cols[] = $col; | |
$col = array(); | |
$col["title"] = "Kunde"; // caption of column | |
$col["name"] = "fk_Kunde"; | |
$col["width"] = "25"; | |
$col["editable"] = true; | |
$col["search"] = false; | |
$col["edittype"] = "select"; // render as select | |
# fetch data from database, with alias k for key, v for value | |
$str = $g->get_dropdown_values("select pk as k, Kuerzel as v from Kunden order by Kuerzel"); | |
$col["editoptions"] = array( | |
"value"=>":Select...;".$str, | |
"onchange" => array( "update_field" => "fk_Auftrag", | |
"sql" => "select pk as k, Bezeichnung as v from Auftraege WHERE fk_Kunde = '{fk_Kunde}'" | |
) | |
); | |
$col["formatter"] = "select"; // display label, not value | |
$cols[] = $col; | |
$col = array(); | |
$col["title"] = "Auftrag"; // caption of column | |
$col["name"] = "fk_Auftrag"; | |
$col["width"] = "50"; | |
$col["search"] = false; | |
$col["editable"] = true; | |
$col["edittype"] = "select"; // render as select | |
# fetch data from database, with alias k for key, v for value | |
$col["editoptions"]["onload"]["sql"] = "select pk as k, Bezeichnung as v from Auftraege WHERE fk_Kunde = '{fk_Kunde}'"; | |
$col["formatter"] = "select"; // display label, not value | |
$cols[] = $col; | |
$col = array(); | |
$col["title"] = "Jobart"; // caption of column | |
$col["name"] = "Jobart"; | |
$col["width"] = "50"; | |
$col["editable"] = true; | |
$col["search"] = false; | |
$col["edittype"] = "select"; // render as select | |
# fetch data from database, with alias k for key, v for value | |
$str = $g->get_dropdown_values("select pk as k, Bezeichnung as v from Jobart"); | |
$col["editoptions"] = array("value"=>":;".$str); | |
$col["formatter"] = "select"; // display label, not value | |
$cols[] = $col; | |
$col = array(); | |
$col["title"] = "Beschreibung"; // caption of column | |
$col["name"] = "Beschreibung"; | |
# $col["width"] = "40"; | |
$col["editable"] = true; | |
$col["edittype"] = "textarea"; // render as textarea on edit | |
$col["editoptions"] = array("rows"=>2, "cols"=>20); // with these attributes | |
$cols[] = $col; | |
$col = array(); | |
$col["title"] = "Dauer"; // caption of column | |
$col["name"] = "Dauer"; | |
$col["width"] = "30"; | |
$col["editable"] = true; | |
$col["formatter"] = "number"; | |
$col["formatoptions"] = array("thousandsSeparator" => ".", | |
"decimalSeparator" => ",", | |
"decimalPlaces" => 2); | |
$cols[] = $col; | |
$col = array(); | |
$col["title"] = "Status"; // caption of column | |
$col["name"] = "Status"; | |
$col["width"] = "50"; | |
$col["editable"] = true; | |
$col["edittype"] = "select"; // render as select | |
# fetch data from database, with alias k for key, v for value | |
$str = $g->get_dropdown_values("select pk as k, Bezeichnung as v from Status"); | |
$col["editoptions"] = array("value"=>":;".$str); | |
$col["formatter"] = "select"; // display label, not value | |
$cols[] = $col; | |
$g->set_columns($cols, true); | |
# $g->set_columns($cols); | |
$g->set_actions(array( | |
"autofilter" => false // show/hide autofilter for search | |
) | |
); | |
$out = $g->render("list1"); | |
/* ajsdh */ | |
$pdo = new PDO('mysql:host=localhost;dbname=xxxxxxx', 'xxxxxxxx', 'xxxxxxx'); | |
$data = $pdo->query("SELECT Vorname, Nachname FROM Mitarbeiter WHERE pk ='" . $fk_Mitarbeiter . "'"); | |
foreach ($data as $row) { | |
$vname = $row['Vorname']; | |
$nname = $row['Nachname']; | |
} | |
$ret = ""; | |
$notiz = ""; | |
$ku = ""; | |
$ku = $_POST["ku"]; | |
if (!empty($_POST["notiz"])) { | |
$ret = "Yes, Notiz is set"; | |
$notiz = $_POST["notiz"]; | |
} else { | |
$ret = "No, Notiz is not set"; | |
} | |
?> | |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<meta name="description" content="Grid 4 PHP Framework with Bootstrap v5."> | |
<meta name="author" content="Abu Ghufran"> | |
<title>Tagesprotokoll</title> | |
<link rel="stylesheet" type="text/css" media="screen" href="../../lib/js/themes/base/jquery-ui.custom.css"> | |
<!-- Bootstrap core CSS --> | |
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"> | |
<link href="https://getbootstrap.com/docs/5.1/examples/sidebars/sidebars.css" rel="stylesheet"> | |
<link rel="stylesheet" type="text/css" media="screen" href="../../lib/js/jqgrid/css/ui.jqgrid.bs.css"> <style> /* Custom page CSS | |
-------------------------------------------------- */ | |
/* Not required for template or sticky footer method. */ | |
main>.container { | |
padding: 70px 15px 0; | |
} | |
</style> | |
<meta name="theme-color" content="#7952b3"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<link rel="stylesheet" type="text/css" media="screen" href="lib/js/themes/material/jquery-ui.custom.css" /> | |
<link rel="stylesheet" type="text/css" media="screen" href="lib/js/jqgrid/css/ui.jqgrid.css" /> | |
<script src="lib/js/jquery.min.js" type="text/javascript"> | |
</script> | |
<script src="lib/js/jqgrid/js/i18n/grid.locale-en.js" type="text/javascript"> | |
</script> | |
<script src="lib/js/jqgrid/js/jquery.jqGrid.min.js" type="text/javascript"> | |
</script> | |
<script src="lib/js/themes/jquery-ui.custom.min.js" type="text/javascript"> | |
</script> | |
</head> | |
<body style="padding: 20px"> | |
<div id="kopf"> | |
<h1> | |
Tagesprotokoll: | |
<?php echo $vname . " " . $nname ?> | |
</h1> | |
<h2> | |
Datum: | |
<?php echo $dat ?> | |
</h2> | |
<br> | |
</div> | |
<div id="inp_tp"> | |
<form method="post" action="inp_Tagesprotokoll.php"> | |
<input class="form-control input-lg" id="notiz" name="notiz" type="text" placeholder="Notiz" value= | |
<?php echo $notiz; ?> | |
> <br> <input class="form-control input-lg" id="ku" name="ku" type="text" placeholder="Krank/Urlaub" value= | |
<?php echo $ku; ?> | |
> <br> | |
<div class="col"> | |
<input class="btn btn-primary btn-block" type="submit" value="Speichern" name="but_submit" id="btn_speichern" /> | |
</div> | |
<br> | |
</form> | |
</div> | |
<div id="" style="height: 100%; width: 100%; margin-top: 20px"> | |
<?php echo $out ?> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment