Example #1
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();
 }
Example #2
0
 /**
  * constructeur
  * @access public
  * @param array tableau a verifier ($_POST,tableau de la row...)
  */
 public function __construct($tPost)
 {
     $this->tPost = $tPost;
     $sClass = _root::getConfigVar('check.class', 'plugin_check');
     $this->oCheck = new $sClass();
     $this->bCheck = true;
 }
Example #3
0
 public function _showXml()
 {
     $oAuteur = model_auteur::getInstance()->findById(_root::getParam('id'));
     $oXml = new plugin_xmlObject($oAuteur);
     $oXml->setListColumn(array('id', 'nom', 'prenom'));
     $oXml->show();
 }
Example #4
0
 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);
 }
Example #5
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();
 }
Example #6
0
 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;
 }
Example #7
0
 /** 
  * constructeur
  * @access public
  * @param string $sToken
  */
 public function __construct()
 {
     $this->sSalt = 'fdsfA34T679hjfdsAfef';
     $this->iLifetime = _root::getConfigVar('security.xsrf.timeout.lifetime');
     $this->bUseSession = _root::getConfigVar('security.xsrf.session.enabled', 0);
     $this->sSessionVar = 'xsrfTokenArray';
 }
Example #8
0
 /** 
  * retourne le code html d'une image
  * @access public
  * @param string $sSrc path de l'image, par defaut utilisera le path.img configure dans conf/site.php
  * @param string $sAlt texte alternatif
  * @param array $tOption tableau contenant autant d'options a ajouter 
  * 						array('style'=>'border:1px')  >> <img style="border:1px"...
  * @return string retourne le code html de l'image
  */
 public function getImg($sSrc, $sAlt = null, $tOption = null)
 {
     if ($sAlt == null) {
         $sAlt = $sSrc;
     }
     $sOptions = $this->getOptionFromTab($tOption);
     return '<img src="' . _root::getConfigVar('path.img') . $sSrc . '" title="' . $sAlt . '" ' . $sOptions . '/>';
 }
Example #9
0
 private function load($sId)
 {
     if ($this->_toFile and isset($this->_toFile[$sId])) {
         return;
     }
     $oFile = new _file(_root::getConfigVar('path.cache') . $sId . '.cachevar');
     $this->_toFile[$sId] = $oFile;
 }
Example #10
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);
 }
Example #11
0
 /** 
  * charge le fichier de langue situe dans la section [path], valeur de i18n
  * @access public static
  * @param string $sLang (doit etre present dans le fichier de config [language] allow separer par des virgules
  */
 public static function load($sLang)
 {
     $tAllowed = preg_split('/,/', _root::getConfigVar('language.allow'));
     if (!in_array($sLang, $tAllowed) and $sLang != _root::getConfigVar('language.default')) {
         throw new Exception('Lang not allowed, list allow:' . _root::getConfigVar('language.allow'));
     }
     include_once _root::getConfigVar('path.i18n') . $sLang . '.php';
     self::$tLangue = _root::getConfigVar('tLangue');
 }
Example #12
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;
 }
Example #13
0
 public function _index()
 {
     $tLink = array('Articles' => 'article::list', 'Articles pagine' => 'article::listPagination', 'Articles via module table' => 'article::listModuleTable', 'Utiliser des classes metiers' => 'article::myclass', 'Appeler des sous module' => 'private_article::list', 'Graphiques' => 'chart::examples', 'Graphiques SVG' => 'chart::examplesSVG', 'Google Map' => 'default::googleMap', 'Auteurs xml' => 'auteurxml::list', 'Products "virtuel"' => 'virtualProducts::list', 'Prive' => 'prive::list');
     if (_root::getACL()->can('edit', 'acl')) {
         $tLink['Manage accounts'] = 'account::list';
         $tLink['Manage groups'] = 'group::list';
         $tLink['Manage permission'] = 'permission::list';
     }
     $oView = new _view('menu::index');
     $oView->tLink = $tLink;
     return $oView;
 }
