setStaticRoot() 공개 메소드

Set a static root which contains the "crudkit/" directory of css and JS
public setStaticRoot ( $staticRoot )
$staticRoot
예제 #1
0
<?php

use CrudKit\CrudKitApp;
use CrudKit\Data\DummyDataProvider;
use CrudKit\Data\SQLiteDataProvider;
use CrudKit\Pages\BasePage;
use CrudKit\Pages\BasicDataPage;
require "../vendor/autoload.php";
$crud = new CrudKitApp();
$crud->setStaticRoot("/src/static");
$page4 = new BasicDataPage('dummy4');
$page4->setName("SQLITE PAGE");
$sqliteProvider = new SQLiteDataProvider("fixtures/chinook.sqlite");
$sqliteProvider->setTable("Customer");
$sqliteProvider->setPrimaryColumn("a0", "CustomerId");
$sqliteProvider->addColumn("a1", "FirstName", "First Name");
$sqliteProvider->addColumn("a2", "LastName", "Last Name");
$sqliteProvider->addColumn("a3", "City", "City");
$sqliteProvider->addColumn("a4", "Country", "Country");
$sqliteProvider->addColumn("a5", "Email", "Email");
$sqliteProvider->setSummaryColumns(array("a1", "a2"));
$sqliteProvider->manyToOne("a6", "SupportRepId", "Employee", "EmployeeId", "FirstName", "Support Rep");
$page4->setDataProvider($sqliteProvider);
$crud->addPage($page4);
$page5 = new BasicDataPage('dummy5');
$page5->setName("Employees");
$empProvider = new SQLiteDataProvider("fixtures/chinook.sqlite");
$empProvider->setTable("Employee");
$empProvider->setPrimaryColumn("b0", "EmployeeId");
$empProvider->addColumn("b1", "FirstName", "First Name");
$empProvider->addColumn("b2", "LastName", "Last Name");
예제 #2
0
<?php

require "vendor/autoload.php";
use CrudKit\CrudKitApp;
use CrudKit\Pages\SQLiteTablePage;
use CrudKit\Pages\BasicLoginPage;
// Create a new CrudKitApp object
$app = new CrudKitApp();
$app->setStaticRoot("static/crudkit/");
$app->setAppName("Admin Panel");
//
// HANDLE LOGIN
//
$login = new BasicLoginPage();
$login->setWelcomeMessage("Use credentials admin/demo or user/demo");
if ($login->userTriedLogin()) {
    $username = $login->getUserName();
    $password = $login->getPassword();
    // TODO: you should use your own authentication scheme here
    if ($username === 'admin' && $password === 'demo') {
        $login->success();
    } else {
        if ($username === 'user' && $password === 'demo') {
            $login->success();
        } else {
            $login->fail("Please check your password (admin/demo) or (user/demo)");
        }
    }
}
$app->useLogin($login);
//