Gitlab CSE Unil
Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
M. Chardon
moodle-assignfeedback_editpdfplus
Commits
ae833d60
Commit
ae833d60
authored
Sep 13, 2019
by
M. Chardon
Browse files
correction bug annotation frame publication perte lien
parent
95c08e27
Changes
2
Hide whitespace changes
Inline
Side-by-side
classes/bdd/annotation.php
View file @
ae833d60
...
...
@@ -141,7 +141,7 @@ class annotation {
$this
->
displaylock
=
$annotationRef
->
displaylock
;
$this
->
displayrotation
=
$annotationRef
->
displayrotation
;
$this
->
borderstyle
=
$annotationRef
->
borderstyle
;
$this
->
parent_annot
=
$annotationRef
->
parent_annot
;
//
$this->parent_annot = $annotationRef->parent_annot;
$this
->
answerrequested
=
$annotationRef
->
answerrequested
;
$this
->
pdfdisplay
=
$annotationRef
->
pdfdisplay
;
}
...
...
classes/page_editor.php
View file @
ae833d60
...
...
@@ -395,9 +395,17 @@ class page_editor {
// Copy all the draft annotations to non-drafts.
$records
=
$DB
->
get_records
(
self
::
BDDTABLEANNOTATION
,
array
(
self
::
GRADEID
=>
$gradeid
,
self
::
DRAFLIB
=>
1
));
foreach
(
$records
as
$record
)
{
$newid
=
self
::
create_annotation_for_release
(
$record
,
$parentlink
);
$oldid
=
$record
->
id
;
$newid
=
self
::
create_annotation_for_release
(
$record
);
$parentlink
[
$oldid
]
=
$newid
;
}
$newAnnotationsRelease
=
$DB
->
get_records
(
self
::
BDDTABLEANNOTATION
,
array
(
self
::
GRADEID
=>
$gradeid
,
self
::
DRAFLIB
=>
0
));
foreach
(
$newAnnotationsRelease
as
$annotation
)
{
if
(
$annotation
->
parent_annot
>
0
&&
$parentlink
[
$annotation
->
parent_annot
])
{
$annotation
->
parent_annot
=
$parentlink
[
$annotation
->
parent_annot
];
$DB
->
update_record
(
self
::
BDDTABLEANNOTATION
,
$annotation
);
}
}
}
else
{
$records
=
$DB
->
get_records
(
self
::
BDDTABLEANNOTATION
,
array
(
self
::
GRADEID
=>
$gradeid
,
self
::
DRAFLIB
=>
1
));
$draftid
=
[];
...
...
@@ -425,9 +433,19 @@ class page_editor {
continue
;
}
//need to be created
$oldid
=
$record
->
id
;
$newid
=
self
::
create_annotation_for_release
(
$record
,
$parentlink
);
$parentlink
[
$oldid
]
=
$newid
;
}
//maj parent ling
$newAnnotationsRelease
=
$DB
->
get_records
(
self
::
BDDTABLEANNOTATION
,
array
(
self
::
GRADEID
=>
$gradeid
,
self
::
DRAFLIB
=>
0
));
foreach
(
$newAnnotationsRelease
as
$annotation
)
{
if
(
!
$annotation
->
parent_annot
||
$annotation
->
parent_annot
<
0
||
in_array
(
$annotation
->
draft_id
,
$draftid
)
||
!
$parentlink
[
$annotation
->
parent_annot
])
{
continue
;
}
$annotation
->
parent_annot
=
$parentlink
[
$annotation
->
parent_annot
];
$DB
->
update_record
(
self
::
BDDTABLEANNOTATION
,
$annotation
);
}
}
return
true
;
...
...
@@ -439,14 +457,14 @@ class page_editor {
* @param array $parentlink array with parent's annotation's id
* @return int new annotation id
*/
private
static
function
create_annotation_for_release
(
$annotationRecord
,
$parentlink
)
{
private
static
function
create_annotation_for_release
(
$annotationRecord
)
{
$oldid
=
$annotationRecord
->
id
;
unset
(
$annotationRecord
->
id
);
$annotationRecord
->
draft
=
0
;
$annotationRecord
->
draft_id
=
$oldid
;
if
(
$annotationRecord
->
parent_annot
>
0
)
{
$annotationRecord
->
parent_annot
=
$parentlink
[
$annotationRecord
->
parent_annot
];
}
/*
if ($annotationRecord->parent_annot > 0) {
$annotationRecord->parent_annot = $parentlink[$annotationRecord->parent_annot];
} */
// Force these.
if
(
!
(
$annotationRecord
instanceof
annotation
))
{
$annotation
=
new
annotation
(
$annotationRecord
);
...
...
Write
Preview
Supports
Markdown
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