Changeset 1133


Ignore:
Timestamp:
Sep 3, 2008 3:13:53 PM (5 years ago)
Author:
dkg
Message:

allowing liasons to create new users with a specific primary interest.

Location:
trunk/jpdd
Files:
2 edited

Legend:

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

    r1132 r1133  
    1717        } 
    1818 
    19     function getInterestCategoryDropdown($name, $emptyfield = NULL, $selected = NULL, $extras = '') { 
     19    function getInterestIDs() { 
     20      global $jpdd; 
     21      return $jpdd->getValuesFromSQL('SELECT id FROM interest', 'id'); 
     22    } 
     23 
     24    function getInterestDropdown($name, $emptyfield = NULL, $selected = NULL, $extras = '') { 
    2025      global $jpdd; 
    2126      $ret = '<select name="'.$name.'" '.$extras.'>'."\n"; 
  • trunk/jpdd/class.jpdd.organization.php

    r1131 r1133  
    44 
    55require_once('class.dkg.person.php'); 
     6require_once('class.jpdd.category.php'); 
    67 
    78if (!class_exists('JPDD_Organization')) { 
     
    201202      $ret .= '<table class="liaisonui"><tbody><tr><td>'; 
    202203 
    203       // hide the dropdown initially. 
     204      // hide the dropdown initially.  It will be showed if the liaison clicks the "attending this workshop" checkbox. 
    204205      $dropdown = '<div id="newassign" style="display: none; padding-left: 1em;"><select name="newassign">'."\n<option>choose a workshop subject</option>\n"; 
    205206      reset($requirements); 
     
    249250<label>Last name:<br/><input type="text" name="last_name" value=""/></label><br/> 
    250251<label>E-mail Address:<br/><input type="text" name="email" value=""/></label><br/> 
     252'.JPDD_Category::getInterestDropdown('primaryinterest', "Primary Focus?").'<br/> 
    251253<label>Attending this workshop?<input type="checkbox" name="isattending" onchange="if (this.checked) { $(\'#newassign\').show() } else {$(\'#newassign\').hide();};" value="yes" /></label><br/> 
    252254'.$dropdown.'<br/> 
     
    299301          $jpdd->arrayKeyIsNotEmpty('last_name', $_POST) ||  
    300302          $jpdd->arrayKeyIsNotEmpty('email', $_POST)) { 
     303 
     304        $acceptableinterests = JPDD_Category::getInterestIDs(); 
     305 
    301306        // FIXME: if the person fields are present, check if person 
    302307        // already exists, as affiliated with the school. 
     
    318323                              $newp->getID().', '.(int)$_POST['newassign'].')'); 
    319324          } 
     325          if ($jpdd->arrayKeyIsNotEmpty('primaryinterest', $_POST) && in_array((int)$_POST['primaryinterest'], $acceptableinterests)) { 
     326            $sql = 'INSERT INTO person_interest (person_id, category_id) VALUES ('. 
     327              $newp->getID().', '.(int)$_POST['primaryinterest'].')'; 
     328            $jpdd->executeSQL($sql); 
     329          } 
    320330        } 
    321331      } 
Note: See TracChangeset for help on using the changeset viewer.