/** * * @param <type> $request */ public function execute($request) { $param = null; $this->candidateId = null; $this->vacancyId = $request->getParameter('id'); //$this->candidateId = $request->getParameter('candidateId'); $this->getResponse()->setTitle(__("Vacancy Apply Form")); //$param = array('candidateId' => $this->candidateId); $this->setForm(new ApplyVacancyForm(array(), $param, true)); if ($this->getUser()->hasFlash('templateMessage')) { list($this->messageType, $this->message) = $this->getUser()->getFlash('templateMessage'); } if (!empty($this->vacancyId)) { $vacancy = $this->getVacancyService()->getVacancyById($this->vacancyId); if (empty($vacancy)) { $this->redirect('recruitmentApply/jobs.html'); } $this->description = $vacancy->getDescription(); $this->name = $vacancy->getName(); } else { $this->redirect('recruitmentApply/jobs.html'); } if ($request->isMethod('post')) { $this->form->bind($request->getParameter($this->form->getName()), $request->getFiles($this->form->getName())); $file = $request->getFiles($this->form->getName()); if ($_FILES['addCandidate']['size']['resume'] > 1024000) { $this->templateMessage = array('WARNING', __(TopLevelMessages::FILE_SIZE_SAVE_FAILURE)); } else { if ($_FILES == null) { $this->getUser()->setFlash('templateMessage', array('warning', __(TopLevelMessages::FILE_SIZE_SAVE_FAILURE))); $this->redirect('recruitmentApply/applyVacancy?id=' . $this->vacancyId); } else { if ($this->form->isValid()) { $result = $this->form->save(); if (isset($result['messageType'])) { $this->messageType = $result['messageType']; $this->message = $result['message']; } else { $this->candidateId = $result['candidateId']; if (!empty($this->candidateId)) { $this->messageType = 'success'; $this->message = __('Application Received'); } //$this->getUser()->setFlash('templateMessage', array('success', __('Your Application for the Position of ' . $this->name . ' Was Received'))); //$this->redirect('recruitmentApply/applyVacancy?id=' . $this->vacancyId . '&candidateId=' . $this->form->candidateId); } } } } } }
/** * * @param <type> $request */ public function execute($request) { $param = null; $this->candidateId = null; $this->vacancyId = $request->getParameter('id'); //$this->candidateId = $request->getParameter('candidateId'); $this->getResponse()->setTitle(__("Vacancy Apply Form")); //$param = array('candidateId' => $this->candidateId); $this->setForm(new ApplyVacancyForm(array(), $param, true)); if (!empty($this->vacancyId)) { $vacancy = $this->getVacancyService()->getVacancyById($this->vacancyId); if (empty($vacancy)) { $this->redirect('recruitmentApply/jobs.html'); } $this->description = $vacancy->getDescription(); $this->name = $vacancy->getName(); } else { $this->redirect('recruitmentApply/jobs.html'); } if ($request->isMethod('post')) { $this->form->bind($request->getParameter($this->form->getName()), $request->getFiles($this->form->getName())); $file = $request->getFiles($this->form->getName()); if ($_FILES['addCandidate']['size']['resume'] > 1024000) { $this->getUser()->setFlash('applyVacancy.warning', __(TopLevelMessages::FILE_SIZE_SAVE_FAILURE)); } else { if ($_FILES == null) { $this->getUser()->setFlash('applyVacancy.warning', __(TopLevelMessages::FILE_SIZE_SAVE_FAILURE)); $this->redirect('recruitmentApply/applyVacancy?id=' . $this->vacancyId); } else { if ($this->form->isValid()) { $result = $this->form->save(); if (isset($result['messageType'])) { $this->getUser()->setFlash('applyVacancy.' . $result['messageType'], $result['message']); } else { $this->candidateId = $result['candidateId']; if (!empty($this->candidateId)) { $this->getUser()->setFlash('applyVacancy.success', __('Application Received')); $this->getUser()->setFlash('applyVacancy.warning', null); // Send a confirmation e-mail to the applicant and notification to the hiring manager. $logger = Logger::getLogger('recruitment.applyvacancy'); $logger->info('Application recieved'); $eventData = array('vacancy' => $vacancy, 'candidateId' => $this->candidateId); $this->getDispatcher()->notify(new sfEvent($this, RecruitmentEvents::RECRUITMENT_APPLY, $eventData)); } } } } } } }
/** * * @param <type> $request */ public function execute($request) { $screen = $request->getParameter('screen'); $param = array('screen' => $screen); $this->form = new RecruitmentAttachmentForm(array(), $param, true); if ($this->getRequest()->isMethod('post')) { if ($_FILES['recruitmentAttachment']['size']['ufile'] > 1024000 || $_FILES == null) { $this->getUser()->setFlash('attachmentMessage', array('warning', __(TopLevelMessages::FILE_SIZE_SAVE_FAILURE))); $this->redirect($this->getRequest()->getReferer() . '#attachments'); } // Handle the form submission $this->form->bind($request->getParameter($this->form->getName()), $request->getFiles($this->form->getName())); if ($this->form->isValid()) { $this->form->save(); $this->getUser()->setFlash('attachmentMessage', array('success', __(TopLevelMessages::SAVE_SUCCESS))); } } $this->redirect($this->getRequest()->getReferer() . '#attachments'); }
/** * * @param <type> $request */ public function execute($request) { $userObj = $this->getUser()->getAttribute('user'); $allowedVacancyList = $userObj->getAllowedVacancyList(); $allowedCandidateListToDelete = $userObj->getAllowedCandidateListToDelete(); $this->candidateId = $request->getParameter('id'); $this->invalidFile = false; $reDirect = false; $this->edit = true; if ($this->candidateId > 0 && !in_array($this->candidateId, $allowedCandidateListToDelete)) { $reDirect = true; $this->edit = false; } $param = array('candidateId' => $this->candidateId, 'allowedVacancyList' => $allowedVacancyList, 'empNumber' => $userObj->getEmployeeNumber(), 'isAdmin' => $userObj->isAdmin()); $this->setForm(new AddCandidateForm(array(), $param, true)); if ($this->getUser()->hasFlash('templateMessage')) { list($this->messageType, $this->message) = $this->getUser()->getFlash('templateMessage'); } $this->jobVacancyList = $this->getVacancyService()->getAllVacancies(); $this->candidateStatus = JobCandidate::ACTIVE; if ($this->candidateId > 0) { $allowedCandidateList = $userObj->getAllowedCandidateList(); if (!in_array($this->candidateId, $allowedCandidateList)) { $this->redirect('recruitment/viewCandidates'); } $this->actionForm = new ViewCandidateActionForm(array(), $param, true); $allowedHistoryList = $userObj->getAllowedCandidateHistoryList($this->candidateId); $candidateHistory = $this->getCandidateService()->getCandidateHistoryForCandidateId($this->candidateId, $allowedHistoryList); $candidateHistoryService = new CandidateHistoryService(); $this->_setListComponent($candidateHistoryService->getCandidateHistoryList($candidateHistory)); $params = array(); $this->parmetersForListCompoment = $params; $this->candidateStatus = $this->getCandidateService()->getCandidateById($this->candidateId)->getStatus(); } else { if (!($userObj->isAdmin() || $userObj->isHiringManager())) { $this->redirect('recruitment/viewCandidates'); } } if ($request->isMethod('post')) { $this->form->bind($request->getParameter($this->form->getName()), $request->getFiles($this->form->getName())); $file = $request->getFiles($this->form->getName()); if ($_FILES['addCandidate']['size']['resume'] > 1024000 || $_FILES['addCandidate']['error']['resume'] && $_FILES['addCandidate']['name']['resume']) { $title = $this->candidateId > 0 ? __('Editing Candidate') : __('Adding Candidate'); $this->templateMessage = array('WARNING', '' . __(TopLevelMessages::FILE_SIZE_SAVE_FAILURE)); } elseif ($_FILES == null) { $title = $this->candidateId > 0 ? __('Editing Candidate') : __('Adding Candidate'); $this->getUser()->setFlash('templateMessage', array('warning', __(TopLevelMessages::FILE_SIZE_SAVE_FAILURE))); $this->redirect('recruitment/addCandidate'); } else { $this->form->bind($request->getParameter($this->form->getName()), $request->getFiles($this->form->getName())); $file = $request->getFiles($this->form->getName()); if ($this->form->isValid()) { $result = $this->form->save(); if (isset($result['messageType'])) { $this->messageType = $result['messageType']; $this->message = $result['message']; $this->invalidFile = true; } else { $this->candidateId = $result['candidateId']; $this->getUser()->setFlash('templateMessage', array('success', __(TopLevelMessages::SAVE_SUCCESS))); $this->redirect('recruitment/addCandidate?id=' . $this->candidateId); } } } } }
/** * * @param <type> $request */ public function execute($request) { /* For highlighting corresponding menu item */ $request->setParameter('initialActionName', 'viewCandidates'); $userRoleManager = $this->getContext()->getUserRoleManager(); $requiredPermissions = array(BasicUserRoleManager::PERMISSION_TYPE_DATA_GROUP => array('recruitment_candidates' => new ResourcePermission(true, false, false, false))); $allowedVacancyList = $userRoleManager->getAccessibleEntityIds('Vacancy', null, null, array(), array(), $requiredPermissions); $this->candidatePermissions = $this->getDataGroupPermissions('recruitment_candidates'); $userObj = $this->getUser()->getAttribute('user'); $allowedCandidateListToDelete = $userObj->getAllowedCandidateListToDelete(); $this->candidateId = $request->getParameter('id'); $this->invalidFile = false; $reDirect = false; $this->edit = true; if ($this->candidateId > 0 && !in_array($this->candidateId, $allowedCandidateListToDelete)) { $reDirect = true; $this->edit = false; } $param = array('candidateId' => $this->candidateId, 'allowedVacancyList' => $allowedVacancyList, 'empNumber' => $userObj->getEmployeeNumber(), 'isAdmin' => $userObj->isAdmin(), 'candidatePermissions' => $this->candidatePermissions); $this->setForm(new AddCandidateForm(array(), $param, true)); $vacancyProperties = array('name', 'id', 'status'); $this->jobVacancyList = $this->getVacancyService()->getVacancyPropertyList($vacancyProperties); $this->candidateStatus = JobCandidate::ACTIVE; if ($this->candidateId > 0) { $allowedCandidateList = $userObj->getAllowedCandidateList(); if (!in_array($this->candidateId, $allowedCandidateList)) { $this->redirect('recruitment/viewCandidates'); } $this->actionForm = new ViewCandidateActionForm(array(), $param, true); $allowedHistoryList = $userObj->getAllowedCandidateHistoryList($this->candidateId); $candidateHistory = $this->getCandidateService()->getCandidateHistoryForCandidateId($this->candidateId, $allowedHistoryList); $candidateHistoryService = new CandidateHistoryService(); if ($this->candidatePermissions->canRead()) { $this->_setListComponent($candidateHistoryService->getCandidateHistoryList($candidateHistory)); } $params = array(); $this->parmetersForListCompoment = $params; $this->candidateStatus = $this->getCandidateService()->getCandidateById($this->candidateId)->getStatus(); } else { if (!($userObj->isAdmin() || $userObj->isHiringManager() || $this->candidatePermissions->canRead())) { $this->redirect('recruitment/viewCandidates'); } } if ($request->isMethod('post')) { if ($this->candidatePermissions->canCreate() || $this->candidatePermissions->canUpdate()) { $this->form->bind($request->getParameter($this->form->getName()), $request->getFiles($this->form->getName())); $file = $request->getFiles($this->form->getName()); if ($_FILES['addCandidate']['size']['resume'] > 1024000 || $_FILES['addCandidate']['error']['resume'] && $_FILES['addCandidate']['name']['resume']) { $title = $this->candidateId > 0 ? __('Editing Candidate') : __('Adding Candidate'); $this->getUser()->setFlash('addcandidate.warning', __(TopLevelMessages::FILE_SIZE_SAVE_FAILURE)); } elseif ($_FILES == null) { $title = $this->candidateId > 0 ? __('Editing Candidate') : __('Adding Candidate'); $this->getUser()->setFlash('addcandidate.warning', __(TopLevelMessages::FILE_SIZE_SAVE_FAILURE)); $this->redirect('recruitment/addCandidate'); } else { $this->form->bind($request->getParameter($this->form->getName()), $request->getFiles($this->form->getName())); $file = $request->getFiles($this->form->getName()); if ($this->form->isValid()) { $result = $this->form->save(); if (isset($result['messageType'])) { $this->getUser()->setFlash('addcandidate.warning', $result['message']); $this->invalidFile = true; } else { $this->candidateId = $result['candidateId']; $this->getUser()->setFlash('addcandidate.success', __(TopLevelMessages::SAVE_SUCCESS)); $this->redirect('recruitment/addCandidate?id=' . $this->candidateId); } } } } } }