* Finish task #68707.

This commit is contained in:
liyuchun
2022-09-15 11:29:24 +08:00
parent c3e0654651
commit a911a6e183
2 changed files with 40 additions and 1 deletions
+39
View File
@@ -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.
*
+1 -1
View File
@@ -72,7 +72,7 @@
<td><?php echo $host->registerDate;?></td>
<td class='c-actions'>
<?php common::printIcon('zahost', 'edit', "hostID={$host->hostID}", $host, 'list');?>
<?php if(common::hasPriv('zahost', 'delete')) echo html::a($this->createLink('zahost', 'delete', "hostID={$host->hostID}"), '<i class="icon-trash"></i>', 'hiddenwin', "title='{$lang->zahost->delete}' class='btn'");;?>
<?php if(common::hasPriv('zahost', 'delete')) echo html::a($this->createLink('zahost', 'delete', "hostID={$host->id}"), '<i class="icon-trash"></i>', 'hiddenwin', "title='{$lang->zahost->delete}' class='btn'");;?>
</td>
</tr>
<?php endforeach;?>