/**
  * setup form
  * 
  * 
  * @access public
  * @param string $name ,default is null
  * @param array $options ,default is null
  */
 public function __construct($name = null, $options = null)
 {
     $this->query = $options['query'];
     unset($options['query']);
     $this->organizationType = $options['organizationType'];
     unset($options['organizationType']);
     parent::__construct($name, $options);
     $this->setAttribute('class', 'form form-horizontal');
     $types = array();
     $atcTypes = array(Role::PROCTOR_ROLE, Role::TEST_CENTER_ADMIN_ROLE);
     $atpTypes = array(Role::TRAINING_MANAGER_ROLE);
     if ($this->organizationType === Organization::TYPE_ATC) {
         $types = $atcTypes;
     } elseif ($this->organizationType === Organization::TYPE_ATP) {
         $types = $atpTypes;
     } else {
         $types = array_merge($atpTypes, $atcTypes);
     }
     $this->add(array('name' => 'user', 'type' => 'DoctrineModule\\Form\\Element\\ObjectSelect', 'attributes' => array('class' => 'form-control chosen-select', 'required' => 'required'), 'options' => array('label' => 'User', 'object_manager' => $this->query->entityManager, 'target_class' => 'Users\\Entity\\User', 'property' => 'fullName', 'is_method' => true, 'find_method' => array('name' => 'findBy', 'params' => array('criteria' => array())), 'display_empty_item' => true, 'empty_item_label' => self::EMPTY_SELECT_VALUE)));
     $criteria = Criteria::create();
     $expr = Criteria::expr();
     if (count($types) > 0) {
         $criteria->andWhere($expr->in("name", $types));
     }
     $this->add(array('name' => 'role', 'type' => 'DoctrineModule\\Form\\Element\\ObjectSelect', 'attributes' => array('class' => 'form-control', 'required' => 'required'), 'options' => array('label' => 'Role', 'object_manager' => $this->query->entityManager, 'target_class' => 'Users\\Entity\\Role', 'property' => 'name', 'is_method' => false, 'find_method' => array('name' => 'matching', 'params' => array('criteria' => $criteria)), 'display_empty_item' => true, 'empty_item_label' => self::EMPTY_SELECT_VALUE)));
     $this->add(array('name' => 'organization', 'type' => 'Zend\\Form\\Element\\Hidden'));
     $this->add(array('name' => 'id', 'type' => 'Zend\\Form\\Element\\Hidden'));
     $this->add(array('name' => 'Create', 'type' => 'Zend\\Form\\Element\\Submit', 'attributes' => array('class' => 'btn btn-success', 'value' => 'Add')));
     $this->add(array('name' => 'reset', 'type' => 'Zend\\Form\\Element', 'attributes' => array('class' => 'btn btn-danger resetButton', 'value' => 'Reset', 'type' => 'button')));
 }
 /**
  * setup form
  * 
  * 
  * @access public
  * @param string $name ,default is null
  * @param array $options ,default is null
  */
 public function __construct($name = null, $options = null)
 {
     $this->query = $options['query'];
     unset($options['query']);
     parent::__construct($name, $options);
     $hiddenMenuItemsIds = array();
     if (isset($options['hiddenMenuItemsIds'])) {
         $hiddenMenuItemsIds = $options['hiddenMenuItemsIds'];
     }
     $this->setAttribute('class', 'form form-horizontal');
     $this->add(array('name' => 'title', 'type' => 'Zend\\Form\\Element\\Text', 'attributes' => array('required' => 'required', 'class' => 'form-control'), 'options' => array('label' => 'Title')));
     $this->add(array('type' => 'Zend\\Form\\Element\\Radio', 'name' => 'type', 'options' => array('label' => '<div class="required">Menu Item Type</div>', 'label_options' => array('disable_html_escape' => true), 'value_options' => array(array('value' => MenuItem::TYPE_PAGE, 'label' => 'Page', 'checked' => false, 'attributes' => array('class' => 'menu_item_type', 'id' => 'type-page')), array('value' => MenuItem::TYPE_DIRECT_URL, 'label' => 'Direct Url', 'checked' => false, 'attributes' => array('class' => 'menu_item_type', 'id' => 'type-directUrl'))))));
     $this->add(array('name' => 'directUrl', 'type' => 'Zend\\Form\\Element\\Text', 'attributes' => array('class' => 'form-control', 'required' => 'required'), 'options' => array('label' => 'Direct Url')));
     $this->add(array('name' => 'page', 'type' => 'DoctrineModule\\Form\\Element\\ObjectSelect', 'attributes' => array('class' => 'form-control', 'required' => 'required'), 'options' => array('label' => 'Page', 'object_manager' => $this->query->entityManager, 'target_class' => 'CMS\\Entity\\Page', 'property' => 'name', 'empty_item_label' => self::EMPTY_SELECT_VALUE, 'display_empty_item' => true, 'label_generator' => function ($targetEntity) {
         return $targetEntity->getTitle();
     })));
     $this->add(array('name' => 'parent', 'type' => 'DoctrineModule\\Form\\Element\\ObjectSelect', 'attributes' => array('class' => 'form-control', 'required' => 'required'), 'options' => array('label' => 'Parent', 'object_manager' => $this->query->entityManager, 'target_class' => 'CMS\\Entity\\MenuItem', 'label_generator' => function ($targetEntity) {
         return $targetEntity->getNestedTitle();
     }, 'find_method' => array('name' => 'getMenuItemsSorted', 'params' => array('hiddenMenuItemsIds' => $hiddenMenuItemsIds)), 'display_empty_item' => true, 'empty_item_label' => "- - ")));
     $this->add(array('name' => 'weight', 'type' => 'Zend\\Form\\Element\\Number', 'attributes' => array('placeholder' => 'Lower value will be displayed at the Top', 'required' => 'required', 'class' => 'form-control', 'min' => '1'), 'options' => array('label' => 'Sort Order')));
     $this->add(array('name' => 'status', 'type' => 'Zend\\Form\\Element\\Checkbox', 'attributes' => array('class' => 'form-control'), 'options' => array('label' => 'Status', 'checked_value' => Status::STATUS_ACTIVE, 'unchecked_value' => Status::STATUS_INACTIVE)));
     $this->add(array('name' => 'menu', 'type' => 'Zend\\Form\\Element\\Hidden'));
     $this->add(array('name' => 'id', 'type' => 'Zend\\Form\\Element\\Hidden'));
     $this->add(array('name' => 'Create', 'type' => 'Zend\\Form\\Element\\Submit', 'attributes' => array('class' => 'btn btn-success', 'value' => 'Create')));
     $this->add(array('name' => 'reset', 'type' => 'Zend\\Form\\Element', 'attributes' => array('class' => 'btn btn-danger resetButton', 'value' => 'Reset', 'type' => 'button')));
 }
