예제 #1
0
파일: main.php 프로젝트: clavat/mkMarket
 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;
 }
예제 #2
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();
 }
예제 #3
0
파일: main.php 프로젝트: clavat/mkframework
 public function _showXml()
 {
     $oAuteur = model_auteur::getInstance()->findById(_root::getParam('id'));
     $oXml = new plugin_xmlObject($oAuteur);
     $oXml->setListColumn(array('id', 'nom', 'prenom'));
     $oXml->show();
 }
예제 #4
0
 private function generate($sTable, $tField)
 {
     $ret = "\n";
     $sXmlStructure = '<?xml version="1.0" encoding="UTF-8"?>' . $ret;
     $sXmlStructure .= '<structure>' . $ret;
     $sXmlStructure .= '<colonne primaire="true">id</colonne>' . $ret;
     foreach ($tField as $sField) {
         if (trim($sField) == '') {
             continue;
         }
         $sXmlStructure .= '<colonne>' . trim($sField) . '</colonne>' . $ret;
     }
     $sXmlStructure .= '</structure>' . $ret;
     $sXmlMax = '<?xml version="1.0" encoding="ISO-8859-1"?>' . $ret;
     $sXmlMax .= '<main>' . $ret;
     $sXmlMax .= '<max><![CDATA[1]]></max>' . $ret;
     $sXmlMax .= '</main>' . $ret;
     $sPath = _root::getConfigVar('path.generation') . _root::getParam('id') . '/data/xml/base/' . $sTable . '/';
     $oFile = new _file($sPath . 'structure.xml');
     $oFile->setContent($sXmlStructure);
     $oFile->save();
     $sPath = _root::getConfigVar('path.generation') . _root::getParam('id') . '/data/xml/base/' . $sTable . '/';
     $oFile = new _file($sPath . 'max.xml');
     $oFile->setContent($sXmlMax);
     $oFile->save();
 }
예제 #5
0
 private function processInscription()
 {
     if (!_root::getRequest()->isPost()) {
         return null;
     }
     $tAccount = model_example::getInstance()->getListAccount();
     $sLogin = _root::getParam('login');
     $sPassword = _root::getParam('password');
     if ($sPassword != _root::getParam('password2')) {
         return 'Les deux mots de passe doivent etre identiques';
     } elseif (_root::getParam('login') == '') {
         return 'Vous devez remplir le nom d utilisateur';
     } elseif ($sPassword == '') {
         return 'Vous devez remplir le mot de passe';
     } elseif (strlen($sPassword) > $this->maxPasswordLength) {
         return 'Mot de passe trop long';
     } elseif (isset($tAccount[$sLogin])) {
         return 'Utilisateur d&eacute;j&agrave; existant';
     }
     $oExample = new row_example();
     $oExample->loginField = $sLogin;
     $oExample->passField = model_example::getInstance()->hashPassword($sPassword);
     $oExample->save();
     return 'Votre compte a bien &eacute;t&eacute; cr&eacute;&eacute;';
 }
예제 #6
0
파일: main.php 프로젝트: clavat/mkframework
 private function save()
 {
     if (!_root::getRequest()->isPost()) {
         return false;
     }
     $oPluginXsrf = new plugin_xsrf();
     if (!$oPluginXsrf->checkToken(_root::getParam('token'))) {
         //on verifie que le token est valide
         return array('token' => $oPluginXsrf->getMessage());
     }
     $oArticleModel = new model_article();
     $iId = _root::getParam('id', null);
     if ($iId == null) {
         $oArticle = new row_article();
     } else {
         $oArticle = $oArticleModel->findById(_root::getParam('id', null));
     }
     foreach ($oArticleModel->getListColumn() as $sColumn) {
         if (_root::getParam($sColumn, null) == null) {
             continue;
         }
         if (in_array($sColumn, $oArticleModel->getIdTab())) {
             continue;
         }
         $oArticle->{$sColumn} = _root::getParam($sColumn, null);
     }
     if ($oArticle->save()) {
         //une fois enregistre on redirige (vers la page de liste)
         _root::redirect('prive::list');
     } else {
         return $oArticle->getListError();
     }
 }
