public function deletecategoryAction() { if ($datas = $this->getRequest()->getParams()) { try { // Test s'il y a un value_id if (empty($datas['value_id'])) { throw new Exception($this->_('An error occurred while saving')); } // Récupère l'option_value en cours $option_value = new Application_Model_Option_Value(); $option_value->find($datas['value_id']); $category = new Folder_Model_Category(); $category->find($datas['category_id']); $parent_id = $category->getParentId(); $category->delete(); $value_ids = array(); $option_value = new Application_Model_Option_Value(); $option_values = $option_value->findAll(array('a.app_id' => $this->getApplication()->getId()), 'position ASC'); foreach ($option_values as $option_value) { if ($option_value->getFolderId() or $option_value->getCode() == "folder") { continue; } $value_ids[] = $option_value->getId(); } $html = array('success' => 1, 'parent_id' => $parent_id, 'value_ids' => $value_ids); } catch (Exception $e) { $html = array('message' => $e->getMessage(), 'message_button' => 1, 'message_loader' => 1); } $this->getLayout()->setHtml(Zend_Json::encode($html)); } }