update:
- ajout et modification des pages skel de spa - ajout de l'envionnement sur l'affichage du layout - update de la commande page:add - ajout de la config pour les commands - modification du nom pour le fichier des defines - modification des namesapce pour les composants de commandes - modification du bin, gitignore, composer.jsonmain
parent
d4ae501192
commit
22df2ca781
|
@ -9,5 +9,6 @@ application/config/bdd-parameters.php
|
|||
application/config/cas-authentification-config.php
|
||||
application/config/hybrid-authentification-config.php
|
||||
application/config/soap-constantes.php
|
||||
application/config/console-parameters.php
|
||||
|
||||
application/include/vues/cache/*
|
||||
application/include/vues/cache/*
|
||||
|
|
|
@ -9,4 +9,4 @@ define("BASE_SERVER_DIRECTORY", "");
|
|||
// Optionnel! il n'est nécessaire que si vous l'utilisez dans les fichiers de traitement ou dans une commande console
|
||||
define('PATH_URL',"http://www.domain.org/");
|
||||
|
||||
define('ENV', "DEV");
|
||||
define('ENV', "DEV", true);
|
|
@ -0,0 +1,3 @@
|
|||
<?php
|
||||
|
||||
define("LINE_FEED", "\n");
|
|
@ -13,5 +13,5 @@ define("CONTROLLER_PATH", APPLICATION_PATH . DIRECTORY_SEPARATOR . "include" . D
|
|||
define("TRAITEMENT_PATH", APPLICATION_PATH . DIRECTORY_SEPARATOR . "traitements");
|
||||
define("PUBLIC_PATH", dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . "public");
|
||||
define("CONSOLE_PATH", dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . "console");
|
||||
define("OUTPUT_PATH", dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . "output");
|
||||
define("DATA_PATH", dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . "data");
|
||||
|
|
@ -8,6 +8,7 @@
|
|||
style="background: rgba(0, 0, 0, 0.59);">
|
||||
<div class="container">
|
||||
<ul class="top-menu">
|
||||
{{\MVC\Object\Environment::getTextEnvironment()}}
|
||||
<li @if($name == 'docs_route' || $name == 'docs_name_route') class="actual" @endif ><a href="{{ \MVC\Classe\Url::link_rewrite( false, 'docs', []) }}">Documentation</a></li>
|
||||
<li @if($name == 'depots') class="actual" @endif ><a href="{{ \MVC\Classe\Url::link_rewrite( false, 'gitlist/SAND-FrameWork', []) }}">Dépot</a></li>
|
||||
<li @if($name == 'donate') class="actual" @endif ><a href="{{ \MVC\Classe\Url::link_rewrite( false, 'Donate', []) }}">Donate</a></li>
|
||||
|
|
|
@ -2,15 +2,17 @@
|
|||
|
||||
"autoload": {
|
||||
"files": [
|
||||
"./application/config/app-constantes.php",
|
||||
"./application/config/define-constantes.php",
|
||||
"./application/config/app-parameters.php",
|
||||
"./application/config/bdd-parameters.php"
|
||||
"./application/config/bdd-parameters.php",
|
||||
"./application/config/console-parameters.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"MVC\\Classe\\" : "./application/class",
|
||||
"MVC\\Object\\" : "./application/objets",
|
||||
"MVC\\Domain\\" : "./domain",
|
||||
"MVC\\Command\\": "./console/command"
|
||||
"MVC\\Command\\": "./console/command",
|
||||
"MVC\\Component\\" : "./console/component"
|
||||
}
|
||||
},
|
||||
|
||||
|
|
118
console/bin.php
118
console/bin.php
|
@ -10,65 +10,8 @@
|
|||
*/
|
||||
global $argv;
|
||||
|
||||
require dirname(__FILE__) . DIRECTORY_SEPARATOR . "vendor" . DIRECTORY_SEPARATOR . "autoload.php";
|
||||
|
||||
\MVC\Command\Component\Debug::setPHPvalues();
|
||||
|
||||
if (isset($argv[1])) {
|
||||
$option = explode(':', $argv[1]);
|
||||
$command_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "command" . DIRECTORY_SEPARATOR . lcfirst($option[0]) . ".php";
|
||||
if (is_file($command_file)) {
|
||||
$class = "Command\\" . lcfirst($option[0]);
|
||||
|
||||
if(isset($option[1]) && $option[1] !== '') {
|
||||
$static_method = $option[1];
|
||||
appel_cmd($class,$static_method);
|
||||
|
||||
}else{
|
||||
$static_method = 'help';
|
||||
$class::$static_method();
|
||||
}
|
||||
} else {
|
||||
$command_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "command" . DIRECTORY_SEPARATOR . "app" . DIRECTORY_SEPARATOR . lcfirst($option[0]) . ".php";
|
||||
if (is_file($command_file)) {
|
||||
$class = "Command\\App\\" . lcfirst($option[0]);
|
||||
|
||||
if(isset($option[1]) && $option[1] !== '') {
|
||||
$static_method = $option[1];
|
||||
appel_cmd($class,$static_method);
|
||||
|
||||
}else{
|
||||
$static_method = 'help';
|
||||
$class::$static_method();
|
||||
}
|
||||
} else {
|
||||
$command_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "command" . DIRECTORY_SEPARATOR . "sand" . DIRECTORY_SEPARATOR . lcfirst($option[0]) . ".php";
|
||||
if (is_file($command_file)) {
|
||||
$class = "Command\\Sand\\" . lcfirst($option[0]);
|
||||
|
||||
if(isset($option[1]) && $option[1] !== '') {
|
||||
$static_method = $option[1];
|
||||
appel_cmd($class,$static_method);
|
||||
|
||||
}else{
|
||||
$static_method = 'help';
|
||||
$class::$static_method();
|
||||
}
|
||||
} else {
|
||||
print "SAND Command not found !\n";
|
||||
$class = "Command\\Help";
|
||||
$static_method = 'help';
|
||||
$class::$static_method();
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
print "No command was specified !\n";
|
||||
$class = "Command\\Help";
|
||||
$static_method = 'help';
|
||||
$class::$static_method();
|
||||
|
||||
}
|
||||
require dirname(__DIR__) . DIRECTORY_SEPARATOR . "vendor" . DIRECTORY_SEPARATOR . "autoload.php";
|
||||
\MVC\Component\Debug::setPHPvalues();
|
||||
|
||||
function appel_cmd($class,$static_method){
|
||||
if(method_exists($class,$static_method)) {
|
||||
|
@ -102,10 +45,65 @@ function appel_cmd($class,$static_method){
|
|||
$errors = $class::$static_method(...$arguments);
|
||||
|
||||
if ($errors !== null) {
|
||||
MVC\Command\Component\Error::logErrors($errors);
|
||||
\MVC\Component\Error::logErrors($errors);
|
||||
}
|
||||
}else{
|
||||
$static_method = 'help';
|
||||
$class::$static_method();
|
||||
}
|
||||
}
|
||||
if (isset($argv[1])) {
|
||||
$option = explode(':', $argv[1]);
|
||||
$command_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "command" . DIRECTORY_SEPARATOR . lcfirst($option[0]) . ".php";
|
||||
if (is_file($command_file)) {
|
||||
$class = "MVC\\Command\\" . lcfirst($option[0]);
|
||||
|
||||
if(isset($option[1]) && $option[1] !== '') {
|
||||
$static_method = $option[1];
|
||||
appel_cmd($class,$static_method);
|
||||
|
||||
}else{
|
||||
$static_method = 'help';
|
||||
$class::$static_method();
|
||||
}
|
||||
} else {
|
||||
$command_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "command" . DIRECTORY_SEPARATOR . "app" . DIRECTORY_SEPARATOR . lcfirst($option[0]) . ".php";
|
||||
if (is_file($command_file)) {
|
||||
$class = "MVC\\Command\\App\\" . lcfirst($option[0]);
|
||||
|
||||
if(isset($option[1]) && $option[1] !== '') {
|
||||
$static_method = $option[1];
|
||||
appel_cmd($class,$static_method);
|
||||
|
||||
}else{
|
||||
$static_method = 'help';
|
||||
$class::$static_method();
|
||||
}
|
||||
} else {
|
||||
$command_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "command" . DIRECTORY_SEPARATOR . "sand" . DIRECTORY_SEPARATOR . lcfirst($option[0]) . ".php";
|
||||
if (is_file($command_file)) {
|
||||
$class = "MVC\\Command\\Sand\\" . lcfirst($option[0]);
|
||||
|
||||
if(isset($option[1]) && $option[1] !== '') {
|
||||
$static_method = $option[1];
|
||||
appel_cmd($class,$static_method);
|
||||
|
||||
}else{
|
||||
$static_method = 'help';
|
||||
$class::$static_method();
|
||||
}
|
||||
} else {
|
||||
print "SAND Command not found !\n";
|
||||
$class = "MVC\\Command\\Help";
|
||||
$static_method = 'help';
|
||||
$class::$static_method();
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
print "No command was specified !\n";
|
||||
$class = "MVC\\Command\\Help";
|
||||
$static_method = 'help';
|
||||
$class::$static_method();
|
||||
|
||||
}
|
|
@ -1,5 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Package MVC\Command\Sand
|
||||
* @author Emmanuel ROY
|
||||
* @license MIT-licence (open source)
|
||||
* @version 3.5
|
||||
*/
|
||||
|
||||
namespace MVC\Command\Sand;
|
||||
/**
|
||||
* Class Page
|
||||
|
@ -30,18 +37,26 @@ class Page
|
|||
print "Es-ce un template blade?(Y,N) Par defaut:Y ";
|
||||
$template = trim(fgets(STDIN));
|
||||
$vue = "";
|
||||
if ($template == '' || $template == 'Y') {
|
||||
$react = "";
|
||||
if ($template !== 'N') {
|
||||
$template = 'blade';
|
||||
|
||||
print "Es-ce une SPA vue.js? (Y,N) Par defaut:N ";
|
||||
$vue = trim(fgets(STDIN));
|
||||
if ($vue == '') {
|
||||
$vue = 'N';
|
||||
} else if ($vue !== 'Y') {
|
||||
if ($vue !== 'Y') {
|
||||
$vue = 'N';
|
||||
print "Es-ce une SPA react.js? (Y,N) Par defaut:N ";
|
||||
$react = trim(fgets(STDIN));
|
||||
if ($react !== 'Y') {
|
||||
$react = 'N';
|
||||
}else{
|
||||
$react = 'Y';
|
||||
}
|
||||
}else{
|
||||
$vue = 'Y';
|
||||
}
|
||||
|
||||
} else if ($template !== 'Y') {
|
||||
} else {
|
||||
$template = 'twig';
|
||||
}
|
||||
|
||||
|
@ -61,7 +76,11 @@ class Page
|
|||
|
||||
if ($template == 'blade'){
|
||||
if ($vue == 'N') {
|
||||
$shell_view = shell_exec('cp ' . CONSOLE_PATH . '/skel/page.blade.php ' . VIEW_PATH . '/view/' . $page . '.blade.php');
|
||||
if ($react == 'N') {
|
||||
$shell_view = shell_exec('cp ' . CONSOLE_PATH . '/skel/page-vuejs.blade.php ' . VIEW_PATH . '/view/' . $page . '.blade.php');
|
||||
} else {
|
||||
$shell_view = shell_exec('cp ' . CONSOLE_PATH . '/skel/page-reactjs.blade.php ' . VIEW_PATH . '/view/' . $page . '.blade.php');
|
||||
}
|
||||
} else {
|
||||
$shell_view = shell_exec('cp ' . CONSOLE_PATH . '/skel/page-vuejs.blade.php ' . VIEW_PATH . '/view/' . $page . '.blade.php');
|
||||
}
|
||||
|
@ -144,6 +163,13 @@ class Page
|
|||
print $shell_view;
|
||||
}
|
||||
|
||||
/**
|
||||
* Supprimer en fonction du template contenu dans le model
|
||||
*/
|
||||
public static function delete()
|
||||
{
|
||||
self::remove();
|
||||
}
|
||||
/**
|
||||
* Supprimer en fonction du template contenu dans le model
|
||||
*/
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace MVC\Command\Component;
|
||||
namespace MVC\Component;
|
||||
|
||||
/**
|
||||
* Composant permettant de debugger et d'initialiser certaines valeurs de php
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace MVC\Command\Component;
|
||||
namespace MVC\Component;
|
||||
|
||||
/**
|
||||
* Composant permettant de logger les erreurs de la commande courante
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace MVC\Command\Component;
|
||||
namespace MVC\Component;
|
||||
|
||||
/**
|
||||
* Composant permettant de créér des fichiers de sortie de données
|
||||
|
|
|
@ -0,0 +1,69 @@
|
|||
@extends('body')
|
||||
|
||||
@section('top-javascript')
|
||||
@parent
|
||||
<script src="https://unpkg.com/react@^16/umd/react.production.min.js"></script>
|
||||
<script src="https://unpkg.com/react-dom@16.13.0/umd/react-dom.production.min.js"></script>
|
||||
<script src="https://unpkg.com/babel-standalone@6.26.0/babel.js"></script>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<h1>%%PAGE%% - REACT.js Controlleur</h1>
|
||||
<br/><br/><br/>
|
||||
<div id="root"></div>
|
||||
@endsection
|
||||
|
||||
@section('bottom-javascript')
|
||||
@parent
|
||||
<script type="text/babel">
|
||||
class App extends React.Component {
|
||||
state = {
|
||||
data: [],
|
||||
}
|
||||
|
||||
// Code is invoked after the component is mounted/inserted into the DOM tree.
|
||||
componentDidMount() {
|
||||
const url =
|
||||
'https://ghibliapi.herokuapp.com/films'
|
||||
|
||||
fetch(url)
|
||||
.then((result) => result.json())
|
||||
.then((result) => {
|
||||
this.setState({
|
||||
data: result,
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
render() {
|
||||
const {data} = this.state
|
||||
|
||||
const result = data.map(obj => {
|
||||
return (
|
||||
<a href="#" key="{obj.id}">
|
||||
<div>
|
||||
<div>
|
||||
<h2>
|
||||
{obj.title}
|
||||
</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<p>
|
||||
{obj.description.slice(0, 300) + "..." }
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<span>Year : {obj.release_date }</span>
|
||||
<span>Director : {obj.director }</span>
|
||||
<span>Producer : {obj.producer }</span>
|
||||
</div>
|
||||
</a>);
|
||||
})
|
||||
return <div>{result}</div>
|
||||
}
|
||||
}
|
||||
|
||||
ReactDOM.render(<App />, document.getElementById('root'))
|
||||
</script>
|
||||
@endsection
|
|
@ -7,7 +7,7 @@
|
|||
@endsection
|
||||
|
||||
@section('content')
|
||||
<h1>%PAGE% - VUE.js Controlleur</h1>
|
||||
<h1>%%PAGE%% - VUE.js Controlleur</h1>
|
||||
<br/><br/><br/>
|
||||
<div id="app">
|
||||
<div>
|
||||
|
|
Loading…
Reference in New Issue