예제 #1
0
 /**
  * Enter national phase, create new matters for a given matter with national phase options
  * *
  */
 public function nationalAction()
 {
     $this->_helper->layout->disableLayout();
     $matterModel = new Application_Model_Matter();
     if ($this->getRequest()->isPost()) {
         $this->_helper->viewRenderer->setNoRender();
         $form_data = $this->getRequest()->getPost('fdata');
         $matter_id = $this->getRequest()->getPost('matter_ID');
         $param = array_shift($form_data);
         $matter['caseref'] = $param['value'];
         $param = array_shift($form_data);
         $matter['category_code'] = $param['value'];
         $param = array_shift($form_data);
         $matter['origin'] = $param['value'];
         $matter['parent_ID'] = $matter_id;
         if ($matter['origin'] == '') {
             $matter['origin'] = null;
         }
         $current_matter = $matterModel->getMatter($matter_id);
         $matter['container_ID'] = $matterModel->getMatterContainer($matter_id);
         $matter['responsible'] = $current_matter[0]['responsible'];
         // print_r($form_data);exit();
         $m = 0;
         for ($i = 0; $i < count($form_data);) {
             if (substr($form_data[$i]['name'], 0, 3) == "dis") {
                 $i++;
             }
             $matter['country'] = $form_data[$i]['value'];
             $entered_date = $form_data[$i + 2]['value'];
             $result = $matterModel->child($matter);
             if ($result) {
                 $matterModel->childActors($matter_id, $result);
                 $matterModel->clonePriorities($matter_id, $result);
                 $matterModel->nationalPhaseEvents($matter_id, $result);
                 $matterModel->enteredEvent($result, $entered_date);
                 $m++;
             }
             $i += 3;
         }
         echo $m;
     } else {
         $category_id = $this->_getParam('category_id');
         $category_arr = explode('-', $category_id);
         $country_id = $this->_getParam('country');
         $country_arr = explode('-', $country_id);
         $caseref = $this->_getParam('caseref');
         if (!isset($category_arr[1])) {
             $category_arr[1] = "";
         }
         $this->view->country_options = $matterModel->getFlagCountries(strtolower($country_arr[1]));
         $this->view->category = $category_arr[0];
         $this->view->category_code = $category_arr[1];
         $this->view->country_name = $country_arr[0];
         $this->view->country_code = $country_arr[1];
         $this->view->username = $this->username;
         $this->view->caseref = $caseref;
     }
 }