/**
  * Initialize the products form
  */
 public function initialize($entity = null, $options = array())
 {
     $f = new TextArea("institucional");
     $f->setLabel('&nbsp');
     $f->setAttribute('class', 'form-control summernote');
     $this->add($f);
 }
 function initialize($entity = null, $options = null)
 {
     $date = new Date('date');
     $date->setLabel('Input Date');
     $date->setFilters(array('striptags', 'string'));
     $date->setDefault(date('Y-m-d'));
     $date->addValidators(array(new PresenceOf(array('message' => 'Date is required'))));
     $this->add($date);
     $start_time = new Text('start_hour');
     $start_time->setLabel('Input Start Hour');
     $start_time->setFilters(array('striptags', 'string'));
     $start_time->addValidators(array(new PresenceOf(array('message' => 'Start Time is required'))));
     $this->add($start_time);
     $finish_time = new Text('finish_hour');
     $finish_time->setLabel('Input Finish Hour');
     $finish_time->setFilters(array('striptags', 'string'));
     $finish_time->addValidators(array(new PresenceOf(array('message' => 'Finish Time is required'))));
     $this->add($finish_time);
     $systemId = new Select('system_id', Systems::find(), array('using' => array('id', 'name'), 'useEmpty' => true));
     $systemId->setLabel('Select System');
     $systemId->addValidators(array(new PresenceOf(array('message' => 'System is required'))));
     if ($entity) {
         $systemId->setDefault(array($entity->system_id));
     }
     $this->add($systemId);
     $description = new TextArea('description');
     $description->setLabel('Input Description');
     $description->addValidators(array(new PresenceOf(array('message' => 'Description is required'))));
     $this->add($description);
     $hidden = new Hidden('id');
     if ($entity) {
         $hidden->setDefault(array($entity->id));
     }
     $this->add($hidden);
 }
Esempio n. 3
0
 public function initialize()
 {
     $type = new Select('type_id', Type::cachedListArray(['key' => 'id']));
     $type->setLabel('Type of Publication');
     $this->add($type);
     $title = new Text('title', ['required' => true]);
     $title->addValidator(new PresenceOf(['message' => 'Title can not be empty']));
     $title->setLabel('Title');
     $this->add($title);
     $slug = new Text('slug');
     $slug->setLabel('Slug');
     $this->add($slug);
     $date = new Text('date');
     $date->setLabel('Publication Date');
     $this->add($date);
     $text = new TextArea('text');
     $text->setLabel('Text');
     $this->add($text);
     $meta_title = new Text('meta_title', ['required' => true]);
     $meta_title->setLabel('meta-title');
     $this->add($meta_title);
     $meta_description = new TextArea('meta_description', ['style' => 'height:4em; min-height: inherit']);
     $meta_description->setLabel('meta-description');
     $this->add($meta_description);
     $meta_keywords = new TextArea('meta_keywords', ['style' => 'height:4em; min-height: inherit']);
     $meta_keywords->setLabel('meta-keywords');
     $this->add($meta_keywords);
     $preview_inner = new Check('preview_inner');
     $preview_inner->setLabel('Show preview image inside publication');
     $this->add($preview_inner);
     $image = new Image('preview_src');
     $image->setLabel('Thumbnail Image');
     $this->add($image);
 }
 /**
  * Initialize the products form
  */
 public function initialize($entity = null, $options = array())
 {
     $titulo = new Text("titulo");
     $titulo->setAttribute('class', 'form-control ');
     $this->add($titulo);
     $email = new Text("email");
     $email->setAttribute('class', 'form-control ');
     $this->add($email);
     $telefone = new Text("telefone");
     $telefone->setAttribute('class', 'form-control ');
     $this->add($telefone);
     $endereco = new Text("endereco");
     $endereco->setAttribute('class', 'form-control ');
     $this->add($endereco);
     $cep = new Text("cep");
     $cep->setLabel('CEP');
     $cep->setAttribute('data-mask', '99999-999');
     $cep->setAttribute('class', 'form-control ');
     $this->add($cep);
     $descricao = new TextArea("descricao");
     $descricao->setLabel('Descrição da loja');
     $descricao->setAttribute('class', 'form-control ');
     $descricao->setAttribute('rows', '5');
     $this->add($descricao);
     $produtos_por_pagina = new Numeric("produtos_por_pagina");
     $produtos_por_pagina->setLabel('Produtos por pagina');
     $produtos_por_pagina->setAttribute('class', 'form-control');
     $this->add($produtos_por_pagina);
     $produtos_destaque_quantidade = new Numeric("produtos_destaque");
     $produtos_destaque_quantidade->setLabel('Produtos destaques');
     $produtos_destaque_quantidade->setAttribute('class', 'form-control');
     $this->add($produtos_destaque_quantidade);
 }
