Ejemplo n.º 1
0
 /**
  * @param null|string $name
  */
 public function __construct($serviceLocator, $options = null)
 {
     parent::__construct('signin');
     $this->setServiceLocator($serviceLocator);
     $this->setAttribute('method', 'post');
     $this->setOptions(['layout' => 'fluid']);
     $filter = $this->getInputFilter();
     //$groupBasic = new DisplayGroup('groupBasic');
     //$this->add($groupBasic);
     $fullName = new Text('fullName');
     $fullName->setLabel('Tên đầy đủ:');
     $this->add($fullName);
     //$groupBasic->addElement($username);
     $filter->add(array('name' => 'fullName', 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập tên'))))));
     $cityId = new Select('cityId');
     $this->loadCities($cityId);
     $filter->add(array('name' => 'cityId', 'required' => false, 'filters' => array()));
     $this->add($cityId);
     $districtId = new Select('districtId');
     $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 người dùng'))))));
     $this->add($address);
     // code
     $description = new Textarea('description');
     $description->setLabel('Mô tả bản thân:');
     $description->setAttributes(['class' => 'form-control basicEditor ', 'style' => 'min-height: 300px;']);
     $this->add($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ả'))))));
     $this->add(array('name' => 'submit', 'attributes' => array('type' => 'submit', 'value' => 'Lưu', 'id' => 'btnSignin', 'class' => 'btn btn btn-primary')));
     //$groupBasic->addElement($this->get('submit'));
 }
 /**
  * @param null|string $name
  */
 public function __construct($serviceLocator, $options = null)
 {
     parent::__construct('userManageFilter');
     $this->setServiceLocator($serviceLocator);
     $this->setAttribute('method', 'POST');
     $filter = $this->getInputFilter();
     $groupBasic = new DisplayGroup('groupBasic');
     $this->add($groupBasic);
     $fromCompanyId = new Text('fromCompanyId');
     $fromCompanyId->setLabel('From companyId:');
     $fromCompanyId->setAttributes(['maxlength' => 255, 'autocomplete' => 'off']);
     $this->add($fromCompanyId);
     $groupBasic->addElement($fromCompanyId);
     $filter->add(array('name' => 'fromCompanyId', '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 fromCompanyId'))))));
     $fromRoleId = new Text('fromRoleId');
     $fromRoleId->setLabel('From role:');
     $fromRoleId->setAttributes(['autocomplete' => 'off']);
     $this->add($fromRoleId);
     $groupBasic->addElement($fromRoleId);
     $filter->add(array('name' => 'fromRoleId', '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 fromRole'))))));
     $toCompanyId = new Text('toCompanyId');
     $toCompanyId->setLabel('To CompanyIds:');
     $toCompanyId->setAttributes(['autocomplete' => 'off']);
     $this->add($toCompanyId);
     $groupBasic->addElement($toCompanyId);
     $filter->add(array('name' => 'toCompanyId', '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 toCompanyId'))))));
     $asRole = new Text('asRole');
     $asRole->setLabel('As role:');
     $asRole->setAttributes(['maxlength' => 255, 'autocomplete' => 'off']);
     $this->add($asRole);
     $groupBasic->addElement($asRole);
     $filter->add(array('name' => 'asRole', '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 as role'))))));
     $this->add(array('name' => 'submit', 'options' => array('clearBefore' => true), 'attributes' => array('type' => 'submit', 'value' => 'Lưu', 'id' => 'btnSaveCrmContact', 'class' => 'btn btn-primary')));
 }
Ejemplo n.º 3
0
 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')));
 }
Ejemplo n.º 4
0
 public function isValid()
 {
     $isValid = parent::isValid();
     if ($isValid) {
         $userService = $this->getServiceLocator()->get('User\\Service\\User');
         $data = parent::getData();
         if (!$userService->authenticate($data['mail'], $data['password'])) {
             $this->get('mail')->setMessages([self::ERROR_INVALID]);
             return false;
         }
         /* @var $user \User\Model\User */
         $user = $userService->getUser();
         //            if(!$user->getActive()){
         //            	$this->get('username')->setMessages([self::ERROR_INACTIVE]);
         //            	$userService->getAuthService()->clearIdentity();
         //            	return false;
         //            }
         //            if($user->getLocked()){
         //            	$this->get('username')->setMessages([self::ERROR_LOCKED]);
         //            	$userService->getAuthService()->clearIdentity();
         //            	return false;
         //            }
     }
     return $isValid;
 }
