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
caseine
moodle-mod_vpl
Commits
380d7c54
Commit
380d7c54
authored
Sep 09, 2020
by
Astor Bizard
Browse files
Fixed $CFG declaration error and some unused code warnings.
parent
e434eb7c
Changes
2
Hide whitespace changes
Inline
Side-by-side
vpl.class.php
View file @
380d7c54
...
...
@@ -142,7 +142,7 @@ class mod_vpl {
/**
* Internal var array of object to file group manager
*
* @var ar
a
ay of object of file group manager
* @var ar
r
ay of object of file group manager
*/
protected
$requiredfgm
;
...
...
@@ -162,7 +162,6 @@ class mod_vpl {
* optional module instance id
*/
public
function
__construct
(
$id
,
$a
=
null
)
{
global
$OUTPUT
;
global
$DB
;
if
(
$id
)
{
if
(
!
$this
->
cm
=
get_coursemodule_from_id
(
VPL
,
$id
))
{
...
...
@@ -437,7 +436,7 @@ class mod_vpl {
// Sort comments by number of occurrences.
krsort
(
$all
);
$html
=
''
;
foreach
(
$all
as
$count
=>
$info
)
{
foreach
(
$all
as
$info
)
{
$html
.
=
$info
;
}
// TODO show info about others review with show hidde button.
...
...
@@ -536,7 +535,6 @@ class mod_vpl {
* @return void
*/
public
function
network_check
()
{
global
$OUTPUT
;
if
(
!
$this
->
pass_network_check
())
{
$str
=
get_string
(
'opnotallowfromclient'
,
VPL
)
.
' '
.
getremoteaddr
();
if
(
constant
(
'AJAX_SCRIPT'
)
)
{
...
...
@@ -1040,7 +1038,6 @@ class mod_vpl {
* @return bool
*/
public
function
is_group_activity
()
{
global
$CFG
;
if
(
!
isset
(
$this
->
group_activity
))
{
$cm
=
$this
->
get_course_module
();
$this
->
group_activity
=
$cm
->
groupingid
>
0
&&
$this
->
get_instance
()
->
worktype
==
1
;
...
...
@@ -1270,7 +1267,7 @@ class mod_vpl {
* @return Object or false
*/
public
function
get_grade_info
()
{
global
$DB
,
$CFG
,
$USER
;
global
$CFG
,
$USER
;
if
(
!
isset
(
$this
->
grade_info
))
{
$this
->
grade_info
=
false
;
if
(
$this
->
get_instance
()
->
grade
!=
0
)
{
// If 0 then NO GRADE.
...
...
@@ -1292,7 +1289,6 @@ class mod_vpl {
* @return boolean
*/
public
function
get_visiblegrade
()
{
global
$USER
;
if
(
$gi
=
$this
->
get_grade_info
())
{
if
(
is_array
(
$gi
->
grades
))
{
$usergi
=
reset
(
$gi
->
grades
);
...
...
@@ -1384,7 +1380,7 @@ class mod_vpl {
* @param $info string title and last nav option
*/
public
function
print_header
(
$info
=
''
)
{
global
$COURSE
,
$PAGE
,
$OUTPUT
;
global
$PAGE
,
$OUTPUT
;
if
(
self
::
$headerisout
)
{
return
;
}
...
...
@@ -1441,7 +1437,7 @@ class mod_vpl {
*/
public
function
print_view_tabs
(
$path
)
{
// TODO refactor using functions.
global
$USER
,
$DB
,
$OUTPUT
,
$PAGE
;
global
$USER
,
$DB
,
$PAGE
;
$active
=
basename
(
$path
);
$cmid
=
$this
->
cm
->
id
;
$userid
=
optional_param
(
'userid'
,
null
,
PARAM_INT
);
...
...
@@ -1527,11 +1523,7 @@ class mod_vpl {
case
'submissionview.php'
:
case
'gradesubmission.php'
:
case
'previoussubmissionslist.php'
:
require_once
(
'vpl_submission.class.php'
);
$subinstance
=
$this
->
last_user_submission
(
$userid
);
if
(
$subinstance
!==
false
)
{
$submission
=
new
mod_vpl_submission
(
$this
,
$subinstance
);
}
if
(
$viewer
&&
!
$level2
)
{
$tabs
[]
=
$viewtab
;
}
...
...
@@ -1544,9 +1536,6 @@ class mod_vpl {
if
(
$manager
||
(
$grader
&&
$USER
->
id
==
$userid
)
||
(
!
$grader
&&
$submiter
&&
$this
->
is_submit_able
()))
{
$href
=
vpl_mod_href
(
'forms/edit.php'
,
'id'
,
$cmid
,
'userid'
,
$userid
);
if
(
$example
&&
$this
->
instance
->
run
)
{
$stredit
=
get_string
(
'run'
,
VPL
);
}
$tabs
[]
=
vpl_create_tabobject
(
'edit.php'
,
$href
,
'edit'
);
}
if
(
!
$example
&&
$submiter
)
{
...
...
@@ -1561,7 +1550,6 @@ class mod_vpl {
$tabs
[]
=
vpl_create_tabobject
(
'gradesubmission.php'
,
$href
,
'grade'
,
'moodle'
);
}
if
(
$subinstance
/*&& ($grader || $similarity|| $this->instance->allowshowprevious)*/
)
{
$strlistprevoiussubmissions
=
get_string
(
'previoussubmissionslist'
,
VPL
);
$href
=
vpl_mod_href
(
'views/previoussubmissionslist.php'
,
'id'
,
$cmid
,
'userid'
,
$userid
);
$tabs
[]
=
vpl_create_tabobject
(
'previoussubmissionslist.php'
,
$href
,
'previoussubmissionslist'
);
}
...
...
@@ -1602,17 +1590,14 @@ class mod_vpl {
case
'listsimilarity.php'
:
if
(
$similarity
)
{
$href
=
vpl_mod_href
(
'similarity/similarity_form.php'
,
'id'
,
$cmid
);
$string
=
get_string
(
'similarity'
,
VPL
);
$tabs
[]
=
vpl_create_tabobject
(
'similarity_form.php'
,
$href
,
'similarity'
);
if
(
$active
==
'listsimilarity.php'
)
{
$string
=
get_string
(
'listsimilarity'
,
VPL
);
$tabs
[]
=
vpl_create_tabobject
(
'listsimilarity.php'
,
''
,
'listsimilarity'
);
}
$plugincfg
=
get_config
(
'mod_vpl'
);
$watermark
=
isset
(
$plugincfg
->
use_watermarks
)
&&
$plugincfg
->
use_watermarks
;
if
(
$watermark
)
{
$href
=
vpl_mod_href
(
'similarity/listwatermark.php'
,
'id'
,
$cmid
);
$string
=
get_string
(
'listwatermarks'
,
VPL
);
$tabs
[]
=
vpl_create_tabobject
(
'listwatermark.php'
,
$href
,
'listwatermarks'
);
}
}
...
...
@@ -1721,13 +1706,13 @@ class mod_vpl {
}
else
{
$this
->
print_restriction
(
'worktype'
,
$values
[
$worktype
]
);
}
$stryes
=
get_string
(
'yes'
);
$strno
=
get_string
(
'no'
);
if
(
$instance
->
example
)
{
$this
->
print_restriction
(
'isexample'
,
$stryes
);
}
$grader
=
$this
->
has_capability
(
VPL_GRADE_CAPABILITY
);
if
(
$grader
)
{
$stryes
=
get_string
(
'yes'
);
$strno
=
get_string
(
'no'
);
require_once
(
$CFG
->
libdir
.
'/gradelib.php'
);
if
(
$gie
=
$this
->
get_grade_info
())
{
if
(
$gie
->
scaleid
==
0
)
{
...
...
vpl_submission.class.php
View file @
380d7c54
...
...
@@ -37,6 +37,7 @@ defined('MOODLE_INTERNAL') || die();
require_once
(
dirname
(
__FILE__
)
.
'/vpl.class.php'
);
require_once
(
dirname
(
__FILE__
)
.
'/views/sh_factory.class.php'
);
require_once
(
dirname
(
__FILE__
)
.
'/views/show_hide_div.class.php'
);
global
$CFG
;
require_once
(
$CFG
->
dirroot
.
'/grade/grading/lib.php'
);
// Non static due to usort error.
...
...
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