예제 #7
0
파일: main.php 프로젝트: clavat/mkframework
 public function _login()
 {
     $oView = new _view('auth::login');
     $this->oLayout->add('main', $oView);
     if (_root::getRequest()->isPost()) {
         $sLogin = _root::getParam('login');
         $sPass = sha1(_root::getParam('password'));
         $oModelAccount = new model_account();
         $tAccount = $oModelAccount->getListAccount();
         if (_root::getAuth()->checkLoginPass($tAccount, $sLogin, $sPass)) {
             $oAccount = _root::getAuth()->getAccount();
             $tPermission = model_permission::getInstance()->findByGroup($oAccount->groupe);
             //on purge les permissions en session
             _root::getACL()->purge();
             //boucle sur les permissions
             if ($tPermission) {
                 foreach ($tPermission as $oPermission) {
                     if ($oPermission->allowdeny == 'ALLOW') {
                         _root::getACL()->allow($oPermission->action, $oPermission->element);
                     } else {
                         _root::getACL()->deny($oPermission->action, $oPermission->element);
                     }
                 }
             }
             _root::redirect('prive::list');
         }
     }
 }
예제 #8
0
파일: main.php 프로젝트: clavat/mkMarket
 public function regenerateIndexXml($sConfig, $sTable, $sIndex)
 {
     //$sConfig='xml';
     if (_root::getConfigVar('db.' . $sConfig . '.sgbd') == 'xml') {
         if (!file_exists(_root::getConfigVar('db.' . $sConfig . '.database'))) {
             $sBuilderDbPath = _root::getConfigVar('path.data') . 'genere/' . _root::getParam('id') . '/public/' . _root::getConfigVar('db.' . $sConfig . '.database');
             if (file_exists($sBuilderDbPath)) {
                 _root::setConfigVar('db.' . $sConfig . '.database', $sBuilderDbPath);
             } else {
                 throw new Exception('Base inexistante ' . _root::getConfigVar('db.' . $sConfig . '.database') . ' ni ' . $sBuilderDbPath);
             }
         }
     } else {
         if (_root::getConfigVar('db.' . $sConfig . '.sgbd') == 'csv') {
             if (!file_exists(_root::getConfigVar('db.' . $sConfig . '.database'))) {
                 $sBuilderDbPath = _root::getConfigVar('path.data') . 'genere/' . _root::getParam('id') . '/public/' . _root::getConfigVar('db.' . $sConfig . '.database');
                 if (file_exists($sBuilderDbPath)) {
                     _root::setConfigVar('db.' . $sConfig . '.database', $sBuilderDbPath);
                 } else {
                     throw new Exception('Base inexistante ' . _root::getConfigVar('db.' . $sConfig . '.database') . ' ni ' . $sBuilderDbPath);
                 }
             }
         }
     }
     $oModelFactory = new model_mkfbuilderfactory();
     $oModelFactory->setConfig($sConfig);
     return $oModelFactory->getSgbd()->generateIndexForTable($sTable, $sIndex);
 }
예제 #9
0
 public function _show()
 {
     $oExamplemodel = model_examplemodel::getInstance()->findById(_root::getParam('id'));
     $oView = new _view('examplemodule::show');
     $oView->oExamplemodel = $oExamplemodel;
     //icishow
     $this->oLayout->add('main', $oView);
 }
예제 #10
0
 public function _projetEmbedded()
 {
     if (_root::getParam('action') == 'model') {
         $tLink = array();
     } else {
         //if(_root::getParam('action')=='module'){
         $tLink = array('Modules' => 'title', 'Cr&eacute;er un module' => 'module', 'Cr&eacute;er un module CRUD' => 'crud', 'Cr&eacute;er un module Lecture seule' => 'crudreadonly', 'Cr&eacute;er un module d\'authentification' => 'authmodule', 'Cr&eacute;er un module d\'authentification avec inscription' => 'authwithinscriptionmodule', 'Modules int&eacute;grable' => 'title', 'Cr&eacute;er un module menu ' => 'addmodulemenu', 'Cr&eacute;er un module int&eacute;grable' => 'moduleembedded', 'Cr&eacute;er un module CRUD int&eacute;grable' => 'crudembedded', 'Cr&eacute;er un module Lecture seule int&eacute;grable' => 'crudembeddedreadonly');
     }
     $oTpl = new _tpl('menu::projetEmbedded');
     $oTpl->tLink = $tLink;
     return $oTpl;
 }