Example #14
0
 public function _list()
 {
     //cache
     if (_root::getCache()->isCached('sidebar_categories')) {
         $oView = _root::getCache()->getCached('sidebar_categories');
         return $oView;
     }
     $tCategories = model_categories::getInstance()->findAll();
     $oView = new _view('categories::list');
     $oView->tCategories = $tCategories;
     _root::getCache()->setCache('sidebar_categories', $oView);
     return $oView;
 }
Example #15
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);
 }
Example #16
0
 /**
  * @access public
  */
 public function _connect()
 {
     //on regenere un nouvel id de session
     session_regenerate_id(true);
     $this->_bConnected = true;
     $_SESSION['ip'] = sha1($_SERVER['REMOTE_ADDR']);
     if (isset($_SERVER['HTTP_USER_AGENT'])) {
         $_SESSION['userAgent'] = sha1($_SERVER['HTTP_USER_AGENT']);
     } else {
         $_SESSION['userAgent'] = sha1('noUserAgent');
     }
     if ((int) _root::getConfigVar('auth.session.timeout.enabled') == 1) {
         $_SESSION['timeout'] = time() + (int) _root::getConfigVar('auth.session.timeout.lifetime');
     }
 }
 public static function _redirect($sRootModule, $tRootParams, $sModuleName, $sModuleAction, $tModuleParam = null)
 {
     $sPrefix = $sModuleName;
     $tParam = array();
     if ($tRootParams) {
         $tParam = $tRootParams;
     }
     $tParam[$sPrefix . 'Action'] = $sModuleAction;
     if ($tModuleParam) {
         foreach ($tModuleParam as $sKey => $sVal) {
             $tParam[$sPrefix . $sKey] = $sVal;
         }
     }
     return _root::redirect($sRootModule, $tParam);
 }
Example #18
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 ($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;
 }
Example #19
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;
 }
Example #20
0
 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;
 }
Example #21
0
 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;
 }
Example #22
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();
 }
Example #23
0
 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();
 }
Example #24
0
    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;
    }
Example #25
0
 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;
 }
Example #26
0
 public static function autoload($sClass)
 {
     $tab = preg_split('/_/', $sClass);
     if ($sClass[0] == '_') {
         include _root::getConfigVar('path.lib') . 'class' . $sClass . '.php';
     } else {
         if (in_array($tab[0], array('plugin', 'model', 'abstract'))) {
             include _root::getConfigVar('path.' . $tab[0]) . $sClass . '.php';
         } else {
             if ($tab[0] == 'module') {
                 if (count($tab) == 2 or _root::getConfigVar('module.folder.organized', 0) == 0) {
                     include _root::getConfigVar('path.module') . substr($sClass, 7) . '/main.php';
                 } else {
                     unset($tab[0]);
                     include _root::getConfigVar('path.module') . implode('/', $tab) . '/main.php';
                 }
             } else {
                 if ($tab[0] == 'row') {
                     include _root::getConfigVar('path.model') . 'model_' . substr($sClass, 4) . '.php';
                 } else {
                     if ($tab[0] == 'sgbd' and in_array($tab[1], array('syntax', 'pdo'))) {
                         include _root::getConfigVar('path.lib') . 'sgbd/' . $tab[1] . '/' . $sClass . '.php';
                     } else {
                         if ($tab[0] == 'sgbd') {
                             include _root::getConfigVar('path.lib') . 'sgbd/' . $sClass . '.php';
                             //definissez ici votre regle de chargement
                             //ici, si la classe debute par my_, on la cherche dans ../myClass
                         } else {
                             if (substr($sClass, 0, 3) == 'my_') {
                                 //on inclut la classe en tronquant my_
                                 //exple: my_metier => ../myClass/metier.php
                                 include '../myClasses/' . substr($sClass, 3) . '.php';
                             } else {
                                 return false;
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Example #27
0
    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;
    }
Example #28
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);
 }
Example #29
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();
     }
 }
Example #30
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'];
        ?>