Example #1
0
 /**
  * Credit card payment form
  * Different form for administrators
  */
 public function paymentForm(\Jazzee\Entity\Applicant $applicant, $amount)
 {
     $form = new \Foundation\Form();
     if (\is_a($this->_controller, 'ApplyPageController')) {
         $form->newHiddenElement('ucla_ref_no', uniqid(rand()));
         $form->newHiddenElement('amount1', $amount);
         $form->newHiddenElement('itemcode1', $this->_paymentType->getVar('itemCode'));
         $form->newHiddenElement('desc1', $this->_paymentType->getVar('itemDescription'));
         $form->newHiddenElement('ref1type1', $this->_paymentType->getVar('reftypeApplicantId'));
         $form->newHiddenElement('ref1val1', $applicant->getId());
         $form->newHiddenElement('ref2type1', $this->_paymentType->getVar('reftypeForwardUrl'));
         $form->newHiddenElement('ref2val1', $this->_controller->getServerPath() . $this->_controller->getActionPath());
         $form->newHiddenElement('signouturl', $this->_controller->absolutePath('transaction/' . \urlencode(get_class($this))));
         if ($this->_controller->getConfig()->getStatus() == 'PRODUCTION') {
             $form->setAction(self::CASHNET_URL . $this->_paymentType->getVar('liveSiteName'));
         } else {
             $form->setAction(self::CASHNET_URL . $this->_paymentType->getVar('devSiteName'));
         }
         $field = $form->newField();
         $field->setLegend($this->_paymentType->getName());
         $field->setInstructions("<p>Clicking the 'Pay with Credit Card' button will redirect you to a secure payment page.  Once you have completed your transaction you will be returned to the application.<strong>Application Fee:</strong> &#36;{$amount}</p>");
         $form->newButton('submit', 'Pay with Credit Card');
     } else {
         $field = $form->newField();
         $field->setLegend($this->_paymentType->getName());
         $field->setInstructions("<p>Credit card details should be enterd directly at the cashnet website and then the transaction ID entered here.</p>");
         $element = $field->newElement('TextInput', 'transactionId');
         $element->setLabel('Transaction ID');
         $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element));
         //we pass the amount back as a hidden element so PaymentPage will have it again
         $form->newHiddenElement('amount', $amount);
         $form->newButton('submit', 'Lookup Transaction');
     }
     return $form;
 }
Example #2
0
 /**
  * Create a new pagetype
  */
 public function actionNew()
 {
     $form = new \Foundation\Form();
     $form->setCSRFToken($this->getCSRFToken());
     $form->setAction($this->path("manage/pagetypes/new"));
     $field = $form->newField();
     $field->setLegend('New page type');
     $element = $field->newElement('TextInput', 'name');
     $element->setLabel('Name');
     $element->addFilter(new \Foundation\Form\Filter\Safe($element));
     $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element));
     $element = $field->newElement('TextInput', 'class');
     $element->setLabel('Class');
     $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element));
     $form->newButton('submit', 'Add Page');
     $this->setVar('form', $form);
     if ($input = $form->processInput($this->post)) {
         if (!class_exists($input->get('class'))) {
             $this->addMessage('error', "That is not a valid class name");
         } else {
             $pageType = new \Jazzee\Entity\PageType();
             $pageType->setName($input->get('name'));
             $pageType->setClass($input->get('class'));
             $this->addMessage('success', $input->get('name') . "  added.");
             $this->_em->persist($pageType);
             $this->redirectPath('manage/pagetypes');
         }
     }
 }
 /**
  * View the current Setup or setup a new app
  */
 public function actionIndex()
 {
     $form = new \Foundation\Form();
     $form->setCSRFToken($this->getCSRFToken());
     $form->setAction($this->path("setup/removeapplication"));
     $field = $form->newField();
     $field->setLegend('Remove Application');
     $element = $field->newElement('TextInput', 'confirm');
     $element->setLabel('Type CONFIRM in the box to remove application');
     $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element));
     $element->addValidator(new \Foundation\Form\Validator\SpecificString($element, 'CONFIRM'));
     if ($this->_application->getApplicants()->count() > 0) {
         $applicants = $this->_application->getApplicants();
         $element = $field->newElement('CheckboxList', 'deleteApps');
         $element->setLabel('The following applicants will be deleted as well.  Confirm each one by checking the box.');
         $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element));
         $element->addValidator(new \Foundation\Form\Validator\AllChecked($element));
         foreach ($applicants as $applicant) {
             $element->newItem($applicant->getId(), $applicant->getFullName());
         }
     }
     $form->newButton('submit', 'Remove Application');
     $this->setVar('form', $form);
     if ($input = $form->processInput($this->post)) {
         $this->_em->remove($this->_application);
         unset($this->_store->AdminControllerGetNavigation);
         $this->addMessage('success', 'Application Removed.');
         $this->redirectPath('setup/application');
     }
     $this->loadView($this->controllerName . '/form');
 }
Example #4
0
 /**
  * Remove a tag from all applicants and add a new tag in its place
  * @param $tagId
  */
 public function actionEdit($tagId)
 {
     if ($tag = $this->_em->getRepository('Jazzee\\Entity\\Tag')->find($tagId)) {
         $applicants = $this->_em->getRepository('Jazzee\\Entity\\Applicant')->findTaggedByApplication($this->_application, $tag);
         $form = new \Foundation\Form();
         $form->setCSRFToken($this->getCSRFToken());
         $form->setAction($this->path("setup/tags/edit/{$tagId}"));
         $field = $form->newField();
         $field->setLegend('Change "' . $tag->getTitle() . '" Tag for ' . count($applicants) . ' applicants');
         $element = $field->newElement('TextInput', 'title');
         $element->setLabel('New Tag');
         $element->setValue($tag->getTitle());
         $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element));
         $applications = $this->_em->getRepository('\\Jazzee\\Entity\\Application')->findByProgram($this->_program);
         $form->newButton('submit', 'Change Tag');
         if ($input = $form->processInput($this->post)) {
             $newTag = $this->_em->getRepository('\\Jazzee\\Entity\\Tag')->findOneBy(array('title' => $input->get('title')));
             if (!$newTag) {
                 $newTag = new \Jazzee\Entity\Tag();
                 $newTag->setTitle($input->get('title'));
                 $this->_em->persist($newTag);
             }
             foreach ($applicants as $applicant) {
                 $applicant->removeTag($tag);
                 $applicant->addTag($newTag);
                 $this->_em->persist($applicant);
             }
             $this->addMessage('success', 'Changed tag for ' . count($applicants) . ' applicants');
             $this->redirectPath('setup/tags');
         }
         $this->setVar('form', $form);
     }
 }
