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
e80d57a6
Commit
e80d57a6
authored
Jun 19, 2019
by
M. Chardon
Browse files
correct moodle analyse issues
parent
494ac893
Changes
9
Hide whitespace changes
Inline
Side-by-side
classes/bdd/axis.php
View file @
e80d57a6
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
...
...
@@ -31,7 +30,7 @@ namespace assignfeedback_editpdfplus\bdd;
* @author kury
*/
class
axis
{
/** @var int unique id for this annotation */
public
$id
=
0
;
...
...
@@ -41,7 +40,7 @@ class axis {
/** @var int axis for this annotation */
public
$label
=
''
;
/** @var int order in toolbar */
/** @var int order in toolbar */
public
$order_axis
=
1000
;
/**
...
...
@@ -62,5 +61,5 @@ class axis {
}
}
}
}
classes/bdd/comment.php
deleted
100644 → 0
View file @
494ac893
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* This file contains the comment class for the assignfeedback_editpdfplus plugin
*
* @package assignfeedback_editpdfplus
* @copyright 2016 Université de Lausanne
* The code is based on mod/assign/feedback/editpdf/classes/comment.php by Davo Smith.
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @deprecated since version 2017051600
*/
namespace
assignfeedback_editpdfplus\bdd
;
/**
* @deprecated since version 2016101700
*/
class
comment
{
/** @var int unique id for this annotation */
public
$id
=
0
;
/** @var int gradeid for this annotation */
public
$gradeid
=
0
;
/** @var int page number for this annotation */
public
$pageno
=
0
;
/** @var int starting location in pixels. Image resolution is 100 pixels per inch */
public
$x
=
0
;
/** @var int starting location in pixels. Image resolution is 100 pixels per inch */
public
$y
=
0
;
/** @var int width of the comment box */
public
$width
=
120
;
/** @var string The comment text. */
public
$rawtext
=
''
;
/** @var string colour - One of red, yellow, green, blue, white */
public
$colour
=
'yellow'
;
/**
* Convert a compatible stdClass into an instance of a comment.
* @param \stdClass $record
*/
public
function
__construct
(
\
stdClass
$record
=
null
)
{
if
(
$record
)
{
$intcols
=
array
(
'width'
,
'x'
,
'y'
);
foreach
(
$this
as
$key
=>
$value
)
{
if
(
isset
(
$record
->
$key
))
{
if
(
in_array
(
$key
,
$intcols
))
{
$this
->
$key
=
intval
(
$record
->
$key
);
}
else
{
$this
->
$key
=
$record
->
$key
;
}
}
}
}
}
}
classes/bdd/tool.php
View file @
e80d57a6
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
...
...
@@ -121,7 +120,7 @@ class tool {
* Get text proposals and transform it into an array
* @return \assignfeedback_editpdfplus\stdClass
*/
public
function
init
T
ool
T
exts
A
rray
()
{
public
function
init
_t
ool
_t
exts
_a
rray
()
{
if
(
!
$this
->
texts
)
{
$this
->
textsarray
=
null
;
}
else
{
...
...
@@ -152,16 +151,16 @@ class tool {
/**
* Set Style and replace label with format symbol for display purpose
*/
public
function
set
D
esign
()
{
$this
->
label
=
$this
->
get
B
utton
L
abel
();
$this
->
style
=
$this
->
get
S
tyle
B
utton
();
public
function
set
_d
esign
()
{
$this
->
label
=
$this
->
get
_b
utton
_l
abel
();
$this
->
style
=
$this
->
get
_s
tyle
_b
utton
();
}
/**
* Calculate a label with format symbol, according to its type
* @return string
*/
private
function
get
B
utton
L
abel
()
{
private
function
get
_b
utton
_l
abel
()
{
if
(
$this
->
type
==
"4"
)
{
return
'| '
.
$this
->
label
.
' |'
;
}
...
...
@@ -175,15 +174,15 @@ class tool {
* Calculate a sytle for a display in a button, according to its type
* @return string
*/
private
function
get
S
tyle
B
utton
()
{
$style
T
mp
=
""
;
private
function
get
_s
tyle
_b
utton
()
{
$style
_t
mp
=
""
;
if
(
$this
->
enabled
==
"0"
)
{
$style
T
mp
.
=
"background-image:none;background-color:#CCCCCC;"
;
$style
_t
mp
.
=
"background-image:none;background-color:#CCCCCC;"
;
}
if
(
$this
->
type
==
"4"
||
$this
->
type
==
"1"
)
{
$style
T
mp
.
=
"text-decoration: underline;"
;
$style
_t
mp
.
=
"text-decoration: underline;"
;
}
return
$style
T
mp
;
return
$style
_t
mp
;
}
/**
...
...
@@ -191,8 +190,8 @@ class tool {
* @param bool $disabled if the button must be disabled
* @return array
*/
public
function
get
R
enderer
B
outon
HTMLD
isplay
(
$disabled
=
false
)
{
$iconhtml
=
$this
->
get
B
utton
L
abel
();
public
function
get
_r
enderer
_b
outon
_html_d
isplay
(
$disabled
=
false
)
{
$iconhtml
=
$this
->
get
_b
utton
_l
abel
();
$tooltiptext
=
get_string
(
'typetool_'
.
$this
->
typeObject
->
label
,
'assignfeedback_editpdfplus'
);
$iconhtml
.
=
"<span class='assignfeedback_editpdfplus_tooltiptext'>"
.
$tooltiptext
.
"</span>"
;
if
(
!
$this
->
typeObject
)
{
...
...
@@ -206,7 +205,7 @@ class tool {
'class'
=>
$this
->
typeObject
->
label
.
' costumtoolbarbutton btn btn-light'
,
'id'
=>
'ctbutton'
.
$this
->
id
,
'type'
=>
'button'
,
'style'
=>
$this
->
get
S
tyle
B
utton
());
'style'
=>
$this
->
get
_s
tyle
_b
utton
());
if
(
$disabled
)
{
$iconparams
[
'disabled'
]
=
'true'
;
}
...
...
classes/bdd/tool_generic.php
View file @
e80d57a6
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
...
...
@@ -51,7 +50,7 @@ class tool_generic extends tool {
* @param bool $disabled if the button must be disabled
* @return array
*/
public
function
get
R
enderer
B
outon
HTMLD
isplay
(
$disabled
=
false
)
{
public
function
get
_r
enderer
_b
outon
_html_d
isplay
(
$disabled
=
false
)
{
$iconhtml
=
\
html_writer
::
tag
(
"i"
,
""
,
array
(
'class'
=>
self
::
DISPLAY_CLASS_BUTTON
[
$this
->
label
],
'aria-hidden'
=>
'true'
));
$iconparams
=
array
(
'data-tool'
=>
$this
->
label
,
...
...
classes/bdd/type_tool.php
View file @
e80d57a6
...
...
@@ -94,7 +94,7 @@ class type_tool {
* Init color of the type tool, and control the value before affected it (null, size...)
* @param string $color
*/
public
function
set
C
olor
(
$color
)
{
public
function
set
_c
olor
(
$color
)
{
if
(
isset
(
$color
)
&&
strlen
(
$color
)
>
4
)
{
$this
->
color
=
$color
;
}
...
...
@@ -102,31 +102,31 @@ class type_tool {
/**
* Init cartridge color of the type tool, and control the value before affected it (null, size...)
* @param string $cartridge
_
color
* @param string $cartridgecolor
*/
public
function
set
C
artridge
C
olor
(
$cartridge
_
color
)
{
if
(
isset
(
$cartridge
_
color
)
&&
strlen
(
$cartridge
_
color
)
>
4
)
{
$this
->
cartridge_color
=
$cartridge
_
color
;
public
function
set
_c
artridge
_c
olor
(
$cartridgecolor
)
{
if
(
isset
(
$cartridgecolor
)
&&
strlen
(
$cartridgecolor
)
>
4
)
{
$this
->
cartridge_color
=
$cartridgecolor
;
}
}
/**
* Init the cartridge X position of the type tool, and control the value before affected it (null, intval...)
* @param string $cartridge
_
x
* @param string $cartridgex
*/
public
function
set
C
artridge
X
(
$cartridge
_
x
)
{
if
(
isset
(
$cartridge
_
x
)
&&
intval
(
$cartridge
_
x
))
{
$this
->
cartridge_x
=
intval
(
$cartridge
_
x
);
public
function
set
_c
artridge
_x
(
$cartridgex
)
{
if
(
isset
(
$cartridgex
)
&&
intval
(
$cartridgex
))
{
$this
->
cartridge_x
=
intval
(
$cartridgex
);
}
}
/**
* Init the cartridge Y position of the type tool, and control the value before affected it (null, intval...)
* @param string $cartridge
_
y
* @param string $cartridgey
*/
public
function
set
C
artridge
Y
(
$cartridge
_
y
)
{
if
(
isset
(
$cartridge
_
y
)
&&
intval
(
$cartridge
_
y
))
{
$this
->
cartridge_y
=
intval
(
$cartridge
_
y
);
public
function
set
_c
artridge
_y
(
$cartridgey
)
{
if
(
isset
(
$cartridgey
)
&&
intval
(
$cartridgey
))
{
$this
->
cartridge_y
=
intval
(
$cartridgey
);
}
}
...
...
classes/page_editor.php
View file @
e80d57a6
...
...
@@ -521,38 +521,38 @@ class page_editor {
global
$CFG
;
switch
(
$newToolType
->
label
)
{
case
'highlightplus'
:
$newToolType
->
set
C
olor
(
$CFG
->
highlightplus_color
);
$newToolType
->
set
C
artridge
C
olor
(
$CFG
->
highlightplus_cartridge_color
);
$newToolType
->
set
C
artridge
X
(
$CFG
->
highlightplus_cartridge_x
);
$newToolType
->
set
C
artridge
Y
(
$CFG
->
highlightplus_cartridge_y
);
$newToolType
->
set
_c
olor
(
$CFG
->
highlightplus_color
);
$newToolType
->
set
_c
artridge
_c
olor
(
$CFG
->
highlightplus_cartridge_color
);
$newToolType
->
set
_c
artridge
_x
(
$CFG
->
highlightplus_cartridge_x
);
$newToolType
->
set
_c
artridge
_y
(
$CFG
->
highlightplus_cartridge_y
);
break
;
case
'stampplus'
:
$newToolType
->
set
C
olor
(
$CFG
->
stampplus_color
);
$newToolType
->
set
_c
olor
(
$CFG
->
stampplus_color
);
break
;
case
'frame'
:
$newToolType
->
set
C
artridge
X
(
$CFG
->
frame_cartridge_x
);
$newToolType
->
set
C
artridge
Y
(
$CFG
->
frame_cartridge_y
);
$newToolType
->
set
_c
artridge
_x
(
$CFG
->
frame_cartridge_x
);
$newToolType
->
set
_c
artridge
_y
(
$CFG
->
frame_cartridge_y
);
break
;
case
'verticalline'
:
$newToolType
->
set
C
olor
(
$CFG
->
verticalline_color
);
$newToolType
->
set
C
artridge
C
olor
(
$CFG
->
verticalline_cartridge_color
);
$newToolType
->
set
C
artridge
X
(
$CFG
->
verticalline_cartridge_x
);
$newToolType
->
set
C
artridge
Y
(
$CFG
->
verticalline_cartridge_y
);
$newToolType
->
set
_c
olor
(
$CFG
->
verticalline_color
);
$newToolType
->
set
_c
artridge
_c
olor
(
$CFG
->
verticalline_cartridge_color
);
$newToolType
->
set
_c
artridge
_x
(
$CFG
->
verticalline_cartridge_x
);
$newToolType
->
set
_c
artridge
_y
(
$CFG
->
verticalline_cartridge_y
);
break
;
case
'stampcomment'
:
$newToolType
->
set
C
artridge
C
olor
(
$CFG
->
stampcomment_cartridge_color
);
$newToolType
->
set
C
artridge
X
(
$CFG
->
stampcomment_cartridge_x
);
$newToolType
->
set
C
artridge
Y
(
$CFG
->
stampcomment_cartridge_y
);
$newToolType
->
set
_c
artridge
_c
olor
(
$CFG
->
stampcomment_cartridge_color
);
$newToolType
->
set
_c
artridge
_x
(
$CFG
->
stampcomment_cartridge_x
);
$newToolType
->
set
_c
artridge
_y
(
$CFG
->
stampcomment_cartridge_y
);
break
;
case
'commentplus'
:
$newToolType
->
set
C
artridge
C
olor
(
$CFG
->
commentplus_cartridge_color
);
$newToolType
->
set
C
artridge
X
(
$CFG
->
commentplus_cartridge_x
);
$newToolType
->
set
C
artridge
Y
(
$CFG
->
commentplus_cartridge_y
);
$newToolType
->
set
_c
artridge
_c
olor
(
$CFG
->
commentplus_cartridge_color
);
$newToolType
->
set
_c
artridge
_x
(
$CFG
->
commentplus_cartridge_x
);
$newToolType
->
set
_c
artridge
_y
(
$CFG
->
commentplus_cartridge_y
);
break
;
default
:
...
...
classes/renderer.php
View file @
e80d57a6
...
...
@@ -49,7 +49,7 @@ class assignfeedback_editpdfplus_renderer extends plugin_renderer_base {
* @return string
*/
private
function
render_toolbar_button_tool
(
assignfeedback_editpdfplus
\
bdd\tool
$fulltool
,
$disabled
=
false
)
{
$displayArray
=
$fulltool
->
get
R
enderer
B
outon
HTMLD
isplay
(
$disabled
);
$displayArray
=
$fulltool
->
get
_r
enderer
_b
outon
_html_d
isplay
(
$disabled
);
return
$this
->
render_toolbar_button_html
(
$displayArray
[
"content"
],
$displayArray
[
"parameters"
]);
}
...
...
externallib.php
View file @
e80d57a6
...
...
@@ -478,7 +478,7 @@ class assignfeedback_editpdfplus_external extends external_api {
$toolsNew
=
admin_editor
::
get_tools_by_axis
(
$axeNew
);
if
(
sizeof
(
$toolsNew
)
>
0
)
{
foreach
(
$toolsNew
as
$tool
)
{
$tool
->
set
D
esign
();
$tool
->
set
_d
esign
();
$res
[]
=
array
(
'modelid'
=>
$model
,
self
::
AXEID
=>
$axeNew
,
self
::
AXELIB
=>
$validateddata
->
label
,
self
::
MESSAGELIB
=>
""
,
self
::
ENABLETOOL
=>
$tool
->
enabled
,
self
::
TOOLID
=>
$tool
->
id
,
self
::
TOOLTYPE
=>
$tool
->
type
,
self
::
BOUTONLIBTOOL
=>
$tool
->
label
,
'style'
=>
$tool
->
style
);
}
}
else
{
...
...
locallib_admin.php
View file @
e80d57a6
...
...
@@ -185,7 +185,7 @@ class assign_feedback_editpdfplus_admin {
}
else
{
$tool
->
init
(
array
(
"contextid"
=>
$this
->
context
->
id
,
"axisid"
=>
$axisid
));
}
$tool
->
init
T
ool
T
exts
A
rray
();
$tool
->
init
_t
ool
_t
exts
_a
rray
();
$data
->
tool
=
$tool
;
$data
->
tools
=
admin_editor
::
get_typetools
();
foreach
(
$data
->
tools
as
$toolRef
)
{
...
...
@@ -224,7 +224,7 @@ class assign_feedback_editpdfplus_admin {
}
$tooltmp
=
page_editor
::
get_tools_by_axis
(
$model
->
axis
);
foreach
(
$tooltmp
as
$tool
)
{
$tool
->
set
D
esign
();
$tool
->
set
_d
esign
();
}
$tmp
=
new
stdClass
();
$tmp
->
model
=
$model
;
...
...
@@ -260,7 +260,7 @@ class assign_feedback_editpdfplus_admin {
$nbannotation
=
admin_editor
::
getNbAnnotationsForTool
(
$tool
->
id
);
$ax
->
canbedelete
&=
$nbannotation
==
0
;
}
$tool
->
set
D
esign
();
$tool
->
set
_d
esign
();
$toolbar
->
tools
[]
=
$tool
;
$ax
->
children
++
;
}
...
...
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