/** * Execute the api call to get user app list. */ public function execute() { $list = Api_Bo_App::getApplicationListByUserId($this->getUserId()); $ret = array(); foreach ($list as $app) { $a = $app['RingsideApp']; $out = array_merge($app, $a); unset($out['RingsideApp']); $ret[] = $out; } $response = array(); if (!empty($ret)) { $response['apps'] = $ret; } return $response; }
/** * Returns an array of all app fbml blocks * formatted for display. * $location enum(narrow|wide) indicates the style to be used when fbml is returned * $arryExcludeAppNames is an array of app names which should not appear in the list * */ function getAllFormattedHtmlForUserOpenSocialApps($location = "narrow", $arryExcludeAppNames = null) { $userAppList = Api_Bo_App::getApplicationListByUserId($this->uid); $this->debug("******************** DUMPING OS userAppList for {$this->uid}" . " which is " . count($userAppList) . " apps"); $aggregateFbml = ""; $fbmlArry = array(); if (!empty($userAppList)) { foreach ($userAppList as $index => $appInfo1) { $appInfo = $appInfo1['RingsideApp']; $this->debug("Processing " . $appInfo['name'] . " " . $appInfo['app_id']); $this->debug("{$appInfo1}=" . var_export($appInfo1, true)); //$returnedFbml=$this->getFbmlForApp($appInfo1['app_id'],$this->uid); $app_id = $appInfo1['app_id']; $app_name = $appInfo['name']; $enabled = true; // Don't show this app if it is not open social if ($appInfo['canvas_type'] != 2) { $enabled = false; $this->debug("{$app_name} rejected as not open social."); } if ($enabled) { //$app_appBlock=$this->getFormatedFbmlFromAppName($app_name,$location,true,$returnedFbml); //$fbmlArry=array_merge($fbmlArry,$app_appBlock); $block = array("<div id='app-{$app_name}-header' class='wide_app_header'> "); $block[] = $app_name; //$block[]="<div style='float: right;' ><form id='formmove' name='formmove' method='post' ><input name='action' type='hidden' value='saveColChange'/><input name='appname' type='hidden' value='$app_name'/><a onClick='form.submit();' href=''> [move] </a></form></div>"; $block[] = "</div>"; $frameParams = $_REQUEST; $callbackQuery = http_build_query($frameParams); $owner_id = $_REQUEST['id']; if ($owner_id == '') { $owner_id = $this->uid; } // Get api_key $keyService = Api_ServiceFactory::create('KeyService'); $domainService = Api_ServiceFactory::create('DomainService'); $domainId = $domainService->getNativeIdByName('Ringside'); $app_keysArray = $keyService->getKeyset($app_id, $domainId); $app_keys = $app_keysArray; /* $app_keysArray=Api_Bo_App::getUsersAppKeys($this->uid,$app_id); $app_keys=$app_keysArray[0]; $this->debug(var_export($app_keysArray,true)); foreach($app_keysArray as $testApp_keys){ if($testApp_keys['network_id']==$socialApiKey){ $app_keys=$testApp_keys; } } $app_keys=$app_keysArray[0]; */ $this->debug("{$app_keys}=" . var_export($app_keys, true)); $social_session = new RingsideSocialSession(); $social_session->addApiSessionKey($app_keys['api_key'], $app_keys['secret']); $this->debug("Building Social Session with " . $app_keys['api_key'] . " and " . $app_keys['secret']); $osGadgetUrl = RingsideSocialConfig::$socialRoot . '/gadgets/ifr?view=profile&synd=ringside&fb_sig_api_key=' . $app_keys['api_key'] . '&fb_sig_owner_id=' . $owner_id . '&url=' . urlencode($appInfo['callback_url']) . '&social_session_key=' . $social_session->getSessionKey(); $this->debug("osGadgetUrl= {$osGadgetUrl}"); $block[] = '<iframe src="' . $osGadgetUrl . '" height="400" width="450"></iframe>'; $fbmlArry = array_merge($fbmlArry, $block); } } } return $fbmlArry; }