Esempio n. 5
0
 public function initialize()
 {
     $type = new Select('type', Publication::$types, array());
     $type->setLabel('Тип пубикации');
     $this->add($type);
     $title = new Text('title', array('required' => true));
     $title->setLabel('Название');
     $this->add($title);
     $slug = new Text('slug');
     $slug->setLabel('Транслитерация');
     $this->add($slug);
     $date = new Text('date');
     $date->setLabel('Дата публикации');
     $this->add($date);
     $text = new TextArea('text');
     $text->setLabel('Текст');
     $this->add($text);
     $meta_title = new Text('meta_title', array('required' => true));
     $meta_title->setLabel('meta-title');
     $this->add($meta_title);
     $meta_description = new TextArea('meta_description');
     $meta_description->setLabel('meta-description');
     $this->add($meta_description);
     $meta_keywords = new TextArea('meta_keywords');
     $meta_keywords->setLabel('meta-keywords');
     $this->add($meta_keywords);
     $preview_inner = new Check('preview_inner');
     $preview_inner->setLabel('Превью внутри публикации');
     $preview_inner->setDefault(1);
     $this->add($preview_inner);
     $image = new File('image');
     $image->setLabel('Загрузить превью');
     $this->add($image);
 }
Esempio n. 6
0
 public function initialize()
 {
     $content = new TextArea('content', array('rows' => 35, 'style' => 'display: none', 'spellcheck' => 'false'));
     $content->addValidator(new PresenceOf(array('message' => 'Some content is required')));
     $this->add($content);
     $id = new Hidden('id');
     $id->addValidator(new Regex(array('pattern' => '/[0-9]*/', 'message' => 'The page id can only be numerical')));
     $this->add($id);
 }
Esempio n. 7
0
 /**
  * @param Phalcon\Mvc\ModelInstance $entity
  * @param array $options
  */
 public function initialize($entity = null, $options = null)
 {
     if (!isset($options['edit']) && !isset($options['create'])) {
         $id = new Text('id');
         $id->setLabel('Id');
         $this->add($id);
     }
     $category = new Select('categoriesId', Categories::find(), array('using' => array('id', 'name'), 'useEmpty' => true, 'emptyText' => '...'));
     $category->setLabel('Category');
     $category->addValidator(new PresenceOf(array('message' => 'Category is mandatory')));
     $category->setUserOption('searcheable', true);
     $category->setUserOption('browseable', true);
     $category->setUserOption('relation', 'category');
     $this->add($category);
     $icon = new Text('icon', array('placeholder' => 'Enter a css-icon class name'));
     $icon->setLabel('Icon');
     $icon->addValidator(new PresenceOf(array('message' => 'Icon is mandatory')));
     $this->add($icon);
     $code = new Text('code', array('maxlength' => 10));
     $code->setLabel('Code');
     $code->setUserOption('searcheable', true);
     $code->setUserOption('browseable', true);
     $code->addValidator(new PresenceOf(array('message' => 'Code is mandatory')));
     $this->add($code);
     $name = new Text('name', array('maxlength' => 64));
     $name->setLabel('Name');
     $name->setUserOption('searcheable', true);
     $name->setUserOption('browseable', true);
     $name->addValidator(new PresenceOf(array('message' => 'Name is mandatory')));
     $this->add($name);
     $description = new TextArea('description');
     $description->setLabel('Description');
     $description->addValidator(new PresenceOf(array('message' => 'Description is mandatory')));
     $this->add($description);
     $price = new Text('price');
     $price->setLabel('Price');
     $price->setUserOption('searcheable', true);
     $price->setUserOption('browseable', true);
     $price->addValidator(new PresenceOf(array('message' => 'Price is mandatory')));
     $price->addValidator(new Numericality(array('message' => 'Price must be a number')));
     $this->add($price);
     $stock = new Text('stock');
     $stock->setLabel('Stock');
     $stock->setUserOption('browseable', true);
     $stock->addValidator(new PresenceOf(array('message' => 'Current stock is mandatory')));
     $stock->addValidator(new Numericality(array('message' => 'Current stock must be a number')));
     $this->add($stock);
     if (isset($options['edit'])) {
         $createdAt = new Date('created', array('readonly' => 'readonly'));
         $createdAt->setLabel('Created At');
         if ($entity->createdAt) {
             $entity->created = date('Y-m-d', $entity->createdAt);
         }
         $this->add($createdAt);
     }
 }
