diff --git a/module/zahost/control.php b/module/zahost/control.php index b9d14fb277..34b668b25f 100644 --- a/module/zahost/control.php +++ b/module/zahost/control.php @@ -105,6 +105,45 @@ class zahost extends control $this->display(); } + + /** + * Delete host. + * + * @param int $assetID + * @param string $confirm + * @access public + * @return void + */ + public function delete($assetID, $confirm = 'no') + { + if($confirm == 'no') + { + die(js::confirm($this->lang->zahost->confirmDelete, inlink('delete', "assetID=$assetID&confirm=yes"))); + } + + $this->dao->update(TABLE_ASSET)->set('deleted')->eq(1)->where('id')->eq($assetID)->exec(); + $this->loadModel('action')->create('zahost', $assetID, 'deleted'); + + /* if ajax request, send result. */ + if($this->server->ajax) + { + if(dao::isError()) + { + $response['result'] = 'fail'; + $response['message'] = dao::getError(); + } + else + { + $response['result'] = 'success'; + $response['message'] = ''; + } + $this->send($response); + } + + if(isonlybody())die(js::reload('parent.parent')); + die(js::locate($this->createLink('zahost', 'browse'), 'parent')); + } + /** * Create template. * diff --git a/module/zahost/view/browse.html.php b/module/zahost/view/browse.html.php index 7d10ec2fd9..56dd45df45 100644 --- a/module/zahost/view/browse.html.php +++ b/module/zahost/view/browse.html.php @@ -72,7 +72,7 @@