/**
  *Given a string, figure out if ets a term from the three letter name, creating it if necesary
  **/
 function _figureOut($ldapName, $agentId)
 {
     $term = suck_by_agentAction::_getTerm(substr($ldapName, strlen($ldapName) - 3, 3));
     $can = suck_by_agentAction::_getCanonicalCourse($ldapName);
     $offer = suck_by_agentAction::_getCourseOffering($can, $term, $ldapName);
     $section = suck_by_agentAction::_getCourseSection($offer, $ldapName);
     if ($agentId == null) {
         return $section;
     }
     $dbManager = Services::getService("DatabaseManager");
     $query = new SelectQuery();
     $query->addTable('cm_enroll');
     $query->addWhere("fk_cm_section='" . addslashes($section->_id->getIdString()) . "'");
     $query->addWhere("fk_student_id='" . addslashes($agentId->getIdString()) . "'");
     //I don't need Id, but I need to select something for the query to work
     $query->addColumn('id');
     //@TODO select count instead
     $res = $dbManager->query($query);
     if ($res->getNumberOfRows() == 0) {
         $section->addStudent($agentId, $p = new Type("EnrollmentStatusType", "edu.middlebury", "LDAP"));
     }
     return $section;
 }