Changeset 1131


Ignore:
Timestamp:
Sep 3, 2008 9:14:51 AM (5 years ago)
Author:
dkg
Message:

show/hide workshop categories for new teacher in liason form based on whether the new teacher is attending.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/jpdd/class.jpdd.organization.php

    r619 r1131  
    201201      $ret .= '<table class="liaisonui"><tbody><tr><td>'; 
    202202 
    203       $dropdown = '<select name="newassign">'."\n<option>choose a subject</option>\n"; 
     203      // hide the dropdown initially. 
     204      $dropdown = '<div id="newassign" style="display: none; padding-left: 1em;"><select name="newassign">'."\n<option>choose a workshop subject</option>\n"; 
    204205      reset($requirements); 
    205206      while(list(,$req) = each($requirements)) { 
     
    230231      } 
    231232       
    232       $dropdown .= '</select>'; 
     233      $dropdown .= '</select></div>'; 
    233234       
    234235      $ret .= '</td><td>'; 
     
    245246      // allow liaisons to create new people: 
    246247      $ret .= '<fieldset><legend>Add a new teacher</legend> 
    247 '.$dropdown.'<br/> 
    248248<label>First name:<br/><input type="text" name="first_name" value=""/></label><br/> 
    249249<label>Last name:<br/><input type="text" name="last_name" value=""/></label><br/> 
    250250<label>E-mail Address:<br/><input type="text" name="email" value=""/></label><br/> 
     251<label>Attending this workshop?<input type="checkbox" name="isattending" onchange="if (this.checked) { $(\'#newassign\').show() } else {$(\'#newassign\').hide();};" value="yes" /></label><br/> 
     252'.$dropdown.'<br/> 
    251253</fieldset>'; 
    252254 
     
    310312          $newp->addM2MPeers('organization', 'affiliation', array($this->getID())); 
    311313         
    312           if ($jpdd->arrayKeyIsNotEmpty('newassign', $_POST) && in_array((int)$_POST['newassign'], $acceptedcategories)) { 
     314          if ($jpdd->arrayKeyIsNotEmpty('isattending', $_POST) && ($_POST['newassign'] == 'yes') && 
     315              $jpdd->arrayKeyIsNotEmpty('newassign', $_POST) && in_array((int)$_POST['newassign'], $acceptedcategories)) { 
    313316            // FIXME: if the org already has enough for this category, put this user into "alternate"? 
    314317            $jpdd->executeSQL('INSERT INTO application (event_id, person_id, category_id) VALUES ('.(int)$jpdd->getActiveEventID().', '. 
Note: See TracChangeset for help on using the changeset viewer.