public function __construct($serviceLocator, $options = null) { parent::__construct('AccountIndex'); $this->setServiceLocator($serviceLocator); $this->setAttribute('method', 'post'); $filter = $this->getInputFilter(); $group = new DisplayGroup('Subject'); $group->setLabel('Thêm danh mục môn học'); $this->add($group); // name $name = new Text('name'); $name->setLabel('Tên danh mục:'); $name->setAttributes(['maxlength' => 255]); $this->add($name); $group->addElement($name); $filter->add(array('name' => 'name', 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập tên danh mục')))))); // code $description = new Textarea('description'); $description->setLabel('Mô tả danh mục:'); $description->setAttributes(['maxlength' => 255, 'class' => 'form-control basicEditor ', 'style' => 'min-height: 300px;']); $this->add($description); $group->addElement($description); $filter->add(array('name' => 'description', 'required' => false, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập mô tả danh mục')))))); $this->add(array('name' => 'afterSubmit', 'type' => 'radio', 'attributes' => array('value' => '/admin/subject/addcategory'), 'options' => array('layout' => 'fluid', 'clearBefore' => true, 'label' => 'Sau khi lưu dữ liệu:', 'value_options' => array('/admin/subject/addcategory' => 'Tiếp tục nhập', '/admin/subject/category' => 'Hiện danh sách vừa nhập')))); $this->add(array('name' => 'submit', 'options' => array('clearBefore' => true), 'attributes' => array('type' => 'submit', 'value' => 'Lưu', 'id' => 'btnSave', 'class' => 'btn btn-primary'))); }
/** * @param null|string $productName */ public function __construct($serviceLocator, $options = null) { parent::__construct('crmContract'); $this->setServiceLocator($serviceLocator); $this->setAttribute('method', 'post'); $filter = $this->getInputFilter(); $mainBasic = new DisplayGroup('mainBasic'); $mainBasic->setLabel('Sản phẩm mẫu'); $this->add($mainBasic); $todeleteBasic = new DisplayGroup('todeleteBasic'); $todeleteBasic->setLabel('Sản phẩm sẽ xóa'); $this->add($todeleteBasic); $mainCompanyId = $this->addElementCompany('mainCompanyId', $mainBasic, ['required' => true]); $mainProductId = new Select('mainProductId'); $mainProductId->setLabel('Sản phẩm mẫu:'); $this->add($mainProductId); $mainBasic->addElement($mainProductId); $this->loadProducts($mainProductId, $mainCompanyId, $options); $filter->add(array('name' => 'mainProductId', 'required' => true, 'filters' => array(array('name' => 'StringTrim'), array('name' => 'Digits')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập sản phẩm'))), array('name' => 'Digits', 'break_chain_on_failure' => true, 'options' => array('messages' => array(\Zend\Validator\Digits::INVALID => 'Dữ liệu sản phẩm không hợp lệ')))))); $toDeleteCompanyId = $this->addElementCompany('toDeleteCompanyId', $todeleteBasic, ['required' => true]); $toDeleteProductId = new Select('toDeleteProductId'); $toDeleteProductId->setLabel('Sản phẩm sẽ xóa:'); $this->add($toDeleteProductId); $todeleteBasic->addElement($toDeleteProductId); $this->loadProducts($toDeleteProductId, $toDeleteCompanyId, $options); $filter->add(array('name' => 'toDeleteProductId', 'required' => true, 'filters' => array(array('name' => 'StringTrim'), array('name' => 'Digits')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập sản phẩm'))), array('name' => 'Digits', 'break_chain_on_failure' => true, 'options' => array('messages' => array(\Zend\Validator\Digits::INVALID => 'Dữ liệu sản phẩm không hợp lệ')))))); $this->add(array('name' => 'submit', 'options' => array('clearBefore' => true), 'attributes' => array('type' => 'submit', 'value' => 'Hợp nhất', 'id' => 'btnSaveCrmContract', 'class' => 'btn btn-primary btnSaveCrmContract'))); }
public function __construct($serviceLocator, $options = null) { parent::__construct('ExpenseCategoryIndex'); $this->setServiceLocator($serviceLocator); $this->setAttribute('method', 'post'); $filter = $this->getInputFilter(); $group = new DisplayGroup('Expensegroup'); $group->setLabel('Thêm tài khoản'); $this->add($group); /* * $parentId = new Select('parentId'); $parentId->setLabel('Công ty mẹ:'); $parentId->setAttributes([ 'maxlength' => 19 ]); $this->add($parentId); $groupCompany->addElement($parentId); $this->loadCompanies($parentId); $filter->add(array( 'name' => 'parentId', 'required' => false )); */ // companyId $companyId = $this->addElementCompany('companyId', $group, ['required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa chọn công ty'))))]); // name $name = new Text('name'); $name->setLabel('Tên khoản mục:'); $name->setAttributes(['maxlength' => 255]); $this->add($name); $group->addElement($name); $filter->add(array('name' => 'name', 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập tên khoản mục')))))); // parent Text $parentName = new Text('parentName'); $parentName->setLabel('Thuộc khoản mục:'); $this->add($parentName); $group->addElement($parentName); $filter->add(array('name' => 'parentName', 'required' => false)); // parent hidden $parentId = new Hidden('parentId'); $this->add($parentId); $group->addElement($parentId); $filter->add(array('name' => 'parentId', 'required' => false)); // code $code = new Text('code'); $code->setLabel('Mã code:'); $code->setAttributes(['maxlength' => 255]); $this->add($code); $group->addElement($code); $filter->add(array('name' => 'code', 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập mã code')))))); // id hidden $id = new Hidden('id'); $this->add($id); $group->addElement($id); $filter->add(array('name' => 'id', 'required' => false)); $this->add(array('name' => 'afterSubmit', 'type' => 'radio', 'attributes' => array('value' => '/accounting/expense/addcategory'), 'options' => array('layout' => 'fluid', 'clearBefore' => true, 'label' => 'Sau khi lưu dữ liệu:', 'value_options' => array('/accounting/expense/addcategory' => 'Tiếp tục nhập', '/accounting/expense/category' => 'Hiện danh sách vừa nhập')))); $this->add(array('name' => 'submit', 'options' => array('clearBefore' => true), 'attributes' => array('type' => 'submit', 'value' => 'Lưu', 'id' => 'btnSave', 'class' => 'btn btn-primary'))); }
public function __construct($serviceLocator, $options = null) { parent::__construct('AccountIndex'); $this->setServiceLocator($serviceLocator); $this->setAttribute('method', 'post'); $filter = $this->getInputFilter(); $group = new DisplayGroup('Subject'); $group->setLabel('Thêm mentor'); $this->add($group); // name $userName = new Text('userName'); $userName->setLabel('Người dùng: '); $userName->setAttributes(['maxlength' => 255]); if ($options == 'edit') { $userName->setAttribute('disabled', 'disabled'); } $this->add($userName); $group->addElement($userName); $filter->add(array('name' => 'userName', 'required' => $options == 'edit' ? false : true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập người dùng')))))); $userId = new Hidden('userId'); $this->add($userId); $group->addElement($userId); $filter->add(array('name' => 'userId', 'required' => $options == 'edit' ? false : true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập người dùng')))))); // code $description = new Textarea('description'); $description->setLabel('Mô tả mentor:'); $description->setAttributes(['class' => 'form-control basicEditor ', 'style' => 'min-height: 300px;']); $this->add($description); $group->addElement($description); $filter->add(array('name' => 'description', 'required' => false, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập mô tả môn học')))))); $subject = new Text('subject'); $subject->setLabel('Tên môn:'); $subject->setAttributes(['maxlength' => 255, 'style' => 'width:100% !important', 'placeholder' => 'Tên môn học']); $subject->setOptions(array('tagsinput' => true, 'description' => 'Tên môn học')); $this->add($subject); $group->addElement($subject); $filter->add(array('name' => 'subject', 'required' => false, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập tên môn')))))); $subjectId = new Hidden('subjectId'); $subjectId->setLabel('Tên môn:'); $this->add($subjectId); $group->addElement($subjectId); $filter->add(array('name' => 'subjectId', 'required' => false, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập tên môn')))))); $this->add(array('name' => 'afterSubmit', 'type' => 'radio', 'attributes' => array('value' => '/admin/expert/add'), 'options' => array('layout' => 'fluid', 'clearBefore' => true, 'label' => 'Sau khi lưu dữ liệu:', 'value_options' => array('/admin/expert/add' => 'Tiếp tục nhập', '/admin/expert/index' => 'Hiện danh sách vừa nhập')))); $this->add(array('name' => 'submit', 'options' => array('clearBefore' => true), 'attributes' => array('type' => 'submit', 'value' => 'Lưu', 'id' => 'btnSave', 'class' => 'btn btn-primary'))); }
public function __construct($serviceLocator, $options = null) { parent::__construct('AccountIndex'); $this->setServiceLocator($serviceLocator); $this->setAttribute('method', 'post'); $filter = $this->getInputFilter(); $group = new DisplayGroup('Search'); $group->setLabel('Tìm kiếm trợ giúp'); $this->add($group); // search $search = new Text('search'); $search->setLabel('Tôi cần giúp về: '); $search->setAttributes(['maxlength' => 255]); $this->add($search); $group->addElement($search); $filter->add(array('name' => 'search', 'required' => false, 'filters' => array(array('name' => 'StringTrim')))); $this->add(array('name' => 'submit', 'options' => array('clearBefore' => true), 'attributes' => array('type' => 'submit', 'value' => 'Lưu', 'id' => 'btnSave', 'class' => 'btn btn-primary'))); }
public function __construct($serviceLocator, $options = null) { parent::__construct('AccountIndex'); $this->setServiceLocator($serviceLocator); $this->setAttribute('method', 'post'); $filter = $this->getInputFilter(); $group = new DisplayGroup('Search'); $group->setLabel('Tìm kiếm trợ giúp ??'); $this->add($group); // search $search = new Text('search'); $search->setLabel('Tôi cần giúp về: '); $search->setAttributes(['maxlength' => 255, 'class' => 'input-title', 'placeholder' => 'e.g. Need help debugging SASS/CSS for frontend in Rails app']); $this->add($search); $group->addElement($search); $filter->add(array('name' => 'search', 'required' => false, 'filters' => array(array('name' => 'StringTrim')))); $searchDetail = new Textarea('searchDetail'); $searchDetail->setAttributes(['placeholder' => 'Thêm chi tiết giúp bạn nhận hỗ trợ nhanh hơn', 'class' => 'input-description']); $this->add($searchDetail); $group->addElement($searchDetail); $filter->add(array('name' => 'searchDetail', 'required' => false, 'filters' => array(array('name' => 'StringTrim')))); $subject = new Text('subject'); $subject->setAttributes(['placeholder' => 'Thêm môn học']); $this->add($subject); $filter->add(array('name' => 'subject', 'required' => false, 'filters' => array(array('name' => 'StringTrim')))); $subjectId = new Hidden('subjectId'); $this->add($subjectId); $filter->add(array('name' => 'subjectId', 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn cần điền ít nhất là 1 môn học')))))); $budget = new Radio('budget'); $budget->setValueOptions(['5' => '20', '10' => '40']); $this->add($budget); $filter->add(array('name' => 'budget', 'required' => false, 'filters' => array(array('name' => 'StringTrim')))); $email = new Text('email'); $email->setLabel('Email'); $this->add($email); $filter->add(array('name' => 'email', 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập email'))), array('name' => 'EmailAddress', 'break_chain_on_failure' => true, 'options' => array('messages' => array('emailAddressInvalidFormat' => 'Địa chỉ email không hợp lệ')))))); $password = new Password('password'); $password->setAttributes(array('type' => 'password', 'id' => 'password')); $password->setLabel('Mật khẩu:'); $this->add($password); //$groupBasic->addElement($password); $filter->add(array('name' => 'password', 'required' => false, 'validators' => array(array('name' => 'NotEmpty', 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập mật khẩu')))))); $this->add(array('name' => 'submit', 'options' => array('clearBefore' => true), 'attributes' => array('type' => 'submit', 'value' => 'Lưu', 'id' => 'btnSave', 'class' => 'btn btn-primary'))); }
/** * @param null|string $name */ public function __construct($serviceLocator, $options = null) { parent::__construct($serviceLocator); $this->setServiceLocator($serviceLocator); $this->setAttribute('method', 'post'); $this->setAttribute('class', 'f'); $this->setAttribute('autocomplete', 'off'); $this->setOptions(['layout' => 'form-2-cols']); $filter = $this->getInputFilter(); $group = new DisplayGroup('Signup'); $group->setLabel('Đăng kí'); $this->add($group); $fullName = new Text('fullName'); $fullName->setLabel('Tên đầy đủ của bạn'); $fullName->setAttributes(['maxlength' => 255, 'class' => 'input-xlarge inputFieldWithTitle']); $group->addElement($fullName); $this->add($fullName); $filter->add(array('name' => 'fullName', 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập tên của bạn')))))); $username = new Text('username'); $username->setLabel('Tên đăng nhập:'); $username->setAttributes(['maxlength' => 255, 'class' => 'input-xlarge inputFieldWithTitle']); $this->add($username); $group->addElement($username); $filter->add(array('name' => 'username', 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập tên đăng nhập'))), array('name' => 'StringLength', 'break_chain_on_failure' => true, 'options' => array('min' => 4, 'messages' => array('stringLengthTooShort' => 'Tên đăng nhập phải có từ 4 đến 32 kí tự'))), array('name' => 'Regex', 'break_chain_on_failure' => true, 'options' => array('pattern' => "/^[a-z0-9_-]{4,32}\$/", 'messages' => array('regexNotMatch' => 'Chỉ chấp nhận các kí tự là chữ, chữ số, dấu - và dấu _'))), array('name' => 'Db\\NoRecordExists', 'options' => array('table' => 'users', 'field' => 'username', 'adapter' => \Zend\Db\TableGateway\Feature\GlobalAdapterFeature::getStaticAdapter(), 'messages' => array('recordFound' => "Tên đăng nhập này đã được sử dụng")))))); // code $password = new Password('password'); $password->setLabel('Mật khẩu'); $password->setAttributes(['class' => 'input-xlarge inputFieldWithTitle']); $this->add($password); $group->addElement($password); $filter->add(array('name' => 'password', 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập Mật khẩu'))), array('name' => 'StringLength', 'break_chain_on_failure' => true, 'options' => array('min' => 6, 'messages' => array('stringLengthTooShort' => 'Mật khẩu phải có từ 6 kí tự trở lên')))))); $password2 = new Password('password2'); $password2->setLabel('Xác nhận mật khẩu:'); $password2->setAttributes(['class' => 'input-xlarge inputFieldWithTitle']); $this->add($password2); $group->addElement($password2); $filter->add(array('name' => 'password2', 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập Mật khẩu'))), array('name' => 'StringLength', 'break_chain_on_failure' => true, 'options' => array('min' => 6, 'messages' => array('stringLengthTooShort' => 'Mật khẩu phải có từ 6 kí tự trở lên'))), array('name' => 'Identical', 'break_chain_on_failure' => true, 'options' => array('token' => 'password', 'messages' => array('notSame' => 'Xác nhận mật khẩu không chính xác')))))); $this->add(array('name' => 'submit', 'options' => array('clearBefore' => true), 'attributes' => array('type' => 'submit', 'value' => 'Đăng kí', 'id' => 'btnSave', 'class' => 'btn btn-primary'))); }
/** * @param null|string $name */ public function __construct($serviceLocator, $options = null) { parent::__construct($serviceLocator); $this->setServiceLocator($serviceLocator); $this->setAttribute('method', 'post'); $this->setAttribute('class', 'f'); $this->setAttribute('autocomplete', 'off'); $this->setOptions(['layout' => 'form-2-cols']); $filter = $this->getInputFilter(); $group = new DisplayGroup('Signup'); $group->setLabel('Đăng kí'); $this->add($group); // name $email = new Text('email'); $email->setLabel('Email:'); $email->setAttributes(['maxlength' => 255]); $this->add($email); $group->addElement($email); $filter->add(array('name' => 'email', 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập địa chỉ email'))), array('name' => 'EmailAddress', 'break_chain_on_failure' => true, 'options' => array('messages' => array('emailAddressInvalidFormat' => 'Địa chỉ email không hợp lệ', 'emailAddressInvalidHostname' => 'Không tồn tại máy chủ mail', 'hostnameInvalidHostname' => 'Không tồn tại hostname như trên', 'hostnameInvalidLocalName' => 'Không tồn tại hostname như trên', 'hostnameLocalNameNotAllowed' => 'Không tồn tại hostname như vậy', 'emailAddressDotAtom' => 'Không tồn tại định dạng E-mail như trên', 'emailAddressQuotedString' => "Định dạng không hợp lệ", 'emailAddressInvalidLocalPart' => 'Định dạng không hợp lệ', 'hostnameUnknownTld' => 'Domain name không hợp lệ'))), array('name' => 'Db\\NoRecordExists', 'options' => array('table' => 'users', 'field' => 'email', 'adapter' => \Zend\Db\TableGateway\Feature\GlobalAdapterFeature::getStaticAdapter(), 'messages' => array('recordFound' => "Email này đã được sử dụng")))))); $username = new Text('username'); $username->setLabel('Tên đăng nhập:'); $username->setAttributes(['maxlength' => 255]); $this->add($username); $group->addElement($username); $filter->add(array('name' => 'username', 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập tên đăng nhập'))), array('name' => 'StringLength', 'break_chain_on_failure' => true, 'options' => array('min' => 4, 'messages' => array('stringLengthTooShort' => 'Tên đăng nhập phải có từ 4 đến 32 kí tự'))), array('name' => 'Regex', 'break_chain_on_failure' => true, 'options' => array('pattern' => "/^[a-z0-9_-]{4,32}\$/", 'messages' => array('regexNotMatch' => 'Chỉ chấp nhận các kí tự là chữ thường, chữ số, dấu - và dấu _'))), array('name' => 'Db\\NoRecordExists', 'options' => array('table' => 'users', 'field' => 'username', 'adapter' => \Zend\Db\TableGateway\Feature\GlobalAdapterFeature::getStaticAdapter(), 'messages' => array('recordFound' => "Tên đăng nhập này đã được sử dụng")))))); // code $password = new Password('password'); $password->setLabel('Mật khẩu'); $this->add($password); $group->addElement($password); $filter->add(array('name' => 'password', 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập Mật khẩu'))), array('name' => 'StringLength', 'break_chain_on_failure' => true, 'options' => array('min' => 6, 'messages' => array('stringLengthTooShort' => 'Mật khẩu phải có từ 6 kí tự trở lên'))), array('name' => 'Regex', 'break_chain_on_failure' => true, 'options' => array('pattern' => "/^[a-zA-Z0-9]{4,32}\$/", 'messages' => array('regexNotMatch' => 'Mật khẩu chỉ bao gồm chữ hoa, thường và số')))))); $password2 = new Password('password2'); $password2->setLabel('Xác nhận mật khẩu:'); $this->add($password2); $group->addElement($password2); $filter->add(array('name' => 'password2', 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa xác nhận Mật khẩu'))), array('name' => 'StringLength', 'break_chain_on_failure' => true, 'options' => array('min' => 6, 'messages' => array('stringLengthTooShort' => 'Mật khẩu phải có từ 6 kí tự trở lên'))), array('name' => 'Identical', 'break_chain_on_failure' => true, 'options' => array('token' => 'password', 'messages' => array('notSame' => 'Xác nhận mật khẩu không chính xác')))))); $this->add(array('name' => 'submit', 'options' => array('clearBefore' => true), 'attributes' => array('type' => 'submit', 'value' => 'Đăng kí', 'id' => 'btnSave', 'class' => 'btn btn-primary'))); }
public function __construct($serviceLocator, $options = null) { parent::__construct('AccountIndex'); $this->setServiceLocator($serviceLocator); $this->setAttribute('method', 'post'); $filter = $this->getInputFilter(); $group = new DisplayGroup('Subject'); $group->setLabel('Thêm mentor'); $this->add($group); $subject = new Text('subject'); $subject->setLabel('Tên môn:'); $subject->setAttributes(['maxlength' => 255, 'style' => 'width:100% !important', 'placeholder' => 'Tên môn học']); $subject->setOptions(array('tagsinput' => true, 'description' => 'Tên môn học')); $this->add($subject); $group->addElement($subject); $filter->add(array('name' => 'subject', 'required' => false, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập tên môn')))))); $subjectId = new Hidden('subjectId'); $subjectId->setLabel('Tên môn:'); $this->add($subjectId); $group->addElement($subjectId); $filter->add(array('name' => 'subjectId', 'required' => false, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập tên môn')))))); $this->add(array('name' => 'submit', 'options' => array('clearBefore' => true), 'attributes' => array('type' => 'submit', 'value' => 'Lưu', 'id' => 'btnSave', 'class' => 'btn btn-primary'))); }
public function __construct($serviceLocator, $options = null) { parent::__construct('AccountIndex'); $this->setServiceLocator($serviceLocator); $this->setAttribute('method', 'post'); $filter = $this->getInputFilter(); $group = new DisplayGroup('Subject'); $group->setLabel('Trở thành mentor '); $this->add($group); // name $name = new Text('name'); $name->setLabel('Tên danh mục:'); $name->setAttributes(['maxlength' => 255, 'placeholder' => 'Tên']); $this->add($name); $group->addElement($name); $filter->add(array('name' => 'name', 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập tên')))))); $email = new Text('email'); $email->setLabel('Tên danh mục:'); $email->setAttributes(['maxlength' => 255, 'placeholder' => 'Email']); $this->add($email); $group->addElement($email); $filter->add(array('name' => 'email', 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập tên')))))); $this->add(array('name' => 'submit', 'options' => array('clearBefore' => true), 'attributes' => array('type' => 'submit', 'value' => 'Lưu', 'id' => 'btnSave', 'class' => 'btn btn-primary'))); }
public function __construct($serviceLocator, $options = null) { parent::__construct('AccountIndex'); $this->setServiceLocator($serviceLocator); $this->setAttribute('method', 'post'); $filter = $this->getInputFilter(); $group = new DisplayGroup('Subject'); $group->setLabel('Trở thành mentor '); $this->add($group); // name $fullname = new Text('fullname'); $fullname->setLabel('Họ và tên:'); $fullname->setAttributes(['maxlength' => 255, 'placeholder' => 'Tên']); $this->add($fullname); $group->addElement($fullname); $filter->add(array('name' => 'fullname', 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập tên')))))); $email = new Text('email'); $email->setLabel('Email của Anh/Chị :'); $email->setAttributes(['maxlength' => 255, 'placeholder' => 'Email']); $this->add($email); $group->addElement($email); $filter->add(array('name' => 'email', 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập email'))), array('name' => 'EmailAddress', 'break_chain_on_failure' => true, 'options' => array('messages' => array('emailAddressInvalidFormat' => 'Địa chỉ email không hợp lệ')))))); $skype = new Text('skype'); $skype->setLabel('Skype:'); $skype->setAttributes(['maxlength' => 255, 'placeholder' => 'Skype']); $this->add($skype); $group->addElement($skype); $filter->add(array('name' => 'skype', 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập skype')))))); $mobile = new Text('mobile'); $mobile->setLabel('Số điện thoại:'); $mobile->setAttributes(['maxlength' => 12, 'placeholder' => 'Số điện thoại']); $this->add($mobile); $group->addElement($mobile); $filter->add(array('name' => 'mobile', 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập số điện thoại')))))); $social = new Text('social'); $social->setLabel('Link tới tài khoản mạng xã hội của bạn:'); $social->setAttributes(['maxlength' => 255, 'placeholder' => 'Mạng xã hội']); $this->add($social); $group->addElement($social); $filter->add(array('name' => 'social', 'required' => false, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập skype')))))); $isTeaching = new Radio('isTeaching'); $isTeaching->setLabel('Bạn đã từng giảng dạy chưa?'); $isTeaching->setValueOptions(['1' => 'Đã từng', '2' => 'Chưa bao giờ']); $this->add($isTeaching); $group->addElement($isTeaching); $filter->add(array('name' => 'isTeaching', 'required' => false, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa chọn')))))); $description = new Textarea('description'); $description->setLabel('Mô tả công việc giảng dạy của bạn:'); $description->setAttributes(['class' => ' inputBox', 'style' => 'min-height: 300px;', 'placeholder' => 'Mô tả']); $this->add($description); $group->addElement($description); $filter->add(array('name' => 'description', 'required' => false, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập mô tả công việc giảng day của bạn')))))); $cityId = new Select('cityId'); $cityId->setLabel('Thành phố:'); $this->loadCities($cityId); $filter->add(array('name' => 'cityId', 'required' => false, 'filters' => array())); $this->add($cityId); $districtId = new Select('districtId'); $districtId->setLabel('Quận/huyện: '); $this->loadDistricts($districtId, $cityId, $options); $this->add($districtId); $filter->add(array('name' => 'districtId', 'required' => false, 'filters' => array())); $address = new Text('address'); $address->setLabel('Địa chỉ: '); $filter->add(array('name' => 'address', 'required' => false, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập địa chỉ của bạn')))))); $this->add($address); // $birthday = new Text('birthday'); // $birthday->setLabel('Tên danh mục:'); // $birthday->setAttributes([ // 'maxlength' => 255, // 'placeholder' => 'Ngày sinh', // 'class' => 'datepicker inputBox' // ]); // $this->add($birthday); // $group->addElement($birthday); // $filter->add(array( // 'name' => 'birthday', // 'required' => false, // 'filters' => array( // array( // 'name' => 'StringTrim' // ) // ), // 'validators' => array( // array( // 'name' => 'NotEmpty', // 'break_chain_on_failure' => true, // 'options' => array( // 'messages' => array( // 'isEmpty' => 'Bạn chưa nhập ngày sinh' // ) // ) // ), // ) // )); $this->add(array('name' => 'submit', 'options' => array('clearBefore' => true), 'attributes' => array('type' => 'submit', 'value' => 'Lưu', 'id' => 'btnSave', 'class' => 'btn btn-primary'))); }
/** * @param null|string $name */ public function __construct($serviceLocator, $options = null) { parent::__construct('fUserAdd'); $this->setServiceLocator($serviceLocator); $this->setAttribute('method', 'post'); $filter = $this->getInputFilter(); $groupBasic = new DisplayGroup('groupBasic'); $groupBasic->setLabel('Thông tin cơ bản'); $this->add($groupBasic); $username = new Text('username'); $username->setLabel('Tên đăng nhập:'); $username->setAttributes(['maxlength' => 50, 'autocomplete' => 'off']); $this->add($username); $groupBasic->addElement($username); $filter->add(array('name' => 'username', 'required' => true, 'filters' => array(array('name' => 'StringTrim'), array('name' => 'StringToLower')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập tên đăng nhập'))), array('name' => 'StringLength', 'break_chain_on_failure' => true, 'options' => array('max' => 50, 'min' => 4, 'messages' => array(StringLength::TOO_LONG => 'Tên đăng nhập giới hạn 4-50 kí tự', StringLength::TOO_SHORT => 'Tên đăng nhập giới hạn 4-50 kí tự'))), array('name' => 'Regex', 'break_chain_on_failure' => true, 'options' => array('pattern' => "/^[a-z0-9_-]{4,32}\$/", 'messages' => array('regexNotMatch' => 'Chỉ chấp nhận các kí tự là chữ, chữ số, dấu - và dấu _'))), array('name' => 'Db\\NoRecordExists', 'options' => array('table' => 'users', 'field' => 'username', 'adapter' => \Zend\Db\TableGateway\Feature\GlobalAdapterFeature::getStaticAdapter(), 'messages' => array('recordFound' => "Tên đăng nhập này đã được sử dụng")))))); $fulName = new Text('fullName'); $fulName->setLabel('Họ tên:'); $fulName->setAttributes(['maxlength' => 255, 'autocomplete' => 'off']); $this->add($fulName); $groupBasic->addElement($fulName); $filter->add(array('name' => 'fullName', 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập họ tên'))), array('name' => 'StringLength', 'break_chain_on_failure' => true, 'options' => array('max' => 255, 'min' => 4, 'messages' => array(StringLength::TOO_LONG => 'Tên đăng nhập giới hạn 4-250 kí tự', StringLength::TOO_SHORT => 'Tên đăng nhập giới hạn 4-250 kí tự')))))); $email = new Text('email'); $email->setLabel('Email:'); $email->setAttributes(['maxlength' => 255, 'autocomplete' => 'off']); $this->add($email); $groupBasic->addElement($email); $filter->add(array('name' => 'email', 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập email'))), array('name' => 'StringLength', 'break_chain_on_failure' => true, 'options' => array('max' => 50, 'min' => 4, 'messages' => array(StringLength::TOO_LONG => 'Tên đăng nhập giới hạn 4-50 kí tự', StringLength::TOO_SHORT => 'Tên đăng nhập giới hạn 4-50 kí tự'))), array('name' => 'EmailAddress', 'break_chain_on_failure' => true, 'options' => array('messages' => array('emailAddressInvalidFormat' => 'Địa chỉ email không hợp lệ'))), array('name' => 'Db\\NoRecordExists', 'options' => array('table' => 'users', 'field' => 'email', 'adapter' => \Zend\Db\TableGateway\Feature\GlobalAdapterFeature::getStaticAdapter(), 'messages' => array('recordFound' => "Email này đã được sử dụng")))))); $user = new \User\Model\User(); $role = new Select('role'); $role->setLabel('Phân quyền:'); $role->setValueOptions(['' => '- Phân quyền -'] + $user->getRoleDisplays()); $this->add($role); $groupBasic->addElement($role); $filter->add(array('name' => 'role', 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa chọn Phân quyền')))))); $password = new Password('password'); $password->setLabel('Mật khẩu:'); $password->setAttributes(['maxlength' => 32, 'autocomplete' => 'off']); $this->add($password); $groupBasic->addElement($password); $filter->add(array('name' => 'password', 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập Mật khẩu'))), array('name' => 'StringLength', 'break_chain_on_failure' => true, 'options' => array('max' => 32, 'min' => 6, 'messages' => array(StringLength::TOO_LONG => 'Mật khẩu giới hạn 6-32 kí tự', StringLength::TOO_SHORT => 'Mật khẩu giới hạn 6-32 kí tự')))))); $rePassword = new Password('rePassword'); $rePassword->setLabel('Nhập lại Mật khẩu:'); $rePassword->setAttributes(['maxlength' => 32, 'autocomplete' => 'off']); $this->add($rePassword); $groupBasic->addElement($rePassword); $filter->add(array('name' => 'rePassword', 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập lại Mật khẩu'))), array('name' => 'StringLength', 'break_chain_on_failure' => true, 'options' => array('max' => 32, 'min' => 6, 'messages' => array(StringLength::TOO_LONG => 'Mật khẩu giới hạn 6-32 kí tự', StringLength::TOO_SHORT => 'Mật khẩu giới hạn 6-32 kí tự'))), array('name' => 'Identical', 'break_chain_on_failure' => true, 'options' => array('token' => 'password', 'messages' => array('notSame' => 'Xác nhận mật khẩu không chính xác')))))); $mobile = new Text('mobile'); $mobile->setLabel('Mobile:'); $mobile->setAttributes(['maxlength' => 15]); $mobile->setOptions(['leftIcon' => 'fa fa-mobile']); $this->add($mobile); $groupBasic->addElement($mobile); $filter->add(array('name' => 'mobile', 'required' => false, 'filters' => array(array('name' => 'StringTrim'), array('name' => 'Digits')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập Mobile'))), array('name' => 'StringLength', 'break_chain_on_failure' => true, 'options' => array('min' => 10, 'max' => 11, 'messages' => array(StringLength::INVALID => 'Mobile phải là dạng 10 hoặc 11 chữ số', StringLength::TOO_SHORT => 'Mobile phải là dạng 10 hoặc 11 chữ số', StringLength::TOO_LONG => 'Mobile phải là dạng 10 hoặc 11 chữ số')))))); // group additional $groupAdditional = new DisplayGroup('groupAdditional'); $groupAdditional->setLabel('Thông tin cá nhân'); $this->add($groupAdditional); $gender = new Select('gender'); $this->add($gender); $groupAdditional->addElement($gender); $gender->setLabel('Giới tính:'); $gender->setValueOptions(array('' => '- Giới tính -', \Home\Model\Consts::GENDER_MALE => 'Nam', \Home\Model\Consts::GENDER_FEMALE => 'Nữ')); $filter->add(array('name' => 'gender', 'required' => false, 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập Giới tính')))))); $birthdate = new Text('birthdate'); $birthdate->setLabel('Ngày sinh:'); $birthdate->setAttributes(['class' => 'datetimepicker', 'data-date-format' => "DD/MM/YYYY"]); $birthdate->setOptions(['leftIcon' => 'fa fa-calendar']); $this->add($birthdate); $groupAdditional->addElement($birthdate); $filter->add(array('name' => 'birthdate', 'required' => false, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'Date', 'break_chain_on_failure' => true, 'options' => array('format' => DateBase::getDisplayDateFormat(), 'messages' => array('dateInvalid' => 'Ngày sinh không hợp lệ', 'dateInvalidDate' => 'Ngày sinh không hợp lệ', 'dateFalseFormat' => 'Ngày sinh không hợp lệ')))))); $cityId = new Select('cityId'); $cityId->setLabel('Thành phố:'); $cityId->setValueOptions(array('' => '- Thành phố -')); $this->add($cityId); $groupAdditional->addElement($cityId); $filter->add(array('name' => 'cityId', 'required' => false, 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập thành phố'))), array('name' => 'StringLength', 'break_chain_on_failure' => true, 'options' => array('max' => 250, 'messages' => array(StringLength::INVALID => 'Địa chỉ chỉ giới hạn nhỏ hơn 250 kí tự')))))); $districtId = new Select('districtId'); $districtId->setLabel('Quận huyện:'); $districtId->setValueOptions(array('' => '- Quận huyện -')); $this->add($districtId); $groupAdditional->addElement($districtId); $filter->add(array('name' => 'districtId', 'required' => false, 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập thành phố')))))); $address = new Text('address'); $address->setLabel('Địa chỉ:'); $address->setAttributes(['maxlength' => 255]); $this->add($address); $groupAdditional->addElement($address); $filter->add(array('name' => 'address', 'required' => false, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập địa chỉ')))))); $this->add(array('name' => 'afterSubmit', 'type' => 'radio', 'attributes' => array('value' => '/system/user/add'), 'options' => array('layout' => 'fluid', 'clearBefore' => true, 'label' => 'Sau khi lưu dữ liệu:', 'value_options' => array('/system/user/add' => 'Tiếp tục nhập người dùng', '/system/user/index' => 'Hiện danh sách người dùng')))); $this->add(array('name' => 'submit', 'options' => array('clearBefore' => true), 'attributes' => array('type' => 'submit', 'value' => 'Lưu', 'id' => 'btnSaveCrmContact', 'class' => 'btn btn-primary'))); }
/** * @param null|string $name */ public function __construct($name = null) { parent::__construct($name); $this->setAttribute('method', 'post'); $this->setAttribute('class', 'profile'); $this->setOptions(array('decorator' => array('type' => 'ul'))); // $this->add(array( // 'name' => 'oldpassword', // 'attributes' => array( // 'type' => 'password', // 'class' => 'validate[required],minSize[6]', // 'id' => 'oldpassword' // ), // 'options' => array( // 'label' => 'Mật khẩu cũ:', // 'decorator' => array('type' => 'li') // ), // )); // $this->add(array( // 'name' => 'newpassword', // 'attributes' => array( // 'type' => 'password', // 'class' => 'validate[required],minSize[6]', // 'id' => 'newpassword' // ), // 'options' => array( // 'label' => 'Mật khẩu mới:', // 'decorator' => array('type' => 'li') // ), // )); // $this->add(array( // 'name' => 'repassword', // 'attributes' => array( // 'type' => 'password', // 'class' => 'validate[required],minSize[6],equals[newpassword]', // 'id' => 'repassword' // ), // 'options' => array( // 'label' => 'Nhập lại mật khẩu mới:', // 'decorator' => array('type' => 'li') // ), // )); // $this->getEventManager()->trigger('init', $this); // $this->add(array( // 'name' => 'submit', // 'attributes' => array( // 'type' => 'submit', // 'value' => 'Xác nhận', // 'id' => 'btnSubmit', // 'class' => 'htmlBtn first' // ), // 'options' => array( // 'decorator' => array( // 'type' => 'li', // 'attributes' => array( // 'class' => 'btns' // ) // ) // ), // )); $filter = $this->getInputFilter(); $changePass = new DisplayGroup('changePass'); $changePass->setLabel('Đổi mật khẩu'); $this->add($changePass); $oldPass = new Password('oldpassword'); $oldPass->setLabel('Mật khẩu cũ:'); $oldPass->setAttributes(['maxlength' => 255, 'class' => 'validate[required],minSize[6]']); $this->add($oldPass); $changePass->addElement($oldPass); $filter->add(array('name' => 'oldpassword', 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập Mật khẩu cũ'))), array('name' => 'StringLength', 'break_chain_on_failure' => true, 'options' => array('min' => 6, 'messages' => array('stringLengthTooShort' => 'Mật khẩu phải có từ 6 kí tự trở lên')))))); $newPass = new Password('newpassword'); $newPass->setLabel('Mật khẩu mới:'); $newPass->setAttributes(['maxlength' => 255, 'class' => 'validate[required],minSize[6]']); $this->add($newPass); $changePass->addElement($newPass); $filter->add(array('name' => 'newpassword', 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập Mật khẩu mới'))), array('name' => 'StringLength', 'break_chain_on_failure' => true, 'options' => array('min' => 6, 'messages' => array('stringLengthTooShort' => 'Mật khẩu phải có từ 6 kí tự trở lên')))))); $conPass = new Password('conpassword'); $conPass->setLabel('Nhập lại mật khẩu mới:'); $conPass->setAttributes(['maxlength' => 255, 'class' => 'validate[required],minSize[6],equals[newpassword]']); $this->add($conPass); $changePass->addElement($conPass); $filter->add(array('name' => 'conpassword', 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập Xác nhận mật khẩu'))), array('name' => 'StringLength', 'break_chain_on_failure' => true, 'options' => array('min' => 6, 'messages' => array('stringLengthTooShort' => 'Mật khẩu phải có từ 6 kí tự trở lên'))), array('name' => 'Identical', 'break_chain_on_failure' => true, 'options' => array('token' => 'newpassword', 'messages' => array('notSame' => 'Xác nhận mật khẩu không chính xác')))))); $this->add(array('name' => 'submit', 'options' => array('clearBefore' => true), 'attributes' => array('type' => 'submit', 'value' => 'Lưu', 'id' => 'btnSaveCrmContact', 'class' => 'btn btn-primary'))); }