Example #1
0
/**
 * Render the index for every page below the provided page
 * 
 * @param ElggObject $page
 * @return boolean
 */
function pages_tools_render_index(ElggObject $page)
{
    $result = false;
    if (!empty($page) && pages_tools_is_valid_page($page)) {
        if ($children = pages_tools_get_ordered_children($page)) {
            $result = "";
            foreach ($children as $child) {
                $result .= "<li>" . elgg_view("output/url", array("text" => $child->title, "href" => "#page_" . $child->getGUID(), "title" => $child->title));
                if ($child_index = pages_tools_render_index($child)) {
                    $result .= "<ul>" . $child_index . "</ul>";
                }
                $result .= "</li>";
            }
        }
    }
    return $result;
}
Example #2
0
/**
 * Render the index in the export for every page below the provided page
 *
 * @param ElggObject $page the page to render for
 *
 * @return false|string
 */
function pages_tools_render_index(ElggObject $page)
{
    if (!pages_tools_is_valid_page($page)) {
        return false;
    }
    $children = pages_tools_get_ordered_children($page);
    if (empty($children)) {
        return false;
    }
    $result = "";
    foreach ($children as $child) {
        $content = elgg_view("output/url", array("text" => $child->title, "href" => "#page_" . $child->getGUID(), "title" => $child->title));
        $child_index = pages_tools_render_index($child);
        if (!empty($child_index)) {
            $content .= elgg_format_element('ul', array(), $child_index);
        }
        $result .= elgg_format_element('li', array(), $content);
    }
    return $result;
}
Example #3
0
$page = get_entity($guid);
if (!pages_tools_is_valid_page($page)) {
    register_error(elgg_echo("InvalidParameterException:GUIDNotFound", array($guid)));
    forward(REFERER);
}
// this could take a while
set_time_limit(0);
// begin of output
$html = "";
// make index
if (!empty($include_index)) {
    $html .= "<h3>" . elgg_echo("pages_tools:export:index") . "</h3>";
    $html .= "<ul>";
    $html .= "<li>" . elgg_view("output/url", array("text" => $page->title, "href" => "#page_" . $page->getGUID(), "title" => $page->title)) . "</li>";
    // include subpages
    if (!empty($include_subpages) && ($sub_index = pages_tools_render_index($page))) {
        $html .= $sub_index;
    }
    $html .= "</ul>";
    $html .= "<p style='page-break-after:always;'></p>";
}
// print page
$html .= "<h3>" . elgg_view("output/url", array("text" => $page->title, "href" => false, "name" => "page_" . $page->getgUID())) . "</h3>";
$html .= elgg_view("output/longtext", array("value" => $page->description));
$html .= "<p style='page-break-after:always;'></p>";
// print subpages
if (!empty($include_subpages) && ($child_pages = pages_tools_render_childpages($page))) {
    $html .= $child_pages;
}
// load library
elgg_load_library("dompdf");