public function initialize()
 {
     $this->_action = 'menuitem_add';
     $name = new Text('name');
     $name->setFilters(array('striptags', 'string'));
     $name->setAttributes(array('class' => 'form-control', 'autocomplete' => 'off', 'id' => 'menuitem_name'));
     $name->setLabel('Name');
     $url = new Text('url');
     $url->setFilters(array('striptags', 'string'));
     $url->setAttributes(array('class' => 'form-control', 'autocomplete' => 'off'));
     $url->setLabel('URL');
     $icon = new Text('icon');
     $icon->setFilters(array('striptags', 'string'));
     $icon->setAttributes(array('class' => 'form-control', 'autocomplete' => 'off'));
     $icon->setLabel('Icon');
     $device = new Select('device_id', Devices::find(), array('using' => array('id', 'name'), 'useEmpty' => true, 'emptyText' => 'None', 'emptyValue' => 0));
     $device->setLabel('Device');
     $menuId = new Hidden('menu_id');
     $menuId->setDefault(1);
     $this->add($name);
     $this->add($url);
     $this->add($icon);
     $this->add($device);
     $this->add($menuId);
 }
Exemple #2
0
 public function initialize($entity = null, $options = null)
 {
     // Name
     $name = new Text('name');
     $name->setLabel('Ваше полное имя');
     $name->setFilters(array('striptags', 'string'));
     $name->addValidators(array(new PresenceOf(array('message' => 'Имя является обязательным параметром'))));
     $this->add($name);
     // Name
     $name = new Text('nickname');
     $name->setLabel('Никнейм в игре');
     $name->setFilters(array('alpha'));
     $name->addValidators(array(new PresenceOf(array('message' => 'Никнейм является обязательным параметром'))));
     $this->add($name);
     // Email
     $email = new Text('email');
     $email->setLabel('E-Mail');
     $email->setFilters(['email']);
     $email->addValidators(array(new PresenceOf(array('message' => 'E-mail является обязательным параметром')), new Email(array('message' => 'E-mail не верный'))));
     $this->add($email);
     // Password
     $password = new Password('password');
     $password->setLabel('Пароль');
     $password->addValidators(array(new PresenceOf(array('message' => 'Пароль является обязательным параметром'))));
     $this->add($password);
     // Confirm Password
     $repeatPassword = new Password('repeatPassword');
     $repeatPassword->setLabel('Повторите пароль');
     $repeatPassword->addValidators(array(new PresenceOf(array('message' => 'Пароль является обязательным параметром'))));
     $this->add($repeatPassword);
 }
 /**
  * Initialize the companies form
  */
 public function initialize($entity = null, $options = array())
 {
     if (!isset($options['edit'])) {
         $element = new Text("id");
         $this->add($element->setLabel("Id"));
     } else {
         $this->add(new Hidden("id"));
     }
     $name = new Text("name");
     $name->setLabel("Name");
     $name->setFilters(array('striptags', 'string'));
     $name->addValidators(array(new PresenceOf(array('message' => 'Name is required'))));
     $this->add($name);
     $telephone = new Text("telephone");
     $telephone->setLabel("Telephone");
     $telephone->setFilters(array('striptags', 'string'));
     $telephone->addValidators(array(new PresenceOf(array('message' => 'Telephone is required'))));
     $this->add($telephone);
     $address = new Text("address");
     $address->setLabel("address");
     $address->setFilters(array('striptags', 'string'));
     $address->addValidators(array(new PresenceOf(array('message' => 'Address is required'))));
     $this->add($address);
     $city = new Text("city");
     $city->setLabel("city");
     $city->setFilters(array('striptags', 'string'));
     $city->addValidators(array(new PresenceOf(array('message' => 'City is required'))));
     $this->add($city);
 }
 public function initialize()
 {
     $this->_action = 'devices_add';
     $name = new Text('name');
     $name->setLabel('Devicename');
     $name->setFilters(array('striptags', 'string'));
     $name->setAttributes(array('class' => 'form-control', 'autocomplete' => 'off'));
     $ip = new Text('ip');
     $ip->setLabel('IP');
     $ip->setFilters(array('striptags', 'string'));
     $ip->setAttributes(array('class' => 'form-control', 'autocomplete' => 'off'));
     $mac = new Text('mac');
     $mac->setLabel('MAC');
     $mac->setFilters(array('striptags', 'string'));
     $mac->setAttributes(array('class' => 'form-control', 'autocomplete' => 'off'));
     $webtemp = new Text('webtemp');
     $webtemp->setLabel('Webtemp path');
     $webtemp->setFilters(array('striptags', 'string'));
     $webtemp->setAttributes(array('class' => 'form-control', 'autocomplete' => 'off'));
     $shutdownMethod = new Select('shutdown_method', array('none' => 'None', 'rpc' => 'RPC'), array('useEmpty' => false));
     $shutdownMethod->setLabel('Shutdown method');
     $showDasboard = new Check('show_on_dashboard');
     $showDasboard->setLabel('Show on dashboard');
     $showDasboard->setAttributes(array('class' => 'form-control'));
     $this->add($name);
     $this->add($ip);
     $this->add($mac);
     $this->add($webtemp);
     $this->add($shutdownMethod);
     $this->add($showDasboard);
 }
	public function initialize($entity = null, $options = null)
    {		
    	$title = new Text('title');
		$title->setLabel('Название');
		$title->setFilters(array('striptags', 'string'));
		$this->add($title);
	}
 /**
  * Add all fields to the form and set form specific attributes.
  */
 public function initialize()
 {
     $this->_action = 'general';
     $title = new Text('title');
     $title->setLabel('Title');
     $title->setFilters(array('striptags', 'string'));
     $title->setAttributes(array('class' => 'form-control'));
     $title->setDefault($this->_config->application->title);
     $title->addValidators(array(new PresenceOf(array())));
     $cryptKey = new Text('cryptkey');
     $cryptKey->setLabel('Cryptkey');
     $cryptKey->setFilters(array('striptags', 'string'));
     $cryptKey->setAttributes(array('class' => 'form-control'));
     $cryptKey->setDefault($this->_config->application->phalconCryptKey);
     $cryptKey->addValidators(array(new PresenceOf(array())));
     $bgcolor = new Select('bgcolor', array('blackbg' => 'Black', 'whitebg' => 'White'), array('useEmpty' => false));
     $bgcolor->setLabel('Background color');
     $bgcolor->setDefault($this->_config->application->background);
     $debug = new Check('debug');
     $debug->setLabel('debug');
     $debug->setAttributes(array('checked' => $this->_config->application->debug == '1' ? 'checked' : null));
     $this->add($title);
     $this->add($bgcolor);
     $this->add($cryptKey);
     $this->add($debug);
 }
