FormGenerator.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. /*
  3. * To change this license header, choose License Headers in Project Properties.
  4. * To change this template file, choose Tools | Templates
  5. * and open the template in the editor.
  6. */
  7. class FormGenerator {
  8. private $eForm;
  9. public function __construct() {
  10. $this->eForm = e107::getForm();
  11. }
  12. public function ExcelGenerator() {
  13. $text = $this->eForm->open('ExcelGenerator', 'post', '', ['autocomplete' => 'off', 'class' => 'formclass'])
  14. . $this->eForm->label('<b>Number of qusetions to generate </b>') . '</br>'
  15. . $this->eForm->number('numberOfQuestions', 20, 2, ['min' => 1, 'max' => 160]) . '</br></br>'
  16. . $this->eForm->flipswitch('addition', 'on', ['on' => 'on', 'off' => 'off'])
  17. . $this->eForm->label('&nbsp;&nbsp;&nbsp;&nbsp;Addition') . '</br></br>'
  18. . $this->eForm->flipswitch('subtraction', 'on', ['on' => 'on', 'off' => 'off'])
  19. . $this->eForm->label('&nbsp;&nbsp;&nbsp;&nbsp;subtraction') . '</br></br>'
  20. . $this->eForm->flipswitch('multiplication', 'on', ['on' => 'on', 'off' => 'off'])
  21. . $this->eForm->label('&nbsp;&nbsp;&nbsp;&nbsp;multiplication') . '</br></br>'
  22. . $this->eForm->flipswitch('division', 'on', ['on' => 'on', 'off' => 'off'])
  23. . $this->eForm->label('&nbsp;&nbsp;&nbsp;&nbsp;division') . '</br></br>'
  24. . '<button type="submit" name="mode" value="Generate Sheet" id="getexcel" class="btn submit btn-success"><span>Generate Sheet</span></button>'
  25. . $this->eForm->close() . '</br></br>';
  26. return $text;
  27. }
  28. private function OldFractionsMulti($title,$q) {
  29. require_once( __DIR__ . '/fraction/src/Fraction.php');
  30. $this->FormattedQuestionForm .= e107::getForm()->label($title) . "\n";
  31. $this->FormattedQuestionForm .= '</br>';
  32. $this->FormattedQuestionForm .= e107::getForm()->label($nominator*$multiplier) . "<br/>\n";
  33. $this->FormattedQuestionForm .= "-------<br/>\n";
  34. $this->FormattedQuestionForm .= e107::getForm()->label($denominator*$multiplier) . "\n";
  35. $this->FormattedQuestionForm .= '</br></br>';
  36. $this->FormattedQuestionForm .= e107::getForm()->text('q1', '', 80, ['placeholder' => 'Write answer here!','autocomplete'=>"off"]) . "\n";
  37. $this->FormattedQuestionForm .= "-------<br/>\n";
  38. $this->FormattedQuestionForm .= e107::getForm()->text('q2', '', 80, ['placeholder' => 'Write answer here!','autocomplete'=>"off"]) . "\n";
  39. $this->FormattedQuestionForm .= e107::getForm()->hidden('a1', (int)($fract1->getNumerator())) . "\n";
  40. $this->FormattedQuestionForm .= e107::getForm()->hidden('a2', (int)($fract1->getDenominator())) . "\n";
  41. $this->FormattedQuestionForm .= e107::getForm()->hidden('qc1', 2) . "\n";
  42. $this->FormattedQuestionForm .= e107::getForm()->hidden('question', "Simplify " . $nominator*$multiplier . " over " . $denominator*$multiplier) . "\n";
  43. }
  44. }