update conduit and documentation on master

This commit is contained in:
Emmanuel ROY 2021-01-05 18:08:40 +01:00
parent 405bd6c73d
commit c0ab3e31ad
11 changed files with 172 additions and 9 deletions

View file

@ -28,7 +28,7 @@ class Controlleur
$conduitRoute = "\\" . $conduit[0];
$method = strtolower($conduit[1]);
$class = new $conduitRoute();
$class->initialize($application->route);
$class->initialize($application);
$this->vue = new VueVide();
$this->vue->ecran = $class->$method();
} elseif ($application->url->page['control']) {

View file

@ -5,10 +5,15 @@ namespace MVC\Classe\Implement;
class Conduit extends Action
{
public function initialize($var)
public function initialize($application)
{
//extract($application->modele->page);
foreach ($application->url->page as $key => $value) {
$this->templateData[$key] = $value;
}
//Export variable from conduit
foreach ($var as $key => $value) {
foreach ($application->route as $key => $value) {
if ($key != "controller") {
if ($key != "_route") {
$this->$key = $value;

View file

@ -11,3 +11,11 @@ foo_placeholder_route:
defaults: { controller: 'FooConduit::load' }
requirements:
id: '[0-9]+'
docs_route:
path: /docs
defaults: { controller: 'DocConduit::index' }
docs_name_route:
path: /docs/file/{file}
defaults: { controller: 'DocConduit::readfile' }

View file

@ -0,0 +1,32 @@
<?php
use MVC\Classe\Implement\Action;
use MVC\Classe\Response;
class MenudocsAction extends Action
{
public function default($data)
{
$files = array();
if ($handle = opendir(DATA_PATH . '/docs')) {
while (false !== ($entry = readdir($handle))) {
if ($entry != "." && $entry != "..") {
$files[] = $entry;
}
}
closedir($handle);
}
asort($files);
return $this->render('menu-docs', array('files' => $files));
}
}

View file

@ -0,0 +1,51 @@
<?php
use Michelf\MarkdownExtra;
use MVC\Classe\Implement\Conduit;
class DocConduit extends Conduit
{
// Route('/docs')
public function index()
{
$files = array();
if ($handle = opendir(DATA_PATH . '/docs')) {
while (false !== ($entry = readdir($handle))) {
if ($entry != "." && $entry != "..") {
$files[] = $entry;
}
}
closedir($handle);
}
asort($files);
$this->templateData['page_title'] = 'Foo';
$this->templateData['description'] = 'DocConduit';
$this->templateData['files'] = $files;
return $this->render('docs', $this->templateData);
}
// Route('/docs/file/{file}')
public function readfile()
{
$markdown = file_get_contents(DATA_PATH . '/docs/' . $this->file);
$my_html = MarkdownExtra::defaultTransform($markdown);
$this->templateData['page_title'] = 'Foo';
$this->templateData['description'] = 'DocConduit';
$this->templateData['data'] = $my_html;
return $this->render('docs', $this->templateData);
}
}

View file

@ -0,0 +1,7 @@
<?php
use MVC\Classe\Logger;
$templateData = array("templating_a" => 'blade', "templating_b" => 'twig', "templating_c" => 'edge');
Logger::addLog('ok', 'Hello world');

View file

@ -0,0 +1,5 @@
name : beers
page_title : module_title
description : module_description
params : module_params

View file

@ -10,6 +10,8 @@
<ul class="top-menu">
<li @if($name == 'policy') class="actual" @endif ><a href="{{ \MVC\Classe\Url::link_rewrite( false, 'Policy', []) }}">Policy</a></li>
<li @if($name == 'cgu') class="actual" @endif ><a href="{{ \MVC\Classe\Url::link_rewrite( false, 'CGU', []) }}"> CGU Terms</a></li>
<li @if($name == 'docs') class="actual" @endif ><a href="{{ \MVC\Classe\Url::link_rewrite( false, 'docs', []) }}">Documentation</a></li>
<li @if($name == 'beers') class="actual" @endif ><a href="{{ \MVC\Classe\Url::link_rewrite( false, 'beers', []) }}">Support</a></li>
</ul>
</div>
</div>
@ -37,7 +39,7 @@
<div class="container">
<nav>
<ul>
<li @if($name == 'search') class="actual" @endif ><a href="{{ \MVC\Classe\Url::link_rewrite( false, 'Index', []) }}">Index</a></li>
<li @if($name == 'index') class="actual" @endif ><a href="{{ \MVC\Classe\Url::link_rewrite( false, 'Index', []) }}">Index</a></li>
<li @if($name == 'admin') class="actual" @endif ><a href="{{ \MVC\Classe\Url::link_rewrite( false, 'Admin', []) }}">Admin</a></li>
</ul>
</nav>

View file

@ -0,0 +1,38 @@
@extends('body')
@section('sidebar')
@parent
<p>This is appended to the master sidebar.</p>
@endsection
@section('content')
<h2 class="section-title" id="donate">Buy me some beers</h2>
<div class="donate-container">
<div class="donate-description">
<p>
SAND FrameWork is an CC Universal-licensed open source project and completely free to use.
</p>
<p>
However, the amount of effort needed to maintain and develop new features for the project is not
sustainable
without proper financial backing.
You can support its ongoing development by being a backer or a sponsor on
<a href="https://www.patreon.com/"> Patreon campaign</a>
(recurring, with perks for different tiers), and get your company logo here.
</p>
<p>
Also, you can make a <a href="https://www.paypal.me/">one time donation via PayPal</a>.
</p>
</div>
<div class="donate-footer">
<a href="https://www.patreon.com/" class="beer-button button-ghost">Be a sponsor on Patreon</a>
<a href="https://www.paypal.me/" class="beer-button button-secondary">Donate via PayPal</a>
</div>
<img src="assets/img/beer.svg" alt="" class="donate-beer">
</div>
@endsection

View file

@ -0,0 +1,19 @@
@extends('body')
@section('sidebar')
@parent
@endsection
@section('content')
@if (isset($files))
<h1>Sommaire:</h1>
@foreach( $files as $file)
<a href="{{ \MVC\Classe\Url::link_rewrite( false, 'docs', ['file'=>$file]) }}">{{ $file }}</a> <br/>
@endforeach
@endif
@if (isset($data))
{{$data}}
@endif
@endsection

View file

@ -14,10 +14,6 @@
},
"require": {
"php": "^8",
"ext-json": "*",
"ext-pdo": "*",
"ext-curl": "*",
"windwalker/renderer": "3.*",
"illuminate/view": "4.*",
"neitanod/forceutf8": "^2.0",
@ -33,6 +29,6 @@
"apereo/phpcas": "^1.3",
"hybridauth/hybridauth": "^3.2",
"michelf/php-markdown": "^1.9"
},
}
}