Example #5
0
 /**
  * Create a new program
  */
 public function actionNew()
 {
     $form = new \Foundation\Form();
     $form->setCSRFToken($this->getCSRFToken());
     $form->setAction($this->path("manage/programs/new"));
     $field = $form->newField();
     $field->setLegend('New Program');
     $element = $field->newElement('TextInput', 'name');
     $element->setLabel('Program Name');
     $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element));
     $element->addFilter(new \Foundation\Form\Filter\Safe($element));
     $element = $field->newElement('TextInput', 'shortName');
     $element->setLabel('Short Name');
     $element->setInstructions('Forms the URL for accessing this program, must be unique');
     $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element));
     $element->addFilter(new \Foundation\Form\Filter\UrlSafe($element));
     $element->addFilter(new \Foundation\Form\Filter\Safe($element));
     $form->newButton('submit', 'Save Changes');
     $this->setVar('form', $form);
     if ($input = $form->processInput($this->post)) {
         $program = new \Jazzee\Entity\Program();
         $program->setName($input->get('name'));
         $program->setShortName($input->get('shortName'));
         $this->addMessage('success', "New Program Saved");
         $this->_em->persist($program);
         //if the user isn't in a program then make this one their default
         if (!$this->_program) {
             $this->_user->setDefaultProgram($program);
             $this->_em->persist($this->_user);
         }
         $this->redirectPath('manage/programs');
     }
 }
Example #6
0
 /**
  * Display a form which posts to authorize.net's server
  */
 public function paymentForm(\Jazzee\Entity\Applicant $applicant, $amount)
 {
     if (\is_a($this->_controller, 'ApplyPageController')) {
         $time = time();
         $fpSequence = $applicant->getId() . $time;
         $form = new \Foundation\Form();
         $form->newHiddenElement('x_show_form', 'PAYMENT_FORM');
         $form->newHiddenElement('x_amount', $amount);
         $form->newHiddenElement('x_test_request', $this->_controller->getConfig()->getStatus() == 'PRODUCTION' ? 0 : 1);
         $form->newHiddenElement('x_fp_sequence', $fpSequence);
         $form->newHiddenElement('x_fp_hash', \AuthorizeNetSIM_Form::getFingerprint($this->_paymentType->getVar('gatewayId'), $this->_paymentType->getVar('gatewayKey'), $amount, $fpSequence, $time));
         $form->newHiddenElement('x_fp_timestamp', $time);
         $form->newHiddenElement('x_relay_response', "TRUE");
         $form->newHiddenElement('x_relay_url', $this->_controller->getServerPath() . $this->_controller->getActionPath() . '/../../../../../transaction/' . \urlencode(get_class($this)));
         $form->newHiddenElement('x_cancel_url', $this->_controller->getServerPath() . $this->_controller->getActionPath());
         $form->newHiddenElement('redirect_url', $this->_controller->getServerPath() . $this->_controller->getActionPath());
         $form->newHiddenElement('x_login', $this->_paymentType->getVar('gatewayId'));
         $form->newHiddenElement('x_cust_id', $applicant->getId());
         $form->newHiddenElement('x_customer_ip', $_SERVER['REMOTE_ADDR']);
         $form->newHiddenElement('x_email', $applicant->getEmail());
         $form->newHiddenElement('x_email_customer', 0);
         $form->newHiddenElement('x_description', $this->_paymentType->getVar('description'));
         $form->setAction($this->_paymentType->getVar('testAccount') ? \AuthorizeNetDPM::SANDBOX_URL : \AuthorizeNetDPM::LIVE_URL);
         $field = $form->newField();
         $field->setLegend($this->_paymentType->getName());
         $field->setInstructions("<p>Clicking the 'Pay with Credit Card' button will redirect you to a secure payment page.  Once you have completed your transaction you will be returned to the application.<strong>Application Fee:</strong> &#36;{$amount}</p>");
         $form->newButton('submit', 'Pay with Credit Card');
     } else {
         $form = parent::paymentForm($applicant, $amount);
     }
     return $form;
 }
Example #7
0
 /**
  * Create a new pagetype
  */
 public function actionNew()
 {
     $form = new \Foundation\Form();
     $form->setCSRFToken($this->getCSRFToken());
     $form->setAction($this->path("manage/elementtypes/new"));
     $field = $form->newField();
     $field->setLegend('New element type');
     $element = $field->newElement('TextInput', 'name');
     $element->setLabel('Name');
     $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element));
     $element->addFilter(new \Foundation\Form\Filter\Safe($element));
     $element = $field->newElement('TextInput', 'class');
     $element->setLabel('Class');
     $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element));
     $form->newButton('submit', 'Add Element');
     $this->setVar('form', $form);
     if ($input = $form->processInput($this->post)) {
         //class_exists causes doctrine to try and load the class which fails so we look first if doctrine can load it and then
         //if that fails we use class exists with no auto_load so it just looks in existing includes
         if (\Doctrine\Common\ClassLoader::classExists(ltrim($input->get('class'), '\\')) or class_exists($input->get('class'), false)) {
             $elementType = new \Jazzee\Entity\ElementType();
             $elementType->setName($input->get('name'));
             $elementType->setClass($input->get('class'));
             $this->addMessage('success', $input->get('name') . " saved.");
             $this->_em->persist($elementType);
             $this->redirectPath('manage/elementtypes');
         } else {
             $this->addMessage('error', "That is not a valid class name.  The class must eithier by loadable by a Doctrine::classLoader registered in the autoload stack or already be included.");
         }
     }
 }
Example #8
0
 /**
  * Create a new virtual file
  */
 public function actionNew()
 {
     $form = new \Foundation\Form();
     $form->setAction($this->path("manage/virtualfiles/new"));
     $form->setCSRFToken($this->getCSRFToken());
     $field = $form->newField();
     $field->setLegend('New Virtual File');
     $element = $field->newElement('TextInput', 'name');
     $element->setLabel('File Name');
     $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element));
     $element->addFilter(new \Foundation\Form\Filter\UrlSafe($element));
     $element->addFilter(new \Foundation\Form\Filter\Safe($element));
     $element = $field->newElement('FileInput', 'contents');
     $element->setLabel('File');
     $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element));
     $element->addFilter(new \Foundation\Form\Filter\Blob($element));
     $form->newButton('submit', 'Add File');
     $this->setVar('form', $form);
     if ($input = $form->processInput($this->post)) {
         $file = new \Jazzee\Entity\VirtualFile();
         $file->setName($input->get('name'));
         $file->setContents($input->get('contents'));
         $this->_em->persist($file);
         $this->addMessage('success', "New Virtual File Saved");
         $this->redirectPath('manage/virtualfiles');
     }
 }
