+# V 0.4.2 Modul Export, Refaktorierung Seeders
+
+## Added
+- neu Modul Export
+- PageController: neu: export()
+
# V 0.4.1 Mandator Account Transaction
## Added
--- /dev/null
+../../../vendor/hamatoma/laraknife/templates/Http/Controllers/ExportController.php
\ No newline at end of file
}
return $rc;
}
+ public function export(array &$records)
+ {
+ $fn = FileHelper::buildExportName('page-export', '.txt');
+ $sep = '~' . StringHelper::randomString(StringHelper::$charSetAlphaNumeric, 3) . '%';
+ $count = count($records);
+ $contents = "!Meta LaraKnife-Export
+separator=$sep
+records=$count
+ ";
+ $recordNo = 0;
+ foreach ($records as &$record) {
+ $recordNo++;
+ $contents .= "action=insert
+table=pages
+primary=page$recordNo
+title=$record->title
+name=$record->name
+contents=<<
+$record->contents
+$sep
+";
+ }
+ file_put_contents($fn, $contents);
+ $rc = redirect('/exported');
+ return $rc;
+ }
/**
* Show the form for editing the specified resource.
*/
$sql = DbHelper::addOrderBy($sql, $fields['_sortParams']);
$pagination = new Pagination($sql, $parameters, $fields);
$records = $pagination->records;
+ if ($request->btnSubmit === 'btnExport') {
+ $rc = $this->export($records);
+ }
$optionsPagetype = SProperty::optionsByScope('pagetype', $fields['pagetype'], 'all');
$optionsMarkup = SProperty::optionsByScope('markup', $fields['markup'], 'all');
$optionsLanguage = SProperty::optionsByScope('localization', $fields['markup'], 'all');
$params = ['audio' => $audio];
switch ($page->pagetype_scope) {
- case 2035/* snaketext */:
+ case 2035/* snaketext */ :
$text = TextProcessor::compressSnakeText($page->contents);
$params['text1'] = $this->asHtml($page, $text);
break;
$validated['owner_id'] = $fields['owner_id'];
$validated['contents'] = MediaWiki::expandStarItems($validated['contents']);
$page = Page::create($validated);
- if ($page != null){
+ if ($page != null) {
$rc = redirect("/page-edit/$page->id");
}
}
"dist": {
"type": "path",
"url": "../laraknife",
- "reference": "f593c3b28cae789a0cd9d443282ec3994d37d25a"
+ "reference": "5571c586612a4a51475ac95ef30ac1bf91b8d115"
},
"require-dev": {
"phpunit/phpunit": "11.0.x-dev"
+++ /dev/null
-<?php
-
-namespace Database\Seeders;
-
-use Illuminate\Database\Seeder;
-use Illuminate\Support\Facades\DB;
-use Illuminate\Database\Console\Seeds\WithoutModelEvents;
-
-class ChapterSeeder extends Seeder
-{
- /**
- * Run the database seeds.
- */
- public function run(): void
- {
- DB::table('menuitems')->insert([
- 'name' => 'chapters',
- 'label' => 'Chapters',
- 'icon' => 'bi bi-book',
- 'section' => 'main',
- 'link' => '/chapter-index'
- ]);
- }
-}
--- /dev/null
+<?php
+
+namespace Database\Seeders;
+
+use App\Models\Module;
+use App\Models\Menuitem;
+use App\Models\SProperty;
+use Illuminate\Database\Seeder;
+use Illuminate\Support\Facades\DB;
+use Illuminate\Database\Console\Seeds\WithoutModelEvents;
+
+class ExportSeeder extends Seeder
+{
+ /**
+ * Run the database seeds.
+ */
+ public function run(): void
+ {
+ Menuitem::insertIfNotExists('exports', 'bi bi-file-earmark-arrow-down');
+ }
+}
+++ /dev/null
-<?php
-
-namespace Database\Seeders;
-
-use Illuminate\Database\Console\Seeds\WithoutModelEvents;
-use Illuminate\Support\Facades\DB;
-use Illuminate\Database\Seeder;
-
-class MenuitemGaDeKuSeeder extends Seeder
-{
- /**
- * Run the database seeds.
- */
- public function run(): void
- {
- DB::table('menuitems')->insert([
- 'name' => 'words',
- 'label' => 'Words',
- 'icon' => 'bi bi-file-earmark-word',
- 'section' => 'main',
- 'link' => '/word-index'
- ]);
- DB::table('menuitems')->insert([
- 'name' => 'nouns',
- 'label' => 'Nouns',
- 'icon' => 'bi bi-file-image',
- 'section' => 'main',
- 'link' => '/noun-index'
- ]);
- DB::table('menuitems')->insert([
- 'name' => 'verbs',
- 'label' => 'Verbs',
- 'icon' => 'bi bi-file-image',
- 'section' => 'main',
- 'link' => '/verb-index'
- ]);
- }
-}
-
+++ /dev/null
-<?php
-
-namespace Database\Seeders;
-
-use App\Models\Module;
-use Illuminate\Database\Seeder;
-use Illuminate\Support\Facades\DB;
-use Illuminate\Database\Console\Seeds\WithoutModelEvents;
-
-class ModuleGaDeKuSeeder extends Seeder
-{
- private function exists(string $name): bool {
- $rc = Module::where(['name' => $name])->first() != null;
- return $rc;
- }
- private function insert(string $name, string $table=null){
- if (! $this->exists($name)){
- $table ??= strtolower($name) . 's';
- DB::table('modules')->insert([
- 'name' => $name,
- 'tablename' => $table
- ]);
- }
- }
- /**
- * Run the database seeds.
- */
- public function run(): void
- {
- /*
- $this->insert('SProperty');
- $this->insert('Role');
- $this->insert('User');
- $this->insert('Note');
- $this->insert('Menuitem');
- $this->insert('File');
- $this->insert('Module');
- */
- $this->insert('Word');
- $this->insert('Verb');
- $this->insert('Nomen');
- $this->insert('Phrase');
- $this->insert('Chapter');
- }
-}
+++ /dev/null
-<?php
-
-namespace Database\Seeders;
-
-use Illuminate\Database\Seeder;
-use Illuminate\Support\Facades\DB;
-use Illuminate\Database\Console\Seeds\WithoutModelEvents;
-
-class NounSeeder extends Seeder
-{
- /**
- * Run the database seeds.
- */
- public function run(): void
- {
- DB::table('sproperties')->insert([
- 'id' => 2021, 'scope' => 'genus', 'name' => 'masculine', 'order' => '10', 'shortname' => 'm'
- ]);
- DB::table('sproperties')->insert([
- 'id' => 2022, 'scope' => 'genus', 'name' => 'feminine', 'order' => '20', 'shortname' => 'f'
- ]);
- DB::table('sproperties')->insert([
- 'id' => 2023, 'scope' => 'genus', 'name' => 'neuter', 'order' => '30', 'shortname' => 'n'
- ]);
- }
-}
{
Menuitem::insertIfNotExists('pages', 'bi bi-journals');
Module::insertIfNotExists('Page');
+
SProperty::insertIfNotExists(1121, 'markup', 'plain text', 10, 'PT');
SProperty::insertIfNotExists(1122, 'markup', 'mediawiki', 20, 'MW');
SProperty::insertIfNotExists(1123, 'markup', 'HTML', 30, 'HL');
+++ /dev/null
-<?php
-
-namespace Database\Seeders;
-
-use Illuminate\Database\Seeder;
-use Illuminate\Support\Facades\DB;
-use Illuminate\Database\Console\Seeds\WithoutModelEvents;
-
-class RoleGaDeKuSeeder extends Seeder
-{
- /**
- * Run the database seeds.
- */
- public function run(): void
- {
- DB::table('roles')->insert([
- 'name' => 'Tutor',
- 'priority' => '30'
- ]);
- DB::table('roles')->insert([
- 'name' => 'Student',
- 'priority' => '40'
- ]);
- }
-}
--- /dev/null
+<?php
+
+namespace Database\Seeders;
+
+use App\Models\Role;
+use Illuminate\Database\Seeder;
+use Illuminate\Support\Facades\DB;
+use Illuminate\Database\Console\Seeds\WithoutModelEvents;
+
+class RoleLocalSeeder extends Seeder
+{
+ /**
+ * Run the database seeds.
+ */
+ public function run(): void
+ {
+ Role::insertIfNotExists('Tutor', 30);
+ Role::insertIfNotExists('Student', 40);
+ }
+}
+++ /dev/null
-<?php
-
-namespace Database\Seeders;
-
-use Illuminate\Database\Seeder;
-use Illuminate\Support\Facades\DB;
-use Illuminate\Database\Console\Seeds\WithoutModelEvents;
-
-class SPropertyAudioSeeder extends Seeder
-{
- /**
- * Run the database seeds.
- */
- public function run(): void
- {
- DB::table('sproperties')->insert([
- 'id' => 1103, 'scope' => 'filegroup', 'name' => 'Audio file', 'order' => '30', 'shortname' => 'AUDIO'
- ]);
- DB::table('sproperties')->insert([
- 'id' => 1104, 'scope' => 'filegroup', 'name' => 'Video file', 'order' => '40', 'shortname' => 'VIDEO'
- ]);
- DB::table('sproperties')->insert([
- 'id' => 1105, 'scope' => 'filegroup', 'name' => 'Image file', 'order' => '50', 'shortname' => 'IMG'
- ]);
- DB::table('sproperties')->insert([
- 'id' => 1106, 'scope' => 'filegroup', 'name' => 'Document file', 'order' => '60', 'shortname' => 'DOC'
- ]);
- }
-}
--- /dev/null
+../../vendor/hamatoma/laraknife/templates/database/seeders/TermSeeder.php
\ No newline at end of file
namespace Database\Seeders;
+use App\Models\Module;
+use App\Models\Menuitem;
use App\Models\SProperty;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
*/
public function run(): void
{
- // int $id, string $scope, string $name, int $order, string $shortname
+ Menuitem::insertIfNotExists('words', 'bi bi-file-earmark-word');
+ Module::insertIfNotExists('Word');
+
SProperty::insertIfNotExists(2001, 'wordtype', 'Noun', '10', 'N');
SProperty::insertIfNotExists(2002, 'wordtype', 'Verb', '20', 'V');
SProperty::insertIfNotExists(2003, 'wordtype', 'Adjective', '30', 'ADJ');
SProperty::insertIfNotExists(2008, 'wordtype', 'Conjunction', '80', 'CON');
SProperty::insertIfNotExists(2009, 'wordtype', 'Interjection', '90', 'INT');
SProperty::insertIfNotExists(2010, 'wordtype', 'Numeral', '100', 'NUM');
+
+ SProperty::insertIfNotExists(2021, 'genus', 'masculine', '10', 'm');
+ SProperty::insertIfNotExists(2022, 'genus', 'feminine', '20', 'f');
+ SProperty::insertIfNotExists(2022, 'genus', 'neuter', '30', 'n');
}
}
+++ /dev/null
-../../vendor/hamatoma/laraknife/templates/database/seeders/
\ No newline at end of file
"<Not verified>": "<Nicht verifiziert>",
"<Please select>": "<Bitte w\u00e4hlen>",
"A Scoped Property": "Eine bereichsbasierte Eigenschaft",
+ "Account": "Konto",
+ "Accounts": "Konten",
"Action": "Aktion",
"Adjective": "Adjektiv",
"Administrator": "Administrator",
"All": "Alle",
+ "Amount": "Betrag",
"Assign Roles": "Rollen zuordnen",
"Back": "Zur\u00fcck",
"Body": "Info",
"Change Password of an User": "Passwort eines Benutzers \u00e4ndern",
"Change of a File": "\u00c4ndern einer Datei",
"Change of a Group": "\u00c4ndern einer Gruppe",
+ "Change of a Mandator": "\u00c4ndern eines Mandanten",
"Change of a Menu Item": "\u00c4ndern einer Men\u00fceintrags",
"Change of a Note": "\u00c4ndern einer Notiz",
"Change of a Noun": "\u00c4nderung eines Nomens",
"Change of a Role": "\u00c4ndern einer Rolle",
"Change of a Scoped Property": "\u00c4ndern einer bereichsbasierten Eigenschaft",
"Change of a Term": "\u00c4ndern eines Termins",
+ "Change of a Transaction": "\u00c4ndern einer Transaktion",
"Change of a Verb": "\u00c4nderung eines Verbs",
"Change of a Word": "\u00c4nderung eines Wortes",
+ "Change of an Account": "\u00c4ndern eines Kontos",
"Change of an User": "\u00c4ndern eines Benutzers",
"Chapter": "Kapitel",
"Chapters": "Kapitel",
"Creation of a Document": "Hochladen eines Dokuments",
"Creation of a File": "Hochladen einer Datei",
"Creation of a Group": "Erstellen einer Gruppe",
+ "Creation of a Mandator": "Erstellen eine Mandanten",
"Creation of a Menu Item": "Erstellen eine Men\u00fceintrags",
"Creation of a Note": "Erstellen einer Notiz",
"Creation of a Page": "Erstellen einer Seite",
"Creation of a Scoped Property": "Erzeugen einer bereichsbasierten Eigenschaft",
"Creation of a Task": "Erstellen einer Aufgabe",
"Creation of a Term": "Erstellen eines Termins",
+ "Creation of a Transaction": "Erstellen einer Transaktion",
"Creation of a Word": "Neues Wort",
+ "Creation of an Account": "Erstellen eines Kontos",
"Creation of an User": "Erstellen eines Benutzers",
"Date": "Datum",
"Delete": "L\u00f6schen",
"Deletion of a Document": "L\u00f6schen eines Dokuments",
"Deletion of a Group": "L\u00f6schen einer Gruppe",
+ "Deletion of a Mandator": "L\u00f6schen eines Mandanten",
"Deletion of a Menu Item": "L\u00f6schen eines Men\u00fceintrags",
"Deletion of a Note": "L\u00f6schen einer Notiz",
"Deletion of a Page": "L\u00f6schen einer Seite",
"Email": "Email",
"English (Britisch)": "Englisch (GB)",
"Exchange of a File": "Austausch einer Datei",
+ "Exported Files": "Exportierte Dateien",
"File": "Datei",
"Filegroup": "Gruppe",
"Filename": "Dateiname",
"Localization": "Lokalisierung",
"Logout": "Abmelden",
"Manager": "Verwalter",
+ "Mandator": "Mandant",
+ "Mandators": "Mandanten",
"Markup": "Sprachtyp",
"Member": "Mitglied",
"Members": "Mitglieder",
"Password": "Passwort",
"Password forgotten?": "Passwort vergessen?",
"Past tense": "Pr\u00e4teritum",
+ "Patterns": "Muster",
"Phrase": "Satz",
"Phrases": "S\u00e4tze",
"Please use the following link and change your password:": "Bitte benutze den folgenden Verweis und \u00e4ndere dein Passwort",
"Reference": "Referenz",
"Remain signed in": "Angemeldet bleiben",
"Repetition": "Wiederholung",
+ "Responsibility": "Verantwortung",
"Responsibility changed": "Verantwortung ge\u00e4ndert",
"Role": "Rolle",
"Roles": "Rollen",
"Status": "Status",
"Store": "Speichern",
"Store Menu": "Men\u00fc speichern",
+ "Sum": "Summe",
"Superlative": "Superlativ",
"Task": "Aufgabe",
"Term": "Termin",
"Title": "Titel",
"To": "Bis",
"Total": "Gesamt",
+ "Transaction": "Transaktion",
+ "Transactions": "Transaktionen",
"Translation": "\u00dcbersetzung",
+ "Type": "Typ",
"Up": "Auf",
"Usage": "Verwendung",
"User": "Benutzer",
"cloze": "L\u00fcckentext",
"cloze text": "L\u00fcckentext",
"description": "Beschreibung",
+ "done": "erledigt",
+ "expense": "Ausgabe",
"feminine": "Femininum",
"free text": "Freier Text",
"grammar rules": "Grammatikregeln",
"help": "Hilfe",
"icon": "Bildsymbol",
"inactive": "nicht aktiv",
+ "income": "Einzahlung",
"label": "Beschriftung",
"link": "Verweis",
"markdown simple": "einfache Markierungssprache",
--- /dev/null
+../storage/app/public/export/
\ No newline at end of file
--- /dev/null
+../../vendor/hamatoma/laraknife/resources/views/export/
\ No newline at end of file
<x-laraknife.forms.string position="first" name="title" label="Title" value="{{ $context->valueOf('title') }}" width2="4" />
<x-laraknife.forms.string position="last" name="contents" label="Contents" value="{{ $context->valueOf('contents') }}" width2="4" />
</x-laraknife.panels.filter>
- <x-laraknife.panels.index-button buttonType="new"/>
+ <x-laraknife.buttons.button-position position="first" name="btnNew" label="New" width1="0" width2="6"/>
+ <x-laraknife.buttons.button-position position="last" name="btnExport" label="Export" width1="0" width2="6"/>
<x-laraknife.panels.sortable-table :context="$context" :pagination="$pagination">
<thead>
<tr>
use App\Http\Controllers\VerbController;
use App\Http\Controllers\WordController;
use App\Http\Controllers\GroupController;
+use App\Http\Controllers\ExportController;
use App\Http\Controllers\PhraseController;
use App\Http\Controllers\ReviewController;
use App\Http\Controllers\AccountController;
MandatorController::routes();
AccountController::routes();
TransactionController::routes();
+ExportController::routes();