public static function has($type = 'REQUEST') { if (Request::env($type)->token->eq(self::get(Router::getToken()))) { return true; } return false; }
/** * */ public function render() { $fields = array(Html\Token::create(Router::getToken())); if (true === $this->__form['useAlert']) { $fields[] = Bootstrap\Alert::create(); } if ($this->__form['fields']) { foreach ($this->__form['fields'] as $name => $field) { $field = Arr::extend(array('name' => $name, 'value' => $this->request($name), 'alert' => $this->inError($name) ? 'error' : null, 'icon' => $this->inError($name) ? 'remove' : null), $field); $fields[] = Bootstrap\Field::create($field); } } Bootstrap\Panel::create(array('grid' => $this->__form['grid'], 'header' => $this->getPrimaryValue() ? $this->__form['i18n']['header']['edit'] : $this->__form['i18n']['header']['create'], 'class' => $this->getPrimaryValue() ? 'panel-primary' : 'panel-success', 'main' => Bootstrap\Fieldset::create($fields), 'footer' => Bootstrap\ButtonGroup::create(array('class' => 'pull-right', 'elements' => $this->__form['buttons']))))->render(); }
<?php use sJo\Module\Admin\Model\Admin; use sJo\Loader\Router; use sJo\View\Helper; use sJo\Libraries as Lib; Helper\Panel::create(array('col' => 6, 'title' => Admin::getInstance()->getPrimaryValue() ? Lib\I18n::__('Edit admin') : Lib\I18n::__('Create admin'), 'class' => Admin::getInstance()->getPrimaryValue() ? 'panel-primary' : 'panel-success', 'elements' => Helper\Fieldset::create(array(Helper\Token::create(Router::getToken()), Helper\Input::create(array('type' => 'email', 'name' => 'email', 'label' => Lib\I18n::__('Email address'), 'placeholder' => Lib\I18n::__('Enter email'), 'value' => Admin::getInstance()->request('email'))), Helper\Input::create(array('type' => 'text', 'name' => 'name', 'label' => Lib\I18n::__('Name'), 'placeholder' => Lib\I18n::__('Enter name'), 'value' => Admin::getInstance()->request('name'))))), 'footer' => Helper\ButtonGroup::create(array('class' => 'pull-right', 'elements' => array(Helper\Button::create(array('name' => 'saveAndStay', 'value' => Lib\I18n::__('Save and stay'))), Helper\Button::create(array('name' => 'saveAndCreate', 'value' => Lib\I18n::__('Save and create new'), 'class' => 'btn-warning')), Helper\Button::create(array('value' => Lib\I18n::__('Save and back to list'), 'class' => 'btn-primary')))))))->render();
?> " /> <title><?php Lib\I18n::_e('Authentification'); ?> </title> <meta name="description" content="<?php Lib\I18n::_e('Authentification'); ?> "> <?php if (Helper\Style::hasRegistry()) { ?> <?php Helper\Style::applyRegistry(); ?> <?php } ?> <style type="text/css"> body{background:#333} form{background:#fff;width:300px;margin:150px auto 0;padding:0 20px 20px;border:5px solid #000;border-radius:10px;box-shadow:0 0 10px #000} </style> </head> <body> <?php Helper\Form::create(array(Helper\Fieldset::create(array(Helper\Token::create(Router::getToken('signin')), Helper\Container::create(array('tagname' => 'h2', 'attributes' => array('class' => 'form-signin-heading'), 'elements' => Lib\I18n::__('Authentification'))), Helper\Alert::create(), Helper\Input::create(array('attributes' => array('name' => 'email', 'value' => Request::env('POST')->email->val(), 'placeholder' => Lib\I18n::__('Adresse email'), 'autofocus' => true))), Helper\Input::create(array('attributes' => array('type' => 'password', 'name' => 'password', 'placeholder' => Lib\I18n::__('Mot de passe')))), Helper\Button::create(array('attributes' => array('class' => 'btn-lg btn-block btn-primary', 'value' => Lib\I18n::__('Connexion'))))))))->render(); ?> </body> </html>
<?php use sJo\Loader\Router; use sJo\Module\Admin\Model\Admin; use sJo\View\Helper; use sJo\Libraries as Lib; $this->header(); Helper\Panel::create(array('col' => 6, 'title' => 'Edition', 'class' => 'panel-primary', 'elements' => Helper\Fieldset::create(array(Helper\Token::create(Router::getToken('update')), Helper\Input::create(array('type' => 'email', 'name' => 'email', 'label' => Lib\I18n::__('Email address'), 'placeholder' => Lib\I18n::__('Enter email'), 'value' => Admin::logged()->email)), Helper\Input::create(array('type' => 'text', 'name' => 'name', 'label' => Lib\I18n::__('Name'), 'placeholder' => Lib\I18n::__('Enter name'), 'value' => Admin::logged()->name)))), 'footer' => Helper\Button::create(array('class' => 'pull-right btn-primary', 'value' => Lib\I18n::__('Save')))))->render(); $this->footer();