Example #9
0
 /**
  * Prune Old scores not mathced to any applicant
  */
 public function actionPrune()
 {
     $form = new \Foundation\Form();
     $form->setCSRFToken($this->getCSRFToken());
     $form->setAction($this->path('manage/scores/prune'));
     $field = $form->newField();
     $field->setLegend('Remove Old Scores');
     $element = $field->newElement('SelectList', 'type');
     $element->setLabel('Score Type');
     $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element));
     $element->newItem('etsgre', 'GRE Scores');
     $element->newItem('etstoefl', 'TOEFL Scores');
     $element = $field->newElement('ShortDateInput', 'olderthan');
     $element->setLabel('Older Than');
     $element->setValue('5 years ago');
     $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element));
     $element->addValidator(new \Foundation\Form\Validator\DateBefore($element, 'last year'));
     $form->newButton('submit', 'Remove Scores');
     $this->setVar('form', $form);
     if ($input = $form->processInput($this->post)) {
         switch ($input->get('type')) {
             case 'etsgre':
                 $count = $this->_em->getRepository('Jazzee\\Entity\\GREScore')->pruneUnmatchedScores(new \DateTime($input->get('olderthan')));
                 $this->addMessage('success', "{$count} GRE scores deleted.");
                 $this->redirectPath('manage/scores');
                 break;
             case 'etstoefl':
                 $count = $this->_em->getRepository('Jazzee\\Entity\\TOEFLScore')->pruneUnmatchedScores(new \DateTime($input->get('olderthan')));
                 $this->addMessage('success', "{$count} TOEFL scores deleted.");
                 $this->redirectPath('manage/scores');
                 break;
         }
     }
 }
Example #10
0
 public function paymentForm(\Jazzee\Entity\Applicant $applicant, $amount)
 {
     $form = new \Foundation\Form();
     $form->setAction($this->_controller->getActionPath());
     $form->newHiddenElement('amount', $amount);
     $field = $form->newField();
     $field->setLegend($this->_paymentType->getName());
     $field = $form->newField();
     $instructions = "<p><strong>Application Fee:</strong> &#36;{$amount}</p>";
     $instructions .= '<p><strong>Make Checks Payable to:</strong> ' . $this->_paymentType->getVar('payable') . '</p>';
     if ($this->_paymentType->getVar('address')) {
         $instructions .= '<p><h4>Mail Check to:</h4>' . nl2br($this->_paymentType->getVar('address')) . '</p>';
     }
     if ($this->_paymentType->getVar('coupon')) {
         $instructions .= '<p><h4>Include the following information with your payment:</h4> ' . nl2br($this->_paymentType->getVar('coupon')) . '</p>';
     }
     $search = array('_Applicant_Name_', '_Applicant_ID_', '_Program_Name_', '_Program_ID_');
     $replace = array();
     $replace[] = $applicant->getFirstName() . ' ' . $applicant->getLastName();
     $replace[] = $applicant->getId();
     $replace[] = $applicant->getApplication()->getProgram()->getName();
     $replace[] = $applicant->getApplication()->getProgram()->getId();
     $instructions = str_ireplace($search, $replace, $instructions);
     $instructions .= '<p>Click the Pay By Check button to pay your fee by check.  Your account will be temporarily credited and you can complete your application.  Your application will not be reviewed until your check is recieved.</p>';
     $field->setInstructions($instructions);
     $form->newButton('submit', 'Pay By Check');
     return $form;
 }
Example #11
0
 /**
  * The payment type and the amount are selected first
  * then we display the form for the payment type
  * @see StandardPage::makeForm()
  */
 protected function makeForm()
 {
     $allowedTypes = explode(',', $this->_applicationPage->getPage()->getVar('allowedPaymentTypes'));
     $allowedTypesCount = count($allowedTypes);
     $amounts = $this->_applicationPage->getPage()->getVar('amounts');
     if ($allowedTypesCount == 1 and $amounts == 1) {
         $paymentType = $this->_controller->getEntityManager()->getRepository('\\Jazzee\\Entity\\PaymentType')->findOneBy(array('id' => $allowedTypes[0], 'isExpired' => false));
         $form = $paymentType->getJazzeePaymentType($this->_controller)->paymentForm($this->_applicant, $this->_applicationPage->getPage()->getVar('amount1'));
         $form->setCSRFToken($this->_controller->getCSRFToken());
         $form->newHiddenElement('level', 2);
         $form->newHiddenElement('paymentType', $paymentType->getId());
         return $form;
     }
     $form = new \Foundation\Form();
     $form->setAction($this->_controller->getActionPath());
     $form->setCSRFToken($this->_controller->getCSRFToken());
     $field = $form->newField();
     $field->setLegend($this->_applicationPage->getTitle());
     $field->setInstructions($this->_applicationPage->getInstructions());
     if ($allowedTypesCount == 1 and !$this->_controller instanceof \Jazzee\AdminController) {
         $paymentType = $this->_controller->getEntityManager()->getRepository('\\Jazzee\\Entity\\PaymentType')->findOneBy(array('id' => $allowedTypes[0], 'isExpired' => false));
         $element = $field->newElement('Plaintext', 'paymentTypeName');
         $element->setLabel('Payment Method');
         $element->setValue($paymentType->getName());
         $form->newHiddenElement('paymentType', $paymentType->getId());
     } else {
         $element = $field->newElement('SelectList', 'paymentType');
         $element->setLabel('Payment Method');
         $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element));
         $paymentTypes = $this->_controller->getEntityManager()->getRepository('\\Jazzee\\Entity\\PaymentType')->findBy(array('isExpired' => false), array('name' => 'ASC'));
         foreach ($paymentTypes as $type) {
             if ($this->_controller instanceof \Jazzee\AdminController or in_array($type->getId(), $allowedTypes)) {
                 $element->newItem($type->getId(), $type->getName());
             }
         }
     }
     if ($amounts == 1) {
         $element = $field->newElement('Plaintext', 'amountText');
         $element->setLabel('Type of payment');
         $element->setValue($this->_applicationPage->getPage()->getVar('description1'));
         $form->newHiddenElement('amount', $this->_applicationPage->getPage()->getVar('amount1'));
     } else {
         $element = $field->newElement('RadioList', 'amount');
         $element->setLabel('Type of payment');
         $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element));
         for ($i = 1; $i <= $amounts; $i++) {
             $element->newItem($this->_applicationPage->getPage()->getVar('amount' . $i), $this->_applicationPage->getPage()->getVar('description' . $i));
         }
         $element->setValue($this->_applicationPage->getPage()->getVar('amount1'));
     }
     $form->newHiddenElement('level', 1);
     $form->newButton('submit', 'Select');
     return $form;
 }
