function built_index($page, $level)
    {
        global $CFG, $WS;
        //printed links array
        $printed_links = array();
        // dfwiki-block || course-block
        $dir = "";
        if ($this->instance->pagetype == "mod-wiki-view") {
            $dir = $CFG->wwwroot . '/mod/wiki/view.php?id=' . $WS->cm->id;
        } else {
            $dir = $CFG->wwwroot . '/course/view.php?id=' . $WS->cm->course;
        }
        //search in vector
        if (!in_array($page, $this->pagesel)) {
            //put in vector
            $this->pagesel[] = $page;
            //get last version
            if (!($pageinfo = wiki_page_last_version($page))) {
                //empty page
                //put in result
                return '<li class="wiki_listme">' . $this->images['square'] . format_text($this->trim_string($page, 20), FORMAT_PLAIN) . '<a href="' . $dir . '&amp;gid=' . $WS->groupmember->groupid . '&amp;uid=' . $WS->member->id . '&amp;page=' . urlencode($page) . '">?</a></li>';
            } else {
                //get links
                $links = wiki_internal_link_to_array($pageinfo->refs);
                $links = wiki_filter_section_links($links);
                //put in result
                if (count($links) == 0) {
                    $res = '<li class="wiki_listme">' . $this->images['square'] . '<a href="' . $dir . '&amp;gid=' . $WS->groupmember->groupid . '&amp;uid=' . $WS->member->id . '&amp;page=' . urlencode($page) . '">' . format_text($this->trim_string($page, 20), FORMAT_PLAIN) . '</a>' . '</li>';
                } else {
                    //determine if this level is opened or close
                    if ($level <= $this->levelsel) {
                        $display = '';
                        $image_ico = $this->images['minus'];
                    } else {
                        $display = 'display:none';
                        $image_ico = $this->images['plus'];
                    }
                    $res = '<li class="wiki_listme">' . $image_ico . '<a href="' . $dir . '&amp;gid=' . $WS->groupmember->groupid . '&amp;uid=' . $WS->member->id . '&amp;page=' . urlencode($page) . '">' . format_text($this->trim_string($page, 20), FORMAT_PLAIN) . '</a>
						<ul class="wiki_listme" style="margin:auto auto auto 15px;' . $display . '">';
                    //foreach link do recursive
                    foreach ($links as $link) {
                        //get real page name
                        $link = wiki_get_real_pagename($link);
                        //search in printed_links
                        if (!in_array($link, $printed_links)) {
                            //put in printed links
                            $printed_links[] = $link;
                            //mount
                            $res .= $this->built_index($link, $level + 1);
                        }
                    }
                    $res .= '</ul></li>';
                }
                //return result
                return $res;
            }
        } else {
            //page is already printed
            return '<li class="wiki_listme">' . $this->images['square'] . '<a href="' . $dir . '&amp;gid=' . $WS->groupmember->groupid . '&amp;uid=' . $WS->member->id . '&amp;page=' . urlencode($page) . '"><i>' . format_text($this->trim_string($page, 20), FORMAT_PLAIN) . '</i></a></li>';
        }
    }
 /**
  * return an array with the link in the page.
  * @param String $pagename
  * @return array of Strings
  */
 function get_wiki_page_goesto($pagename)
 {
     global $WS;
     $pagename = wiki_get_real_pagename($pagename);
     $res = array();
     if ($pageinfo = wiki_page_last_version($pagename)) {
         $res = wiki_internal_link_to_array($pageinfo->refs);
         $res = wiki_filter_section_links($res);
     }
     return $res;
 }