Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class JobsPage extends Page {
- public static $db = array(
- );
- public static $has_one = array(
- );
- public static $has_many = array (
- );
- }
- class JobsPage_Controller extends Page_Controller {
- static $allowed_actions = array (
- 'ShowJob'
- );
- function ApplyForm() {
- $fields = new FieldSet(
- new TextareaField("CoverLetter", "Cover Letter")
- );
- $actions = new FieldSet(
- new FormAction("doApply", "Apply Now")
- );
- $validator = new RequiredFields("CoverLetter");
- return new Form($this, "ApplyForm", $fields, $actions, $validator);
- }
- function ShowJob() {
- $params = Director::urlParams();
- $id = (int)$params['ID'];
- $object = DataObject::get_one('job', 'ID='.$id);
- if($object) {
- return $this
- ->customise(array('JobObject' => $object, 'ApplyForm' => $this->ApplyForm()))
- ->renderWith(array('Job_result', 'SearchPage'));
- } else {
- Director::redirect('not-found');
- }
- }
- function doApply($data, $form) {
- printf("Hello");
- //Director::redirect('services'); // Redicrect to services, so I'll know it has been reached
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement