/** Edit a degree of wear
  * @access public
  * @return void
  * @throws Pas_Exception_Param
  */
 public function editdegreeofwearAction()
 {
     if ($this->getParam('id', false)) {
         $form = new DegreeOfWearForm();
         $form->details->setLegend('Edit degree of wear details');
         $form->submit->setLabel('Submit term detail changes');
         $this->view->form = $form;
         if ($this->_request->isPost()) {
             if ($form->isValid($this->_request->getPost())) {
                 $degrees = new WearTypes();
                 $where = array();
                 $where[] = $degrees->getAdapter()->quoteInto('id = ?', $this->getParam('id'));
                 $degrees->update($form->getValues(), $where);
                 $this->getFlash()->addMessage('Degree of wear: ' . $form->getValue('term') . ' updated!');
                 $this->redirect($this->_redirectUrl . 'degreesofwear');
             } else {
                 $this->getFlash()->addMessage($this->_formErrors);
                 $form->populate($this->_request->getPost());
             }
         } else {
             $id = (int) $this->_request->getParam('id', 0);
             if ($id > 0) {
                 $degrees = new WearTypes();
                 $degree = $degrees->fetchRow('id=' . $id);
                 if (count($degree)) {
                     $form->populate($degree->toArray());
                 } else {
                     throw new Pas_Exception_Param($this->_nothingFound);
                 }
             }
         }
     } else {
         throw new Pas_Exception_Param($this->_missingParameter, 500);
     }
 }