예제 #11
0
 public function _category()
 {
     $oView = new _view('default::index');
     $this->oLayout->add('main', $oView);
     //posts (main)
     $oModuleExamplemodule = new module_posts();
     $oModuleExamplemodule->setCategory(_root::getParam('id'));
     //si vous souhaitez indiquer au module integrable des informations sur le module parent
     $oModuleExamplemodule->setRootLink('default::categoryDetail', array('id' => _root::getParam('id')));
     //recupere la vue du module
     $oViewModule = $oModuleExamplemodule->_index();
     //assigner la vue retournee a votre layout
     $this->oLayout->add('main', $oViewModule);
 }
예제 #12
0
파일: main.php 프로젝트: clavat/mkMarket
 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;
 }
예제 #13
0
 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 (_root::getRequest()->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 = 'Table ' . $sTable . ' (champs: ' . implode(',', $tField) . ') g&eacute;n&eacute;r&eacute; avec succ&egrave;s';
         $detail = 'Cr&eacute;ation du fichier sqlite ' . $sDbFilename;
     }
     $oTpl = new _Tpl('moduleSqlite::index');
     $oTpl->msg = $msg;
     $oTpl->detail = $detail;
     $oTpl->tSqlite = $tSqlite;
     return $oTpl;
 }
예제 #14
0
파일: main.php 프로젝트: clavat/mkMarket
 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;
 }
예제 #15
0
파일: main.php 프로젝트: clavat/mkframework
 public function _project()
 {
     $bBootstrap = 0;
     if (file_exists('data/genere/' . _root::getParam('id') . '/layout/bootstrap.php')) {
         $bBootstrap = 1;
     }
     if ($bBootstrap) {
         $tType = array('all', 'bootstrap');
     } else {
         $tType = array('all', 'normal');
     }
     $sLang = _root::getConfigVar('language.default');
     $tLinkModule = array();
     foreach ($tType as $sType) {
         $sPathModule = _root::getConfigVar('path.module') . '/mods/' . $sType;
         $tModulesAll = scandir($sPathModule);
         foreach ($tModulesAll as $sModule) {
             if (file_exists($sPathModule . '/' . $sModule . '/info.ini')) {
                 $tIni = parse_ini_file($sPathModule . '/' . $sModule . '/info.ini');
                 $priority = 999;
                 if (isset($tIni['priority'])) {
                     $priority = $tIni['priority'];
                 }
                 $sPriority = sprintf('%03d', $priority);
                 $tLinkModule[$tIni['category']][$tIni['title.' . $sLang] . ' <sup>version ' . $tIni['version'] . '</sup>'] = $sPriority . 'mods_' . $sType . '_' . $sModule . '::index';
             }
         }
     }
     //$tModules=scandir(_root::getConfigVar('path.module')).'/mods/normal';
     $tTitle = array('market', 'coucheModel', 'modules', 'modulesEmbedded', 'views', 'databasesEmbedded', 'unitTest');
     $tLink = array();
     foreach ($tTitle as $sTitle) {
         if (isset($tLinkModule[$sTitle])) {
             $tLinkModuleCat = $tLinkModule[$sTitle];
             asort($tLinkModuleCat);
             $tLink[tr('menu_' . $sTitle)] = 'title';
             foreach ($tLinkModuleCat as $sLabel => $sLink) {
                 $tLink[$sLabel] = substr($sLink, 3);
             }
         }
     }
     $oTpl = $this->getView('project');
     $oTpl->tLink = $tLink;
     return $oTpl;
 }
예제 #16
0
 public function generate($sTable, $tField)
 {
     $ret = "\n";
     $sep = ';';
     $sFile = '1' . $ret;
     $sFile .= 'id' . $sep;
     foreach ($tField as $sField) {
         if (trim($sField) == '') {
             continue;
         }
         $sFile .= trim($sField) . $sep;
     }
     $sFile .= $ret;
     $sPath = _root::getConfigVar('path.generation') . _root::getParam('id') . '/data/csv/base/' . $sTable . '.csv';
     $oFile = new _file($sPath);
     $oFile->setContent($sFile);
     $oFile->save();
 }
예제 #17
0
파일: main.php 프로젝트: clavat/mkMarket
    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;
    }
예제 #18
0
파일: main.php 프로젝트: clavat/mkMarket
 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;
 }