Ejemplo n.º 5
0
 public function isValid()
 {
     $isValid = parent::isValid();
     if ($isValid) {
         /** @var \User\Service\User $userService */
         $userService = $this->getServiceLocator()->get('User\\Service\\User');
         $data = parent::getData();
         $user = new User();
         $user->setEmail($data['email']);
         /** @var \User\Model\UserMapper $userMapper */
         $userMapper = $this->getServiceLocator()->get('User\\Model\\UserMapper');
         if ($userMapper->isActive($user) && !$data['password']) {
             $this->get('email')->setMessages(['Bạn đã đăng ký, vui lòng chọn đăng nhập để tiếp tục']);
             return false;
         }
         if (!$userService->isAvailableEmail($data['email'])) {
             return true;
         }
         if ($data['password'] != '' && !$userService->authenticate($data['email'], $data['password'])) {
             $this->get('email')->setMessages([\User\Form\Signin::ERROR_INVALID]);
             return false;
         }
     }
     return $isValid;
 }
Ejemplo n.º 6
0
 public function getData($flag = 17)
 {
     //$fileName = $this->recieverFile();
     $data = parent::getData();
     $data['fileName'] = $data['fileUpload']['name'];
     return $data;
 }
Ejemplo n.º 7
0
 public function __construct($serviceLocator, $options = null)
 {
     parent::__construct('transactionItem');
     $this->setServiceLocator($serviceLocator);
     $this->setAttribute('method', 'post');
     $filter = $this->getInputFilter();
     $id = new Hidden('id');
     $this->add($id);
     $filter->add(array('name' => 'id', '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 id'))))));
     $transactionId = new Hidden('transactionId');
     $this->add($transactionId);
     $filter->add(array('name' => 'transactionId', '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 mã code'))))));
     $accountId = new Text('accountId');
     $this->add($accountId);
     $filter->add(array('name' => 'accountId', '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 quỹ'))))));
     if ($options && isset($options['accountIds']) && is_array($options['accountIds'])) {
         $filter->get('accountId')->getValidatorChain()->attach(new \Zend\Validator\InArray(array('haystack' => $options['accountIds'])));
     }
     $expenseCategoryId = new Text('expenseCategoryId');
     $this->add($expenseCategoryId);
     $filter->add(array('name' => 'expenseCategoryId', '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 khoản mục chi tiêu'))))));
     if ($options && isset($options['expenseCategoryIds']) && is_array($options['expenseCategoryIds'])) {
         $filter->get('expenseCategoryId')->getValidatorChain()->attach(new \Zend\Validator\InArray(array('haystack' => $options['expenseCategoryIds'])));
     }
     $amount = new Text('amount');
     $this->add($amount);
     $filter->add(array('name' => 'amount', '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 giá trị'))))));
     $vat = new Text('vat');
     $this->add($vat);
     $filter->add(array('name' => 'vat', '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 giá trị'))))));
     $description = new Text('description');
     $this->add($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 giá trị'))))));
 }
