Merge branch 'RomanGolienko-main'
Tests & Lint & Deploy to Railway / build (20.x, 8.2) (push) Failing after 2m0s Details
Tests & Lint & Deploy to Railway / deploy (8.1) (push) Has been skipped Details

This commit is contained in:
aslan 2024-01-24 15:50:42 +03:00
commit 49cf4f619a
12 changed files with 186 additions and 19 deletions

View File

@ -15,21 +15,42 @@ class PageScrapper
public function getHTML() public function getHTML()
{ {
$page = file_get_contents($this->url); $page = file_get_contents($this->url);
$strForPregMatch = "/" . "{$this->contentMarker}" . "(.*)<\/div>/isU"; $strForPregMatch = "/" . "{$this->contentMarker}" . "(.*)<\/div>/is";
$arr = []; $arr = [];
$rez = preg_match_all($strForPregMatch, $page, $arr); $rez = preg_match_all($strForPregMatch, $page, $arr);
return $content = $arr[1][0] . '</div>';
return $content = $arr[1][0];
} }
public function normalizeURLFile($content) public function normalizeURLFile($content)
{ {
$rez = preg_match_all('/href="(.*)"/isU', $content, $arr);
$rez = preg_match_all('/<a href="(.*)">/isU',$content,$arr);
$arr[1] = array_unique($arr[1]);
foreach ($arr[1] as $el) { foreach ($arr[1] as $el) {
if (strpos($el, 'http') !== 0) { if (!str_starts_with($el, 'https')){
$content = str_replace($el,'https://mkgtu.ru' . $el,$content); $content = str_replace($el,'https://mkgtu.ru' . $el,$content);
} }
} }
return $content; return $content;
}
public function cutHTML($content,$strForScissors)
{
$arr = [];
$rez = preg_match_all($strForScissors, $content, $arr);
$content = str_replace($arr[1],'',$content);
return $content;
} }
} }

View File

@ -26,7 +26,7 @@
</a> </a>
</div> </div>
<div class="col-lg-3 col-md-4"> <div class="col-lg-3 col-md-4">
<a href="{{ route('applicant') }}"> <a href="{{ route('abitur') }}">
<div class="tp-feature__item before-color-2 mb-40"> <div class="tp-feature__item before-color-2 mb-40">
<div class="tp-feature__icon"> <div class="tp-feature__icon">
<img style="max-width: 26%;" src="{{ URL::to('img/courses/abit.png') }}" alt=""> <img style="max-width: 26%;" src="{{ URL::to('img/courses/abit.png') }}" alt="">

View File

