function admin_display_groups_popup_edit_definition

7.x admin.groups.inc admin_display_groups_popup_edit_definition()
6.x admin.groups.inc admin_display_groups_popup_edit_definition()
4.x admin.groups.inc admin_display_groups_popup_edit_definition()
5.x admin.groups.inc admin_display_groups_popup_edit_definition()

File

modules/admin/admin.groups.inc, line 437

Code

function admin_display_groups_popup_edit_definition() {
  $rtn = "";

  fp_add_css(fp_get_module_path("admin") . "/css/admin.css");
  fp_add_js(fp_get_module_path("admin") . "/js/admin.js");

  $group_id = trim($_REQUEST ["group_id"]);
  $de_catalog_year = admin_get_de_catalog_year();
  $group = new Group($group_id, null, -1, false, true);
  $group->load_descriptive_data();

  if (isset($_REQUEST ["definition"])) {
    $definition = trim($_REQUEST ["definition"]);
  }
  else {
    $definition = $group->definition;
  }

  $results = admin_get_courses_from_definition($definition);


  // This text will be used to describe how the definition works in a javascript alert box:
  $tdef .= t("Definitions provide a very quick way to add or remove many courses from a group.  For example, to add all CSCI courses, enter:") . "\n";
  $tdef .= "       add CSCI.*\n";
  $tdef .= t("The . is used to seperate the subject from the course number.  The * means \"any value.\"  You may also use it in the subject.  For example, ");
  $tdef .= t("to add all CSCI and any course with a subject that begins with A, enter:") . "\n";
  $tdef .= "       add CSCI.*\n       add A*.*\n";
  $tdef .= t("Removing courses is done the same way.  For example, you can add all courses, then remove any course with a number lower than 400:") . "\n";
  $tdef .= "       add *.*\n       rem *.1*\n       rem *.2*\n       rem *.3*\n";
  $tdef .= "\n\n" . t("It should be stated that add statements will include courses which have been marked as \"exclude.\"  This is normal.  Those courses will not") . " ";
  $tdef .= t("show up in group selection screens, but they will be added to a group if a student has completed that course in the past.");


  $rtn .= "<b>Edit Definition for $group->title ($de_catalog_year)<br><i>$group->group_name</i></b>
    <br><br><form action='" . base_path() . "/admin/groups/popup-edit-definition&de_catalog_year=$de_catalog_year&group_id=$group_id' method='POST' id='mainform'>
      <table border='0'>
      <tr>
          <td valign='top' align='right'>
          <div class='tenpt' align='left'>Working Definition:
           " . fp_get_js_alert_link($tdef, "[?]") . "</div>
          <textarea name='definition' id='definition' rows='10' cols='15' >$definition</textarea>
          <br>
          <input type='button' value='Generate ->'
            onClick='showUpdate(); document.getElementById(\"mainform\").submit();'>
        </td>
        <td valign='top' align='right' class='tenpt'>
          <div class='tenpt' align='left'>Results:" . " (" . $results ["count"] . ")</div>
          <textarea rows='10' cols='35' readonly=readonly
            style='background-color: lightgray;'>{$results ["text"]}</textarea>
            <br>
            (loads courses from all catalog years)
        </td>
      </tr>
      </table>
      </form>
      " . t("If you are satisfied with the results of this definition, 
      click the Save to Group button.  Otherwise, simply close this window.") . "
      
      
      <input type='button' value='Save to Group' onClick='adminPopupSaveDefinition(\"\");'>
  
    ";




  return $rtn;
}