Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
LabNbook
LabNbook-Moodle
Commits
d34a6717
Verified
Commit
d34a6717
authored
Jan 05, 2021
by
David Beniamine
Browse files
Fix incoherent field name in DB
parent
0ad134f3
Changes
6
Hide whitespace changes
Inline
Side-by-side
classes/ar/labnbook.php
View file @
d34a6717
...
...
@@ -15,7 +15,7 @@ namespace mod_labnbook\ar;
class
labnbook
{
public
$id
;
public
$course
id
;
public
$course
;
public
$name
;
public
$intro
;
public
$introformat
;
...
...
classes/local/helper.php
View file @
d34a6717
...
...
@@ -60,7 +60,7 @@ class helper
if
(
!
fetch\user
::
isAuthenticated
())
{
return
;
}
$ids
=
$DB
->
get_fieldset_select
(
"labnbook"
,
"labnbook_teamconfigid"
,
"course
id
= "
.
(
int
)
$courseId
);
$ids
=
$DB
->
get_fieldset_select
(
"labnbook"
,
"labnbook_teamconfigid"
,
"course = "
.
(
int
)
$courseId
);
if
(
$ids
)
{
$userFetcher
=
new
fetch\user
();
$userFetcher
->
grantMissionsAccess
(
$ids
);
...
...
db/install.xml
View file @
d34a6717
...
...
@@ -7,7 +7,7 @@
<TABLE
NAME=
"labnbook"
COMMENT=
"Activity instance (mandatory name of this table)"
>
<FIELDS>
<FIELD
NAME=
"id"
TYPE=
"int"
LENGTH=
"10"
NOTNULL=
"true"
SEQUENCE=
"true"
COMMENT=
"referenced from course_modules.instance"
/>
<FIELD
NAME=
"course
id
"
TYPE=
"int"
LENGTH=
"10"
NOTNULL=
"true"
DEFAULT=
"0"
SEQUENCE=
"false"
/>
<FIELD
NAME=
"course"
TYPE=
"int"
LENGTH=
"10"
NOTNULL=
"true"
DEFAULT=
"0"
SEQUENCE=
"false"
/>
<FIELD
NAME=
"name"
TYPE=
"char"
LENGTH=
"255"
NOTNULL=
"false"
SEQUENCE=
"false"
/>
<FIELD
NAME=
"intro"
TYPE=
"text"
NOTNULL=
"false"
SEQUENCE=
"false"
/>
<FIELD
NAME=
"introformat"
TYPE=
"int"
LENGTH=
"4"
NOTNULL=
"true"
DEFAULT=
"0"
SEQUENCE=
"false"
/>
...
...
@@ -18,7 +18,7 @@
</FIELDS>
<KEYS>
<KEY
NAME=
"primary"
TYPE=
"primary"
FIELDS=
"id"
/>
<KEY
NAME=
"course
id
"
TYPE=
"foreign"
FIELDS=
"course
id
"
REFTABLE=
"course"
REFFIELDS=
"id"
/>
<KEY
NAME=
"course"
TYPE=
"foreign"
FIELDS=
"course"
REFTABLE=
"course"
REFFIELDS=
"id"
/>
</KEYS>
</TABLE>
</TABLES>
...
...
db/upgrade.php
View file @
d34a6717
...
...
@@ -17,14 +17,20 @@
*/
function
xmldb_labnbook_upgrade
(
$oldversion
)
{
/*
global
$DB
;
$dbman
=
$DB
->
get_manager
();
if
(
$oldversion
<
2021010500
)
{
// Rename field course on table labnbook to NEWNAMEGOESHERE.
$table
=
new
xmldb_table
(
'labnbook'
);
$field
=
new
xmldb_field
(
'courseid'
,
XMLDB_TYPE_INTEGER
,
'10'
,
null
,
XMLDB_NOTNULL
,
null
,
'0'
,
'id'
);
// Launch rename field course.
$dbman
->
rename_field
(
$table
,
$field
,
'course'
);
}
// For further information please read the Upgrade API documentation:
// https://docs.moodle.org/dev/Upgrade_API
*/
return
true
;
}
lib.php
View file @
d34a6717
...
...
@@ -82,8 +82,6 @@ function labnbook_add_instance($moduleinstance, $mform = null)
}
$moduleinstance
->
timecreated
=
\
time
();
// On database field name is courseid not course
$moduleinstance
->
courseid
=
(
int
)
$moduleinstance
->
course
;
$id
=
$DB
->
insert_record
(
LABNBOOK_TABLE
,
$moduleinstance
);
return
$id
;
...
...
version.php
View file @
d34a6717
...
...
@@ -9,8 +9,8 @@
\
defined
(
'MOODLE_INTERNAL'
)
||
die
();
$plugin
->
component
=
'mod_labnbook'
;
$plugin
->
release
=
'0.1.
5
'
;
$plugin
->
version
=
202010
14
00
;
$plugin
->
release
=
'0.1.
6
'
;
$plugin
->
version
=
202
1
010
5
00
;
$plugin
->
requires
=
2019052000
;
$plugin
->
maturity
=
MATURITY_RC
;
$plugin
->
supported
=
[
37
,
39
];
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