예제 #1
0
 /**
  * adds a new classifier
  * *
  */
 public function addClassifierAction()
 {
     $this->_helper->layout->disableLayout();
     $matterModel = new Application_Model_Matter();
     if ($this->getRequest()->isPost()) {
         $this->_helper->viewRenderer->setNoRender();
         $post_data = $this->getRequest()->getPost();
         foreach ($post_data as $key => $data) {
             if ($data == "") {
                 unset($post_data[$key]);
             }
         }
         if (!$post_data['matter_ID'] || !$post_data['type_code']) {
             echo "false";
             return;
         }
         if (!isset($post_data['value_ID'])) {
             $cvs = $matterModel->getClassifierValues($post_data['type_code']);
             if (count($cvs) > 0) {
                 $data = array('value' => $post_data['value'], 'type_code' => $post_data['type_code'], 'notes' => $post_data['notes']);
                 $post_data['value_ID'] = $matterModel->addClassifierValue($data);
             }
         }
         $matterModel = new Application_Model_Matter();
         $result = $matterModel->addClassifier($post_data);
         if ($matterModel->getError()) {
             echo $matterModel->getError();
         } else {
             echo $result;
         }
     } else {
         $this->view->type_code = $this->_getParam('type_code');
         $this->view->classifier_types = $matterModel->getClassifierTypes();
     }
 }