Example #12
0
 public function paymentForm(\Jazzee\Entity\Applicant $applicant, $amount)
 {
     $form = new \Foundation\Form();
     $form->setAction($this->_controller->getActionPath());
     $form->newHiddenElement('amount', $amount);
     $field = $form->newField();
     $field->setLegend($this->_paymentType->getName());
     $element = $field->newElement('Textarea', 'justification');
     $element->setLabel('What is your reason for applying for a fee waiver?');
     $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element));
     $element->addValidator(new \Foundation\Form\Validator\MaximumLength($element, 5000));
     $form->newButton('submit', 'Apply for Fee Waiver');
     return $form;
 }
Example #13
0
 /**
  * Make the form for the page
  * @return \Foundation\Form
  */
 protected function makeForm()
 {
     $form = new \Foundation\Form();
     $form->setAction($this->_controller->getActionPath());
     $field = $form->newField();
     $field->setLegend($this->_applicationPage->getTitle());
     $field->setInstructions($this->_applicationPage->getInstructions());
     foreach ($this->_applicationPage->getPage()->getElements() as $element) {
         $element->getJazzeeElement()->setController($this->_controller);
         $element->getJazzeeElement()->addToField($field);
     }
     $form->newButton('submit', 'Save');
     return $form;
 }
Example #14
0
 /**
  * Initial form is for school search
  */
 protected function makeForm()
 {
     $form = new \Foundation\Form();
     $form->setAction($this->_controller->getActionPath());
     $field = $form->newField();
     $field->setLegend($this->_applicationPage->getTitle());
     $field->setInstructions($this->_applicationPage->getInstructions());
     $element = $field->newElement('TextInput', 'schoolSearch');
     $element->setLabel('Search for School');
     $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element));
     $form->newButton('submit', 'Search');
     $form->newHiddenElement('level', 'search');
     $form->getElementByName('submit')->setValue('Search');
     return $form;
 }
Example #15
0
 /**
  * Branching Page Form
  * Replaces the form with the correct branch
  * @param \Jazzee\Entity\Page $page
  */
 protected function branchingForm(\Jazzee\Entity\Page $page)
 {
     $form = new \Foundation\Form();
     $form->setAction($this->_controller->getActionPath());
     $field = $form->newField();
     $field->setLegend($this->_applicationPage->getTitle());
     $field->setInstructions($page->getInstructions());
     foreach ($page->getElements() as $element) {
         $element->getJazzeeElement()->setController($this->_controller);
         $element->getJazzeeElement()->addToField($field);
     }
     $form->newHiddenElement('level', 2);
     $form->newHiddenElement('branching', $page->getId());
     $form->newButton('submit', 'Save');
     $this->_form = $form;
 }
Example #16
0
 /**
  * Search GRE Scores
  */
 public function actionIndex()
 {
     $form = new \Foundation\Form();
     $form->setCSRFToken($this->getCSRFToken());
     $form->setAction($this->path('scores/gre'));
     $field = $form->newField();
     $field->setLegend('Search GRE Scores');
     $element = $field->newElement('TextInput', 'firstName');
     $element->setLabel('First Name');
     $element = $field->newElement('TextInput', 'lastName');
     $element->setLabel('Last Name');
     $form->newButton('submit', 'Search');
     $this->setVar('form', $form);
     if ($input = $form->processInput($this->post)) {
         $results = $this->_em->getRepository('\\Jazzee\\Entity\\GREScore')->findByName($input->get('firstName') . '%', $input->get('lastName') . '%');
         $this->setVar('results', $results);
     }
 }
Example #17
0
 /**
  * Display index
  */
 public function actionIndex()
 {
     $form = new \Foundation\Form();
     $form->setCSRFToken($this->getCSRFToken());
     $form->setAction($this->path('changeprogram'));
     $field = $form->newField();
     $field->setLegend('Select Program');
     $element = $field->newElement('SelectList', 'program');
     $element->setLabel('Program');
     $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element));
     $programs = $this->_em->getRepository('\\Jazzee\\Entity\\Program')->findBy(array('isExpired' => false), array('name' => 'ASC'));
     $userPrograms = $this->_user->getPrograms();
     foreach ($programs as $program) {
         if ($this->checkIsAllowed($this->controllerName, 'anyProgram') or in_array($program->getId(), $userPrograms)) {
             $element->newItem($program->getId(), $program->getName());
         }
     }
     if ($this->_program) {
         $element->setValue($this->_program->getId());
     }
     //only ask if the user already has a default cycle
     if ($this->_user->getDefaultProgram()) {
         $element = $field->newElement('RadioList', 'default');
         $element->setLabel('Set as your default');
         $element->newItem(0, 'No');
         $element->newItem(1, 'Yes');
         $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element));
     }
     $form->newButton('submit', 'Change Program');
     if ($input = $form->processInput($this->post)) {
         $this->_program = $this->_em->getRepository('\\Jazzee\\Entity\\Program')->find($input->get('program'));
         //if they wish it, or if the user has no default cycle
         if (!$this->_user->getDefaultProgram() or $input->get('default')) {
             $this->_user->setDefaultProgram($this->_program);
             $this->_em->persist($this->_user);
             $this->addMessage('success', 'Default program changed to ' . $this->_program->getName());
         }
         unset($this->_store->AdminControllerGetNavigation);
         $this->addMessage('success', 'Program changed to ' . $this->_program->getName());
         $this->redirectPath('welcome');
     }
     $this->setVar('form', $form);
 }