Esempio n. 8
0
 public function initialize()
 {
     $content = new TextArea('content', array('rows' => 35, 'style' => 'display: none;', 'placeholder' => 'Some Markdown text'));
     $content->addValidator(new PresenceOf(array('message' => 'Some content is required')));
     $this->add($content);
     $title = new Text('title', array('placeholder' => 'Title (CamelCase only)', 'autofocus' => true));
     $title->addValidator(new PresenceOf(array('message' => 'A title is required')));
     $title->addValidator(new Regex(array('pattern' => '/[A-Z][a-zA-Z]*/', 'message' => 'Only CamelCase or single word titles are allowed')));
     $this->add($title);
 }
Esempio n. 9
0
 public function initialize($entity = null, $options = array())
 {
     $name = new Text('name', array('placeholder' => 'Name'));
     $name->setLabel('Name');
     $name->addValidators(array(new PresenceOf(array('message' => 'Please enter your name')), new StringLength(array('max' => 50, 'min' => 2, 'messageMaximum' => 'Name must have at most 50 characters', 'messageMinimum' => 'Name must have at least 2 characters'))));
     $this->add($name);
     $description = new TextArea('description', array('placeholder' => 'Description'));
     $description->setLabel('Description');
     $description->addValidators(array(new PresenceOf(array('message' => 'Please enter your description')), new StringLength(array('max' => 1000, 'min' => 5, 'messageMaximum' => 'Description must have at most 1000 characters', 'messageMinimum' => 'Name must have at least 5 characters'))));
     $this->add($description);
 }
 public function initialize()
 {
     $type = new Radio('type', ['1' => '单选/多选', '3' => '判断']);
     $type->setLabel('题目类型');
     $type->addValidators([new PresenceOf(['message' => '题目类型必选'])]);
     $this->add($type);
     $question = new TextArea('question');
     $question->setLabel('题目');
     $question->addValidators([new PresenceOf(['message' => '题目内容必填'])]);
     $this->add($question);
 }
 function initialize($entity = null, $options = null)
 {
     $name = new Text('name');
     $name->setLabel('Input Module');
     $name->setFilters(array('striptags', 'string'));
     $name->addValidators(array(new PresenceOf(array('message' => 'Name is required'))));
     $this->add($name);
     $description = new TextArea('description');
     $description->setLabel('Input Description');
     $description->addValidators(array(new PresenceOf(array('message' => 'Description is required'))));
     $this->add($description);
 }
 public function initialize($entity = null, $options = null)
 {
     $code = new Text('code');
     $code->setLabel('Code');
     $this->add($code);
     $parameter = new Text('parameter');
     $parameter->setLabel('Parameter');
     $this->add($parameter);
     $textvalue = new TextArea('textvalue');
     $textvalue->setLabel('Value');
     $this->add($textvalue);
 }
 public function initialize($entity = null, $options = null)
 {
     $language = new Select('languagecode', Language::find(), array('using' => array('code', 'language'), 'useEmpty' => TRUE, 'emptyText' => $this->di->get('translate')->_('Select a Language')));
     $language->setLabel('Idioma');
     $this->add($language);
     $name = new Text('name');
     $name->setLabel('Name translation');
     $this->add($name);
     $description = new TextArea('description');
     $description->setLabel('Description translation');
     $this->add($description);
 }
 public function initialize($entity = null, $options = null)
 {
     $language = new Select('languagecode', Language::find(), array('using' => array('code', 'language'), 'useEmpty' => TRUE, 'emptyText' => $this->di->get('translate')->_('Select a Language')));
     $language->setLabel('Idioma');
     $this->add($language);
     $title = new Text('title');
     $title->setLabel('Title');
     $this->add($title);
     $content = new TextArea('content', array('id' => 'summernote', 'name' => 'content', 'class' => 'summernote'));
     $content->setLabel('Content');
     $this->add($content);
 }
 /**
  * Initialize the products form
  */
 public function initialize($entity = null, $options = array())
 {
     $f = new TextArea("meta_description");
     $f->setLabel('Meta Description');
     $f->setAttribute('class', 'form-control');
     $f->setAttribute('rows', '10');
     $this->add($f);
     $f = new TextArea("meta_keyword");
     $f->setLabel('Meta Keywords');
     $f->setAttribute('class', 'form-control');
     $f->setAttribute('rows', '10');
     $this->add($f);
 }
