<?php
 namespace Modules\Utils\AppReports; class View_Utils_FormExportConfig extends \App\Mvc\View_Utils_FormAbstract { private $ignoreFiles = ['dbAuthData.php', ]; public function getForm() { $CFG = \Engine\Loader_Cfg::getInstance()->getGlobal(); $configPath = $CFG['paths']['config']; $form = \Engine\Form\General::create(); $fieldset=\Engine\Form\Container\Fieldset::create("Export configs as XML"); $form->addContainer($fieldset); $fld = new \Engine\Form\Input\Checkboxes("Export options", 'exportOptions', $this->values['exportOptions']); $configFileList = \Engine\Dir::getFileListRecursive($configPath); $configOptions = []; foreach ($configFileList as $configFile) { $fileName = \Engine\File::getName($configFile); if(in_array($fileName.".".\Engine\File::getExtension($configFile), $this->ignoreFiles)) { continue; } $pathName = \Engine\File::getPath($configFile); $pathPosition = strpos($pathName, substr($configPath, 2)); $folderName = substr($pathName, $pathPosition+strlen($configPath)-2); $configOptions[$folderName.$fileName.".".\Engine\File::getExtension($configFile)] = $folderName.$fileName.".".\Engine\File::getExtension($configFile); } $fld->setPossibleValues($configOptions); $fld->setValue($this->cfg['defaultValues']['formExportConfig']); $fld->setStyle('renderMode', 'block'); $fieldset->addElement($fld); $form->addElement(new \Engine\Form\Input\Hidden('', $this->submitButtonName, 1)); return $form; } }