public function _editcode() { $this->saveCode(); $oModuleDir = new _dir('data/genere/' . _root::getParam('project') . '/module'); $tModule = array(); foreach ($oModuleDir->getListDir() as $oDir) { $tModule[] = $oDir->getName(); } $oModelDir = new _dir('data/genere/' . _root::getParam('project') . '/model'); $tModel = array(); foreach ($oModelDir->getListFile() as $oFile) { $tModel[] = substr($oFile->getName(), 0, -4); } $this->oLayout = new _layout('templateCodeFrame'); $oFile = new _file(_root::getParam('file')); if (!$oFile->exist()) { $oView = new _view('code::nocode'); } else { $oView = new _view('code::code'); } $oView->oFile = $oFile; $oView->tModule = $tModule; $oView->tModel = $tModel; $this->oLayout->add('main', $oView); }
public function findAll() { $oDir = new _dir($this->sGenere); $tProjet = array(); foreach ($oDir->getListDir() as $oDir) { $tProjet[] = $oDir->getName(); } return $tProjet; }
public function _index() { if (_root::getParam('config') == '') { return $this->xmlindexselect(); } module_builder::getTools()->rootAddConf('conf/connexion.ini.php'); $msg = ''; $detail = ''; $tTables = array(); $tTableColumn = array(); $sConfig = _root::getParam('config'); $tTables = module_builder::getTools()->getListTablesFromConfig($sConfig); $tTableColumn = array(); foreach ($tTables as $sTable) { $tTableColumn[$sTable] = module_builder::getTools()->getListColumnFromConfigAndTable($sConfig, $sTable); } $tFileIndex = array(); if (_root::getParam('sTable') != '') { $oDir = new _dir(_root::getConfigVar('path.generation') . _root::getParam('id') . '/data/json/base/' . _root::getParam('sTable') . '/index'); if (!$oDir->exist()) { $oDir->save(); } $tFile = array(); foreach ($oDir->getListDir() as $oFile) { if (preg_match('/.index/', $oFile->getName())) { $tFileIndex[] = $oFile->getName(); } } } if (_root::getParam('regenerateIndexXml') != '') { $this->regenerateIndexXml($sConfig, _root::getParam('sTable'), _root::getParam('regenerateIndexXml')); } if (_root::getRequest()->isPost()) { $sTable = _root::getParam('sTable'); $tField = _root::getParam('tField'); module_builder::getTools()->projetmkdir('data/json/base/' . $sTable . '/index'); module_builder::getTools()->projetmkdir('data/json/base/' . $sTable . '/index/' . implode('.', $tField) . '.index'); $this->regenerateIndexXml($sConfig, $sTable, implode('.', $tField) . '.index'); $msg = 'Index ' . implode('.', $tField) . ' sur la table ' . $sTable . ' généré avec succès'; $detail = 'Création repertoire data/json/base/' . $sTable . '/index'; $detail .= '<br />Création repertoire index data/json/base/' . $sTable . '/index/' . implode('.', $tField); $detail .= '<br />Regénération de l\'index'; } $oTpl = new _Tpl('moduleJsonIndex::index'); $oTpl->msg = $msg; $oTpl->detail = $detail; $oTpl->tTables = $tTables; $oTpl->tTableColumn = $tTableColumn; $oTpl->tFileIndex = $tFileIndex; return $oTpl; }
public function _index() { if (_root::getParam('config') == '') { return $this->xmlindexselect(); } module_builder::getTools()->rootAddConf('conf/connexion.ini.php'); $msg = ''; $detail = ''; $tTables = array(); $tTableColumn = array(); $sConfig = _root::getParam('config'); $tTables = module_builder::getTools()->getListTablesFromConfig($sConfig); $tTableColumn = array(); foreach ($tTables as $sTable) { $tTableColumn[$sTable] = module_builder::getTools()->getListColumnFromConfigAndTable($sConfig, $sTable); } $tFileIndex = array(); if (_root::getParam('sTable') != '') { $oDir = new _dir(_root::getConfigVar('path.generation') . _root::getParam('id') . '/data/json/base/' . _root::getParam('sTable') . '/index'); if (!$oDir->exist()) { $oDir->save(); } $tFile = array(); foreach ($oDir->getListDir() as $oFile) { if (preg_match('/.index/', $oFile->getName())) { $tFileIndex[] = $oFile->getName(); } } } if (_root::getParam('regenerateIndexXml') != '') { $this->regenerateIndexXml($sConfig, _root::getParam('sTable'), _root::getParam('regenerateIndexXml')); } if (_root::getRequest()->isPost()) { $sTable = _root::getParam('sTable'); $tField = _root::getParam('tField'); module_builder::getTools()->projetmkdir('data/json/base/' . $sTable . '/index'); module_builder::getTools()->projetmkdir('data/json/base/' . $sTable . '/index/' . implode('.', $tField) . '.index'); $this->regenerateIndexXml($sConfig, $sTable, implode('.', $tField) . '.index'); $msg = trR('indexGenereAvecSucces', array('#listField#' => implode('.', $tField), '#maTable#' => $sTable)); $detail = trR('creationRepertoire', array('#REPERTOIRE#' => 'data/json/base/' . $sTable . '/index')); $detail .= '<br />' . trR('creationRepertoire', array('#REPERTOIRE#' => 'index data/json/base/' . $sTable . '/index/' . implode('.', $tField))); } $oTpl = $this->getView('index'); $oTpl->msg = $msg; $oTpl->detail = $detail; $oTpl->tTables = $tTables; $oTpl->tTableColumn = $tTableColumn; $oTpl->tFileIndex = $tFileIndex; return $oTpl; }
public function codeArbo($sProject) { $oDir = new _dir('data/genere/' . $sProject); $tDir = $oDir->getListDir(); $tFileAndDir = array(); foreach ($tDir as $oDir) { $tFileDir[$oDir->getName()]['dir'] = $this->getListDir($oDir); $tFileDir[$oDir->getName()]['file'] = $this->getListFile($oDir); } ksort($tFileDir); $oView = new _view('menu::codearbo'); $oView->tDir = $tDir; $oView->tFileDir = $tFileDir; return $oView; }
private function removeRowFromAllIndex($sTable, $tProperty) { $oDir = new _dir($this->_tConfig[$this->_sConfig . '.database'] . $sTable . '/index'); if ($oDir->exist()) { $tDirIndex = $oDir->getListDir(); foreach ($tDirIndex as $oDirIndex) { $this->removeRowFromIndex($sTable, $tProperty, $oDirIndex->getName()); } } }
public function getListModule() { $oDir = new _dir(_root::getConfigVar('path.generation') . _root::getParam('id') . '/module/'); $tDir = $oDir->getListDir(); $tNewDir = array(); foreach ($tDir as $oModule) { $sModuleName = $oModule->getName(); if (in_array($sModuleName, array('menu', 'builder', 'example', 'exampleembedded'))) { continue; } if (!file_exists(module_builder::getTools()->getRootWebsite() . 'module/' . $sModuleName . '/main.php')) { continue; } $tNewDir[] = $oModule; } return $tNewDir; }
private function loadAutoload() { if ((int) self::getConfigVar('cache.autoload.enabled') == 1) { $sCacheFilename = self::getConfigVar('path.cache') . 'autoload.php'; if (file_exists($sCacheFilename)) { include $sCacheFilename; } else { //on creer un tableau associatif de tous les path des classes $tDir = array('lib' => self::getConfigVar('path.lib'), 'abstract' => self::getConfigVar('path.lib') . 'abstract/', 'sgbd' => self::getConfigVar('path.lib') . 'sgbd/', 'sgbd_pdo' => self::getConfigVar('path.lib') . 'sgbd/pdo/', 'sgbd_syntax' => self::getConfigVar('path.lib') . 'sgbd/syntax/', 'plugin' => self::getConfigVar('path.plugin'), 'model' => self::getConfigVar('path.model'), 'module' => self::getConfigVar('path.module')); $tAutoload = array(); foreach ($tDir as $sType => $sDir) { if (in_array($sType, array('lib', 'abstract', 'sgbd', 'sgbd_pdo', 'sgbd_syntax', 'plugin', 'model'))) { $oDir = new _dir($sDir); $tFile = $oDir->getListFile(); foreach ($tFile as $oFile) { $sFilename = $oFile->getName(); $tFilename = preg_split('/_/', $sFilename); if ($sType == 'lib') { $tAutoload['_' . substr($tFilename[1], 0, -4)] = $sDir . $sFilename; } else { $tAutoload[substr($sFilename, 0, -4)] = $sDir . $sFilename; } } } else { if ($sType == 'module') { $oDir = new _dir($sDir); $tModuleDir = $oDir->getListDir(); foreach ($tModuleDir as $oModuleDir) { $sModuleDirname = $oModuleDir->getName(); $tAutoload['module_' . $sModuleDirname] = $sDir . $sModuleDirname . '/main.php'; } } } } $sCodeCache = '<?php _root::$tAutoload=' . var_export($tAutoload, true) . ';'; file_put_contents($sCacheFilename, $sCodeCache); self::$tAutoload = $tAutoload; } } }