Esempio n. 16
0
 public function initialize()
 {
     $id = new Text("id");
     $id->addValidator(new PresenceOf(array('message' => 'ID can not be empty.')));
     $id->addValidator(new Regex(array('pattern' => '/[a-z0-9_-]+/i', 'message' => 'В ID must be a-z 0-9 _ -')));
     $id->setLabel('ID');
     $title = new Text("title");
     $title->setLabel('Title');
     $html = new TextArea("html");
     $html->setLabel('HTML');
     $this->add($id);
     $this->add($title);
     $this->add($html);
 }
Esempio n. 17
0
 public function initialize()
 {
     $id = new Text("id");
     $id->addValidator(new PresenceOf(array('message' => 'ID должен быть указан')));
     $id->addValidator(new Regex(array('pattern' => '/[a-z0-9_-]+/i', 'message' => 'В ID могут быть только символы a-z 0-9 _ -')));
     $id->setLabel('ID');
     $title = new Text("title");
     $title->setLabel('Название');
     $html = new TextArea("html");
     $html->setLabel('HTML');
     $this->add($id);
     $this->add($title);
     $this->add($html);
 }
Esempio n. 18
0
 /**
  * Initialize the products form
  */
 public function initialize($entity = null, $options = array())
 {
     $f = new text("aws_bucket");
     $f->setLabel('AWS Bucket');
     $f->setAttribute('class', 'form-control');
     $this->add($f);
     $f = new text("aws_id");
     $f->setLabel('AWS ID');
     $f->setAttribute('class', 'form-control');
     $this->add($f);
     $f = new text("aws_location");
     $f->setLabel('AWS LOCATION');
     $f->setAttribute('class', 'form-control');
     $this->add($f);
     $f = new text("aws_secret_key");
     $f->setLabel('AWS SECRET KEY');
     $f->setAttribute('class', 'form-control');
     $this->add($f);
     $f = new text("facebook_appId");
     $f->setLabel('Facebook app id');
     $f->setAttribute('class', 'form-control');
     $this->add($f);
     $f = new text("facebook_appSecret");
     $f->setLabel('Facebooke app secret');
     $f->setAttribute('class', 'form-control');
     $this->add($f);
     $f = new text("sendgrid_username");
     $f->setLabel('Sendgrid username');
     $f->setAttribute('class', 'form-control');
     $this->add($f);
     $f = new text("sendgrid_password");
     $f->setLabel('sendgrid password');
     $f->setAttribute('class', 'form-control');
     $this->add($f);
     $f = new text("sendgrid_templateId");
     $f->setLabel('sendgrid template ID');
     $f->setAttribute('class', 'form-control');
     $this->add($f);
     $f = new TextArea("mapa");
     $f->setLabel('Google Maps');
     $f->setAttribute('class', 'form-control');
     $f->setAttribute('rows', '10');
     $this->add($f);
     $f = new TextArea("chat");
     $f->setLabel('Chat');
     $f->setAttribute('class', 'form-control');
     $f->setAttribute('rows', '10');
     $this->add($f);
 }
Esempio n. 19
0
 public function initialize($entity = null, $options = null)
 {
     $title = new Text('title', array('class' => 'form-control'));
     $title->setLabel('Title');
     $this->add($title);
     $author = new Text('author', array('class' => 'form-control'));
     $author->setLabel('Author');
     $this->add($author);
     $content = new TextArea('content', array('id' => 'summernote', 'name' => 'content', 'class' => 'summernote'));
     $content->setLabel('Content');
     $this->add($content);
     $active = new Select("active", array('Y' => $this->di->get('translate')->_('Yes'), 'N' => $this->di->get('translate')->_('No')), array('class' => 'form-control'));
     $active->setLabel('active');
     $this->add($active);
 }
Esempio n. 20
0
 public function initialize()
 {
     $name = new Text("name");
     $name->setLabel('Name');
     $name->addValidator(new PresenceOf(array('message' => '<strong>Name</strong> is required.')));
     $this->add($name);
     $format = new Select("format", ['CSV' => 'Standard CSV', 'Excel' => 'Micosoft Excel (.xlsx)']);
     $format->setLabel('File format');
     $this->add($format);
     $qry = new TextArea("qry");
     $qry->setLabel('Query');
     $qry->addValidator(new PresenceOf(array('message' => '<strong>Query</strong> is required.')));
     $this->add($qry);
     //$this->setCsrf();
 }
