/** Edit an emperor
  * @access public
  * @return void
  * @throws Pas_Exception_Param
  */
 public function editemperorAction()
 {
     if ($this->getParam('id', false)) {
         $form = new EmperorForm();
         $form->submit->setLabel('Save Emperor\'s details');
         $form->details->setLegend('Biographical details');
         $this->view->form = $form;
         if ($this->_request->isPost()) {
             if ($form->isValid($this->_request->getPost())) {
                 $emperors = new Emperors();
                 $where = array();
                 $where[] = $emperors->getAdapter()->quoteInto('id = ?', $this->getParam('id'));
                 $emperors->update($form->getValues(), $where);
                 $this->getFlash()->addMessage('Issuer details for ' . $form->getValue('name') . ' updated!');
                 $this->redirect($this->_redirectUrl . 'emperorbios/');
             } else {
                 $this->getFlash()->addMessage($this->_formErrors);
                 $form->populate($this->_request->getPost());
             }
         } else {
             // find id is expected in $params['id']
             $id = (int) $this->_request->getParam('id', 0);
             if ($id > 0) {
                 $emperors = new Emperors();
                 $emperor = $emperors->fetchRow('id=' . $id);
                 if (count($emperor) > 0) {
                     $form->populate($emperor->toArray());
                 } else {
                     throw new Pas_Exception_Param($this->_nothingFound);
                 }
             }
         }
     } else {
         throw new Pas_Exception_Param($this->_missingParameter, 500);
     }
 }