public function executeAjaxCloneAndAcceptApplicant() { $project = ProjectPeer::retrieveByUuid($this->getRequestParameter('project')); $this->forward404Unless($project, 'Project not found, unable to accept applicant'); if ($project->clonePositionAcceptApplicant($this->getRequestParameter('position'), $this->getRequestParameter('user')) == false) { $this->forward404('Unable to add position, error.'); } $this->setTemplate('ajaxAddPosition'); $this->newPosition = new ProjectPosition(); $this->project = $project; }
public function executeRemovePhoto() { $photo = sfPhotoGalleryPeer::retrieveByUuid($this->getRequestParameter('photo')); $this->forward404Unless($photo, 'Photo not found, unable to set profile photo'); $project = ProjectPeer::retrieveByUuid($this->getRequestParameter('project')); $this->forward404Unless($project, 'Project not found, unable to set profile photo'); // Make sure photo belongs to project if (sfPhotoGalleryPeer::isAttachedToEntity('Project', $project->getId(), $photo->getUuid())) { // Make sure we update the picture if profile photo if ($photo->getUuid() != $project->getPicture()) { $photo->delete(); } else { $photo->delete(); $project->setPicture(NULL); $project->save(); } } $this->redirect($this->getRequest()->getReferer()); }