Example #3
0
 /**
  * setup form and add validation constraints
  * 
  * 
  * @access public
  * @param string $name ,default is null
  * @param array $options ,default is null
  */
 public function __construct($name = null, $options = null)
 {
     parent::__construct($name, $options);
     $this->setAttribute('class', 'form form-horizontal');
     $this->add(array('name' => 'username', 'type' => 'Zend\\Form\\Element\\Text', 'attributes' => array('required' => 'required', 'class' => 'form-control'), 'options' => array('label' => 'Username')));
     $this->add(array('name' => 'password', 'type' => 'Zend\\Form\\Element\\Password', 'attributes' => array('required' => 'required', 'class' => 'form-control'), 'options' => array('label' => 'Password')));
     $this->add(array('name' => 'login', 'type' => 'Zend\\Form\\Element\\Submit', 'attributes' => array('class' => 'btn btn-lg btn-success btn-block', 'value' => 'Log in')));
     $this->setInputFilter($this->getInputFilter());
 }
Example #4
0
 /**
  * setup form
  * 
  * 
  * @access public
  * @param string $name ,default is null
  * @param array $options ,default is null
  */
 public function __construct($name = null, $options = null)
 {
     parent::__construct($name, $options);
     $this->setAttribute('class', 'form form-horizontal');
     $this->add(array('name' => 'name', 'type' => 'Zend\\Form\\Element\\Text', 'attributes' => array('required' => 'required', 'class' => 'form-control'), 'options' => array('label' => 'Name')));
     $this->add(array('name' => 'id', 'type' => 'Zend\\Form\\Element\\Hidden'));
     $this->add(array('name' => 'Create', 'type' => 'Zend\\Form\\Element\\Submit', 'attributes' => array('class' => 'btn btn-success', 'value' => 'Create')));
     $this->add(array('name' => 'reset', 'type' => 'Zend\\Form\\Element', 'attributes' => array('class' => 'btn btn-danger resetButton', 'value' => 'Reset', 'type' => 'button')));
 }
