Ejemplo n.º 1
0
 private function generate($sTable, $tField)
 {
     $tNewField = array('id');
     foreach ($tField as $sField) {
         if (trim($sField) == '') {
             continue;
         }
         $tNewField[] = trim($sField);
     }
     $sStructure = implode(';', $tNewField);
     $oDir = new _dir(_root::getConfigVar('path.generation') . _root::getParam('id') . '/data/json');
     if (!$oDir->exist()) {
         $oDir->save();
     }
     $oDir = new _dir(_root::getConfigVar('path.generation') . _root::getParam('id') . '/data/json/base');
     if (!$oDir->exist()) {
         $oDir->save();
     }
     $oDir = new _dir(_root::getConfigVar('path.generation') . _root::getParam('id') . '/data/json/base/' . $sTable . '');
     if (!$oDir->exist()) {
         $oDir->save();
     }
     $sPath = _root::getConfigVar('path.generation') . _root::getParam('id') . '/data/json/base/' . $sTable . '/';
     $oFile = new _file($sPath . 'structure.csv');
     $oFile->setContent($sStructure);
     $oFile->save();
     $sPath = _root::getConfigVar('path.generation') . _root::getParam('id') . '/data/json/base/' . $sTable . '/';
     $oFile = new _file($sPath . 'max.txt');
     $oFile->setContent(1);
     $oFile->save();
 }
Ejemplo n.º 2
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;
 }
Ejemplo n.º 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 = 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;
 }
Ejemplo n.º 4
0
 public function _index()
 {
     $this->process();
     $tModule = module_builder::getTools()->getListModule();
     $tModuleAndMethod = array();
     foreach ($tModule as $oModule) {
         $sModuleName = $oModule->getName();
         if (in_array($sModuleName, array('menu', 'builder', 'example', 'exampleembedded'))) {
             continue;
         }
         include module_builder::getTools()->getRootWebsite() . 'module/' . $sModuleName . '/main.php';
         if (get_parent_class('module_' . $sModuleName) != 'abstract_module') {
             continue;
         }
         $tMethods = get_class_methods('module_' . $sModuleName);
         foreach ($tMethods as $i => $sMethod) {
             if ($sMethod[0] != '_' or substr($sMethod, 0, 2) == '__') {
                 unset($tMethods[$i]);
             }
         }
         if (empty($tMethods)) {
             continue;
         }
         $tModuleAndMethod[$sModuleName] = $tMethods;
     }
     $oDir = new _dir(module_builder::getTools()->getRootWebsite() . 'module/menu');
     $bExist = $oDir->exist();
     $oTpl = $this->getView('index');
     //$oTpl->var=$var;
     $oTpl->msg = $this->msg;
     $oTpl->detail = $this->detail;
     $oTpl->tError = $this->tError;
     $oTpl->bExist = $bExist;
     $oTpl->tModuleAndMethod = $tModuleAndMethod;
     return $oTpl;
 }
Ejemplo n.º 5
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());
         }
     }
 }