@ -38,7 +38,7 @@
</div> </div>
<div class="col-8"> <div class="col-8">
<a href="postup.php"> <a href="{{ route('spetsialitet-magistratura') }}">
<h4> <h4>
<div <div
class="d-flex justify-content-start align-items-center w-100 h-100 border border-secondary m-1 p-4 buttonHover rounded-2"> class="d-flex justify-content-start align-items-center w-100 h-100 border border-secondary m-1 p-4 buttonHover rounded-2">
@ -49,7 +49,7 @@
</div> </div>
<div class="col-8"> <div class="col-8">
<a href="postup-col.php"> <a href="{{ route('kolledzh') }}">
<h4> <h4>
<div <div
class="d-flex justify-content-start align-items-center w-100 h-100 border border-secondary m-1 p-4 buttonHover rounded-2"> class="d-flex justify-content-start align-items-center w-100 h-100 border border-secondary m-1 p-4 buttonHover rounded-2">
@ -60,7 +60,7 @@
</div> </div>
<div class="col-8"> <div class="col-8">
<a href="ui-4.html#"> <a href="{{ route('platnye-obrazovatelnye-uslugi') }}">
<h4> <h4>
<div <div
class="d-flex justify-content-start align-items-center w-100 h-100 border border-secondary m-1 p-4 buttonHover rounded-2"> class="d-flex justify-content-start align-items-center w-100 h-100 border border-secondary m-1 p-4 buttonHover rounded-2">
@ -71,7 +71,7 @@
</div> </div>
<div class="col-8"> <div class="col-8">
<a href="ui-4.html#"> <a href="{{ route('ordinatura') }}">
<h4> <h4>
<div <div
class="d-flex justify-content-start align-items-center w-100 h-100 border border-secondary m-1 p-4 buttonHover rounded-2"> class="d-flex justify-content-start align-items-center w-100 h-100 border border-secondary m-1 p-4 buttonHover rounded-2">
@ -82,7 +82,7 @@
</div> </div>
<div class="col-8"> <div class="col-8">
<a href="ui-4.html#"> <a href="{{ route('aspirantura') }}">
<h4> <h4>
<div <div
class="d-flex justify-content-start align-items-center w-100 h-100 border border-secondary m-1 p-4 buttonHover rounded-2"> class="d-flex justify-content-start align-items-center w-100 h-100 border border-secondary m-1 p-4 buttonHover rounded-2">
@ -93,7 +93,7 @@
</div> </div>
<div class="col-8"> <div class="col-8">
<a href="ui-4.html#"> <a href="https://mkgtu.ru/upload/postuplenie_docs/abiturientu/voprosi.pdf" target="_blank">
<h4> <h4>
<div <div
class="d-flex justify-content-start align-items-center w-100 h-100 border border-secondary m-1 p-4 buttonHover rounded-2"> class="d-flex justify-content-start align-items-center w-100 h-100 border border-secondary m-1 p-4 buttonHover rounded-2">
@ -104,7 +104,7 @@
</div> </div>
<div class="col-8"> <div class="col-8">
<a href="ui-4.html#"> <a href="{{ route('videomaterialy-dlya-postupayushchikh') }}">
<h4> <h4>
<div <div
class="d-flex justify-content-start align-items-center w-100 h-100 border border-secondary m-1 p-4 buttonHover rounded-2"> class="d-flex justify-content-start align-items-center w-100 h-100 border border-secondary m-1 p-4 buttonHover rounded-2">
@ -115,7 +115,7 @@
</div> </div>
<div class="col-8"> <div class="col-8">
<a href="ui-4.html#"> <a href="#">
<h4> <h4>
<div <div
class="d-flex justify-content-start align-items-center w-100 h-100 border border-secondary m-1 p-4 buttonHover rounded-2"> class="d-flex justify-content-start align-items-center w-100 h-100 border border-secondary m-1 p-4 buttonHover rounded-2">

View File

@ -0,0 +1,19 @@
@extends('layouts.applicant-layout')
@section('content')
<div class=" fw-bolder fs-1 text-center py-5 lh-lg"> Для поступающих на обучение по программам аспирантуры </div>
<div class="container pt-4 d-flex justify-content-center">
<div class="col-10">
@php
use App\Services\PageScrapper;
$pageScrapper = new PageScrapper("https://mkgtu.ru/postuplenie/priemnaya-kampaniya/aspirantura/", '<div class=["\']content_info["\']>');
$row = $pageScrapper->getHTML();
$content = $pageScrapper->normalizeURLFile($row);
$content = $pageScrapper->cutHTML($content,'/<footer(.*)<\/footer>/isU');
echo $content;
@endphp
</div>
</div>
@endsection

View File

@ -0,0 +1,19 @@
@extends('layouts.applicant-layout')
@section('content')
<div class=" fw-bolder fs-1 text-center py-5 lh-lg"> Для поступающих на обучение по программам среднего профессионального образования </div>
<div class="container pt-4 d-flex justify-content-center">
<div class="col-10">
@php
use App\Services\PageScrapper;
$pageScrapper = new PageScrapper("https://mkgtu.ru/postuplenie/priemnaya-kampaniya/kolledzh/", '<div class=["\']content_info["\']>');
$row = $pageScrapper->getHTML();
$content = $pageScrapper->normalizeURLFile($row);
$content = $pageScrapper->cutHTML($content,'/<footer(.*)<\/footer>/isU');
echo $content;
@endphp
</div>
</div>
@endsection

