Thread: [Aimmath-commit] moodle/mod/math_assignment lib.php,1.10,1.11
Brought to you by:
gustav_delius,
npstrick
From: <ma...@us...> - 2003-09-16 15:26:33
|
Update of /cvsroot/aimmath/moodle/mod/math_assignment In directory sc8-pr-cvs1:/tmp/cvs-serv20421/mod/math_assignment Modified Files: lib.php Log Message: Changed handling of problem and solution sheets. Index: lib.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/lib.php,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** lib.php 16 Sep 2003 13:23:10 -0000 1.10 --- lib.php 16 Sep 2003 15:26:30 -0000 1.11 *************** *** 15,36 **** // problems ! if ($math_assignment->problemsurl <> "") { ! $math_assignment->problems = $math_assignment->problemsurl; ! } ! else if ($math_assignment->problemsfile <> "") { ! $math_assignment->problems = math_assignment_save_upload($math_assignment->course, $_FILES['problemsfile']); } $math_assignment->problems = trim($math_assignment->problems); // solutions ! if ($math_assignment->solutions == "|url|") ! $math_assignment->solutions = $math_assignment->solutionsurl; ! else if ($math_assignment->solutions == "|upload|") { ! if (empty($_FILES['solutionsfile'])) ! $math_assignment->solutions = ""; ! else $math_assignment->solutions = math_assignment_save_upload($math_assignment->course, $_FILES['solutionsfile']); } $math_assignment->solutions = trim($math_assignment->solutions); $math_assignment->timemodified = time(); --- 15,42 ---- // problems ! if ($math_assignment->problems === "") { ! if ($math_assignment->problemsurl) ! $math_assignment->problems = $math_assignment->problemsurl; ! else if (!empty($_FILES['problemsfile'])) ! $math_assignment->problems = math_assignment_save_upload($math_assignment->course, $_FILES['problemsfile']); } $math_assignment->problems = trim($math_assignment->problems); + if (isset($math_assignment->problemscompile)) + $math_assignment->problemscompile = ($math_assignment->problemscompile != ""); + else + $math_assignment->problemscompile = false; // solutions ! if ($math_assignment->solutions === "") { ! if ($math_assignment->solutionsurl) ! $math_assignment->solutions = $math_assignment->solutionsurl; ! else if (!empty($_FILES['solutionsfile'])) $math_assignment->solutions = math_assignment_save_upload($math_assignment->course, $_FILES['solutionsfile']); } $math_assignment->solutions = trim($math_assignment->solutions); + if (isset($math_assignment->solutionscompile)) + $math_assignment->solutionscompile = ($math_assignment->solutionscompile != ""); + else + $math_assignment->solutionscompile = false; $math_assignment->timemodified = time(); *************** *** 50,73 **** // problems ! if ($math_assignment->problems == "|url|") ! $math_assignment->problems = $math_assignment->problemsurl; ! else if ($math_assignment->problems == "|upload|") { ! if (empty($_FILES['problemsfile'])) ! $math_assignment->problems = ""; ! else $math_assignment->problems = math_assignment_save_upload($math_assignment->course, $_FILES['problemsfile']); } $math_assignment->problems = trim($math_assignment->problems); // solutions ! if ($math_assignment->solutions == "|url|") ! $math_assignment->solutions = $math_assignment->solutionsurl; ! else if ($math_assignment->solutions == "|upload|") { ! if (empty($_FILES['solutionsfile'])) ! $math_assignment->solutions = ""; ! else $math_assignment->solutions = math_assignment_save_upload($math_assignment->course, $_FILES['solutionsfile']); } $math_assignment->solutions = trim($math_assignment->solutions); $math_assignment->timemodified = time(); --- 56,83 ---- // problems ! if ($math_assignment->problems === "") { ! if ($math_assignment->problemsurl) ! $math_assignment->problems = $math_assignment->problemsurl; ! else if (!empty($_FILES['problemsfile'])) $math_assignment->problems = math_assignment_save_upload($math_assignment->course, $_FILES['problemsfile']); } $math_assignment->problems = trim($math_assignment->problems); + if (isset($math_assignment->problemscompile)) + $math_assignment->problemscompile = ($math_assignment->problemscompile != ""); + else + $math_assignment->problemscompile = false; // solutions ! if ($math_assignment->solutions === "") { ! if ($math_assignment->solutionsurl) ! $math_assignment->solutions = $math_assignment->solutionsurl; ! else if (!empty($_FILES['solutionsfile'])) $math_assignment->solutions = math_assignment_save_upload($math_assignment->course, $_FILES['solutionsfile']); } $math_assignment->solutions = trim($math_assignment->solutions); + if (isset($math_assignment->solutionscompile)) + $math_assignment->solutionscompile = ($math_assignment->solutionscompile != ""); + else + $math_assignment->solutionscompile = false; $math_assignment->timemodified = time(); *************** *** 250,273 **** global $CFG; ! if ($math_assignment->problems) { ! if(strcasecmp(substr($math_assignment->problems, -4), ".tex") == 0) $proburl = "pdfgen.php?id=$math_assignment->id&type=problems"; - else if ($CFG->slasharguments) - $proburl = "$CFG->wwwroot/file.php/$math_assignment->course/$math_assignment->problems"; else ! $proburl = "$CFG->wwwroot/file.php?file=/$math_assignment->course/$math_assignment->problems"; } ! else ! $proburl = ""; ! if ($math_assignment->solutions) { ! if(strcasecmp(substr($math_assignment->solutions, -4), ".tex") == 0) $solurl = "pdfgen.php?id=$math_assignment->id&type=solutions"; - else if ($CFG->slasharguments) - $solurl = "$CFG->wwwroot/file.php/$math_assignment->course/$math_assignment->solutions"; else ! $solurl = "$CFG->wwwroot/file.php?file=/$math_assignment->course/$math_assignment->solutions"; } - else - $solurl = ""; } --- 260,296 ---- global $CFG; ! if($math_assignment->problemscompile) { ! if ($math_assignment->problems || $math_assignment->aimquiz) $proburl = "pdfgen.php?id=$math_assignment->id&type=problems"; else ! $proburl = ""; } ! else { ! if ($math_assignment->problems) { ! if ($CFG->slasharguments) ! $proburl = "$CFG->wwwroot/file.php/$math_assignment->course/$math_assignment->problems"; ! else ! $proburl = "$CFG->wwwroot/file.php?file=/$math_assignment->course/$math_assignment->problems"; ! } ! else ! $proburl = ""; ! } ! ! if($math_assignment->solutionscompile) { ! if ($math_assignment->solutions || $math_assignment->aimquiz) $solurl = "pdfgen.php?id=$math_assignment->id&type=solutions"; else ! $solurl = ""; ! } ! else { ! if ($math_assignment->solutions) { ! if ($CFG->slasharguments) ! $solurl = "$CFG->wwwroot/file.php/$math_assignment->course/$math_assignment->solutions"; ! else ! $solurl = "$CFG->wwwroot/file.php?file=/$math_assignment->course/$math_assignment->solutions"; ! } ! else ! $solurl = ""; } } |