master
Lìu Văn Quyết 2 years ago
parent d9eef8ae6a
commit f6526306e9
  1. 2304
      src/.phpstorm.meta.php
  2. 23703
      src/_ide_helper.php
  3. 296
      src/app/Http/Controllers/LoseRootController.php
  4. 13
      src/app/Models/Curriculum.php
  5. 12
      src/app/Models/Lesson.php
  6. 12
      src/composer.json
  7. 1213
      src/composer.lock
  8. 3
      src/config/app.php
  9. 38
      src/config/database.php
  10. 343
      src/config/ide-helper.php
  11. 106
      src/config/purifier.php
  12. BIN
      src/public/file_excel/lo_trinh_mat_goc.xlsx
  13. 117
      src/resources/views/curriculum/index.blade.php
  14. 3
      src/resources/views/includes/head.blade.php
  15. 36
      src/resources/views/includes/header.blade.php
  16. 3
      src/resources/views/layouts/default.blade.php
  17. 3
      src/routes/web.php

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -2,6 +2,8 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Models\Curriculum;
use App\Models\Lesson;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Maatwebsite\Excel\Facades\Excel; use Maatwebsite\Excel\Facades\Excel;
use PhpOffice\PhpSpreadsheet\IOFactory; use PhpOffice\PhpSpreadsheet\IOFactory;
@ -11,36 +13,276 @@ class LoseRootController extends Controller
// //
private $_row_unit = 1; private $_row_unit = 1;
private $_curriculum_six_id = 666; private $_curriculum_six_id = 666;
private $_curriculum_six_grade = 2;
private $_curriculum_six_name = "Giáo trình mất gốc lớp 6";
private $_curriculum_seven_id = 777; private $_curriculum_seven_id = 777;
private $_curriculum_seven_grade = 4;
private $_curriculum_seven_name = "Giáo trình mất gốc lớp 7";
private $_curriculum_eight_id = 888; private $_curriculum_eight_id = 888;
private $_curriculum_eight_grade = 3;
private $_curriculum_eight_name = "Giáo trình mất gốc lớp 8";
private $_curriculum_nine_id = 999; private $_curriculum_nine_id = 999;
private $_curriculum_nine_grade = 6;
private $_curriculum_nine_name = "Giáo trình mất gốc lớp 9";
private $_default_curriculum_cate = 22;
private $_admin_id = 1;
protected $m_lesson;
public function __construct(Lesson $lesson)
{
$this->m_lesson = $lesson;
}
public function index_file() public function index_file()
{ {
return view("pages.home"); return view("pages.home");
} }
public function handle_data(Request $request){
$data_all = json_decode($request->data) ?? null;
$curriculum_data = $data_all->curriculum_data;
$curriculum_unit_data = $data_all->curriculum_unit_data;
$lesson_by_topic = $data_all->lesson_by_topic;
$unit_data = $data_all->unit_data;
$unit_element_data = $data_all->unit_element_data;
$trip = $data_all->trip;
$add = Curriculum::insert((array)$curriculum_data);
dd($curriculum_data);
}
public function read_file(Request $request) public function read_file(Request $request)
{ {
$file = $request->file('file_handle'); // $file = $request->file('file_handle');
$sheet_name = $request->sheet ?? "class_6";
// dd($sheet_name);
$file = null;
// ĐỌC DỮ LIỆU TỪ FILE EXCEL // ĐỌC DỮ LIỆU TỪ FILE EXCEL
$data_class_6 = $this->read_excel($file, "class_6"); // LỚP 6 $data = [];
$data_show = [];
// if($sheet_name == "class_6"){
// }
// $data_class_6 = $this->read_excel($file, $sheet_name); // LỚP 6
$data_class = $this->read_excel($file, $sheet_name); // LỚP 6
// $data_class_7 = $this->read_excel($file, "class_7"); // LỚP 7 // $data_class_7 = $this->read_excel($file, "class_7"); // LỚP 7
// $data_class_8 = $this->read_excel($file, "class_8"); // LỚP 8 // $data_class_8 = $this->read_excel($file, "class_8"); // LỚP 8
// $data_class_9 = $this->read_excel($file, "class_9"); // LỚP 9 // $data_class_9 = $this->read_excel($file, "class_9"); // LỚP 9
// TẠO LỘ TRÌNH LỚP // TẠO LỘ TRÌNH LỚP VÀ GIÁO TRÌNH
$trip_loseroot = $this->create_trip_loseroot($data_class_6); // $trip_loseroot = $this->create_trip_loseroot($data_class_6);
// DỮ LIỆU ĐỂ ADD VÀO GIÁO TRÌNH (KEY = UNIT_ID) // DỮ LIỆU ĐỂ ADD VÀO GIÁO TRÌNH (KEY = UNIT_ID)
$generate = $this->generate_curriculum($data_class_6, $this->_curriculum_six_id);
dd($generate); // if (!empty($data_class_6)) {
// $generate_6 = $this->generate_curriculum($data_class_6, $this->_curriculum_six_id);
// $create_full_class_6 = $this->create_curriculum($data_class_6, $generate_6, $this->_curriculum_six_id, $this->_curriculum_six_name, $this->_curriculum_six_grade);
// $data = $create_full_class_6;
// }
if ($sheet_name == "class_6") {
$default_curriculum_id = $this->_curriculum_six_id;
$default_curriculum_name = $this->_curriculum_six_name;
$default_curriculum_grade = $this->_curriculum_six_grade;
}
if ($sheet_name == "class_7") {
$default_curriculum_id = $this->_curriculum_seven_id;
$default_curriculum_name = $this->_curriculum_seven_name;
$default_curriculum_grade = $this->_curriculum_seven_grade;
}
if ($sheet_name == "class_8") {
$default_curriculum_id = $this->_curriculum_eight_id;
$default_curriculum_name = $this->_curriculum_eight_name;
$default_curriculum_grade = $this->_curriculum_eight_grade;
}
if ($sheet_name == "class_9") {
$default_curriculum_id = $this->_curriculum_nine_id;
$default_curriculum_name = $this->_curriculum_nine_name;
$default_curriculum_grade = $this->_curriculum_nine_grade;
}
if (!empty($data_class)) {
$generate = $this->generate_curriculum($data_class);
$create_full_class = $this->create_curriculum($data_class, $generate, $default_curriculum_id, $default_curriculum_name, $default_curriculum_grade);
$data = $create_full_class;
$data_trip = $this->format_data_show($data);
}
// dd($data_trip);
return view("curriculum.index", compact('data', 'data_trip'));
} }
public function create_trip_loseroot($data) public function format_data_show($data)
{ {
if (!empty($data)) { $data_trip = $data['data_trip'] ?? [];
// dd($data_trip);
$trip_unit_full = [];
if(!empty($data_trip)){
foreach($data_trip as $week_number => $trip_info){
$skill_vocabulary = $trip_info['vocabulary'] ?? null;
$skill_grammar = $trip_info['grammar'] ?? null;
$trip_of_week = [];
if(count($skill_vocabulary) == count($skill_grammar)){
foreach($skill_vocabulary as $unit_num => $vocab){
$trip_of_week[$unit_num] = [$vocab, $skill_grammar[$unit_num]];
}
}
$trip_unit_full[$week_number] = $trip_of_week;
}
}
return $trip_unit_full;
}
public function create_curriculum($data_trip, $data_unit_info, $curriculum_id, $curriculum_name, $grade_id)
{
// dd($this->m_lesson->offset(0)->limit(10)->get());
if ($grade_id == 2) { // LỚP 6
$index_unit = 4000;
} elseif ($grade_id == 4) { // LỚP 7
$index_unit = 4100;
} elseif ($grade_id == 3) { // LỚP 8
$index_unit = 4200;
} else { // LỚP 9
$index_unit = 4300;
}
// LẤY CÁC LESSON CÓ TRONG TOPIC
$lesson_by_topic = $this->get_lesson_by_topic($data_unit_info);
$unit_data = [];
$curriculum_unit_data = [];
$unit_element_data = [];
$data_trip_data = [];
// dữ liệu của giáo trình
$data_curriculum = [
'id' => $curriculum_id,
'name' => $curriculum_name,
'image_intro' => null,
'author' => "Sunday English",
'goal' => null,
'description' => null,
'category_id' => $this->_default_curriculum_cate,
'status' => "public",
'created_by' => $this->_admin_id,
'created_at' => date('Y-m-d H:i:s'),
'deleted' => 0,
'json_data_curriculum' => null,
'type' => "sunday",
'grade_id' => $grade_id,
'curriculum_avatar' => "assets/img_base/avatar_default.jpg",
'type_grade' => "primary",
'allow_learning_free' => 1,
'curriculum_rootlessness' => 1,
];
// TẠO GIÁO TRÌNH VỚI CÁC BÀI HỌC
if (!empty($data_unit_info)) {
$unit_id = $index_unit;
$all_lesson = 0;
foreach ($data_unit_info as $unit_num => $val_unit) {
$unit_id++;
$unit_name = "Unit " . $unit_num;
// DỮ LIỆU UNIT
$unit_data[$unit_num] = [
'id' => $unit_id,
'unit_name' => $unit_name,
'category_id' => null,
'goal' => null,
'type' => null,
'status' => null,
'created_by' => $this->_admin_id,
'created_at' => date('Y-m-d H:i:s'),
'deleted' => 0,
'json_exam_info' => null,
'is_list_exam' => 0,
'unit_avatar' => "assets/img_base/unit_dfa.jpg",
'semester' => null,
'is_unit_basic' => null,
];
// DỮ LIỆU GIÁO TRÌNH UNIT
$curriculum_unit_data[] = [
'curriculum_id' => $curriculum_id,
'unit_id' => $unit_id,
'order' => $unit_num - 1, // vì order chạy từ key 0
'desc' => null,
'created_at' => date('Y-m-d H:i:s'),
'created_by' => $this->_admin_id,
'deleted' => 0
];
// DỮ LIỆU UNIT VÀ CÁC LESSON
$unit_element_temp = [];
if (!empty($val_unit)) {
// GÁN CÁC LESSON ID VÀO UNIT MỚI
array_walk($val_unit, function ($v, $k) use (&$unit_element_temp, $lesson_by_topic) {
// $lesson_in_topic = array_keys($lesson_by_topic[$v]);
$unit_element_temp[] = array_keys($lesson_by_topic[$v]);
});
}
$count_order_ue = 0;
if (!empty($unit_element_temp)) {
foreach ($unit_element_temp as $temp_unit) {
$all_lesson += count($temp_unit);
if (!empty($temp_unit)) {
array_walk($temp_unit, function ($v, $k) use ($unit_id, &$count_order_ue, &$unit_element_data) {
$count_order_ue++;
// $unit_element_data[$unit_id][] = $v;
$unit_element_data[] = [
'unit_id' => $unit_id,
'lesson_id' => $v,
'desc' => null,
'order' => $count_order_ue - 1,
'created_at' => date('Y-m-d H:i:s'),
'created_by' => $this->_admin_id,
'deleted' => 0,
'is_test' => null,
];
});
}
}
}
}
}
// TẠO LỘ TRÌNH CHO GIÁO TRÌNH 53 TUẦN
// if (!empty($data_trip)) {
// foreach ($data_trip as $num_week => $trip_week) {
// // dd(array_values($trip_week));
// $new_trip_week = array_values($trip_week);
// for ($i = 1; $i < count($trip_week); $i++) {
// echo $i;
// }
// dd($trip_week);
// $data_trip_data[] = 9;
// }
// }
// dd($lesson_by_topic[56]);
return [
'curriculum_data' => $data_curriculum ?? null,
'unit_data' => $unit_data ?? null,
'curriculum_unit_data' => $curriculum_unit_data ?? null,
'unit_element_data' => $unit_element_data ?? null,
'data_trip' => $data_trip ?? null,
'lesson_by_topic' => $lesson_by_topic ?? null
];
}
public function get_lesson_by_topic($unit_info)
{
$data_final = [];
$topic_ids = [];
if (!empty($unit_info)) {
foreach ($unit_info as $info) {
array_walk($info, function ($v, $k) use (&$topic_ids) {
$topic_ids[$v] = $v;
});
}
} }
if (!empty($topic_ids)) {
$list_lesson = $this->m_lesson->whereIn('thread_id', $topic_ids)->where('deleted', 0)->get();
}
if (!empty($list_lesson)) {
foreach ($list_lesson as $lesson) {
$data_final[$lesson->thread_id][$lesson->id] = $lesson;
}
}
return $data_final;
} }
public function generate_curriculum($data, $curriculum_id) public function generate_curriculum($data)
{ {
$data_by_skill = []; $data_by_skill = [];
$data_unit_topic = []; $data_unit_topic = [];
@ -73,36 +315,15 @@ class LoseRootController extends Controller
} }
return $data_unit_topic; return $data_unit_topic;
} }
public function create_curriculum()
{
$data_curriculum = [
'id' => $curriculum_id,
'name' => null,
'image_intro' => $curriculum_name,
'author' => "Sunday English",
'goal' => null,
'description' => null,
'category_id' => $curriculum_name,
'status' => $curriculum_name,
'created_at' => $curriculum_name,
'created_by' => $curriculum_name,
'updated_at' => $curriculum_name,
'deleted' => $curriculum_name,
'json_data_curriculum' => $curriculum_name,
'updated_by' => $curriculum_name,
'type' => $curriculum_name,
'grade_id' => $curriculum_name,
'curriculum_avatar' => $curriculum_name,
'type_grade' => $curriculum_name,
'allow_learning_free' => $curriculum_name,
'curriculum_rootlessness' => $curriculum_name,
];
}
public function read_excel($file, $sheet_name) public function read_excel($file, $sheet_name)
{ {
$spreadsheet = IOFactory::load($file); // $spreadsheet = IOFactory::load($file);
$sheet = $spreadsheet->getSheetByName($sheet_name); $spreadsheet = IOFactory::load(public_path('file_excel/lo_trinh_mat_goc.xlsx'));
$sheet = $spreadsheet->getActiveSheet(); $sheetNames = $spreadsheet->getSheetNames();
$sheetIndex = array_search($sheet_name, $sheetNames);
$sheet = $spreadsheet->getSheet($sheetIndex);
// $sheet = $spreadsheet->getActiveSheet();
// Lấy tất cả dữ liệu từ sheet và chuyển đổi thành mảng // Lấy tất cả dữ liệu từ sheet và chuyển đổi thành mảng
$data = []; $data = [];
@ -145,6 +366,7 @@ class LoseRootController extends Controller
} }
} }
} }
// dd($list_week_format);
return $list_week_format; return $list_week_format;
} }

@ -0,0 +1,13 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Curriculum extends Model
{
use HasFactory;
protected $table = 'gk_curriculum';
protected $connection = 'mysql_loseroot';
}

@ -0,0 +1,12 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Lesson extends Model
{
use HasFactory;
protected $table = 'gk_lesson';
}

@ -8,13 +8,16 @@
"php": "^8.1", "php": "^8.1",
"guzzlehttp/guzzle": "^7.2", "guzzlehttp/guzzle": "^7.2",
"laravel/framework": "^10.10", "laravel/framework": "^10.10",
"laravel/helpers": "^1.6",
"laravel/sanctum": "^3.3", "laravel/sanctum": "^3.3",
"laravel/tinker": "^2.8", "laravel/tinker": "^2.8",
"maatwebsite/excel": "^3.1", "maatwebsite/excel": "^3.1",
"mews/purifier": "^3.4",
"nwidart/laravel-modules": "^10.0", "nwidart/laravel-modules": "^10.0",
"phpoffice/phpspreadsheet": "^1.29" "phpoffice/phpspreadsheet": "^1.29"
}, },
"require-dev": { "require-dev": {
"barryvdh/laravel-ide-helper": "^2.13",
"fakerphp/faker": "^1.9.1", "fakerphp/faker": "^1.9.1",
"laravel/pint": "^1.0", "laravel/pint": "^1.0",
"laravel/sail": "^1.18", "laravel/sail": "^1.18",
@ -42,7 +45,10 @@
"@php artisan package:discover --ansi" "@php artisan package:discover --ansi"
], ],
"post-update-cmd": [ "post-update-cmd": [
"@php artisan vendor:publish --tag=laravel-assets --ansi --force" "@php artisan vendor:publish --tag=laravel-assets --ansi --force",
"Illuminate\\Foundation\\ComposerScripts::postUpdate",
"@php artisan ide-helper:generate",
"@php artisan ide-helper:meta"
], ],
"post-root-package-install": [ "post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
@ -53,7 +59,9 @@
}, },
"extra": { "extra": {
"laravel": { "laravel": {
"dont-discover": [] "dont-discover": [
"barryvdh/laravel-ide-helper"
]
} }
}, },
"config": { "config": {

1213
src/composer.lock generated

File diff suppressed because it is too large Load Diff

@ -169,6 +169,8 @@ return [
App\Providers\EventServiceProvider::class, App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class, App\Providers\RouteServiceProvider::class,
Maatwebsite\Excel\ExcelServiceProvider::class, Maatwebsite\Excel\ExcelServiceProvider::class,
Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class,
Mews\Purifier\PurifierServiceProvider::class,
])->toArray(), ])->toArray(),
/* /*
@ -185,6 +187,7 @@ return [
'aliases' => Facade::defaultAliases()->merge([ 'aliases' => Facade::defaultAliases()->merge([
// 'Example' => App\Facades\Example::class, // 'Example' => App\Facades\Example::class,
'Excel' => Maatwebsite\Excel\Facades\Excel::class, 'Excel' => Maatwebsite\Excel\Facades\Excel::class,
'Purifier' => Mews\Purifier\Facades\Purifier::class,
])->toArray(), ])->toArray(),
]; ];

@ -62,6 +62,44 @@ return [
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [], ]) : [],
], ],
'mysql_sunday' => [
'driver' => 'mysql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
'mysql_loseroot' => [
'driver' => 'mysql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST_2', '127.0.0.1'),
'port' => env('DB_PORT_2', '3306'),
'database' => env('DB_DATABASE_2', 'forge'),
'username' => env('DB_USERNAME_2', 'forge'),
'password' => env('DB_PASSWORD_2', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
'pgsql' => [ 'pgsql' => [
'driver' => 'pgsql', 'driver' => 'pgsql',

@ -0,0 +1,343 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Filename & Format
|--------------------------------------------------------------------------
|
| The default filename
|
*/
'filename' => '_ide_helper.php',
/*
|--------------------------------------------------------------------------
| Models filename
|--------------------------------------------------------------------------
|
| The default filename for the models helper file
|
*/
'models_filename' => '_ide_helper_models.php',
/*
|--------------------------------------------------------------------------
| Where to write the PhpStorm specific meta file
|--------------------------------------------------------------------------
|
| PhpStorm also supports the directory `.phpstorm.meta.php/` with arbitrary
| files in it, should you need additional files for your project; e.g.
| `.phpstorm.meta.php/laravel_ide_Helper.php'.
|
*/
'meta_filename' => '.phpstorm.meta.php',
/*
|--------------------------------------------------------------------------
| Fluent helpers
|--------------------------------------------------------------------------
|
| Set to true to generate commonly used Fluent methods
|
*/
'include_fluent' => false,
/*
|--------------------------------------------------------------------------
| Factory Builders
|--------------------------------------------------------------------------
|
| Set to true to generate factory generators for better factory()
| method auto-completion.
|
| Deprecated for Laravel 8 or latest.
|
*/
'include_factory_builders' => false,
/*
|--------------------------------------------------------------------------
| Write Model Magic methods
|--------------------------------------------------------------------------
|
| Set to false to disable write magic methods of model
|
*/
'write_model_magic_where' => true,
/*
|--------------------------------------------------------------------------
| Write Model External Eloquent Builder methods
|--------------------------------------------------------------------------
|
| Set to false to disable write external eloquent builder methods
|
*/
'write_model_external_builder_methods' => true,
/*
|--------------------------------------------------------------------------
| Write Model relation count properties
|--------------------------------------------------------------------------
|
| Set to false to disable writing of relation count properties to model DocBlocks.
|
*/
'write_model_relation_count_properties' => true,
/*
|--------------------------------------------------------------------------
| Write Eloquent Model Mixins
|--------------------------------------------------------------------------
|
| This will add the necessary DocBlock mixins to the model class
| contained in the Laravel Framework. This helps the IDE with
| auto-completion.
|
| Please be aware that this setting changes a file within the /vendor directory.
|
*/
'write_eloquent_model_mixins' => false,
/*
|--------------------------------------------------------------------------
| Helper files to include
|--------------------------------------------------------------------------
|
| Include helper files. By default not included, but can be toggled with the
| -- helpers (-H) option. Extra helper files can be included.
|
*/
'include_helpers' => false,
'helper_files' => [
base_path() . '/vendor/laravel/framework/src/Illuminate/Support/helpers.php',
],
/*
|--------------------------------------------------------------------------
| Model locations to include
|--------------------------------------------------------------------------
|
| Define in which directories the ide-helper:models command should look
| for models.
|
| glob patterns are supported to easier reach models in sub-directories,
| e.g. `app/Services/* /Models` (without the space)
|
*/
'model_locations' => [
'app',
],
/*
|--------------------------------------------------------------------------
| Models to ignore
|--------------------------------------------------------------------------
|
| Define which models should be ignored.
|
*/
'ignored_models' => [
],
/*
|--------------------------------------------------------------------------
| Models hooks
|--------------------------------------------------------------------------
|
| Define which hook classes you want to run for models to add custom information
|
| Hooks should implement Barryvdh\LaravelIdeHelper\Contracts\ModelHookInterface.
|
*/
'model_hooks' => [
// App\Support\IdeHelper\MyModelHook::class
],
/*
|--------------------------------------------------------------------------
| Extra classes
|--------------------------------------------------------------------------
|
| These implementations are not really extended, but called with magic functions
|
*/
'extra' => [
'Eloquent' => ['Illuminate\Database\Eloquent\Builder', 'Illuminate\Database\Query\Builder'],
'Session' => ['Illuminate\Session\Store'],
],
'magic' => [],
/*
|--------------------------------------------------------------------------
| Interface implementations
|--------------------------------------------------------------------------
|
| These interfaces will be replaced with the implementing class. Some interfaces
| are detected by the helpers, others can be listed below.
|
*/
'interfaces' => [
],
/*
|--------------------------------------------------------------------------
| Support for custom DB types
|--------------------------------------------------------------------------
|
| This setting allow you to map any custom database type (that you may have
| created using CREATE TYPE statement or imported using database plugin
| / extension to a Doctrine type.
|
| Each key in this array is a name of the Doctrine2 DBAL Platform. Currently valid names are:
| 'postgresql', 'db2', 'drizzle', 'mysql', 'oracle', 'sqlanywhere', 'sqlite', 'mssql'
|
| This name is returned by getName() method of the specific Doctrine/DBAL/Platforms/AbstractPlatform descendant
|
| The value of the array is an array of type mappings. Key is the name of the custom type,
| (for example, "jsonb" from Postgres 9.4) and the value is the name of the corresponding Doctrine2 type (in
| our case it is 'json_array'. Doctrine types are listed here:
| https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/types.html#types
|
| So to support jsonb in your models when working with Postgres, just add the following entry to the array below:
|
| "postgresql" => array(
| "jsonb" => "json_array",
| ),
|
*/
'custom_db_types' => [
],
/*
|--------------------------------------------------------------------------
| Support for camel cased models
|--------------------------------------------------------------------------
|
| There are some Laravel packages (such as Eloquence) that allow for accessing
| Eloquent model properties via camel case, instead of snake case.
|
| Enabling this option will support these packages by saving all model
| properties as camel case, instead of snake case.
|
| For example, normally you would see this:
|
| * @property \Illuminate\Support\Carbon $created_at
| * @property \Illuminate\Support\Carbon $updated_at
|
| With this enabled, the properties will be this:
|
| * @property \Illuminate\Support\Carbon $createdAt
| * @property \Illuminate\Support\Carbon $updatedAt
|
| Note, it is currently an all-or-nothing option.
|
*/
'model_camel_case_properties' => false,
/*
|--------------------------------------------------------------------------
| Property Casts
|--------------------------------------------------------------------------
|
| Cast the given "real type" to the given "type".
|
*/
'type_overrides' => [
'integer' => 'int',
'boolean' => 'bool',
],
/*
|--------------------------------------------------------------------------
| Include DocBlocks from classes
|--------------------------------------------------------------------------
|
| Include DocBlocks from classes to allow additional code inspection for
| magic methods and properties.
|
*/
'include_class_docblocks' => false,
/*
|--------------------------------------------------------------------------
| Force FQN usage
|--------------------------------------------------------------------------
|
| Use the fully qualified (class) name in docBlock,
| event if class exists in a given file
| or there is an import (use className) of a given class
|
*/
'force_fqn' => false,
/*
|--------------------------------------------------------------------------
| Use generics syntax
|--------------------------------------------------------------------------
|
| Use generics syntax within DocBlocks,
| e.g. `Collection<User>` instead of `Collection|User[]`.
|
*/
'use_generics_annotations' => true,
/*
|--------------------------------------------------------------------------
| Additional relation types
|--------------------------------------------------------------------------
|
| Sometimes it's needed to create custom relation types. The key of the array
| is the Relationship Method name. The value of the array is the canonical class
| name of the Relationship, e.g. `'relationName' => RelationShipClass::class`.
|
*/
'additional_relation_types' => [],
/*
|--------------------------------------------------------------------------
| Additional relation return types
|--------------------------------------------------------------------------
|
| When using custom relation types its possible for the class name to not contain
| the proper return type of the relation. The key of the array is the relationship
| method name. The value of the array is the return type of the relation.
| e.g. `'relationName' => 'many'`.
|
*/
'additional_relation_return_types' => [],
/*
|--------------------------------------------------------------------------
| Run artisan commands after migrations to generate model helpers
|--------------------------------------------------------------------------
|
| The specified commands should run after migrations are finished running.
|
*/
'post_migrate' => [
// 'ide-helper:models --nowrite',
],
];

