public function testItemsGetInfoMultiNotThere() { $coreClient = new RingsideRestClient($this->fbClient); $coreClient->items_setInfo(123, 'http://localhost/foo.jpg', 'http://localhost/foo.html'); $coreClient->items_setInfo(345, 'http://localhost/bar.jpg', 'http://localhost/bar.html'); $info = $coreClient->items_getInfo(array(123, 234)); $this->assertTrue(is_array($info), "Expected an array of item info, got {$info}"); $this->assertEquals(1, sizeof($info)); $this->assertEquals('http://localhost/foo.jpg', $info[0]['url']); $this->assertEquals('http://localhost/foo.html', $info[0]['refurl']); }
function doEndTag($application, $parentHandler, $args) { $this->loadTopicsAndSuggestions($application); $lasttopic = ''; $count = 0; if (!empty($this->suggestions)) { $iids = array(); foreach ($this->suggestions as $suggestion) { $topic = $suggestion['topic']; if (!isset($args['topic']) || $args['topic'] == 'all' || $args['topic'] == $topic) { try { $names = $application->getClient()->users_getInfo($suggestion['uid'], "first_name"); $name = $names[0]; $firstname = $name['first_name']; } catch (Exception $e) { $firstname = 'Friend of Friend'; } // Checking for topic switches if ($topic != $lasttopic) { if ($count > 0) { echo '</table>'; } echo '<br />'; echo '<table border="0" width="500px" cellpadding="5">'; $colspan = isset($this->style) ? 3 : 2; echo ' <tr><td width="500px" colspan="' . $colspan . '" bgcolor="#f7931d">Topic: ' . $topic . '</td></tr>'; $lasttopic = $topic; } echo ' <tr>'; if (isset($this->style)) { $rest = new RingsideRestClient($application->getClient()); $iids[] = $suggestion['sid']; $rest->items_setInfo($suggestion['sid'], 'trail6', 'trail6', null); //Now get ratings $ratings = array(); if (count($iids) > 0) { $ratings = $rest->ratings_get($iids); if (!$ratings) { $ratings = array(); } } $yes = 'black'; $no = 'black'; foreach ($ratings as $rating) { $iid = $rating['iid']; if ($iid == $suggestion['sid']) { $vote = $rating['vote']; if ($vote == 1) { $yes = 'green'; } else { $no = 'red'; } } } $vote_string = '<a href="index.php?action=rate&vote=1&iid=' . $suggestion['sid'] . '"><font color="' . $yes . '">yes</font></a>|<a href="index.php?action=rate&vote=0&iid=' . $suggestion['sid'] . '"><font color="' . $no . '">no</font></a> '; echo ' <td width="5%" bgcolor="#eeeeee">' . $vote_string . '</td>'; } echo ' <td width="30%" bgcolor="#fdc589">' . $suggestion['suggestion'] . '</td>'; echo ' <td width="65%" bgcolor="#eeeeee">posted by ' . $firstname . ' at ' . $suggestion['created'] . '</td>'; echo ' </tr>'; $count++; } } } if ($count > 0) { echo '</table>'; } }
/** * Queries for a list of suggestions and then includes the list page * * @param int $topic Topic ID, optional parameter. */ function showSuggestions(RingsideRestClient $rest, $uid) { $friends = $rest->delegate->friends_get(); $friends[] = $uid; $suggestions = SuggestionUtils::getSuggestions($friends); // Now get ratings $iids = array(); foreach ($suggestions as $suggestion) { $iids[] = $suggestion['sid']; $rest->items_setInfo($suggestion['sid'], 'trail4', 'trail4', null); } $ratings = array(); if (sizeof($iids) > 0) { $ratings = $rest->ratings_get($iids); } include_once 'list.php'; }
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. ******************************************************************************/ require_once('ringside/core/client/RingsideRestClient.php'); require_once('config.php'); $server_url = "http://api.facebook.com/restserver.php"; $web_url = 'http://www.facebook.com'; try { require_once('ringside/api/clients/RingsideApiClients.php'); $fb = new RingsideApiClients($api_key, $secret, $web_url, $server_url); $ringside = new RingsideRestClient($fb->api_client); $loggedinuser = $fb->require_login(); $fb->api_client->friends_get(); $ringside->items_setInfo('testitem', RingsideRestClient::$server_url, 'http://'.$_SERVER['HTTP_HOST']); $item = $ringside->items_getInfo('testitem'); if ($item) { ?>Test Passed<? $ringside->items_remove('testitem'); } else { ?>Test FAILED<? } } catch ( Exception $e ) { ?>Test EXCEPTION<br><pre><?php echo $e->getMessage()."\n"; echo $e->getTraceAsString(); } ?></pre>