本文整理汇总了PHP中common_node::moveToBin方法的典型用法代码示例。如果您正苦于以下问题:PHP common_node::moveToBin方法的具体用法?PHP common_node::moveToBin怎么用?PHP common_node::moveToBin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common_node
的用法示例。
在下文中一共展示了common_node::moveToBin方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mainAction
/**
* main action
*/
public function mainAction()
{
/**
* check input variables
*/
if (is_numeric($_POST['node_id'])) {
$node_id = $_POST['node_id'];
} else {
msg("node_bin: node_id is not numeric", 'error');
return false;
}
/**
* initialise Node object
*/
require_once 'models/common/common_node.php';
$Node = new common_node();
/**
* the request seems to be valid, try to bin the node
*/
if ($Node->moveToBin($node_id)) {
msg("Node (id={$node_id}) moved to Bin", 'ok');
} else {
msg("Cannot move Node (id={$node_id}) to Bin", 'error');
}
return true;
}
示例2: mainAction
/**
* main action
*/
public function mainAction()
{
require_once 'models/common/common_node.php';
$Node = new common_node();
if (is_numeric($this->GET['id'])) {
$delete_id = $this->GET['id'];
} else {
return false;
}
//delete
if ($this->GET['delete'] && is_numeric($delete_id)) {
$id_map = $Node->getIdMap();
/**
* create confirmation code
*/
$confirmation_code = md5($delete_id . session_id());
$this->tpl->assign('CONFIRMATION_CODE', $confirmation_code);
/**
* safety check we are not trying to delete some core page
*/
if (!array_search($delete_id, $id_map)) {
$node_data = $Node->detail($delete_id);
if (!is_array($node_data)) {
msg("Content ID {$delete_id} does not exists", 'error');
return false;
}
if ($this->GET['confirm']) {
//delete only if confirmation code match
if ($this->GET['confirm'] === $confirmation_code) {
if ($Node->moveToBin($delete_id)) {
msg("{$node_data['node_group']} \"{$node_data['title']}\" (id={$node_data['id']}) has been deleted");
//if it was a "page", than go to parent page
if ($this->GET['ajax'] == 0) {
if ($node_data['node_group'] == 'page') {
onxshopGoTo("/page/{$node_data['parent']}");
} else {
onxshopGoTo($_SESSION['last_diff'], 2);
}
}
} else {
msg("Can't delete!", 'error');
}
} else {
msg("node_delete: incorrect confirmation code", 'error');
}
} else {
//get children
$children = $Node->listing("parent = {$delete_id}");
foreach ($children as $child) {
$this->tpl->assign("CHILD", $child);
$this->tpl->parse('content.confirm.children.item');
}
if (count($children) > 0) {
$this->tpl->parse('content.confirm.children');
}
//get linked as shared content
$node_data = $Node->detail($delete_id);
$this->tpl->assign("NODE", $node_data);
$shared_linked = $Node->getShared($delete_id);
foreach ($shared_linked as $linked) {
$this->tpl->assign("LINKED", $linked);
$this->tpl->parse('content.confirm.linked.item');
}
if (count($shared_linked) > 0) {
$this->tpl->parse('content.confirm.linked');
}
$this->tpl->parse('content.confirm');
}
} else {
msg("This can't be deleted", 'error');
}
}
return true;
}