Example #18
0
 /**
  * Edit a user
  * @param integer $userID
  */
 public function actionEdit($userID)
 {
     if ($user = $this->_em->getRepository('\\Jazzee\\Entity\\User')->find($userID)) {
         $form = new \Foundation\Form();
         $form->setCSRFToken($this->getCSRFToken());
         $form->setAction($this->path('setup/users/edit/' . $userID));
         $field = $form->newField();
         $field->setLegend('Roles for ' . $user->getFirstName() . ' ' . $user->getLastName());
         $element = $field->newElement('CheckboxList', 'roles');
         $element->setLabel('Program Roles');
         foreach ($this->_em->getRepository('\\Jazzee\\Entity\\Role')->findBy(array('program' => $this->_program->getId())) as $role) {
             $element->newItem($role->getId(), $role->getName());
         }
         $values = array();
         foreach ($user->getRoles() as $role) {
             $values[] = $role->getId();
         }
         $element->setValue($values);
         $form->newButton('submit', 'Save Changes');
         $this->setVar('form', $form);
         if ($input = $form->processInput($this->post)) {
             //clear out all current program roles
             foreach ($user->getRoles() as $role) {
                 if ($role->getProgram() == $this->_program) {
                     $user->getRoles()->removeElement($role);
                 }
             }
             $roles = $input->get('roles');
             if (!empty($roles)) {
                 foreach ($input->get('roles') as $roleID) {
                     if ($role = $this->_em->getRepository('\\Jazzee\\Entity\\Role')->findOneBy(array('id' => $roleID, 'program' => $this->_program->getId()))) {
                         $user->addRole($role);
                     }
                 }
             }
             $this->_em->persist($user);
             $this->addMessage('success', "Changes Saved Successfully");
             $this->redirectPath('setup/users');
         }
     } else {
         $this->addMessage('error', "Error: User #{$userID} does not exist.");
     }
 }
Example #19
0
 /**
  * Display a form which posts to authorize.net's server
  */
 public function paymentForm(\Jazzee\Entity\Applicant $applicant, $amount)
 {
     if (\is_a($this->_controller, 'ApplyPageController')) {
         $time = time();
         $fpSequence = $applicant->getId() . $time;
         $form = new \Foundation\Form();
         $form->newHiddenElement('x_amount', $amount);
         $form->newHiddenElement('x_test_request', $this->_controller->getConfig()->getStatus() == 'PRODUCTION' ? 0 : 1);
         $form->newHiddenElement('x_fp_sequence', $fpSequence);
         $form->newHiddenElement('x_fp_hash', \AuthorizeNetDPM::getFingerprint($this->_paymentType->getVar('gatewayId'), $this->_paymentType->getVar('gatewayKey'), $amount, $fpSequence, $time));
         $form->newHiddenElement('x_fp_timestamp', $time);
         $form->newHiddenElement('x_relay_response', "TRUE");
         $form->newHiddenElement('x_relay_url', $this->_controller->getServerPath() . $this->_controller->getActionPath() . '/../../../../../transaction/' . \urlencode(get_class($this)));
         $form->newHiddenElement('redirect_url', $this->_controller->getServerPath() . $this->_controller->getActionPath());
         $form->newHiddenElement('x_login', $this->_paymentType->getVar('gatewayId'));
         $form->newHiddenElement('x_cust_id', $applicant->getId());
         $form->newHiddenElement('x_customer_ip', $_SERVER['REMOTE_ADDR']);
         $form->newHiddenElement('x_email', $applicant->getEmail());
         $form->newHiddenElement('x_email_customer', 0);
         $form->newHiddenElement('x_description', $this->_paymentType->getVar('description'));
         $form->setAction($this->_paymentType->getVar('testAccount') ? \AuthorizeNetDPM::SANDBOX_URL : \AuthorizeNetDPM::LIVE_URL);
         $field = $form->newField();
         $field->setLegend($this->_paymentType->getName());
         $field->setInstructions("<p><strong>Application Fee:</strong> &#36;{$amount}</p>");
         $element = $field->newElement('TextInput', 'x_card_num');
         $element->setLabel('Credit Card Number');
         $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element));
         $element = $field->newElement('TextInput', 'x_exp_date');
         $element->setLabel('Expiration Date');
         $element->setFormat('mm/yy eg ' . date('m/y'));
         $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element));
         $element = $field->newElement('TextInput', 'x_card_code');
         $element->setLabel('CCV');
         $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element));
         $element = $field->newElement('TextInput', 'x_zip');
         $element->setLabel('Billing Postal Code');
         $element->setInstructions('US Credit Cards which do not provide a postal code will be rejected.');
         $form->newButton('submit', 'Pay with Credit Card');
     } else {
         $form = parent::paymentForm($applicant, $amount);
     }
     return $form;
 }
Example #20
0
 /**
  * Advanced Search Form
  */
 public function actionAdvanced()
 {
     $form = new \Foundation\Form();
     $form->setCSRFToken($this->getCSRFToken());
     $form->setAction($this->path('applicants/search/advanced'));
     $field = $form->newField();
     $field->setLegend('Advanced Search');
     $element = $field->newElement('Textarea', 'query');
     $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element));
     $element->addValidator(new \Foundation\Form\Validator\Json($element));
     $element->setLabel('Query');
     $form->newButton('submit', 'Search');
     if ($input = $form->processInput($this->post)) {
         $obj = json_decode($input->get('query'));
         $applicants = $this->_em->getRepository('\\Jazzee\\Entity\\Applicant')->findApplicantsByQuery($obj, $this, $this->_application);
         $this->setVar('applicants', $applicants);
     }
     $this->setVar('form', $form);
     $this->loadView('applicants_search/index');
 }
Example #21
0
 /**
  * Create a new virtual file
  */
 public function actionNew()
 {
     $form = new \Foundation\Form();
     $form->setAction($this->path("manage/answerstatus/new"));
     $form->setCSRFToken($this->getCSRFToken());
     $field = $form->newField();
     $field->setLegend('New Answer Status');
     $element = $field->newElement('TextInput', 'name');
     $element->setLabel('Name');
     $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element));
     $element->addFilter(new \Foundation\Form\Filter\Safe($element));
     $form->newButton('submit', 'Save');
     $this->setVar('form', $form);
     if ($input = $form->processInput($this->post)) {
         $status = new \Jazzee\Entity\AnswerStatusType();
         $status->setName($input->get('name'));
         $this->_em->persist($status);
         $this->addMessage('success', "New Answer Status Saved");
         $this->redirectPath('manage/answerstatus');
     }
 }
