| … | |
… | |
| 15 | $form->set_id = -1; |
15 | $form->set_id = -1; |
| 16 | } |
16 | } |
| 17 | if( ! isset($form->gradingmethod) ) { |
17 | if( ! isset($form->gradingmethod) ) { |
| 18 | $form->gradingmethod = 0; |
18 | $form->gradingmethod = 0; |
| 19 | } |
19 | } |
| 20 | //if( ! isset($form->course) ) { |
20 | |
| 21 | // $form->course = $course->id; |
|
|
| 22 | //} |
|
|
| 23 | // this is really hacky, but I need the contents of the lib.php for wwassignment: |
21 | // this is really hacky, but I need the contents of the lib.php for wwassignment: |
| 24 | require_once("../mod/wwassignment/lib.php"); |
22 | require_once("../mod/wwassignment/lib.php"); |
| 25 | //require_once ("$CFG->dirroot/mod/wwassignmentlib.php"); |
23 | //require_once ("$CFG->dirroot/mod/wwassignmentlib.php"); |
| 26 | define('WWMOODLE_SET_WEBWORK_URL', $CFG->wwassignment_webwork_url); |
24 | define('WWASSIGNMENT_WEBWORK_URL', $CFG->wwassignment_webworkurl); |
| 27 | |
25 | |
| 28 | require_login($course->id); |
26 | require_login($course->id); |
| 29 | |
27 | |
| 30 | add_to_log($course->id, "wwassignment", "view all", "index.php?id=$course->id", ""); |
28 | add_to_log($course->id, "wwassignment", "view all", "index.php?id=$course->id", ""); |
| 31 | $wwCourseName = wwmoodle_courseIdToShortName($course->id); |
29 | $wwCourseName = _wwassignment_courseIdToShortName($course->id); |
| 32 | |
30 | |
| 33 | |
31 | |
| 34 | /// Get all required strings |
32 | /// Get all required strings |
| 35 | |
33 | |
| 36 | $strwwassignments = get_string("modulenameplural", "wwassignment"); |
34 | $strwwassignments = get_string("modulenameplural", "wwassignment"); |
| 37 | $strwwassignment = get_string("modulename", "wwassignment"); |
35 | $strwwassignment = get_string("modulename", "wwassignment"); |
| 38 | |
36 | |
| 39 | ?> |
37 | ?> |
| 40 | <?php |
38 | <?php |
| 41 | // ensure that there is a bridge for this course: |
39 | // ensure that there is a bridge for this course: |
| 42 | error_log("form "); |
40 | // error_log("form "); |
| 43 | error_log(print_r($form,true)); |
41 | // error_log(print_r($form,true)); |
| 44 | $oCourse = get_record("course", "id", $form->course); |
42 | // $oCourse = get_record("course", "id", $form->course); |
| 45 | error_log(print_r($oCourse, true)); |
43 | // error_log(print_r($oCourse->id, true)); |
| 46 | $aMods = get_all_instances_in_course("wwmoodle", $oCourse); |
44 | $record = get_record("wwassignment_bridge", "course",$form->course); |
| 47 | error_log("aMods"); |
45 | // error_log("aMods"); |
| 48 | error_log(count($aMods)); |
46 | // error_log(count($record)); |
| 49 | error_log(print_r($aMods, true)); |
47 | // error_log(print_r($record, true)); |
| 50 | ?> |
48 | ?> |
| 51 | |
49 | |
| 52 | |
50 | |
| 53 | <form name="form" method="post" action="mod.php"> |
51 | <form name="form" method="post" action="mod.php"> |
| 54 | <center> |
52 | <center> |
| 55 | <table cellpadding="5"> |
53 | <table cellpadding="5"> |
| 56 | <tr><td> |
54 | <tr><td> |
| 57 | <?php |
55 | <?php |
| 58 | if (count($aMods) == 0) { |
56 | if ($record) { |
| 59 | |
57 | print "This course is already prepared to connect to the webwork course $wwCourseName. "; |
| 60 | print "This course will be connected to $wwCourseName"; |
|
|
| 61 | if (isadmin()) { |
|
|
| 62 | print("<p style='font-size: smaller; color: #aaa; text-align: center;'> |
|
|
| 63 | <a style='color: black;text-decoration:underline' href='".WWMOODLE_WEBWORK_URL."/admin'>"."Link to create WeBWorK course"."</a></p>"); |
|
|
| 64 | |
58 | |
| 65 | } |
59 | |
| 66 | |
60 | |
| 67 | } else { |
61 | } else { |
| 68 | print "This course is already prepared to connect to the webwork course $wwCourseName. "; |
62 | print "This course will be connected to $wwCourseName"; |
|
|
63 | } |
| 69 | if (isadmin()) { |
64 | if (isadmin()) { |
| 70 | print("<p style='font-size: smaller; color: #aaa; text-align: center;'> |
65 | print("<p style='font-size: smaller; color: #aaa; text-align: center;'> |
| 71 | <a style='color: black;text-decoration:underline' href='".WWMOODLE_WEBWORK_URL."/admin'>"."Link to create WeBWorK course"."</a></p>"); |
66 | <a style='color: black;text-decoration:underline' href='".WWASSIGNMENT_WEBWORK_URL."/admin'>"."Link to create WeBWorK course"."</a></p>"); |
| 72 | |
67 | |
| 73 | } |
68 | } |
| 74 | |
|
|
| 75 | |
|
|
| 76 | |
|
|
| 77 | } |
|
|
| 78 | ?> |
69 | ?> |
| 79 | </td></tr> |
70 | </td></tr> |
| 80 | <tr valign="top"> |
71 | <tr valign="top"> |
| 81 | <td align="right"><label for='name'><b><?php print_string("name") ?>:</b></label></td> |
72 | <td align="right"><label for='name'><b><?php print_string("name") ?>:</b></label></td> |
| 82 | <td> |
73 | <td> |
| … | |
… | |
| 87 | |
78 | |
| 88 | <tr valign='top'> |
79 | <tr valign='top'> |
| 89 | <td align='right'><label for='set_id'><b><?php print_string("set_id", "wwassignment"); ?>:</b></label><br /> |
80 | <td align='right'><label for='set_id'><b><?php print_string("set_id", "wwassignment"); ?>:</b></label><br /> |
| 90 | <?php helpbutton("set_id", get_string("helpSet_id", "wwassignment"), "wwassignment", true, true); ?> |
81 | <?php helpbutton("set_id", get_string("helpSet_id", "wwassignment"), "wwassignment", true, true); ?> |
| 91 | </td> |
82 | </td> |
| 92 | <td align='left'><?php wwassignment_printSetSelect($form->course, $form->set_id); ?></td> |
83 | <td align='left'><?php _wwassignment_printSetSelect($form->course, $form->set_id); ?></td> |
| 93 | </tr> |
84 | </tr> |
| 94 | <tr valign="top"> |
85 | <tr valign="top"> |
| 95 | <td align="right"><b><?php print_string("description", "assignment") ?>:</b> |
86 | <td align="right"><b><?php print_string("description", "assignment") ?>:</b> |
| 96 | <br /><br /> |
87 | <br /><br /> |
| 97 | <?php |
88 | <?php |
| … | |
… | |
| 151 | |
142 | |
| 152 | </form> |
143 | </form> |
| 153 | <?php |
144 | <?php |
| 154 | if( isteacher($course->id) ) { |
145 | if( isteacher($course->id) ) { |
| 155 | print("<p style='font-size: smaller; color: #aaa; text-align: center;'> |
146 | print("<p style='font-size: smaller; color: #aaa; text-align: center;'> |
| 156 | <a style='color: #666;text-decoration:underline' href='".WWMOODLE_SET_WEBWORK_URL."/$course->shortname/instructor' target='_webwork_edit'>" |
147 | <a style='color: #666;text-decoration:underline' href='".WWASSIGNMENT_WEBWORK_URL."/$course->shortname/instructor' target='_webwork_edit'>" |
| 157 | .get_string("goToWeBWorK", "wwmoodle")."</a></p>"); |
148 | .get_string("goToWeBWorK", "wwmoodle")."</a></p>"); |
| 158 | } |
149 | } |
| 159 | ?> |
150 | ?> |