/** * Initialize the component. * * @see ntentan\controllers.Controller::init() */ public function init() { parent::init(); // Setup the template engine and set params TemplateEngine::appendPath(realpath(__DIR__ . "/../../views/signin")); View::set('app', Config::get('ntentan:app.name')); View::set('social_signin_base_url', ''); }
public function login() { TemplateEngine::appendPath(__DIR__ . '/../../../../views/auth'); if (Input::exists(Input::POST, $this->usersFields['username']) && Input::exists(Input::POST, $this->usersFields['password'])) { return $this->authLocalPassword(Input::post($this->usersFields['username']), Input::post($this->usersFields['password'])); } else { return false; } }
public function testSubPathTemplateLoading() { $output = TemplateEngine::render('some_login.tpl.php', array()); $this->assertEquals("This is a Login Page?", $output); TemplateEngine::prependPath("tests/files/views/secondary"); $output = TemplateEngine::render('some_login.tpl.php', array()); $this->assertEquals("Is this another Login Page?", $output); TemplateEngine::reset(); TemplateEngine::appendPath('tests/files/views'); }
public function __construct() { parent::__construct(); $this->addOperation('edit'); $this->addOperation('delete'); TemplateEngine::appendPath(realpath(__DIR__ . '/../../views/crud')); TemplateEngine::appendPath(realpath(__DIR__ . '/../../views/forms')); View::set('entities', $this->getWyfName()); View::set('entity', Text::singularize($this->getWyfName())); View::set('has_add_operation', true); View::set('form_template', str_replace('.', '_', $this->getWyfPackage()) . '_form'); }
public function __construct() { $this->addComponent('auth', array('users_model' => 'system.users', 'on_success' => 'call_function', 'login_route' => 'auth/login', 'success_function' => AuthController::class . '::postLogin')); TemplateEngine::appendPath(realpath(__DIR__ . '/../../views/default')); TemplateEngine::appendPath(realpath(__DIR__ . '/../../views/menus')); View::set('route_breakdown', explode('/', Router::getRoute())); View::set('wyf_title', Config::get('ntentan:app.name')); $class = get_class($this); $namespace = Ntentan::getNamespace(); if (preg_match("/{$namespace}\\\\app\\\\(?<base>.*)\\\\controllers\\\\(?<name>.*)Controller/", $class, $matches)) { $this->package = strtolower(str_replace("\\", ".", $matches['base']) . "." . $matches['name']); $this->name = str_replace(".", " ", $this->package); $this->path = str_replace(' ', '/', $this->name); } }
public static function init($parameters = []) { Router::mapRoute('wyf_auth', 'auth/{action}', ['default' => ['controller' => controllers\AuthController::class]]); Router::mapRoute('wyf_api', 'api/{*path}', ['default' => ['controller' => controllers\ApiController::class, 'action' => 'rest']]); Router::mapRoute('wyf_main', function ($route) { $routeArray = explode('/', $route); $routeDetails = self::getController($routeArray, realpath(__DIR__ . '/../../../../src/app/'), \ntentan\Ntentan::getNamespace() . '\\app'); return $routeDetails; }, ['default' => ['action' => 'index']]); TemplateEngine::appendPath(realpath(__DIR__ . '/../views/layouts')); TemplateEngine::appendPath(realpath(__DIR__ . '/../views')); AssetsLoader::appendSourceDir(realpath(__DIR__ . '/../assets')); View::set('wyf_app_name', $parameters['short_name']); InjectionContainer::bind(ModelClassResolver::class)->to(ClassNameResolver::class); InjectionContainer::bind(ControllerClassResolver::class)->to(ClassNameResolver::class); }
public function testLoading() { TemplateEngine::appendPath("tests/files/views/no_engine"); TemplateEngine::render("no_engine", array()); }
public function __construct() { \ntentan\honam\TemplateEngine::appendPath(__DIR__ . "/../../templates/forms"); }
public function __construct() { TemplateEngine::appendPath(__DIR__ . "/../../templates/pagination"); }
public static function setUpBeforeClass() { TemplateEngine::appendPath('tests/files/views'); }
public function __construct() { \ntentan\honam\TemplateEngine::appendPath(__DIR__ . "/../../templates/menu"); $this->setCurrentUrl(Input::server('REQUEST_URI')); }