generator.php 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <div class="row template sticky">
  2. <?php echo $this->labelEx($model,'template'); ?>
  3. <?php echo $this->dropDownList($model,'template',$templates); ?>
  4. <div class="tooltip">
  5. Please select which set of the templates should be used to generated the code.
  6. </div>
  7. <?php echo $this->error($model,'template'); ?>
  8. </div>
  9. <div class="buttons">
  10. <?php echo CHtml::submitButton('Preview',array('name'=>'preview')); ?>
  11. <?php if($model->status===CCodeModel::STATUS_PREVIEW && !$model->hasErrors()): ?>
  12. <?php echo CHtml::submitButton('Generate',array('name'=>'generate')); ?>
  13. <?php endif; ?>
  14. </div>
  15. <?php if(!$model->hasErrors()): ?>
  16. <div class="feedback">
  17. <?php if($model->status===CCodeModel::STATUS_SUCCESS): ?>
  18. <div class="success">
  19. <?php echo $model->successMessage(); ?>
  20. </div>
  21. <?php elseif($model->status===CCodeModel::STATUS_ERROR): ?>
  22. <div class="error">
  23. <?php echo $model->errorMessage(); ?>
  24. </div>
  25. <?php endif; ?>
  26. <?php if(isset($_POST['generate'])): ?>
  27. <pre class="results"><?php echo $model->renderResults(); ?></pre>
  28. <?php elseif(isset($_POST['preview'])): ?>
  29. <?php echo CHtml::hiddenField("answers"); ?>
  30. <table class="preview">
  31. <tr>
  32. <th class="file">Code File</th>
  33. <th class="confirm">
  34. <label for="check-all">Generate</label>
  35. <?php
  36. $count=0;
  37. foreach($model->files as $file)
  38. {
  39. if($file->operation!==CCodeFile::OP_SKIP)
  40. $count++;
  41. }
  42. if($count>1)
  43. echo '<input type="checkbox" name="checkAll" id="check-all" />';
  44. ?>
  45. </th>
  46. </tr>
  47. <?php foreach($model->files as $i=>$file): ?>
  48. <tr class="<?php echo $file->operation; ?>">
  49. <td class="file">
  50. <?php echo CHtml::link(CHtml::encode($file->relativePath), array('code','id'=>$i), array('class'=>'view-code','rel'=>$file->path)); ?>
  51. <?php if($file->operation===CCodeFile::OP_OVERWRITE): ?>
  52. (<?php echo CHtml::link('diff', array('diff','id'=>$i), array('class'=>'view-code','rel'=>$file->path)); ?>)
  53. <?php endif; ?>
  54. </td>
  55. <td class="confirm">
  56. <?php
  57. if($file->operation===CCodeFile::OP_SKIP)
  58. echo 'unchanged';
  59. else
  60. {
  61. $key=md5($file->path);
  62. echo CHtml::label($file->operation, "answers_{$key}")
  63. . ' ' . CHtml::checkBox("answers[$key]", $model->confirmed($file));
  64. }
  65. ?>
  66. </td>
  67. </tr>
  68. <?php endforeach; ?>
  69. </table>
  70. <?php endif; ?>
  71. </div>
  72. <?php endif; ?>