View File

@ -0,0 +1,19 @@
@extends('layouts.applicant-layout')
@section('content')
<div class=" fw-bolder fs-1 text-center py-5 lh-lg"> Для поступающих на обучение по программам ординатуры </div>
<div class="container pt-4 d-flex justify-content-center">
<div class="col-10">
@php
use App\Services\PageScrapper;
$pageScrapper = new PageScrapper("https://mkgtu.ru/postuplenie/priemnaya-kampaniya/ordinatura/", '<div class=["\']content_info["\']>');
$row = $pageScrapper->getHTML();
$content = $pageScrapper->normalizeURLFile($row);
$content = $pageScrapper->cutHTML($content,'/<footer(.*)<\/footer>/isU');
echo $content;
@endphp
</div>
</div>
@endsection

View File

@ -0,0 +1,19 @@
@extends('layouts.applicant-layout')
@section('content')
<div class=" fw-bolder fs-1 text-center py-5 lh-lg"> Для поступающих на обучение по договорам об оказании платных образовательных услуг </div>
<div class="container fs-4 pt-4 d-flex justify-content-center">
<div class="col-10">
@php
use App\Services\PageScrapper;
$pageScrapper = new PageScrapper("https://mkgtu.ru/postuplenie/priemnaya-kampaniya/platnye-obrazovatelnye-uslugi/", '<div class=["\']content_info["\']>');
$row = $pageScrapper->getHTML();
$content = $pageScrapper->normalizeURLFile($row);
$content = $pageScrapper->cutHTML($content,'/<footer(.*)<\/footer>/isU');
echo $content;
@endphp
</div>
</div>
@endsection

View File

@ -0,0 +1,19 @@
@extends('layouts.applicant-layout')
@section('content')
<div class=" fw-bolder fs-1 text-center py-5 lh-lg"> Для поступающих на программы бакалавриата, магистратуры </div>
<div class="container pt-4 d-flex justify-content-center">
<div class="col-10">
@php
use App\Services\PageScrapper;
$pageScrapper = new PageScrapper("https://mkgtu.ru/postuplenie/priemnaya-kampaniya/spetsialitet-magistratura-2022/", '<div class=["\']content_info["\']>');
$row = $pageScrapper->getHTML();
$content = $pageScrapper->normalizeURLFile($row);
$content = $pageScrapper->cutHTML($content,'/<footer(.*)<\/footer>/isU');
echo $content ;
@endphp
</div>
</div>
@endsection

View File

@ -0,0 +1,25 @@
@extends('layouts.applicant-layout')
@section('content')
<div class=" fw-bolder fs-1 text-center py-5 lh-lg"> Видеоматериалы для поступающих </div>
<div class="container pt-4 d-flex justify-content-center">
<div class="col-10 text-center pb-4 ">
@php
use App\Services\PageScrapper;
$pageScrapper = new PageScrapper("https://mkgtu.ru/postuplenie/priemnaya-kampaniya/videomaterialy-dlya-postupayushchikh/", '<div class=["\']content_info["\']>');
$row = $pageScrapper->getHTML();
$content = $pageScrapper->normalizeURLFile($row);
$content = $pageScrapper->cutHTML($content,'/<footer(.*)<\/footer>/isU');
$content = str_replace(
'<img width="614" alt="Обложка Госуслуги_page-0001.jpg" src="/upload/medialibrary/c76/c761087fd6938bd8eb8708e9e036679e.jpg" height="346" title="Обложка Госуслуги_page-0001.jpg">',
'<img width="614" alt="Обложка Госуслуги_page-0001.jpg" src="https://mkgtu.ru/upload/medialibrary/c76/c761087fd6938bd8eb8708e9e036679e.jpg" height="346" title="Обложка Госуслуги_page-0001.jpg" class="border border-3 rounded-3 border-secondary">',
$content);
echo $content;
@endphp
</div>
</div>
@endsection

View File

