/**
  * Build a social profile object.
  *
  * <code>
  * $options = new Joomla\Registry\Registry(array(
  *    'platform' => 'socialcommunity',
  *    'user_id'  => 1,
  *    'title'    => 'Title...',
  *    'image'    => "http://mydomain.com/image.png",
  *    'url'      => "http://mydomain.com",
  *    'app'      => 'my_app'
  * ));
  *
  * $factory = new Prism\Integration\Activity\Factory($options);
  * $activity = $factory->create();
  * </code>
  */
 public function create()
 {
     $activity = null;
     switch ($this->options->get('platform')) {
         case 'socialcommunity':
             $activity = new Socialcommunity($this->options->get('user_id'));
             $activity->setUrl($this->options->get('url'));
             $activity->setImage($this->options->get('image'));
             break;
         case 'gamification':
             $activity = new Gamification($this->options->get('user_id'));
             $activity->setTitle($this->options->get('title'));
             $activity->setUrl($this->options->get('url'));
             $activity->setImage($this->options->get('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($this->options->get('user_id'));
             $activity->setApp($this->options->get('app'));
             break;
         case 'easysocial':
             $activity = new EasySocial($this->options->get('user_id'));
             $activity->setContextId($this->options->get('user_id'));
             break;
     }
     if ($activity !== null) {
         $activity->setDb(\JFactory::getDbo());
     }
     return $activity;
 }
 /**
  * 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;
 }
Beispiel #3
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;
 }