Exemple #7
0
 public function initialize()
 {
     $this->add(new Text("firstname"));
     $lastname = new Text("lastname");
     $this->add($lastname);
     $username = new Text("username");
     $username->setFilters(array('striptags', 'string'));
     $username->addValidators(array(new PresenceOf()));
     $this->add($username);
     // password
     $password = new Password('password');
     $password->addValidator(new PresenceOf(array('message' => 'password')));
     $this->add($password);
     $this->add(new Text("avatar"));
     $email = new Text("email");
     $email->addValidators(array(new PresenceOf(), new Email()));
     $this->add($email);
     $this->add(new Select('gender', array('0' => 'Nữ', '1' => 'Nam')));
     $this->add(new Text("birthday"));
     $this->add(new Text("address"));
     $this->add(new Text("phone"));
     $this->add(new Select('gender', array('0' => 'Không', '1' => 'Có')));
     $this->add(new Select('status', array('0' => 'Không', '1' => 'Có'), array('class' => 'medium')));
     $department_id = new Select('department_id', \Modules\Backend\Models\Member_department::find(), array('using' => array('id', 'name'), 'class' => 'medium'));
     $this->add($department_id);
     $group_id = new Select('group_id', \Modules\Backend\Models\Permission_group::find(), array('using' => array('id', 'name'), 'class' => 'medium'));
     $this->add($group_id);
 }
 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);
 }
 public function initialize($entity = null, $options = null)
 {
     //姓名
     $name = new Text('name');
     $name->setLabel('姓 名');
     $name->setFilters(array('striptags', 'string'));
     $name->addValidators(array(new PresenceOf(array('message' => '请输入用户的姓名'))));
     $this->add($name);
     //用户名
     $name = new Text('username');
     $name->setLabel('用户名');
     $name->setFilters(array('alpha'));
     $name->addValidators(array(new PresenceOf(array('message' => '请输入用户名'))));
     $this->add($name);
     //邮箱
     $email = new Text('email');
     $email->setLabel('邮 箱');
     $email->setFilters('email');
     $email->addValidators(array(new PresenceOf(array('message' => '请输入邮箱')), new Email(array('message' => '不是有效的邮箱'))));
     $this->add($email);
     //密码
     $password = new Password('password');
     $password->setLabel('密 码');
     $password->addValidators(array(new PresenceOf(array('message' => '请输入密码'))));
     $this->add($password);
     //确认密码
     $repeatPassword = new Password('repeatPassword');
     $repeatPassword->setLabel('二次密码');
     $repeatPassword->addValidators(array(new PresenceOf(array('message' => '请再次输入密码'))));
     $this->add($repeatPassword);
 }
 public function initialize($entity = null, $options = null)
 {
     // Name
     $name = new Text('name');
     $name->setLabel('Полное имя');
     $name->setFilters(array('striptags', 'string'));
     $name->addValidators(array(new PresenceOf(array('message' => 'Имя вводить обязательно'))));
     $this->add($name);
     // Name
     $name = new Text('username');
     $name->setLabel('Имя пользователя');
     $name->setFilters(array('alpha'));
     $name->addValidators(array(new PresenceOf(array('message' => 'Это обязательное поле'))));
     $this->add($name);
     // Email
     $email = new Text('email');
     $email->setLabel('E-Mail');
     $email->setFilters('email');
     $email->addValidators(array(new PresenceOf(array('message' => 'Без email вы не зарегестрируетесь нигде')), new Email(array('message' => 'Это не настоящий email'))));
     $this->add($email);
     // Password
     $password = new Password('password');
     $password->setLabel('Пароль');
     $password->addValidators(array(new PresenceOf(array('message' => 'Придумайте пароль'))));
     $this->add($password);
     // Confirm Password
     $repeatPassword = new Password('repeatPassword');
     $repeatPassword->setLabel('Повторите пароль');
     $repeatPassword->addValidators(array(new PresenceOf(array('message' => 'Подтвердите свой пароль'))));
     $this->add($repeatPassword);
 }
