/** * Execute the console command. * * @return mixed */ public function handle(ScaffoldController $scaffoldController) { $generateRoute = $this->option('no-route') !== true; $pathRoute = app_path('Http/routes.php'); $scaffoldController->pathRoute($pathRoute)->pathController($this->getPath($this->getFullControllerName()))->nameController($this->getControllerName())->nameFullControllerName($this->getFullControllerName())->nameModel($this->getNameInput())->nameRoute(strtolower($this->getNameInput()))->nameView(strtolower($this->getNameInput()))->route($generateRoute)->generate(); if ($generateRoute) { $this->info('Resource route added to ' . $pathRoute); } $this->info($this->type . ' created successfully.'); }
public static function getInstance(ApplicationController $application) { if (!isset(self::$instance)) { self::$instance = new ScaffoldController($application); } return self::$instance; }
function __construct( $pageName ) { $this->application = ApplicationController::getInstance(); if(isset($_REQUEST["scaffolding"]) && "true" == $_REQUEST["scaffolding"]){ add_required_class( 'Scaffold.Controller.php', SCAFFOLD ); $this->application->loadScaffoldingSettings(""); $settings = $this->application->getSettings(); $actions = array(ACTION_LIST,ACTION_DELETE,ACTION_UPDATE,ACTION_FIND,ACTION_ADD); $action = ""; /*** * we are going to change page=AddUsersPage to * action = add * table = Users * page = DefaultScaffoldingPage * * this is because we want to pull out the information from the query string to make it simple, give it a dynamic url * and we are only using one scaffolding page in ApplicationSettings->global->scaffolding->default_page, to skin the page */ foreach($actions as $actionType){ $ucActionType = ucfirst($actionType); $regexAction = "/^{$ucActionType}/"; if(1 == preg_match($regexAction, $pageName)){ $action = $actionType; break; } } $table = preg_replace($regexAction, "", $pageName); $table = preg_replace("/Page$/", "", $table); $_REQUEST["action"] = $action; $_REQUEST["table"] = $table; $pageName = $settings["global"]["scaffolding"]["default_page"]; $_REQUEST["page"] = $pageName; $this->scaffolding = ScaffoldController::getInstance($this->application); } if( $pageName ) { $this->pageName = $pageName; $this->url = PAGE_PATH . $this->pageName . PAGE_EXTENSION; if( $this->urlExists( $this->url ) ) { $this->log( "<!-- loading page $this->url -->" ); $this->isLoaded = $this->load( $this->url ); $this->tags = array( TEMPLATE_TAG, MODULES_TAG, DEPENDENCY_TAG, TITLE_TAG, MESSAGING_TAG ); $this->moduleList = array(); } else { $this->log( "url not found: $this->url." ); } } }
<?php require_once "resources/bin/constants.php"; add_required_class('Scaffold.Controller.php', SCAFFOLD); add_required_class('Scaffold.Class.php', SCAFFOLD); add_required_class('Scaffolding.Class.php', SCAFFOLD); $controller = ScaffoldController::getInstance($application); $action = $_REQUEST["action"]; $table = $_REQUEST["table"]; $id = $_REQUEST["id"]; if (isset($_REQUEST["submit"])) { echo $controller->doSubmission($action, $table, $id, $_REQUEST); } else { echo $controller->doAction($action, $table, $id); } //$action = $_REQUEST["action"]; //$connection = $application->getDatabaseConnection(); // //switch($action){ // case "create": // showCreateInfo($connection); // break; // case "tableInfo": // showTableInfo($connection); // break; // case "allTables": // default: // showAllTables($connection); //} // //function showAllTables($connection) {