@ -0,0 +1,106 @@
<?php
/**
* Ok, glad you are here
* first we get a config instance, and set the settings
* $config = HTMLPurifier_Config::createDefault();
* $config->set('Core.Encoding', $this->config->get('purifier.encoding'));
* $config->set('Cache.SerializerPath', $this->config->get('purifier.cachePath'));
* if ( ! $this->config->get('purifier.finalize')) {
* $config->autoFinalize = false;
* }
* $config->loadArray($this->getConfig());
*
* You must NOT delete the default settings
* anything in settings should be compacted with params that needed to instance HTMLPurifier_Config.
*
* @link http://htmlpurifier.org/live/configdoc/plain.html
*/
return [
'encoding' => 'UTF-8',
'finalize' => true,
'ignoreNonStrings' => false,
'cachePath' => storage_path('app/purifier'),
'cacheFileMode' => 0755,
'settings' => [
'default' => [
'HTML.Doctype' => 'HTML 4.01 Transitional',
'HTML.Allowed' => 'div,b,strong,i,em,u,a[href|title],ul,ol,li,p[style],br,span[style],img[width|height|alt|src]',
'CSS.AllowedProperties' => 'font,font-size,font-weight,font-style,font-family,text-decoration,padding-left,color,background-color,text-align',
'AutoFormat.AutoParagraph' => true,
'AutoFormat.RemoveEmpty' => true,
],
'test' => [
'Attr.EnableID' => 'true',
],
"youtube" => [
"HTML.SafeIframe" => 'true',
"URI.SafeIframeRegexp" => "%^(http://|https://|//)(www.youtube.com/embed/|player.vimeo.com/video/)%",
],
'custom_definition' => [
'id' => 'html5-definitions',
'rev' => 1,
'debug' => false,
'elements' => [
// http://developers.whatwg.org/sections.html
['section', 'Block', 'Flow', 'Common'],
['nav', 'Block', 'Flow', 'Common'],
['article', 'Block', 'Flow', 'Common'],
['aside', 'Block', 'Flow', 'Common'],
['header', 'Block', 'Flow', 'Common'],
['footer', 'Block', 'Flow', 'Common'],
// Content model actually excludes several tags, not modelled here
['address', 'Block', 'Flow', 'Common'],
['hgroup', 'Block', 'Required: h1 | h2 | h3 | h4 | h5 | h6', 'Common'],
// http://developers.whatwg.org/grouping-content.html
['figure', 'Block', 'Optional: (figcaption, Flow) | (Flow, figcaption) | Flow', 'Common'],
['figcaption', 'Inline', 'Flow', 'Common'],
// http://developers.whatwg.org/the-video-element.html#the-video-element
['video', 'Block', 'Optional: (source, Flow) | (Flow, source) | Flow', 'Common', [
'src' => 'URI',
'type' => 'Text',
'width' => 'Length',
'height' => 'Length',
'poster' => 'URI',
'preload' => 'Enum#auto,metadata,none',
'controls' => 'Bool',
]],
['source', 'Block', 'Flow', 'Common', [
'src' => 'URI',
'type' => 'Text',
]],
// http://developers.whatwg.org/text-level-semantics.html
['s', 'Inline', 'Inline', 'Common'],
['var', 'Inline', 'Inline', 'Common'],
['sub', 'Inline', 'Inline', 'Common'],
['sup', 'Inline', 'Inline', 'Common'],
['mark', 'Inline', 'Inline', 'Common'],
['wbr', 'Inline', 'Empty', 'Core'],
// http://developers.whatwg.org/edits.html
['ins', 'Block', 'Flow', 'Common', ['cite' => 'URI', 'datetime' => 'CDATA']],
['del', 'Block', 'Flow', 'Common', ['cite' => 'URI', 'datetime' => 'CDATA']],
],
'attributes' => [
['iframe', 'allowfullscreen', 'Bool'],
['table', 'height', 'Text'],
['td', 'border', 'Text'],
['th', 'border', 'Text'],
['tr', 'width', 'Text'],
['tr', 'height', 'Text'],
['tr', 'border', 'Text'],
],
],
'custom_attributes' => [
['a', 'target', 'Enum#_blank,_self,_target,_top'],
],
'custom_elements' => [
['u', 'Inline', 'Inline', 'Common'],
],
],
];