Example #5
0
 /**
  * setup form
  * 
  * 
  * @access public
  * @param string $name ,default is null
  * @param array $options ,default is null
  */
 public function __construct($name = null, $options = null)
 {
     parent::__construct($name, $options);
     $this->setAttribute('class', 'form form-horizontal');
     $this->add(array('name' => 'title', 'type' => 'Zend\\Form\\Element\\Text', 'attributes' => array('required' => 'required', 'class' => 'form-control'), 'options' => array('label' => 'Title')));
     $this->add(array('name' => 'status', 'type' => 'Zend\\Form\\Element\\Checkbox', 'attributes' => array('class' => 'form-control'), 'options' => array('label' => 'Status', 'checked_value' => Status::STATUS_ACTIVE, 'unchecked_value' => Status::STATUS_INACTIVE)));
     $this->add(array('name' => 'id', 'type' => 'Zend\\Form\\Element\\Hidden'));
     $this->add(array('name' => 'Create', 'type' => 'Zend\\Form\\Element\\Submit', 'attributes' => array('class' => 'btn btn-success', 'value' => 'Create')));
     $this->add(array('name' => 'reset', 'type' => 'Zend\\Form\\Element', 'attributes' => array('class' => 'btn btn-danger resetButton', 'value' => 'Reset', 'type' => 'button')));
 }
 /**
  * setup form and add validation constraints
  * 
  * 
  * @access public
  * @param string $name ,default is null
  * @param array $options ,default is null
  */
 public function __construct($name = null, $options = null)
 {
     parent::__construct($name, $options);
     $this->setAttribute('class', 'form form-horizontal');
     $this->add(array('name' => 'name', 'type' => 'Zend\\Form\\Element\\Text', 'attributes' => array('required' => 'required', 'placeholder' => 'Enter text here', 'class' => 'form-control'), 'options' => array('label' => 'Name')));
     $this->add(array('name' => 'email', 'type' => 'Zend\\Form\\Element\\Email', 'attributes' => array('required' => 'required', 'placeholder' => 'Enter email address', 'class' => 'form-control'), 'options' => array('label' => 'Email')));
     $this->add(array('name' => 'subject', 'type' => 'Zend\\Form\\Element\\Text', 'attributes' => array('required' => 'required', 'placeholder' => 'Enter text here', 'class' => 'form-control'), 'options' => array('label' => 'Subject')));
     $this->add(array('name' => 'message', 'type' => 'Zend\\Form\\Element\\Textarea', 'attributes' => array('required' => 'required', 'placeholder' => 'Enter your comment here', 'class' => 'form-control', 'rows' => 5), 'options' => array('label' => 'Message')));
     $this->add(array('name' => 'submit', 'type' => 'Zend\\Form\\Element\\Submit', 'attributes' => array('class' => 'btn btn-lg btn-success btn-block', 'value' => 'Submit')));
     $this->setInputFilter($this->getInputFilter());
 }
Example #7
0
 /**
  * setup form
  * 
  * 
  * @access public
  * @param string $name ,default is null
  * @param array $options ,default is null
  */
 public function __construct($name = null, $options = null)
 {
     $this->query = $options['query'];
     //        $excludedRoles = $options['excludedRoles'];
     unset($options['query']);
     //        unset($options['countries']);
     //        unset($options['languages']);
     //        unset($options['excludedRoles']);
     parent::__construct($name, $options);
     $this->setAttribute('class', 'form form-horizontal');
     $this->add(array('name' => 'type', 'required' => true, 'type' => 'Zend\\Form\\Element\\Hidden', 'options' => array('messages' => array(\Zend\Validator\NotEmpty::IS_EMPTY => "you have to choose organization type"))));
     $this->add(array('type' => 'Zend\\Form\\Element\\MultiCheckbox', 'name' => 'orgType', 'required' => true, 'options' => array('label' => 'Organization Type', 'value_options' => array(array('value' => '1', 'label' => '    ATC Organization', 'checked' => false, 'attributes' => array('class' => 'orgType', 'id' => 'type-1')), array('value' => '2', 'label' => '    ATP Organization', 'checked' => false, 'attributes' => array('id' => 'type-2', 'class' => 'orgType'))))));
     $this->add(array('name' => 'submit', 'type' => 'Zend\\Form\\Element\\Submit', 'attributes' => array('class' => 'btn btn-success', 'value' => 'Start!')));
 }