예제 #19
0
파일: main.php 프로젝트: clavat/mkframework
 public function _save()
 {
     $oAuteurModel = new model_auteur();
     $iId = _root::getParam('id', null);
     if ($iId == null) {
         $oAuteur = new row_auteur();
     } else {
         $oAuteur = $oAuteurModel->findById(_root::getParam('id', null));
     }
     foreach ($oAuteurModel->getListColumn() as $sColumn) {
         if (_root::getParam($sColumn, null) === null) {
             continue;
         }
         if (in_array($sColumn, $oAuteurModel->getIdTab())) {
             continue;
         }
         $oAuteur->{$sColumn} = _root::getParam($sColumn, null);
     }
     $oAuteur->save();
     _root::redirect('auteur::edit', array('id' => $oAuteur->getId()));
 }
예제 #20
0
 private function checkLoginPass()
 {
     //si le formulaire n'est pas envoye on s'arrete la
     if (!_root::getRequest()->isPost()) {
         return null;
     }
     $sLogin = _root::getParam('login');
     $sPassword = _root::getParam('password');
     if (strlen($sPassword > $this->maxPasswordLength)) {
         return 'Mot de passe trop long';
     }
     //on stoque les mots de passe hashe dans la classe model_example
     $sHashPassword = model_example::getInstance()->hashPassword($sPassword);
     $tAccount = model_example::getInstance()->getListAccount();
     //on va verifier que l'on trouve dans le tableau retourne par notre model
     //l'entree $tAccount[ login ][ mot de passe hashe ]
     if (!_root::getAuth()->checkLoginPass($tAccount, $sLogin, $sHashPassword)) {
         return 'Mauvais login/mot de passe';
     }
     _root::redirect('privatemodule_action');
 }
예제 #21
0
파일: main.php 프로젝트: clavat/mkMarket
    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;
    }
예제 #22
0
 private function genModuleMain($sModule, $tAction)
 {
     $sContent = module_builder::getTools()->stringReplaceIn(array('_examplemodule' => '_' . $sModule), 'data/sources/projet/module/example/main.php');
     preg_match_all('/#debutaction#(.*)?#finaction#/s', $sContent, $tMatch);
     $sMethodeSource = $tMatch[1][0];
     $sMethodes = '';
     foreach ($tAction as $sAction) {
         $sAction = trim($sAction);
         if ($sAction == '') {
             continue;
         }
         $sMethodes .= preg_replace('/examplemodule/', $sModule, preg_replace('/exampleaction/', $sAction, $sMethodeSource));
         $oFileTpl = new _file(_root::getConfigVar('path.generation') . _root::getParam('id') . '/module/' . $sModule . '/view/' . $sAction . '.php');
         $oFileTpl->setContent('vue ' . $sModule . '::' . $sAction);
         $oFileTpl->save();
         $oFileTpl->chmod(0666);
     }
     $sContent = preg_replace('/\\/\\/ICI--/', $sMethodes, $sContent);
     $oFile = new _file(_root::getConfigVar('path.generation') . _root::getParam('id') . '/module/' . $sModule . '/main.php');
     $oFile->setContent($sContent);
     $oFile->save();
     $oFile->chmod(0666);
 }
예제 #23
0
 public function processSave()
 {
     if (!_root::getRequest()->isPost() or _root::getParam('formmodule') != self::$sModuleName) {
         //si ce n'est pas une requete POST on ne soumet pas
         return null;
     }
     $oPluginXsrf = new plugin_xsrf();
     if (!$oPluginXsrf->checkToken(_root::getParam('token'))) {
         //on verifie que le token est valide
         return array('token' => $oPluginXsrf->getMessage());
     }
     $iId = module_posts::getParam('id', null);
     if ($iId == null) {
         $oPosts = new row_posts();
     } else {
         $oPosts = model_posts::getInstance()->findById(module_posts::getParam('id', null));
     }
     $tId = model_posts::getInstance()->getIdTab();
     $tColumn = model_posts::getInstance()->getListColumn();
     foreach ($tColumn as $sColumn) {
         $oPluginUpload = new plugin_upload($sColumn);
         if ($oPluginUpload->isValid()) {
             $sNewFileName = _root::getConfigVar('path.upload') . $sColumn . '_' . date('Ymdhis');
             $oPluginUpload->saveAs($sNewFileName);
             $oPosts->{$sColumn} = $oPluginUpload->getPath();
             continue;
         } else {
             if (_root::getParam($sColumn, null) === null) {
                 continue;
             } else {
                 if (in_array($sColumn, $tId)) {
                     continue;
                 }
             }
         }
         $oPosts->{$sColumn} = _root::getParam($sColumn, null);
     }
     if ($oPosts->save()) {
         //une fois enregistre on redirige (vers la page liste)
         $this->redirect('list');
     } else {
         return $oPosts->getListError();
     }
 }
