Reestruturacao da pasta app e mudancas nos templates
This commit is contained in:
Executable
+184
@@ -0,0 +1,184 @@
|
||||
<?php
|
||||
|
||||
use Routes\RouteCollection as RouteCollection;
|
||||
|
||||
class GeneratorController {
|
||||
|
||||
private $langBase =
|
||||
<<<EOL
|
||||
<?php
|
||||
\$lang['{{PLUGIN_NAME}}']['module_name'] = '{{PLUGIN_NAME_PRETTY}}';
|
||||
EOL;
|
||||
|
||||
private $migrationBase =
|
||||
<<<EOL
|
||||
<?php
|
||||
|
||||
use Schema\Wrapper as Wrapper;
|
||||
|
||||
function {{PLUGIN_NAME}}_upgrade(\$pluginversion) {
|
||||
if (\$pluginversion < '1.0.0') {
|
||||
\$table = Wrapper::get_table('{{PLUGIN_NAME}}');
|
||||
\$table->addColumn("name", 'string', Array('null' => false));
|
||||
\$table->addColumn("time", 'timestamp', Array('null' => true, 'default'=>null));
|
||||
\$table->addColumn("areaid", 'integer', Array('null' => false));
|
||||
\$table->addTimestamps();
|
||||
\$table->addSoftDelete();
|
||||
\$table->create();
|
||||
|
||||
Migrator::getInstance()->update_plugin_version('{{PLUGIN_NAME}}', '1.0.0');
|
||||
return;
|
||||
}
|
||||
|
||||
//if (\$pluginversion < '1.0.1') {
|
||||
//\$table = Wrapper::get_table('{{PLUGIN_NAME}}');
|
||||
//Migrator::getInstance()->update_plugin_version('{{PLUGIN_NAME}}', '1.0.1');
|
||||
//return;
|
||||
//}
|
||||
}
|
||||
EOL;
|
||||
|
||||
private $versionBase =
|
||||
<<<EOL
|
||||
<?php
|
||||
|
||||
\$plugin->name = '{{PLUGIN_NAME}}';
|
||||
\$plugin->version = '0.0.1';
|
||||
|
||||
//\$plugin->require = Array( ["name" => "plugin_name", "version" => 'x.x.x'] );
|
||||
EOL;
|
||||
|
||||
private $controllerBase =
|
||||
<<<EOL
|
||||
<?php
|
||||
class {{CONTROLLER}} {
|
||||
|
||||
function index(){
|
||||
|
||||
}
|
||||
|
||||
function create(){
|
||||
|
||||
}
|
||||
|
||||
function Store(){
|
||||
|
||||
}
|
||||
|
||||
function show({{OBJECT}} \$instance){
|
||||
|
||||
}
|
||||
|
||||
function edit({{OBJECT}} \$instance){
|
||||
|
||||
}
|
||||
|
||||
function update({{OBJECT}} \$instance){
|
||||
|
||||
}
|
||||
|
||||
function destroy({{OBJECT}} \$instance){
|
||||
|
||||
}
|
||||
|
||||
function purge({{OBJECT}} \$instance){
|
||||
|
||||
}
|
||||
}
|
||||
EOL;
|
||||
|
||||
|
||||
private $objectBase =
|
||||
<<<EOL
|
||||
<?php
|
||||
use ORM\Entity as Entity;
|
||||
|
||||
class {{OBJECT}} extends Entity {
|
||||
|
||||
//const _idPolice = Array('type' => '', 'min' => 0, 'max' => 100000, 'step' => 2);
|
||||
|
||||
const _tableName = '{{TABLE_NAME}}';
|
||||
//const _properties = Array('id', 'name');
|
||||
|
||||
//const _timestamps = true;
|
||||
//const _softdelete = true;
|
||||
|
||||
//const _connectionName = '';
|
||||
}
|
||||
EOL;
|
||||
|
||||
private $routeBase =
|
||||
<<<EOL
|
||||
<?php
|
||||
|
||||
use Routes\RouteCollection as RouteCollection;
|
||||
|
||||
RouteCollection::group('/{{PLUGIN_NAME}}', function(){
|
||||
RouteCollection::get ('/', '{{CONTROLLER}}@index');
|
||||
RouteCollection::get ('/', '{{CONTROLLER}}@create');
|
||||
RouteCollection::post ('/', '{{CONTROLLER}}@store');
|
||||
RouteCollection::get ('/[i:id]', '{{CONTROLLER}}@show');
|
||||
RouteCollection::get ('/[i:id]/edit', '{{CONTROLLER}}@edit');
|
||||
RouteCollection::put ('/[i:id]/edit', '{{CONTROLLER}}@update');
|
||||
RouteCollection::delete('/[i:id]', '{{CONTROLLER}}@destroy');
|
||||
});
|
||||
EOL;
|
||||
|
||||
function createPluginFromTemplate($subname, $name){
|
||||
if (is_dir( DIR_APP.$subname . '/' . $name )){
|
||||
echo 'Treco ja existe';
|
||||
return;
|
||||
}else{
|
||||
mkdir(DIR_APP.$subname . '/' . $name, 0755, true);
|
||||
mkdir(DIR_APP.$subname . '/' . $name . '/lang', 0755, true);
|
||||
mkdir(DIR_APP.$subname . '/' . $name . '/classes', 0755, true);
|
||||
mkdir(DIR_APP.$subname . '/' . $name . '/db', 0755, true);
|
||||
mkdir(DIR_APP.$subname . '/' . $name . '/views', 0755, true);
|
||||
}
|
||||
|
||||
$plugin_name = $name;
|
||||
$plugin_name_pretty = ucwords(str_replace('_', ' ', $name));
|
||||
$object = ucfirst( $name );
|
||||
$controller = $object.'Controller';
|
||||
|
||||
$this->langBase = str_replace("{{PLUGIN_NAME}}", $plugin_name, $this->langBase);
|
||||
$this->langBase = str_replace("{{PLUGIN_NAME_PRETTY}}", $plugin_name_pretty, $this->langBase);
|
||||
file_put_contents(DIR_APP.$subname . '/' . $name . '/lang/en.php', $this->langBase);
|
||||
file_put_contents(DIR_APP.$subname . '/' . $name . '/lang/'.APP_LANG.'.php', $this->langBase);
|
||||
|
||||
$this->migrationBase = str_replace("{{PLUGIN_NAME}}", $plugin_name, $this->migrationBase);
|
||||
file_put_contents(DIR_APP.$subname . '/' . $name . '/db/Migrate.php', $this->migrationBase);
|
||||
|
||||
$this->routeBase = str_replace("{{PLUGIN_NAME}}", $plugin_name, $this->routeBase);
|
||||
$this->routeBase = str_replace("{{CONTROLLER}}", $controller, $this->routeBase);
|
||||
file_put_contents(DIR_APP.$subname . '/' . $name . '/Routes.php', $this->routeBase);
|
||||
|
||||
$this->objectBase = str_replace("{{OBJECT}}", $object, $this->objectBase);
|
||||
$this->objectBase = str_replace("{{TABLE_NAME}}", $name, $this->objectBase);
|
||||
file_put_contents(DIR_APP.$subname . '/' . $name . "/classes/$object.php", $this->objectBase);
|
||||
|
||||
$this->controllerBase = str_replace("{{OBJECT}}", $object, $this->controllerBase);
|
||||
$this->controllerBase = str_replace("{{CONTROLLER}}", $controller, $this->controllerBase);
|
||||
file_put_contents(DIR_APP.$subname . '/' . $name . "/$controller.php", $this->controllerBase);
|
||||
|
||||
|
||||
}
|
||||
|
||||
function listRoutes(){
|
||||
foreach(RouteCollection::returnRoutes() as $route){
|
||||
//var_dump($route->_callback);continue;//die();
|
||||
echo implode($route->_verb , ', ') ." || $route->_uri || $route->_weight||";
|
||||
if( gettype($route->_callback[0]) == 'object' ){
|
||||
echo 'Clousure ||';
|
||||
}else{
|
||||
echo $route->_callback[0];
|
||||
}
|
||||
echo "\n";
|
||||
}
|
||||
//file_put_contents('/tmp/Route.php', $this->routeBase);
|
||||
//echo $this->objectBase;
|
||||
echo APP_LANG;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Executable
+24
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
use Routes\RouteCollection as RouteCollection;
|
||||
|
||||
RouteCollection::group('/core', function(){
|
||||
|
||||
include_once 'GeneratorController.php';
|
||||
|
||||
RouteCollection::cli('/routes', function(){
|
||||
last_class()->listRoutes();
|
||||
});
|
||||
|
||||
|
||||
RouteCollection::cli('/purge/[h:module]', function($module){
|
||||
echo "Purgin $module\n";
|
||||
});
|
||||
|
||||
RouteCollection::cli('/purge', function(){
|
||||
echo "Purging Everything\n";
|
||||
});
|
||||
|
||||
RouteCollection::cli('/create/[h:subname]/[h:name]', 'GeneratorController@createPluginFromTemplate');
|
||||
|
||||
});
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
$lang['generator']['module_name'] = 'generator';
|
||||
|
||||
$lang['generator']['main_title'] = 'Module Generator';
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
$lang['generator']['module_name'] = 'wellcome';
|
||||
|
||||
$lang['generator']['main_title'] = 'Gerador de modulos!';
|
||||
|
||||
|
||||
Executable
+27
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
use Routes\RouteCollection as RouteCollection;
|
||||
use DDLWrapper\Wrapper as Wrapper;
|
||||
|
||||
RouteCollection::cli('sanity/install', function() {
|
||||
include_once 'classes/Migrator.class.php';
|
||||
|
||||
global $DB;
|
||||
Wrapper::set_driver($DB);
|
||||
|
||||
Migrator::getInstance()->execute_plan();
|
||||
|
||||
Wrapper::commit();
|
||||
})->middlewareIgnore('auth');
|
||||
|
||||
|
||||
RouteCollection::add('*', '*', function() {
|
||||
global $ROUTE;
|
||||
if(INSTALL_REQUIRE){
|
||||
//App need to be installed
|
||||
if (!is_file(DIR_CONFIG . 'modules.ini')) {
|
||||
$ROUTE->doBlock()->setHttpError(500);
|
||||
}
|
||||
}
|
||||
|
||||
}, -19)->doIgnore()->middlewareIgnore('auth');
|
||||
Executable
+183
@@ -0,0 +1,183 @@
|
||||
<?php
|
||||
|
||||
class Migrator{
|
||||
|
||||
private static $instance;
|
||||
|
||||
private $instaled;
|
||||
private $phisical;
|
||||
|
||||
private $uninstall = Array();
|
||||
private $downgrade = Array();
|
||||
|
||||
private $upgrade = Array();
|
||||
private $install = Array();
|
||||
|
||||
private function __construct(){
|
||||
$this->load_installed_plugins();
|
||||
$this->load_physical_plugins();
|
||||
}
|
||||
|
||||
private static function newObj(){
|
||||
if (!isset( self::$instance )) {
|
||||
self::$instance = new Migrator();
|
||||
}
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
public static function getInstance(){
|
||||
if (!isset(self::$instance)) {
|
||||
return self::newObj();
|
||||
}
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
private function save(){
|
||||
$out = '';
|
||||
foreach ($this->instaled as $instaled){
|
||||
$out .= "[$instaled->name]\n";
|
||||
$out .= "name=$instaled->name\n";
|
||||
$out .= "version=$instaled->version\n\n";
|
||||
}
|
||||
file_put_contents(DIR_CONFIG.'/modules.ini', $out);
|
||||
}
|
||||
|
||||
private function is_satisfy($name, $version){
|
||||
if(!isset($this->instaled[$name])){
|
||||
return false;
|
||||
}
|
||||
if($this->instaled[$name]->version >= $version){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private function is_satisfy_array($array){
|
||||
foreach ($array as $item){
|
||||
if( !self::is_satisfy($item->name, $item->version) ){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function update_plugin_version($name, $version){
|
||||
echo "Atualizando $name para versão $version\n";
|
||||
if( isset($this->instaled[$name]) ){
|
||||
$this->instaled[$name]->version = $version;
|
||||
return;
|
||||
}
|
||||
$this->instaled[$name] = new stdClass();
|
||||
$this->instaled[$name]->name = $name;
|
||||
$this->instaled[$name]->version = $version;
|
||||
}
|
||||
|
||||
private function load_installed_plugins(){
|
||||
$installed = parse_ini_file(DIR_CONFIG.'/modules.ini', true);
|
||||
|
||||
foreach ($installed as $key => $item) {
|
||||
$installed[$key] = (object) $item;
|
||||
}
|
||||
|
||||
return $this->instaled = $installed;
|
||||
}
|
||||
|
||||
private function load_physical_plugins(){
|
||||
$module_configs = Array();
|
||||
$plugins = Array();
|
||||
|
||||
$rdi = new RecursiveDirectoryIterator(DIR_APP);
|
||||
|
||||
foreach(new RecursiveIteratorIterator($rdi) as $file){
|
||||
if( strpos($file, 'version.php') ){
|
||||
$module_configs[] = str_replace('version.php','', $file);
|
||||
}
|
||||
}
|
||||
foreach ($module_configs as $module_config) {
|
||||
$plugin = new stdClass();
|
||||
include $module_config . 'version.php';
|
||||
$plugins[$plugin->name] = $plugin;
|
||||
if(is_file( $module_config . 'db/Migrate.php') ){
|
||||
//echo 'aaaaaaaaaaaa';
|
||||
include $module_config . 'db/Migrate.php';
|
||||
}
|
||||
}
|
||||
$this->phisical = $plugins;
|
||||
}
|
||||
|
||||
public function physical_list(){
|
||||
return $this->phisical;
|
||||
}
|
||||
|
||||
public function installed_list(){
|
||||
return $this->instaled;
|
||||
}
|
||||
|
||||
public function instal_list(){
|
||||
return $this->install;
|
||||
}
|
||||
|
||||
public function uninstal_list(){
|
||||
return $this->uninstall;
|
||||
}
|
||||
|
||||
public function sort_plugins(){
|
||||
foreach ($this->phisical as $key => $plugin){
|
||||
if( !isset($this->instaled[$key]) ){
|
||||
$this->install[] = $plugin;
|
||||
continue;
|
||||
}
|
||||
if( $this->instaled[$key]->version < $plugin->version){
|
||||
$this->upgrade[] = $plugin;
|
||||
continue;
|
||||
}
|
||||
if( $this->instaled[$key]->version > $plugin->version){
|
||||
$this->downgrade[] = $plugin;
|
||||
continue;
|
||||
}
|
||||
$this->uninstall[] = $plugin;
|
||||
}
|
||||
}
|
||||
|
||||
public function execute_plan(){
|
||||
$status = false;
|
||||
while(! $status ){
|
||||
$this->sort_plugins();
|
||||
$status = true;
|
||||
|
||||
foreach ($this->install as $key => $item) {
|
||||
if( isset($item->require) ){
|
||||
if( !self::is_satisfy_array($item->require) ){ $status = false; continue; }
|
||||
}
|
||||
if(!self::is_satisfy($item->name, $item->version) ){
|
||||
if(!function_exists($item->name.'_upgrade')){
|
||||
$this->update_plugin_version($item->name, $item->version);
|
||||
$this->upgrade[] = $item;
|
||||
unset($this->install[$key]);
|
||||
continue;
|
||||
}
|
||||
call_user_func($item->name.'_upgrade', 0);
|
||||
$this->upgrade[] = $this->instaled[$item->name];
|
||||
unset($this->install[$key]);
|
||||
$status = false;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($this->upgrade as $item) {
|
||||
if( isset($item->require) ){
|
||||
if( !self::is_satisfy_array($item->require) ){ $status = false; continue; }
|
||||
}
|
||||
if(!self::is_satisfy($item->name, $item->version) ){
|
||||
if(!function_exists($item->name.'_upgrade')){
|
||||
$this->update_plugin_version($item->name, $item->version);
|
||||
continue;
|
||||
}
|
||||
call_user_func($item->name.'_upgrade', $this->instaled[$item->name]->version);
|
||||
$status = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->save();
|
||||
}
|
||||
|
||||
}
|
||||
Executable
+6
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
function core_migrator_upgrade_plugin_version($name, $version){
|
||||
$migrator = Migrator::getInstance();
|
||||
}
|
||||
|
||||
Executable
+89
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Template;
|
||||
|
||||
class Output {
|
||||
|
||||
private static $_instance;
|
||||
|
||||
private $view = false;
|
||||
protected $values = Array();
|
||||
|
||||
private $_template = '';
|
||||
private $_extension = '';
|
||||
|
||||
private function __construct() {
|
||||
$this->_template = ( defined('TEMPLATE_DEFAULT') ) ? TEMPLATE_DEFAULT : 'DefaultTemplate';
|
||||
$this->_extension = ( defined('TEMPLATE_FILETYPE') ) ? TEMPLATE_FILETYPE : '.mustache';
|
||||
}
|
||||
|
||||
private static function newObj() {
|
||||
if (!isset(self::$_instance)) {
|
||||
self::$_instance = new Output();
|
||||
}
|
||||
return self::$_instance;
|
||||
}
|
||||
|
||||
public function getInstance() {
|
||||
if (!isset(self::$_instance)) {
|
||||
return self::newObj();
|
||||
}
|
||||
return self::$_instance;
|
||||
}
|
||||
|
||||
public function setTemplate($template = 'DefaultTemplate') {
|
||||
self::getInstance()->_template = $template;
|
||||
// self::getInstance()->_template = '';
|
||||
return self::getInstance();
|
||||
}
|
||||
|
||||
public static function renderView($name, $values = null, $location = null) {
|
||||
if (!$location) {
|
||||
$segments = explode('/', debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS)[0]['file']);
|
||||
array_pop($segments);
|
||||
$location = implode('/', $segments) . '/views/';
|
||||
}
|
||||
|
||||
self::getInstance()->setView($name, $values, $location)->render();
|
||||
}
|
||||
|
||||
public static function setView($name, $values = Array(), $location = null) {
|
||||
$instance = self::getInstance();
|
||||
$folder = '';
|
||||
if (!$location) {
|
||||
$segments = explode('/', debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS)[0]['file']);
|
||||
array_pop($segments);
|
||||
$location = implode('/', $segments) . '/views/';
|
||||
}
|
||||
$folder = $location;
|
||||
$location .= $name;
|
||||
|
||||
if (strpos($instance->_extension, $location) == 0) {
|
||||
$location .= $instance->_extension;
|
||||
}
|
||||
|
||||
$instance->view = Array();
|
||||
$instance->view['location'] = $location;
|
||||
$instance->view['folder'] = $folder;
|
||||
$instance->view['values'] = $values;
|
||||
return self::getInstance();
|
||||
}
|
||||
|
||||
public static function addValue($key, $value){
|
||||
self::getInstance()->view['values'][$key] = $value;
|
||||
}
|
||||
|
||||
public static function render() {
|
||||
$instance = self::getInstance();
|
||||
|
||||
if(!is_file(__DIR__."/classes/".strtolower($instance->_template)."/".$instance->_template.'.php') ){
|
||||
$instance->_template = 'DefaultTemplate';
|
||||
}
|
||||
|
||||
include_once __DIR__."/classes/".strtolower($instance->_template)."/".$instance->_template.'.php';
|
||||
|
||||
$class = new $instance->_template;
|
||||
$class->setView($instance->view)->render();
|
||||
|
||||
}
|
||||
}
|
||||
Executable
+15
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
use Routes\RouteCollection as RouteCollection;
|
||||
use Menus\Menu as Menu;
|
||||
|
||||
RouteCollection::get('*', function(){
|
||||
|
||||
include_once 'Output.class.php';
|
||||
|
||||
GLOBAL $SIDEBAR, $DROPDOWN;
|
||||
|
||||
$SIDEBAR = new Menu( array('id' => 'side-menu', 'class' => "nav") );
|
||||
$DROPDOWN = new Menu( array("class" => 'dropdown-menu') );
|
||||
|
||||
}, -11)->doIgnore();
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
use Template\RenderableTemplate as RenderableTemplate;
|
||||
|
||||
class Dashboard extends RenderableTemplate {
|
||||
|
||||
public $content;
|
||||
|
||||
public function render() {
|
||||
if (is_ajax_request()) {
|
||||
$this->content = file_get_contents($this->getView()['location']);
|
||||
$this->implate();
|
||||
return;
|
||||
}
|
||||
|
||||
global $DROPDOWN, $SIDEBAR;
|
||||
|
||||
$head = '';
|
||||
$head .= '<meta name="viewport" content="width=device-width, initial-scale=1.0">';
|
||||
$head .= '<script src="/plugins/jquery/jquery.min.js"></script>';
|
||||
|
||||
$head .= '<script src="/plugins/mousetrap/mousetrap.min.js"></script>';
|
||||
|
||||
$head .= '<script src="/plugins/jquery-mask-plugin/jquery.mask.min.js"></script>';
|
||||
|
||||
$head .= '<link href="/plugins/bootstrap/bootstrap.min.css" rel="stylesheet" />';
|
||||
$head .= '<script src="/plugins/bootstrap/bootstrap.min.js"></script>';
|
||||
|
||||
$head .= '<link href="/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" />';
|
||||
|
||||
$head .= '<link href="/plugins/normalize-css/normalize.css" rel="stylesheet">';
|
||||
$head .= '<link href="/dist/style.css" rel="stylesheet">';
|
||||
|
||||
$head .= '<link href="/dist/theme/black_and_white.css" rel="stylesheet">';
|
||||
|
||||
$head .= '<link href="/plugins/metisMenu/metisMenu.min.css" rel="stylesheet">';
|
||||
$head .= '<script src="/plugins/metisMenu/metisMenu.min.js"></script>';
|
||||
|
||||
$head .= '<link href="/plugins/select2/select2.min.css" rel="stylesheet">';
|
||||
$head .= '<script src="/plugins/select2/select2.min.js"></script>';
|
||||
|
||||
$head .= '<link rel="stylesheet" href="/plugins/datatables/dataTables.css">';
|
||||
$head .= '<script src="/plugins/datatables/dataTables.js"></script>';
|
||||
|
||||
$head .= '<link rel="stylesheet" href="/plugins/trumbowyg/ui/trumbowyg.min.css">';
|
||||
$head .= '<script src="/plugins/trumbowyg/trumbowyg.min.js"></script>';
|
||||
|
||||
$foot = '';
|
||||
$foot .= '<script src="/dist/script.js"></script>';
|
||||
$foot .= '<script src="/dist/exercicio_form.js"></script>';
|
||||
|
||||
$this->content = file_get_contents(__DIR__ . '/template.html');
|
||||
|
||||
$this->content = str_replace("{{usermenu}}", "", $this->content);
|
||||
$this->content = str_replace("{{elements}}", $SIDEBAR->render(), $this->content);
|
||||
|
||||
$this->content = str_replace("{{head}}", $head, $this->content);
|
||||
|
||||
if(is_file($this->getView()['location'])){
|
||||
$this->content = str_replace('{{>content}}', $this->replaceSections(file_get_contents($this->getView()['location']), $this->_view['values']), $this->content);
|
||||
}else{
|
||||
$this->content = str_replace('{{>content}}', '', $this->content);
|
||||
}
|
||||
|
||||
$this->content = str_replace("{{footer}}", $foot, $this->content);
|
||||
|
||||
$this->implate();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
<html>
|
||||
<head>
|
||||
{{head}}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="wrapper">
|
||||
<!-- Sidebar -->
|
||||
<!-- Sidebar -->
|
||||
<nav id="sidebar-wrapper">
|
||||
<div class="logo" style="">
|
||||
<img src='/media/logo_white.png' alt="logo" />
|
||||
</div>
|
||||
<!-- <div class="search-nav" style="">
|
||||
<input class="form-control" type="text" placeholder="Busca"/>
|
||||
</div> -->
|
||||
|
||||
<hr />
|
||||
|
||||
{{elements}}
|
||||
<ul id="side-second-menu" class="hidden nav">
|
||||
</ul>
|
||||
</nav>
|
||||
<!-- /#sidebar-wrapper -->
|
||||
<!-- /#sidebar-wrapper -->
|
||||
|
||||
<!-- Page Content -->
|
||||
<div id="main-page-wrapper">
|
||||
|
||||
<header style='min-height: 50px; background-color: #000;'>
|
||||
<ul class="nav navbar-nav navbar-left">
|
||||
<li class="tooltip-sidebar-toggle">
|
||||
<a href="" id="menu-toggle">
|
||||
<i class="fa fa-th-list" aria-hidden="true"></i>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<!-- <ul id='menu-usuario' class="nav navbar-nav navbar-right nav-dropdown">
|
||||
<li class="dropdown">
|
||||
<a class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false" data-method="reload">
|
||||
<i class="fa fa-user" aria-hidden="true"></i> <span class="caret"></span>
|
||||
</a>
|
||||
{{usermenu}}
|
||||
</li>
|
||||
</ul> -->
|
||||
</header>
|
||||
|
||||
<div id="progress" class="progress hidden" >
|
||||
<div class="progress-bar progress-bar-striped progress-bar-animated active" style="width: 100%;"></div>
|
||||
</div>
|
||||
<!-- BreadCrumbs -->
|
||||
|
||||
<!-- /BreadCrumbs -->
|
||||
|
||||
<div id="page-content-wrapper">
|
||||
<div class="container-fluid" style="height: 1024px;">
|
||||
|
||||
<div class="row">
|
||||
<div id="content" class="col-lg-12">
|
||||
{{>content}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /#page-content-wrapper -->
|
||||
</div>
|
||||
<div id="modal" class="modal fade" role="dialog"> </div>
|
||||
{{footer}}
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
use Template\RenderableTemplate as RenderableTemplate;
|
||||
|
||||
class DefaultTemplate extends RenderableTemplate {
|
||||
|
||||
public function __construct() {
|
||||
|
||||
}
|
||||
|
||||
public function render() {
|
||||
|
||||
$this->content = file_get_contents(__DIR__ . '/template.html');
|
||||
|
||||
if(is_file($this->getView()['location'])){
|
||||
$this->content = str_replace('{{>content}}', $this->replaceSections(file_get_contents($this->getView()['location']), $this->_view['values']), $this->content);
|
||||
}else{
|
||||
$this->content = str_replace('{{>content}}', '', $this->content);
|
||||
}
|
||||
$this->implate();
|
||||
}
|
||||
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
{{>content}}
|
||||
</body>
|
||||
</html>
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
use Template\RenderableTemplate as RenderableTemplate;
|
||||
|
||||
class NullTemplate extends RenderableTemplate {
|
||||
|
||||
public function __construct() {
|
||||
|
||||
}
|
||||
|
||||
public function render() {
|
||||
|
||||
if (is_file($this->getView()['location'])) {
|
||||
$this->content = file_get_contents($this->getView()['location']);
|
||||
$this->implate();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
use Routes\RouteCollection as RouteCollection;
|
||||
use App\Core\Template\Output as Output;
|
||||
|
||||
include_once 'WellcomeController.php';
|
||||
|
||||
RouteCollection::add('GET','/', function(){
|
||||
|
||||
Output::setTemplate('');
|
||||
Output::setView('wellcome');
|
||||
Output::addValue('string', Array('welcome' => 'Bem vindo'));
|
||||
Output::addValue('palavrinha', 'Oi');
|
||||
Output::render();
|
||||
});
|
||||
|
||||
RouteCollection::add('get', '/welcome', 'WellcomeController@welcome');
|
||||
Executable
+11
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
use RR\Response as R;
|
||||
|
||||
class WellcomeController{
|
||||
|
||||
function welcome(){
|
||||
R::json(Array('message' => Lang::getString('welcome', 'welcome')))->send()->done();
|
||||
}
|
||||
|
||||
}
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
$lang['welcome']['module_name'] = 'welcome';
|
||||
|
||||
$lang['welcome']['welcome'] = 'Welcome!';
|
||||
|
||||
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
$lang['welcome']['module_name'] = 'welcome';
|
||||
|
||||
$lang['welcome']['welcome'] = 'Bienvenue!';
|
||||
|
||||
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
$lang['welcome']['module_name'] = 'welcome';
|
||||
|
||||
$lang['welcome']['welcome'] = 'Bem-vindo!';
|
||||
|
||||
|
||||
Executable
+6
@@ -0,0 +1,6 @@
|
||||
<div style="text-align: center">
|
||||
<img src="media/logo_black.png" />
|
||||
</div>
|
||||
{{string.welcome}} to hell...
|
||||
<br />
|
||||
I shal be your guide {{palavrinha}}
|
||||
Reference in New Issue
Block a user