Example #22
0
 /**
  * Display index
  */
 public function actionIndex()
 {
     $form = new \Foundation\Form();
     $form->setAction($this->path('changecycle'));
     $form->setCSRFToken($this->getCSRFToken());
     $field = $form->newField();
     $field->setLegend('Select Cycle');
     $element = $field->newElement('SelectList', 'cycle');
     $element->setLabel('Cycle');
     $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element));
     $cycles = $this->_em->getRepository('\\Jazzee\\Entity\\Cycle')->findAll();
     foreach ($cycles as $cycle) {
         $element->newItem($cycle->getId(), $cycle->getName());
     }
     if ($this->_cycle) {
         $element->setValue($this->_cycle->getId());
     }
     //only ask if the user already has a default cycle
     if ($this->_user->getDefaultCycle()) {
         $element = $field->newElement('RadioList', 'default');
         $element->setLabel('Set as your default');
         $element->newItem(0, 'No');
         $element->newItem(1, 'Yes');
         $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element));
     }
     $form->newButton('submit', 'Change Cycle');
     if ($input = $form->processInput($this->post)) {
         $this->_cycle = $this->_em->getRepository('\\Jazzee\\Entity\\Cycle')->find($input->get('cycle'));
         //if they wish it, or if the user has no default cycle
         if (!$this->_user->getDefaultCycle() or $input->get('default')) {
             $this->_user->setDefaultCycle($this->_cycle);
             $this->_em->persist($this->_user);
             $this->addMessage('success', 'Default cycle changed to ' . $this->_cycle->getName());
         }
         unset($this->_store->AdminControllerGetNavigation);
         $this->addMessage('success', 'Cycle changed to ' . $this->_cycle->getName());
         $this->redirectPath('welcome');
     }
     $this->setVar('form', $form);
 }
Example #23
0
 /**
  * Test Email Communication
  */
 public function actionTest()
 {
     $form = new \Foundation\Form();
     $form->setCSRFToken($this->getCSRFToken());
     $form->setAction($this->path('manage/mail/test'));
     $field = $form->newField();
     $field->setLegend('Send Test Email');
     $element = $field->newElement('TextInput', 'address');
     $element->setLabel('To');
     $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element));
     $element->addValidator(new \Foundation\Form\Validator\EmailAddress($element));
     $form->newButton('submit', 'Send Test');
     $this->setVar('form', $form);
     if ($input = $form->processInput($this->post)) {
         $message = $this->newMailMessage();
         $message->AddAddress($input->get('address'));
         $message->Subject = 'Test Email';
         $message->Body = 'This is a test email from the application system.';
         $message->Send();
         $this->addMessage('success', "Test Email Sent");
         $this->redirectPath('manage/mail');
     }
 }
Example #24
0
 /**
  * Credit card payment form
  * Different form for administrators
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function paymentForm(\Jazzee\Entity\Applicant $applicant, $amount)
 {
     $form = new \Foundation\Form();
     //we pass the amount back as a hidden element so PaymentPage will have it again
     $form->newHiddenElement('amount', $amount);
     $form->setAction($this->_controller->getActionPath());
     $field = $form->newField();
     $field->setLegend($this->_paymentType->getName());
     if (\is_a($this->_controller, 'ApplyPageController')) {
         $field->setInstructions("<p><strong>Application Fee:</strong> &#36;{$amount}</p>");
         $element = $field->newElement('TextInput', 'cardNumber');
         $element->setLabel('Credit Card Number');
         $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element));
         $element->addValidator(new \Foundation\Form\Validator\CreditCard($element, explode(',', $this->_paymentType->getVar('acceptedCards'))));
         $element = $field->newElement('ShortDateInput', 'expirationDate');
         $element->setLabel('Expiration Date');
         $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element));
         $element->addValidator(new \Foundation\Form\Validator\DateAfter($element, 'last month'));
         $element->addFilter(new \Foundation\Form\Filter\DateFormat($element, 'mY'));
         $element = $field->newElement('TextInput', 'cardCode');
         $element->setLabel('CCV');
         $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element));
         $element = $field->newElement('TextInput', 'postalCode');
         $element->setLabel('Billing Postal Code');
         $element->setInstructions('US Credit Cards which do not provide a postal code will be rejected.');
         $form->newButton('submit', 'Pay with Credit Card');
     } else {
         if (\is_a($this->_controller, 'ApplicantsSingleController')) {
             $field->setInstructions("<p>Credit card details should be enterd directly at the authorize.net website and then the transaction entered here.</p>");
             $element = $field->newElement('TextInput', 'transactionId');
             $element->setLabel('Transaction ID');
             $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element));
             $form->newButton('submit', 'Lookup Transaction');
         }
     }
     return $form;
 }
 /**
  * Create a new preview
  */
 public function actionNew()
 {
     $form = new \Foundation\Form();
     $form->setCSRFToken($this->getCSRFToken());
     $form->setAction($this->path("setup/previewapplication/new"));
     $field = $form->newField();
     $field->setLegend('Create New Preview');
     $element = $field->newElement('SelectList', 'adminRole');
     $element->setLabel('Admin Role');
     $element->setInstructions('If you specifiy and admin role then anyone using the preview will be able to access the administrator functions using this role.  They will only be able to see applicants in the prevew application.');
     $element->newItem('', 'No access');
     foreach ($this->_em->getRepository('\\Jazzee\\Entity\\Role')->findByProgram($this->_program->getId()) as $role) {
         $element->newItem($role->getId(), $role->getName());
     }
     $form->newButton('submit', 'Create Preview');
     if ($input = $form->processInput($this->post)) {
         if ($input->get('adminRole')) {
             $adminRole = $this->_em->getRepository('\\Jazzee\\Entity\\Role')->findOneBy(array('program' => $this->_program->getId(), 'id' => $input->get('adminRole')));
         } else {
             $adminRole = new \Jazzee\Entity\Role();
             $adminRole->setName('No Access');
         }
         $prefix = substr(md5(mt_rand() * mt_rand()), rand(0, 24), rand(6, 8));
         //clean out any wierd chars in program or cycle name
         $key = preg_replace("/[^a-z0-9\\._-]/i", '', $this->_program->getShortName() . $this->_cycle->getName()) . '-' . time() . '-' . \uniqid($prefix);
         $path = $this->getPathString($key);
         $doctrineConfig = $this->_em->getConfiguration();
         $connectionParams = array('driver' => 'pdo_sqlite', 'path' => $path);
         $previewEntityManager = \Doctrine\ORM\EntityManager::create($connectionParams, $doctrineConfig);
         $this->buildTemporaryDatabase($previewEntityManager);
         $this->createPreviewApplication($previewEntityManager, $adminRole);
         $this->addMessage('success', 'Created preview');
         $this->redirectPath('setup/previewapplication');
     }
     $this->setVar('form', $form);
 }
