mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 09:26:35 +02:00
Removed notices by introducing new function print_header_simple() which works on site as well as in courses without extra logic.
This commit is contained in:
parent
64c3e85374
commit
90fcc576ea
49 changed files with 1530 additions and 1709 deletions
|
@ -22,15 +22,12 @@
|
|||
|
||||
require_login($course->id);
|
||||
|
||||
if ($course->category) {
|
||||
$navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
|
||||
}
|
||||
$strworkshops = get_string("modulenameplural", "workshop");
|
||||
$strworkshop = get_string("modulename", "workshop");
|
||||
$strupload = get_string("upload");
|
||||
|
||||
print_header("$course->shortname: $workshop->name : $strupload", "$course->fullname",
|
||||
"$navigation <A HREF=index.php?id=$course->id>$strworkshops</A> ->
|
||||
print_header_simple("$workshop->name : $strupload", "",
|
||||
"<A HREF=index.php?id=$course->id>$strworkshops</A> ->
|
||||
<A HREF=\"view.php?a=$workshop->id\">$workshop->name</A> -> $strupload",
|
||||
"", "", true);
|
||||
/****
|
||||
|
@ -41,27 +38,27 @@
|
|||
}
|
||||
****/
|
||||
$timenow = time();
|
||||
if (!$title = $_POST['title']) {
|
||||
notify(get_string("notitlegiven", "workshop") );
|
||||
}
|
||||
else {
|
||||
if (is_uploaded_file($newfile['tmp_name']) and $newfile['size'] > 0) {
|
||||
if ($newfile['size'] > $workshop->maxbytes) {
|
||||
notify(get_string("uploadfiletoobig", "assignment", $workshop->maxbytes));
|
||||
}
|
||||
else {
|
||||
$newfile_name = clean_filename($newfile['name']);
|
||||
if ($newfile_name) {
|
||||
if (!$title = $_POST['title']) {
|
||||
notify(get_string("notitlegiven", "workshop") );
|
||||
}
|
||||
else {
|
||||
if (is_uploaded_file($newfile['tmp_name']) and $newfile['size'] > 0) {
|
||||
if ($newfile['size'] > $workshop->maxbytes) {
|
||||
notify(get_string("uploadfiletoobig", "assignment", $workshop->maxbytes));
|
||||
}
|
||||
else {
|
||||
$newfile_name = clean_filename($newfile['name']);
|
||||
if ($newfile_name) {
|
||||
// get the current set of submissions
|
||||
$submissions = workshop_get_user_submissions($workshop, $USER);
|
||||
// add new submission record
|
||||
$newsubmission->workshopid = $workshop->id;
|
||||
$newsubmission->userid = $USER->id;
|
||||
$newsubmission->title = $title;
|
||||
$newsubmission->timecreated = time();
|
||||
if (!$newsubmission->id = insert_record("workshop_submissions", $newsubmission)) {
|
||||
error("Workshop upload: Failure to create new submission record!");
|
||||
}
|
||||
$newsubmission->workshopid = $workshop->id;
|
||||
$newsubmission->userid = $USER->id;
|
||||
$newsubmission->title = $title;
|
||||
$newsubmission->timecreated = time();
|
||||
if (!$newsubmission->id = insert_record("workshop_submissions", $newsubmission)) {
|
||||
error("Workshop upload: Failure to create new submission record!");
|
||||
}
|
||||
// see if this is a resubmission by looking at the previous submissions...
|
||||
if ($submissions and ($workshop->phase >1)) { // ...but not teacher submissions
|
||||
// find the last submission
|
||||
|
@ -92,17 +89,17 @@
|
|||
add_to_log($course->id, "workshop", "resubmit", "view.php?id=$cm->id",
|
||||
"$workshop->id","$cm->id");
|
||||
}
|
||||
if (! $dir = workshop_file_area($workshop, $newsubmission)) {
|
||||
error("Sorry, an error in the system prevents you from uploading files: contact your teacher or system administrator");
|
||||
}
|
||||
if (move_uploaded_file($newfile['tmp_name'], "$dir/$newfile_name")) {
|
||||
print_heading(get_string("uploadsuccess", "assignment", $newfile_name) );
|
||||
add_to_log($course->id, "workshop", "submit", "view.php?id=$cm->id", "$workshop->id", "$cm->id");
|
||||
if (! $dir = workshop_file_area($workshop, $newsubmission)) {
|
||||
error("Sorry, an error in the system prevents you from uploading files: contact your teacher or system administrator");
|
||||
}
|
||||
else {
|
||||
notify(get_string("uploaderror", "assignment") );
|
||||
}
|
||||
}
|
||||
if (move_uploaded_file($newfile['tmp_name'], "$dir/$newfile_name")) {
|
||||
print_heading(get_string("uploadsuccess", "assignment", $newfile_name) );
|
||||
add_to_log($course->id, "workshop", "submit", "view.php?id=$cm->id", "$workshop->id", "$cm->id");
|
||||
}
|
||||
else {
|
||||
notify(get_string("uploaderror", "assignment") );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif (!is_uploaded_file($newfile['tmp_name']) and !$newfile['size'] > 0 and $newfile['name']) {
|
||||
|
@ -111,7 +108,7 @@
|
|||
else {
|
||||
notify(get_string("uploadnofilefound", "assignment"));
|
||||
}
|
||||
}
|
||||
}
|
||||
print_continue("view.php?a=$workshop->id");
|
||||
|
||||
print_footer($course);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue