[system] / trunk / wwmoodle / wwassignment / mod.html Repository:
ViewVC logotype

View of /trunk/wwmoodle/wwassignment/mod.html

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4381 - (download) (as text) (annotate)
Mon Aug 14 19:34:14 2006 UTC (13 years, 6 months ago) by sh002i
File size: 5858 byte(s)
move bridge creation to mod.html -- that way, the bridge is created the
first time someone asks to create a webwork set. this allows us to
provide the create/administer ww course links right away. cleanup,
formatting. the bridge creation is actually done in
_wwassignment_ensureBridgeExists in lib.php.

also, i hate php.

    1 <!-- This page defines the form to create or edit an instance of this module -->
    2 <!-- It is used from /course/mod.php.  The whole instance is available as $form. -->
    3 
    4 <?php
    5 // $Id$
    6 
    7 // initial RPC experiment... not working out too well. i get completely
    8 // unenlightening "invalid argument" error.
    9 
   10 //  require_once 'XML/RPC.php';
   11 //
   12 //  $msg = new XML_RPC_Message('WeBWorK.RPC.CourseManagement.listCourses');
   13 //  $cli = new XML_RPC_Client('/webwork2_rpc', 'https://devel.webwork.rochester.edu', 8000);
   14 //  //$cli->setDebug(1);
   15 //  $resp = $cli->send($msg);
   16 //
   17 //  echo '<pre>';
   18 //
   19 //  if ($resp) {
   20 //    if (!$resp->faultCode()) {
   21 //      $val = $resp->value();
   22 //      $data = XML_RPC_decode($val);
   23 //      echo print_r($data);
   24 //    } else {
   25 //      /*
   26 //       * Display problems that have been gracefully cought and
   27 //       * reported by the xmlrpc.php script
   28 //       */
   29 //      echo 'Fault Code: ' . $resp->faultCode() . "\n";
   30 //      echo 'Fault Reason: ' . $resp->faultString() . "\n";
   31 //    }
   32 //  } else {
   33 //    echo '<p>Communication error: ' . $cli->errstr . '</p>';
   34 //  }
   35 //
   36 //  echo '</pre>';
   37 
   38 /// First we check that form variables have been initialised
   39 if (!isset($form->name)) {
   40   $form->name = '';
   41 }
   42 if( !isset($form->intro) ) {
   43   $form->intro = 'Introduction?? where is this used? defined in mod.html';
   44 }
   45 if( !isset($form->set_id) ) {
   46   $form->set_id = -1;
   47 }
   48 if( ! isset($form->gradingmethod) ) {
   49   $form->gradingmethod = 0;
   50 }
   51 
   52 // this is really hacky, but I need the contents of the lib.php for wwassignment:
   53 require_once ("$CFG->dirroot/mod/wwassignment/lib.php");
   54 define('WWASSIGNMENT_WEBWORK_URL', $CFG->wwassignment_webworkurl);
   55 
   56 require_login($course->id);
   57 
   58 add_to_log($course->id, "wwassignment", "view all", "index.php?id=$course->id", "");
   59 $wwCourseName = _wwassignment_courseIdToShortName($course->id);
   60 
   61 /// Get all required strings
   62 $strwwassignments = get_string("modulenameplural", "wwassignment");
   63 $strwwassignment  = get_string("modulename", "wwassignment");
   64 
   65 // ensure that there is a bridge for this course
   66 _wwassignment_ensureBridgeExists($course->id);
   67 
   68 ?>
   69 
   70 <?php
   71 
   72 if (isadmin() || isteacher($course->id)) {
   73   print "<p style='font-size: smaller; text-align: center;'>";
   74 }
   75 if (isadmin()) {
   76   print("<a href='".WWASSIGNMENT_WEBWORK_URL."/admin/?subDisplay=add_course&add_courseID=$wwCourseName&add_dbLayout=sql_moodle'>"."Create WeBWorK course"."</a>");
   77 
   78 }
   79 if (isadmin() && isteacher($course->id)) {
   80   print("<br/>");
   81 }
   82 if(isteacher($course->id)) {
   83   print("<a href='".WWASSIGNMENT_WEBWORK_URL."/$course->shortname/instructor' target='_blank'>"
   84          .get_string("goToWeBWorK", "wwassignment")."</a>");
   85 }
   86 if (isadmin() || isteacher($course->id)) {
   87   print "</p>";
   88 }
   89 
   90 ?>
   91 
   92   <form name="form" method="post" action="mod.php">
   93   <center>
   94   <table cellpadding="5">
   95   <tr valign="top">
   96     <td align="right"><label for='name'><b><?php  print_string("name") ?>:</b></label></td>
   97     <td>
   98       <input type="text" id='name' name="name" size="30" value="<?php  p($form->name) ?>">
   99     </td>
  100   </tr>
  101   <!-- More rows go in here... -->
  102 
  103   <tr valign='top'>
  104     <td align='right'><label for='set_id'><b><?php print_string("set_id", "wwassignment"); ?>:</b></label><br />
  105       <?php helpbutton("set_id", get_string("helpSet_id", "wwassignment"), "wwassignment", true, true); ?>
  106     </td>
  107     <td align='left'><?php _wwassignment_printSetSelect($form->course, $form->set_id); ?></td>
  108   </tr>
  109   <tr valign="top">
  110     <td align="right"><b><?php print_string("description", "assignment") ?>:</b>
  111      <br /><br />
  112      <?php
  113       helpbutton("writing", get_string("helpwriting"), "moodle", true, true);
  114       echo "<br />";
  115       helpbutton("questions", get_string("helpquestions"), "moodle", true, true);
  116       echo "<br />";
  117       if ($usehtmleditor) {
  118          helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);
  119       } else {
  120          emoticonhelpbutton("form", "description");
  121       }
  122       ?>
  123     </td>
  124     <td>
  125     <?php
  126        print_textarea($usehtmleditor, 20, 60, 680, 400, "description", $form->description);
  127 
  128        if ($usehtmleditor) {
  129          echo '<input type="hidden" name="format" value="'.FORMAT_HTML.'" />';
  130        } else {
  131          echo '<div align="right">';
  132          helpbutton("textformat", get_string("formattexttype"));
  133          print_string("formattexttype");
  134          echo ':&nbsp;';
  135          if (!$form->format) {
  136            $form->format = $defaultformat;
  137          }
  138          choose_from_menu(format_text_menu(), "format", $form->format, "");
  139          echo '</div>';
  140        }
  141     ?>
  142     </td>
  143   </tr>
  144   <tr valign='top'>
  145     <td align='right'><label for='gradeMethod'><b><?php print_string("gradeMethod", "wwassignment"); ?>:</b></label><br />
  146       <?php helpbutton("gradeMethod", get_string("helpGradeMethod", "wwassignment"), "wwassignment", true, true); ?>
  147     </td>
  148     <td align='left'><?php wwassignment_printGradeMethodSelect($form->gradingmethod); ?></td>
  149   </tr>
  150   <!-- The following line for Moodle 1.5 prints the visibility setting form element -->
  151   <?php print_visible_setting($form,$oCourse); // the version without $oCourse doesn't work, error in course/lib.php perhaps MEG?>
  152 
  153   </table>
  154   <!-- These hidden variables are always the same -->
  155   <input type="hidden" name='formaction'    value="create_assignment" />
  156   <input type="hidden" name='course'      value="<?php  p($form->course) ?>" />
  157   <input type="hidden" name="sesskey"     value="<?php  p($form->sesskey) ?>" />
  158   <input type="hidden" name='coursemodule'  value="<?php  p($form->coursemodule) ?>" />
  159   <input type="hidden" name='section'     value="<?php  p($form->section) ?>" />
  160   <input type="hidden" name='module'      value="<?php  p($form->module) ?>" />
  161   <input type="hidden" name='modulename'    value="<?php  p($form->modulename) ?>" />
  162   <input type="hidden" name='instance'    value="<?php  p($form->instance) ?>" />
  163   <input type="hidden" name='mode'      value="<?php  p($form->mode) ?>" />
  164   <input type="submit" value="<?php  print_string("savechanges") ?>" />
  165   </center>
  166 
  167   </form>

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9