function printFeed($feeds)
{
    foreach ($feeds as $feed) {
        echo '<li><a href="/feeds/' . $feed[1] . '">' . $feed[0] . '</a>';
        if (count($feed[2]) > 0) {
            echo '<ul style="list-style-image: url(\'/images/prototype/news/feed.gif\');">';
            printFeed($feed[2]);
            echo '</ul>';
        }
        echo '</li>';
    }
}
Beispiel #2
0
/**
 * Renders the page's HTML.
 *
 * @param Zend_OAuth_Token $token (optional) The user's current OAuth token.
 * @param array $feeds (optional) An array of Zend_Gdata_Feed to print
 *     information for.
 * @return void
 */
function renderHTML($token = null, $feeds = null)
{
    ?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset=utf-8 />
<link href="style.css" type="text/css" rel="stylesheet"/>
</head>
<body>
  <?php 
    if (!isset($_SESSION['ACCESS_TOKEN'])) {
        ?>
    <button onclick="location.href='<?php 
        echo "{$APP_URL}?action=request_token";
        ?>
';">Grant Access to this app!</button>
  <?php 
    } else {
        ?>
    <div id="token_info">
      <span style="float:left;"><img src="http://code.google.com/apis/accounts/images/oauth_icon.png"></span>
      <div id="token"><?php 
        printToken($token);
        ?>
</div>
    </div>
    <div id="logout"><a href="<?php 
        echo "{$APP_URL}?action=logout";
        ?>
">Logout</a></div>
    <div style="clear:both;">
      <div id="doclist">
        <h4>First 100 documents from the <a href="http://code.google.com/apis/documents/" target="_new">Documents List Data API</a>:</h4>
        <div class="feed"><?php 
        printFeed($feeds[0]);
        ?>
</div>
      </div>
      <div id="spreadsheets">
        <h4>First 100 spreadsheets from the <a href="http://code.google.com/apis/spreadsheets/" target="_new">Spreadsheets Data API</a>:</h4>
        <div class="feed"><?php 
        printFeed($feeds[1]);
        ?>
</div>
      </div>
    </div>
  <?php 
    }
    ?>
</body>
</html>
<?php 
}