Ejemplo n.º 1
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.");
         }
     }
 }
Ejemplo n.º 2
0
 public function testNewButton()
 {
     $form = new \Foundation\Form();
     $button = $form->newButton('submit', 'submit');
     $this->assertTrue($button instanceof \Foundation\Form\Element\ButtonInput);
     $this->assertContains($button, $form->getElements());
 }
Ejemplo n.º 3
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;
 }
Ejemplo n.º 4
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;
         }
     }
 }
Ejemplo n.º 5
0
 /**
  * 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');
 }
Ejemplo n.º 6
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');
     }
 }
Ejemplo n.º 7
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');
         }
     }
 }
Ejemplo n.º 8
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);
     }
 }
Ejemplo n.º 9
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;
 }
Ejemplo n.º 10
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;
 }
Ejemplo n.º 11
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;
 }
Ejemplo n.º 12
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);
     }
 }
Ejemplo n.º 13
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);
 }
Ejemplo n.º 14
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;
 }
Ejemplo n.º 15
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.");
     }
 }
Ejemplo n.º 16
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');
     }
 }
Ejemplo n.º 17
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);
 }
Ejemplo n.º 18
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');
     }
 }
Ejemplo n.º 19
0
 /**
  * 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);
 }
Ejemplo n.º 20
0
 /**
  * New Message to applicant
  * @param $applicantId
  */
 public function actionNew($applicantId = false)
 {
     if ($applicantId) {
         $applicant = $this->getApplicantById($applicantId);
     }
     $form = new \Foundation\Form();
     $path = 'applicants/messages/new';
     if ($applicantId) {
         $path .= '/' . $applicantId;
     }
     $form->setAction($this->path($path));
     $field = $form->newField();
     $field->setLegend('New Message');
     if ($applicantId) {
         $element = $field->newElement('Plaintext', 'name');
         $element->setLabel('To');
         $element->setValue($applicant->getFullName());
         $element = $field->newElement('HiddenInput', 'to');
         $element->setValue($applicant->getId());
     } else {
         $element = $field->newElement('SelectList', 'to');
         $element->setLabel('To');
         foreach ($this->_em->getRepository('\\Jazzee\\Entity\\Applicant')->findApplicantsByName('%', '%', $this->_application) as $applicant) {
             $element->newItem($applicant->getId(), $applicant->getLastName() . ', ' . $applicant->getFirstName());
         }
         $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element));
     }
     $element = $field->newElement('TextInput', 'subject');
     $element->setLabel('Subject');
     $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element));
     $element->addFilter(new \Foundation\Form\Filter\SafeHTML($element));
     $element = $field->newElement('Textarea', 'text');
     $element->setLabel('Message');
     $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element));
     $element->addFilter(new \Foundation\Form\Filter\SafeHTML($element));
     $form->newButton('submit', 'Submit');
     $this->setVar('form', $form);
     if ($input = $form->processInput($this->post)) {
         $thread = new \Jazzee\Entity\Thread();
         $thread->setSubject($input->get('subject'));
         $applicant = $this->getApplicantById($input->get('to'));
         $thread->setApplicant($applicant);
         $message = new \Jazzee\Entity\Message();
         $message->setSender(\Jazzee\Entity\Message::PROGRAM);
         $message->setText($input->get('text'));
         $thread->addMessage($message);
         $this->_em->persist($thread);
         $this->_em->persist($message);
         $this->addMessage('success', 'Your message has been sent.');
         $this->redirectPath('applicants/messages');
     }
 }
Ejemplo n.º 21
0
 /**
  * Change applicant password
  */
 public function actionChangePassword()
 {
     $form = new \Foundation\Form();
     $form->setCSRFToken($this->getCSRFToken());
     $form->setAction($this->applyPath('account/changePassword'));
     $field = new \Foundation\Form\Field($form);
     $field->setLegend('Change Password');
     $form->addField($field);
     $element = $field->newElement('PasswordInput', 'password');
     $element->setLabel('Current Password');
     $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element));
     $element = $field->newElement('PasswordInput', 'newpassword');
     $element->setLabel('New Password');
     $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element));
     $element = $field->newElement('PasswordInput', 'confirm');
     $element->setLabel('Confirm Password');
     $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element));
     $element->addValidator(new \Foundation\Form\Validator\SameAs($element, 'newpassword'));
     $form->newButton('submit', 'Change Password');
     if ($input = $form->processInput($this->post)) {
         if ($this->_applicant->checkPassword($input->get('password'))) {
             $this->_applicant->setPassword($input->get('newpassword'));
             $this->_em->persist($this->_applicant);
             $this->addMessage('success', 'Your password was changed successfully.');
             $this->redirectApplyPath('account');
         } else {
             $form->getElementByName('password')->addMessage('Password Incorrect');
         }
     }
     $this->setVar('form', $form);
     $this->loadView($this->controllerName . '/form');
 }
Ejemplo n.º 22
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()}");
         }
     }
 }
Ejemplo n.º 23
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);
 }
Ejemplo n.º 24
0
 /**
  * Edit an applicants external ID
  * @param integer $applicantId
  */
 public function actionEditExternalId($applicantId)
 {
     $applicant = $this->getApplicantById($applicantId);
     $form = new \Foundation\Form();
     $form->setAction($this->path("applicants/single/{$applicantId}/editExternalId"));
     $field = $form->newField();
     $field->setLegend('Change External ID for ' . $applicant->getFirstName() . ' ' . $applicant->getLastName());
     $element = $field->newElement('TextInput', 'externalId');
     $element->setLabel('External ID');
     $element->setFormat('Clear to remove the id');
     $element->setValue($applicant->getExternalId());
     $element->addValidator(new \Foundation\Form\Validator\SpecialObject($element, array('object' => $this->_application, 'method' => 'validateExternalId', 'errorMessage' => 'This is not a valid External ID for this program.')));
     $form->newButton('submit', 'Apply');
     if (!empty($this->post)) {
         $this->setLayoutVar('textarea', true);
         if ($input = $form->processInput($this->post)) {
             if ($input->get('externalId')) {
                 $applicant->setExternalId($input->get('externalId'));
                 $this->auditLog($applicant, 'External ID set to ' . $applicant->getExternalId());
                 $this->_em->persist($applicant);
                 $this->setLayoutVar('status', 'success');
             } else {
                 $applicant->setExternalId(null);
                 $this->auditLog($applicant, 'Removed External ID');
                 $this->_em->persist($applicant);
                 $this->setLayoutVar('status', 'success');
             }
         } else {
             $this->setLayoutVar('status', 'error');
         }
     }
     $this->setVar('result', array('actions' => $this->getActions($applicant)));
     $this->setVar('form', $form);
     $this->loadView('applicants_single/form');
 }
