public function ajaxSalvarTagAction() { if (!$this->autenticacao(true)) { return; } $model = new Application_Model_EventoTags(); try { $id_tag = $this->_getParam('id', 0); $id_evento = $this->_getParam('id_evento', 0); $id = $model->insert(array('id_tag' => $id_tag, 'id_evento' => $id_evento)); if ($id > 0) { $this->view->ok = true; $this->view->msg = _("Tag added successfully."); } else { $this->view->ok = false; $this->view->error = _("An unexpected error ocurred while saving <b>tag</b>."); } } catch (Exception $e) { if ($e->getCode() == 23505) { $this->view->error = _("Tag already added."); } else { $this->view->error = _("An unexpected error ocurred while saving <b>tag</b>. Details: ") . $e->getMessage(); } $this->view->ok = false; } }