本文整理汇总了PHP中Phalcon\Forms\Element\Text::setFilters方法的典型用法代码示例。如果您正苦于以下问题:PHP Text::setFilters方法的具体用法?PHP Text::setFilters怎么用?PHP Text::setFilters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Phalcon\Forms\Element\Text
的用法示例。
在下文中一共展示了Text::setFilters方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initialize
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);
}
示例2: initialize
/**
* 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);
}
示例3: initialize
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);
}
示例4: initialize
/**
* 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 ================================*/
}
示例5: initialize
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);
}
示例6: initialize
/**
* 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);
}
示例7: initialize
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);
}
示例8: initialize
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);
}
示例9: initialize
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);
}
示例10: initialize
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);
}
}
示例11: initialize
public function initialize($entity = null, $options = null)
{
$title = new Text('title');
$title->setLabel('Название');
$title->setFilters(array('striptags', 'string'));
$this->add($title);
}
示例12: initialize
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);
}
示例13: initialize
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);
}
示例14: initialize
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);
}
示例15: initialize
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);
}
}