Exemple #11
0
 public function initialize($entity = null, $options = array())
 {
     /*Si el form es de creacion, los campos seran required. Viceversa.*/
     $required['clave'] = "";
     $required['valor'] = "";
     if (isset($options['required'])) {
         $required['clave'] = "required";
         $required['valor'] = "true";
     }
     /*=========================== ID =====================================*/
     if (!isset($options['edit'])) {
         $element = new Text("yacimiento_id");
         $this->add($element->setLabel("ID"));
     } else {
         $this->add(new Hidden("yacimiento_id"));
     }
     /*=========================== Destino =====================================*/
     $elemento = new Text('yacimiento_destino', array('maxlength' => 60, 'class' => 'form-control', $required['clave'] => $required['valor']));
     $elemento->setLabel('Destino');
     $elemento->setFilters(array('striptags', 'string'));
     $elemento->addValidators(array(new PresenceOf(array('message' => 'El destino es requerido'))));
     $this->add($elemento);
     /*=========================== Operadoras =====================================*/
     $elemento = new Select('operadora_yacimientoId', Operadora::find(array('operadora_habilitado=1 AND operadora_yacimientoId=NULL', 'order' => 'operadora_nombre')), array('using' => array('operadora_id', 'operadora_nombre'), 'useEmpty' => true, 'emptyText' => 'SELECCIONE LAS OPERADORAS', 'emptyValue' => '', 'class' => 'form-control autocompletar', 'style' => 'width:100%', 'multiple' => 'multiple', $required['clave'] => $required['valor']));
     $elemento->setLabel('Operadoras');
     $this->add($elemento);
     /*=========================== EquipoPozo =====================================*/
     $elemento = new Select('equipoPozo_yacimientoId', Equipopozo::find(array('equipoPozo_habilitado=1 AND equipoPozo_yacimientoId=NULL', 'order' => 'equipoPozo_nombre')), array('using' => array('equipoPozo_id', 'equipoPozo_nombre'), 'useEmpty' => true, 'emptyText' => 'SELECCIONE LOS EQUIPOS/POZOS', 'emptyValue' => '', 'class' => 'form-control autocompletar', 'style' => 'width:100%', 'multiple' => 'multiple', $required['clave'] => $required['valor']));
     $elemento->setLabel('Equipos/Pozos');
     $this->add($elemento);
 }
