예제 #1
0
 public function validationFor($name)
 {
     if (parent::validationFor($name)) {
         $span = new Html('span');
         $span->addClass('msg error');
         $span->setInnerHtml(parent::validationFor($name));
         return $span;
     }
     return '';
 }
 public function __construct()
 {
     parent::__construct();
     // This is really not required, but if you want you can change the doctype like so..
     $this->getSite()->setDocType(Site::DOCTYPE_HTML_5);
     // GetSite contains information about the site - here we can add javascript and change styling etc.
     $this->getSite()->setTitle('Test site');
     $this->getSite()->addWrappedCss('style.css');
     $this->getSite()->addWrappedJs('jquery-1.11.3.min.js');
     $this->getSite()->addWrappedJs('global.js');
     $this->getSite()->addWrappedJs('pecee.js');
     // Add meta viewport field
     $object = new Html('meta');
     $object->setClosingType(Html::CLOSE_TYPE_SELF);
     $object->addAttribute('name', 'viewport');
     $object->addAttribute('content', 'width=device-width, initial-scale=1');
     $this->getSite()->addHeader($object);
     // Add entry to debug class
     Debug::GetInstance()->add('NU HAR JEG LOADED ABSTRACT');
     // OVERSTÅENDE SVARER TIL AT GØRE SÅDAN HER
     //$this->getSite()->addMeta('viewport', 'width=device-width, initial-scale=1');
 }
예제 #3
0
 public function __construct($name, $method = self::METHOD_POST, $action = null, $enctype = self::ENCTYPE_APPLICATION_URLENCODED)
 {
     parent::__construct('form');
     $this->closingType = self::CLOSE_TYPE_NONE;
     $this->name($name);
     $this->enctype($enctype);
     $this->method($method);
     $this->action($action === null ? url() : $action);
     // Add csrf token
     if (strtolower($method) !== 'get') {
         $this->addItem(new HtmlInput(BaseCsrfVerifier::POST_KEY, 'hidden', csrf_token()));
     }
 }
예제 #4
0
 public function start($id, $visible = false)
 {
     $tab = new Html('div');
     $tab->setClosingType(Html::CLOSE_TYPE_NONE);
     $tab->addAttribute('class', 'pecee-tablist');
     $tab->addAttribute('data-id', $id);
     $tab->addAttribute('data-visible', $visible ? 'true' : 'false');
     return $tab;
 }
예제 #5
0
파일: Form.php 프로젝트: skipperbent/pecee
 /**
  * Create button element
  * @param string $text
  * @param string|null $type
  * @param string|null $name
  * @param string|null $value
  * @return Html
  */
 public function button($text, $type = null, $name = null, $value = null)
 {
     $el = new Html('button');
     $el->addInnerHtml($text);
     if ($type !== null) {
         $el->addAttribute('type', $type);
     }
     if ($name !== null) {
         $el->addAttribute('name', $name);
     }
     if ($value !== null) {
         $el->addAttribute('value', $value);
     }
     $el->setClosingType(Html::CLOSE_TYPE_TAG);
     return $el;
 }