예제 #24
0
echo tr('extensions');
?>
</th>
			<th style="width:80px"><?php 
echo tr('local');
?>
</th>
			<th></th>
			<th></th>
		</tr>

		<?php 
foreach ($this->tBloc as $oBloc) {
    ?>
			<?php 
    if (_root::getParam('hideInstalled') and isset($this->tLocalIni[$oBloc['id']]) and $this->tLocalIni[$oBloc['id']] == $oBloc['version']) {
        ?>

			<?php 
    } else {
        ?>
			<?php 
        $nbLine++;
        ?>
			<tr>
				<td><?php 
        echo $oBloc['title'] . ' <i>' . $oBloc['id'] . '</i>';
        ?>
<br/><span class="author"><?php 
        echo $oBloc['author'];
        ?>
예제 #25
0
 private function getValue($sName)
 {
     $tPost = _root::getParam($sName);
     if ($this->isPost and isset($tPost[$this->id])) {
         return $tPost[$this->id];
     } else {
         if ($this->tObject and isset($this->tObject[$this->i]->{$sName})) {
             return $this->tObject[$this->i]->{$sName};
         }
     }
     return null;
 }
예제 #26
0
 public function genModelTplCrudembeddedReadonly($sModule, $sClass, $tColumn, $sTableName)
 {
     //$tColumn=_root::getParam('tColumn');
     $tType = _root::getParam('tType');
     $tTpl = array('list', 'show');
     foreach ($tTpl as $sTpl) {
         $oFile = new _file('data/sources/fichiers/module/crudembeddedreadonly/view/' . $sTpl . '.php');
         $sContent = $oFile->getContent();
         preg_match_all('/#lignetd(.*)?#fin_lignetd/s', $sContent, $tMatch);
         $sLigne = $tMatch[1][0];
         preg_match_all('/#input(.*)?#fin_input/s', $sContent, $tMatch);
         $sInputText = $tMatch[1][0];
         preg_match_all('/#textarea(.*)?#fin_textarea/s', $sContent, $tMatch);
         $sInputTextarea = $tMatch[1][0];
         preg_match_all('/#select(.*)?#fin_select/s', $sContent, $tMatch);
         $sInputSelect = $tMatch[1][0];
         preg_match_all('/#upload(.*)?#fin_upload/s', $sContent, $tMatch);
         $sInputUpload = $tMatch[1][0];
         if ($sTpl == 'list') {
             //TH
             preg_match_all('/#ligneth(.*)?#fin_ligneth/s', $sContent, $tMatch);
             $sLigneTH = $tMatch[1][0];
         }
         $sTable = '';
         $sTableTh = '';
         $sEnctype = '';
         foreach ($tColumn as $i => $sColumn) {
             $sType = $tType[$i];
             if ($sType == 'text' or $sType == 'date') {
                 $sInput = preg_replace('/examplecolumn/', $sColumn, $sInputText);
                 $sInput = preg_replace('/oExamplemodel/', 'o' . ucfirst($sTableName), $sInput);
             } elseif ($sType == 'textarea') {
                 $sInput = preg_replace('/examplecolumn/', $sColumn, $sInputTextarea);
                 $sInput = preg_replace('/oExamplemodel/', 'o' . ucfirst($sTableName), $sInput);
             } elseif (substr($sType, 0, 7) == 'select;') {
                 $sInput = preg_replace('/examplecolumn/', $sColumn, $sInputSelect);
                 $sInput = preg_replace('/oExamplemodel/', 'o' . ucfirst($sTableName), $sInput);
                 $sInput = preg_replace('/examplemodel/', substr($sType, 7), $sInput);
             } elseif ($sType == 'upload') {
                 $sInput = preg_replace('/examplecolumn/', $sColumn, $sInputUpload);
                 $sInput = preg_replace('/oExamplemodel/', 'o' . ucfirst($sTableName), $sInput);
                 $sEnctype = ' enctype="multipart/form-data"';
                 //changement du enctype du formulaire
             }
             $sTable .= preg_replace('/examplecolumn/', $sColumn, preg_replace('/exampletd/', $sInput, $sLigne));
             $sTableTh .= preg_replace('/exampleth/', $sColumn, $sLigneTH);
         }
         $sContent = module_builder::getTools()->stringReplaceIn(array('oExamplemodel' => 'o' . ucfirst($sTableName), 'tExamplemodel' => 't' . ucfirst($sTableName), 'examplemodule' => $sModule, '<\\?php \\/\\/enctype\\?>' => $sEnctype, '<\\?php \\/\\/ici\\?>' => $sTable, '<\\?php \\/\\/icith\\?>' => $sTableTh, '<\\?php\\/\\*variables(.*)variables\\*\\/\\?>' => ''), 'data/sources/fichiers/module/crudembeddedreadonly/view/' . $sTpl . '.php');
         $oFile = new _file(_root::getConfigVar('path.generation') . _root::getParam('id') . '/module/' . $sModule . '/view/' . $sTpl . '.php');
         $oFile->setContent($sContent);
         $oFile->save();
         $oFile->chmod(0777);
     }
 }
예제 #27
0
파일: list.php 프로젝트: clavat/mkframework
<ul class="projets">
<?php 
if ($this->tProjet) {
    ?>
	<?php 
    foreach ($this->tProjet as $sProjet) {
        ?>
		<li <?php 
        if (_root::getParam('id') == $sProjet) {
            ?>
class="selectionne"<?php 
        }
        ?>
>
								<span><?php 
        echo $sProjet;
        ?>
</span>

								<a href="<?php 
        echo _root::getLink('builder::edit', array('id' => $sProjet));
        ?>
#createon"><?php 
        echo tr('menuNavProject_link_edit');
        ?>
</a>
								
								<a href="<?php 
        echo _root::getLink('code::index', array('project' => $sProjet));
        ?>
"><?php 
예제 #28
0
파일: index.php 프로젝트: clavat/mkMarket
        ?>
"><?php 
        echo $sModule->getName();
        ?>
</option>
					<?php 
    }
    ?>
				
				</select>
			
			</td>
			
			<td>/view/</td>
			<td><input type="text" name="view" value="<?php 
    echo _root::getParam('moduleToCreate', 'listViaModule');
    ?>
"/>.php</td>
			
			 
		</tr>
		
	 
		
	</table>
	
	<br/>
	
	<table>
		<tr>
			<th><?php 
예제 #29
0
 private function genModelTpl($sModule, $sClass, $tColumn, $sTableName, $tCrud, $tLabel)
 {
     //$tColumn=_root::getParam('tColumn');
     $tType = _root::getParam('tType');
     $tCrud[] = 'list';
     $tTpl = array('list', 'show', 'edit', 'new', 'delete');
     $tTplCrud = array('show' => 'crudShow', 'new' => 'crudNew', 'delete' => 'crudDelete', 'edit' => 'crudEdit', 'list' => 'list');
     foreach ($tTpl as $sTpl) {
         //print $sTpl;
         if (!in_array($tTplCrud[$sTpl], $tCrud)) {
             //print "skip $sTpl ";
             continue;
         }
         $oFile = new _file('data/sources/fichiers/module/crudBootstrap/view/' . $sTpl . '.php');
         $sContent = $oFile->getContent();
         $oVar = simplexml_load_file('data/sources/fichiers/module/crudBootstrap/view/' . $sTpl . '.php.xml');
         $sLigne = (string) $oVar->lignetd;
         $sInputText = (string) $oVar->input;
         $sInputTextarea = (string) $oVar->textarea;
         $sInputSelect = (string) $oVar->select;
         $sInputUpload = (string) $oVar->upload;
         $sLinks = '';
         $sLinkNew = '';
         if ($sTpl == 'list') {
             //TH
             $sLigneTH = (string) $oVar->ligneth;
             //liens
             $tLink['crudNew'] = (string) $oVar->linkNew;
             $tLink['crudEdit'] = (string) $oVar->linkEdit;
             $tLink['crudShow'] = (string) $oVar->linkShow;
             $tLink['crudDelete'] = (string) $oVar->linkDelete;
             $iMaxCrud = count($tCrud);
             $iMaxCrud -= 2;
             foreach ($tCrud as $i => $sAction) {
                 if (in_array($sAction, array('crudNew', 'list'))) {
                     continue;
                 }
                 if (!isset($tLink[$sAction])) {
                     continue;
                 }
                 $sLinks .= $tLink[$sAction];
                 if ($i < $iMaxCrud) {
                     //$sLinks .= '| ';
                 }
             }
             if (in_array('crudNew', $tCrud)) {
                 $sLinkNew = $tLink['crudNew'];
             }
         }
         $sTable = '';
         $sTableTh = '';
         $sEnctype = '';
         foreach ($tColumn as $i => $sColumn) {
             $sLabel = $tLabel[$i];
             $sType = $tType[$i];
             if ($sType == 'text' or $sType == 'date') {
                 $sInput = preg_replace('/examplecolumn/', $sColumn, $sInputText);
                 $sInput = preg_replace('/oExamplemodel/', 'o' . ucfirst($sTableName), $sInput);
             } elseif ($sType == 'textarea') {
                 $sInput = preg_replace('/examplecolumn/', $sColumn, $sInputTextarea);
                 $sInput = preg_replace('/oExamplemodel/', 'o' . ucfirst($sTableName), $sInput);
             } elseif (substr($sType, 0, 7) == 'select;') {
                 $sInput = preg_replace('/examplecolumn/', $sColumn, $sInputSelect);
                 $sInput = preg_replace('/oExamplemodel/', 'o' . ucfirst($sTableName), $sInput);
                 $sInput = preg_replace('/examplemodel/', substr($sType, 7), $sInput);
             } elseif ($sType == 'upload') {
                 $sInput = preg_replace('/examplecolumn/', $sColumn, $sInputUpload);
                 $sInput = preg_replace('/oExamplemodel/', 'o' . ucfirst($sTableName), $sInput);
                 $sEnctype = ' enctype="multipart/form-data"';
                 //changement du enctype du formulaire
             }
             $sTable .= preg_replace('/examplecolumn/', $sLabel, preg_replace('/exampletd/', $sInput, $sLigne));
             $sTableTh .= preg_replace('/exampleth/', $sLabel, $sLigneTH);
         }
         $tReplace = array('<\\?php \\/\\/linknew\\?>' => $sLinkNew, '<\\?php \\/\\/links\\?>' => $sLinks, 'oExamplemodel' => 'o' . ucfirst($sTableName), 'tExamplemodel' => 't' . ucfirst($sTableName), 'examplemodule' => $sModule, '<\\?php \\/\\/enctype\\?>' => $sEnctype, '<\\?php \\/\\/ici\\?>' => $sTable, '<\\?php \\/\\/icith\\?>' => $sTableTh, '<\\?php \\/\\/colspan\\?>' => count($tColumn) + 1);
         $sContent = module_builder::getTools()->stringReplaceIn($tReplace, 'data/sources/fichiers/module/crudBootstrap/view/' . $sTpl . '.php');
         $oFile = new _file(_root::getConfigVar('path.generation') . _root::getParam('id') . '/module/' . $sModule . '/view/' . $sTpl . '.php');
         $oFile->setContent($sContent);
         $oFile->save();
         $oFile->chmod(0666);
     }
 }
예제 #30
0
파일: main.php 프로젝트: clavat/mkframework
 public function delete()
 {
     if (!_root::getRequest()->isPost()) {
         //si ce n'est pas une requete POST on ne soumet pas
         return null;
     }
     $oPluginXsrf = new plugin_xsrf();
     if (!$oPluginXsrf->checkToken(_root::getParam('token'))) {
         //on verifie que le token est valide
         return array('token' => $oPluginXsrf->getMessage());
     }
     $oAccountModel = new model_account();
     $iId = _root::getParam('id', null);
     if ($iId != null) {
         $oAccount = $oAccountModel->findById(_root::getParam('id', null));
     }
     $oAccount->delete();
     //une fois enregistre on redirige (vers la page d'edition)
     _root::redirect('account::list');
 }