Exemple #12
0
 public function initialize($entity = null, $options = null)
 {
     // Name
     $name = new Text('name');
     $name->setLabel('Your Full Name');
     $name->setFilters(array('striptags', 'string'));
     $name->addValidators(array(new PresenceOf(array('message' => 'Name is required'))));
     $this->add($name);
     // Name
     $name = new Text('username');
     $name->setLabel('Username');
     $name->setFilters(array('alpha'));
     $name->addValidators(array(new PresenceOf(array('message' => 'Please enter your desired user name'))));
     $this->add($name);
     // Email
     $email = new Text('email');
     $email->setLabel('E-Mail');
     $email->setFilters('email');
     $email->addValidators(array(new PresenceOf(array('message' => 'E-mail is required')), new Email(array('message' => 'E-mail is not valid'))));
     $this->add($email);
     // Password
     $password = new Password('password');
     $password->setLabel('Password');
     $password->addValidators(array(new PresenceOf(array('message' => 'Password is required'))));
     $this->add($password);
     // Confirm Password
     $repeatPassword = new Password('repeatPassword');
     $repeatPassword->setLabel('Repeat Password');
     $repeatPassword->addValidators(array(new PresenceOf(array('message' => 'Confirmation password is required'))));
     $this->add($repeatPassword);
 }
 public function initialize($menuitems)
 {
     $this->_action = 'menu';
     foreach ($menuitems as $menuItem) {
         $name = new Text('menuitem[' . $menuItem->id . '][name]');
         $name->setFilters(array('striptags', 'string'));
         $name->setAttributes(array('class' => 'form-control'));
         $name->setDefault($menuItem->name);
         $url = new Text('menuitem[' . $menuItem->id . '][url]');
         $url->setFilters(array('striptags', 'string'));
         $url->setAttributes(array('class' => 'form-control'));
         $url->setDefault($menuItem->url);
         $icon = new Text('menuitem[' . $menuItem->id . '][icon]');
         $icon->setFilters(array('striptags', 'string'));
         $icon->setAttributes(array('class' => 'form-control'));
         $icon->setDefault($menuItem->icon);
         $device = new Select('menuitem[' . $menuItem->id . '][device]', Devices::find(), array('using' => array('id', 'name'), 'useEmpty' => true, 'emptyText' => 'None', 'emptyValue' => 0));
         $device->setDefault($menuItem->device_id);
         $id = new Hidden('menuitem[' . $menuItem->id . '][id]');
         $id->setDefault($menuItem->id);
         $this->add($name);
         $this->add($url);
         $this->add($icon);
         $this->add($device);
         $this->add($id);
     }
 }