Example #8
0
 /**
  * setup form
  * 
  * 
  * @access public
  * @param string $name ,default is null
  * @param array $options ,default is null
  */
 public function __construct($name = null, $options = null)
 {
     $this->query = $options['query'];
     $countries = $options['countries'];
     $languages = $options['languages'];
     $excludedRoles = $options['excludedRoles'];
     unset($options['query']);
     unset($options['countries']);
     unset($options['languages']);
     unset($options['excludedRoles']);
     parent::__construct($name, $options);
     $this->setAttribute('class', 'form form-horizontal');
     $this->add(array('name' => 'firstName', 'type' => 'Zend\\Form\\Element\\Text', 'attributes' => array('placeholder' => 'Enter First Name', 'required' => 'required', 'class' => 'form-control'), 'options' => array('label' => 'First Name')));
     $this->add(array('name' => 'middleName', 'type' => 'Zend\\Form\\Element\\Text', 'attributes' => array('placeholder' => 'Enter Middle Name', 'class' => 'form-control'), 'options' => array('label' => 'Middle Name')));
     $this->add(array('name' => 'lastName', 'type' => 'Zend\\Form\\Element\\Text', 'attributes' => array('placeholder' => 'Enter Last Name', 'required' => 'required', 'class' => 'form-control'), 'options' => array('label' => 'Last Name')));
     $this->add(array('name' => 'username', 'type' => 'Zend\\Form\\Element\\Text', 'attributes' => array('placeholder' => 'Enter User Name', 'required' => 'required', 'class' => 'form-control'), 'options' => array('label' => 'User Name')));
     $this->add(array('name' => 'mobile', 'type' => 'Zend\\Form\\Element\\Text', 'attributes' => array('placeholder' => 'Enter Mobile Number ( 444-555-1234 / 246.555.8888 / 1235554567)', 'required' => 'required', 'class' => 'form-control'), 'options' => array('label' => 'Mobile')));
     $this->add(array('name' => 'phone', 'type' => 'Zend\\Form\\Element\\Text', 'attributes' => array('placeholder' => 'Enter Phone Number ( 444-555-1234 / 246.555.8888 / 1235554567)', 'class' => 'form-control'), 'options' => array('label' => 'Phone')));
     $this->add(array('name' => 'email', 'type' => 'Zend\\Form\\Element\\Email', 'attributes' => array('placeholder' => 'Enter Email', 'required' => 'required', 'class' => 'form-control'), 'options' => array('label' => 'Email')));
     $this->add(array('name' => 'confirmEmail', 'type' => 'Zend\\Form\\Element\\Email', 'attributes' => array('placeholder' => 'Confirm User Email', 'class' => 'form-control'), 'options' => array('label' => 'Confirm Email')));
     $this->add(array('name' => 'password', 'type' => 'Zend\\Form\\Element\\Password', 'attributes' => array('placeholder' => 'Enter Password', 'class' => 'form-control'), 'options' => array('label' => 'Password')));
     $this->add(array('name' => 'confirmPassword', 'type' => 'Zend\\Form\\Element\\Password', 'attributes' => array('placeholder' => 'Confirm User Password', 'class' => 'form-control'), 'options' => array('label' => 'Confirm Password')));
     $this->add(array('name' => 'securityQuestion', 'type' => 'Zend\\Form\\Element\\Text', 'attributes' => array('placeholder' => 'Enter Security Question', 'required' => 'required', 'class' => 'form-control'), 'options' => array('label' => '<p class="required">Security Question</p> <p><ul><li>Security Question should be <strong>Memorable</strong>, You should be able to remember the answer.</li><li>Security Question should be <strong>Consistent</strong>, Answer should not change with time.</li><li>Security Question should be <strong>Safe</strong>, Answer should be hard to guess or research.</li></ul></p>', 'label_options' => array('disable_html_escape' => true))));
     $this->add(array('name' => 'securityAnswer', 'type' => 'Zend\\Form\\Element\\Text', 'attributes' => array('placeholder' => 'Enter Security Answer', 'required' => 'required', 'class' => 'form-control'), 'options' => array('label' => 'Security Answer')));
     $this->add(array('name' => 'identificationType', 'type' => 'Zend\\Form\\Element\\Text', 'attributes' => array('placeholder' => 'Enter Identification Type (National ID, or Passport, etc)', 'required' => 'required', 'class' => 'form-control'), 'options' => array('label' => 'Identification Type')));
     $this->add(array('name' => 'identificationNumber', 'type' => 'Zend\\Form\\Element\\Text', 'attributes' => array('placeholder' => 'Enter Identification Number', 'required' => 'required', 'class' => 'form-control'), 'options' => array('label' => 'Identification Number')));
     $this->add(array('name' => 'identificationExpiryDate', 'type' => 'Zend\\Form\\Element\\Date', 'attributes' => array('required' => 'required', 'class' => 'form-control date', 'type' => 'text'), 'options' => array('label' => 'Identification Expiry Date', 'format' => Time::DATE_FORMAT)));
     $this->add(array('name' => 'dateOfBirth', 'type' => 'Zend\\Form\\Element\\Date', 'attributes' => array('required' => 'required', 'class' => 'form-control date', 'type' => 'text'), 'options' => array('label' => 'Date Of Birth', 'format' => Time::DATE_FORMAT)));
     $this->add(array('name' => 'nationality', 'type' => 'Zend\\Form\\Element\\Select', 'attributes' => array('class' => 'form-control', 'required' => 'required'), 'options' => array('label' => 'Nationality', 'value_options' => $countries, 'empty_option' => self::EMPTY_SELECT_VALUE)));
     $this->add(array('name' => 'language', 'type' => 'Zend\\Form\\Element\\Select', 'attributes' => array('class' => 'form-control', 'required' => 'required'), 'options' => array('label' => 'Language', 'value_options' => $languages, 'empty_option' => self::EMPTY_SELECT_VALUE)));
     $this->add(array('name' => 'addressOne', 'type' => 'Zend\\Form\\Element\\Text', 'attributes' => array('placeholder' => 'Enter Address Line 1', 'required' => 'required', 'class' => 'form-control'), 'options' => array('label' => 'Address Line 1')));
     $this->add(array('name' => 'addressTwo', 'type' => 'Zend\\Form\\Element\\Text', 'attributes' => array('placeholder' => 'Enter Address Line 2', 'class' => 'form-control'), 'options' => array('label' => 'Address Line 2')));
     $this->add(array('name' => 'city', 'type' => 'Zend\\Form\\Element\\Text', 'attributes' => array('placeholder' => 'Enter City', 'required' => 'required', 'class' => 'form-control'), 'options' => array('label' => 'City')));
     $this->add(array('name' => 'zipCode', 'type' => 'Zend\\Form\\Element\\Text', 'attributes' => array('placeholder' => 'Enter Zip Code', 'class' => 'form-control'), 'options' => array('label' => 'Zip Code')));
     $this->add(array('name' => 'country', 'type' => 'Zend\\Form\\Element\\Select', 'attributes' => array('class' => 'form-control', 'required' => 'required'), 'options' => array('label' => 'Country', 'value_options' => $countries, 'empty_option' => self::EMPTY_SELECT_VALUE)));
     $this->add(array('name' => 'photo', 'type' => 'Zend\\Form\\Element\\File', 'options' => array('label' => 'Picture')));
     $this->add(array('name' => 'roles', 'type' => 'DoctrineModule\\Form\\Element\\ObjectMultiCheckbox', 'attributes' => array('class' => 'form-control'), 'options' => array('label' => '<label class="legendLabel">Roles</label>', 'object_manager' => $this->query->entityManager, 'target_class' => 'Users\\Entity\\Role', 'property' => 'name', 'find_method' => array('name' => 'getRoles', 'params' => array('excludedRoles' => $excludedRoles)), 'label_options' => array('disable_html_escape' => true))));
     $this->add(array('name' => 'privacyStatement', 'type' => 'Zend\\Form\\Element\\Checkbox', 'attributes' => array('class' => 'form-control', 'required' => 'required'), 'options' => array('label' => 'Privacy Statement', 'checked_value' => Statement::STATEMENT_AGREE, 'unchecked_value' => Statement::STATEMENT_DISAGREE)));
     $this->add(array('name' => 'studentStatement', 'type' => 'Zend\\Form\\Element\\Checkbox', 'attributes' => array('class' => 'form-control'), 'options' => array('label' => 'Student Statement', 'checked_value' => Statement::STATEMENT_AGREE, 'unchecked_value' => Statement::STATEMENT_DISAGREE)));
     $this->add(array('name' => 'proctorStatement', 'type' => 'Zend\\Form\\Element\\Checkbox', 'attributes' => array('class' => 'form-control'), 'options' => array('label' => 'Proctor Statement', 'checked_value' => Statement::STATEMENT_AGREE, 'unchecked_value' => Statement::STATEMENT_DISAGREE)));
     $this->add(array('name' => 'instructorStatement', 'type' => 'Zend\\Form\\Element\\Checkbox', 'attributes' => array('class' => 'form-control'), 'options' => array('label' => 'Instructor Statement', 'checked_value' => Statement::STATEMENT_AGREE, 'unchecked_value' => Statement::STATEMENT_DISAGREE)));
     $this->add(array('name' => 'testCenterAdministratorStatement', 'type' => 'Zend\\Form\\Element\\Checkbox', 'attributes' => array('class' => 'form-control'), 'options' => array('label' => 'Test Center Administrator Statement', 'checked_value' => Statement::STATEMENT_AGREE, 'unchecked_value' => Statement::STATEMENT_DISAGREE)));
     $this->add(array('name' => 'trainingManagerStatement', 'type' => 'Zend\\Form\\Element\\Checkbox', 'attributes' => array('class' => 'form-control'), 'options' => array('label' => 'Training Manager Statement', 'checked_value' => Statement::STATEMENT_AGREE, 'unchecked_value' => Statement::STATEMENT_DISAGREE)));
     if (!$this->isAdminUser) {
         $this->add(array('type' => 'Zend\\Form\\Element\\Captcha', 'name' => 'captcha', 'attributes' => array('class' => 'form-control classCaptcha', 'required' => 'required'), 'options' => array('label' => 'Please verify you are human.', 'label_attributes' => array('class' => 'classCaptcha'), 'captcha' => array('class' => 'Image', 'options' => array('font' => APPLICATION_PATH . '/fonts/Arctik.ttf', 'width' => 200, 'height' => 100, 'dotNoiseLevel' => 90, 'lineNoiseLevel' => 3)))));
     }
     $this->add(array('name' => 'id', 'type' => 'Zend\\Form\\Element\\Hidden'));
     $this->add(array('name' => 'submit', 'type' => 'Zend\\Form\\Element\\Submit', 'attributes' => array('class' => 'btn btn-success', 'value' => 'Create')));
     $this->add(array('name' => 'reset', 'type' => 'Zend\\Form\\Element', 'attributes' => array('class' => 'btn btn-danger resetButton', 'value' => 'Reset', 'type' => 'button')));
 }
 /**
  * setup form
  * 
  * 
  * @access public
  * @param string $name ,default is null
  * @param array $options ,default is null
  */
 public function __construct($name = null, $options = null)
 {
     $this->query = $options['query'];
     unset($options['query']);
     parent::__construct($name, $options);
     $this->setAttribute('class', 'form form-inline');
     $this->setAttribute('method', 'GET');
     $this->add(array('name' => 'title', 'type' => 'Zend\\Form\\Element\\Text', 'attributes' => array('class' => 'form-control'), 'options' => array('label' => 'Title')));
     $this->add(array('name' => 'directUrl', 'type' => 'Zend\\Form\\Element\\Text', 'attributes' => array('class' => 'form-control'), 'options' => array('label' => 'Url')));
     $this->add(array('name' => 'type', 'type' => 'Zend\\Form\\Element\\Select', 'attributes' => array('class' => 'form-control'), 'options' => array('label' => 'Type', "value_options" => array(MenuItem::TYPE_PAGE => "Page", MenuItem::TYPE_DIRECT_URL => "Direct Url"), 'empty_option' => "All")));
     $this->add(array('name' => 'menu', 'type' => 'DoctrineModule\\Form\\Element\\ObjectSelect', 'attributes' => array('class' => 'form-control'), 'options' => array('label' => 'Menu', 'object_manager' => $this->query->setEntity('CMS\\Entity\\Menu')->entityManager, 'target_class' => 'CMS\\Entity\\Menu', 'property' => "title", 'find_method' => array('name' => 'findAll', 'params' => array()), 'display_empty_item' => true, 'empty_item_label' => "All")));
     $this->add(array('name' => 'status', 'type' => 'Zend\\Form\\Element\\Select', 'attributes' => array('class' => 'form-control'), 'options' => array('label' => 'Status', "value_options" => array(Status::STATUS_ACTIVE => Status::STATUS_ACTIVE_TEXT, Status::STATUS_INACTIVE => Status::STATUS_INACTIVE_TEXT), 'empty_option' => "All")));
     $this->add(array('name' => 'filter', 'type' => 'Zend\\Form\\Element\\Submit', 'attributes' => array('class' => 'btn btn-success', 'value' => 'Filter')));
     $this->add(array('name' => 'reset', 'type' => 'Zend\\Form\\Element', 'attributes' => array('class' => 'btn btn-danger resetButton', 'value' => 'Reset', 'type' => 'button')));
 }
Example #10
0
 /**
  * setup form
  * 
  * 
  * @access public
  * @param string $name ,default is null
  * @param array $options ,default is null
  */
 public function __construct($name = null, $options = null)
 {
     $this->query = $options['query'];
     unset($options['query']);
     parent::__construct($name, $options);
     $this->setAttribute('class', 'form form-horizontal');
     $this->add(array('name' => 'date', 'type' => 'Zend\\Form\\Element\\Date', 'attributes' => array('required' => 'required ', 'class' => 'form-control date', 'type' => 'text'), 'options' => array('label' => 'Exam Date', 'format' => Time::DATE_FORMAT), 'validators' => array('Courses\\Form\\TenDaysAfterValidator' => true)));
     $this->add(array('name' => 'studentsNo', 'type' => 'Zend\\Form\\Element\\Number', 'attributes' => array('required' => 'required', 'class' => 'form-control '), 'options' => array('label' => 'Students Number')));
     $this->add(array('name' => 'atcId', 'type' => 'DoctrineModule\\Form\\Element\\ObjectSelect', 'attributes' => array('required' => 'required', 'class' => 'form-control', 'multiple' => false), 'options' => array('label' => 'Authenticated Test Center', 'label_attributes' => array('class' => ' '), 'object_manager' => $this->query->entityManager, 'target_class' => 'Organizations\\Entity\\Organization', 'property' => 'type', 'empty_item_label' => self::EMPTY_SELECT_VALUE, 'display_empty_item' => true, 'label_generator' => function ($targetEntity) {
         return $targetEntity->getCommercialName();
     }, 'find_method' => array('name' => 'listOrganizations', 'params' => array('query' => $this->query, 'type' => \Organizations\Entity\Organization::TYPE_ATC)))));
     $this->add(array('name' => 'courseId', 'type' => 'DoctrineModule\\Form\\Element\\ObjectSelect', 'attributes' => array('required' => 'required', 'class' => 'form-control', 'multiple' => false), 'options' => array('label' => 'Course', 'label_attributes' => array('class' => ' '), 'object_manager' => $this->query->entityManager, 'target_class' => 'Courses\\Entity\\Course', 'property' => 'name', 'empty_item_label' => self::EMPTY_SELECT_VALUE, 'display_empty_item' => true, 'label_generator' => function ($targetEntity) {
         return $targetEntity->getName();
     })));
     $this->add(array('name' => 'Create', 'type' => 'Zend\\Form\\Element\\Submit', 'attributes' => array('class' => 'btn btn-success', 'value' => 'Book now!')));
 }
