public function _index() { $msg = ''; $detail = ''; if ($this->isPost()) { $sModule = _root::getParam('module'); $sActions = _root::getParam('actions'); $tAction = explode("\n", $sActions); if ($this->projectMkdir('module/' . $sModule) == true) { $detail = trR('creationRepertoire', array('#REPERTOIRE#' => 'module/' . $sModule)); } else { $detail = trR('repertoireDejaExistant', array('#REPERTOIRE#' => 'module/' . $sModule)); } if ($this->projectMkdir('module/' . $sModule . '/view') == true) { $detail .= '<br />' . trR('creationRepertoire', array('#REPERTOIRE#' => 'module/' . $sModule . '/view')); } else { $detail .= '<br />' . trR('repertoireDejaExistant', array('#REPERTOIRE#' => 'module/' . $sModule . '/view')); } $this->genModuleMain($sModule, $tAction); $msg = trR('moduleGenereAvecSucces', array('#MODULE#' => $sModule, '#listACTION#' => implode(',', $tAction))); $detail .= '<br />' . trR('CreationDuFichierVAR', array('#FICHIER#' => 'module/' . $sModule . '/main.php')); foreach ($tAction as $sAction) { $detail .= '<br />' . trR('CreationDuFichierVAR', array('#FICHIER#' => 'module/' . $sModule . '/view/' . $sAction . '.php')); } $detail .= '<br />' . tr('accessibleVia'); foreach ($tAction as $sAction) { $detail .= '<br />- <a href="data/genere/' . _root::getParam('id') . '/public/index.php?:nav=' . $sModule . '::' . $sAction . '">index.php?:nav=' . $sModule . '::' . $sAction . '</a>'; } } $oTpl = $this->getView('index'); $oTpl->msg = $msg; $oTpl->detail = $detail; 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 _index() { module_builder::getTools()->rootAddConf('conf/connexion.ini.php'); $tConnexion = _root::getConfigVar('db'); $tSqlite = array(); foreach ($tConnexion as $sConfig => $val) { if (substr($val, 0, 6) == 'sqlite') { $tSqlite[substr($sConfig, 0, -4)] = $val; } } $msg = ''; $detail = ''; if ($this->isPost()) { $sDbFilename = _root::getParam('sDbFilename'); $sTable = _root::getParam('sTable'); $tField = _root::getParam('tField'); $tType = _root::getParam('tType'); $tSize = _root::getParam('tSize'); try { $oDb = new PDO($sDbFilename); } catch (PDOException $exception) { die($exception->getMessage()); } $oDb->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $sSql = 'CREATE TABLE IF NOT EXISTS ' . $sTable . '('; $sSql .= 'id INTEGER PRIMARY KEY AUTOINCREMENT'; foreach ($tField as $i => $sField) { $sSql .= ','; $sSql .= $sField . ' ' . $tType[$i]; if ($tType[$i] == 'VARCHAR') { $sSql .= '(' . $tSize[$i] . ')'; } } $sSql .= ')'; try { $oDb->exec($sSql); } catch (PDOException $exception) { die($exception->getMessage()); } $msg = trR('baseTableGenereAvecSucces', array('#maTable#' => $sTable, '#listField#' => implode(',', $tField))); $detail = trR('creationFichier', array('#FICHIER#' => ' sqlite ' . $sDbFilename)); } $oTpl = $this->getView('index'); $oTpl->msg = $msg; $oTpl->detail = $detail; $oTpl->tSqlite = $tSqlite; return $oTpl; }
public function _index() { $msg = ''; $detail = ''; if ($this->isPost()) { $sTable = _root::getParam('sTable'); $tField = explode("\n", _root::getParam('sField')); $this->generate($sTable, $tField); $msg = trR('baseTableGenereAvecSucces', array('#maTable#' => $sTable, '#listField#' => implode(',', $tField))); $detail .= '<br />' . trR('creationFichier', array('#FICHIER#' => 'data/csv/base/' . $sTable . '.csv')); } $oTpl = $this->getView('index'); $oTpl->msg = $msg; $oTpl->detail = $detail; return $oTpl; }
public function _index() { module_builder::getTools()->rootAddConf('conf/connexion.ini.php'); if (_root::getParam('sAction') == 'mongodbAddCollection') { $this->mongodbAddCollection(); } $msg = ''; $detail = ''; $tTables = array(); $tTableColumn = array(); if (_root::getParam('sConfig') != '') { $sConfig = _root::getParam('sConfig'); $tTables = module_builder::getTools()->getListTablesFromConfig($sConfig); $tTableColumn = array(); foreach ($tTables as $sTable) { $tTableColumn[$sTable] = module_builder::getTools()->getListColumnFromConfigAndTable($sConfig, $sTable); } } if (_root::getRequest()->isPost()) { $tEnable = _root::getParam('tEnable'); $tTables = _root::getParam('tTable'); $tPrimary = _root::getParam('tPrimary'); $tSelectEnable = _root::getParam('tSelectEnable'); $tSelectKey = _root::getParam('tSelectKey'); $tSelectVal = _root::getParam('tSelectVal'); foreach ($tTables as $i => $sTable) { if (!in_array($sTable, $tEnable)) { continue; } $tSelect = null; if (is_array($tSelectEnable) and in_array($sTable, $tSelectEnable)) { $tSelect = array('key' => $tSelectKey[$i], 'val' => $tSelectVal[$i]); } $this->generate($sTable, $sConfig, $tPrimary[$i], $tSelect); $detail .= trR('CreationDuFichierVAR', array('#FICHIER#' => 'model/model_' . $sTable)) . '<br />'; } $msg = tr('coucheModeleGenereAvecSucces'); } $oTpl = $this->getView('index'); $oTpl->tTables = $tTables; $oTpl->tTableColumn = $tTableColumn; $oTpl->msg = $msg; $oTpl->detail = $detail; $oTpl->tConnexion = _root::getConfigVar('db'); return $oTpl; }
private function process() { if (_root::getRequest()->isPost() == false) { return null; } $this->msg = tr('coucheModeleGenereAvecSucces'); $this->detail = trR('CreationDuFichierVAR', array('#FICHIER#' => 'model/model_' . $sTable)); $this->projectMkdir('module/' . $sModuleMenuName); /*SOURCE*/ $oSourceModel = $this->getObjectSource('example.php'); /*SOURCE*/ $oSourceModel->setPattern('#maTable#', $maTable); $sSnippet = $oSourceModel->getSnippet('monSnippet', array('#maVar#' => $maValeur)); /*SOURCE*/ $oSourceModel->setPattern('#sSnippet#', $sSnippet); /*SOURCE*/ $oSourceModel->save(); }
private function process() { if (_root::getRequest()->isPost() == false) { return null; } $tError = null; $msg = null; $detail = null; $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] = tr('remplissezLeLibelle'); $ok = 0; } } if ($ok) { if (module_builder::getTools()->projetmkdir('module/' . $sModule) == true) { $detail = trR('creationRepertoire', array('#REPERTOIRE#' => 'module/' . $sModule)); if (module_builder::getTools()->projetmkdir('module/' . $sModule . '/view') == true) { $detail .= '<br />' . trR('creationRepertoire', array('#REPERTOIRE#' => 'module/' . $sModule . '/view')); $this->genModuleMenuMain($sModule, $tMethod, $tLabel); $msg = trR('moduleGenereAvecSucces', array('#MODULE#' => $sModule)); $detail .= '<br />' . trR('CreationDuFichierVAR', array('#FICHIER#' => 'module/' . $sModule . '/main.php')); $detail .= '<br />' . trR('CreationDuFichierVAR', array('#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/>' . tr('pourLutiliserAjoutez') . '<br /> ' . highlight_string($sCode, 1); } else { $detail .= '<br />' . trR('repertoireDejaExistant', array('#REPERTOIRE#' => 'module/' . $sModule . '/view')); } } else { $detail = trR('repertoireDejaExistant', array('#REPERTOIRE#' => 'module/' . $sModule . '/view')); } } $this->tError = $tError; $this->detail = $detail; $this->msg = $msg; }
public function _index() { $msg = ''; $detail = ''; if ($this->isPost()) { $sTable = _root::getParam('sTable'); $tField = explode("\n", _root::getParam('sField')); $this->projectMkdir('data/xml/base/' . $sTable); $this->generate($sTable, $tField); $msg = trR('baseTableGenereAvecSucces', array('#maTable#' => $sTable, '#listField#' => implode(',', $tField))); $detail = trR('creationRepertoire', array('#REPERTOIRE#' => 'data/xml/base/' . $sTable)); $detail .= '<br />' . trR('creationFichier', array('#FICHIER#' => 'data/xml/base/' . $sTable . '/structure.xml')); $detail .= '<br />' . trR('creationFichier', array('#FICHIER#' => 'data/xml/base/' . $sTable . '/max.xml')); } $oTpl = $this->getView('index'); $oTpl->msg = $msg; $oTpl->detail = $detail; return $oTpl; }
public function _index() { $msg = ''; $detail = ''; if ($this->isPost()) { $sModule = _root::getParam('module'); $sActions = _root::getParam('actions'); $tAction = explode("\n", $sActions); if ($this->projectMkdir('module/' . $sModule) == true) { $detail = trR('creationRepertoire', array('#REPERTOIRE#' => 'module/' . $sModule)); } else { $detail = trR('repertoireDejaExistant', array('#REPERTOIRE#' => 'module/' . $sModule)); } if ($this->projectMkdir('module/' . $sModule . '/view') == true) { $detail .= '<br />' . trR('creationRepertoire', array('#REPERTOIRE#' => 'module/' . $sModule . '/view')); } else { $detail .= '<br />' . trR('repertoireDejaExistant', array('#REPERTOIRE#' => 'module/' . $sModule . '/view')); } $this->genModuleMain($sModule, $tAction); $msg = trR('moduleGenereAvecSucces', array('#MODULE#' => $sModule, '#listACTION#' => implode(',', $tAction))); $detail .= '<br />' . trR('CreationDuFichierVAR', array('#FICHIER#' => 'module/' . $sModule . '/main.php')); foreach ($tAction as $sAction) { $detail .= '<br />' . trR('CreationDuFichierVAR', array('#FICHIER#' => 'module/' . $sModule . '/view/' . $sAction . '.php')); } $sCode = '<?php ' . "\n"; $sCode .= '//instancier le module' . "\n"; $sCode .= '$oModule' . ucfirst(strtolower($sModule)) . '=new module_' . $sModule . ";\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('pourLutiliserIndiquez') . ':<br /> ' . highlight_string($sCode, 1); } $oTpl = $this->getView('index'); $oTpl->msg = $msg; $oTpl->detail = $detail; 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 = $this->getView('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 ($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'); $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; $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 = 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')); $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->bModelFilterCountExist = $bModelFilterCountExist; $oTpl->bModelFilterPaginationExist = $bModelFilterPaginationExist; $oTpl->bModelCountExist = $bModelCountExist; $oTpl->bModelPaginationExist = $bModelPaginationExist; $oTpl->msg = $msg; $oTpl->detail = $detail; $oTpl->tFile = $tFile; return $oTpl; }
private function unzipTo($sUrl, $sTarget) { try { file_put_contents($sTarget . '.zip', file_get_contents($sUrl)); } catch (Exception $e) { $this->errorZip = trR('urlNonDispo', array('#url#' => $sUrl)); return false; } $zip = new ZipArchive(); if ($zip->open($sTarget . '.zip')) { $zip->extractTo($sTarget); $zip->close(); try { chmod($sTarget, 0777); } catch (Exception $e) { } //menage unlink($sTarget . '.zip'); } return true; }
PRIMARY KEY (`id`) ); CREATE TABLE `Actions` ( `id` int(11) NOT NULL auto_increment, `name` varchar(50) NOT NULL, PRIMARY KEY (`id`) );</textarea></div> <p> </p> <h2><?php echo tr('coucheModel'); ?> </h2> <p><?php echo trR('genererLaCoucheModel', array('#LINK#' => _root::getLink('builder::edit', array('id' => _root::getParam('id'), 'action' => 'mods_all_model::index')) . '#createon')); ?> </p> <p> </p> <a id="formulaire" name="formulaire"></a> <h2><?php echo tr('miseEnPlace'); ?> </h2> <p><?php echo tr('vousNetesPasObligerDutiliserLesmemes'); ?> </p> <p class="center"><img src="site/css/images/rightsManagerMultiMcd.png"/></p>
private function process() { if (_root::getRequest()->isPost() == false or _root::getParam('actioncode') != 'generate') { return null; } $tField = $this->tField; $oValid = new plugin_valid(_root::getRequest()->getParams()); foreach ($tField as $sField) { $oValid->isLongerOrEqualThan($sField, 2, 'obligatoire'); } if (!$oValid->isValid()) { return $oValid->getListError(); } //ok $sClassModelRightsManager = 'model_' . _root::getParam('modelToGenerate'); $sClassRowRightsManager = 'row_' . _root::getParam('modelToGenerate'); $sObjectRightManger = 'o' . ucfirst(_root::getParam('modelToGenerate')); $sModuleRightsManager = _root::getParam('moduleToGenerate'); //permissions $classModelPermission = _root::getParam('classModelPermission'); include_once _root::getConfigVar('path.generation') . _root::getParam('id') . '/model/' . $classModelPermission . '.php'; $oPermission = new $classModelPermission(); //actions $classModelAction = _root::getParam('classModelAction'); include_once _root::getConfigVar('path.generation') . _root::getParam('id') . '/model/' . $classModelAction . '.php'; $oAction = new $classModelAction(); //items $classModelItem = _root::getParam('classModelItem'); include_once _root::getConfigVar('path.generation') . _root::getParam('id') . '/model/' . $classModelItem . '.php'; $oItem = new $classModelItem(); //groups $classModelGroup = _root::getParam('classModelGroup'); include_once _root::getConfigVar('path.generation') . _root::getParam('id') . '/model/' . $classModelGroup . '.php'; $oGroup = new $classModelGroup(); //groupsUser $classModelGroupUser = _root::getParam('classModelGroupUser'); include_once _root::getConfigVar('path.generation') . _root::getParam('id') . '/model/' . $classModelGroupUser . '.php'; $oGroupUser = new $classModelGroupUser(); //users $classModelUser = _root::getParam('classModelUser'); include_once _root::getConfigVar('path.generation') . _root::getParam('id') . '/model/' . $classModelUser . '.php'; $oUser = new $classModelUser(); $exampleConfig = $oPermission->getConfig(); $exampleTable = $oPermission->getTable(); $exampleUserGroups_id = _root::getParam('classModelUser_groups_id'); $exampleAction_name = _root::getParam('classModelAction_name'); $exampleItem_name = _root::getParam('classModelItem_name'); //exampleGroups_id //exampleAction_name //exampleItem_name $sPermissionTable = $oPermission->getTable(); $sPermissionActionId = _root::getParam('classModelPermission_actions_id'); $sPermissionItemId = _root::getParam('classModelPermission_items_id'); $sPermissionGroupId = _root::getParam('classModelPermission_groups_id'); $sPermissionId = _root::getParam('classModelPermission_id'); $sActionTable = $oAction->getTable(); $sActionId = _root::getParam('classModelAction_id'); $sActionName = _root::getParam('classModelAction_name'); $sItemTable = $oItem->getTable(); $sItemId = _root::getParam('classModelItem_id'); $sItemName = _root::getParam('classModelItem_name'); $sGroupTable = $oGroup->getTable(); $sGroupId = _root::getParam('classModelGroup_id'); $sGroupName = _root::getParam('classModelGroup_name'); $sGroupUserTable = $oGroupUser->getTable(); $sGroupUserUserId = _root::getParam('classModelGroupUser_users_id'); $sGroupUserGroupId = _root::getParam('classModelGroupUser_groups_id'); $sUserTable = $oUser->getTable(); $sUserId = _root::getParam('classModelUser_id'); $sUserGroupId = _root::getParam('classModelUser_groups_id'); $sUserLogin = _root::getParam('classModelUser_login'); $r = "\n"; $t = "\t"; //requete requeteFindListByUser /*SOURCE*/ $oSourceModel = $this->getObjectSource('model_rightsManagerMulti.php'); $exampleRequeteFindListByUser = $oSourceModel->getSnippet('requeteFindListByUser', array('#sActionTable#' => $sActionTable, '#sActionId#' => $sActionId, '#sActionName#' => $sActionName, '#sItemTable#' => $sItemTable, '#sItemId#' => $sItemId, '#sItemName#' => $sItemName, '#sGroupUserTable#' => $sGroupUserTable, '#sGroupUserGroupId#' => $sGroupUserGroupId, '#sGroupUserUserId#' => $sGroupUserUserId, '#sPermissionTable#' => $sPermissionTable, '#sPermissionItemId#' => $sPermissionItemId, '#sPermissionActionId#' => $sPermissionActionId, '#sPermissionGroupId#' => $sPermissionGroupId)); //requete findAll $exampleRequeteFindAll = $oSourceModel->getSnippet('exampleRequeteFindAll', array('#sActionTable#' => $sActionTable, '#sActionId#' => $sActionId, '#sActionName#' => $sActionName, '#sItemTable#' => $sItemTable, '#sItemId#' => $sItemId, '#sItemName#' => $sItemName, '#sGroupTable#' => $sGroupTable, '#sGroupId#' => $sGroupId, '#sGroupName#' => $sGroupName, '#sPermissionId#' => $sPermissionId, '#sPermissionTable#' => $sPermissionTable, '#sPermissionItemId#' => $sPermissionItemId, '#sPermissionActionId#' => $sPermissionActionId, '#sPermissionGroupId#' => $sPermissionGroupId)); /*SOURCE*/ $oSourceModel->setPattern('#model_examplemodel#', $sClassModelRightsManager); /*SOURCE*/ $oSourceModel->setPattern('#row_examplemodel#', $sClassRowRightsManager); /*SOURCE*/ $oSourceModel->setPattern('#exampleTable#', $exampleTable); /*SOURCE*/ $oSourceModel->setPattern('#exampleConfig#', $exampleConfig); /*SOURCE*/ $oSourceModel->setPattern('#requeteFindListByUser#', $exampleRequeteFindListByUser); /*SOURCE*/ $oSourceModel->setPattern('#exampleRequeteFindAll#', $exampleRequeteFindAll); /*SOURCE*/ $oSourceModel->setPattern('#examplePermission_id#', $sPermissionId); /*SOURCE*/ $oSourceModel->setPattern('#exampleUserGroups_id#', $sUserGroupId); /*SOURCE*/ $oSourceModel->setPattern('#exampleAction_name#', $sActionName); /*SOURCE*/ $oSourceModel->setPattern('#exampleItem_name#', $sItemName); /*SOURCE*/ $oSourceModel->setPattern('#exampleGroupTable#', $sGroupTable); /*SOURCE*/ $oSourceModel->setPattern('#exampleGroup_id#', $sGroupId); /*SOURCE*/ $oSourceModel->setPattern('#exampleGroup_name#', $sGroupName); /*SOURCE*/ $oSourceModel->setPattern('#exampleActionTable#', $sActionTable); /*SOURCE*/ $oSourceModel->setPattern('#exampleAction_id#', $sActionId); /*SOURCE*/ $oSourceModel->setPattern('#exampleAction_name#', $sActionName); /*SOURCE*/ $oSourceModel->setPattern('#exampleItemTable#', $sItemTable); /*SOURCE*/ $oSourceModel->setPattern('#exampleItem_id#', $sItemId); /*SOURCE*/ $oSourceModel->setPattern('#exampleItem_name#', $sItemName); /*SOURCE*/ $oSourceModel->setPattern('#exampleUserTable#', $sUserTable); /*SOURCE*/ $oSourceModel->setPattern('#exampleUser_id#', $sUserId); /*SOURCE*/ $oSourceModel->setPattern('#exampleUser_login#', $sUserLogin); /*SOURCE*/ $oSourceModel->setPattern('#exampleUser_groupsId#', $sUserGroupId); /*SOURCE*/ $oSourceModel->setPattern('#exampleGroupUserTable#', $sGroupUserTable); /*SOURCE*/ $oSourceModel->setPattern('#exampleGroupUserGroupId#', $sGroupUserGroupId); /*SOURCE*/ $oSourceModel->setPattern('#exampleGroupUserUserId#', $sGroupUserUserId); /*SOURCE*/ $oSourceModel->setPattern('#sClassModelRightsManager#', $sClassModelRightsManager); /*SOURCE*/ $bSave = $oSourceModel->save(); if ($bSave == false) { return array('error' => trR('fichierExisteDeja', array('#FICHIER#' => 'model/' . $sClassModelRightsManager . '.php'))); } //--module main /*SOURCE*/ $oSourceMain = $this->getObjectSource('example/main.php'); /*SOURCE*/ $oSourceMain->setPattern('#MODULE#', $sModuleRightsManager); $tReplace = array('#examplemodule#' => $sModuleRightsManager, '#model_examplemodel#' => $sClassModelRightsManager, '#row_examplemodel#' => $sClassRowRightsManager, '#oExamplemodel#' => $sObjectRightManger, '#examplePermissionId#' => $sPermissionId, '#exampleGroupId#' => $sPermissionGroupId, '#exampleActionId#' => $sPermissionActionId, '#exampleItemId#' => $sPermissionItemId, '#exampleUserTable#' => $sUserTable, '#exampleUser_id#' => $sUserId, '#exampleUser_login#' => $sUserLogin, '#exampleUser_groupsId#' => $sUserGroupId, '#exampleUserTable#' => $sUserTable, '#exampleUser_id#' => $sUserId, '#exampleUser_login#' => $sUserLogin, '#exampleUser_groupsId#' => $sUserGroupId); /*SOURCE*/ $oSourceMain->setListPattern($tReplace); /*SOURCE*/ $bSave = $oSourceMain->save(); if ($bSave == false) { return array('error' => trR('fichierExisteDeja', array('#FICHIER#' => 'module/' . $sModuleRightsManager . '/main.php'))); } $tView = array('index', 'new', 'edit', 'delete', 'userEdit'); foreach ($tView as $sView) { //--view /*SOURCE*/ $oSourceView = $this->getObjectSource('example/view/' . $sView . '.php'); /*SOURCE*/ $oSourceView->setPattern('#MODULE#', $sModuleRightsManager); /*SOURCE*/ $oSourceView->setListPattern($tReplace); /*SOURCE*/ $bSave = $oSourceView->save(); if ($bSave == false) { return array('error' => trR('fichierExisteDeja', array('#FICHIER#' => 'module/' . $sModuleRightsManager . '/view/' . $sView . '.php'))); } } //----------- $sMsg = null; $sDetail = null; $sMsg = 'Model ' . $sClassModelRightsManager . ' et Module ' . $sModuleRightsManager . ' générés avec succès'; $sDetail .= trR('CreationDuFichierVAR', array('#FICHIER#' => 'model/' . $sClassModelRightsManager . '.php')) . ' <br/><br/>'; $sDetail .= trR('creationRepertoire', array('#REPERTOIRE#' => 'module/' . $sModuleRightsManager . '/')) . '<br/>'; $sDetail .= trR('creationRepertoire', array('#REPERTOIRE#' => 'Création du repertoire module/' . $sModuleRightsManager . '/view/')) . ' <br/>'; $sDetail .= trR('CreationDuFichierVAR', array('#FICHIER#' => 'module/' . $sModuleRightsManager . '/main.php')) . ' <br/>'; $sDetail .= trR('CreationDuFichierVAR', array('#FICHIER#' => 'module/' . $sModuleRightsManager . '/view/index.php')) . ' <br/>'; $sDetail .= trR('CreationDuFichierVAR', array('#FICHIER#' => 'module/' . $sModuleRightsManager . '/view/new.php')) . ' <br/>'; $sDetail .= trR('CreationDuFichierVAR', array('#FICHIER#' => 'module/' . $sModuleRightsManager . '/view/edit.php')) . ' <br/>'; $sDetail .= trR('CreationDuFichierVAR', array('#FICHIER#' => 'module/' . $sModuleRightsManager . '/view/delete.php')) . ' <br/>'; $sDetail .= '<br/><br/>' . tr('accessibleVia') . ' <a href="' . _root::getConfigVar('path.generation') . _root::getParam('id') . '/public/index.php?:nav=' . $sModuleRightsManager . '::index">index.php?:nav=' . $sModuleRightsManager . '::index</a>'; $sModuleAuth = 'auth'; $tConfig = module_builder::getTools()->rootAddConf('conf/site.ini.php'); if (isset($tConfig['auth']) and isset($tConfig['auth']['module'])) { $sModuleAuthAndAction = $tConfig['auth']['module']; if (preg_match('/:/', $sModuleAuthAndAction)) { list($sModuleAuth, $foo) = explode(':', $sModuleAuthAndAction); } } $r = "\n"; $t = "\t"; $sCode = null; $sCode = '<?php ' . "\n"; $sCode .= 'private function checkLoginPass(){' . $r; $sCode .= $t . '(...)' . $r; $sCode .= $t . '$oUser=_root::getAuth()->getAccount();' . $r; $sCode .= $t . $sClassModelRightsManager . '::getInstance()->loadForUser($oUser);' . $r; $sCode .= $r; $sCode .= $t . '_root::redirect(\'privatemodule_action\');' . $r; $sCode .= '}' . $r; $sCodeHighli = highlight_string($sCode, 1); return array('msg' => $sMsg, 'detail' => $sDetail, 'code' => $sCodeHighli, 'auth' => $sModuleAuth); }
private function process() { if (_root::getRequest()->isPost() == false or _root::getParam('formu') != 'generate') { return null; } $oPluginValid = new plugin_valid(_root::getRequest()->getParams()); $oPluginValid->isNotEmpty('modulename', 'Le champ doit être rempli'); $oPluginValid->isNotEmpty('classmodel', 'Le champ doit être rempli'); $oPluginValid->isNotEmpty('redirect', 'Le champ doit être rempli'); if (!$oPluginValid->isValid()) { return $oPluginValid->getListError(); } $sModuleName = _root::getParam('modulename'); $sClassModuleName = 'module_' . $sModuleName; $sRedirectModuleAction = _root::getParam('redirect'); $sModelName = _root::getParam('classmodel'); $sViewName = $sModuleName . '::login'; $sViewInscriptionName = $sModuleName . '::inscription'; $sRowName = preg_replace('/model_/', 'row_', $sModelName); $sLoginField = _root::getParam('loginField'); $sPassField = _root::getParam('passField'); $oExample = 'o' . ucfirst(preg_replace('/model_/', '', $sModelName)); $this->projectMkdir('module/' . $sModuleName); /*SOURCE*/ $oSourceMain = $this->getObjectSource('example/main.php'); /*SOURCE*/ $oSourceMain->setPattern('#MODULE#', $sModuleName); /*SOURCE*/ $oSourceMain->setPattern('#privatemodule_action#', $sRedirectModuleAction); /*SOURCE*/ $oSourceMain->setPattern('#model_example#', $sModelName); /*SOURCE*/ $oSourceMain->setPattern('#row_example#', $sRowName); /*SOURCE*/ $oSourceMain->setPattern('#oExample#', $oExample); /*SOURCE*/ $oSourceMain->setPattern('#auth_login#', $sViewName); /*SOURCE*/ $oSourceMain->setPattern('#auth_inscription#', $sViewInscriptionName); /*SOURCE*/ $oSourceMain->setPattern('#loginField#', $sLoginField); /*SOURCE*/ $oSourceMain->setPattern('#passField#', $sPassField); /*SOURCE*/ $oSourceMain->save(); $this->projectMkdir('module/' . $sModuleName . '/view'); /*SOURCE*/ $oSourceViewLogin = $this->getObjectSource('example/view/login.php'); /*SOURCE*/ $oSourceViewLogin->setPattern('#MODULE#', $sModuleName); /*SOURCE*/ $oSourceViewLogin->save(); /*SOURCE*/ $oSourceViewLogin = $this->getObjectSource('example/view/inscription.php'); /*SOURCE*/ $oSourceViewLogin->setPattern('#MODULE#', $sModuleName); /*SOURCE*/ $oSourceViewLogin->setPattern('#loginField#', $sLoginField); /*SOURCE*/ $oSourceViewLogin->save(); $sModuleName = _root::getParam('modulename'); $this->msg = 'Création du module ' . $sModuleName; $this->detail = trR('creationRepertoire', array('#REPERTOIRE#' => 'module/' . $sModuleName)); $this->detail .= '<br/>' . trR('CreationDuFichierVAR', array('#FICHIER#' => 'module/' . $sModuleName . '/main.php')); $this->detail .= '<br/>' . trR('creationRepertoire', array('#REPERTOIRE#' => 'module/' . $sModuleName)); $this->detail .= '<br/>' . trR('CreationDuFichierVAR', array('#FICHIER#' => 'module/' . $sModuleName . '/view/login.php')); $this->detail .= '<br/>' . trR('CreationDuFichierVAR', array('#FICHIER#' => 'module/' . $sModuleName . '/view/inscription.php')); $this->detail .= '<br/>'; $this->detail .= '<br/>' . trR('editezVotreFichier', array('#link#' => '<a target="_blank" href="' . _root::getLink('code::index', array('project' => _root::getParam('id'), 'file' => 'conf/site.ini.php')) . '">conf/site.ini.php</a>')); $this->detail .= '<br/> <div style="padding:8px;border:2px dotted gray"> [auth]<br/> enabled=1<br/> ' . tr('et') . '<br/> module=' . $sModuleName . '::login </div> '; }
?> " onclick="refresh()" /></li> </ul> <?php } else { ?> <p>Model <?php echo $this->class; ?> 3/4: <span style="color:green">ok</span></p> <?php if (!$this->bModelFilterPaginationExist) { ?> <p class="error"><?php echo trR('ilNousFautUneMethode', array('#method#' => 'findListFilteredAndLimitOrderBy()', '#class#' => $this->class)); ?> <a target="_blank" href="<?php echo _root::getLink('code::index', array('project' => _root::getParam('id'), 'file' => 'model/' . $this->class . '.php')); ?> ">model/<?php echo $this->class; ?> .php</a></p> <ul> <li><?php echo tr('ajoutezUneMethode'); ?> findListFilteredAndLimitOrderBy()</li> <li><?php echo tr('exempleDePaginationAdaptezSelonVotreSgbd');
private function installExtModuleInProject($sModule, $sVersion) { $sRootUrl = _root::getConfigVar('market.builder.url'); $sRootUrl = str_replace('Builder', 'Application', $sRootUrl); $sPathModule = $sModule; $sRootPathModule = module_builder::getTools()->getRootWebsite() . 'module'; $sRootPathApplication = module_builder::getTools()->getRootWebsite(); if (!$this->unzipTo($sRootUrl . '/module/' . $sModule . $sVersion . '.zip', $sRootPathModule . '/' . $sPathModule)) { return $this->errorZip; } list($foo, $sModuleDir) = explode('.', $sPathModule); if (file_exists($sRootPathModule . '/' . $sModuleDir . '/install.ini')) { $tInstallIni = parse_ini_file($sRootPathModule . '/' . $sModuleDir . '/install.ini', true); foreach ($tInstallIni as $tCopy) { $sFrom = $sRootPathModule . '/' . $sModuleDir . '/' . $tCopy['from']; $sTo = $sRootPathApplication . '/' . $tCopy['to']; $sDir = dirname($sTo); if (!is_writable($sDir)) { return trR('repertoireNonWritable', array('#repertoire#' => $sDir)); } if (file_exists($sTo)) { return trR('fichierExisteDeja', array('#fichier#' => $sTo)); } rename($sFrom, $sTo); } } }
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; }
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 processSimple() { if (!_root::getRequest()->isPost()) { return array(null, null); } if (_root::getParam('model') == '' or _root::getParam('method') == '') { return array(null, null); } if (!file_exists('data/genere/' . _root::getParam('id') . '/module/table')) { //copie module table + images $this->importModuleTable(); } $sModule = _root::getParam('module'); $sView = _root::getParam('view'); $tableClass = _root::getParam('tableClass'); $enableAlt = _root::getParam('enableAlt'); $sModel = _root::getParam('model'); $sMethod = _root::getParam('method'); $arrayAlt = _root::getParam('arrayAlt'); $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]); unset($tLabel[$i]); } } $ret = "\n"; $t = "\t"; $sViewContent = '<?php ' . $ret; $sViewContent .= '$oTable = new module_table(\'simple\');' . $ret; $sViewContent .= '$oTable->setClass(\'' . $tableClass . '\');' . $ret; if (!$enableAlt) { $sViewContent .= '/*'; } $sViewContent .= '$oTable->setCycleClass( ' . var_export($arrayAlt, true) . ');' . $ret; if (!$enableAlt) { $sViewContent .= '*/'; } $sViewContent .= $ret; $sViewContent .= '$oTable->setHeader(' . var_export($tLabel, true) . ');' . $ret; $sViewContent .= $ret; $sViewContent .= 'if($this->tData){' . $ret; $sViewContent .= $t . 'foreach($this->tData as $oData){' . $ret; $sViewContent .= $t . $t . '$oTable->addLine(array(' . $ret; foreach ($tColumn as $sColumn) { $sViewContent .= $t . $t . $t . '$oData->' . $sColumn . ',' . $ret; } $sViewContent .= $t . $t . '));' . $ret; $sViewContent .= $t . '}' . $ret; $sViewContent .= '}' . $ret; $sViewContent .= $ret; $sViewContent .= 'echo $oTable->build()->show();'; $oFile = new _file('data/genere/' . _root::getParam('id') . '/module/' . $sModule . '/view/' . $sView . '.php'); if ($oFile->exist()) { return array(tr('vueDejaExistante'), null); } $oFile->setContent($sViewContent); $oFile->save(); $oFile->chmod(0666); $sModel = str_replace('.php', '', $sModel); $msg = trR('CreationDuFichierVAR', array('#FICHIER#' => $sView . '.php')); $detail = ''; $detail .= trR('CreationDuFichierVAR', array('#FICHIER#' => 'module/' . $sModule . '/view/' . $sView . '.php')); $sCode = '<?php ' . "\n"; $sCode .= '//recupere les enregistrements' . "\n"; $sCode .= '$tData=' . $sModel . '::getInstance()->' . $sMethod . '();' . $ret; $sCode .= '//recupere la vue du module' . "\n"; $sCode .= '$oView=new _view(\'' . $sModule . '::' . $sView . '\');' . "\n"; $sCode .= '$oView->tData=$tData;' . $ret; $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); return array($msg, $detail); }