Example #26
0
 /**
  * Get a form for a specific status text var
  * @param string $status
  * @return \Foundation\Form
  */
 protected function getStatusForm($status)
 {
     $form = new \Foundation\Form();
     $form->setCSRFToken($this->getCSRFToken());
     $form->setAction($this->path("setup/application/editStatus{$status}"));
     $field = $form->newField();
     $field->setLegend("Edit {$status} Page");
     $search = array('_Applicant_Name_', '_Application_Deadline_', '_Offer_Response_Deadline_', '_SIR_Link_', '_Admit_Letter_', '_Deny_Letter_', '_Admit_Date_', '_Deny_Date_', '_Accept_Date_', '_Decline_Date_');
     $field->setInstructions('You can use these tokens in the text, they will be replaced automatically: <br />' . implode('</br />', $search));
     $element = $field->newElement('Textarea', 'message');
     $element->setLabel('Message');
     $func = "getStatus{$status}Text";
     $element->setValue($this->_application->{$func}());
     $element->addFilter(new \Foundation\Form\Filter\SafeHTML($element));
     $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element));
     $form->newButton('submit', 'Save');
     return $form;
 }
Example #27
0
 /**
  * Create a new pagetype
  */
 public function actionNew()
 {
     $form = new \Foundation\Form();
     $form->setCSRFToken($this->getCSRFToken());
     $form->setAction($this->path('setup/roles/new'));
     $field = $form->newField();
     $field->setLegend('New program role');
     $element = $field->newElement('TextInput', 'name');
     $element->setLabel('Role Name');
     $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element));
     $element->addFilter(new \Foundation\Form\Filter\Safe($element));
     $form->newButton('submit', 'Add Role');
     $this->setVar('form', $form);
     if ($input = $form->processInput($this->post)) {
         $role = new \Jazzee\Entity\Role();
         $role->notGLobal();
         $role->setProgram($this->_program);
         $role->setName($input->get('name'));
         $this->_em->persist($role);
         $display = new \Jazzee\Entity\Display('role');
         $display->setRole($role);
         $display->setApplication($this->_application);
         $display->setName($role->getName() . ' display');
         foreach ($this->_user->getMaximumDisplayForApplication($this->_application)->listElements() as $userDisplayElement) {
             $displayElement = \Jazzee\Entity\DisplayElement::createFromDisplayElement($userDisplayElement, $this->_application);
             $display->addElement($displayElement);
             $this->getEntityManager()->persist($displayElement);
         }
         $this->_em->persist($display);
         $this->_em->flush();
         $this->addMessage('success', "Role Saved Successfully");
         $this->redirectPath('setup/roles');
     }
 }
Example #28
0
 /**
  * Setup the current application and cycle
  */
 public function actionIndex()
 {
     $form = new \Foundation\Form();
     $form->setCSRFToken($this->getCSRFToken());
     $form->setAction($this->path("setup/copyapplication"));
     $field = $form->newField();
     $field->setLegend('Import Application');
     $element = $field->newElement('SelectList', 'application');
     $element->setLabel('Cycle to Copy');
     $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element));
     $applications = $this->_em->getRepository('\\Jazzee\\Entity\\Application')->findByProgram($this->_program);
     foreach ($applications as $application) {
         $element->newItem($application->getId(), $application->getCycle()->getName());
     }
     $form->newButton('submit', 'Copy');
     if ($input = $form->processInput($this->post)) {
         $previousApplication = $this->_em->getRepository('\\Jazzee\\Entity\\Application')->find($input->get('application'));
         $this->_application = new \Jazzee\Entity\Application();
         $this->_application->setProgram($this->_program);
         $this->_application->setCycle($this->_cycle);
         $this->_application->inVisible();
         $this->_application->unPublish();
         if ($previousApplication->isByInvitationOnly()) {
             $this->_application->byInvitationOnly();
         }
         $this->_application->setContactName($previousApplication->getContactName());
         $this->_application->setContactEmail($previousApplication->getContactEmail());
         $this->_application->setWelcome($previousApplication->getWelcome());
         $this->_application->setOpen($previousApplication->getOpen()->format('c'));
         $this->_application->setClose($previousApplication->getClose()->format('c'));
         $this->_application->setBegin($previousApplication->getBegin()->format('c'));
         $this->_application->setStatusIncompleteText($previousApplication->getStatusIncompleteText());
         $this->_application->setStatusNoDecisionText($previousApplication->getStatusNoDecisionText());
         $this->_application->setStatusAdmitText($previousApplication->getStatusAdmitText());
         $this->_application->setStatusDenyText($previousApplication->getStatusDenyText());
         $this->_application->setStatusAcceptText($previousApplication->getStatusAcceptText());
         $this->_application->setStatusDeclineText($previousApplication->getStatusDeclineText());
         foreach ($previousApplication->getApplicationPages() as $previousPage) {
             $page = $this->addPage($previousPage->getPage());
             $applicationPage = new \Jazzee\Entity\ApplicationPage();
             $applicationPage->setApplication($this->_application);
             $applicationPage->setPage($page);
             $applicationPage->setKind($previousPage->getKind());
             $applicationPage->setTitle($previousPage->getTitle());
             $applicationPage->setMin($previousPage->getMin());
             $applicationPage->setMax($previousPage->getMax());
             $applicationPage->setName($previousPage->getName());
             if ($previousPage->isRequired()) {
                 $applicationPage->required();
             } else {
                 $applicationPage->optional();
             }
             if ($previousPage->answerStatusDisplay()) {
                 $applicationPage->showAnswerStatus();
             } else {
                 $applicationPage->hideAnswerStatus();
             }
             $applicationPage->setInstructions($previousPage->getInstructions());
             $applicationPage->setLeadingText($previousPage->getLeadingText());
             $applicationPage->setTrailingText($previousPage->getTrailingText());
             $applicationPage->setWeight($previousPage->getWeight());
             $this->_em->persist($applicationPage);
         }
         $templates = $this->_em->getRepository('Jazzee\\Entity\\Template')->findBy(array('application' => $previousApplication));
         foreach ($templates as $previousTemplate) {
             $template = new \Jazzee\Entity\Template($previousTemplate->getType());
             $template->setApplication($this->_application);
             $template->setTitle($previousTemplate->getTitle());
             $template->setText($previousTemplate->getText());
             $this->_em->persist($template);
         }
         $this->_em->persist($this->_application);
         $this->addMessage('success', 'Application copied successfully');
         unset($this->_store->AdminControllerGetNavigation);
         $this->redirectPath('setup/application');
     }
     $this->setVar('form', $form);
 }