Ejemplo n.º 6
0
    public function _index()
    {
        $detail = null;
        $tError = array();
        $tModuleAndMethod = array();
        $bExist = 0;
        if (_root::getRequest()->isPost()) {
            $sModule = _root::getParam('modulename');
            $tMethod = _root::getParam('tMethod');
            $tLabel = _root::getParam('tLabel');
            $ok = 1;
            //check formulaire
            foreach ($tMethod as $i => $sMethod) {
                if ($tLabel[$i] == '') {
                    $tError[$i] = 'Remplissez le libell&eacute; du lien';
                    $ok = 0;
                }
            }
            if ($ok) {
                if (module_builder::getTools()->projetmkdir('module/' . $sModule) == true) {
                    $detail = 'Cr&eacute;ation repertoire module/' . $sModule;
                    if (module_builder::getTools()->projetmkdir('module/' . $sModule . '/view') == true) {
                        $detail .= '<br />Cr&eacute;ation r&eacute;pertoire module/' . $sModule . '/view';
                        $this->genModuleMenuMain($sModule, $tMethod, $tLabel);
                        $msg = 'Module ' . $sModule . ' g&eacute;n&eacute;r&eacute; avec succ&egrave;s';
                        $detail .= '<br />Cr&eacute;ation fichier module/' . $sModule . '/main.php';
                        $detail .= '<br />Cr&eacute;ation fichier module/' . $sModule . '/view/index.php';
                        $sCode = '<?php ' . "\n";
                        $sCode .= '//assignez le menu a l\'emplacement menu' . "\n";
                        $sCode .= '$this->oLayout->addModule(\'menu\',\'' . $sModule . '::index\');' . "\n";
                        $detail .= '<br/><br/>Pour l\'utiliser, ajoutez dans votre methode before():<br />
						' . highlight_string($sCode, 1);
                    } else {
                        $detail .= '<br />Warning: repertoire d&eacute;j&agrave; existant module/' . $sModule . '/view';
                    }
                } else {
                    $detail = 'Warning: repertoire module/' . $sModule . ' d&eacute;j&agrave; existant: modifiez le nom du module menu';
                }
            }
        } else {
            $tModule = module_builder::getTools()->getListModule();
            $tModuleAndMethod = array();
            foreach ($tModule as $oModule) {
                $sModuleName = $oModule->getName();
                if (in_array($sModuleName, array('menu', 'builder', 'example', 'exampleembedded'))) {
                    continue;
                }
                include module_builder::getTools()->getRootWebsite() . 'module/' . $sModuleName . '/main.php';
                if (get_parent_class('module_' . $sModuleName) != 'abstract_module') {
                    continue;
                }
                $tMethods = get_class_methods('module_' . $sModuleName);
                foreach ($tMethods as $i => $sMethod) {
                    if ($sMethod[0] != '_' or substr($sMethod, 0, 2) == '__') {
                        unset($tMethods[$i]);
                    }
                }
                if (empty($tMethods)) {
                    continue;
                }
                $tModuleAndMethod[$sModuleName] = $tMethods;
            }
            $oDir = new _dir(module_builder::getTools()->getRootWebsite() . 'module/menu');
            $bExist = $oDir->exist();
        }
        $oView = new _view('moduleMenuBootstrap::index');
        $oView->tModuleAndMethod = $tModuleAndMethod;
        $oView->detail = $detail;
        $oView->bExist = $bExist;
        $oView->tError = $tError;
        return $oView;
    }
Ejemplo n.º 7
0
 private function processExport()
 {
     if (!_root::getRequest()->isPost()) {
         return array();
     }
     $sFrom = _root::getConfigVar('path.generation') . _root::getParam('from') . '/';
     $sTo = _root::getParam('to') . '/' . _root::getParam('from');
     $oDir = new _dir($sTo);
     if ($oDir->exist()) {
         return array('error' => 'Repertoire ' . $sTo . ' existe deja');
     }
     if (!in_array(_root::getParam('lib'), array('link', 'copy'))) {
         return array('error' => 'Veuillez s&eacute;lectionner un choix pour la librairie du framework');
     }
     $oModelProject = model_mkfbuilderprojet::getInstance()->copyFromTo($sFrom, $sTo);
     if (_root::getParam('lib') == 'link') {
         $sLib = __DIR__;
         $sLib = str_replace('module/builder', 'lib/framework/', $sLib);
         $this->updateLibPathInConf($sTo, $sLib);
         $detail = 'Projet cr&eacute;e dans ' . $sTo;
         $detail .= '<br/>Dans votre projet, la librairie du framework pointe sur ' . $sLib;
         return array('ok' => 'Projet bien export&eacute; sur ' . $sTo, 'detail' => $detail);
     } else {
         if (_root::getParam('lib') == 'copy') {
             $oDir = new _dir($sTo . '/lib/');
             $oDir->save();
             //copy du framework
             $oModelProject = model_mkfbuilderprojet::getInstance()->copyFromTo('lib/framework', $sTo . '/lib/mkframework');
             $sLib = '../lib/mkframework/';
             $this->updateLibPathInConf($sTo, $sLib);
             $detail = 'Projet cr&eacute;e dans ' . $sTo;
             $detail .= '<br/>Dans votre projet, la librairie du framework a ete copie dans ' . $sLib;
             return array('ok' => 'Projet bien export&eacute; sur ' . $sTo, 'detail' => $detail);
         }
     }
 }