Beispiel #1
0
 public function executeEdit(sfWebRequest $request)
 {
     $this->forward404Unless($request->isXmlHttpRequest());
     $this->checkProject($request);
     $this->checkProfile($request, $this->ei_project);
     $this->checkFunction($request, $this->ei_project);
     $version_notice_id = $request->getParameter('version_notice_id');
     $notice_id = $request->getParameter('notice_id');
     $notice_ref = $request->getParameter('notice_ref');
     $lang = $request->getParameter('lang');
     $this->ei_version_notice = Doctrine_Core::getTable('EiVersionNotice')->findOneByVersionNoticeIdAndNoticeIdAndNoticeRefAndLang($version_notice_id, $notice_id, $notice_ref, $lang);
     /* Si la version de notice n'existe pas pour la langue , on la crée sur l'application distante */
     if ($this->ei_version_notice == null) {
         $this->ei_version_notice = EiVersionNotice::createDistantNoticeLang($version_notice_id, $notice_id, $notice_ref, $lang);
         if ($this->ei_version_notice == null || is_array($this->ei_version_notice)) {
             // La version de notice n'a pas pu être créée sur le site distant : on retourne une erreur
             return $this->renderText(json_encode(array('header' => $this->ei_version_notice['message'], 'formContent' => "Version notice can't be created on central system ...", 'success' => false)));
         }
     }
     /* Récupération de toutes les langues du projet */
     $this->project_langs = $this->ei_project->getProjectLangs();
     /* Récupération des versions de notices de la fonction */
     $this->noticeVersionsForDropdownList = Doctrine_Core::getTable('EiVersionNotice')->getNoticeVersionsForDropdownList($this->kal_function);
     /*Récupération des profils actifs sur une notice */
     $this->activesProfilesForNoticeVersion = Doctrine_Core::getTable('EiVersionNotice')->getActiveProfilesForVersion($this->ei_project, $this->kal_function, $this->ei_version_notice->getVersionNoticeId(), $this->ei_version_notice->getNoticeId(), $this->ei_version_notice->getNoticeRef());
     $this->form = new EiVersionNoticeForm($this->ei_version_notice);
     /*Récupération des paramètres d'entrées et de sortie dela fonction */
     $this->getAndParseFunctionAndProjectParametersToArray();
     //Récupération des paramètres de fonction et de projet sous forme de tableau
     /* Gestion des retours json */
     /* En tête de la notice */
     $headerParams = $this->urlParameters;
     $headerParams['function_id'] = $this->kal_function->getFunctionId();
     $headerParams['function_ref'] = $this->kal_function->getFunctionRef();
     $headerParams['ei_version_notice'] = $this->ei_version_notice;
     $headerParams['noticeVersions'] = $this->noticeVersionsForDropdownList;
     $headerParams['project_langs'] = $this->project_langs;
     $headerParams['activesProfilesForNoticeVersion'] = $this->activesProfilesForNoticeVersion;
     $headerParams['default_notice_lang'] = $this->ei_project->getDefaultNoticeLang();
     /* Formulaire de la notice */
     $formContentParams = $this->urlParameters;
     $formContentParams['function_id'] = $this->kal_function->getFunctionId();
     $formContentParams['function_ref'] = $this->kal_function->getFunctionRef();
     $formContentParams['version_notice_id'] = $this->ei_version_notice->getVersionNoticeId();
     $formContentParams['notice_id'] = $this->ei_version_notice->getNoticeId();
     $formContentParams['notice_ref'] = $this->ei_version_notice->getNoticeRef();
     $formContentParams['lang'] = $this->ei_version_notice->getLang();
     $formContentParams['action'] = "update";
     /* Retour de la réponse json*/
     return $this->renderText(json_encode(array('header' => $this->getPartial("versionNoticeHeader", $headerParams), 'formContent' => $this->getPartial("blockForm", array("form" => $this->form, "url_form" => $formContentParams, 'inParameters' => $this->inTabParameters, 'outParameters' => $this->outTabParameters)), 'success' => true)));
     return sfView::NONE;
 }