/**
  * Build a social profile object.
  *
  * <code>
  * $options = array(
  *    "social_platform" => "socialcommunity",
  *    "user_id" => 1
  * );
  *
  * $activityBuilder = new Prism\Integration\Activity\Builder($options);
  * $activityBuilder->build();
  *
  * $activity = $activityBuilder->getActivity();
  * </code>
  */
 public function build()
 {
     $type = ArrayHelper::getValue($this->config, 'social_platform');
     $userId = ArrayHelper::getValue($this->config, 'user_id');
     $url = ArrayHelper::getValue($this->config, 'url');
     $image = ArrayHelper::getValue($this->config, 'image');
     $title = ArrayHelper::getValue($this->config, 'title');
     switch ($type) {
         case 'socialcommunity':
             $activity = new SocialCommunity($userId);
             $activity->setUrl($url);
             $activity->setImage($image);
             break;
         case 'gamification':
             $activity = new Gamification($userId);
             $activity->setTitle($title);
             $activity->setUrl($url);
             $activity->setImage($image);
             break;
         case 'jomsocial':
             // Register JomSocial Router
             if (!class_exists('CRoute')) {
                 \JLoader::register('CRoute', JPATH_SITE . '/components/com_community/libraries/core.php');
             }
             $activity = new JomSocial($userId);
             $activity->setDb(\JFactory::getDbo());
             $app = ArrayHelper::getValue($this->config, 'app');
             $activity->setApp($app);
             break;
         case 'easysocial':
             $activity = new EasySocial($userId);
             $activity->setContextId($userId);
             break;
         default:
             $activity = null;
             break;
     }
     $this->activity = $activity;
 }
示例#2
0
 /**
  * Build a social profile object.
  *
  * <code>
  * $options = array(
  *    "social_platform" => "socialcommunity",
  *    "user_id" => 1
  * );
  *
  * $activityBuilder = new Prism\Integration\Activity\Builder($options);
  * $activityBuilder->build();
  *
  * $activity = $activityBuilder->getActivity();
  * </code>
  */
 public function build()
 {
     $type = ArrayHelper::getValue($this->config, "social_platform");
     $userId = ArrayHelper::getValue($this->config, "user_id");
     $url = ArrayHelper::getValue($this->config, "url");
     $image = ArrayHelper::getValue($this->config, "image");
     $title = ArrayHelper::getValue($this->config, "title");
     switch ($type) {
         case "socialcommunity":
             $activity = new SocialCommunity($userId);
             $activity->setUrl($url);
             $activity->setImage($image);
             break;
         case "gamification":
             $activity = new Gamification($userId);
             $activity->setTitle($title);
             $activity->setUrl($url);
             $activity->setImage($image);
             break;
         case "jomsocial":
             // Register JomSocial Router
             if (!class_exists("CRoute")) {
                 \JLoader::register("CRoute", JPATH_SITE . "/components/com_community/libraries/core.php");
             }
             $activity = new JomSocial($userId);
             $activity->setDb(\JFactory::getDbo());
             $app = ArrayHelper::getValue($this->config, "app");
             $activity->setApp($app);
             break;
         case "easysocial":
             $activity = new EasySocial($userId);
             $activity->setContextId($userId);
             break;
         default:
             $activity = null;
             break;
     }
     $this->activity = $activity;
 }