Exemplo n.º 1
0
function createSubject(EiProjet $ei_project, $superAdmin)
{
    $ei_subject = new EiSubject();
    $ei_subject->setName("Bug" . time());
    $ei_subject->setAuthorId($superAdmin->getId());
    $ei_subject->setProjectId($ei_project->getProjectId());
    $ei_subject->setProjectRef($ei_project->getRefId());
    $ei_subject->save();
    return $ei_subject;
}
Exemplo n.º 2
0
 public function executeCreate(sfWebRequest $request)
 {
     $this->checkProject($request);
     //Récupération du projet
     $this->checkProfile($request, $this->ei_project);
     //Récupération du profil courant
     if (!$request->isMethod(sfRequest::POST)) {
         $this->getUser()->setFlash('alert_version_form', array('title' => 'Warning', 'class' => 'alert-warning', 'text' => 'Form has been reinitialized. Need posts parameters'));
         $this->redirect($this->generateUrl('subject_new', $this->urlParameters));
     }
     $this->guardUser = $this->guard_user;
     $subject = new EiSubject();
     $subject->setProjectId($this->ei_project->getProjectId());
     $subject->setProjectRef($this->ei_project->getRefId());
     $subject->setAuthorId($this->guardUser->getId());
     $this->form = new EiSubjectForm($subject, array('ei_project' => $this->ei_project, 'guardUser' => $this->guardUser));
     unset($this->form[$this->form->getCSRFFieldName()]);
     $this->processForm($request, $this->form);
     $this->setTemplate('new');
 }
Exemplo n.º 3
0
 public function executeCreateContext(sfWebRequest $request)
 {
     $this->guardUser = $this->getUser()->getGuardUser();
     $this->checkProject($request);
     //Récupération du projet
     $this->checkProfile($request, $this->ei_project);
     $this->checkCampaignGraph($request);
     $context = new EiBugContext();
     $context->setCampaignId($this->ei_campaign_graph->getCampaignId());
     $context->setScenarioId($this->ei_campaign_graph->getScenarioId());
     $context->setCampaignGraphId($this->ei_campaign_graph->getId());
     $context->setEiDataSetId($this->ei_campaign_graph->getDataSetId());
     $context->setProfileId($this->ei_profile->getProfileId());
     $context->setProfileRef($this->ei_profile->getProfileRef());
     $context->setAuthorId($this->guardUser->getId());
     $subject = new EiSubject();
     $subject->setProjectId($this->ei_project->getProjectId());
     $subject->setProjectRef($this->ei_project->getRefId());
     $subject->setAuthorId($this->guardUser->getId());
     $this->form = new EiSubjectForm($subject, array('ei_project' => $this->ei_project, 'guardUser' => $this->guardUser, 'ei_bug_context' => $context));
     $this->processForm($request, $this->form);
     if ($this->success) {
         $show = $this->urlParameters;
         $show['ei_context'] = $this->ei_context;
         return $this->renderText(json_encode(array('html' => $this->getPartial('bugContext/show', $show), 'success' => $this->success)));
     } else {
         $newContextForm = $this->urlParameters;
         $newContextForm['form'] = $this->form;
         $newContextForm['campaign_graph_id'] = $this->campaign_graph_id;
         return $this->renderText(json_encode(array('html' => $this->getPartial('bugContext/newContextForm', $newContextForm), 'success' => $this->success)));
     }
     return sfView::NONE;
 }