PageRenderTime 33ms CodeModel.GetById 6ms RepoModel.GetById 0ms app.codeStats 0ms

/module/Education/src/Education/Form/EducationForm.php

https://gitlab.com/mnomansheikh/ampuz
PHP | 176 lines | 152 code | 11 blank | 13 comment | 2 complexity | 3badb9816ae7fe9321d0a52376c41ac7 MD5 | raw file
  1. <?php
  2. namespace Education\Form;
  3. use Zend\Form\Form;
  4. use zend\Db\Adapter\AdapterInterface;
  5. use zend\Db\ResultSet\ResultSet;
  6. class EducationForm extends Form
  7. {
  8. // protected $dbAdapter;
  9. public function __construct($Companies = null,$Regions=null,$Countries= null,$Indicators=null,$Frequencies = null,$DateField=null)
  10. {
  11. // we want to ignore the name passed
  12. parent::__construct('education');
  13. //$this->setAttribute("method", "post");
  14. $this->add(array(
  15. 'name' => 'education_id',
  16. 'type' => 'Hidden',
  17. ));
  18. $this->add(array(
  19. 'name' => 'category',
  20. 'type' => 'text',
  21. 'attributes' => array(
  22. 'value' => 'community'
  23. )
  24. ));
  25. $this->add(array(
  26. 'name' => 'area',
  27. 'type' => 'text',
  28. 'attributes' => array(
  29. 'value' => 'education'
  30. )
  31. ));
  32. $this->add(array(
  33. 'type' => 'Zend\Form\Element\Select',
  34. 'name' => 'company_id',
  35. 'options' => array(
  36. 'label' => 'Company',
  37. //'value_options' => $this->getOptionsForSelect(),
  38. 'value_options' => $Companies,
  39. ),
  40. 'attributes' => array(
  41. // 'value' => '1', //set selected to '1'
  42. 'class' => 'form-control',
  43. 'id' => 'company_form_id',
  44. )
  45. ));
  46. $this->add(array(
  47. 'type' => 'Zend\Form\Element\Select',
  48. 'name' => 'region_id',
  49. 'options' => array(
  50. 'label' => 'Country',
  51. //'value_options' => $this->getOptionsForSelect(),
  52. 'value_options' => $Regions,
  53. ),
  54. 'attributes' => array(
  55. // 'value' => '1', //set selected to '1'
  56. 'class' => 'form-control',
  57. 'id' => 'region_form_id',
  58. )
  59. ));
  60. $this->add(array(
  61. 'type' => 'Zend\Form\Element\Select',
  62. 'name' => 'country_id',
  63. 'options' => array(
  64. 'label' => 'Country',
  65. //'value_options' => $this->getOptionsForSelect(),
  66. 'value_options' => $Countries,
  67. ),
  68. 'attributes' => array(
  69. // 'value' => '1', //set selected to '1'
  70. 'class' => 'form-control',
  71. 'id' => 'country_form_id',
  72. )
  73. ));
  74. $this->add(array(
  75. 'type' => 'Zend\Form\Element\Select',
  76. 'name' => 'frequency_ids',
  77. 'options' => array(
  78. 'label' => 'Frequency',
  79. //'value_options' => $this->getOptionsForSelect(),
  80. 'value_options' => $Frequencies,
  81. ),
  82. 'attributes' => array(
  83. // 'value' => '1', //set selected to '1'
  84. 'class' => 'form-control',
  85. 'id' => 'frequency_form_ids',
  86. )
  87. ));
  88. $this->add(array(
  89. 'name' => 'frequency_name',
  90. 'type' => 'text',
  91. 'attributes' => array(
  92. 'readonly' => 'readonly',
  93. 'class' => 'form-control',
  94. 'id' => 'frequency_form_name',
  95. )
  96. ));
  97. $this->add(array(
  98. 'name' => 'frequency_id',
  99. 'type' => 'Hidden',
  100. 'attributes' => array(
  101. 'id' => 'frequency_form_id',
  102. )
  103. ));
  104. if($DateField != null){
  105. $this->add(
  106. $DateField
  107. );
  108. }
  109. $this->add(array(
  110. 'name' => 'month',
  111. 'type' => 'Hidden',
  112. 'attributes' => array(
  113. 'id' => 'month',
  114. )
  115. ));
  116. $this->add(array(
  117. 'name' => 'year',
  118. 'type' => 'Hidden',
  119. 'attributes' => array(
  120. 'id' => 'year',
  121. )
  122. ));
  123. $this->add(array(
  124. 'type' => 'Zend\Form\Element\Select',
  125. 'name' => 'type',
  126. 'options' => array(
  127. 'label' => 'Type',
  128. //'value_options' => $this->getOptionsForSelect(),
  129. 'value_options' => $Indicators,
  130. ),
  131. 'attributes' => array(
  132. /* 'value' => '1', //set selected to '1'*/
  133. 'class' => 'form-control',
  134. 'id' => 'indicator_form_id',
  135. )
  136. ));
  137. $this->add(array(
  138. 'name' => 'value',
  139. 'attributes' => array(
  140. 'class' => 'form-control',
  141. 'required' => 'required',
  142. ),
  143. ));
  144. $this->add(array(
  145. 'name' => 'submit',
  146. 'type' => 'Submit',
  147. 'attributes' => array(
  148. 'value' => 'Go',
  149. 'id' => 'submitbutton',
  150. 'class' => 'btn8 btn-8f btn-8 pull-right',
  151. ),
  152. ));
  153. $this->add(array(
  154. 'name' => 'cancel',
  155. 'type' => 'button',
  156. 'options'=>array(
  157. 'label'=>'Cancel'
  158. ),
  159. 'attributes' => array(
  160. 'onclick' => 'javascript:window.location.href = "/'._PROJECT_NAME_.'/public/education";',
  161. 'class' => 'btn8 btn-8f btn-8 pull-right',
  162. ),
  163. ));
  164. }
  165. }