Beispiel #1
0
 /**
  * 
  * @method get
  * @route /{object}/[i:id]
  */
 public function editAction($additionnalParamsForSmarty = array(), $defaultValues = array())
 {
     $requestParam = $this->getParams('named');
     $objectFormUpdateUrl = $this->objectBaseUrl . '/update';
     $inheritanceUrl = null;
     if (false === is_null($this->inheritanceUrl)) {
         $inheritanceUrl = $this->router->getPathFor($this->inheritanceUrl, array('id' => $requestParam['id']));
     }
     $myForm = new WebFormGenerator($objectFormUpdateUrl, array('id' => $requestParam['id'], 'objectName' => static::$objectName));
     $myForm->getFormFromDatabase();
     $myForm->addHiddenComponent('object_id', $requestParam['id']);
     $myForm->addHiddenComponent('object', static::$objectName);
     // set specific object current values
     $myForm->setDefaultValues($defaultValues, $requestParam['id']);
     // set object current values
     $myForm->setDefaultValues($this->objectClass, $requestParam['id']);
     $formModeUrl = $this->router->getPathFor($this->objectBaseUrl . '/[i:id]', array('id' => $requestParam['id']));
     // Display page
     $this->tpl->assign('pageTitle', $this->objectDisplayName);
     $this->tpl->assign('form', $myForm->generate());
     $this->tpl->assign('advanced', $requestParam['advanced']);
     $this->tpl->assign('formModeUrl', $formModeUrl);
     $this->tpl->assign('formName', $myForm->getName());
     $this->tpl->assign('validateUrl', $objectFormUpdateUrl);
     foreach ($additionnalParamsForSmarty as $smartyVarName => $smartyVarValue) {
         $this->tpl->assign($smartyVarName, $smartyVarValue);
     }
     $this->tpl->assign('inheritanceUrl', $inheritanceUrl);
     if (isset($this->inheritanceTagsUrl) && false === is_null($this->inheritanceTagsUrl)) {
         $inheritanceTagsUrl = $this->router->getPathFor($this->inheritanceTagsUrl, array('id' => $requestParam['id']));
         $this->tpl->assign('inheritanceTagsUrl', $inheritanceTagsUrl);
     }
     if (isset($this->inheritanceTmplUrl)) {
         $this->tpl->assign('inheritanceTmplUrl', $this->router->getPathFor($this->inheritanceTmplUrl));
     }
     if (isset($this->tmplField)) {
         $this->tpl->assign('tmplField', $this->tmplField);
     }
     $this->tpl->display('file:[CentreonConfigurationModule]edit.tpl');
 }
Beispiel #2
0
 /**
  *
  * @method get
  * @route /indicator/[i:id]
  */
 public function editAction($additionnalParamsForSmarty = array())
 {
     $requestParam = $this->getParams('named');
     $objectFormUpdateUrl = $this->objectBaseUrl . '/update';
     $inheritanceUrl = null;
     if (false === is_null($this->inheritanceUrl)) {
         $inheritanceUrl = $this->router->getPathFor($this->inheritanceUrl, array('id' => $requestParam['id']));
     }
     $myForm = new WebFormGenerator($objectFormUpdateUrl, array('id' => $requestParam['id']));
     $myForm->getFormFromDatabase();
     $myForm->addHiddenComponent('object_id', $requestParam['id']);
     $myForm->addHiddenComponent('object', static::$objectName);
     // get object Current Values
     $myForm->setDefaultValues($this->objectClass, $requestParam['id']);
     $typeId = IndicatorRepository::getIndicatorType($requestParam['id']);
     if ($typeId === '3') {
         $paramsToUpdate = IndicatorRepository::getBooleanParameters($requestParam['id']);
         // set value for custom fields
         $myForm->setValues($this->objectClass, $requestParam['id'], $paramsToUpdate);
     }
     $formModeUrl = $this->router->getPathFor($this->objectBaseUrl . '/[i:id]', array('id' => $requestParam['id']));
     // Display page
     $this->tpl->assign('pageTitle', $this->objectDisplayName);
     $this->tpl->assign('form', $myForm->generate());
     $this->tpl->assign('advanced', $requestParam['advanced']);
     $this->tpl->assign('formModeUrl', $formModeUrl);
     $this->tpl->assign('formName', $myForm->getName());
     $this->tpl->assign('validateUrl', $objectFormUpdateUrl);
     foreach ($additionnalParamsForSmarty as $smartyVarName => $smartyVarValue) {
         $this->tpl->assign($smartyVarName, $smartyVarValue);
     }
     $this->tpl->assign('inheritanceUrl', $inheritanceUrl);
     if (isset($this->inheritanceTmplUrl)) {
         $this->tpl->assign('inheritanceTmplUrl', $this->router->getPathFor($this->inheritanceTmplUrl));
     }
     if (isset($this->tmplField)) {
         $this->tpl->assign('tmplField', $this->tmplField);
     }
     $this->tpl->display('file:[CentreonConfigurationModule]edit.tpl');
 }