_form.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /**
  3. * This is the template for generating the form view for crud.
  4. * The following variables are available in this template:
  5. * - $ID: the primary key name
  6. * - $modelClass: the model class name
  7. * - $columns: a list of column schema objects
  8. */
  9. ?>
  10. <div class="form">
  11. <?php echo "<?php \$form=\$this->beginWidget('CActiveForm', array(
  12. 'id'=>'".$this->class2id($modelClass)."-form',
  13. 'enableAjaxValidation'=>false,
  14. )); ?>\n"; ?>
  15. <p class="note">Fields with <span class="required">*</span> are required.</p>
  16. <?php echo "<?php echo \$form->errorSummary(\$model); ?>\n"; ?>
  17. <?php
  18. foreach($columns as $column)
  19. {
  20. if($column->isPrimaryKey)
  21. continue;
  22. ?>
  23. <div class="row">
  24. <?php echo "<?php echo ".$this->generateActiveLabel($modelClass,$column)."; ?>\n"; ?>
  25. <?php echo "<?php echo ".$this->generateActiveField($modelClass,$column)."; ?>\n"; ?>
  26. <?php echo "<?php echo \$form->error(\$model,'{$column->name}'); ?>\n"; ?>
  27. </div>
  28. <?php
  29. }
  30. ?>
  31. <div class="row buttons">
  32. <?php echo "<?php echo CHtml::submitButton(\$model->isNewRecord ? 'Create' : 'Save'); ?>\n"; ?>
  33. </div>
  34. <?php echo "<?php \$this->endWidget(); ?>\n"; ?>
  35. </div><!-- form -->