Example #1
0
 public function testTpConfig()
 {
     $project = new Project();
     $project->setName('name');
     $project->setDescription('description');
     $project->setKeywords(['k1', 'k2']);
     $project->setHomepage('http://homepage.com');
     $project->addAuthor(new Author('author-name <*****@*****.**>'));
     $project->addPackage($this->buildPackage('namespace1', ['path1.1', 'path1.2']));
     $this->assertSame(['name' => 'name', 'description' => 'description', 'keywords' => ['k1', 'k2'], 'homepage' => 'http://homepage.com', 'authors' => [['name' => 'author-name', 'email' => '*****@*****.**']], 'autoload' => ['psr-4' => ['namespace1\\' => ['path1.1', 'path1.2']]]], $project->toConfig());
 }
Example #2
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');
 }