Example #29
0
 /**
  * Create a new cycle
  */
 public function actionNew()
 {
     $form = new \Foundation\Form();
     $form->setCSRFToken($this->getCSRFToken());
     $form->setAction($this->path("manage/cycles/new"));
     $field = $form->newField();
     $field->setLegend('New cycle');
     $element = $field->newElement('TextInput', 'name');
     $element->setLabel('Cycle Name');
     $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element));
     $element->addFilter(new \Foundation\Form\Filter\UrlSafe($element));
     $element->addFilter(new \Foundation\Form\Filter\Safe($element));
     $element = $field->newElement('DateInput', 'start');
     $element->setLabel('Start Date');
     $element->addValidator(new \Foundation\Form\Validator\DateBeforeElement($element, 'end'));
     $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element));
     $element = $field->newElement('DateInput', 'end');
     $element->setLabel('End Date');
     $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element));
     $form->newButton('submit', 'Save Changes');
     $this->setVar('form', $form);
     if ($input = $form->processInput($this->post)) {
         if (count($this->_em->getRepository('\\Jazzee\\Entity\\Cycle')->findBy(array('name' => $input->get('name'))))) {
             $this->addMessage('error', "A cycle with that name already exists");
         } else {
             $cycle = new \Jazzee\Entity\Cycle();
             $cycle->setName($input->get('name'));
             $cycle->setStart($input->get('start'));
             $cycle->setEnd($input->get('end'));
             $this->_em->persist($cycle);
             $this->_em->flush();
             $this->addMessage('success', "New Cycle Saved");
             $this->redirectPath("manage/cycles/edit/{$cycle->getId()}");
         }
     }
 }
Example #30
0
 /**
  * List all applicants
  */
 public function actionIndex()
 {
     $form = new \Foundation\Form();
     $form->setCSRFToken($this->getCSRFToken());
     $form->setAction($this->path('applicants/download'));
     $field = $form->newField();
     $field->setLegend('Download Applicants');
     $element = $field->newElement('RadioList', 'type');
     $element->setLabel('Type of Download');
     $element->newItem('xls', 'Excel');
     $element->newItem('xml', 'XML');
     $element->newItem('json', 'JSON');
     $element->newItem('pdfarchive', 'Archive of Multiple PDFs');
     $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element));
     $element = $field->newElement('CheckboxList', 'filters');
     $element->setLabel('Types of applicants');
     $element->newItem('unlocked', 'Incomplete');
     $element->newItem('locked', 'Locked');
     $element->newItem('admitted', 'Admitted');
     $element->newItem('denied', 'Denied');
     $element->newItem('accepted', 'Accepted');
     $element->newItem('declined', 'Declined');
     $tags = $this->_em->getRepository('\\Jazzee\\Entity\\Tag')->findByApplication($this->_application);
     foreach ($tags as $tag) {
         $element->newItem($tag->getId(), $tag->getTitle());
     }
     $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element));
     $element = $field->newElement('RadioList', 'display');
     $element->setLabel('Display');
     $displays = array();
     foreach ($this->listDisplays() as $key => $display) {
         $displays[$key] = $display;
         $element->newItem($key, $display['name']);
     }
     $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element));
     $form->newButton('submit', 'Download Applicants');
     if ($input = $form->processInput($this->post)) {
         $filters = $input->get('filters');
         $applicationPages = array();
         foreach ($this->_application->getApplicationPages(\Jazzee\Entity\ApplicationPage::APPLICATION) as $pageEntity) {
             $pageEntity->getJazzeePage()->setController($this);
             $applicationPages[$pageEntity->getId()] = $pageEntity;
         }
         $applicantsArray = array();
         $minimalDisplay = new \Jazzee\Display\Minimal($this->_application);
         $ids = $this->_em->getRepository('\\Jazzee\\Entity\\Applicant')->findIdsByApplication($this->_application);
         foreach ($ids as $id) {
             $applicant = $this->_em->getRepository('\\Jazzee\\Entity\\Applicant')->findArray($id, $minimalDisplay);
             $selected = false;
             if (!$applicant['isLocked'] and in_array('unlocked', $filters)) {
                 $selected = true;
             }
             if ($applicant['isLocked']) {
                 if (in_array('locked', $filters)) {
                     $selected = true;
                 }
                 if ($applicant['decision']['finalAdmit'] and in_array('admitted', $filters)) {
                     $selected = true;
                 }
                 if ($applicant['decision']['finalDeny'] and in_array('denied', $filters)) {
                     $selected = true;
                 }
                 if ($applicant['decision']['acceptOffer'] and in_array('accepted', $filters)) {
                     $selected = true;
                 }
                 if ($applicant['decision']['declineOffer'] and in_array('declined', $filters)) {
                     $selected = true;
                 }
             }
             if (!$selected) {
                 $tagIds = array();
                 foreach ($applicant['tags'] as $arr) {
                     $tagIds[] = $arr['id'];
                 }
                 foreach ($filters as $value) {
                     if (array_key_exists($value, $tags)) {
                         $tag = $tags[$value];
                         if (in_array($tag->getId(), $tagIds)) {
                             $selected = true;
                         }
                     }
                 }
             }
             if ($selected) {
                 $applicantsArray[] = $applicant['id'];
             }
         }
         //end foreach applicants
         //use a full applicant display where display is needed
         $display = $this->getDisplay($displays[$input->get('display')]);
         unset($ids);
         switch ($input->get('type')) {
             case 'xls':
                 $this->makeXls($applicantsArray, $display);
                 break;
             case 'xml':
                 $this->makeXml($applicantsArray);
                 break;
             case 'json':
                 $this->makeJson($applicantsArray, $display);
                 break;
             case 'pdfarchive':
                 $this->makePdfArchive($applicantsArray, $display);
                 break;
         }
     }
     $this->setVar('form', $form);
 }