mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
MDL-14679 converted some course related code
This commit is contained in:
parent
579d45b434
commit
e4907498da
3 changed files with 19 additions and 17 deletions
|
@ -8,16 +8,18 @@
|
|||
$id = optional_param('id', false, PARAM_INT); // Course id
|
||||
$name = optional_param('name', false, PARAM_RAW); // Course short name
|
||||
|
||||
$name = stripslashes($name); // TODO: remove soon
|
||||
|
||||
if (!$id and !$name) {
|
||||
print_error("unspecifycourseid");
|
||||
}
|
||||
|
||||
if ($name) {
|
||||
if (! $course = get_record("course", "shortname", $name) ) {
|
||||
if (!$course = $DB->get_record("course", array("shortname"=>$name))) {
|
||||
print_error("invalidshortname");
|
||||
}
|
||||
} else {
|
||||
if (! $course = get_record("course", "id", $id) ) {
|
||||
if (!$course = get_record("course", array("id"=>$id))) {
|
||||
print_error("invalidcourseid");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue