Changeset 263
- Timestamp:
- 06/24/07 08:10:24 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/script/generators/scaffold/templates/controller.php
r230 r263 6 6 <?php 7 7 if($model_name != $controller_name){ // if equal will be handled by the Akelos directly 8 echo " var \$models = '$singular_name'; ";8 echo " var \$models = '$singular_name';\n\n"; 9 9 } 10 10 ?> … … 41 41 } 42 42 } 43 <?php if($model_name != $controller_name){ ?> 44 45 function edit() 46 { 47 if(!empty($this->params['id'])){ 48 if(empty($this-><?php echo $singular_name?>->id) || $this-><?php echo $singular_name?>->id != $this->params['id']){ 49 $this-><?php echo $singular_name?> =& $this-><?php echo $model_name?>->find($this->params['id']); 50 } 51 }else{ 52 $this->redirectToAction('listing'); 53 } 54 55 if(!empty($this->params['<?php echo $singular_name?>'])){ 56 $this-><?php echo $singular_name?>->setAttributes($this->params['<?php echo $singular_name?>']); 57 if($this->Request->isPost() && $this-><?php echo $singular_name?>->save()){ 58 $this->flash['notice'] = $this->t('<?php echo $model_name?> was successfully updated.'); 59 $this->redirectTo(array('action' => 'show', 'id' => $this-><?php echo $singular_name?>->getId())); 60 } 61 } 62 } 63 <?php } else { ?> 43 64 44 65 function edit() … … 48 69 } 49 70 if(!empty($this->params['<?php echo $singular_name?>']) && !empty($this->params['id'])){ 50 <?php51 if($model_name != $controller_name){ // if equal will be handled by the Akelos directly52 ?>if(empty($this-><?php echo $singular_name?>->id) || $this-><?php echo $singular_name?>->id != $this->params['id']){53 $this-><?php echo $singular_name?> =& $this-><?php echo $model_name?>->find($this->params['id']);54 }<?php55 }56 ?>57 71 $this-><?php echo $singular_name?>->setAttributes($this->params['<?php echo $singular_name?>']); 58 72 if($this->Request->isPost() && $this-><?php echo $singular_name?>->save()){ … … 62 76 } 63 77 } 64 78 <?php } ?> 79 65 80 function destroy() 66 81 {
