/**
  * Добавляем / изменяем публикацию
  *
  */
 public function addpublicationAction()
 {
     if (!$this->_rubric) {
         throw new Exception('rubric_id не определён');
     }
     $form = new Publications_Framework_Form($this->_rubric->table_name);
     if ($form->getElement('uniq_id') && $this->getParam('uniq_id')) {
         $form->getElement('uniq_id')->setValue($this->getParam('uniq_id'));
     }
     if ($publication_id = $this->getParam('publication_id')) {
         $this->view->publication_id = $publication_id;
         $editData = $this->_modelPublications->fetchRow($this->_modelPublications->select()->where('publication_id = ?', $publication_id))->toArray();
         $form->setDefaults($editData);
     }
     if ($route_id = $this->getParam('route_id')) {
         $this->view->route_id = $this->getParam('route_id');
     }
     if (!sizeof($_POST) || !$form->isValid($_POST)) {
         $this->view->form = $form;
     } else {
         $post = $form->getPostData();
         if ($route_id) {
             $post['route_id'] = $route_id;
         }
         if ($publication_id) {
             $this->_modelPublications->update($post, $this->_modelFields->getAdapter()->quoteInto('publication_id = ?', $publication_id));
         } else {
             $this->_modelPublications->insert($post);
         }
         $this->renderScript('admin/addPublicationComplete.ajax.phtml');
     }
 }