use App\Models\File;
use App\Models\Page;
use App\Models\Module;
-use App\Helpers\Helper;
use App\Helpers\DbHelper;
use App\Models\SProperty;
use App\Helpers\MediaWiki;
use App\Helpers\StringHelper;
use App\Helpers\TextProcessor;
use App\Helpers\ContextLaraKnife;
-use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Facades\Validator;
$fn = FileHelper::buildExportName('page-export', '.txt');
$sep = '~' . StringHelper::randomString(StringHelper::$charSetAlphaNumeric, 3) . '%';
$count = count($records);
- $contents = "!Meta LaraKnife-Export
-separator=$sep
-records=$count
- ";
+ $host = env('APP_URL');
+ $date = (new \DateTime('now'))->format('Y-m-d H:i');
+ $contents = ":LaraKnife-Export
+:host=$host
+:exported=$date
+:separator=$sep
+:records=$count
+";
$recordNo = 0;
foreach ($records as &$record) {
$recordNo++;
- $contents .= "action=insert
-table=pages
-primary=page$recordNo
+ $contents .= ":action=insert
+:table=pages
+!id=page$recordNo
+!reference_id=$record->reference_id
+!audio_id=$record->audio_id
+!owner_id=$record->owner_id
+!previous_id=$record->previous_id
+!next_id=$record->next_id
+!up_id=$record->up_id
title=$record->title
name=$record->name
-contents=<<
-$record->contents
+pagetype_scope=$record->pagetype_scope
+markup_scope=$record->markup_scope
+order=$record->order
+language_scope=$record->language_scope
+~contents=$record->contents
+$sep
+~info=$record->info
$sep
";
}
file_put_contents($fn, $contents);
- $rc = redirect('/exported');
+ $rc = redirect('/export-index');
return $rc;
}
/**
*/
public function index(Request $request)
{
+ $rc = null;
if ($request->btnSubmit === 'btnNew') {
- return redirect('/page-create');
+ $rc = redirect('/page-create');
} else {
$sql = "
SELECT t0.*,
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');
- $optionsOwner = DbHelper::comboboxDataOfTable('users', 'name', 'id', $fields['owner']);
- $context = new ContextLaraKnife($request, $fields);
- return view('page.index', [
- 'context' => $context,
- 'records' => $records,
- 'optionsPagetype' => $optionsPagetype,
- 'optionsMarkup' => $optionsMarkup,
- 'optionsLanguage' => $optionsLanguage,
- 'optionsOwner' => $optionsOwner,
- 'pagination' => $pagination
- ]);
+ if ($rc == null) {
+ $optionsPagetype = SProperty::optionsByScope('pagetype', $fields['pagetype'], 'all');
+ $optionsMarkup = SProperty::optionsByScope('markup', $fields['markup'], 'all');
+ $optionsLanguage = SProperty::optionsByScope('localization', $fields['markup'], 'all');
+ $optionsOwner = DbHelper::comboboxDataOfTable('users', 'name', 'id', $fields['owner']);
+ $context = new ContextLaraKnife($request, $fields);
+ $rc = view('page.index', [
+ 'context' => $context,
+ 'records' => $records,
+ 'optionsPagetype' => $optionsPagetype,
+ 'optionsMarkup' => $optionsMarkup,
+ 'optionsLanguage' => $optionsLanguage,
+ 'optionsOwner' => $optionsOwner,
+ 'pagination' => $pagination
+ ]);
+ }
+ return $rc;
}
}
/**
"dist": {
"type": "path",
"url": "../laraknife",
- "reference": "5571c586612a4a51475ac95ef30ac1bf91b8d115"
+ "reference": "31c805ca6f97201252f11b8bdd36192fc6fe7951"
},
"require-dev": {
"phpunit/phpunit": "11.0.x-dev"
},
{
"name": "psy/psysh",
- "version": "v0.12.3",
+ "version": "v0.12.4",
"source": {
"type": "git",
"url": "https://github.com/bobthecow/psysh.git",
- "reference": "b6b6cce7d3ee8fbf31843edce5e8f5a72eff4a73"
+ "reference": "2fd717afa05341b4f8152547f142cd2f130f6818"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/bobthecow/psysh/zipball/b6b6cce7d3ee8fbf31843edce5e8f5a72eff4a73",
- "reference": "b6b6cce7d3ee8fbf31843edce5e8f5a72eff4a73",
+ "url": "https://api.github.com/repos/bobthecow/psysh/zipball/2fd717afa05341b4f8152547f142cd2f130f6818",
+ "reference": "2fd717afa05341b4f8152547f142cd2f130f6818",
"shasum": ""
},
"require": {
],
"support": {
"issues": "https://github.com/bobthecow/psysh/issues",
- "source": "https://github.com/bobthecow/psysh/tree/v0.12.3"
+ "source": "https://github.com/bobthecow/psysh/tree/v0.12.4"
},
- "time": "2024-04-02T15:57:53+00:00"
+ "time": "2024-06-10T01:18:23+00:00"
},
{
"name": "ralouphie/getallheaders",