Example #1
0
function ryzom_app_render($title, $content, $style = '', $javascript = array(), $homeLink = false)
{
    $c = '';
    // get Lua code
    $c .= ryLua::get(RYZOM_IG);
    $at_end = ryLua::getEnd(RYZOM_IG);
    // Render header
    $title_prefix = '';
    if (ON_IPHONE) {
        $title_prefix = 'Ryzom - ';
    }
    if (!RYZOM_IG) {
        $c .= '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">' . "\n";
    }
    $c .= '<html><head>' . "\n";
    $c .= '		<title>' . $title_prefix . (translation_exists($title) ? _t($title) : $title) . '</title>' . "\n";
    if (!RYZOM_IG) {
        $c .= '		<meta HTTP-EQUIV="content-type" CONTENT="text/html; charset=UTF-8" />' . "\n";
    }
    $events = '';
    if (!RYZOM_IG) {
        $c .= ryzom_render_header();
        $c .= ryzom_render_header_www();
        if (function_exists('newrelic_get_browser_timing_header')) {
            $c .= newrelic_get_browser_timing_header();
        }
        if (ON_IPHONE) {
            $events = 'onorientationchange="updateOrientation();" ';
        }
    } else {
        #if (!$style)
        $style = 'bgcolor="#00000000"';
    }
    if (!RYZOM_IG) {
        // Javascript
        $js_code = '';
        if (is_string($javascript)) {
            $javascript = array($javascript);
        }
        foreach ($javascript as $js) {
            $js_code .= '		<script type="text/javascript" src="' . $js . '"></script>' . "\n";
        }
        $c .= $js_code;
    }
    $c .= '	</head>' . "\n";
    $c .= '	<body ' . $events . ' ' . $style . '>' . "\n";
    if (!RYZOM_IG) {
        $c .= ryzom_render_www(ryzom_render_window($title, $content, $homeLink));
        $c .= '</body>';
        if (function_exists('newrelic_get_browser_timing_header')) {
            $c .= newrelic_get_browser_timing_footer();
        }
    } else {
        $c .= $content . '<br /><table bgcolor="#000000"><tr><td>' . ryLogger::getInstance()->getLogs() . '</td></tr></table></body>';
    }
    $c .= '</html>' . $at_end;
    return $c;
}
        $content = render_character($xml, $key);
    } else {
        $title = 'Guild profile';
        $content = render_guild($xml);
    }
    ryzom_log_end();
} else {
    // Display the form to enter the API Key
    $title = 'Profile';
    $content = '<form action="" method="post">';
    $content .= 'Please enter the API Key (guild or character) that you can find on <a href="https://secure.ryzom.com/payment_profile">your profile page</a>:</br>';
    $content .= '<input type="text" name="key"><br/>';
    $content .= '<input type="submit" value="Submit" />';
    $content .= '</form>';
}
echo ryzom_render_www(ryzom_render_window($title, $content));
echo '</body></html>';
function render_guild($xml)
{
    $content = '<h1>' . $xml->name . '</h1>';
    $content .= '<ul>';
    $content .= '<li>Created: <b>' . ryzom_time_txt(ryzom_time_array($xml->creation_date, '')) . '</b></li>';
    $content .= '<li>Cult: <b>' . $xml->cult . '</b></li>';
    $content .= '<li>Civilization: <b>' . $xml->civ . '</b></li>';
    $guild_icon = ryzom_guild_icon_image($xml->icon, 'b');
    $guild_icon_small = ryzom_guild_icon_image($xml->icon, 's');
    $content .= "<li>Guild Icon: {$guild_icon} {$guild_icon_small}</li>";
    $content .= '</ul>';
    // read the members, then sort them by grade and name
    $result = $xml->xpath('/guild/members/*');
    $members = array();