Example #1
0
 public function executeSaveNew()
 {
     $project = new Project();
     $culture = $this->getUser()->getCulture();
     // TODO: Implement multiple owners / project leads, if necessary
     $project->setCreatedBy($this->getUser()->getGuardUser()->getId());
     $project->setOwnerId($this->getUser()->getGuardUser()->getId());
     $project->setDepartmentId($this->getRequestParameter('department_id') ? $this->getRequestParameter('department_id') : null);
     $project->setTitle($this->getRequestParameter('title'));
     $project->setDescription($this->getRequestParameter('description'));
     $project->setNotes($this->getRequestParameter('notes'));
     $project->setKeywords($this->getRequestParameter('tags_as_text'));
     if ($this->getRequestParameter('begin')) {
         list($d, $m, $y) = sfI18N::getDateForCulture($this->getRequestParameter('begin'), $this->getUser()->getCulture());
         $project->setBegin("{$y}-{$m}-{$d}");
     }
     if ($this->getRequestParameter('finish')) {
         list($d, $m, $y) = sfI18N::getDateForCulture($this->getRequestParameter('finish'), $this->getUser()->getCulture());
         $project->setFinish("{$y}-{$m}-{$d}");
     }
     $this->logMessage('Dates Saved');
     $project->setCampusId($this->getRequestParameter('campus'));
     $project->setPublished($this->getRequestParameter('published', 0));
     $project->save();
     $this->logMessage('Project Saved');
     $project->createDefaultPermissions();
     return $this->redirect('project/awaitApproval');
 }
Example #2
0
 public function approve()
 {
     if (!$this->getIsApproved()) {
         $this->setIsApproved(true);
         $project = new Project();
         $project->setCreatedBy($this->getCreatedBy());
         $project->setOwnerId($this->getOwnerId());
         $project->setDepartmentId($this->getDepartmentId());
         $project->setCampusId($this->getCampusId());
         $project->setTitle($this->getTitle());
         $project->setDescription($this->getDescription());
         $project->setNotes($this->getNotes());
         $project->setBegin($this->getBegin());
         $project->setFinish($this->getFinish());
         $project->setMainForm('default');
         $project->setPublished(true);
         $project->setIsApproved(true);
         $project->save();
     }
 }