From 9d2ac22f3005b868fa12a66f0af11d5cee7bb638 Mon Sep 17 00:00:00 2001 From: Cake Date: Tue, 26 Jan 2010 17:12:02 +0900 Subject: [PATCH] =?utf8?q?profile=5Ftype=E5=88=A4=E6=96=AD=E3=82=92helper?= =?utf8?q?=E5=87=A6=E7=90=86=E5=85=B1=E6=9C=89=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- app/controllers/profile_selects_controller.php | 6 +++++- app/controllers/profiles_controller.php | 12 +++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/app/controllers/profile_selects_controller.php b/app/controllers/profile_selects_controller.php index e3234b8..e87d279 100644 --- a/app/controllers/profile_selects_controller.php +++ b/app/controllers/profile_selects_controller.php @@ -123,7 +123,11 @@ class ProfileSelectsController extends AppController { $this->redirect(array('controller' => 'systems', 'action'=>'admin_index')); } - if ($profile['Profile']['profile_type'] != 'select' && $profile['Profile']['profile_type'] != 'm-select') { + App::import('Helper', 'Profiledisp'); + $Profiledisp = new ProfiledispHelper; + $Profiledisp->set_profile_type4view($profile['Profile']); + + if (!$Profiledisp->profile_type['is_select'] && !$Profiledisp->profile_type['is_checkbox']) { $this->Session->setFlash(__('Profile type is not valid.', true)); $this->redirect(array('controller' => 'profiles', 'action'=>'admin_edit', $profile['Profile']['id'])); } diff --git a/app/controllers/profiles_controller.php b/app/controllers/profiles_controller.php index f591dee..cc5b86a 100644 --- a/app/controllers/profiles_controller.php +++ b/app/controllers/profiles_controller.php @@ -89,13 +89,19 @@ class ProfilesController extends AppController { $this->Session->setFlash(__('The Profile has been saved', true)); // profile_tablesの削除 - if ($profile['Profile']['profile_type'] == 'table') { + App::import('Helper', 'Profiledisp'); + $Profiledisp = new ProfiledispHelper; + $Profiledisp->set_profile_type4view($profile['Profile']); + if ($Profiledisp->profile_type['is_table']) { $this->Profile->ProfileTable->deleteAll(array('ProfileTable.profile_id' => $id), true); } // profile_selectsの削除 - if (in_array($profile['Profile']['profile_type'], array('select', 'm-select')) && !in_array($this->data['Profile']['profile_type'], array('select', 'm-select'))) { - $this->Profile->ProfileSelect->deleteAll(array('ProfileSelect.profile_id' => $id), true); + if ($Profiledisp->profile_type['is_select']) { + $Profiledisp->set_profile_type4view($this->data['Profile']); + if (!$Profiledisp->profile_type['is_select']) { + $this->Profile->ProfileSelect->deleteAll(array('ProfileSelect.profile_id' => $id), true); + } } $this->redirect(array('controller' => 'systems', 'action'=>'admin_view', $profile['Profile']['system_id'])); } else { -- 2.11.0