public function seticonAction() { if ($datas = $this->getRequest()->getPost()) { try { // Charge l'icône $icon = new Media_Model_Library_Image(); $icon->find($datas['icon_id']); // Test si l'option_value_id est passé en paramètre if (empty($datas['option_value_id'])) { throw new Exception($this->_('An error occurred while saving')); } if (empty($datas['icon_id'])) { throw new Exception($this->_('An error occurred while saving. The selected icon is not valid.')); } $icon_saved = $this->setIcon($datas['icon_id'], $datas['option_value_id']); if (!empty($icon_saved)) { // Charge l'option_value $option_value = new Application_Model_Option_Value(); $option_value->find($datas['option_value_id']); $icon_color = $this->getApplication()->getBlock('tabbar')->getImageColor(); $icon_url = $icon_saved['icon_url']; if ($icon->getCanBeColorized()) { $icon_url = $this->_getColorizedImage($icon->getImageId(), $option_value->getIconColor()); } $html = array('success' => 1, 'icon_id' => $icon->getId(), 'icon_url' => $icon_url, 'colored_icon_url' => $this->getUrl('template/block/colorize', array('id' => $option_value->getIconId(), 'color' => str_replace('#', '', $icon_color))), 'colored_header_icon_url' => $icon_saved['colored_header_icon_url']); } else { throw new Exception($this->_('An error occurred while saving')); } } catch (Exception $e) { $html = array('message' => $e->getMessage(), 'message_button' => 1, 'message_loader' => 1); } $this->_sendHtml($html); } }