git.schokokeks.org
Repositories
Help
Report an Issue
fs-draft.git
Code
Commits
Branches
Tags
Suche
Strukturansicht:
8e9c8f7
Branches
Tags
master
midgard
vorlage
fs-draft.git
source
structure
correlatives.html.php
fancy table-stuff, woohoo!
bfadmin-master
commited
8e9c8f7
at 2016-04-26 01:47:21
correlatives.html.php
Blame
History
Raw
<?php include_once("source/logic/server/data.php"); include_once("source/logic/server/table.php"); include_once("source/logic/server/misc.php"); include_once("source/logic/server/sql.php"); ?> <section class="subsection" id="correlatives"> <header>Correlatives</header> <div class="note_error">This section is only a proposal yet; not part of the draft.</div> <?php $mode = 2; switch ($mode) { case 0: { $table = new class_table ( [ new class_column ( "Domain", function ($row) {return $row["domain"];} ), new class_column ( "Interrogative / Relative", _foo("interrogative"), _bar("word") ), new class_column ( "Demonstrative far", _foo("demonstrative_far"), _bar("word") ), new class_column ( "Demonstrative near", _foo("demonstrative_near"), _bar("word") ), new class_column ( "Universal", _foo("universal"), _bar("word") ), new class_column ( "Undefined", _foo("undefined"), _bar("word") ), new class_column ( "Negative", _foo("negative"), _bar("word") ), ], read_json("source/data/correlatives.json") ); $table->generate(); break; } case 1: { global $configuration; $database = read_json("source/data/x.json"); $data = $database["words"]; // $data = sql_cross($database["words"], sql_rename($database["words"])); $data = sql_select($data, function ($row) {return ($row["language"] == "fs");}); $table = new class_table ( [ new class_column("Domain (id)", function ($row) {return $row["domain_id"];}), new class_column("Type (id)", function ($row) {return $row["type_id"];}), new class_column ( "Folksprak", function ($row) {return $row["words"];}, function ($value) {global $configuration; return _baz($value, "word", "fs");} ), /* new class_column ( $configuration["languagemap"][$configuration["target"]], function ($row) {global $configuration; return $row["words"][$configuration["target"]];}, function ($value) {global $configuration; return _baz($value, "word", $configuration["target"]);} ), */ ], $data ); $table->generate(); break; } case 2: { global $configuration; $database = read_json("source/data/x.json"); $data = $database["words"]; $data = ( /* sql_project ( */ sql_select ( sql_rename ( sql_cross ( $data, $database["domains"] ), "name", "domain_name" ), function ($row) {return ($row["id"] == $row["domain_id"]);} )/*, ["domain_id", "name", "type_id", "language", "words"] ) */ ); $data = ( /* sql_project ( */ sql_select ( sql_rename ( sql_cross ( $data, $database["types"] ), "name", "type_name" ), function ($row) {return ($row["id"] == $row["type_id"]);} )/*, ["domain_name", "name", "language", "words"] ) */ ); $data = ( sql_select ( $data, function ($row) {return ($row["language"] == "fs");} ) ); $data = ( sql_add ( $data, "type_name/words", function ($row) { return ["key" => $row["type_id"], "value" => $row["words"]]; } ) ); $data = ( sql_project ( $data, ["domain_name", "type_name/words"] ) ); $data = ( sql_group ( $data, "domain_name", [ "type_name/words" => function ($args) { $output = []; array_map ( function ($arg) use (&$output) { $output[$arg["key"]] = $arg["value"]; }, $args ); return $output; }, ] ) ); $table = new class_table ( array_merge ( [ new class_column("Domain", function ($row) {return $row["domain_name"];}), ], array_map ( function ($type) { return ( new class_column ( ("Type: " . $type["name"]), function ($row) use (&$type) {return $row["type_name/words"][$type["id"]];}, function ($value) {return _baz($value, "word", "fs");} ) ); }, $database["types"] ) ), $data ); $table->generate(); break; } default: { break; } } ?> <div class="note_information">Some of these words are very unlikely to ever get used (e.g. <span class="word lang_fs">ing slag</span>). Nevertheless they exist and are listed for completeness.</div> </section>