From af4aa86f4242f58d3f9bb508e5f05ddda2317de6 Mon Sep 17 00:00:00 2001 From: Holiienko Roman Date: Thu, 25 Jan 2024 12:57:38 +0300 Subject: [PATCH 1/2] completing all pages in categories --- app/Services/PageScrapper.php | 7 ++ resources/views/home.blade.php | 8 +- .../views/layouts/applicant-layout.blade.php | 3 +- resources/views/menu/abitur.blade.php | 2 +- ...omaterialy-dlya-postupayushchikh.blade.php | 8 +- .../menu/inostrannym-abiturientam.blade.php | 76 +++++++++++++++++++ ...i-mezhdunarodnoe-sotrudnichestvo.blade.php | 0 .../kafedry.blade.php | 19 +++++ .../mezhdunarodnaya-deyatelnost.blade.php | 19 +++++ .../obshchie-svedeniya.blade.php | 19 +++++ ...ntr-mezhdunarodnogo-obrazovaniya.blade.php | 19 +++++ .../menu/olimpiady-dlya-shkolnikov.blade.php | 30 ++++++++ resources/views/menu/paid_edu.blade.php | 28 +++++++ .../menu/podgotovitelnye-kursy.blade.php | 20 +++++ routes/web.php | 42 ++++++++++ 15 files changed, 290 insertions(+), 10 deletions(-) create mode 100644 resources/views/menu/inostrannym-abiturientam.blade.php create mode 100644 resources/views/menu/inostrannym-abiturientam/akademicheskaya-mobilnost-i-mezhdunarodnoe-sotrudnichestvo.blade.php create mode 100644 resources/views/menu/inostrannym-abiturientam/kafedry.blade.php create mode 100644 resources/views/menu/inostrannym-abiturientam/mezhdunarodnaya-deyatelnost.blade.php create mode 100644 resources/views/menu/inostrannym-abiturientam/obshchie-svedeniya.blade.php create mode 100644 resources/views/menu/inostrannym-abiturientam/tsentr-mezhdunarodnogo-obrazovaniya.blade.php create mode 100644 resources/views/menu/olimpiady-dlya-shkolnikov.blade.php create mode 100644 resources/views/menu/paid_edu.blade.php create mode 100644 resources/views/menu/podgotovitelnye-kursy.blade.php diff --git a/app/Services/PageScrapper.php b/app/Services/PageScrapper.php index 21fa781..8f8422a 100644 --- a/app/Services/PageScrapper.php +++ b/app/Services/PageScrapper.php @@ -35,6 +35,13 @@ class PageScrapper $content = str_replace($el, 'https://mkgtu.ru' . $el, $content); } } + $rez = preg_match_all('/src="(.*)">/isU', $content, $arr); + $arr[1] = array_unique($arr[1]); + foreach ($arr[1] as $el) { + if (!str_starts_with($el, 'https') && str_contains($el, 'upload')) { + $content = str_replace($el, 'https://mkgtu.ru' . $el, $content); + } + } return $content; } diff --git a/resources/views/home.blade.php b/resources/views/home.blade.php index 51c2bf5..f255caf 100644 --- a/resources/views/home.blade.php +++ b/resources/views/home.blade.php @@ -46,7 +46,7 @@
- +
- +
- +
- +
diff --git a/resources/views/menu/abitur.blade.php b/resources/views/menu/abitur.blade.php index 05dc9f7..28f3482 100644 --- a/resources/views/menu/abitur.blade.php +++ b/resources/views/menu/abitur.blade.php @@ -13,7 +13,7 @@ } -
+
diff --git a/resources/views/menu/abitur/videomaterialy-dlya-postupayushchikh.blade.php b/resources/views/menu/abitur/videomaterialy-dlya-postupayushchikh.blade.php index cd0f407..f2fa0c8 100644 --- a/resources/views/menu/abitur/videomaterialy-dlya-postupayushchikh.blade.php +++ b/resources/views/menu/abitur/videomaterialy-dlya-postupayushchikh.blade.php @@ -11,10 +11,10 @@ $content = $pageScrapper->normalizeURLFile($row); $content = $pageScrapper->cutHTML($content,'//isU'); - $content = str_replace( - 'Обложка Госуслуги_page-0001.jpg', - 'Обложка Госуслуги_page-0001.jpg', - $content); +// $content = str_replace( +// 'Обложка Госуслуги_page-0001.jpg', +// 'Обложка Госуслуги_page-0001.jpg', +// $content); echo $content; @endphp diff --git a/resources/views/menu/inostrannym-abiturientam.blade.php b/resources/views/menu/inostrannym-abiturientam.blade.php new file mode 100644 index 0000000..a786aa9 --- /dev/null +++ b/resources/views/menu/inostrannym-abiturientam.blade.php @@ -0,0 +1,76 @@ +@extends('layouts.applicant-layout') +@section('content') + + + + + + +@endsection diff --git a/resources/views/menu/inostrannym-abiturientam/akademicheskaya-mobilnost-i-mezhdunarodnoe-sotrudnichestvo.blade.php b/resources/views/menu/inostrannym-abiturientam/akademicheskaya-mobilnost-i-mezhdunarodnoe-sotrudnichestvo.blade.php new file mode 100644 index 0000000..e69de29 diff --git a/resources/views/menu/inostrannym-abiturientam/kafedry.blade.php b/resources/views/menu/inostrannym-abiturientam/kafedry.blade.php new file mode 100644 index 0000000..7885b7e --- /dev/null +++ b/resources/views/menu/inostrannym-abiturientam/kafedry.blade.php @@ -0,0 +1,19 @@ +@extends('layouts.applicant-layout') +@section('content') +
Кафедры
+
+ +
+ @php + use App\Services\PageScrapper; + $pageScrapper = new PageScrapper("https://mkgtu.ru/postuplenie/inostrannym-abiturientam/kafedry/", '
'); + $row = $pageScrapper->getHTML(); + $content = $pageScrapper->normalizeURLFile($row); + $content = $pageScrapper->cutHTML($content,'//isU'); + echo $content; + + @endphp + +
+
+@endsection diff --git a/resources/views/menu/inostrannym-abiturientam/mezhdunarodnaya-deyatelnost.blade.php b/resources/views/menu/inostrannym-abiturientam/mezhdunarodnaya-deyatelnost.blade.php new file mode 100644 index 0000000..a95996e --- /dev/null +++ b/resources/views/menu/inostrannym-abiturientam/mezhdunarodnaya-deyatelnost.blade.php @@ -0,0 +1,19 @@ +@extends('layouts.applicant-layout') +@section('content') +
Международная деятельность
+
+ +
+ @php + use App\Services\PageScrapper; + $pageScrapper = new PageScrapper("https://mkgtu.ru/postuplenie/inostrannym-abiturientam/mezhdunarodnaya-deyatelnost/", '
'); + $row = $pageScrapper->getHTML(); + $content = $pageScrapper->normalizeURLFile($row); + $content = $pageScrapper->cutHTML($content,'//isU'); + echo $content; + + @endphp + +
+
+@endsection diff --git a/resources/views/menu/inostrannym-abiturientam/obshchie-svedeniya.blade.php b/resources/views/menu/inostrannym-abiturientam/obshchie-svedeniya.blade.php new file mode 100644 index 0000000..2d26872 --- /dev/null +++ b/resources/views/menu/inostrannym-abiturientam/obshchie-svedeniya.blade.php @@ -0,0 +1,19 @@ +@extends('layouts.applicant-layout') +@section('content') +
Общие сведения
+
+ +
+ @php + use App\Services\PageScrapper; + $pageScrapper = new PageScrapper("https://mkgtu.ru/postuplenie/inostrannym-abiturientam/obshchie-svedeniya/", '
'); + $row = $pageScrapper->getHTML(); + $content = $pageScrapper->normalizeURLFile($row); + $content = $pageScrapper->cutHTML($content,'//isU'); + echo $content; + + @endphp + +
+
+@endsection diff --git a/resources/views/menu/inostrannym-abiturientam/tsentr-mezhdunarodnogo-obrazovaniya.blade.php b/resources/views/menu/inostrannym-abiturientam/tsentr-mezhdunarodnogo-obrazovaniya.blade.php new file mode 100644 index 0000000..74b6529 --- /dev/null +++ b/resources/views/menu/inostrannym-abiturientam/tsentr-mezhdunarodnogo-obrazovaniya.blade.php @@ -0,0 +1,19 @@ +@extends('layouts.applicant-layout') +@section('content') +
Центр Международного образования
+
+ +
+ @php + use App\Services\PageScrapper; + $pageScrapper = new PageScrapper("https://mkgtu.ru/postuplenie/inostrannym-abiturientam/tsentr-mezhdunarodnogo-obrazovaniya/", '
'); + $row = $pageScrapper->getHTML(); + $content = $pageScrapper->normalizeURLFile($row); + $content = $pageScrapper->cutHTML($content,'//isU'); + echo $content; + + @endphp + +
+
+@endsection diff --git a/resources/views/menu/olimpiady-dlya-shkolnikov.blade.php b/resources/views/menu/olimpiady-dlya-shkolnikov.blade.php new file mode 100644 index 0000000..017051d --- /dev/null +++ b/resources/views/menu/olimpiady-dlya-shkolnikov.blade.php @@ -0,0 +1,30 @@ +@extends('layouts.applicant-layout') +@section('content') +
Олимпиады для школьников
+{{-- пофиксить!!!!--}} +
+ +
+ @php + use App\Services\PageScrapper; + $pageScrapper = new PageScrapper("https://mkgtu.ru/postuplenie/olimpiady-dlya-shkolnikov/", '
'); + $row = $pageScrapper->getHTML(); + $content = $pageScrapper->normalizeURLFile($row); + $content = $pageScrapper->cutHTML($content,'//isU'); + +// $tmp = preg_match_all('/

/isU', "https://mkgtu.ru/postuplenie/olimpiady-dlya-shkolnikov/", $arr); +// +// $arr[0] = array_unique($arr[0]); +// $str = $arr[0][0]; + $content = str_replace('

', '

', $content); + + + + + echo $content; + + @endphp + +

+
+@endsection diff --git a/resources/views/menu/paid_edu.blade.php b/resources/views/menu/paid_edu.blade.php new file mode 100644 index 0000000..6f89bce --- /dev/null +++ b/resources/views/menu/paid_edu.blade.php @@ -0,0 +1,28 @@ +@extends('layouts.applicant-layout') +@section('extra_styles') + + + + + + + +@endsection +@section('content') +
Платные образовательные услуги
+
+ +
+ @php + use App\Services\PageScrapper; + $pageScrapper = new PageScrapper("https://mkgtu.ru/sveden/paid_edu/", '
'); + $row = $pageScrapper->getHTML(); + $content = $pageScrapper->normalizeURLFile($row); + $content = $pageScrapper->cutHTML($content,'//isU'); + echo $content; + + @endphp + +
+
+@endsection diff --git a/resources/views/menu/podgotovitelnye-kursy.blade.php b/resources/views/menu/podgotovitelnye-kursy.blade.php new file mode 100644 index 0000000..03ada84 --- /dev/null +++ b/resources/views/menu/podgotovitelnye-kursy.blade.php @@ -0,0 +1,20 @@ +@extends('layouts.applicant-layout') + +@section('content') +
Подготовительные курсы
+
+ +
+ @php + use App\Services\PageScrapper; + $pageScrapper = new PageScrapper("https://mkgtu.ru/postuplenie/podgotovitelnye-kursy/", '
'); + $row = $pageScrapper->getHTML(); + $content = $pageScrapper->normalizeURLFile($row); + $content = $pageScrapper->cutHTML($content,'//isU'); + echo $content; + + @endphp + +
+
+@endsection diff --git a/routes/web.php b/routes/web.php index ae771ca..ce35c36 100644 --- a/routes/web.php +++ b/routes/web.php @@ -34,6 +34,26 @@ Route::get('/applicant', function () { return view('menu.abitur'); })->name('abitur'); +Route::get('/for-foreign-applicants', function () { + return view('menu.inostrannym-abiturientam'); +})->name('inostrannym-abiturientam'); + +Route::get('/paid_edu', function () { + return view('menu.paid_edu'); +})->name('paid_edu'); + +Route::get('/olympiads-for-schoolchildren', function () { + return view('menu.olimpiady-dlya-shkolnikov'); +})->name('olimpiady-dlya-shkolnikov'); + +Route::get('/training courses', function () { + return view('menu.podgotovitelnye-kursy'); +})->name('podgotovitelnye-kursy'); + + + + + Route::get('/web-consultations', function () { return view('menu.abitur.web-consultations'); })->name('web-consultations'); @@ -62,6 +82,28 @@ Route::get('/video-materials-for-applicants', function () { return view('menu.abitur.videomaterialy-dlya-postupayushchikh'); })->name('videomaterialy-dlya-postupayushchikh'); +Route::get('/international-activity', function () { + return view('menu.inostrannym-abiturientam.mezhdunarodnaya-deyatelnost'); +})->name('mezhdunarodnaya-deyatelnost'); + +Route::get('/general-information', function () { + return view('menu.inostrannym-abiturientam.obshchie-svedeniya'); +})->name('obshchie-svedeniya'); + +Route::get('/departments', function () { + return view('menu.inostrannym-abiturientam.kafedry'); +})->name('kafedry'); + +Route::get('/international-education-center', function () { + return view('menu.inostrannym-abiturientam.tsentr-mezhdunarodnogo-obrazovaniya'); +})->name('tsentr-mezhdunarodnogo-obrazovaniya'); + +Route::get('/academic-mobility-and-international-cooperation', function () { + return view('menu.inostrannym-abiturientam.akademicheskaya-mobilnost-i-mezhdunarodnoe-sotrudnichestvo'); +})->name('akademicheskaya-mobilnost-i-mezhdunarodnoe-sotrudnichestvo'); + + + Route::post('/uploadfile', [UploadFileController::class, 'showUploadFile'])->name('uploadfile'); Route::get('/dashboard', function () { From 207e392fff795856759426f506c2aaea08d3c963 Mon Sep 17 00:00:00 2001 From: Holiienko Roman Date: Thu, 25 Jan 2024 14:01:05 +0300 Subject: [PATCH 2/2] fixing --- app/Services/PageScrapper.php | 6 ++- ...i-mezhdunarodnoe-sotrudnichestvo.blade.php | 43 +++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/app/Services/PageScrapper.php b/app/Services/PageScrapper.php index 8f8422a..8dd6658 100644 --- a/app/Services/PageScrapper.php +++ b/app/Services/PageScrapper.php @@ -50,8 +50,12 @@ class PageScrapper $arr = []; + // + //safdsaf sdfdasf