function execute($params) { $action = $params->action; // intval() returns the integer value of var // on success, or 0 on failure $followerId = intval($params->followerId); $followingId = intval($params->followingId); if (empty($followerId) || empty($followingId) || empty($action)) { $message = "Bad input: missing required parameters."; $response = array("code" => 500, "message" => $message); return $response; } $userDao = new \com\indigloo\sc\dao\User(); $followingDBRow = $userDao->getOnLoginId($followingId); $followingName = $followingDBRow['name']; $followerDBRow = $userDao->getOnLoginId($followerId); $followerName = $followerDBRow['name']; $socialGraphDao = new \com\indigloo\sc\dao\SocialGraph(); $message = ""; $code = 200; switch ($action) { case UIConstants::FOLLOW_USER: $socialGraphDao->follow($followerId, $followerName, $followingId, $followingName); $message = sprintf("Success! You are following %s ", $followingName); break; case UIConstants::UNFOLLOW_USER: $socialGraphDao->unfollow($followerId, $followingId); $message = sprintf("Success! You are no longer following %s ", $followingName); break; default: break; } $response = array("code" => $code, "message" => $message); return $response; }
//sc/user/dashboard/following.php include 'sc-app.inc'; include APP_WEB_DIR . '/inc/header.inc'; include APP_WEB_DIR . '/inc/role/user.inc'; use com\indigloo\Util; use com\indigloo\Url; use com\indigloo\Configuration as Config; use com\indigloo\sc\auth\Login; use com\indigloo\ui\Filter; $gSessionLogin = \com\indigloo\sc\auth\Login::getLoginInSession(); $loginId = $gSessionLogin->id; $loginName = $gSessionLogin->name; if (is_null($loginId)) { trigger_error("Error : NULL login_id on user dashboard", E_USER_ERROR); } $socialGraphDao = new \com\indigloo\sc\dao\SocialGraph(); $followings = $socialGraphDao->getFollowing($loginId, 50); $total = sizeof($followings); ?> <!DOCTYPE html> <html> <head> <title> Following - <?php echo $loginName; ?> </title> <?php include APP_WEB_DIR . '/inc/meta.inc';
private function processGraph($params, $options, $source) { $pubUserId = Util::getArrayKey($params, "login_id"); $loginId = PseudoId::decode($pubUserId); $qparams = Url::getRequestQueryParams(); $userDao = new \com\indigloo\sc\dao\User(); $userDBRow = $userDao->getOnLoginId($loginId); $this->isValidUser($userDBRow); $socialGraphDao = new \com\indigloo\sc\dao\SocialGraph(); settype($source, "integer"); $graphDBRows = array(); $graphName = NULL; switch ($source) { case 1: $graphDBRows = $socialGraphDao->getFollowers($loginId, 50); $graphName = "followers"; break; case 2: $graphDBRows = $socialGraphDao->getFollowing($loginId, 50); $graphName = "followings"; break; default: trigger_error("unknown source for social graph", E_USER_ERROR); } $template = APP_WEB_DIR . '/view/user/graph.php'; //page variables $pageBaseUrl = "/pub/user/" . $pubUserId; $pageTitle = sprintf("%s of %s", $graphName, $userDBRow["name"]); $metaKeywords = SeoData::getHomeMetaKeywords(); $metaDescription = SeoData::getHomeMetaDescription(); include $template; }
include APP_WEB_DIR . '/inc/role/user.inc'; use com\indigloo\Util; use com\indigloo\Url; use com\indigloo\Configuration as Config; use com\indigloo\sc\auth\Login; use com\indigloo\ui\Filter; use com\indigloo\sc\html\SocialGraph as GraphHtml; $gSessionLogin = \com\indigloo\sc\auth\Login::getLoginInSession(); $loginId = $gSessionLogin->id; $loginName = $gSessionLogin->name; if (is_null($loginId)) { trigger_error("Error : NULL login_id on user dashboard", E_USER_ERROR); } $activityDao = new \com\indigloo\sc\dao\Activity(); $feedDataObj = $activityDao->getUserFeeds($loginId, 50); $socialGraphDao = new \com\indigloo\sc\dao\SocialGraph(); $followers = $socialGraphDao->getFollowers($loginId, 5); $followings = $socialGraphDao->getFollowing($loginId, 5); $options = array("ui" => "feed", "image" => true); $followersData = GraphHtml::getTable($loginId, $followers, 1, $options); $options = array("link" => "/user/dashboard/follower.php", "size" => sizeof($followers), "title" => "Followers"); $followersHtml = GraphHtml::getDashWrapper($followersData, $options); $options = array("ui" => "feed", "image" => true); $followingsData = GraphHtml::getTable($loginId, $followings, 2, $options); $options = array("link" => "/user/dashboard/following.php", "size" => sizeof($followings), "title" => "Followings"); $followingsHtml = GraphHtml::getDashWrapper($followingsData, $options); $htmlObj = new \com\indigloo\sc\html\Activity(); $activityHtml = $htmlObj->getHtml($feedDataObj); ?>
//sc/user/dashboard/following.php include 'sc-app.inc'; include APP_WEB_DIR . '/inc/header.inc'; include APP_WEB_DIR . '/inc/role/user.inc'; use com\indigloo\Util; use com\indigloo\Url; use com\indigloo\Configuration as Config; use com\indigloo\sc\auth\Login; $gSessionLogin = \com\indigloo\sc\auth\Login::getLoginInSession(); $loginId = $gSessionLogin->id; $loginName = $gSessionLogin->name; if (is_null($loginId)) { trigger_error("Error : NULL login_id on user dashboard", E_USER_ERROR); } $socialGraphDao = new \com\indigloo\sc\dao\SocialGraph(); $followers = $socialGraphDao->getFollowers($loginId, 50); $total = sizeof($followers); ?> <!DOCTYPE html> <html> <head> <title> followers of <?php echo $loginName; ?> </title> <?php include APP_WEB_DIR . '/inc/meta.inc';