Example #11
0
 /**
  * setup form
  * 
  * 
  * @access public
  * @param string $name ,default is null
  * @param array $options ,default is null
  */
 public function __construct($name = null, $options = null)
 {
     $this->query = $options['query'];
     unset($options['query']);
     parent::__construct($name, $options);
     $this->setAttribute('class', 'form form-horizontal');
     $this->add(array('name' => 'title', 'type' => 'Zend\\Form\\Element\\Text', 'attributes' => array('required' => 'required', 'class' => 'form-control'), 'options' => array('label' => 'Title')));
     $this->add(array('name' => 'path', 'type' => 'Zend\\Form\\Element\\Text', 'attributes' => array('required' => 'required', 'class' => 'form-control'), 'options' => array('label' => 'Path')));
     $this->add(array('name' => 'type', 'type' => 'Zend\\Form\\Element\\Select', 'attributes' => array('class' => 'form-control', 'required' => 'required'), 'options' => array('label' => 'Type', "value_options" => array(PageTypes::PAGE_TYPE => PageTypes::PAGE_TYPE, PageTypes::PRESS_RELEASE_TYPE => PageTypes::PRESS_RELEASE_TYPE), 'empty_option' => self::EMPTY_SELECT_VALUE)));
     $this->add(array('name' => 'category', 'type' => 'Zend\\Form\\Element\\Select', 'attributes' => array('class' => 'form-control', 'required' => 'required'), 'options' => array('label' => 'Category', "value_options" => array(PageCategories::DEFAULT_CATEGORY => PageCategories::DEFAULT_CATEGORY), 'empty_option' => self::EMPTY_SELECT_VALUE)));
     $this->add(array('name' => 'author', 'type' => 'Zend\\Form\\Element\\Text', 'attributes' => array('required' => 'required', 'class' => 'form-control'), 'options' => array('label' => 'Author')));
     $this->add(array('name' => 'picture', 'type' => 'Zend\\Form\\Element\\File', 'attributes' => array('accept' => 'image/*'), 'options' => array('label' => '<p class="required">Picture</p> <p>Supported Extensions: gif,png,jpg,jpeg</p>', 'label_options' => array('disable_html_escape' => true))));
     $this->add(array('name' => 'summary', 'type' => 'Zend\\Form\\Element\\Textarea', 'attributes' => array('required' => 'required', 'class' => 'form-control', 'rows' => 3, 'cols' => 80), 'options' => array('label' => 'Summary')));
     $this->add(array('name' => 'body', 'type' => 'Zend\\Form\\Element\\Textarea', 'attributes' => array('required' => 'required', 'class' => 'form-control', 'rows' => 10, 'cols' => 80), 'options' => array('label' => 'Body')));
     $this->add(array('name' => 'id', 'type' => 'Zend\\Form\\Element\\Hidden'));
     $this->add(array('name' => FormButtons::SAVE_BUTTON, 'type' => 'Zend\\Form\\Element\\Submit', 'attributes' => array('class' => 'pull-left btn-inline btn btn-primary', 'value' => FormButtons::SAVE_BUTTON_TEXT)));
     $this->add(array('name' => FormButtons::SAVE_AND_PUBLISH_BUTTON, 'type' => 'Zend\\Form\\Element\\Submit', 'attributes' => array('class' => 'pull-left btn-inline btn btn-success', 'value' => FormButtons::SAVE_AND_PUBLISH_BUTTON_TEXT)));
     $this->add(array('name' => FormButtons::UNPUBLISH_BUTTON, 'type' => 'Zend\\Form\\Element\\Submit', 'attributes' => array('class' => 'pull-left btn-inline btn btn-warning', 'value' => FormButtons::UNPUBLISH_BUTTON_TEXT)));
     $this->add(array('name' => 'reset', 'type' => 'Zend\\Form\\Element', 'attributes' => array('class' => 'pull-left btn-inline btn btn-danger resetButton', 'value' => 'Reset', 'type' => 'button')));
 }