@ -1,6 +1,6 @@
@extends('layouts.applicant-layout') @extends('layouts.applicant-layout')
@section('content') @section('content')
<div class=" fw-bolder fs-1 text-center py-5"> Веб-консультации для абитуриентов и их родителей </div> <div class=" fw-bolder fs-1 text-center py-5 lh-lg"> Веб-консультации для абитуриентов и их родителей </div>
<div class="container pt-4 d-flex justify-content-center"> <div class="container pt-4 d-flex justify-content-center">
<div class="col-10"> <div class="col-10">
@ -9,6 +9,7 @@
$pageScrapper = new PageScrapper("https://www.mkgtu.ru/postuplenie/web-consultations/", '<div class=["\']content_info["\']>'); $pageScrapper = new PageScrapper("https://www.mkgtu.ru/postuplenie/web-consultations/", '<div class=["\']content_info["\']>');
$row = $pageScrapper->getHTML(); $row = $pageScrapper->getHTML();
$content = $pageScrapper->normalizeURLFile($row); $content = $pageScrapper->normalizeURLFile($row);
$content = $pageScrapper->cutHTML($content,'/<footer(.*)<\/footer>/isU');
echo $content; echo $content;
@endphp @endphp

View File

@ -30,15 +30,16 @@
} }
</style> </style>
<div class=" fw-bolder fs-1 text-center py-5"> Подача документов онлайн </div> <div class=" fw-bolder fs-1 text-center py-5 lh-lg"> Подача документов онлайн </div>
<div class="container pt-4 d-flex justify-content-center"> <div class="container pt-4 d-flex justify-content-center">
<div class="col-10"> <div class="col-10">
@php @php
use App\Services\PageScrapper; use App\Services\PageScrapper;
$pageScrapper = new PageScrapper("https://www.mkgtu.ru/postuplenie/web-consultations/", '<div class=["\']content_info["\']>'); $pageScrapper = new PageScrapper("https://mkgtu.ru/postuplenie/podat-dokumenty-onlayn/", '<div class=["\']content_info["\']>');
$row = $pageScrapper->getHTML(); $row = $pageScrapper->getHTML();
$content = $pageScrapper->normalizeURLFile($row); $content = $pageScrapper->normalizeURLFile($row);
$content = $pageScrapper->cutHTML($content,'/<footer(.*)<\/footer>/isU');
echo $content; echo $content;
@endphp @endphp

View File

@ -30,14 +30,38 @@ Route::get('/course', function () {
return view('menu.course'); return view('menu.course');
})->name('course'); })->name('course');
Route::get('/abitur', function () { Route::get('/applicant', function () {
return view('menu.abitur'); return view('menu.abitur');
})->name('applicant'); })->name('abitur');
Route::get('/web-consultations', function () { Route::get('/web-consultations', function () {
return view('menu.abitur.web-consultations'); return view('menu.abitur.web-consultations');
})->name('web-consultations'); })->name('web-consultations');
Route::get('/specialty-magistracy', function () {
return view('menu.abitur.spetsialitet-magistratura');
})->name('spetsialitet-magistratura');
Route::get('/college', function () {
return view('menu.abitur.kolledzh');
})->name('kolledzh');
Route::get('/paid-educational-services', function () {
return view('menu.abitur.platnye-obrazovatelnye-uslugi');
})->name('platnye-obrazovatelnye-uslugi');
Route::get('/residency', function () {
return view('menu.abitur.ordinatura');
})->name('ordinatura');
Route::get('/traineeship', function () {
return view('menu.abitur.aspirantura');
})->name('aspirantura');
Route::get('/video-materials-for-applicants', function () {
return view('menu.abitur.videomaterialy-dlya-postupayushchikh');
})->name('videomaterialy-dlya-postupayushchikh');
Route::post('/uploadfile', [UploadFileController::class, 'showUploadFile'])->name('uploadfile'); Route::post('/uploadfile', [UploadFileController::class, 'showUploadFile'])->name('uploadfile');
Route::get('/dashboard', function () { Route::get('/dashboard', function () {