Esempio n. 21
0
 public function initialize($entity = null, $options = null)
 {
     $name = new Text('name');
     $name->setLabel('Name');
     $this->add($name);
     $type = new Text('type');
     $type->setLabel('type');
     $this->add($type);
     $size = new Text('size');
     $size->setLabel('size');
     $this->add($size);
     $path = new TextArea('path');
     $path->setLabel('Path');
     $this->add($path);
 }
Esempio n. 22
0
 public function initialize($entity = null, $options = null)
 {
     $name = new Text('name');
     $name->setLabel('Nombre');
     $this->add($name);
     $title = new Text('title');
     $title->setLabel('Título');
     $this->add($title);
     $type = new Select("type", array('image' => 'Imagen', 'video' => 'Video', 'mix' => 'Mixta'));
     $type->setLabel('Tipo');
     $this->add($type);
     $description = new TextArea('description');
     $description->setLabel('Descripción');
     $this->add($description);
 }
Esempio n. 23
0
 public function initialize()
 {
     $keyMap = $this->getUserKeys();
     $rendererMap = $this->di->get('renderer')->getRendererNameMap();
     $this->add($title = new Text('title'));
     $this->add(new Text('description'));
     $this->add($body = new TextArea('body'));
     $this->add($key = new \Phalcon\Forms\Element\Select('key_id', $keyMap));
     $this->add($format = new \Phalcon\Forms\Element\Select('format', $rendererMap));
     $key->setDefault($this->user->accountKey_id);
     $title->addValidator(new \Phalcon\Validation\Validator\PresenceOf(['message' => 'Title is required']));
     $body->addValidator(new \Phalcon\Validation\Validator\PresenceOf(['message' => 'Content is required']));
     $key->addValidator(new \Phalcon\Validation\Validator\InclusionIn(['message' => 'Encryption key is required', 'domain' => array_keys($keyMap)]));
     $format->addValidator(new \Phalcon\Validation\Validator\InclusionIn(['message' => 'Format is required', 'domain' => array_keys($rendererMap)]));
 }
Esempio n. 24
0
 /**
  * Constructs rich text area (ckeditor)
  *
  * @param string $name
  * @param null $attributes
  */
 public function __construct($name, $attributes = null)
 {
     $templatePath = implode(DIRECTORY_SEPARATOR, [dirname(__FILE__), 'RichTextArea', 'views', '']);
     $this->setDecorator(new Decorator($templatePath));
     $this->getDecorator()->setTemplateName('jquery');
     parent::__construct($name, $attributes);
 }
Esempio n. 25
0
 public function initalize($entity = null, $options = array())
 {
     if (!isset($options['edit'])) {
         $element = new Text("id");
         $this->add($element->setLabel("id"));
     } else {
         $this->add(new Hidden("id"));
     }
     $dte = new Hidden("date_added", array('id' => 'date_added', 'value' => date("Y-m-d H:i:s")));
     $this->add($dte);
     $title = new MyText("title", array('id' => 'title'));
     $title->setLabel("title");
     $this->add($title);
     $msg = new TextArea("text", array('id' => 'text', 'class' => 'form-control'));
     $msg->setLabel("Message");
     $this->add($msg);
 }
 public function initialize($entity = null, $options = null)
 {
     // In edition the id is hidden
     if (isset($options['edit']) && $options['edit']) {
         $uid = new Hidden('uid');
     } else {
         $uid = new Text('uid');
     }
     $this->add($uid);
     $title = new Text('title', array());
     $title->addValidators(array(new PresenceOf(array('message' => 'The name is required'))));
     $this->add($title);
     $sourcecode = new TextArea('sourcecode', array());
     $sourcecode->addValidators(array(new PresenceOf(array('message' => 'The sourcecode is required'))));
     $this->add($sourcecode);
     $this->add(new Select('templatetype', array('0' => ControllerBase::translate('templateTypeMail'), '1' => ControllerBase::translate('templateTypeContent'))));
 }
 public function initialize($entity = null, $options = null)
 {
     $article = new Select('articleid', Article::find(), array('using' => array('id', 'title'), 'useEmpty' => TRUE, 'emptyText' => $this->di->get('translate')->_('Select an Article'), 'class' => 'form-control'));
     $article->setLabel('Article');
     $this->add($article);
     $name = new Text('name', array('class' => 'form-control'));
     $name->setLabel('Name');
     $this->add($name);
     $email = new Text('email', array('class' => 'form-control'));
     $email->setLabel('Email');
     $this->add($email);
     $comment = new TextArea('comment', array('id' => 'summernote', 'name' => 'comment', 'class' => 'summernote'));
     $comment->setLabel('Comment');
     $this->add($comment);
     $active = new Select("active", array('Y' => $this->di->get('translate')->_('Yes'), 'N' => $this->di->get('translate')->_('No')), array('class' => 'form-control'));
     $active->setLabel('active');
     $this->add($active);
 }
