예제 #1
0
파일: main.php 프로젝트: clavat/mkframework
 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);
 }
예제 #2
0
 public function findAll()
 {
     $oDir = new _dir($this->sGenere);
     $tProjet = array();
     foreach ($oDir->getListDir() as $oDir) {
         $tProjet[] = $oDir->getName();
     }
     return $tProjet;
 }
예제 #3
0
 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&eacute;ation repertoire index data/json/base/' . $sTable . '/index/' . implode('.', $tField);
         $detail .= '<br />Reg&eacute;n&eacute;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;
 }
예제 #4
0
파일: main.php 프로젝트: clavat/mkMarket
 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;
 }
예제 #5
0
 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;
 }
예제 #6
0
 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());
         }
     }
 }
예제 #7
0
파일: main.php 프로젝트: clavat/mkframework
 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;
 }
예제 #8
0
 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;
         }
     }
 }