Exemplo n.º 1
0
 public function subform($appType, $configurationXmlFile, $values, $control_name, $name)
 {
     if (N2Filesystem::fileexists($configurationXmlFile)) {
         N2Loader::import('libraries.form.form');
         $form = new N2Form($appType);
         $form->loadArray($values);
         //$subformValue = array();
         //$subformValue[N2Post::getVar('name')] = N2Post::getVar('value');
         //$form->loadArray($subformValue);
         $form->loadXMLFile($configurationXmlFile);
         ob_end_clean();
         // To clear the output of the platform
         ob_start();
         $subform = $form->getSubFormAjax(N2Post::getVar('tab'), $name);
         $subform->initAjax($control_name);
         echo $subform->renderForm();
         //echo N2AssetsManager::generateAjaxCSS();
         $scripts = N2AssetsManager::generateAjaxJS();
         $html = ob_get_clean();
         $response = array('html' => $html, 'scripts' => $scripts);
     } else {
         $response = array('error' => 'Configuration file not found: ' . $configurationXmlFile);
     }
     return $response;
 }