static function getFileListOfDir($dir) { $fileList = array(); $dir = substr($dir, -1) != "/" ? $dir . "/" : $dir; chmod($dir, 0777); $openDir = opendir($dir); //echo $openDir; while ($file = readdir($openDir)) { if (!in_array($file, array(".", ".."))) { if (!is_dir($dir . $file)) { $fileList[] = $dir . $file; } else { App_Util::getFileListOfDir($dir . $file); } } } closedir($openDir); return $fileList; }
function templateDesignAction() { $this->setLayout("templatedesign"); $this->_showTabs(4); $this->addSaveButton(); $modelName = $this->_request->getParam("model", 'Eau_Model_Company'); $uiName = $this->_request->getParam("uiName", 'default'); $config = App_Model_Config::get($modelName); $templeatLocation = TEMPLATES_DIR . "/" . $modelName; $templateFileList = App_Util::getFileListOfDir($templeatLocation); if (count($templateFileList) == 0) { $templateFileList = array("{$templeatLocation}/default.txt"); } $this->view->templateData = file_get_contents($templateFileList[0]); $this->view->templateFileList = $templateFileList; $this->view->uiName = $uiName; $this->view->config = $config; }
public function exportDetailAction() { $request = $this->getRequest(); $exportLayout = $request->getParam('exportlayout', 'P'); $rowsPerPage = $request->getParam('rowsperpage', '20'); $uiName = $request->getParam('template', 'default'); $exportFileName = $request->getParam('exportFileName', ''); $page = $request->getParam('page', ''); if ($page != 'all') { $startpage = $request->getParam('startpage', '1'); $endpage = $request->getParam('endpage', ''); $page = array($startpage, $endpage); } $this->disableLayout(); $filter = $this->_getfilter(); $filter->disableAction(); $filter->setUiName($uiName); $modelName = $this->_model; $templeatLocation = TEMPLATES_DIR . "/" . $modelName; $templateFileList = App_Util::getFileListOfDir($templeatLocation); if (count($templateFileList) == 0) { $templateFileList = array("{$templeatLocation}/default.txt"); } $this->view->templateData = file_get_contents($templateFileList[0]); $template = new App_Template($templateFileList[0]); $this->view->exportPdfDetail($filter, $exportLayout, $rowsPerPage, $page, $exportFileName, $template); $this->render('blank', null, true); }