コード例 #1
0
/**
 * Outputs all nicknames owned by a specific username.
 *
 * @param  Zend_Gdata_Gapps $gapps    The service object to use for communicating with the Google
 *                                    Apps server.
 * @param  boolean          $html     True if output should be formatted for display in a web browser.
 * @param  string           $username The username whose nicknames should be displayed.
 * @return void
 */
function retrieveNicknames($gapps, $html, $username)
{
    if ($html) {
        echo "<h2>Registered Nicknames For {$username}</h2>\n";
    }
    $feed = $gapps->retrieveNicknames($username);
    if ($html) {
        echo "<ul>\n";
    }
    foreach ($feed as $nickname) {
        if ($html) {
            echo "  <li>";
        } else {
            echo "  * ";
        }
        echo $nickname->nickname->name;
        if ($html) {
            echo '</li>';
        }
        echo "\n";
    }
    if ($html) {
        echo "</ul>\n";
    }
}