Exemple #14
0
 /**
  * Initialize the products form
  */
 public function initialize($entity = null, $options = array())
 {
     /*======================= usuario_id ================================*/
     if (!isset($options['edit'])) {
         $element = new Text("usuario_id");
         $this->add($element->setLabel("Id"));
     } else {
         $this->add(new Hidden("usuario_id"));
     }
     /*======================= usuario_nick ================================*/
     $name = new Text("name");
     $name->setLabel("Name");
     $name->setFilters(array('striptags', 'string'));
     $name->addValidators(array(new PresenceOf(array('message' => 'Name is required'))));
     $this->add($name);
     /*======================= usuario_nombreCompleto ================================*/
     $type = new Select('product_types_id', ProductTypes::find(), array('using' => array('id', 'name'), 'useEmpty' => true, 'emptyText' => '...', 'emptyValue' => ''));
     $type->setLabel('Type');
     $this->add($type);
     /*======================= usuario_contrasenia ================================*/
     $price = new Text("price");
     $price->setLabel("Price");
     $price->setFilters(array('float'));
     $price->addValidators(array(new PresenceOf(array('message' => 'Price is required')), new Numericality(array('message' => 'Price is required'))));
     $this->add($price);
     /*======================= usuario_sector ================================*/
     /*======================= usuario_email ================================*/
     /*======================= usuario_activo ================================*/
     /*======================= usuario_fechaCreacion ================================*/
     /*======================= usuario_imagen ================================*/
 }
 public function initialize($entity = null, $options = null)
 {
     // Email
     $email = new Text('email');
     $email->setLabel('E-Mail');
     $email->setFilters('email');
     $email->addValidators(array(new PresenceOf(array('message' => 'E-mail is required')), new Email(array('message' => 'E-mail is not valid'))));
     $this->add($email);
 }
 public function initialize($config)
 {
     $title = new Text('title');
     $title->setLabel('Title');
     $title->setFilters(array('striptags', 'string'));
     $title->setAttributes(array('class' => 'form-control'));
     $title->setDefault($config->application->title);
     $this->add($title);
 }
 public function initialize($users)
 {
     foreach ($users as $user) {
         $username = new Text('user[' . $user->id . '][username]');
         $username->setLabel('Check device state timeouts');
         $username->setFilters(array('striptags', 'string'));
         $username->setAttributes(array('class' => 'form-control'));
         $username->setDefault($user->username);
         $this->add($username);
     }
 }
 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);
 }
Exemple #19
0
 public function initialize($entity = null, $options = null)
 {
     // Name
     $name = new Text('nome', ['class' => 'form-control']);
     $name->setLabel('Nome');
     $name->setFilters(array('striptags', 'string'));
     $name->addValidators(array(new PresenceOf(array('message' => 'É necessário preencher o Nome'))));
     $this->add($name);
     // Email
     $email = new Text('email', ['class' => 'form-control']);
     $email->setLabel('E-Mail');
     $email->setFilters('email');
     $email->addValidators(array(new PresenceOf(array('message' => 'É necessário preencher o E-mail')), new Email(array('message' => 'Formato de E-mail inválido'))));
     $this->add($email);
     // Password
     $password = new Password('senha', ['class' => 'form-control']);
     $password->setLabel('Senha');
     $password->addValidators(array(new PresenceOf(array('message' => 'É necessário preencher a Senha'))));
     $this->add($password);
     // Confirm Password
     $repeatPassword = new Password('confirmar', ['class' => 'form-control']);
     $repeatPassword->setLabel('Confirmar Senha');
     $repeatPassword->addValidators(array(new PresenceOf(array('message' => 'É necessário preencher Confirmar Senha')), new Confirmation(['message' => 'Erro na Confirmação da Senha', 'with' => 'senha'])));
     $this->add($repeatPassword);
     // CPF
     $cpf = new Text('cpf', ['class' => 'form-control']);
     $cpf->setLabel('CPF');
     $cpf->setFilters(array('striptags', 'string'));
     $cpf->addValidators(array(new PresenceOf(array('message' => 'É necessário preencher o CPF')), new Cpf()));
     $this->add($cpf);
     // RG
     /*
     $rg = new Text('rg', ['class' => 'form-control']);
     $rg->setLabel('RG');
     $rg->setFilters(array('striptags', 'string'));
     $this->add($rg);
     */
     // Telefone
     $telefone = new Text('telefone', ['class' => 'form-control']);
     $telefone->setLabel('Telefone');
     $telefone->setFilters(array('striptags', 'string'));
     $this->add($telefone);
     // Celular
     $celular = new Text('celular', ['class' => 'form-control']);
     $celular->setLabel('celular');
     $celular->setFilters(array('striptags', 'string'));
     $this->add($celular);
     // Submit
     $submit = new Submit('Enviar', ['class' => 'btn btn-default']);
     $submit->setLabel(' ');
     $this->add($submit);
 }
