本文整理汇总了PHP中Navigation::remove方法的典型用法代码示例。如果您正苦于以下问题:PHP Navigation::remove方法的具体用法?PHP Navigation::remove怎么用?PHP Navigation::remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Navigation
的用法示例。
在下文中一共展示了Navigation::remove方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Navigation
function test_adding_node()
{
$n = new Navigation();
$blog_node = (object) array('data' => 'Blog', 'attr' => (object) array('id' => 'blog', 'sort' => 0));
/**
* Add blog page.
*/
$n->add($blog_node, 'index');
/**
* Should have second id now:
*
* index
* - blog
*/
$this->assertEquals($n->get_all_ids(), array('index', 'blog'));
// Remove and re-add index
$n->remove('index');
$this->assertEquals($n->get_all_ids(), array());
$n->add('index');
$index_node = $n->node('index');
$expected_index = (object) array('data' => 'Home', 'attr' => (object) array('id' => 'index', 'sort' => 0));
/*
* Should have index node with title 'Home' from the database.
*/
$this->assertEquals($expected_index, $index_node);
}
示例2: die
<?php
/**
* Removes a page from the navigation. Called via a hook from
* the page delete handler.
*/
if (!$this->internal) {
die('Must be called by another handler');
}
$n = new Navigation();
$n->remove($this->data['page'], false);
$n->save();
require_once 'apps/navigation/lib/Functions.php';
navigation_clear_cache();
示例3: array
$error = $nav->error;
}
break;
case 'move':
$id = $_POST['page'];
$ref = $_POST['ref'];
$pos = $_POST['pos'];
if ($nav->move($id, $ref, $pos) && $nav->save()) {
$out = array('msg' => sprintf('Page %s moved to %s %s.', $id, $pos, $ref), 'page' => $id, 'ref' => $ref, 'pos' => $pos);
} else {
$error = $nav->error;
}
break;
case 'remove':
$id = $_POST['page'];
if ($nav->remove($id) && $nav->save()) {
require_once 'apps/navigation/lib/Functions.php';
$ids = $nav->get_all_ids();
$out = array('msg' => sprintf('Page %s removed.', $id), 'page' => $id, 'other' => navigation_get_other_pages($ids));
} else {
$error = $nav->error;
}
break;
default:
$error = 'Unknown method';
break;
}
if (!$error) {
require_once 'apps/navigation/lib/Functions.php';
navigation_clear_cache();
}
示例4: foreach
}
if (!empty($out)) {
foreach ($out as $order => $id) {
$order = $order + 1;
if (!$objNavigation->updateOrder($id, $order)) {
$error[] = $id;
}
}
}
}
break;
case 'remove':
$id = $this->objUrl->get('id');
if (!empty($id)) {
$record = $objNavigation->getOne($id);
if (!empty($record) && $objNavigation->remove($id)) {
$links = $objNavigation->getRecords($record['type']);
if (empty($links)) {
echo json_encode(array('error' => false, 'message' => '<tr><td colspan="2">' . $this->objLanguage->labels[64] . '</td></tr>'));
} else {
echo json_encode(array('error' => false));
}
} else {
echo json_encode(array('error' => true));
}
} else {
echo json_encode(array('error' => true));
}
break;
}
} else {
开发者ID:joakinCC,项目名称:udemy.com-Multilingual-CMS-Website-with-PHP-MySQL-jQuery,代码行数:31,代码来源:navigation.php