CCodeForm.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. /**
  3. * CCodeForm class file.
  4. *
  5. * @author Qiang Xue <qiang.xue@gmail.com>
  6. * @link http://www.yiiframework.com/
  7. * @copyright 2008-2013 Yii Software LLC
  8. * @license http://www.yiiframework.com/license/
  9. */
  10. /**
  11. * CCodeForm represents the form for collecting code generation parameters.
  12. *
  13. * @author Qiang Xue <qiang.xue@gmail.com>
  14. * @package system.gii
  15. * @since 1.1.2
  16. */
  17. class CCodeForm extends CActiveForm
  18. {
  19. /**
  20. * @var CCodeModel the code model associated with the form
  21. */
  22. public $model;
  23. /**
  24. * Initializes the widget.
  25. * This renders the form open tag.
  26. */
  27. public function init()
  28. {
  29. echo <<<EOD
  30. <div class="form gii">
  31. <p class="note">
  32. Fields with <span class="required">*</span> are required.
  33. Click on the <span class="sticky">highlighted fields</span> to edit them.
  34. </p>
  35. EOD;
  36. parent::init();
  37. }
  38. /**
  39. * Runs the widget.
  40. */
  41. public function run()
  42. {
  43. $templates=array();
  44. foreach($this->model->getTemplates() as $i=>$template)
  45. $templates[$i]=basename($template).' ('.$template.')';
  46. $this->renderFile(Yii::getPathOfAlias('gii.views.common.generator').'.php',array(
  47. 'model'=>$this->model,
  48. 'templates'=>$templates,
  49. ));
  50. parent::run();
  51. echo "</div>";
  52. }
  53. }