예제 #1
0
 /**
  * Delete entries
  * 
  * @param  array|string $where SQL WHERE clause(s)
  * @return int|string
  */
 public function delete($user_id, $company_id)
 {
     $model_contact = new Client_Model_Contact();
     $data["acl_users_id"] = 0;
     $model_contact->update($data, 'acl_users_id = ' . (int) $user_id . ' and company_id =' . $company_id);
     //delete resource
     $table = $this->getTable();
     $table->delete('acl_users_id = ' . (int) $user_id . ' and companies_id =' . $company_id);
 }
예제 #2
0
 /**
  * EditAction for Contacts
  *
  * @return void
  */
 public function editAction()
 {
     $this->view->title = "Edit Contacts";
     $form = new Client_Form_Contact();
     if ($this->getRequest()->isPost()) {
         if ($form->isValid($this->getRequest()->getPost())) {
             $model = new Client_Model_Contact();
             $id = $this->getRequest()->getPost('id');
             $model->update($form->getValues(), 'id = ' . (int) $id);
             return $this->_helper->_redirector->gotoSimple('consult', 'client', 'client');
         } else {
             $form->populate($this->getRequest()->getPost());
         }
     } else {
         $id = $this->_getParam('id', 0);
         if ($id > 0) {
             $model = new Client_Model_Contact();
             $form->populate($model->fetchEntry($id));
         }
     }
     $this->view->form = $form;
 }