Esempio n. 28
0
 public static function buildCommentForm(myModel $entity = null, Comments $comment = null)
 {
     if ($comment == null) {
         $form = new Form();
         $form->add(new Submit('Add Comment'));
         if (null != $entity) {
             $form->Url = $entity->getAddCommentFormUrl();
         }
     } else {
         $form = new Form($comment);
         $form->add(new Submit('修改'));
     }
     $content = new TextArea('content');
     $content->addValidator(new PresenceOf(['message' => '评论内容不能为空']));
     //这里也是一个增加验证的地方
     $form->add($content);
     return $form;
 }
Esempio n. 29
0
 public function initialize($entity = null, $options = null)
 {
     $name = new Text('name');
     $name->setLabel('Name');
     $this->add($name);
     $location = new Text('location');
     $location->setLabel('Location');
     $this->add($location);
     $start_date = new Text('start_date');
     $start_date->setLabel('Start Date');
     $this->add($start_date);
     $finish_date = new Text('finish_date');
     $finish_date->setLabel('Finish Date');
     $this->add($finish_date);
     $description = new TextArea('description');
     $description->setLabel('Descripción');
     $this->add($description);
 }
 function initialize($entity = null, $options = null)
 {
     $date = new Date('date_found');
     $date->setLabel('Input Date Found');
     $date->setFilters(array('striptags', 'string'));
     $this->add($date);
     /*====================== Number =====================*/
     $number = new Text('number');
     $number->setLabel('Input Number');
     $number->setFilters(array('striptags', 'string'));
     $number->addValidators(array(new PresenceOf(array('message' => 'Number is required'))));
     $this->add($number);
     /*====================== Solved =====================*/
     $isSolved = new Radio('is_solved', array('name' => 'is_solved', 'value' => '1'));
     $isSolved->setLabel('Is Solved');
     $isSolved->addValidators(array(new PresenceOf(array('message' => 'Is solved is required'))));
     $this->add($isSolved);
     $isSolved2 = new Radio('is_solved2', array('name' => 'is_solved', 'value' => '0', 'checked' => TRUE));
     $isSolved2->setLabel('Is Solved2');
     $isSolved2->addValidators(array(new PresenceOf(array('message' => 'Is solved is required'))));
     $this->add($isSolved2);
     $systemId = new Select('system_id', Systems::find(), array('using' => array('id', 'name'), 'useEmpty' => true));
     $systemId->setLabel('Select System');
     $systemId->addValidators(array(new PresenceOf(array('message' => 'System is required'))));
     if ($entity) {
         $systemId->setDefault(array($entity->system_id));
     }
     $this->add($systemId);
     $modulesId = new Select('modules_id', Modules::find(), array('using' => array('id', 'name'), 'useEmpty' => true));
     $modulesId->setLabel('Select Modules');
     $modulesId->addValidators(array(new PresenceOf(array('message' => 'Modules is required'))));
     if ($entity) {
         $modulesId->setDefault(array($entity->modules_id));
     }
     $this->add($modulesId);
     /*===== Bug =============*/
     $systemId = new Select('system_id', Systems::find(), array('using' => array('id', 'name'), 'useEmpty' => true));
     $systemId->setLabel('Select System');
     $systemId->addValidators(array(new PresenceOf(array('message' => 'System is required'))));
     if ($entity) {
         $systemId->setDefault(array($entity->system_id));
     }
     $this->add($systemId);
     $description = new TextArea('description');
     $description->setLabel('Input Description');
     $description->addValidators(array(new PresenceOf(array('message' => 'Description is required'))));
     $this->add($description);
     $hidden = new Hidden('id');
     if ($entity) {
         $hidden->setDefault(array($entity->id));
     }
     $this->add($hidden);
 }