Esempio n. 1
0
 /**
  * Generate documentation, in available formats.
  *
  * @return void
  **/
 public function generateAction()
 {
     $doc_data = array();
     $emod = new Default_Model_Error();
     $amod = new Default_Model_Action();
     $omod = new Default_Model_Output();
     $doc_data['actions'] = $amod->getAll();
     $doc_data['output-types'] = $omod->getAll();
     $doc_data['errors'] = $emod->getAll();
     $this->view->doc_data = $doc_data;
 }
 public function deleteAction()
 {
     $id = $this->getRequest()->getParam('id');
     if ($id === null) {
         $this->addErrorMessage('ID parameter is missing.');
         return;
     }
     $model = new Default_Model_Error();
     $model->delete($id);
     $this->addMessage('Error code deleted');
     $this->_redirect('/errors');
 }
Esempio n. 3
0
 public function deleteAction()
 {
     $id = $this->getRequest()->getParam('id');
     if ($id === null) {
         $this->addErrorMessage($this->tr->_('ACTION_MISSING_ID'));
         return;
     }
     $model = new Default_Model_Error();
     $model->delete($id);
     $this->addMessage($this->tr->_('ERROR_DELETE'));
     $this->_redirect('/errors');
 }
Esempio n. 4
0
 /**
  * Delete an error
  *
  * This is the delete error method. It allows you to delete an error.
  *
  * @return void
  */
 public function deleteAction()
 {
     $this->_helper->viewRenderer->setViewSuffix('txt');
     // The options we are accepting for deleting
     $options = new Zend_Console_Getopt(array('name|n=s' => $this->tr->_('NAME')));
     try {
         $options->parse();
     } catch (Zend_Console_Getopt_Exception $e) {
         $this->view->message = $e->getUsageMessage();
         return;
     }
     if ($options->name == '') {
         $this->view->message = $options->getUsageMessage();
         return;
     }
     $error_name = strtoupper($options->name);
     $model = new Default_Model_Error();
     $tempErrors = $model->getAll();
     $error_id = null;
     foreach ($tempErrors as $key => $value) {
         if ($error_name == strtoupper($value['name'])) {
             $error_id = $value['hash'];
             break;
         }
     }
     if (!$error_id) {
         $this->view->message = $this->tr->_('COULD_NOT_DELETE_ERROR') . ': ' . $error_name . '. ' . $this->tr->_('COULD_NOT_FIND_MATCH') . '.' . PHP_EOL;
         return;
     }
     try {
         $model->delete($error_id);
         $this->view->message = $this->tr->_('SUCCESS_DELETE_ERROR') . ': ' . $error_name . PHP_EOL;
     } catch (RuntimeException $e) {
         $this->view->message = $this->tr->_('ERROR_DELETING_ERROR') . ': ' . $error_name . '. ' . $e->getMessage() . PHP_EOL;
     }
 }
Esempio n. 5
0
    /**
     * Delete an error
     *
     * This is the delete error method. It allows you to delete an error.
     *
     * @return void
     */
    public function deleteAction()
    {
        $this->_helper->viewRenderer->setViewSuffix('txt');

        // The options we are accepting for deleting
        $options = new Zend_Console_Getopt(
            array(
                'name|n=s' => 'Name of the error.',
            )
        );

        try {
            $options->parse();
        } catch (Zend_Console_Getopt_Exception $e) {
            $this->view->message = $e->getUsageMessage();
            return;
        }
        if ($options->name == '') {
            $this->view->message = $options->getUsageMessage();
            return;
        }

        $error_name = strtoupper($options->name);
        $model      = new Default_Model_Error();
        $tempErrors = $model->getAll();
        $error_id   = null;
        foreach ($tempErrors as $key => $value) {
            if ($error_name == strtoupper($value['name'])) {
                $error_id = $value['hash'];
                break;
            }
        }

        if (!$error_id) {
            $this->view->message = 'Could not delete error: ' . $error_name . '. Could not find match.' . PHP_EOL;
            return;
        }

        try {
            $model->delete($error_id);
            $this->view->message = 'Successfully deleted error: ' . $error_name . PHP_EOL;
        } catch (RuntimeException $e) {
            $this->view->message = 'Error deleting errror: ' . $error_name . '. ' . $e->getMessage() . PHP_EOL;
        }
    }