Beispiel #1
0
 public function deleteAction()
 {
     $this->_helper->viewRenderer->setNoRender();
     $this->_helper->getHelper('layout')->disableLayout();
     if ($this->getRequest()->isPost()) {
         $id = $this->_getParam('id', 0);
         $addressDb = new Contacts_Model_DbTable_Address();
         $addressDb->deleteAddress($id);
     }
     //$this->_flashMessenger->addMessage('MESSAGES_SUCCESFULLY_DELETED');
 }
Beispiel #2
0
 public function addAction()
 {
     $data = array();
     $data['created'] = $this->_date;
     $data['createdby'] = $this->_user['id'];
     $data['clientid'] = $this->_user['clientid'];
     $contactDb = new Contacts_Model_DbTable_Contact();
     $id = $contactDb->addContact($data);
     $addressDb = new Contacts_Model_DbTable_Address();
     $client = Zend_Registry::get('Client');
     //Primary Address
     $data = array();
     $data['contactid'] = $id;
     $data['type'] = 'primaryAddress';
     $data['country'] = $client['country'];
     $data['clientid'] = $this->_user['clientid'];
     $data['created'] = $this->_date;
     $addressDb->addAddress($data);
     //Shipping Address
     $data = array();
     $data['contactid'] = $id;
     $data['type'] = 'shippingAddress';
     $data['country'] = $client['country'];
     $data['clientid'] = $this->_user['clientid'];
     $data['created'] = $this->_date;
     $addressDb->addAddress($data);
     //Create contact folder if does not already exists
     if (!file_exists(BASE_PATH . '/files/contacts/' . $id . '/')) {
         mkdir(BASE_PATH . '/files/contacts/' . $id . '/');
         chmod(BASE_PATH . '/files/contacts/' . $id . '/', 0777);
     }
     $this->_helper->redirector->gotoSimple('edit', 'contact', null, array('id' => $id));
 }