diff --git a/Controller/SeoABTestsController.php b/Controller/SeoABTestsController.php index 17630d4..ccdb8f0 100644 --- a/Controller/SeoABTestsController.php +++ b/Controller/SeoABTestsController.php @@ -35,25 +35,30 @@ function admin_add() { if (!empty($this->data)) { $this->SeoABTest->clear(); if ($this->SeoABTest->save($this->data)) { - $this->Session->setFlash(__('The seo AB Test has been saved')); + $goodFlash = $this->_getViewObject()->elementExists('goodFlash') ? 'goodFlash' : 'default'; + $this->Session->setFlash(__('The seo AB Test has been saved'), $goodFlash); $this->redirect(array('action' => 'index')); } else { - $this->Session->setFlash(__('The seo AB Test could not be saved. Please, try again.')); + $badFlash = $this->_getViewObject()->elementExists('badFlash') ? 'badFlash' : 'default'; + $this->Session->setFlash(__('The seo AB Test could not be saved. Please, try again.'), $badFlash); } } } function admin_edit($id = null) { if (!$id && empty($this->data)) { - $this->Session->setFlash(__('Invalid seo AB Test')); + $badFlash = $this->_getViewObject()->elementExists('badFlash') ? 'badFlash' : 'default'; + $this->Session->setFlash(__('Invalid seo AB Test'), $badFlash); $this->redirect(array('action' => 'index')); } if (!empty($this->data)) { if ($this->SeoABTest->save($this->data)) { - $this->Session->setFlash(__('The seo AB Test has been saved')); + $goodFlash = $this->_getViewObject()->elementExists('goodFlash') ? 'goodFlash' : 'default'; + $this->Session->setFlash(__('The seo AB Test has been saved'), $goodFlash); $this->redirect(array('action' => 'index')); } else { - $this->Session->setFlash(__('The seo AB Test could not be saved. Please, try again.')); + $badFlash = $this->_getViewObject()->elementExists('badFlash') ? 'badFlash' : 'default'; + $this->Session->setFlash(__('The seo AB Test could not be saved. Please, try again.'), $badFlash); } } if (empty($this->data)) { @@ -64,14 +69,17 @@ function admin_edit($id = null) { function admin_delete($id = null) { if (!$id) { - $this->Session->setFlash(__('Invalid id for seo AB Test')); + $badFlash = $this->_getViewObject()->elementExists('badFlash') ? 'badFlash' : 'default'; + $this->Session->setFlash(__('Invalid id for seo AB Test'), $badFlash); $this->redirect(array('action'=>'index')); } if ($this->SeoABTest->delete($id)) { - $this->Session->setFlash(__('Seo AB Test deleted')); + $goodFlash = $this->_getViewObject()->elementExists('goodFlash') ? 'goodFlash' : 'default'; + $this->Session->setFlash(__('Seo AB Test deleted'), $goodFlash); $this->redirect(array('action'=>'index')); } - $this->Session->setFlash(__('Seo AB Test was not deleted')); + $badFlash = $this->_getViewObject()->elementExists('badFlash') ? 'badFlash' : 'default'; + $this->Session->setFlash(__('Seo AB Test was not deleted'), $badFlash); $this->redirect(array('action' => 'index')); } } diff --git a/Controller/SeoBlacklistsController.php b/Controller/SeoBlacklistsController.php index 69ea9dd..4c888aa 100644 --- a/Controller/SeoBlacklistsController.php +++ b/Controller/SeoBlacklistsController.php @@ -32,52 +32,63 @@ function admin_index($filter = null) { function admin_view($id = null) { if (!$id) { - $this->Session->setFlash(__('Invalid seo blacklist')); + $badFlash = $this->_getViewObject()->elementExists('badFlash') ? 'badFlash' : 'default'; + $this->Session->setFlash(__('Invalid seo blacklist'), $badFlash); $this->redirect(array('action' => 'index')); } $this->set('seoBlacklist', $this->SeoBlacklist->read(null, $id)); + $this->set('id', $id); } function admin_add() { if (!empty($this->data)) { $this->SeoBlacklist->clear(); if ($this->SeoBlacklist->save($this->data)) { - $this->Session->setFlash(__('The seo blacklist has been saved')); + $goodFlash = $this->_getViewObject()->elementExists('goodFlash') ? 'goodFlash' : 'default'; + $this->Session->setFlash(__('The seo blacklist has been saved'), $goodFlash); $this->redirect(array('action' => 'index')); } else { - $this->Session->setFlash(__('The seo blacklist could not be saved. Please, try again.')); + $badFlash = $this->_getViewObject()->elementExists('badFlash') ? 'badFlash' : 'default'; + $this->Session->setFlash(__('The seo blacklist could not be saved. Please, try again.'), $badFlash); } } } function admin_edit($id = null) { if (!$id && empty($this->data)) { - $this->Session->setFlash(__('Invalid seo blacklist')); + $badFlash = $this->_getViewObject()->elementExists('badFlash') ? 'badFlash' : 'default'; + $this->Session->setFlash(__('Invalid seo blacklist'), $badFlash); $this->redirect(array('action' => 'index')); } if (!empty($this->data)) { if ($this->SeoBlacklist->save($this->data)) { - $this->Session->setFlash(__('The seo blacklist has been saved')); + $goodFlash = $this->_getViewObject()->elementExists('goodFlash') ? 'goodFlash' : 'default'; + $this->Session->setFlash(__('The seo blacklist has been saved'), $goodFlash); $this->redirect(array('action' => 'index')); } else { - $this->Session->setFlash(__('The seo blacklist could not be saved. Please, try again.')); + $badFlash = $this->_getViewObject()->elementExists('badFlash') ? 'badFlash' : 'default'; + $this->Session->setFlash(__('The seo blacklist could not be saved. Please, try again.'), $badFlash); } } if (empty($this->data)) { $this->data = $this->SeoBlacklist->read(null, $id); } + $this->set('id', $id); } function admin_delete($id = null) { if (!$id) { - $this->Session->setFlash(__('Invalid id for seo blacklist')); + $badFlash = $this->_getViewObject()->elementExists('badFlash') ? 'badFlash' : 'default'; + $this->Session->setFlash(__('Invalid id for seo blacklist'), $badFlash); $this->redirect(array('action'=>'index')); } if ($this->SeoBlacklist->delete($id)) { - $this->Session->setFlash(__('Seo blacklist deleted')); + $goodFlash = $this->_getViewObject()->elementExists('goodFlash') ? 'goodFlash' : 'default'; + $this->Session->setFlash(__('Seo blacklist deleted'), $goodFlash); $this->redirect(array('action'=>'index')); } - $this->Session->setFlash(__('Seo blacklist was not deleted')); + $badFlash = $this->_getViewObject()->elementExists('badFlash') ? 'badFlash' : 'default'; + $this->Session->setFlash(__('Seo blacklist was not deleted'), $badFlash); $this->redirect(array('action' => 'index')); } } diff --git a/Controller/SeoCanonicalsController.php b/Controller/SeoCanonicalsController.php index 4972d31..adae496 100644 --- a/Controller/SeoCanonicalsController.php +++ b/Controller/SeoCanonicalsController.php @@ -16,52 +16,63 @@ function admin_index($filter = null) { function admin_view($id = null) { if (!$id) { - $this->Session->setFlash(__('Invalid seo canonical')); + $badFlash = $this->_getViewObject()->elementExists('badFlash') ? 'badFlash' : 'default'; + $this->Session->setFlash(__('Invalid seo canonical'), $badFlash); $this->redirect(array('action' => 'index')); } $this->set('seoCanonical', $this->SeoCanonical->read(null, $id)); + $this->set('id', $id); } function admin_add() { if (!empty($this->data)) { $this->SeoCanonical->clear(); if ($this->SeoCanonical->save($this->data)) { - $this->Session->setFlash(__('The seo canonical has been saved')); + $goodFlash = $this->_getViewObject()->elementExists('goodFlash') ? 'goodFlash' : 'default'; + $this->Session->setFlash(__('The seo canonical has been saved'), $goodFlash); $this->redirect(array('action' => 'index')); } else { - $this->Session->setFlash(__('The seo canonical could not be saved. Please, try again.')); + $badFlash = $this->_getViewObject()->elementExists('badFlash') ? 'badFlash' : 'default'; + $this->Session->setFlash(__('The seo canonical could not be saved. Please, try again.'), $badFlash); } } } function admin_edit($id = null) { if (!$id && empty($this->data)) { - $this->Session->setFlash(__('Invalid seo canonical')); + $badFlash = $this->_getViewObject()->elementExists('badFlash') ? 'badFlash' : 'default'; + $this->Session->setFlash(__('Invalid seo canonical'), $badFlash); $this->redirect(array('action' => 'index')); } if (!empty($this->data)) { if ($this->SeoCanonical->save($this->data)) { - $this->Session->setFlash(__('The seo canonical has been saved')); + $goodFlash = $this->_getViewObject()->elementExists('goodFlash') ? 'goodFlash' : 'default'; + $this->Session->setFlash(__('The seo canonical has been saved'), $goodFlash); $this->redirect(array('action' => 'index')); } else { - $this->Session->setFlash(__('The seo canonical could not be saved. Please, try again.')); + $badFlash = $this->_getViewObject()->elementExists('badFlash') ? 'badFlash' : 'default'; + $this->Session->setFlash(__('The seo canonical could not be saved. Please, try again.'), $badFlash); } } if (empty($this->data)) { $this->data = $this->SeoCanonical->read(null, $id); } + $this->set('id', $id); } function admin_delete($id = null) { if (!$id) { - $this->Session->setFlash(__('Invalid id for seo canonical')); + $badFlash = $this->_getViewObject()->elementExists('badFlash') ? 'badFlash' : 'default'; + $this->Session->setFlash(__('Invalid id for seo canonical'), $badFlash); $this->redirect(array('action'=>'index')); } if ($this->SeoCanonical->delete($id)) { - $this->Session->setFlash(__('Seo canonical deleted')); + $goodFlash = $this->_getViewObject()->elementExists('goodFlash') ? 'goodFlash' : 'default'; + $this->Session->setFlash(__('Seo canonical deleted'), $goodFlash); $this->redirect(array('action'=>'index')); } - $this->Session->setFlash(__('Seo canonical was not deleted')); + $badFlash = $this->_getViewObject()->elementExists('badFlash') ? 'badFlash' : 'default'; + $this->Session->setFlash(__('Seo canonical was not deleted'), $badFlash); $this->redirect(array('action' => 'index')); } } diff --git a/Controller/SeoMetaTagsController.php b/Controller/SeoMetaTagsController.php index cd0fe7f..09cc711 100644 --- a/Controller/SeoMetaTagsController.php +++ b/Controller/SeoMetaTagsController.php @@ -15,7 +15,8 @@ function admin_index($filter = null) { function admin_view($id = null) { if (!$id) { - $this->Session->setFlash(__('Invalid seo meta tag')); + $badFlash = $this->_getViewObject()->elementExists('badFlash') ? 'badFlash' : 'default'; + $this->Session->setFlash(__('Invalid seo meta tag'), $badFlash); $this->redirect(array('action' => 'index')); } $this->set('seoMetaTag', $this->SeoMetaTag->read(null, $id)); @@ -26,25 +27,30 @@ function admin_add() { if (!empty($this->data)) { $this->SeoMetaTag->clear(); if ($this->SeoMetaTag->save($this->data)) { - $this->Session->setFlash(__('The seo meta tag has been saved')); + $goodFlash = $this->_getViewObject()->elementExists('goodFlash') ? 'goodFlash' : 'default'; + $this->Session->setFlash(__('The seo meta tag has been saved'), $goodFlash); $this->redirect(array('action' => 'index')); } else { - $this->Session->setFlash(__('The seo meta tag could not be saved. Please, try again.')); + $badFlash = $this->_getViewObject()->elementExists('badFlash') ? 'badFlash' : 'default'; + $this->Session->setFlash(__('The seo meta tag could not be saved. Please, try again.'), $badFlash); } } } function admin_edit($id = null) { if (!$id && empty($this->data)) { - $this->Session->setFlash(__('Invalid seo meta tag')); + $badFlash = $this->_getViewObject()->elementExists('badFlash') ? 'badFlash' : 'default'; + $this->Session->setFlash(__('Invalid seo meta tag'), $badFlash); $this->redirect(array('action' => 'index')); } if (!empty($this->data)) { if ($this->SeoMetaTag->save($this->data)) { - $this->Session->setFlash(__('The seo meta tag has been saved')); + $goodFlash = $this->_getViewObject()->elementExists('goodFlash') ? 'goodFlash' : 'default'; + $this->Session->setFlash(__('The seo meta tag has been saved'), $goodFlash); $this->redirect(array('action' => 'index')); } else { - $this->Session->setFlash(__('The seo meta tag could not be saved. Please, try again.')); + $badFlash = $this->_getViewObject()->elementExists('badFlash') ? 'badFlash' : 'default'; + $this->Session->setFlash(__('The seo meta tag could not be saved. Please, try again.'), $badFlash); } } if (empty($this->data)) { @@ -55,14 +61,17 @@ function admin_edit($id = null) { function admin_delete($id = null) { if (!$id) { - $this->Session->setFlash(__('Invalid id for seo meta tag')); + $badFlash = $this->_getViewObject()->elementExists('badFlash') ? 'badFlash' : 'default'; + $this->Session->setFlash(__('Invalid id for seo meta tag'), $badFlash); $this->redirect(array('action'=>'index')); } if ($this->SeoMetaTag->delete($id)) { - $this->Session->setFlash(__('Seo meta tag deleted')); + $goodFlash = $this->_getViewObject()->elementExists('goodFlash') ? 'goodFlash' : 'default'; + $this->Session->setFlash(__('Seo meta tag deleted'), $goodFlash); $this->redirect(array('action'=>'index')); } - $this->Session->setFlash(__('Seo meta tag was not deleted')); + $badFlash = $this->_getViewObject()->elementExists('badFlash') ? 'badFlash' : 'default'; + $this->Session->setFlash(__('Seo meta tag was not deleted'), $badFlash); $this->redirect(array('action' => 'index')); } } diff --git a/Controller/SeoRedirectsController.php b/Controller/SeoRedirectsController.php index 9b60d06..ce3b681 100644 --- a/Controller/SeoRedirectsController.php +++ b/Controller/SeoRedirectsController.php @@ -15,7 +15,8 @@ function admin_index($filter = null) { function admin_view($id = null) { if (!$id) { - $this->Session->setFlash(__('Invalid seo redirect')); + $badFlash = $this->_getViewObject()->elementExists('badFlash') ? 'badFlash' : 'default'; + $this->Session->setFlash(__('Invalid seo redirect'), $badFlash); $this->redirect(array('action' => 'index')); } $this->set('seoRedirect', $this->SeoRedirect->read(null, $id)); @@ -26,25 +27,30 @@ function admin_add() { if (!empty($this->data)) { $this->SeoRedirect->clear(); if ($this->SeoRedirect->save($this->data)) { - $this->Session->setFlash(__('The seo redirect has been saved')); + $goodFlash = $this->_getViewObject()->elementExists('goodFlash') ? 'goodFlash' : 'default'; + $this->Session->setFlash(__('The seo redirect has been saved'), $goodFlash); $this->redirect(array('action' => 'index')); } else { - $this->Session->setFlash(__('The seo redirect could not be saved. Please, try again.')); + $badFlash = $this->_getViewObject()->elementExists('badFlash') ? 'badFlash' : 'default'; + $this->Session->setFlash(__('The seo redirect could not be saved. Please, try again.'), $badFlash); } } } function admin_edit($id = null) { if (!$id && empty($this->data)) { - $this->Session->setFlash(__('Invalid seo redirect')); + $badFlash = $this->_getViewObject()->elementExists('badFlash') ? 'badFlash' : 'default'; + $this->Session->setFlash(__('Invalid seo redirect'), $badFlash); $this->redirect(array('action' => 'index')); } if (!empty($this->data)) { if ($this->SeoRedirect->save($this->data)) { - $this->Session->setFlash(__('The seo redirect has been saved')); + $goodFlash = $this->_getViewObject()->elementExists('goodFlash') ? 'goodFlash' : 'default'; + $this->Session->setFlash(__('The seo redirect has been saved'), $goodFlash); $this->redirect(array('action' => 'index')); } else { - $this->Session->setFlash(__('The seo redirect could not be saved. Please, try again.')); + $badFlash = $this->_getViewObject()->elementExists('badFlash') ? 'badFlash' : 'default'; + $this->Session->setFlash(__('The seo redirect could not be saved. Please, try again.'), $badFlash); } } if (empty($this->data)) { @@ -55,14 +61,17 @@ function admin_edit($id = null) { function admin_delete($id = null) { if (!$id) { - $this->Session->setFlash(__('Invalid id for seo redirect')); + $badFlash = $this->_getViewObject()->elementExists('badFlash') ? 'badFlash' : 'default'; + $this->Session->setFlash(__('Invalid id for seo redirect'), $badFlash); $this->redirect(array('action'=>'index')); } if ($this->SeoRedirect->delete($id)) { - $this->Session->setFlash(__('Seo redirect deleted')); + $goodFlash = $this->_getViewObject()->elementExists('goodFlash') ? 'goodFlash' : 'default'; + $this->Session->setFlash(__('Seo redirect deleted'), $goodFlash); $this->redirect(array('action'=>'index')); } - $this->Session->setFlash(__('Seo redirect was not deleted')); + $badFlash = $this->_getViewObject()->elementExists('badFlash') ? 'badFlash' : 'default'; + $this->Session->setFlash(__('Seo redirect was not deleted'), $badFlash); $this->redirect(array('action' => 'index')); } } diff --git a/Controller/SeoStatusCodesController.php b/Controller/SeoStatusCodesController.php index 3857510..91e0a49 100644 --- a/Controller/SeoStatusCodesController.php +++ b/Controller/SeoStatusCodesController.php @@ -15,7 +15,8 @@ function admin_index($filter = null) { function admin_view($id = null) { if (!$id) { - $this->Session->setFlash(__('Invalid seo status code')); + $badFlash = $this->_getViewObject()->elementExists('badFlash') ? 'badFlash' : 'default'; + $this->Session->setFlash(__('Invalid seo status code'), $badFlash); $this->redirect(array('action' => 'index')); } $this->set('seoStatusCode', $this->SeoStatusCode->read(null, $id)); @@ -26,10 +27,12 @@ function admin_add() { if (!empty($this->data)) { $this->SeoStatusCode->clear(); if ($this->SeoStatusCode->save($this->data)) { - $this->Session->setFlash(__('The seo status code has been saved')); + $goodFlash = $this->_getViewObject()->elementExists('goodFlash') ? 'goodFlash' : 'default'; + $this->Session->setFlash(__('The seo status code has been saved'), $goodFlash); $this->redirect(array('action' => 'index')); } else { - $this->Session->setFlash(__('The seo status code could not be saved. Please, try again.')); + $badFlash = $this->_getViewObject()->elementExists('badFlash') ? 'badFlash' : 'default'; + $this->Session->setFlash(__('The seo status code could not be saved. Please, try again.'), $badFlash); } } $this->set('status_codes', $this->SeoStatusCode->findCodeList()); @@ -37,15 +40,18 @@ function admin_add() { function admin_edit($id = null) { if (!$id && empty($this->data)) { - $this->Session->setFlash(__('Invalid seo status code')); + $badFlash = $this->_getViewObject()->elementExists('badFlash') ? 'badFlash' : 'default'; + $this->Session->setFlash(__('Invalid seo status code'), $badFlash); $this->redirect(array('action' => 'index')); } if (!empty($this->data)) { if ($this->SeoStatusCode->save($this->data)) { - $this->Session->setFlash(__('The seo status code has been saved')); + $goodFlash = $this->_getViewObject()->elementExists('goodFlash') ? 'goodFlash' : 'default'; + $this->Session->setFlash(__('The seo status code has been saved'), $goodFlash); $this->redirect(array('action' => 'index')); } else { - $this->Session->setFlash(__('The seo status code could not be saved. Please, try again.')); + $badFlash = $this->_getViewObject()->elementExists('badFlash') ? 'badFlash' : 'default'; + $this->Session->setFlash(__('The seo status code could not be saved. Please, try again.'), $badFlash); } } if (empty($this->data)) { @@ -57,14 +63,17 @@ function admin_edit($id = null) { function admin_delete($id = null) { if (!$id) { - $this->Session->setFlash(__('Invalid id for seo status code')); + $badFlash = $this->_getViewObject()->elementExists('badFlash') ? 'badFlash' : 'default'; + $this->Session->setFlash(__('Invalid id for seo status code'), $badFlash); $this->redirect(array('action'=>'index')); } if ($this->SeoStatusCode->delete($id)) { - $this->Session->setFlash(__('Seo status code deleted')); + $goodFlash = $this->_getViewObject()->elementExists('goodFlash') ? 'goodFlash' : 'default'; + $this->Session->setFlash(__('Seo status code deleted'), $goodFlash); $this->redirect(array('action'=>'index')); } - $this->Session->setFlash(__('Seo status code was not deleted')); + $badFlash = $this->_getViewObject()->elementExists('badFlash') ? 'badFlash' : 'default'; + $this->Session->setFlash(__('Seo status code was not deleted'), $badFlash); $this->redirect(array('action' => 'index')); } } diff --git a/Controller/SeoTitlesController.php b/Controller/SeoTitlesController.php index ecf0579..c13474c 100644 --- a/Controller/SeoTitlesController.php +++ b/Controller/SeoTitlesController.php @@ -15,20 +15,24 @@ function admin_index($filter = null) { function admin_view($id = null) { if (!$id) { - $this->Session->setFlash(__('Invalid seo title')); + $badFlash = $this->_getViewObject()->elementExists('badFlash') ? 'badFlash' : 'default'; + $this->Session->setFlash(__('Invalid seo title'), $badFlash); $this->redirect(array('action' => 'index')); } $this->set('seoTitle', $this->SeoTitle->read(null, $id)); + $this->set('id', $id); } function admin_add() { if (!empty($this->data)) { $this->SeoTitle->clear(); if ($this->SeoTitle->save($this->data)) { - $this->Session->setFlash(__('The seo title has been saved')); + $goodFlash = $this->_getViewObject()->elementExists('goodFlash') ? 'goodFlash' : 'default'; + $this->Session->setFlash(__('The seo title has been saved'), $goodFlash); $this->redirect(array('action' => 'index')); } else { - $this->Session->setFlash(__('The seo title could not be saved. Please, try again.')); + $badFlash = $this->_getViewObject()->elementExists('badFlash') ? 'badFlash' : 'default'; + $this->Session->setFlash(__('The seo title could not be saved. Please, try again.'), $badFlash); } } $seoUris = $this->SeoTitle->SeoUri->find('list'); @@ -37,15 +41,18 @@ function admin_add() { function admin_edit($id = null) { if (!$id && empty($this->data)) { - $this->Session->setFlash(__('Invalid seo title')); + $badFlash = $this->_getViewObject()->elementExists('badFlash') ? 'badFlash' : 'default'; + $this->Session->setFlash(__('Invalid seo title'), $badFlash); $this->redirect(array('action' => 'index')); } if (!empty($this->data)) { if ($this->SeoTitle->save($this->data)) { - $this->Session->setFlash(__('The seo title has been saved')); + $goodFlash = $this->_getViewObject()->elementExists('goodFlash') ? 'goodFlash' : 'default'; + $this->Session->setFlash(__('The seo title has been saved'), $goodFlash); $this->redirect(array('action' => 'index')); } else { - $this->Session->setFlash(__('The seo title could not be saved. Please, try again.')); + $badFlash = $this->_getViewObject()->elementExists('badFlash') ? 'badFlash' : 'default'; + $this->Session->setFlash(__('The seo title could not be saved. Please, try again.'), $badFlash); } } if (empty($this->data)) { @@ -53,18 +60,22 @@ function admin_edit($id = null) { } $seoUris = $this->SeoTitle->SeoUri->find('list'); $this->set(compact('seoUris')); + $this->set('id', $id); } function admin_delete($id = null) { if (!$id) { - $this->Session->setFlash(__('Invalid id for seo title')); + $badFlash = $this->_getViewObject()->elementExists('badFlash') ? 'badFlash' : 'default'; + $this->Session->setFlash(__('Invalid id for seo title'), $badFlash); $this->redirect(array('action'=>'index')); } if ($this->SeoTitle->delete($id)) { - $this->Session->setFlash(__('Seo title deleted')); + $goodFlash = $this->_getViewObject()->elementExists('goodFlash') ? 'goodFlash' : 'default'; + $this->Session->setFlash(__('Seo title deleted'), $goodFlash); $this->redirect(array('action'=>'index')); } - $this->Session->setFlash(__('Seo title was not deleted')); + $badFlash = $this->_getViewObject()->elementExists('badFlash') ? 'badFlash' : 'default'; + $this->Session->setFlash(__('Seo title was not deleted'), $badFlash); $this->redirect(array('action' => 'index')); } } diff --git a/Controller/SeoUrisController.php b/Controller/SeoUrisController.php index c6d8b3b..17ca421 100644 --- a/Controller/SeoUrisController.php +++ b/Controller/SeoUrisController.php @@ -30,12 +30,14 @@ function admin_index($filter = null) { function admin_urlencode($id = null){ if($this->SeoUri->urlEncode($id)){ - $this->Session->setFlash("uri Successfully Url Encoded."); + $goodFlash = $this->_getViewObject()->elementExists('goodFlash') ? 'goodFlash' : 'default'; + $this->Session->setFlash("uri Successfully Url Encoded.", $goodFlash); } else { - $this->Session->setFlash("Erorr URL Encoding uri"); + $badFlash = $this->_getViewObject()->elementExists('badFlash') ? 'badFlash' : 'default'; + $this->Session->setFlash("Erorr URL Encoding uri", $badFlash); } - $this->redirect(array('action' => 'view', $id)); + $this->redirect(array('action' => 'edit', $id)); } function admin_view($id = null) { @@ -52,26 +54,31 @@ function admin_add() { $this->SeoUri->clear(); $this->clearAssociatesIfEmpty(); if ($this->SeoUri->saveAll($this->request->data)) { - $this->Session->setFlash(__('The seo uri has been saved')); + $goodFlash = $this->_getViewObject()->elementExists('goodFlash') ? 'goodFlash' : 'default'; + $this->Session->setFlash(__('The seo uri has been saved'), $goodFlash); $this->redirect(array('action' => 'index')); } else { - $this->Session->setFlash(__('The seo uri could not be saved. Please, try again.')); + $badFlash = $this->_getViewObject()->elementExists('badFlash') ? 'badFlash' : 'default'; + $this->Session->setFlash(__('The seo uri could not be saved. Please, try again.'), $badFlash); } } } function admin_edit($id = null) { if (!$id && empty($this->request->data)) { - $this->Session->setFlash(__('Invalid seo uri')); + $badFlash = $this->_getViewObject()->elementExists('badFlash') ? 'badFlash' : 'default'; + $this->Session->setFlash(__('Invalid seo uri'), $badFlash); $this->redirect(array('action' => 'index')); } if (!empty($this->request->data)) { $this->clearAssociatesIfEmpty(); if ($this->SeoUri->save($this->request->data)) { - $this->Session->setFlash(__('The seo uri has been saved')); + $goodFlash = $this->_getViewObject()->elementExists('goodFlash') ? 'goodFlash' : 'default'; + $this->Session->setFlash(__('The seo uri has been saved'), $goodFlash); $this->redirect(array('action' => 'index')); } else { - $this->Session->setFlash(__('The seo uri could not be saved. Please, try again.')); + $badFlash = $this->_getViewObject()->elementExists('badFlash') ? 'badFlash' : 'default'; + $this->Session->setFlash(__('The seo uri could not be saved. Please, try again.'), $badFlash); } } if (empty($this->request->data)) { @@ -83,19 +90,22 @@ function admin_edit($id = null) { function admin_delete($id = null) { if (!$id) { - $this->Session->setFlash(__('Invalid id for seo uri')); + $badFlash = $this->_getViewObject()->elementExists('badFlash') ? 'badFlash' : 'default'; + $this->Session->setFlash(__('Invalid id for seo uri'), $badFlash); $this->redirect(array('action'=>'index')); } if ($this->SeoUri->delete($id)) { - $this->Session->setFlash(__('Seo uri deleted')); + $goodFlash = $this->_getViewObject()->elementExists('goodFlash') ? 'goodFlash' : 'default'; + $this->Session->setFlash(__('Seo uri deleted'), $goodFlash); $this->redirect(array('action'=>'index')); } + $badFlash = $this->_getViewObject()->elementExists('badFlash') ? 'badFlash' : 'default'; $this->Session->setFlash(__('Seo uri was not deleted')); - $this->redirect(array('action' => 'index')); + $this->redirect(array('action' => 'index'), $badFlash); } function admin_approve($id = null){ - if(!$id) { + if(!$id) { $this->Session->setFlash(__('Invalid id for seo uri')); } elseif($this->SeoUri->setApproved($id)) { diff --git a/Controller/SeoUrlsController.php b/Controller/SeoUrlsController.php index 0f0a1e3..7bcee7c 100644 --- a/Controller/SeoUrlsController.php +++ b/Controller/SeoUrlsController.php @@ -40,29 +40,33 @@ function admin_edit($id = null) { } if (!empty($this->data)) { if ($this->SeoUrl->save($this->data)) { - $this->Session->setFlash(__('The seo url has been saved')); + $goodFlash = $this->_getViewObject()->elementExists('goodFlash') ? 'goodFlash' : 'default'; + $this->Session->setFlash(__('The seo url has been saved'), $goodFlash); $this->redirect(array('action' => 'index')); } else { - $this->Session->setFlash(__('The seo url could not be saved. Please, try again.')); + $badFlash = $this->_getViewObject()->elementExists('badFlash') ? 'badFlash' : 'default'; + $this->Session->setFlash(__('The seo url could not be saved. Please, try again.'), $badFlash); } } if (empty($this->data)) { - $this->data = $this->SeoUrl->findForViewById($id); + $this->data = $this->SeoUrl->findById($id); } - $this->set('status_codes', $this->SeoUrl->SeoStatusCode->findCodeList()); $this->set('id', $id); } function admin_delete($id = null) { if (!$id) { - $this->Session->setFlash(__('Invalid id for seo url')); + $badFlash = $this->_getViewObject()->elementExists('badFlash') ? 'badFlash' : 'default'; + $this->Session->setFlash(__('Invalid id for seo url'), $badFlash); $this->redirect(array('action'=>'index')); } if ($this->SeoUrl->delete($id)) { - $this->Session->setFlash(__('Seo url deleted')); + $goodFlash = $this->_getViewObject()->elementExists('goodFlash') ? 'goodFlash' : 'default'; + $this->Session->setFlash(__('Seo url deleted'), $goodFlash); $this->redirect(array('action'=>'index')); } - $this->Session->setFlash(__('Seo url was not deleted')); + $badFlash = $this->_getViewObject()->elementExists('badFlash') ? 'badFlash' : 'default'; + $this->Session->setFlash(__('Seo url was not deleted'), $badFlash); $this->redirect(array('action' => 'index')); }