Example #12
0
 /**
  * setup form
  * 
  * 
  * @access public
  * @param string $name ,default is null
  * @param array $options ,default is null
  */
 public function __construct($name = null, $options = null)
 {
     $this->needAdminApproval = true;
     $this->query = $options['query'];
     unset($options['query']);
     $this->userId = $options['userId'];
     unset($options['userId']);
     parent::__construct($name, $options);
     // The form will hydrate an object of type "BlogPost"
     $this->setHydrator(new DoctrineHydrator($this->query->entityManager));
     $this->setAttribute('class', 'form form-horizontal');
     $this->add(array('name' => 'name', 'type' => 'Zend\\Form\\Element\\Text', 'attributes' => array('required' => 'required', 'class' => 'form-control'), 'options' => array('label' => 'Name')));
     // Add the outline fieldset
     $outlineFieldset = new OutlineFieldset($this->query, $this->isAdminUser);
     $this->add(array('type' => 'Zend\\Form\\Element\\Collection', 'name' => 'outlines', 'options' => array('count' => 1, 'label' => "Outline", 'should_create_template' => true, 'allow_add' => true, 'allow_remove' => true, 'template_placeholder' => '__outlineNumber__', 'target_element' => $outlineFieldset)));
     $this->add(array('name' => 'addMore', 'type' => 'Zend\\Form\\Element', 'attributes' => array('class' => 'btn btn-primary addMoreButton', 'value' => 'Add More', 'type' => 'button', 'onclick' => "addMoreOutline('#course_form_addMore')")));
     $this->add(array('name' => 'startDate', 'type' => 'Zend\\Form\\Element\\Date', 'attributes' => array('required' => 'required', 'class' => 'form-control date', 'type' => 'text'), 'options' => array('label' => 'Start Date', 'format' => Time::DATE_FORMAT)));
     $this->add(array('name' => 'endDate', 'type' => 'Zend\\Form\\Element\\Date', 'attributes' => array('required' => 'required', 'class' => 'form-control date', 'type' => 'text'), 'options' => array('label' => 'End Date', 'format' => Time::DATE_FORMAT)));
     $this->add(array('name' => 'capacity', 'type' => 'Zend\\Form\\Element\\Number', 'attributes' => array('required' => 'required', 'class' => 'form-control', 'min' => '1'), 'options' => array('label' => 'Capacity')));
     $this->add(array('name' => 'studentsNo', 'type' => 'Zend\\Form\\Element\\Number', 'attributes' => array('required' => 'required', 'class' => 'form-control', 'min' => '0'), 'options' => array('label' => 'Students Number')));
     $types = array(Organization::TYPE_ATP, Organization::TYPE_BOTH);
     $status = Status::STATUS_ACTIVE;
     $userIds = array();
     if ($this->isAdminUser === false) {
         $userIds[] = $this->userId;
     }
     $this->add(array('name' => 'atp', 'type' => 'DoctrineModule\\Form\\Element\\ObjectSelect', 'attributes' => array('required' => 'required', 'class' => 'form-control'), 'options' => array('label' => 'Authorized Training Partner', 'object_manager' => $this->query->entityManager, 'target_class' => 'Organizations\\Entity\\Organization', 'property' => 'commercialName', 'is_method' => false, 'find_method' => array('name' => 'getOrganizationsBy', 'params' => array('userIds' => $userIds, 'types' => $types, 'status' => $status)), 'empty_item_label' => self::EMPTY_SELECT_VALUE, 'display_empty_item' => true)));
     $this->add(array('name' => 'ai', 'type' => 'DoctrineModule\\Form\\Element\\ObjectSelect', 'attributes' => array('required' => 'required', 'class' => 'form-control'), 'options' => array('label' => 'Authorized Instructor', 'object_manager' => $this->query->entityManager, 'target_class' => 'Users\\Entity\\User', 'property' => 'fullName', 'is_method' => true, 'find_method' => array('name' => 'getUsers', 'params' => array("roles" => array(Role::INSTRUCTOR_ROLE))), 'empty_item_label' => self::EMPTY_SELECT_VALUE, 'display_empty_item' => true)));
     $this->add(array('name' => 'brief', 'type' => 'Zend\\Form\\Element\\Textarea', 'attributes' => array('required' => 'required', 'class' => 'form-control'), 'options' => array('label' => 'Brief')));
     $this->add(array('name' => 'time', 'type' => 'Zend\\Form\\Element\\Time', 'attributes' => array('placeholder' => 'Example: 10:10', 'required' => 'required', 'class' => 'form-control'), 'options' => array('label' => 'Time', 'format' => 'H:i')));
     $this->add(array('name' => 'duration', 'type' => 'Zend\\Form\\Element\\Number', 'attributes' => array('placeholder' => 'Duration is in days', 'required' => 'required', 'class' => 'form-control', 'min' => '1'), 'options' => array('label' => 'Duration')));
     if ($this->isAdminUser === true) {
         $this->add(array('name' => 'isForInstructor', 'type' => 'Zend\\Form\\Element\\Checkbox', 'attributes' => array('class' => 'form-control'), 'options' => array('label' => 'Train the Trainer course', 'checked_value' => Status::STATUS_ACTIVE, 'unchecked_value' => Status::STATUS_INACTIVE)));
         $this->add(array('name' => 'status', 'type' => 'Zend\\Form\\Element\\Checkbox', 'attributes' => array('class' => 'form-control'), 'options' => array('label' => 'Status', 'checked_value' => Status::STATUS_ACTIVE, 'unchecked_value' => Status::STATUS_INACTIVE)));
     }
     $this->add(array('name' => 'id', 'type' => 'Zend\\Form\\Element\\Hidden'));
     $this->add(array('name' => 'Create', 'type' => 'Zend\\Form\\Element\\Submit', 'attributes' => array('class' => 'btn btn-success', 'value' => 'Create')));
     $this->add(array('name' => 'reset', 'type' => 'Zend\\Form\\Element', 'attributes' => array('class' => 'btn btn-danger resetButton', 'value' => 'Reset', 'type' => 'button')));
 }
 /**
  * Bind an object to the form
  *
  * Ensures the object is populated with validated values.
  * 
  * @param  object $object
  * @param  int $flags ,default value is FormInterface::VALUES_NORMALIZED
  * @return mixed|void
  * @throws Exception\InvalidArgumentException
  */
 public function bind($object, $flags = FormInterface::VALUES_NORMALIZED)
 {
     parent::bind($object, $flags);
     // remove addMore button from edit form
     $this->remove("addMore");
 }
Example #14
0
 public function bind($object, $flags = FormInterface::VALUES_NORMALIZED)
 {
     parent::bind($object, $flags);
     //
     //        $users = $object->getOrganizationUsers();
     //
     //
     //
     $focalContactPerson = $object->getFocalContactPerson();
     if (isset($focalContactPerson->id) && $focalContactPerson != null) {
         $this->get('focalContactPerson_id')->setValue($focalContactPerson->id);
     }
 }