Split lib.php into locallib.php and lib.php;

Fixed bug # 1435;
Possibly fixed bug #1489
This commit is contained in:
rkingdon
2004-06-18 09:24:20 +00:00
parent c2df1c2ec2
commit dbda4a92ad
7 changed files with 2772 additions and 2746 deletions
+11 -7
View File
@@ -28,7 +28,8 @@
************************************************/
require("../../config.php");
require("lib.php");
require("lib.php");
require("locallib.php");
optional_variable($id); // Course Module ID
optional_variable($a); // workshop ID
@@ -235,7 +236,7 @@
// show assessment and allow changes
workshop_print_assessment($workshop, $assessment, true, $allowcomments, $_SERVER["HTTP_REFERER"]);
}
}
/*************** display grading form (viewed by student) *********************************/
@@ -293,8 +294,8 @@
if (!isteacher($course->id)) {
error("Only teachers can look at this page");
}
$count = count_records("workshop_grades", "workshop", $workshop->id);
$count = count_records("workshop_grades", "workshopid", $workshop->id);
if ($workshop->phase > 1 and $count) {
notify(get_string("warningonamendingelements", "workshop"));
}
@@ -712,14 +713,17 @@
}
// first get the assignment elements for maxscores and weights...
if (!$elementsraw = get_records("workshop_elements", "workshopid", $workshop->id, "elementno ASC")) {
$elementsraw = get_records("workshop_elements", "workshopid", $workshop->id, "elementno ASC");
if (count($elementsraw) < $workshop->nelements) {
print_string("noteonassignmentelements", "workshop");
}
else {
if ($elementsraw) {
foreach ($elementsraw as $element) {
$elements[] = $element; // to renumber index 0,1,2...
}
}
} else {
$elements = null;
}
$timenow = time();
// don't fiddle about, delete all the old and add the new!
+2 -1
View File
@@ -1,7 +1,8 @@
<?PHP // $Id$
require("../../config.php");
require("lib.php");
require("lib.php");
require("locallib.php");
require_variable($id); // course
+26 -2724
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+1
View File
@@ -22,6 +22,7 @@
require("../../config.php");
require("lib.php");
require("locallib.php");
optional_variable($id); // Course Module ID
optional_variable($a); // workshop ID
+12 -11
View File
@@ -2,6 +2,7 @@
require("../../config.php");
require("lib.php");
require("locallib.php");
require_variable($id); // CM ID
@@ -46,7 +47,7 @@
else {
if (is_uploaded_file($newfile['tmp_name']) and $newfile['size'] > 0) {
if ($newfile['size'] > $workshop->maxbytes) {
notify(get_string("uploadfiletoobig", "assignment", $workshop->maxbytes));
notify(get_string("uploadfiletoobig", "assignment", $workshop->maxbytes));
}
else {
$newfile_name = clean_filename($newfile['name']);
@@ -61,8 +62,8 @@
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) {
// 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
foreach ($submissions as $submission) {
$lastsubmission = $submission;
@@ -101,15 +102,15 @@
else {
notify(get_string("uploaderror", "assignment") );
}
}
else {
notify(get_string("uploadbadname", "assignment") );
}
}
}
else {
notify(get_string("uploadnofilefound", "assignment") );
}
}
}
elseif (!is_uploaded_file($newfile['tmp_name']) and !$newfile['size'] > 0 and $newfile['name']) {
notify(get_string("uploadfiletoobig", "assignment", $workshop->maxbytes));
}
else {
notify(get_string("uploadnofilefound", "assignment"));
}
}
print_continue("view.php?a=$workshop->id");
+6 -3
View File
@@ -18,6 +18,7 @@
require("../../config.php");
require("lib.php");
require("locallib.php");
optional_variable($id); // Course Module ID
optional_variable($a); // workshop ID
@@ -71,7 +72,7 @@
if (isteacher($course->id)) {
if (empty($action)) { // no action specified, either go straight to elements page else the admin page
// has the assignment any elements
if (count_records("workshop_elements", "workshopid", $workshop->id)) {
if (count_records("workshop_elements", "workshopid", $workshop->id) >= $workshop->nelements) {
$action = "teachersview";
}
else {
@@ -455,9 +456,11 @@
switch ($workshop->phase) {
case 0:
case 1: // set up assignment
echo "<p><b><a href=\"assessments.php?id=$cm->id&action=editelements\">".
if ($workshop->nelements) {
echo "<p><b><a href=\"assessments.php?id=$cm->id&action=editelements\">".
get_string("amendassessmentelements", "workshop")."</a></b> \n";
helpbutton("elements", get_string("amendassessmentelements", "workshop"), "workshop");
helpbutton("elements", get_string("amendassessmentelements", "workshop"), "workshop");
}
if ($workshop->ntassessments) {
// if teacher examples show submission and assessment links
echo "<p><b><a href=\"view.php?id=$cm->id&action=submitassignment\">".