@ -0,0 +1,117 @@
@extends('layouts.default')
@section('content')
{{-- @php
var_dump($data['data_trip']);
@endphp --}}
<h4 class="text-center">
{{ $data['curriculum_data']['name'] }}
</h4>
@foreach ($data_trip as $week_num => $trip)
<div class="row border">
<p class="text-uppercase font-weight-bold">
<a class="#" data-bs-toggle="collapse" href="#{{ 'collapseExample_' . $week_num }}" role="button"
aria-expanded="false" aria-controls="{{ 'collapseExample_' . $week_num }}">
{{ 'Tuần ' . $week_num }}
</a>
</p>
<div class="collapse" id="{{ 'collapseExample_' . $week_num }}">
<div class="row">
@foreach ($trip as $unit_num => $unit_value)
<div class="col-md-auto p-3 border border-info m-1">
<p class="text-center">
<a class="text-dark" data-bs-toggle="collapse" href="#{{ 'collapseUnit_' . $week_num }}"
role="button" aria-expanded="false" aria-controls="{{ 'collapseUnit_' . $week_num }}">
{{ 'Unit ' . $unit_num }}
</a>
</p>
<div class="collapse collapse-unit" id="{{ 'collapseUnit_' . $week_num }}">
<div class="row">
@foreach ($unit_value as $topic_id)
{{-- <div class="col-sm">
{{ $lesson_id }}
</div> --}}
<div class="card col-sm p-0 m-1" style="width: 8rem;">
{{-- <img class="card-img-top" src="..." alt="Card image cap"> --}}
<div class="card-body p-0">
<p class="card-text text-center">TOPIC : {{ $topic_id }}
<small> ( {{ count($data['lesson_by_topic'][$topic_id]) ?? 0 }}
)</small>
</p>
@foreach ($data['lesson_by_topic'][$topic_id] as $lesson_id => $lesson)
<p style="font-size: 11px;"> - (ID : {{ $lesson_id }} TYPE :
{{ $lesson->lesson_type ?? null }})</p>
@endforeach
{{-- <small style="font-size: 15px;">Lesson In Topic {{ $topic_id }}</small> --}}
</div>
</div>
@endforeach
</div>
</div>
</div>
@endforeach
</div>
{{-- <div class="card card-body">
Some placeholder content for the collapse component. This panel is hidden by default but revealed when
the user activates the relevant trigger.
</div> --}}
</div>
</div>
@endforeach
<div class="d-grid gap-2 d-md-block text-center pt-3">
<button type="button" class="btn btn-primary" id="createData">Tạo dữ liệu</button>
</div>
<input type="text" id="dataCommon" hidden value="{{ json_encode($data) }}">
<input type="text" id="dataTrip" hidden value="{{ json_encode($data_trip) }}">
@stop
@section('js')
<script>
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
$(document).ready(function() {
// var data_common = "{{ json_encode($data) }}";
// var data_trip = "{{ json_encode($data) }}";
var data_common = $("#dataCommon").val();
var data_trip = $("#dataTrip").val();
$(document).on("click", "#createData", function() {
let data_final = [];
let url = "{{ route('loseroot.handle_data') }}";
let common = $.parseJSON(data_common);
let trip = $.parseJSON(data_trip);
var obj_final = {
curriculum_data: common['curriculum_data'],
curriculum_unit_data: common['curriculum_unit_data'],
data_trip: common['data_trip'],
lesson_by_topic: common['lesson_by_topic'],
unit_data: common['unit_data'],
unit_element_data: common['unit_element_data'],
trip: trip,
};
// console.log(obj_final);return;
ajax_post(url, JSON.stringify(obj_final));
});
function ajax_post(url, data) {
$.ajax({
type: "POST",
url: url,
data: {
'data' : data
},
dataType: "application/json",
success: function(response) {
console.log(response);
}
});
}
});
</script>
@stop

@ -1,7 +1,7 @@
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="description" content=""> <meta name="description" content="">
<meta name="csrf-token" content="{{ csrf_token() }}" />
<meta name="Saquib" content="Blade"> <meta name="Saquib" content="Blade">
<meta name="csrf-token" content="{{ csrf_token() }}"> <meta name="csrf-token" content="{{ csrf_token() }}">
<title>Checkout our layout</title> <title>Checkout our layout</title>
@ -10,3 +10,4 @@
{{-- <link rel="stylesheet" href="//netdna.bootstrapcdn.com/twitter-bootstrap/3.0.3/css/bootstrap-combined.min.css"> --}} {{-- <link rel="stylesheet" href="//netdna.bootstrapcdn.com/twitter-bootstrap/3.0.3/css/bootstrap-combined.min.css"> --}}
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous"> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>

@ -1,17 +1,23 @@
{{-- <div class="navbar"> <nav class="navbar navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand" href="#">Lose Root</a>
<div class="navbar-inner"> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav"
aria-expanded="false" aria-label="Toggle navigation">
<a id="logo" href="/">Single Malt</a> <span class="navbar-toggler-icon"></span>
</button>
<ul class="nav"> <div class="collapse navbar-collapse justify-content-center" id="navbarNav">
<ul class="navbar-nav">
<li><a href="/">Home</a></li> <li class="nav-item active">
<a class="nav-link" href="{{ route('loseroot.file.read', ['sheet' => 'class_6']) }}">Giáo trình mất gốc lớp 6 <span class="sr-only"></span></a>
<li><a href="/contact">Contact</a></li> </li>
<li class="nav-item">
<a class="nav-link" href="{{ route('loseroot.file.read', ['sheet' => 'class_7']) }}">Giáo trình mất gốc lớp 7</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ route('loseroot.file.read', ['sheet' => 'class_8']) }}">Giáo trình mất gốc lớp 8</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ route('loseroot.file.read', ['sheet' => 'class_9']) }}">Giáo trình mất gốc lớp 9</a>
</li>
</ul> </ul>
</div> </div>
</nav>
</div> --}}

