Пример #1
0
 /**
  * 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"
  * ));
  *
  * $factory      = new Prism\Integration\Notification\Factory($options);
  * $notification = $factory->create();
  * </code>
  */
 public function create()
 {
     switch ($this->options->get('platform')) {
         case 'socialcommunity':
             $notification = new Socialcommunity($this->options->get('user_id'));
             $notification->setUrl($this->options->get('url'));
             $notification->setImage($this->options->get('image'));
             break;
         case 'gamification':
             $notification = new Gamification($this->options->get('user_id'));
             $notification->setTitle($this->options->get('title'));
             $notification->setUrl($this->options->get('url'));
             $notification->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');
             }
             $notification = new JomSocial($this->options->get('user_id'));
             break;
         case 'easysocial':
             $notification = new EasySocial($this->options->get('user_id'));
             break;
         default:
             $notification = null;
             break;
     }
     if ($notification !== null) {
         $notification->setDb(\JFactory::getDbo());
     }
     return $notification;
 }
Пример #2
0
 /**
  * Build a social profile object.
  *
  * <code>
  * $options = array(
  *    "social_platform" => "socialcommunity",
  *    "user_id" => 1
  * );
  *
  * $notificationBuilder = new Prism\Integration\Notification\Builder($options);
  * $notificationBuilder->build();
  *
  * $notification = $notificationBuilder->getNotification();
  * </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":
             $notification = new SocialCommunity($userId);
             $notification->setUrl($url);
             $notification->setImage($image);
             break;
         case "gamification":
             $notification = new Gamification($userId);
             $notification->setTitle($title);
             $notification->setUrl($url);
             $notification->setImage($image);
             break;
         case "jomsocial":
             // Register JomSocial Router
             if (!class_exists("CRoute")) {
                 \JLoader::register("CRoute", JPATH_SITE . "/components/com_community/libraries/core.php");
             }
             $notification = new JomSocial($userId);
             $notification->setDb(\JFactory::getDbo());
             break;
         case "easysocial":
             $notification = new EasySocial($userId);
             $notification->setDb(\JFactory::getDbo());
             break;
         default:
             $notification = null;
             break;
     }
     $this->notification = $notification;
 }
Пример #3
0
 /**
  * Build a social profile object.
  *
  * <code>
  * $options = array(
  *    "social_platform" => "socialcommunity",
  *    "user_id" => 1
  * );
  *
  * $notificationBuilder = new Prism\Integration\Notification\Builder($options);
  * $notificationBuilder->build();
  *
  * $notification = $notificationBuilder->getNotification();
  * </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':
             $notification = new SocialCommunity($userId);
             $notification->setUrl($url);
             $notification->setImage($image);
             break;
         case 'gamification':
             $notification = new Gamification($userId);
             $notification->setTitle($title);
             $notification->setUrl($url);
             $notification->setImage($image);
             break;
         case 'jomsocial':
             // Register JomSocial Router
             if (!class_exists('CRoute')) {
                 \JLoader::register('CRoute', JPATH_SITE . '/components/com_community/libraries/core.php');
             }
             $notification = new JomSocial($userId);
             $notification->setDb(\JFactory::getDbo());
             break;
         case 'easysocial':
             $notification = new EasySocial($userId);
             $notification->setDb(\JFactory::getDbo());
             break;
         default:
             $notification = null;
             break;
     }
     $this->notification = $notification;
 }