本文整理汇总了PHP中wiki_build_tree函数的典型用法代码示例。如果您正苦于以下问题:PHP wiki_build_tree函数的具体用法?PHP wiki_build_tree怎么用?PHP wiki_build_tree使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wiki_build_tree函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wiki_build_tree
/**
* Generate wiki's page tree
*
* @param page_wiki $page. A wiki page object
* @param navigation_node $node. Starting navigation_node
* @param array $keys. An array to store keys
* @return an array with all tree nodes
*/
function wiki_build_tree($page, $node, &$keys)
{
$content = array();
static $icon;
$icon = new pix_icon('f/odt', '');
$pages = wiki_get_linked_pages($page->id);
foreach ($pages as $p) {
$key = $page->id . ':' . $p->id;
if (in_array($key, $keys)) {
break;
}
array_push($keys, $key);
$l = wiki_parser_link($p);
$link = new moodle_url('/mod/wiki/view.php', array('pageid' => $p->id));
// navigation_node::get_content will format the title for us
$nodeaux = $node->add($p->title, $link, null, null, null, $icon);
if ($l['new']) {
$nodeaux->add_class('wiki_newentry');
}
wiki_build_tree($p, $nodeaux, $keys);
}
$content[] = $node;
return $content;
}
示例2: print_index_content
/**
* Prints the index page tab content
*
*
*/
private function print_index_content() {
global $OUTPUT;
$page = $this->page;
if ($page->timerendered + WIKI_REFRESH_CACHE_TIME < time()) {
$fresh = wiki_refresh_cachedcontent($page);
$page = $fresh['page'];
}
// navigation_node get_content calls format string for us
$node = new navigation_node($page->title);
$keys = array();
$tree = array();
$tree = wiki_build_tree($page, $node, $keys);
$table = new html_table();
$table->head = array(get_string('pageindex', 'wiki') . $OUTPUT->help_icon('pageindex', 'wiki'));
$table->attributes['class'] = 'wiki_editor generalbox';
$table->data[] = array($this->render_navigation_node($tree));
echo html_writer::table($table);
}