Ejemplo n.º 8
0
 public function isValid()
 {
     $isVaild = parent::isValid();
     if ($isVaild) {
         $data = parent::getData();
         $expenseCategory = new \Accounting\Model\ExpenseCategory();
         if ($data['id']) {
             $expenseCategory->setId($data['id']);
         }
         if ($data['companyId']) {
             $expenseCategory->setCompanyId($data['companyId']);
         }
         if ($data['code']) {
             $expenseCategory->setCode($data['code']);
         }
         if ($data['name']) {
             $expenseCategory->setName($data['name']);
         }
         $expenseCategoryMapper = $this->getServiceLocator()->get('Accounting\\Model\\ExpenseCategoryMapper');
         $result = $expenseCategoryMapper->checkunique($expenseCategory);
         if ($result && $result == 'code') {
             $this->get('code')->setMessages(['Mã code này đã tồn tại']);
             $isVaild = false;
         }
         if ($result && $result == 'name') {
             $this->get('name')->setMessages(['tên này đã tồn tại']);
             $isVaild = false;
         }
         return $isVaild;
     }
 }
 public function __construct($serviceLocator, $options = null)
 {
     parent::__construct('updatecode');
     $this->setServiceLocator($serviceLocator);
     $filter = $this->getInputFilter();
     $code = new Text('code');
     $this->add($code);
     $filter->add(array('name' => 'code', 'required' => true, 'filters' => array(array('name' => 'StringTrim'), array('name' => 'Digits')), 'validators' => array(array('name' => 'NotEmpty', 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập mã nhân viên hoặc mã nhân viên không hợp lệ.'))), array('name' => 'StringLength', 'options' => array('min' => '1', 'max' => '4', 'messages' => array(\Zend\Validator\StringLength::INVALID => 'Mã nhân viên không hợp lệ.', \Zend\Validator\StringLength::TOO_SHORT => 'Mã nhân viên không hợp lệ. Là chuỗi số từ 1 đến 4 chữ số', \Zend\Validator\StringLength::TOO_LONG => 'Mã nhân viên không hợp lệ. Là chuỗi số từ 1 đến 4 chữ số'))))));
 }
Ejemplo n.º 10
0
 public function getData($flag = null)
 {
     $data = parent::getData($flag);
     $date = new \DateTime();
     $data['filePath'] = $date->format('dmY');
     $data['fileName'] = $data['fileUpload']['name'];
     $data['fileSize'] = $data['fileUpload']['size'];
     return $data;
 }
Ejemplo n.º 11
0
 /**
  * @param null|string $name
  */
 public function __construct($serviceLocator, $options = null)
 {
     parent::__construct('userManageFilter');
     $this->setServiceLocator($serviceLocator);
     $this->setAttribute('method', 'GET');
     $filter = $this->getInputFilter();
     $companyId = $this->addElementCompany('companyId', null, ['required' => false]);
     $compareCompanyId = $this->addElementCompany('compareCompanyId', null, ['required' => false]);
     $this->add(array('name' => 'submit', 'options' => array(), 'attributes' => array('type' => 'submit', 'value' => 'Lọc', 'id' => 'btnFilterCrmContact', 'class' => 'btn btn-primary')));
 }
Ejemplo n.º 12
0
 /**
  * (non-PHPdoc)
  * @see \Home\Form\FormBase::getData()
  */
 public function getData($flag = null)
 {
     $data = parent::getData();
     if ($data['applyDateRange']) {
         $daterange = explode(' - ', $data['applyDateRange']);
         $fromDate = $daterange[0];
         $toDate = $daterange[1];
         $data['fromApplyDate'] = DateBase::toCommonDate(trim($fromDate));
         $data['toApplyDate'] = DateBase::toCommonDate(trim($toDate));
     }
     return $data;
 }
Ejemplo n.º 13
0
 /**
  *
  * @param null|string $name
  */
 public function __construct($serviceLocator)
 {
     parent::__construct('ideaFilter');
     $this->setServiceLocator($serviceLocator);
     $this->setAttribute('method', 'GET');
     $filter = $this->getInputFilter();
     $name = new Text('name');
     $name->setAttributes(['maxlength' => 255, 'placeholder' => 'Tên danh mục']);
     $this->add($name);
     $filter->add(array('name' => 'name', 'required' => false, 'filters' => array(array('name' => 'StringTrim'))));
     $this->add(array('name' => 'submit', 'options' => array(), 'attributes' => array('type' => 'submit', 'value' => 'Lọc', 'id' => 'btnFilterCompanyContact', 'class' => 'btn btn-primary')));
 }
Ejemplo n.º 14
0
 /**
  * (non-PHPdoc)
  * @see \Zend\Form\Form::getData()
  */
 public function getData($flag = null)
 {
     $data = parent::getData();
     if (isset($data['daterangepicker']) && $data['daterangepicker']) {
         $daterange = explode(' - ', $data['daterangepicker']);
         $fromDate = $daterange[0];
         $toDate = $daterange[1];
         $data['fromDate'] = DateBase::toCommonDate(trim($fromDate));
         $data['toDate'] = DateBase::toCommonDate(trim($toDate));
     }
     return $data;
 }
Ejemplo n.º 15
0
 /**
  * @param null|string $username
  */
 public function __construct($serviceLocator)
 {
     parent::__construct('userManageFilter');
     $this->setServiceLocator($serviceLocator);
     $this->setAttribute('method', 'GET');
     $filter = $this->getInputFilter();
     $companyId = $this->addElementCompany('companyId', null, ['required' => false]);
     $departmentId = new Select('departmentId');
     $departmentId->setValueOptions(['' => '- Phòng ban -']);
     $this->add($departmentId);
     $this->loadDepartments($departmentId, $companyId);
     $filter->add(array('name' => 'departmentId', 'required' => false, 'filters' => array(array('name' => 'StringTrim'))));
     $id = new Text('id');
     $id->setAttributes(['maxlength' => 255, 'placeholder' => 'ID']);
     $this->add($id);
     $filter->add(array('name' => 'id', 'required' => false, 'filters' => array(array('name' => 'StringTrim'))));
     $username = new Text('username');
     $username->setAttributes(['maxlength' => 255, 'placeholder' => 'Họ tên']);
     $this->add($username);
     $filter->add(array('name' => 'username', 'required' => false, 'filters' => array(array('name' => 'StringTrim'))));
     $email = new Text('email');
     $email->setAttributes(['maxlength' => 255, 'placeholder' => 'Email']);
     $this->add($email);
     $filter->add(array('name' => 'email', 'required' => false, 'filters' => array(array('name' => 'StringTrim'))));
     //phân quyền riêng
     $hasPrivateRole = new Select('hasPrivateRole');
     $hasPrivateRole->setValueOptions(array('' => '- Phân quyền riêng -', '1' => 'Có ', '-1' => 'Không '));
     $this->add($hasPrivateRole);
     $filter->add(array('name' => 'hasPrivateRole', 'required' => false));
     $user = new \User\Model\User();
     $roleValues = array('' => '- Quyền hạn -') + $user->getRoleDisplays();
     unset($roleValues[$user::ROLE_SUPERADMIN]);
     $role = new Select('role');
     $role->setValueOptions($roleValues);
     $this->add($role);
     $filter->add(array('name' => 'role', 'required' => false, 'filters' => array(array('name' => 'StringTrim'), array('name' => 'Digits'))));
     $roleCompany = new Select('roleCompany');
     $roleCompany->setValueOptions(['' => '- Nhóm quyền -']);
     $this->add($roleCompany);
     $this->loadRole($roleCompany, $companyId);
     $filter->add(array('name' => 'roleCompany', 'required' => false, 'filters' => array(array('name' => 'StringTrim'))));
     $active = new Select('active');
     $active->setValueOptions(array('' => '- Kích hoạt', '1' => 'Đã kích hoạt', '-1' => 'Chưa kích hoạt'));
     $this->add($active);
     $filter->add(array('name' => 'active', 'required' => false, 'filters' => array(array('name' => 'StringTrim'))));
     $locked = new Select('locked');
     $locked->setValueOptions(array('' => '- Khóa -', '1' => 'Đã khóa', '-1' => 'Chưa khóa'));
     $this->add($locked);
     $filter->add(array('name' => 'locked', 'required' => false, 'filters' => array(array('name' => 'StringTrim'))));
     $this->add(array('name' => 'submit', 'options' => array(), 'attributes' => array('type' => 'submit', 'value' => 'Lọc', 'id' => 'btnFilterCrmContact', 'class' => 'btn btn-primary')));
 }
 /**
  *
  * @param null|string $name        	
  */
 public function __construct($serviceLocator)
 {
     parent::__construct('ideaFilter');
     $this->setServiceLocator($serviceLocator);
     $this->setAttribute('method', 'GET');
     $filter = $this->getInputFilter();
     //CompanyId
     $companyId = new Select('companyId');
     $companyId->setLabel('Chọn công ty:');
     $this->add($companyId);
     $this->loadCompanies($companyId);
     $filter->add(array('name' => 'companyId', 'required' => false, 'filters' => array(array('name' => 'StringTrim'))));
     $this->add(array('name' => 'submit', 'options' => array(), 'attributes' => array('type' => 'submit', 'value' => 'Lọc', 'id' => 'btnFilterCompanyContact', 'class' => 'btn btn-primary')));
 }
Ejemplo n.º 17
0
 public function __construct($serviceLocator, $options = null)
 {
     parent::__construct('AccountIndex');
     $this->setServiceLocator($serviceLocator);
     $this->setAttribute('method', 'post');
     $filter = $this->getInputFilter();
     $group = new DisplayGroup('Accountgroup');
     $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 select
     $companyId = $this->addElementCompany('companyId', $group, ['required' => true]);
     $this->add(array('name' => 'afterSubmit', 'type' => 'radio', 'attributes' => array('value' => '/accounting/account/initnewcompany'), 'options' => array('layout' => 'fluid', 'clearBefore' => true, 'label' => 'Sau khi lưu dữ liệu:', 'value_options' => array('/accounting/account/initnewcompany' => 'Tiếp tục nhập', '/accounting/account/index' => 'Hiện danh sách vừa nhập'))));
     $this->add(array('name' => 'submit', 'options' => array('clearBefore' => true), 'attributes' => array('type' => 'submit', 'value' => 'Tạo', 'id' => 'btnSave', 'class' => 'btn btn-primary')));
 }
Ejemplo n.º 18
0
 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')));
 }
Ejemplo n.º 19
0
 public function isValid()
 {
     $isValid = parent::isValid();
     if ($isValid) {
         $data = parent::getData();
         if ($data['mainCompanyId'] == $data['toDeleteCompanyId']) {
             $this->get('mainCompanyId')->setMessages(['Không thể hợp nhất 2 sp cùng cty']);
             $this->get('toDeleteCompanyId')->setMessages(['Không thể hợp nhất 2 sp cùng cty']);
             $isValid = false;
         }
         if ($data['mainProductId'] == $data['toDeleteProductId']) {
             $this->get('mainProductId')->setMessages(['Sp trùng']);
             $this->get('toDeleteProductId')->setMessages(['Sp trùng']);
             $isValid = false;
         }
     }
     return $isValid;
 }
Ejemplo n.º 20
0
 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')));
 }
Ejemplo n.º 21
0
 public function __construct($serviceLocator, $options = null)
 {
     parent::__construct('AccountIndex');
     $this->setServiceLocator($serviceLocator);
     $this->setAttribute('method', 'post');
     $filter = $this->getInputFilter();
     $group = new DisplayGroup('Accountgroup');
     $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 select
     $companyId = $this->addElementCompany('companyId', $group, ['required' => false]);
     // name
     $name = new Text('name');
     $name->setLabel('Tên tài khoản:');
     $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 tài khoản'))))));
     // 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'))))));
     $this->add(array('name' => 'afterSubmit', 'type' => 'radio', 'attributes' => array('value' => '/accounting/account/add'), 'options' => array('layout' => 'fluid', 'clearBefore' => true, 'label' => 'Sau khi lưu dữ liệu:', 'value_options' => array('/accounting/account/add' => 'Tiếp tục nhập', '/accounting/account/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')));
 }
Ejemplo n.º 22
0
 /**
  * @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')));
 }
Ejemplo n.º 23
0
 public function isValid()
 {
     $isValid = parent::isValid();
     if ($isValid) {
         $data = parent::getData();
         $userMapper = $this->getServiceLocator()->get('\\User\\Model\\UserMapper');
         if (!($user = $userMapper->get(null, null, $data['email']))) {
             $this->get('email')->setMessages(['Email không tồn tại trong hệ thống']);
             $isValid = false;
         } else {
             if (!$user->getActive()) {
                 $this->get('email')->setMessages(['Tài khoản chưa được active']);
                 $isValid = false;
             }
             if ($user->getLocked()) {
                 $this->get('email')->setMessages(['Tài khoản chưa được active']);
                 $isValid = false;
             }
         }
     }
     return $isValid;
 }
Ejemplo n.º 24
0
 /**
  * @param null|string $name
  */
 public function __construct($serviceLocator, $options = null)
 {
     parent::__construct('passwordForgot');
     $this->setServiceLocator($serviceLocator);
     $this->setAttribute('method', 'post');
     $filter = $this->getInputFilter();
     $groupBasic = new DisplayGroup('groupBasic');
     $this->add($groupBasic);
     $password = new Password('password');
     $password->setLabel('Mật khẩu mới:');
     $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 mới:');
     $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'))))));
     $this->add(array('name' => 'submit', 'attributes' => array('type' => 'submit', 'value' => 'Đặt lại mật khẩu', 'id' => 'btnSubmit', 'class' => 'htmlBtn first btn btn-primary'), 'options' => array('clearBefore' => true, 'decorator' => array('type' => 'li', 'attributes' => array('class' => 'btns')))));
 }
Ejemplo n.º 25
0
 /**
  * @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')));
 }
Ejemplo n.º 26
0
 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')));
 }
Ejemplo n.º 27
0
 /**
  * @param null|string $name
  */
 public function __construct($serviceLocator, $options = null)
 {
     parent::__construct('taskRequirement');
     $this->setServiceLocator($serviceLocator);
     $this->setAttribute('method', 'post');
     $filter = $this->getInputFilter();
     if ($options && isset($options['id']) && $options['id']) {
         $this->id = $options['id'];
     }
     $taskFile = new \Work\Model\TaskFile();
     $taskFile->setTaskId($this->id);
     $taskFile->setCreatedDateTime(DateBase::getCurrentDateTime());
     $targetFolder = Uri::getSavePath($taskFile);
     if (!file_exists($targetFolder)) {
         $oldmask = umask(0);
         mkdir($targetFolder, 0777, true);
         umask($oldmask);
     }
     $task = new Task();
     $fileUpload = new File('fileUpload');
     $this->add($fileUpload);
     $filter->add(array('name' => 'fileUpload', 'type' => '\\Zend\\InputFilter\\FileInput', 'required' => true, 'allowEmpty' => true, 'filters' => array(new \Zend\Filter\File\RenameUpload(array('target' => $targetFolder, 'use_upload_name' => true, 'overwrite' => true))), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa chọn file'))), array('name' => 'File\\Size', 'break_chain_on_failure' => true, 'options' => array('max' => Task::MAX_FILE_SIZE . 'MB', 'messages' => array(\Zend\Validator\File\Size::TOO_BIG => 'File upload phải < 100Mb'))), array('name' => 'File\\Extension', 'break_chain_on_failure' => true, 'options' => array('extension' => $task->getAllowExtension(), 'messages' => array(\Zend\Validator\File\Extension::FALSE_EXTENSION => 'File upload phải là file ảnh, excel, hoặc msword,pds,pdf'))))));
 }
Ejemplo n.º 28
0
 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')));
 }
Ejemplo n.º 29
0
 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')));
 }
Ejemplo n.º 30
0
 public function isValid()
 {
     $isVaild = parent::isValid();
     if ($isVaild) {
         $user = new \User\Model\User();
         $user->exchangeArray($this->getData());
         $userMapper = $this->getServiceLocator()->get('\\User\\Model\\UserMapper');
         if ($userMapper->isExisted($user)) {
             $this->get('username')->setMessages(['Tên tài khoản hoặc email này đã được sử dụng']);
             $isVaild = false;
         }
     }
     return $isVaild;
 }