Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
moodle-mod_pdfannotator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elc
moodle-mod_pdfannotator
Commits
fef0f3a2
Commit
fef0f3a2
authored
2 years ago
by
anisa kusumadewi
Browse files
Options
Downloads
Patches
Plain Diff
wip:
fix comments download
parent
23a8b970
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
locallib.php
+35
-18
35 additions, 18 deletions
locallib.php
version.php
+1
-1
1 addition, 1 deletion
version.php
with
36 additions
and
19 deletions
locallib.php
+
35
−
18
View file @
fef0f3a2
...
...
@@ -64,7 +64,7 @@ function pdfannotator_display_embed($pdfannotator, $cm, $course, $file, $page =
// Load and execute the javascript files.
$PAGE
->
requires
->
js
(
new
moodle_url
(
"/mod/pdfannotator/shared/pdf.js?ver=00002"
));
$PAGE
->
requires
->
js
(
new
moodle_url
(
"/mod/pdfannotator/shared/textclipper.js"
));
$PAGE
->
requires
->
js
(
new
moodle_url
(
"/mod/pdfannotator/shared/index.js?ver=000
29
"
));
$PAGE
->
requires
->
js
(
new
moodle_url
(
"/mod/pdfannotator/shared/index.js?ver=000
30
"
));
$PAGE
->
requires
->
js
(
new
moodle_url
(
"/mod/pdfannotator/shared/locallib.js?ver=00005"
));
// Pass parameters from PHP to JavaScript.
...
...
@@ -167,6 +167,25 @@ function pdfannotator_extract_images($contentarr, $itemid, $context=null) {
}
function
pdfannotator_split_content_image
(
$content
,
$res
,
$itemid
,
$context
=
null
)
{
// Gets all files in the comment with id itemid.
$fs
=
get_file_storage
();
$files
=
$fs
->
get_area_files
(
$context
->
id
,
'mod_pdfannotator'
,
'post'
,
$itemid
);
$fileinfo
=
[];
foreach
(
$files
as
$file
)
{
if
(
$file
->
is_directory
()
and
$file
->
get_filepath
()
===
'/'
)
{
continue
;
}
$info
=
[];
$info
[
'fileid'
]
=
$file
->
get_id
();
$info
[
'filename'
]
=
$file
->
get_filename
();
$info
[
'filepath'
]
=
$file
->
get_filepath
();
$info
[
'filecontent'
]
=
$file
->
get_content
();
$info
[
'filesize'
]
=
$file
->
get_filesize
();
$info
[
'filemimetype'
]
=
$file
->
get_mimetype
();
$fileinfo
[]
=
$info
;
}
$imgmatch
=
[];
$firststr
=
''
;
$data
=
[];
...
...
@@ -190,26 +209,23 @@ function pdfannotator_split_content_image($content, $res, $itemid, $context=null
$format
[
0
]
=
'jpeg'
;
}
$data
[
'format'
]
=
strtoupper
(
$format
[
0
]);
$fs
=
get_file_storage
();
$files
=
$fs
->
get_area_files
(
$context
->
id
,
'mod_pdfannotator'
,
'post'
,
$itemid
);
$fileinfo
=
[];
foreach
(
$files
as
$file
)
{
if
(
$file
->
is_directory
()
and
$file
->
get_filepath
()
===
'/'
)
{
continue
;
$tempinfo
=
[];
foreach
(
$fileinfo
as
$file
)
{
$count
=
substr_count
(
$imgstr
,
$file
[
'filename'
]);
if
(
$count
)
{
$tempinfo
=
$file
;
break
;
}
//$fileinfo['fileid'] = $file->file_record['id'];
$fileinfo
[
'filename'
]
=
$file
->
get_filename
();
$fileinfo
[
'filepath'
]
=
$file
->
get_filepath
();
$fileinfo
[
'filecontent'
]
=
$file
->
get_content
();
$fileinfo
[
'filesize'
]
=
$file
->
get_filesize
();
}
//$imagedata = file_get_contents($fileinfo['filecontent']);
$imagedata
=
'data:
image/'
.
strtolower
(
$data
[
'format
'
]
)
.
';base64,'
.
base64_encode
(
$
file
info
[
'filecontent'
]);
$imagedata
=
'data:
'
.
$tempinfo
[
'filemimetype
'
]
.
';base64,'
.
base64_encode
(
$
temp
info
[
'filecontent'
]);
$data
[
'image'
]
=
$imagedata
;
$data
[
'format'
]
=
$tempinfo
[
'filemimetype'
];
$data
[
'fileid'
]
=
$tempinfo
[
'fileid'
];
$data
[
'filename'
]
=
$tempinfo
[
'filename'
];
$data
[
'filepath'
]
=
$tempinfo
[
'filepath'
];
$data
[
'filesize'
]
=
$tempinfo
[
'filesize'
];
//$data['image'] = $url[0];
preg_match
(
'/height=[0-9]+/'
,
$imgstr
,
$height
);
$data
[
'imageheight'
]
=
str_replace
(
"
\"
"
,
""
,
explode
(
'='
,
$height
[
0
])[
1
]);
preg_match
(
'/width=[0-9]+/'
,
$imgstr
,
$width
);
...
...
@@ -220,6 +236,7 @@ function pdfannotator_split_content_image($content, $res, $itemid, $context=null
$content
=
$laststr
;
}
$res
[]
=
$content
;
return
$res
;
}
...
...
This diff is collapsed.
Click to expand it.
version.php
+
1
−
1
View file @
fef0f3a2
...
...
@@ -25,7 +25,7 @@
defined
(
'MOODLE_INTERNAL'
)
||
die
();
$plugin
->
component
=
'mod_pdfannotator'
;
$plugin
->
version
=
202210260
0
;
$plugin
->
version
=
202210260
1
;
$plugin
->
release
=
'PDF Annotator v1.4 release 11'
;
$plugin
->
requires
=
2021051700
;
$plugin
->
maturity
=
MATURITY_STABLE
;
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment