4ece841f0d8c3638cea023504a7efa145a37dcd6
Author: yandod
Date: 2009-12-26 18:33:57 +0900
diff --git a/app/controllers/enumerations_controller.php b/app/controllers/enumerations_controller.php
index 0ae043d..646eee8 100644
--- a/app/controllers/enumerations_controller.php
+++ b/app/controllers/enumerations_controller.php
@@ -23,27 +23,29 @@ class EnumerationsController extends AppController {
if ($this->Enumeration->save($this->data)) {
$this->Session->setFlash(__('Successful update.', true), 'default', array('class'=>'flash flash_notice'));
$this->redirect('index');
- }
+ }
}
$this->set('options',$this->Enumeration->OPTIONS);
$this->set('opt',$this->params['named']['opt']);
$this->render('new');
}
-#
-# def edit
-# @enumeration = Enumeration.find(params[:id])
-# end
-#
-# def update
-# @enumeration = Enumeration.find(params[:id])
-# if @enumeration.update_attributes(params[:enumeration])
-# flash[:notice] = l(:notice_successful_update)
+
+ function edit($id){
+ $enumeration = $this->Enumeration->findById($id);
+ $this->set('enumeration',$enumeration);
+ if ($this->data) {
+ $this->data['Enumeration']['id'] = $id;
+ if($this->Enumeration->save($this->data)) {
+ $this->Session->setFlash(__('Successful update.', true), 'default', array('class'=>'flash flash_notice'));
# redirect_to :action => 'list', :opt => @enumeration.opt
-# else
-# render :action => 'edit'
-# end
-# end
-#
+ $this->redirect('index');
+ } else {
+ $this->render('edit');
+ }
+ }
+ $this->data = $enumeration;
+ }
+
function move($id) {
$this->Enumeration->read(null, $id);
if(!empty($this->params['named']['position'])) {
diff --git a/app/views/enumerations/edit.ctp b/app/views/enumerations/edit.ctp
index 7baea02..2ef7cd5 100644
--- a/app/views/enumerations/edit.ctp
+++ b/app/views/enumerations/edit.ctp
@@ -1,10 +1,12 @@
-<h2><%=l(:label_enumerations)%></h2>
+<h2><?php __('Enumerations') ?></h2>
-<% form_tag({:action => 'update', :id => @enumeration}, :class => "tabular") do %>
- <%= render :partial => 'form' %>
- <%= submit_tag l(:button_save) %>
-<% end %>
+<?php echo $form->create('Enumeration',array('url' => array('action'=>'edit','id'=>$enumeration['Enumeration']['id']),'class'=>'tabular')); ?>
+ <?php echo $this->element('enumerations/_form',aa('opt',$enumeration['Enumeration']['opt'])) ?>
+ <?php echo $form->submit(__('Save',true)) ?>
+<?php echo $form->end(); ?>
-<% form_tag({:action => 'destroy', :id => @enumeration}) do %>
- <%= submit_tag l(:button_delete) %>
-<% end %>
\ No newline at end of file
+<?php
+echo $form->create(null, array('url'=>array('action'=>'destroy', 'id'=>$enumeration['Enumeration']['id']), 'class'=>'button_to'));
+echo $form->submit(__('Delete',true), array('onclick'=>'return confirm("'.__('Are you sure ?',true).'");', 'class'=>"button-small"));
+echo $form->end();
+?>
\ No newline at end of file
