source/content/principles.html.php
8794e319
 <?php
 global $configuration;
 include_once("source/logic/server/data.php");
 include_once("source/logic/server/sql.php");
 include_once("source/logic/server/table.php");
  ?>
579dbe00
 <section class="section" id="principles">
dcda8f59
 	<header>Principles</header>
dee63d95
 	<p>The word stock of Folksprak is &dash; with minor exceptions &dash; derived from the modern Germanic languages (e.g. English, German, Swedish, &#8230;) and/or their precursors (e.g. Old English, Old Norse, Proto Germanic, etc.). Branches which no longer emerge today (e.g. the East Germanic languages like Gothic), were not incorporated.</p>
270847a5
 	<p>The following table gives an overview about the typical transitions of phones from Proto-Germanic to some of todays natural Germanic languages and Folksprak, along with example words in square brackets:</p>
8794e319
 	<span class="todo">more entries</span>
 <?php
270847a5
 	$data_common = read_json("source/data/common.json");
8794e319
 	$data_transitions = read_json("source/data/transitions.json");
 	
 	$data = $data_transitions["data"];
270847a5
 	{
 		{
 			$data = sql_select($data, function ($row) {return in_array($row["language_id"], ["gem","flk","eng","deu","nld","dan","nob","swe","isl"]);});
 		}
 		{
 			{
 				$data = sql_cross($data, $data_common["languages"]);
 				$data = sql_select($data, function ($row) {return ($row["language_id"] == $row["id"]);});
 				$data = sql_delete($data, ["id"]);
 				$data = sql_rename($data, "name", "language_name");
 			}
 		}
 	}
 		
8794e319
 	$table = new class_table
 	(
 		[
 			new class_column("Transition", "transition_id"),
270847a5
 			new class_column("Language", "language_name"),
 			new class_column("Language ID", "language_id"),
 			new class_column("Phones", "phones"),
8794e319
 			new class_column("Examples", "examples"),
 		],
 		$data
 	);
 	
 	$table->snap
 	(
 		[
 			"label_vertical" => function ($column) {return "";},
 			"columns_vertical" =>
 			[
 				$table->columns_get()[0],
 			],
 			"label_horizontal" => function ($column, $value) {return $value;},
 			"columns_horizontal" =>
 			[
 				$table->columns_get()[1],
 			],
 			"columns_data" =>
 			[
 				$table->columns_get()[2],
 				$table->columns_get()[3],
270847a5
 				$table->columns_get()[4],
8794e319
 			],
 			"data_aggregator" => function ($values)
 			{
 				return $values;
 			},
 			"data_formatter" => function ($values)
 			{
 				if (count($values) == 1)
 				{
270847a5
 					$phones = implode(
8794e319
 						", ",
 						array_map
 						(
 							function ($phoneme) use (&$values)
 							{
 								return mark($phoneme, ["type_word", "lang_" . $values[0]["language_id"]]);
 							},
270847a5
 							$values[0]["phones"]
8794e319
 						)
 					);
 					$examples = implode
 					(
 						", ",
 						array_map
 						(
 							function ($word) use (&$values)
 							{
 								return mark($word, ["type_word", "lang_" . $values[0]["language_id"]]);
 							},
 							array_slice($values[0]["examples"], 0, 1)
 						)
 					);
270847a5
 					$output = $phones;
8794e319
 					if (count($values[0]["examples"]) > 0)
 					{
 						$break = true;
 						$breaker = $break ? "<br/>" : " ";
 						$output .= "${breaker}[${examples}]";
 					}
 					return $output;
 				}
 				else
 				{
 					return "?";
 				}
 			},
 		]
 	)->generate();
  ?>
dcda8f59
 </section>