@ -18,7 +18,7 @@
</header> </header>
<div id="main" class="content"> <div id="main" class="content p-3">
@yield('content') @yield('content')
@ -33,6 +33,7 @@
</div> </div>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js" integrity="sha384-IQsoLXl5PILFhosVNubq5LC7Qb9DXgDA9i+tQ8Zj3iwWAwPtgFTxbJ8NT4GN1R8p" crossorigin="anonymous"></script> <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js" integrity="sha384-IQsoLXl5PILFhosVNubq5LC7Qb9DXgDA9i+tQ8Zj3iwWAwPtgFTxbJ8NT4GN1R8p" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.min.js" integrity="sha384-cVKIPhGWiC2Al4u+LWgxfKTRIcfu0JTxR+EQDz/bgldoEyl4H0zUF0QKbrJ0EcQF" crossorigin="anonymous"></script> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.min.js" integrity="sha384-cVKIPhGWiC2Al4u+LWgxfKTRIcfu0JTxR+EQDz/bgldoEyl4H0zUF0QKbrJ0EcQF" crossorigin="anonymous"></script>
@yield('js')
</body> </body>
</html> </html>

@ -19,5 +19,6 @@ use Illuminate\Support\Facades\Route;
// }); // });
Route::prefix('lose-root')->group(function () { Route::prefix('lose-root')->group(function () {
Route::get('/handle-file', [LoseRootController::class,'index_file'])->name('loseroot.file.index'); Route::get('/handle-file', [LoseRootController::class,'index_file'])->name('loseroot.file.index');
Route::post('/read-file', [LoseRootController::class,'read_file'])->name('loseroot.file.read'); Route::get('/read-file', [LoseRootController::class,'read_file'])->name('loseroot.file.read');
Route::post('/handle-data', [LoseRootController::class,'handle_data'])->name('loseroot.handle_data');
}); });

Loading…
Cancel
Save