Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
Clubphp
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Clubphp
Commits
055dd94f
Commit
055dd94f
authored
May 24, 2026
by
Mahmoud Aglan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
coco
parent
b98c1c14
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
62 additions
and
39 deletions
+62
-39
TutorialController.php
app/Modules/Tutorials/Controllers/TutorialController.php
+11
-1
book.php
app/Modules/Tutorials/Views/book.php
+49
-36
000-default.conf
docker/000-default.conf
+1
-1
php.ini
docker/php.ini
+1
-1
No files found.
app/Modules/Tutorials/Controllers/TutorialController.php
View file @
055dd94f
...
...
@@ -558,7 +558,9 @@ class TutorialController extends Controller
public
function
exportPdf
(
Request
$request
)
:
Response
{
set_time_limit
(
480
);
set_time_limit
(
1800
);
$dlToken
=
$_GET
[
'dl'
]
??
''
;
$screenshotsPath
=
realpath
(
__DIR__
.
'/../../../../public/assets/tutorials/screenshots'
);
$viewsPath
=
realpath
(
__DIR__
.
'/../Views'
);
...
...
@@ -605,6 +607,10 @@ class TutorialController extends Controller
$pdfContent
=
file_get_contents
(
$tmpOutput
);
@
unlink
(
$tmpOutput
);
if
(
$dlToken
)
{
setcookie
(
'book_download'
,
$dlToken
,
time
()
+
120
,
'/'
);
}
$response
=
new
Response
();
return
$response
->
html
(
$pdfContent
,
200
)
->
withHeaders
([
'Content-Type'
=>
'application/pdf'
,
...
...
@@ -615,6 +621,10 @@ class TutorialController extends Controller
@
unlink
(
$tmpOutput
);
}
if
(
$dlToken
)
{
setcookie
(
'book_download'
,
$dlToken
,
time
()
+
120
,
'/'
);
}
$response
=
new
Response
();
return
$response
->
html
(
$html
,
200
)
->
withHeaders
([
'Content-Type'
=>
'text/html; charset=utf-8'
,
...
...
app/Modules/Tutorials/Views/book.php
View file @
055dd94f
...
...
@@ -127,14 +127,20 @@
<script>
var
exportSteps
=
[
{
pct
:
5
,
label
:
'تحضير البيانات...'
},
{
pct
:
15
,
label
:
'تجميع شروحات العضوية...'
},
{
pct
:
30
,
label
:
'تجميع شروحات الأنشطة الرياضية...'
},
{
pct
:
45
,
label
:
'تجميع شروحات الخزنة...'
},
{
pct
:
55
,
label
:
'تجميع باقي الأقسام...'
},
{
pct
:
70
,
label
:
'تضمين لقطات الشاشة...'
},
{
pct
:
85
,
label
:
'توليد ملف PDF...'
},
{
pct
:
92
,
label
:
'تجهيز التحميل...'
},
{
pct
:
12
,
label
:
'تجميع شروحات العضوية...'
},
{
pct
:
20
,
label
:
'تجميع شروحات الأنشطة الرياضية...'
},
{
pct
:
28
,
label
:
'تجميع شروحات الخزنة...'
},
{
pct
:
35
,
label
:
'تجميع باقي الأقسام...'
},
{
pct
:
45
,
label
:
'تضمين لقطات الشاشة...'
},
{
pct
:
55
,
label
:
'توليد ملف PDF...'
},
{
pct
:
65
,
label
:
'معالجة الصفحات...'
},
{
pct
:
72
,
label
:
'تنسيق المحتوى...'
},
{
pct
:
80
,
label
:
'ضغط الملف...'
},
{
pct
:
88
,
label
:
'المراجعة النهائية...'
},
{
pct
:
94
,
label
:
'جاري الانتهاء...'
},
];
var
stepTimer
=
null
;
var
cookieTimer
=
null
;
function
startExport
()
{
document
.
getElementById
(
'beforeExport'
).
style
.
display
=
'none'
;
...
...
@@ -155,42 +161,47 @@ function startExport() {
progressStep
.
textContent
=
step
.
label
;
stepIndex
++
;
if
(
stepIndex
<
exportSteps
.
length
)
{
s
etTimeout
(
animateStep
,
8
000
);
s
tepTimer
=
setTimeout
(
animateStep
,
90
000
);
}
}
animateStep
();
fetch
(
'/tutorials/export-pdf'
)
.
then
(
function
(
response
)
{
if
(
!
response
.
ok
)
throw
new
Error
(
'HTTP '
+
response
.
status
);
return
response
.
blob
();
})
.
then
(
function
(
blob
)
{
// Use hidden iframe — browsers don't timeout iframe downloads
var
token
=
Date
.
now
().
toString
();
var
iframe
=
document
.
createElement
(
'iframe'
);
iframe
.
style
.
display
=
'none'
;
iframe
.
setAttribute
(
'id'
,
'exportFrame'
);
iframe
.
src
=
'/tutorials/export-pdf?dl='
+
token
;
document
.
body
.
appendChild
(
iframe
);
// Poll for download cookie (set by server when response is sent)
cookieTimer
=
setInterval
(
function
()
{
if
(
document
.
cookie
.
indexOf
(
'book_download='
+
token
)
!==
-
1
)
{
clearInterval
(
cookieTimer
);
clearTimeout
(
stepTimer
);
// Clear the cookie
document
.
cookie
=
'book_download=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT'
;
progressBar
.
style
.
width
=
'100%'
;
progressLabel
.
textContent
=
'100%'
;
progressStep
.
textContent
=
'اكتمل!'
;
var
filename
=
'Book-of-the-ERP.pdf'
;
if
(
blob
.
type
&&
blob
.
type
.
indexOf
(
'html'
)
!==
-
1
)
{
filename
=
'Book-of-the-ERP.html'
;
}
var
url
=
window
.
URL
.
createObjectURL
(
blob
);
var
a
=
document
.
createElement
(
'a'
);
a
.
href
=
url
;
a
.
download
=
filename
;
document
.
body
.
appendChild
(
a
);
a
.
click
();
setTimeout
(
function
()
{
window
.
URL
.
revokeObjectURL
(
url
);
document
.
body
.
removeChild
(
a
);
},
100
);
setTimeout
(
function
()
{
finishExport
(
true
);
},
600
);
})
.
catch
(
function
(
err
)
{
document
.
getElementById
(
'errorMessage'
).
textContent
=
'فشل التصدير: '
+
err
.
message
;
progressStep
.
textContent
=
'اكتمل! تم التحميل ✓'
;
setTimeout
(
function
()
{
finishExport
(
true
);
},
1500
);
// Clean up iframe
var
f
=
document
.
getElementById
(
'exportFrame'
);
if
(
f
)
setTimeout
(
function
()
{
f
.
remove
();
},
5000
);
}
},
2000
);
// Safety timeout: 25 minutes max
setTimeout
(
function
()
{
if
(
document
.
getElementById
(
'duringExport'
).
style
.
display
!==
'none'
)
{
clearInterval
(
cookieTimer
);
clearTimeout
(
stepTimer
);
document
.
getElementById
(
'errorMessage'
).
textContent
=
'انتهت المهلة. قد يكون الملف قد تم تحميله — تحقق من مجلد التنزيلات.'
;
finishExport
(
false
);
});
var
f
=
document
.
getElementById
(
'exportFrame'
);
if
(
f
)
f
.
remove
();
}
},
1500000
);
}
function
finishExport
(
success
)
{
...
...
@@ -208,6 +219,8 @@ function resetExport() {
document
.
getElementById
(
'afterExport'
).
style
.
display
=
'none'
;
document
.
getElementById
(
'errorExport'
).
style
.
display
=
'none'
;
document
.
getElementById
(
'progressBar'
).
style
.
width
=
'0%'
;
clearInterval
(
cookieTimer
);
clearTimeout
(
stepTimer
);
}
document
.
addEventListener
(
'DOMContentLoaded'
,
function
()
{
...
...
docker/000-default.conf
View file @
055dd94f
...
...
@@ -3,7 +3,7 @@
DocumentRoot
/
var
/
www
/
html
/
public
# Allow long-running requests (PDF generation)
TimeOut
48
0
TimeOut
180
0
<
Directory
/
var
/
www
/
html
/
public
>
Options
-
Indexes
+
FollowSymLinks
...
...
docker/php.ini
View file @
055dd94f
...
...
@@ -3,7 +3,7 @@
upload_max_filesize
=
20M
post_max_size
=
25M
memory_limit
=
1024M
max_execution_time
=
48
0
max_execution_time
=
180
0
max_input_time
=
240
max_input_vars
=
5000
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment