/** Delete a reference
  * @access public
  * @return void
  */
 public function deleteAction()
 {
     if ($this->getParam('id', false)) {
         if ($this->_request->isPost()) {
             $id = (int) $this->_request->getPost('id');
             $findID = (int) $this->_request->getPost('findID');
             $this->setController($this->_request->getPost('controller'));
             $this->setRedirect($this->getController());
             $del = $this->_request->getPost('del');
             if ($del == 'Yes' && $id > 0) {
                 $where = array();
                 $where[] = $this->_bibliography->getAdapter()->quoteInto('id = ?', $id);
                 $this->_bibliography->delete($where);
                 $this->getFlash()->addMessage('Reference deleted!');
                 $this->redirect($this->getRedirect() . 'record/id/' . $findID);
             }
         } else {
             $id = (int) $this->getParam('id');
             if ($id > 0) {
                 $this->view->id = $id;
                 $this->view->bib = $this->_bibliography->fetchFindBook($id, $this->getController());
             }
         }
     } else {
         throw new Pas_Exception_Param($this->_missingParameter, 500);
     }
 }
 public function configure()
 {
     $this->useFields(array('title'));
     $this->addPagerItems();
     $this->widgetSchema['title'] = new sfWidgetFormInputText();
     $this->widgetSchema->setNameFormat('searchBibliography[%s]');
     $this->validatorSchema['title'] = new sfValidatorString(array('required' => false, 'trim' => true));
     $choices = array_merge(array('' => ''), Bibliography::getAvailableTypes());
     $this->widgetSchema['type'] = new sfWidgetFormChoice(array('choices' => $choices));
     $this->validatorSchema['type'] = new sfValidatorChoice(array('required' => false, 'choices' => array_keys($choices)));
 }
 public function configure()
 {
     $this->useFields(array('title', 'type', 'abstract', 'year'));
     $this->validatorSchema['title'] = new sfValidatorString(array('required' => true, 'trim' => true));
     $this->widgetSchema['title']->setLabel('Full Bibliographic reference');
     $this->validatorSchema['year'] = new sfValidatorInteger(array('required' => false, 'min' => 0, 'max' => date('Y') + 2));
     $this->widgetSchema['year']->setAttributes(array('class' => 'small_size'));
     $choices = Bibliography::getAvailableTypes();
     $this->widgetSchema['type'] = new sfWidgetFormChoice(array('choices' => $choices));
     $this->validatorSchema['type'] = new sfValidatorChoice(array('required' => true, 'choices' => array_keys($choices)));
     $this->validatorSchema['Authors_holder'] = new sfValidatorPass();
     $this->widgetSchema['Authors_holder'] = new sfWidgetFormInputHidden(array('default' => 1));
     $this->loadEmbed('Authors');
     //force load of authors
 }
 /** Delete a reference
  */
 public function deleteAction()
 {
     if ($this->_getParam('id', false)) {
         if ($this->_request->isPost()) {
             $id = (int) $this->_request->getPost('id');
             $findID = (int) $this->_request->getPost('findID');
             $del = $this->_request->getPost('del');
             if ($del == 'Yes' && $id > 0) {
                 $bibs = new Bibliography();
                 $where = array();
                 $where = $bibs->getAdapter()->quoteInto('id = ?', $id);
                 $bibs->delete($where);
                 $this->_flashMessenger->addMessage('Reference deleted!');
                 $this->_redirect(self::REDIRECT . $findID);
             }
         } else {
             $id = (int) $this->_getParam('id');
             if ($id > 0) {
                 $this->view->id = $id;
                 $bibs = new Bibliography();
                 $this->view->bib = $bibs->fetchFindBook($id);
             }
         }
     } else {
         throw new Pas_Exception_Param($this->_missingParameter);
     }
 }