Exemple #20
0
 public function initialize($entity = null, $options = array())
 {
     //Username
     $username = new Text("username", array("class" => "form-control", "placeholder" => $this->i18n->user_login_username));
     $username->setFilters(array('striptags', 'string'));
     $username->addValidators(array(new PresenceOf(array('message' => $this->i18n->user_login_usernamerequired))));
     $this->add($username);
     //Password
     $password = new Password("password", array("class" => "form-control", "placeholder" => $this->i18n->user_password));
     $password->setFilters(array('striptags', 'string'));
     $password->addValidators(array(new PresenceOf(array('message' => $this->i18n->user_login_passwordrequired))));
     $this->add($password);
 }
 /**
  * Initialize the companies form
  */
 public function initialize($entity = null, $options = array())
 {
     if (!isset($options['edit'])) {
         $element = new Text("id");
         $this->add($element->setLabel("Id"));
     } else {
         $this->add(new Hidden("id"));
     }
     $catname = new Text("tag_name");
     $catname->setLabel("分类名称");
     $catname->setFilters(array('striptags', 'string'));
     $catname->addValidators(array(new PresenceOf(array('message' => 'tag_name is required'))));
     $this->add($catname);
 }
Exemple #22
0
 /**
  * Initialize the companies form
  */
 public function initialize($entity = null, $options = array())
 {
     if (!isset($options['edit'])) {
         $element = new Text("id");
         $this->add($element->setLabel("Id"));
     } else {
         $this->add(new Hidden("id"));
     }
     $keyword = new Text("keyword");
     $keyword->setLabel("搜索关键字");
     $keyword->setFilters(array('striptags', 'string'));
     $keyword->addValidators(array(new PresenceOf(array('message' => 'keyword is required'))));
     $this->add($keyword);
 }
 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);
     $version = new Text('version');
     $version->setLabel('Create Version');
     $version->setFilters(array('striptags', 'string'));
     $version->addValidators(array(new PresenceOf(array('message' => 'Name is required'))));
     $this->add($version);
 }
 /**
  * Initialize the products form
  *
  * @param mixed $entity
  * @param array $options
  */
 public function initialize($entity = null, array $options = null)
 {
     if (!isset($options['edit'])) {
         $element = new Text("id");
         $this->add($element->setLabel("Id"));
     } else {
         $this->add(new Hidden("id"));
     }
     $name = new Text("name");
     $name->setLabel("Name");
     $name->setFilters(['striptags', 'string']);
     $name->addValidators([new PresenceOf(['message' => 'Name is required'])]);
     $this->add($name);
 }
 /**
  * Initialize the products form
  */
 public function initialize($model = null, $options = array())
 {
     $nome = new Text("nome");
     $nome->setLabel("Nome");
     $nome->setFilters(array('striptags', 'string'));
     $nome->setAttribute('class', 'form-control');
     $this->add($nome);
     if (is_null($model)) {
         $categoria = new Select("parent", Categorias::returnArrayForSelect(), array('using' => array('_id', 'nome'), 'useEmpty' => true, 'emptyText' => 'Nenhuma', 'emptyValue' => ''));
         $categoria->setLabel("Selecione a categoria pai*");
         $categoria->setAttribute('class', 'form-control');
         $this->add($categoria);
     }
 }
