private function edit()
 {
     /* Bail out if we don't have a valid candidate ID. */
     if (!$this->isRequiredIDValid('candidateID', $_GET)) {
         CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'Invalid candidate ID.');
     }
     $candidateID = $_GET['candidateID'];
     $candidates = new Candidates($this->_siteID);
     $data = $candidates->getForEditing($candidateID);
     /* Bail out if we got an empty result set. */
     if (empty($data)) {
         CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'The specified candidate ID could not be found.');
     }
     if ($data['isAdminHidden'] == 1 && $this->_accessLevel < ACCESS_LEVEL_MULTI_SA) {
         $this->listByView('This candidate is hidden - only a CATS Administrator can unlock the candidate.');
         return;
     }
     $users = new Users($this->_siteID);
     $usersRS = $users->getSelectList();
     /* Add an MRU entry. */
     $_SESSION['CATS']->getMRU()->addEntry(DATA_ITEM_CANDIDATE, $candidateID, $data['firstName'] . ' ' . $data['lastName']);
     /* Get extra fields. */
     $extraFieldRS = $candidates->extraFields->getValuesForEdit($candidateID);
     /* Get possible sources. */
     $sourcesRS = $candidates->getPossibleSources();
     $sourcesString = ListEditor::getStringFromList($sourcesRS, 'name');
     /* Is current source a possible source? */
     // FIXME: Use array search functions!
     $sourceInRS = false;
     foreach ($sourcesRS as $sourceData) {
         if ($sourceData['name'] == $data['source']) {
             $sourceInRS = true;
         }
     }
     if ($this->_accessLevel == ACCESS_LEVEL_DEMO) {
         $canEmail = false;
     } else {
         $canEmail = true;
     }
     $emailTemplates = new EmailTemplates($this->_siteID);
     $statusChangeTemplateRS = $emailTemplates->getByTag('EMAIL_TEMPLATE_OWNERSHIPASSIGNCANDIDATE');
     if ($statusChangeTemplateRS['disabled'] == 1) {
         $emailTemplateDisabled = true;
     } else {
         $emailTemplateDisabled = false;
     }
     /* Date format for DateInput()s. */
     if ($_SESSION['CATS']->isDateDMY()) {
         $data['dateAvailableMDY'] = DateUtility::convert('-', $data['dateAvailable'], DATE_FORMAT_DDMMYY, DATE_FORMAT_MMDDYY);
     } else {
         $data['dateAvailableMDY'] = $data['dateAvailable'];
     }
     if (!eval(Hooks::get('CANDIDATE_EDIT'))) {
         return;
     }
     $EEOSettings = new EEOSettings($this->_siteID);
     $EEOSettingsRS = $EEOSettings->getAll();
     $this->_template->assign('active', $this);
     $this->_template->assign('data', $data);
     $this->_template->assign('usersRS', $usersRS);
     $this->_template->assign('extraFieldRS', $extraFieldRS);
     $this->_template->assign('sourcesRS', $sourcesRS);
     $this->_template->assign('sourcesString', $sourcesString);
     $this->_template->assign('sourceInRS', $sourceInRS);
     $this->_template->assign('candidateID', $candidateID);
     $this->_template->assign('canEmail', $canEmail);
     $this->_template->assign('EEOSettingsRS', $EEOSettingsRS);
     $this->_template->assign('emailTemplateDisabled', $emailTemplateDisabled);
     $this->_template->display('./modules/candidates/Edit.tpl');
 }