Ejemplo n.º 25
0
 /**
  * Edit a template
  */
 public function actionEdit($id)
 {
     if ($template = $this->_application->getTemplateById($id)) {
         $pdfLib = new PDFLib();
         $pdfLib->set_option("errorpolicy=exception");
         $tmpFile = tempnam($this->_config->getVarPath() . '/tmp/', 'pdftemplate');
         $document = $pdfLib->open_pdi_document($template->getTmpFilePath(), "");
         $pagecount = $pdfLib->pcos_get_number($document, "length:pages");
         $blocks = array();
         for ($pageNum = 0; $pageNum < $pagecount; $pageNum++) {
             $blockcount = $pdfLib->pcos_get_number($document, "length:pages[{$pageNum}]/blocks");
             for ($blockNum = 0; $blockNum < $blockcount; $blockNum++) {
                 $blocks[] = $pdfLib->pcos_get_string($document, "pages[{$pageNum}]/blocks[{$blockNum}]/Name");
             }
         }
         $blocks = array_unique($blocks);
         $form = new \Foundation\Form();
         $form->setCSRFToken($this->getCSRFToken());
         $form->setAction($this->path("setup/pdftemplates/edit/" . $template->getId()));
         $field = $form->newField();
         $field->setLegend('Edit Template Blocks');
         $element = $field->newElement('TextInput', 'title');
         $element->setLabel('Title');
         $element->setValue($template->getTitle());
         $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element));
         $blockElements = array('applicant-firstName' => 'Applicant: First Name', 'applicant-lastName' => 'Applicant: Last Name', 'applicant-middleName' => 'Applicant: Middle Name', 'applicant-suffix' => 'Applicant: Suffix', 'applicant-fullName' => 'Applicant: Full Name', 'applicant-email' => 'Applicant: Email', 'applicant-id' => 'Applicant: ID', 'applicant-externalid' => 'Applicant: External ID');
         foreach ($this->_application->getApplicationPages() as $applicationPage) {
             if ($applicationPage->getJazzeePage() instanceof \Jazzee\Interfaces\PdfPage) {
                 foreach ($applicationPage->getJazzeePage()->listPdfTemplateElements() as $key => $title) {
                     $blockElements[$key] = $title;
                 }
             }
         }
         foreach ($blocks as $blockName) {
             $element = $field->newElement('SelectList', 'block_' . $blockName);
             $element->setLabel("Block {$blockName}");
             $element->newItem(null, '');
             foreach ($blockElements as $id => $title) {
                 $element->newItem($id, $title);
             }
             if ($template->hasBlock($blockName)) {
                 $blockData = $template->getBlock($blockName);
                 switch ($blockData['type']) {
                     case 'applicant':
                         $element->setValue('applicant-' . $blockData['element']);
                         break;
                     case 'page':
                         $element->setValue('page-' . $blockData['pageId'] . '-element-' . $blockData['elementId']);
                         break;
                 }
             }
         }
         if ($input = $form->processInput($this->post)) {
             $template->setTitle($input->get('title'));
             $template->clearBlocks();
             $matches = array();
             //initialize for use in preg_match
             foreach ($blocks as $blockName) {
                 if ($blockElement = $input->get('block_' . $blockName)) {
                     if (preg_match('#applicant-([a-z]+)#i', $blockElement, $matches)) {
                         $template->addBlock($blockName, array('type' => 'applicant', 'element' => $matches[1]));
                     } else {
                         if (preg_match('#page-([0-9]+)-element-([0-9]+)#i', $blockElement, $matches)) {
                             $template->addBlock($blockName, array('type' => 'page', 'pageId' => $matches[1], 'elementId' => $matches[2]));
                         }
                     }
                 }
             }
             $this->getEntityManager()->persist($template);
             $this->addMessage('success', 'Template Saved Successfully');
             $this->redirectPath('setup/pdftemplates');
         }
         $form->newButton('submit', 'Save');
         $this->setVar('form', $form);
     } else {
         $this->addMessage('error', 'Unable to edit template.  It is not associated with this application.');
         $this->redirectPath('setup/pdftemplates');
     }
 }
Ejemplo n.º 26
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);
 }
Ejemplo n.º 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');
     }
 }
Ejemplo n.º 28
0
 /**
  * Create a form to choose a school
  * @param array $choices
  */
 protected function pickSchoolForm($choices)
 {
     $form = new \Foundation\Form();
     $field = $form->newField();
     $field->setLegend($this->_applicationPage->getTitle());
     $field->setInstructions($this->_applicationPage->getInstructions());
     $element = $field->newElement('RadioList', 'pickSchoolId');
     $element->setLabel('Choose School');
     $element->newItem(null, 'Enter a new School');
     $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element));
     asort($choices);
     foreach ($choices as $id => $value) {
         $element->newItem($id, $value);
     }
     $form->newHiddenElement('level', 'pick');
     $form->newButton('submit', 'Next');
     $this->_form = $form;
 }
Ejemplo n.º 29
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;
 }
Ejemplo n.º 30
0
 /**
  * Record the reason the payment was refunded
  * @see ApplyPaymentInterface::rejectPaymentForm()
  */
 public function getRefundPaymentForm(\Jazzee\Entity\Payment $payment)
 {
     $form = new \Foundation\Form();
     $field = $form->newField();
     $field->setLegend('Refund Payment');
     $field->setInstructions('Transactions have to be refunded by UCLA.  After refunding this transaction enter details into this system for record keeping.');
     $element = $field->newElement('TextInput', 'transactionId');
     $element->setLabel('Refund Transaction ID');
     $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element));
     $element = $field->newElement('Textarea', 'refundedReason');
     $element->setLabel('Reason displayed to Applicant');
     $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element));
     $form->newButton('submit', 'Save');
     return $form;
 }