public function copyFromTo($sFrom, $sTo) { if (preg_match('/test/', $sFrom) or preg_match('/script/', $sFrom)) { return; } if (is_dir($sFrom)) { $oDir = new _dir($sFrom); try { mkdir($sTo); } catch (Exception $e) { throw new Exception('Erreur creation repertoire ' . $sTo . ' Verifier les droits du repertoire ' . $this->sGenere . ' du mkf4builder On doit pouvoir ecrire dedans (generation de projet) '); } chmod($sTo, 0777); foreach ($oDir->getList() as $oFile) { if (preg_match('/example/', $oFile->getAdresse())) { continue; } self::copyFromTo($oFile->getAdresse(), $sTo . '/' . $oFile->getName()); } } else { copy($sFrom, $sTo); chmod($sTo, 0666); } }
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); }
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(); }
/** * @access public static * @return object sgbd */ public function getSgbd() { $bFirst = false; if ($this->_sClassSgbd == null) { $sVarIniConfig = _root::getConfigVar('model.ini.var', 'db'); $tClassSgbd = _root::getConfigVar($sVarIniConfig); if (!$tClassSgbd) { $sMsg = 'Il vous manque un fichier de configuration'; $sMsg .= ' ou le bloc de configuration [' . $sVarIniConfig . '] concernant la connexion' . "\n"; $sMsg .= ' Exemple: [' . $sVarIniConfig . '] mysql.dsn="mysql:dbname=blog;host=localhost" mysql.sgbd=pdo_mysql mysql.hostname=localhost mysql.database=blog mysql.username=root mysql.password=pass '; throw new Exception($sMsg); } $this->_sClassSgbd = 'sgbd_' . $tClassSgbd[$this->sConfig . '.sgbd']; $bFirst = true; if (substr($this->_sClassSgbd, 0, 8) == 'sgbd_pdo') { $sClassPath = _root::getConfigVar('path.lib') . 'sgbd/pdo/' . $this->_sClassSgbd . '.php'; } elseif (substr($this->_sClassSgbd, 0, 5) == 'sgbd_') { $sClassPath = _root::getConfigVar('path.lib') . 'sgbd/' . $this->_sClassSgbd . '.php'; } if (!file_exists($sClassPath)) { $oDirPdo = new _dir(_root::getConfigVar('path.lib') . 'sgbd/pdo/'); $tListPdo = $oDirPdo->getListFile(); $tPlus = array('Liste driver pdo:'); foreach ($tListPdo as $oFile) { $tPlus[] = '-' . $oFile->getName(); } $sListePdo = implode("\n", $tPlus); $oDir = new _dir(_root::getConfigVar('path.lib') . 'sgbd/'); $tList = $oDir->getListFile(); $tPlus = array('Liste driver autre:'); foreach ($tList as $oFile) { $tPlus[] = '-' . $oFile->getName(); } $sListeAutre = implode("\n", $tPlus); throw new Exception('Pas de driver ' . $this->_sClassSgbd . ' (' . $sClassPath . ')' . "\n" . $sListePdo . "\n" . $sListeAutre); } } $this->_oSgbd = call_user_func(array($this->_sClassSgbd, 'getInstance'), $this->sConfig); if ($bFirst) { $this->_oSgbd->setConfig($tClassSgbd); } return $this->_oSgbd; }
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 copyFromTo($sFrom, $sTo) { if (is_dir($sFrom)) { $oDir = new _dir($sFrom); mkdir($sTo); chmod($sTo, 0777); foreach ($oDir->getList() as $oFile) { self::copyFromTo($oFile->getAdresse(), $sTo . '/' . $oFile->getName()); } } else { copy($sFrom, $sTo); chmod($sTo, 0777); } }
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; }
public function _simple() { $msg = ''; $detail = ''; list($msg, $detail) = $this->processSimple(); module_builder::getTools()->rootAddConf('conf/connexion.ini.php'); $oDir = new _dir(_root::getConfigVar('path.generation') . _root::getParam('id') . '/model/'); $tFile = array(); $tRowMethodes = array(); $tModule = module_builder::getTools()->getListModule(); foreach ($oDir->getListFile() as $oFile) { if (preg_match('/.sample.php/', $oFile->getName()) or !preg_match('/.php$/', $oFile->getName())) { continue; } $tFile[] = $oFile->getName(); require_once $oFile->getAdresse(); $sClassFoo = substr($oFile->getName(), 0, -4); $oModelFoo = new $sClassFoo(); if (method_exists($oModelFoo, 'getSelect')) { $tRowMethodes[substr($oFile->getName(), 0, -4)] = substr($oFile->getName(), 0, -4) . '::getSelect()'; } } $oTpl = new _Tpl('moduleViewForm::simple'); if (_root::getParam('class') != '') { $sClass = substr(_root::getParam('class'), 0, -4); require_once _root::getConfigVar('path.generation') . _root::getParam('id') . '/model/' . $sClass . '.php'; $tColumn = module_builder::getTools()->getListColumnFromClass($sClass); $oTpl->sClass = $sClass; $sId = null; $tId = module_builder::getTools()->getIdTabFromClass($sClass); foreach ($tColumn as $i => $sColumn) { if (in_array($sColumn, $tId)) { unset($tColumn[$i]); $sId = $sColumn; } } $oTpl->tColumn = $tColumn; $oTpl->sId = $sId; $oTpl->tRowMethodes = $tRowMethodes; $oModel = new $sClass(); } $oTpl->msg = $msg; $oTpl->detail = $detail; $oTpl->tFile = $tFile; $oTpl->tModule = $tModule; return $oTpl; }
public function _index() { $this->init(); $tMessage = $this->process(); module_builder::getTools()->rootAddConf('conf/connexion.ini.php'); $oDir = new _dir(_root::getConfigVar('path.generation') . _root::getParam('id') . '/model/'); $tFile = array(null); $tColumn = array(); $tRowMethodes = array(); foreach ($oDir->getListFile() as $oFile) { if (preg_match('/.sample.php/', $oFile->getName()) or !preg_match('/.php$/', $oFile->getName())) { continue; } require_once $oFile->getAdresse(); $sClass = substr($oFile->getName(), 0, -4); $oModelFoo = new $sClass(); $tFile[$sClass] = $oFile->getName(); $tColumnFoo = module_builder::getTools()->getListColumnFromClass($sClass); $tColumnClass = array(null); foreach ($tColumnFoo as $sField) { $tColumnClass[$sField] = $sField; } $tColumn[$sClass] = $tColumnClass; } //formu $oForm = new stdclass(); foreach ($this->tField as $sField) { $oForm->{$sField} = null; } $oForm->moduleToGenerate = 'rightsManagerMulti'; $oForm->modelToGenerate = 'rightsManagerMulti'; $oTpl = $this->getView('index'); $oTpl->tModel = $tFile; $oTpl->tColumn = $tColumn; $oTpl->oForm = $oForm; $oTpl->tMessage = $tMessage; $oTpl->msg = $this->msg; $oTpl->detail = $this->detail; $oTpl->tError = $this->tError; return $oTpl; }
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; }
public function _index() { $bGuriddoExist = false; $bGuriddoPublicExist = false; $bModelCountExist = false; $bModelPaginationExist = false; $bModelFilterCountExist = false; $bModelFilterPaginationExist = false; //check guriddo if (file_exists(_root::getConfigVar('path.generation') . _root::getParam('id') . '/module/guriddo')) { $bGuriddoExist = true; } //check guriddo public if (file_exists(_root::getConfigVar('path.generation') . _root::getParam('id') . '/public/guriddo')) { $bGuriddoPublicExist = true; } module_builder::getTools()->rootAddConf('conf/connexion.ini.php'); $msg = ''; $detail = ''; $oDir = new _dir(_root::getConfigVar('path.generation') . _root::getParam('id') . '/model/'); $tFile = array(); $tRowMethodes = array(); foreach ($oDir->getListFile() as $oFile) { if (preg_match('/.sample.php/', $oFile->getName()) or !preg_match('/.php$/', $oFile->getName())) { continue; } $tFile[] = $oFile->getName(); require_once $oFile->getAdresse(); $sClassFoo = substr($oFile->getName(), 0, -4); $oModelFoo = new $sClassFoo(); if (method_exists($oModelFoo, 'getSelect')) { $tRowMethodes[substr($oFile->getName(), 0, -4)] = substr($oFile->getName(), 0, -4) . '::getSelect()'; } } $oTpl = new _Tpl('moduleCrudGuriddo::index'); $oTpl->bGuriddo = $bGuriddoExist; $oTpl->bGuriddoPublicExist = $bGuriddoPublicExist; $oTpl->pathGenerated = _root::getConfigVar('path.generation') . _root::getParam('id'); $oTpl->pathModule = _root::getConfigVar('path.generation') . _root::getParam('id') . '/module'; $oTpl->pathPublic = _root::getConfigVar('path.generation') . _root::getParam('id') . '/public/'; if (_root::getParam('class') != '') { $sClass = substr(_root::getParam('class'), 0, -4); require_once _root::getConfigVar('path.generation') . _root::getParam('id') . '/model/' . $sClass . '.php'; $oTpl->class = $sClass; $oModel = new $sClass(); if (method_exists($oModel, 'findTotal')) { $bModelCountExist = true; } if (method_exists($oModel, 'findListLimitOrderBy')) { $bModelPaginationExist = true; } if (method_exists($oModel, 'findTotalFiltered')) { $bModelFilterCountExist = true; } if (method_exists($oModel, 'findListFilteredAndLimitOrderBy')) { $bModelFilterPaginationExist = true; } $tColumn = module_builder::getTools()->getListColumnFromClass($sClass); $oTpl->sClass = $sClass; $oTpl->tSortColumn = $tColumn; $tId = module_builder::getTools()->getIdTabFromClass($sClass); foreach ($tColumn as $i => $sColumn) { if (in_array($sColumn, $tId)) { unset($tColumn[$i]); } } $oTpl->tColumn = $tColumn; $oTpl->tRowMethodes = $tRowMethodes; $oTpl->sModuleToCreate = $oModel->getTable(); } if (_root::getRequest()->isPost()) { $sModuleToCreate = _root::getParam('moduleToCreate'); $sClass = _root::getParam('sClass'); $tColumn = _root::getParam('tColumn'); $tLabel = _root::getParam('tLabel'); $tType = _root::getParam('tType'); $tEnable = _root::getParam('tEnable'); $sDefaultField = _root::getParam('defaultSort'); $tTableOption = array(); $tTableOption['width'] = _root::getParam('tableWidth'); $tTableOption['height'] = _root::getParam('tableHeight'); $tTableOption['limit'] = _root::getParam('tableLimit'); foreach ($tColumn as $i => $sColumn) { if (!in_array($sColumn, $tEnable)) { unset($tColumn[$i]); } } require_once _root::getConfigVar('path.generation') . _root::getParam('id') . '/model/' . $sClass . '.php'; $oModel = new $sClass(); $sModule = $sModuleToCreate; module_builder::getTools()->projetmkdir('module/' . $sModule); module_builder::getTools()->projetmkdir('module/' . $sModule . '/view'); $tCrud = _root::getParam('crud', null); $bWithPagination = _root::getParam('withPagination'); $this->genModelMain($sModuleToCreate, $oModel->getTable(), $sClass, $tColumn, $tLabel, $sDefaultField, $tTableOption, $tCrud, $bWithPagination); $this->genModelTpl($sModuleToCreate, $sClass, $tColumn, $oModel->getTable(), $tCrud, $tLabel); $msg = 'Module ' . $sModule . ' généré avec succès'; $detail = 'Création repertoire module/' . $sModule; $detail .= '<br />Création repertoire module/' . $sModule . '/view'; $detail .= '<br />Création fichier module/' . $sModule . '/main.php'; $detail .= '<br />Création fichier module/' . $sModule . '/view/list.php'; $detail .= '<br/><br/>Pour y accéder <a href="' . _root::getConfigVar('path.generation') . _root::getParam('id') . '/public/index.php?:nav=' . $sModule . '::index">cliquer ici (index.php?:nav=' . $sModule . '::index)</a>'; } $oTpl->bModelFilterCountExist = $bModelFilterCountExist; $oTpl->bModelFilterPaginationExist = $bModelFilterPaginationExist; $oTpl->bModelCountExist = $bModelCountExist; $oTpl->bModelPaginationExist = $bModelPaginationExist; $oTpl->msg = $msg; $oTpl->detail = $detail; $oTpl->tFile = $tFile; return $oTpl; }
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 _index() { module_builder::getTools()->rootAddConf('conf/connexion.ini.php'); $msg = ''; $detail = ''; $oDir = new _dir(_root::getConfigVar('path.generation') . _root::getParam('id') . '/model/'); $tFile = array(); $tRowMethodes = array(); foreach ($oDir->getListFile() as $oFile) { if (preg_match('/.sample.php/', $oFile->getName()) or !preg_match('/.php$/', $oFile->getName())) { continue; } $tFile[] = $oFile->getName(); require_once $oFile->getAdresse(); $sClassFoo = substr($oFile->getName(), 0, -4); $oModelFoo = new $sClassFoo(); if (method_exists($oModelFoo, 'getSelect')) { $tRowMethodes[substr($oFile->getName(), 0, -4)] = substr($oFile->getName(), 0, -4) . '::getSelect()'; } } $oTpl = $this->getView('index'); if (_root::getParam('class') != '') { $sClass = substr(_root::getParam('class'), 0, -4); require_once _root::getConfigVar('path.generation') . _root::getParam('id') . '/model/' . $sClass . '.php'; $tColumn = module_builder::getTools()->getListColumnFromClass($sClass); $oTpl->sClass = $sClass; $tId = module_builder::getTools()->getIdTabFromClass($sClass); foreach ($tColumn as $i => $sColumn) { if (in_array($sColumn, $tId)) { unset($tColumn[$i]); } } $oTpl->tColumn = $tColumn; $oTpl->tRowMethodes = $tRowMethodes; $oModel = new $sClass(); $oTpl->sModuleToCreate = $oModel->getTable(); $oTpl->sgbd = _root::getConfigVar('db.' . $oModel->getConfig() . '.sgbd'); } if ($this->isPost()) { $sModuleToCreate = _root::getParam('moduleToCreate'); $sClass = _root::getParam('sClass'); $tColumn = _root::getParam('tColumn'); $tLabel = _root::getParam('tLabel'); $tType = _root::getParam('tType'); $tEnable = _root::getParam('tEnable'); foreach ($tColumn as $i => $sColumn) { if (!in_array($sColumn, $tEnable)) { unset($tColumn[$i]); } } require_once _root::getConfigVar('path.generation') . _root::getParam('id') . '/model/' . $sClass . '.php'; $oModel = new $sClass(); $sModule = $sModuleToCreate; $this->projectMkdir('module/' . $sModule); $this->projectMkdir('module/' . $sModule . '/view'); $tCrud = _root::getParam('crud', null); $bWithPagination = _root::getParam('withPagination'); $this->genModelMain($sModuleToCreate, $oModel->getTable(), $sClass, $tColumn, $tCrud, $bWithPagination); $this->genModelTpl($sModuleToCreate, $sClass, $tColumn, $oModel->getTable(), $tCrud, $tLabel); $msg = trR('moduleGenereAvecSucces', array('#MODULE#' => $sModule)); $detail = trR('creationRepertoire', array('#REPERTOIRE#' => 'module/' . $sModule)); $detail .= '<br />' . trR('creationRepertoire', array('#REPERTOIRE#' => 'module/' . $sModule . '/view')); $detail .= '<br />' . trR('CreationDuFichierVAR', array('#FICHIER#' => 'module/' . $sModule . '/main.php')); $detail .= '<br />' . trR('CreationDuFichierVAR', array('#FICHIER#' => 'module/' . $sModule . '/view/list.php')); if (in_array('crudEdit', $tCrud)) { $detail .= '<br />' . trR('CreationDuFichierVAR', array('#FICHIER#' => 'module/' . $sModule . '/view/edit.php')); } if (in_array('crudNew', $tCrud)) { $detail .= '<br />' . trR('CreationDuFichierVAR', array('#FICHIER#' => 'module/' . $sModule . '/view/new.php')); } if (in_array('crudShow', $tCrud)) { $detail .= '<br />' . trR('CreationDuFichierVAR', array('#FICHIER#' => 'module/' . $sModule . '/view/show.php')); } if (in_array('crudDelete', $tCrud)) { $detail .= '<br />' . trR('CreationDuFichierVAR', array('#FICHIER#' => 'module/' . $sModule . '/view/delete.php')); } $sCode = '<?php ' . "\n"; $sCode .= '//instancier le module' . "\n"; $sCode .= '$oModule' . ucfirst(strtolower($sModule)) . '=new module_' . $sModule . ";\n\n"; $sCode .= '//si vous souhaitez indiquer au module integrable des informations sur le module parent' . "\n"; $sCode .= '//$oModuleExamplemodule->setRootLink(\'module::action\',array(\'parametre\'=>_root::getParam(\'parametre\')));' . "\n\n"; $sCode .= '//recupere la vue du module' . "\n"; $sCode .= '$oView=$oModule' . ucfirst(strtolower($sModule)) . '->_index();' . "\n"; $sCode .= "\n"; $sCode .= '//assigner la vue retournee a votre layout' . "\n"; $sCode .= '$this->oLayout->add(\'main\',$oView);' . "\n"; $detail .= '<br/><br/>' . tr('pourLutiliser') . '<br /> ' . highlight_string($sCode, 1); } $oTpl->msg = $msg; $oTpl->detail = $detail; $oTpl->tFile = $tFile; return $oTpl; }
private function analyze($oTpl) { $error = null; $msg = null; $detail = null; module_builder::getTools()->rootAddConf('conf/connexion.ini.php'); $oDir = new _dir(_root::getConfigVar('path.generation') . _root::getParam('id') . '/model/'); $tFile = array(); $tRowMethodes = array(); foreach ($oDir->getListFile() as $oFile) { if (preg_match('/.sample.php/', $oFile->getName()) or !preg_match('/.php$/', $oFile->getName())) { continue; } $tFile[] = $oFile->getName(); require_once $oFile->getAdresse(); $sClassFoo = substr($oFile->getName(), 0, -4); $oModelFoo = new $sClassFoo(); if (method_exists($oModelFoo, 'getSelect')) { $tRowMethodes[substr($oFile->getName(), 0, -4)] = substr($oFile->getName(), 0, -4) . '::getSelect()'; } } if (_root::getParam('model') != '') { $sClass = substr(_root::getParam('model'), 0, -4); require_once _root::getConfigVar('path.generation') . _root::getParam('id') . '/model/' . $sClass . '.php'; $tBlackListMethod = get_class_methods('abstract_model'); $tBlackListMethod[] = 'getInstance'; $tMethod = array(); $tMethod0 = get_class_methods($sClass); foreach ($tMethod0 as $sMethod) { if (!in_array($sMethod, $tBlackListMethod)) { $tMethod[] = $sMethod; } } $oTpl->tMethod = $tMethod; } if (_root::getParam('model') != '' and _root::getParam('method') != '') { $tModule = module_builder::getTools()->getListModule(); $sClass = substr(_root::getParam('model'), 0, -4); require_once _root::getConfigVar('path.generation') . _root::getParam('id') . '/model/' . $sClass . '.php'; $sMethod = _root::getParam('method'); module_builder::getTools()->loadConfig($sClass); $oModel = new $sClass(); $tData = array(); try { $tData = $oModel->{$sMethod}(); if (!$tData) { $error = 'Votre methode ' . $sMethod . ' ne retourne pas d\'enregistrement.<br />'; $error .= 'Ce generateur necessite d\'avoir des donnees pour construire le tableau'; } } catch (Exception $e) { $error = 'La methode ' . $sMethod . ' n\'est pas compatible avec ce generateur'; } $tColumn = array(); if ($tData) { foreach ($tData as $oRow) { if (is_subclass_of($oRow, 'abstract_row')) { $tColumn0 = $oRow->getTab(); } else { $tColumn0 = get_object_vars($oRow); } $tColumn = array_keys($tColumn0); break; } } else { } $oTpl->sClass = $sClass; $oTpl->tModule = $tModule; $tId = module_builder::getTools()->getIdTabFromClass($sClass); foreach ($tColumn as $i => $sColumn) { if (in_array($sColumn, $tId)) { unset($tColumn[$i]); } } $oTpl->tColumn = $tColumn; $oTpl->tRowMethodes = $tRowMethodes; $oModel = new $sClass(); $oTpl->sModuleToCreate = $oModel->getTable(); } $oTpl->msg = $msg; $oTpl->detail = $detail; $oTpl->tFile = $tFile; $oTpl->error = $error; return $oTpl; }
public function _index() { $tMessage = $this->process(); module_builder::getTools()->rootAddConf('conf/connexion.ini.php'); $oDir = new _dir(_root::getConfigVar('path.generation') . _root::getParam('id') . '/model/'); $tFile = array(); $tRowMethodes = array(); foreach ($oDir->getListFile() as $oFile) { if (preg_match('/.sample.php/', $oFile->getName()) or !preg_match('/.php$/', $oFile->getName())) { continue; } $tFile[] = $oFile->getName(); require_once $oFile->getAdresse(); $sClassFoo = substr($oFile->getName(), 0, -4); $oModelFoo = new $sClassFoo(); if (method_exists($oModelFoo, 'getListAccount') and method_exists($oModelFoo, 'hashPassword')) { $tRowMethodes[substr($oFile->getName(), 0, -4)] = substr($oFile->getName(), 0, -4) . '::getInstance()->getListAccount() et hashPassword()'; } } if (_root::getParam('model') == null) { $tRowMethodes = array(); } $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; } $tColumnAccount = null; $sClassAccount = _root::getParam('model'); if ($sClassAccount) { $sClassAccount = substr($sClassAccount, 0, -4); $tColumnAccount = module_builder::getTools()->getListColumnFromClass($sClassAccount); } $oTpl = $this->getView('index'); $oTpl->tRowMethodes = $tRowMethodes; $oTpl->tModuleAndMethod = $tModuleAndMethod; $oTpl->tFile = $tFile; $oTpl->tColumnAccount = $tColumnAccount; $oTpl->tError = $this->tError; $oTpl->msg = $this->msg; $oTpl->detail = $this->detail; $oTpl->tMessage = $tMessage; return $oTpl; }
<?php $sPath = _root::getParam('path', '..'); $oDir = new _dir($sPath); $tDir = $oDir->getList(); $sParent = '..'; if (preg_match('/\\//', $sPath)) { $tParent = explode('/', $sPath); array_pop($tParent); $sParent = implode('/', $tParent); } $tReturn = $this->tReturn; if (isset($tReturn['error'])) { ?> <p class="error" style="padding:8px;border:1px dotted red;margin:8px;"><strong>ERROR:</strong> <?php echo $tReturn['error']; ?> </p> <?php } ?> Vous allez exporter votre projet vers le répertoire ci-dessous: <h2><?php echo $sPath; ?> </h2> <div class="smenu"> <ul> <h3>Sélectionnez le répertoire où copier le projet:</h3> <li><a href="<?php
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é du lien'; $ok = 0; } } if ($ok) { if (module_builder::getTools()->projetmkdir('module/' . $sModule) == true) { $detail = 'Création repertoire module/' . $sModule; if (module_builder::getTools()->projetmkdir('module/' . $sModule . '/view') == true) { $detail .= '<br />Création répertoire module/' . $sModule . '/view'; $this->genModuleMenuMain($sModule, $tMethod, $tLabel); $msg = 'Module ' . $sModule . ' généré avec succès'; $detail .= '<br />Création fichier module/' . $sModule . '/main.php'; $detail .= '<br />Cré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éjà existant module/' . $sModule . '/view'; } } else { $detail = 'Warning: repertoire module/' . $sModule . ' déjà 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; }
public function projetmkdir($sRep) { $oDir = new _dir(_root::getConfigVar('path.generation') . _root::getParam('id') . '/' . $sRep); try { $oDir->save(); $oDir->chmod(0777); } catch (Exception $e) { //pas grave si repertoire existe deja, mais on avertir quand meme return false; } return true; }
public function _index() { module_builder::getTools()->rootAddConf('conf/connexion.ini.php'); $msg = ''; $detail = ''; $oDir = new _dir(_root::getConfigVar('path.generation') . _root::getParam('id') . '/model/'); $tFile = array(); $tRowMethodes = array(); foreach ($oDir->getListFile() as $oFile) { if (preg_match('/.sample.php/', $oFile->getName()) or !preg_match('/.php$/', $oFile->getName())) { continue; } $tFile[] = $oFile->getName(); require_once $oFile->getAdresse(); $sClassFoo = substr($oFile->getName(), 0, -4); $oModelFoo = new $sClassFoo(); if (method_exists($oModelFoo, 'getSelect')) { $tRowMethodes[substr($oFile->getName(), 0, -4)] = substr($oFile->getName(), 0, -4) . '::getSelect()'; } } $oTpl = new _Tpl('moduleCrudBootstrap::index'); if (_root::getParam('class') != '') { $sClass = substr(_root::getParam('class'), 0, -4); require_once _root::getConfigVar('path.generation') . _root::getParam('id') . '/model/' . $sClass . '.php'; $tColumn = module_builder::getTools()->getListColumnFromClass($sClass); $oTpl->sClass = $sClass; $tId = module_builder::getTools()->getIdTabFromClass($sClass); foreach ($tColumn as $i => $sColumn) { if (in_array($sColumn, $tId)) { unset($tColumn[$i]); } } $oTpl->tColumn = $tColumn; $oTpl->tRowMethodes = $tRowMethodes; $oModel = new $sClass(); $oTpl->sModuleToCreate = $oModel->getTable(); } if (_root::getRequest()->isPost()) { $sModuleToCreate = _root::getParam('moduleToCreate'); $sClass = _root::getParam('sClass'); $tColumn = _root::getParam('tColumn'); $tLabel = _root::getParam('tLabel'); $tType = _root::getParam('tType'); $tEnable = _root::getParam('tEnable'); foreach ($tColumn as $i => $sColumn) { if (!in_array($sColumn, $tEnable)) { unset($tColumn[$i]); } } require_once _root::getConfigVar('path.generation') . _root::getParam('id') . '/model/' . $sClass . '.php'; $oModel = new $sClass(); $sModule = $sModuleToCreate; module_builder::getTools()->projetmkdir('module/' . $sModule); module_builder::getTools()->projetmkdir('module/' . $sModule . '/view'); $tCrud = _root::getParam('crud', null); $bWithPagination = _root::getParam('withPagination'); $this->genModelMain($sModuleToCreate, $oModel->getTable(), $sClass, $tColumn, $tCrud, $bWithPagination); $this->genModelTpl($sModuleToCreate, $sClass, $tColumn, $oModel->getTable(), $tCrud, $tLabel); $msg = 'Module ' . $sModule . ' généré avec succès'; $detail = 'Création repertoire module/' . $sModule; $detail .= '<br />Création repertoire module/' . $sModule . '/view'; $detail .= '<br />Création fichier module/' . $sModule . '/main.php'; $detail .= '<br />Création fichier module/' . $sModule . '/view/list.php'; if (in_array('crudEdit', $tCrud)) { $detail .= '<br />Création fichier module/' . $sModule . '/view/edit.php'; } if (in_array('crudNew', $tCrud)) { $detail .= '<br />Création fichier module/' . $sModule . '/view/new.php'; } if (in_array('crudShow', $tCrud)) { $detail .= '<br />Création fichier module/' . $sModule . '/view/show.php'; } if (in_array('crudDelete', $tCrud)) { $detail .= '<br />Création fichier module/' . $sModule . '/view/delete.php'; } $detail .= '<br/><br/>Pour y accéder <a href="' . _root::getConfigVar('path.generation') . _root::getParam('id') . '/public/index.php?:nav=' . $sModule . '::index">cliquer ici (index.php?:nav=' . $sModule . '::index)</a>'; } $oTpl->msg = $msg; $oTpl->detail = $detail; $oTpl->tFile = $tFile; return $oTpl; }
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; } } }
public function _index() { module_builder::getTools()->rootAddConf('conf/connexion.ini.php'); $msg = ''; $detail = ''; $oDir = new _dir(_root::getConfigVar('path.generation') . _root::getParam('id') . '/model/'); $tFile = array(); $tRowMethodes = array(); foreach ($oDir->getListFile() as $oFile) { if (preg_match('/.sample.php/', $oFile->getName()) or !preg_match('/.php$/', $oFile->getName())) { continue; } $tFile[] = $oFile->getName(); require_once $oFile->getAdresse(); $sClassFoo = substr($oFile->getName(), 0, -4); $oModelFoo = new $sClassFoo(); if (method_exists($oModelFoo, 'getSelect')) { $tRowMethodes[substr($oFile->getName(), 0, -4)] = substr($oFile->getName(), 0, -4) . '::getSelect()'; } } $oTpl = new _Tpl('moduleCrudEmbeddedReadonly::index'); if (_root::getParam('class') != '') { $sClass = substr(_root::getParam('class'), 0, -4); require_once _root::getConfigVar('path.generation') . _root::getParam('id') . '/model/' . $sClass . '.php'; $tColumn = module_builder::getTools()->getListColumnFromClass($sClass); $oTpl->sClass = $sClass; $tId = module_builder::getTools()->getIdTabFromClass($sClass); foreach ($tColumn as $i => $sColumn) { if (in_array($sColumn, $tId)) { unset($tColumn[$i]); } } $oTpl->tColumn = $tColumn; $oTpl->tRowMethodes = $tRowMethodes; $oModel = new $sClass(); $oTpl->sModuleToCreate = $oModel->getTable(); } if (_root::getRequest()->isPost()) { $sModuleToCreate = _root::getParam('moduleToCreate'); $sClass = _root::getParam('sClass'); $tColumn = _root::getParam('tColumn'); $tType = _root::getParam('tType'); $tEnable = _root::getParam('tEnable'); foreach ($tColumn as $i => $sColumn) { if (!in_array($sColumn, $tEnable)) { unset($tColumn[$i]); } } require_once _root::getConfigVar('path.generation') . _root::getParam('id') . '/model/' . $sClass . '.php'; $oModel = new $sClass(); $sModule = $sModuleToCreate; module_builder::getTools()->projetmkdir('module/' . $sModule); module_builder::getTools()->projetmkdir('module/' . $sModule . '/view'); $this->genModelMainCrudembeddedReadonly($sModuleToCreate, $oModel->getTable(), $sClass, $tColumn); $this->genModelTplCrudembeddedReadonly($sModuleToCreate, $sClass, $tColumn, $oModel->getTable()); $msg = 'Module ' . $sModule . ' généré avec succès'; $detail = 'Création repertoire module/' . $sModule; $detail .= '<br />Création repertoire module/' . $sModule . '/view'; $detail .= '<br />Création fichier module/' . $sModule . '/main.php'; $detail .= '<br />Création fichier module/' . $sModule . '/view/list.php'; $detail .= '<br />Création fichier module/' . $sModule . '/view/edit.php'; $detail .= '<br />Création fichier module/' . $sModule . '/view/new.php'; $detail .= '<br />Création fichier module/' . $sModule . '/view/show.php'; $detail .= '<br />Création fichier module/' . $sModule . '/view/delete.php'; $sCode = '<?php ' . "\n"; $sCode .= '//instancier le module' . "\n"; $sCode .= '$oModule' . ucfirst(strtolower($sModule)) . '=new module_' . $sModule . ";\n\n"; $sCode .= '//si vous souhaitez indiquer au module integrable des informations sur le module parent' . "\n"; $sCode .= '//$oModuleExamplemodule->setRootLink(\'module::action\',array(\'parametre\'=>_root::getParam(\'parametre\')));' . "\n\n"; $sCode .= '//recupere la vue du module' . "\n"; $sCode .= '$oView=$oModule' . ucfirst(strtolower($sModule)) . '->_index();' . "\n"; $sCode .= "\n"; $sCode .= '//assigner la vue retournee a votre layout' . "\n"; $sCode .= '$this->oLayout->add(\'main\',$oView);' . "\n"; $detail .= '<br/><br/>Pour l\'utiliser, indiquez:<br /> ' . highlight_string($sCode, 1); } $oTpl->msg = $msg; $oTpl->detail = $detail; $oTpl->tFile = $tFile; return $oTpl; }
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é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ée dans ' . $sTo; $detail .= '<br/>Dans votre projet, la librairie du framework pointe sur ' . $sLib; return array('ok' => 'Projet bien exporté 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ée dans ' . $sTo; $detail .= '<br/>Dans votre projet, la librairie du framework a ete copie dans ' . $sLib; return array('ok' => 'Projet bien exporté sur ' . $sTo, 'detail' => $detail); } } }
public function _index() { module_builder::getTools()->rootAddConf('conf/connexion.ini.php'); $msg = ''; $detail = ''; $oDir = new _dir(_root::getConfigVar('path.generation') . _root::getParam('id') . '/model/'); $tFile = array(); $tRowMethodes = array(); foreach ($oDir->getListFile() as $oFile) { if (preg_match('/.sample.php/', $oFile->getName()) or !preg_match('/.php$/', $oFile->getName())) { continue; } $tFile[] = $oFile->getName(); require_once $oFile->getAdresse(); $sClassFoo = substr($oFile->getName(), 0, -4); $oModelFoo = new $sClassFoo(); if (method_exists($oModelFoo, 'getSelect')) { $tRowMethodes[substr($oFile->getName(), 0, -4)] = substr($oFile->getName(), 0, -4) . '::getSelect()'; } } $oTpl = $this->getView('index'); if (_root::getParam('class') != '') { $sClass = substr(_root::getParam('class'), 0, -4); require_once _root::getConfigVar('path.generation') . _root::getParam('id') . '/model/' . $sClass . '.php'; $tColumn = module_builder::getTools()->getListColumnFromClass($sClass); $oTpl->sClass = $sClass; $tId = module_builder::getTools()->getIdTabFromClass($sClass); foreach ($tColumn as $i => $sColumn) { if (in_array($sColumn, $tId)) { unset($tColumn[$i]); } } $oTpl->tColumn = $tColumn; $oTpl->tRowMethodes = $tRowMethodes; $oModel = new $sClass(); $oTpl->sModuleToCreate = $oModel->getTable(); $oTpl->sgbd = _root::getConfigVar('db.' . $oModel->getConfig() . '.sgbd'); } if ($this->isPost()) { $sModuleToCreate = _root::getParam('moduleToCreate'); $sClass = _root::getParam('sClass'); $tColumn = _root::getParam('tColumn'); $tLabel = _root::getParam('tLabel'); $tType = _root::getParam('tType'); $tEnable = _root::getParam('tEnable'); foreach ($tColumn as $i => $sColumn) { if (!in_array($sColumn, $tEnable)) { unset($tColumn[$i]); } } require_once _root::getConfigVar('path.generation') . _root::getParam('id') . '/model/' . $sClass . '.php'; $oModel = new $sClass(); $sModule = $sModuleToCreate; $this->projectMkdir('module/' . $sModule); $this->projectMkdir('module/' . $sModule . '/view'); $tCrud = array('crudShow'); $bWithPagination = _root::getParam('withPagination'); $this->genModelMain($sModuleToCreate, $oModel->getTable(), $sClass, $tColumn, $tCrud, $bWithPagination); $this->genModelTpl($sModuleToCreate, $sClass, $tColumn, $oModel->getTable(), $tCrud, $tLabel); $msg = trR('moduleGenereAvecSucces', array('#MODULE#' => $sModule)); $detail = trR('creationRepertoire', array('#REPERTOIRE#' => 'module/' . $sModule)); $detail .= '<br />' . trR('creationRepertoire', array('#REPERTOIRE#' => 'module/' . $sModule . '/view')); $detail .= '<br />' . trR('CreationDuFichierVAR', array('#FICHIER#' => 'module/' . $sModule . '/main.php')); $detail .= '<br />' . trR('CreationDuFichierVAR', array('#FICHIER#' => 'module/' . $sModule . '/view/list.php')); if (in_array('crudShow', $tCrud)) { $detail .= '<br />' . trR('CreationDuFichierVAR', array('#FICHIER#' => 'module/' . $sModule . '/view/show.php')); } $detail .= '<br/><br/>' . tr('accessibleVia') . '<a href="' . _root::getConfigVar('path.generation') . _root::getParam('id') . '/public/index.php?:nav=' . $sModule . '::index">index.php?:nav=' . $sModule . '::index</a>'; } $oTpl->msg = $msg; $oTpl->detail = $detail; $oTpl->tFile = $tFile; return $oTpl; }
private function projetmkdir($sRep) { $oDir = new _dir($this->sProjectPath . '/' . $sRep); try { $oDir->save(); $oDir->chmod(0777); } catch (Exception $e) { //pas grave si repertoire existe deja, mais on avertir quand meme return false; } return true; }
public function getListTable() { $oDir = new _dir($this->_tConfig[$this->_sConfig . '.database']); $tDir = $oDir->getList(); $tSDir = array(); foreach ($tDir as $oDir) { $tSDir[] = preg_replace('/\\.csv/', '', $oDir->getName()); } return $tSDir; }
public function _index() { $tMessage = $this->generate(); module_builder::getTools()->rootAddConf('conf/connexion.ini.php'); $msg = null; $detail = null; if (isset($tMessage['success']) and $tMessage['success'] == 1) { $sModuleName = _root::getParam('modulename'); $msg = 'Création du module ' . $sModuleName; $detail = ' Création du repertoire module/' . $sModuleName . '<br/> Création du fichier module/' . $sModuleName . '/main.php<br/> Création du repertoire module/' . $sModuleName . '/view<br/> Création du fichier module/' . $sModuleName . '/view/login.php<br/> <br/> Editez votre fichier <a target="_blank" href="' . _root::getLink('code::index', array('project' => _root::getParam('id'), 'file' => 'conf/site.ini.php')) . '">conf/site.ini.php</a> et indiquez <br/> <div style="padding:8px;border:2px dotted gray"> [auth]<br/> enabled=1<br/> et<br/> module=' . $sModuleName . '::login </div> '; } $oDir = new _dir(_root::getConfigVar('path.generation') . _root::getParam('id') . '/model/'); $tFile = array(); $tRowMethodes = array(); foreach ($oDir->getListFile() as $oFile) { if (preg_match('/.sample.php/', $oFile->getName()) or !preg_match('/.php$/', $oFile->getName())) { continue; } $tFile[] = $oFile->getName(); require_once $oFile->getAdresse(); $sClassFoo = substr($oFile->getName(), 0, -4); $oModelFoo = new $sClassFoo(); if (method_exists($oModelFoo, 'getListAccount') and method_exists($oModelFoo, 'hashPassword')) { $tRowMethodes[substr($oFile->getName(), 0, -4)] = substr($oFile->getName(), 0, -4) . '::getInstance()->getListAccount() et hashPassword()'; } } $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; } $tColumnAccount = null; $sClassAccount = _root::getParam('model'); if ($sClassAccount) { $sClassAccount = substr($sClassAccount, 0, -4); $tColumnAccount = module_builder::getTools()->getListColumnFromClass($sClassAccount); } $oTpl = new _Tpl('moduleAuth::index'); $oTpl->tRowMethodes = $tRowMethodes; $oTpl->tModuleAndMethod = $tModuleAndMethod; $oTpl->tMessage = $tMessage; $oTpl->msg = $msg; $oTpl->detail = $detail; $oTpl->tFile = $tFile; $oTpl->tColumnAccount = $tColumnAccount; return $oTpl; }