コード例 #1
0
 /**
  * Actor is linked to Matter
  * an entry is inserted into matter_actor_lnk
  * *
  */
 public function addMatterActorAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender();
     if (!$this->getRequest()->isPost()) {
         return;
     }
     $data = array();
     $matterModel = new Application_Model_Matter();
     $matter_id = $this->getRequest()->getPost('matter_ID');
     $data['actor_ID'] = $this->getRequest()->getPost('actor_ID');
     $data['role'] = $this->getRequest()->getPost('role');
     $container_id = $matterModel->getMatterContainer($matter_id);
     $data['actor_ref'] = $this->getRequest()->getPost('actor_ref');
     $role_shareable = $this->getRequest()->getPost('role_shareable');
     $data['shared'] = $matterModel->isRoleShareable($data['role']);
     if ($this->getRequest()->getPost('add_container') && $container_id) {
         $data['matter_ID'] = $container_id;
         if ($role_shareable == 0) {
             $data['shared'] = 1;
         }
     } else {
         $data['matter_ID'] = $matter_id;
         $data['shared'] = 0;
     }
     $actor_info = $matterModel->getActorInfo($data['actor_ID']);
     $data['company_ID'] = $actor_info['company_ID'];
     $data['display_order'] = $matterModel->getNextDisplayOrder($matter_id, $container_id, $data['role']);
     $data['date'] = date('Y-m-d');
     $result = $matterModel->addMatterActor($data);
     if ($matterModel->getError()) {
         echo $matterModel->getError();
     }
     if ($result) {
         echo "Actor linked to the Matter";
     }
 }