Exemple #26
0
 public function initialize($entity = null, $user_options = array())
 {
     // Login details
     $username = new Element\Text('username');
     $username->setLabel('Email');
     $username->setFilters(array('striptags', 'trim'));
     $username->addValidators(array(new Validator\Email(array('message' => 'This is not a valid email')), new EveValidator\User\Unique(array('message' => 'Email already registered'))));
     $username->setAttributes(array('data-toggle' => 'popover', 'data-content' => 'Enter an email address', 'data-title' => 'Help'));
     $this->add($username);
     $username_again = new Element\Text('username_again');
     $username_again->setLabel('Re-enter email');
     $username_again->setFilters(array('striptags', 'trim'));
     $username_again->addValidators(array(new Validator\Confirmation(array('message' => 'Emails do not match', 'with' => 'username'))));
     $this->add($username_again);
     $password = new Element\Password('password');
     $password->setLabel('Password');
     $password->setFilters(array('striptags', 'trim'));
     $password->addValidators(array(new Validator\Regex(array('pattern' => '/[A-Za-z\\d\\W]+/i', 'message' => 'Password must be greater than 6 characters')), new Validator\StringLength(array('max' => 100, 'min' => 6, 'messageMaximum' => 'Password is too long', 'messageMinimum' => 'Password is too short'))));
     $password->setAttributes(array('data-toggle' => 'popover', 'data-content' => 'Password must be greater than 6 characters', 'data-title' => 'Help'));
     $this->add($password);
     $password_again = new Element\Password('password_again');
     $password_again->setLabel('Re-enter password');
     $password_again->setFilters(array('striptags', 'trim'));
     $password_again->addValidators(array(new Validator\Confirmation(array('message' => 'Passwords do not match', 'with' => 'password'))));
     $this->add($password_again);
     $name = new Element\Text('name');
     $name->setLabel('Name');
     $name->setFilters(array('striptags', 'trim'));
     $this->add($name);
     $teamspeak = new Element\Text('teamspeak');
     $teamspeak->setLabel('Teamspeak');
     $teamspeak->setFilters(array('striptags', 'trim'));
     $this->add($teamspeak);
     $character = new Element\Text('character');
     $character->setLabel('Character name');
     $character->setFilters(array('striptags', 'trim'));
     $character->addValidator(new Validator\PresenceOf(array('message' => 'This field is required')));
     $this->add($character);
     $game_id = new Element\Text('game_id');
     $game_id->setLabel('Character In-Game ID');
     $game_id->setFilters(array('striptags', 'trim'));
     $game_id->addValidator(new Validator\PresenceOf(array('message' => 'This field is required')));
     $this->add($game_id);
     $submit = new Element\Submit('submit');
     $submit->setLabel('Register');
     $submit->setUserOption('icon', 'user');
     $submit->setAttribute('value', 'Register');
     $submit->setAttribute('class', 'btn btn-primary');
     $this->add($submit);
 }
Exemple #27
0
 public function initialize($entity = null, $user_options = null)
 {
     //no need for it
     $this->setCsrf(false);
     //keyword
     $keyword = new Element\Text('keyword');
     $keyword->setLabel('keyword');
     $keyword->setFilters(array('striptags', 'trim'));
     $this->add($keyword);
     //search button
     $submit_search = new Element\Submit('submit_search');
     $submit_search->setLabel('search');
     $submit_search->setUserOption('icon', 'search');
     $submit_search->setAttributes(array('value' => $this->translator->_('search'), 'class' => 'btn btn-primary'));
     $this->add($submit_search);
 }
Exemple #28
0
 public function initialize($entity = null, $user_options = array())
 {
     $name = new Element\Text('name');
     $name->setLabel('Name');
     $name->setFilters(array('striptags', 'trim'));
     $this->add($name);
     $teamspeak = new Element\Text('teamspeak');
     $teamspeak->setLabel('Teamspeak');
     $teamspeak->setFilters(array('striptags', 'trim'));
     $this->add($teamspeak);
     $submit = new Element\Submit('submit');
     $submit->setLabel('Save');
     $submit->setUserOption('icon', 'user');
     $submit->setAttribute('value', 'Save');
     $submit->setAttribute('class', 'btn btn-primary');
     $this->add($submit);
 }
Exemple #29
0
 public function initialize($entity = null, $user_options = array())
 {
     $name = new Element\Text('name');
     $name->setLabel('Name');
     $name->setFilters(array('striptags', 'trim'));
     $name->addValidator(new Validator\PresenceOf(array('message' => 'This field is required')));
     $this->add($name);
     $active = new Element\Check('active');
     $active->setLabel('Activate Now?');
     $this->add($active);
     $submit = new Element\Submit('submit');
     $submit->setLabel('Save');
     $submit->setUserOption('icon', 'floppy-o');
     $submit->setAttribute('value', 'Save');
     $submit->setAttribute('class', 'btn btn-primary');
     $this->add($submit);
 }
 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);
 }